Xfce Forum

Sub domains
 

You are not logged in.

#1 2023-06-01 09:43:56

bradwiggo
Member
Registered: 2021-06-29
Posts: 15

Having issues assigning XFWM shortcuts using xfconf-query

I'm trying to make a script that will initalise xfce to my settings, using xfconf-query. It seems to be working fine for most things, but I'm having an issue with the XFWM keyboard shortcuts.

Basically I want tile up, down, left right to be mapped to up down left right arrow keys, and then top left etc mapped to page up/down and home/end, as on my laptop those are mapped to fn + arrow keys.

The issue I'm having is using the following set of xfconf commands:

xfconf-query -c xfce4-keyboard-shortcuts -p "/xfwm4/custom" -r -R # To reset any other changes 
xfconf-query -c xfce4-keyboard-shortcuts -np '/xfwm4/custom/<Super>Up' -t 'string' -s 'tile_up_key'
xfconf-query -c xfce4-keyboard-shortcuts -np '/xfwm4/custom/<Super>Down' -t 'string' -s 'tile_down_key'
xfconf-query -c xfce4-keyboard-shortcuts -np '/xfwm4/custom/<Super>Right' -t 'string' -s 'tile_right_key'
xfconf-query -c xfce4-keyboard-shortcuts -np '/xfwm4/custom/<Super>Left' -t 'string' -s 'tile_left_key'
xfconf-query -c xfce4-keyboard-shortcuts -np '/xfwm4/custom/<Super>End' -t 'string' -s 'tile_up_right_key'
xfconf-query -c xfce4-keyboard-shortcuts -np '/xfwm4/custom/<Super>Page_Down' -t 'string' -s 'tile_down_right_key'
xfconf-query -c xfce4-keyboard-shortcuts -np '/xfwm4/custom/<Super>Page_Up' -t 'string' -s 'tile_up_left_key'
xfconf-query -c xfce4-keyboard-shortcuts -np '/xfwm4/custom/<Super>Home' -t 'string' -s 'tile_down_left_key'

If I run these commands, none of the keys will work. If I run

xfconf-query -c xfce4-keyboard-shortcuts -lv | grep "xfwm4/custom/<Super>"

then this is the output:

/xfwm4/custom/<Super>Down                  tile_down_key
/xfwm4/custom/<Super>End                   tile_up_right_key
/xfwm4/custom/<Super>Home                  tile_down_left_key
/xfwm4/custom/<Super>Left                  tile_left_key
/xfwm4/custom/<Super>Page_Down             tile_down_right_key
/xfwm4/custom/<Super>Page_Up               tile_up_left_key
/xfwm4/custom/<Super>Right                 tile_right_key
/xfwm4/custom/<Super>Up                    tile_up_key

Which looks right, but if you look the the xfwm4-settings UI, it looks like this:

Picture 1

Which doesn't look right.

What am I doing wrong?

Offline

#2 2023-06-01 10:09:26

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,999

Re: Having issues assigning XFWM shortcuts using xfconf-query

If you run each of those commands manually in a terminal window, does it then work?

If so, maybe place a sleep statement after the first command to give it time to complete properly.


Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2023-06-01 10:52:07

bradwiggo
Member
Registered: 2021-06-29
Posts: 15

Re: Having issues assigning XFWM shortcuts using xfconf-query

ToZ wrote:

If you run each of those commands manually in a terminal window, does it then work?

If so, maybe place a sleep statement after the first command to give it time to complete properly.


They sometimes work, but inconsistently. About 5 minutes after I made this post I ran the script again, and then every single one worked. However, 30 minutes later, some of the shortcuts have stopped working (I didn't rerun the script or make any other changes to XFWM4 bindings)

For example now I tried running

 xfconf-query -c xfce4-keyboard-shortcuts -np '/xfwm4/custom/<Super>Down' -t 'string' -s 'tile_down_key' 

and it didn't work. If I go into the settings UI and set it then it will work. However if I reboot, it stops working.

Offline

#4 2023-06-01 12:20:34

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,999

Re: Having issues assigning XFWM shortcuts using xfconf-query

Which distro and versions of Xfce and xfwm4 are you running?


Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#5 2023-06-01 12:24:56

bradwiggo
Member
Registered: 2021-06-29
Posts: 15

Re: Having issues assigning XFWM shortcuts using xfconf-query

ToZ wrote:

Which distro and versions of Xfce and xfwm4 are you running?

Distro is Arch, Xfce version is 4.18, Xfwm4 version 4.18.0 (revision 7e7473c5b)

Offline

#6 2023-06-01 17:06:02

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,999

Re: Having issues assigning XFWM shortcuts using xfconf-query

This might be of interest.

I can replicate the problem on my system as well. Have a read through that bug report and if you feel it is relevant, post to it. If not, feel free to create a new bug report.


Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#7 2023-06-02 13:32:38

bradwiggo
Member
Registered: 2021-06-29
Posts: 15

Re: Having issues assigning XFWM shortcuts using xfconf-query

ToZ wrote:

This might be of interest.

I can replicate the problem on my system as well. Have a read through that bug report and if you feel it is relevant, post to it. If not, feel free to create a new bug report.

Thanks, I'll have a look at the bug report.

As a workaround, xdotool could be used to automatically add shortcuts:

xfwm4-settings & disown
sleep 0.1
xdotool key Right Down Down 	
xdotool type "Add workspace"
xdotool key Enter
xdotool keydown Super Shift
xdotool key t
xdotool keyup Super Shift

Where "Add workspace" is the exact name of the action, and "Super+Shift+t" is the keyboard shortcut.

Offline

#8 2025-06-12 08:59:27

amarcine
Member
Registered: 2025-06-12
Posts: 2
LinuxFirefox 138.0

Re: Having issues assigning XFWM shortcuts using xfconf-query

I ran into the same problem. It looks like what breaks the shortcuts/xfwm is the fact that, when one adds new shortcut to xfce4-keyboard-shortcuts `/xfwm4/custom/` for some xfwm action like `tile_left_key`, there are two shortcuts for that action. Note that in the xfwm settings / Keyboars, the shortcuts are set per action, so the opposite way than via xfconf-query.

The solution is to first drop existing shortcuts for the action we want to set:

_SetXFWMShortcut()
{
  local action="$1"
  local shortcut="$2"

  # First need to drop existing shortcuts for the action we want to set
  local existing=$(xfconf-query -c xfce4-keyboard-shortcuts -p /xfwm4/custom -l -v | grep "$action" | sed 's@\s.*@@')
  for e in $existing ; do
    xfconf-query -c xfce4-keyboard-shortcuts -p "$e" -r
  done

  xfconf-query -c xfce4-keyboard-shortcuts -p "/xfwm4/custom/$shortcut" -n -t string -s "$action"
}

_SetXFWMShortcut tile_left_key '<Alt>Left'

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.010 seconds, 8 queries executed - Memory usage: 561.99 KiB (Peak: 578.84 KiB) ]