I would like to create a script to switch between two shortcuts profile in XFCE in a way that I could change the shortcuts layout without restarting the session.

I know that shortcuts are in ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml and I made two copies with wanted shortcuts layout.

Swapping files in ~/.config/xfce4/xfconf/xfce-perchannel-xml are not enough.

Shortcuts have been updated only after full reboot (log out and in was not enough).

Is there any command which updates shortcuts in session (Window Manager somehow doing it without restarting session)?

1 Answer 1


You can use xfconf-query. Example:

xfconf-query -c xfce4-keyboard-shortcuts -p '/commands/custom/<Primary><Alt>x' -s mousepad

xfconf-query -c xfce4-keyboard-shortcuts -p '/commands/custom/<Primary><Alt>x' -s xfce4-terminal

The first command sets ctrlaltx to mousepad, and the second switches it to xfce4-terminal.

You can find the path for these commands in xfce4-settings-editor. The left hand menu is -c i.e. Channel. Then you have the Property -p which you can get by clicking on an item under a channel and clicking the Edit button at the bottom. Then the -s is the same as --set.

For your script, you can query which command is set with:

xfconf-query -c xfce4-keyboard-shortcuts -p '/commands/custom/<Primary><Alt>x'


~$ xfconf-query -c xfce4-keyboard-shortcuts -p '/commands/custom/<Primary><Alt>x'

Your script can look something like this with the xfconf-query commands for each keyboard shortcut listed out.


status=$(xfconf-query -c xfce4-keyboard-shortcuts -p '/commands/custom/<Primary><Alt>x')

if [ "$status" == "xfce4-terminal" ]; then
    # profile 1
    xfconf-query -c xfce4-keyboard-shortcuts -p '/commands/custom/<Primary><Alt>x' -s mousepad
    # etc
    # etc
    # profile 2
    xfconf-query -c xfce4-keyboard-shortcuts -p '/commands/custom/<Primary><Alt>x' -s xfce4-terminal
    # etc
    # etc

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .