1

I need to change the name of a workspace on a remote machine. I've looked at the documentation for xfconf-query and I've managed to list the workspace names using

xfconf-query -c xfwm4 -p /general/workspace_names

The result begins with

Value is an array with 13 items:

I also grep'd for a file that contained one of my workspace names and I found ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfwm4.xml but when I edit the file and change one of the workspace names, then open the workspaces gui, it still has the same old value. And yet, if I change the workspace name in the gui then open ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfwm4.xml - the workspace has been updated with the new workspace name.

I've done a lot of searching on this and nothing I can find tells me how to specify which item in the array I want to change - and what I want to change it to. If someone out there knows how to do this, could you just post an example like

xfconf-query -c xfwm4 -p /general/workspace_names -o(ld) old_name -n(ew) new_name

1 Answer 1

0

I couldn't find a command line utility to do this specifically. Using xfconf-query the names for all workspaces must be specified since /general/workspace_names is an array as your output indicates. A Bash script may help with this.

$ cat xfwm4-set-workspace-name
#!/bin/bash

# usage: xfwm4-set-workspace-name [number name]...

_OLD_IFS=$IFS IFS=$'\n'
ws_count=$(xfconf-query -c xfwm4 -p /general/workspace_count)
ws_names=($(xfconf-query -c xfwm4 -p /general/workspace_names | tail -n+3))
IFS=$_OLD_IFS

declare -i ws_number

while [ $# -gt 0 ]; do
    ws_number=$1
    shift

    if [ $ws_number -lt 1 -o $ws_number -gt $ws_count ]; then
        echo warning: invalid workspace number 2>/dev/null
        shift
        continue
    fi

    if [ $# -eq 0 ]; then
        echo warning: no workspace name specified 2>/dev/null
        break
    fi

    ws_name=$1
    shift
    ws_names[$((ws_number - 1))]=$ws_name
done

declare -a xfconf_sets

for i in ${!ws_names[@]}; do
    xfconf_sets+=(-s "${ws_names[$i]}")
done

xfconf-query -c xfwm4 -p /general/workspace_names "${xfconf_sets[@]}"
$ ./xfwm4-set-workspace-name 2 'ws two' 3 'workspace three'

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.