I am trying to add a keyboard shortcut to xfce using salt.
Here are the files I created:
- /srv/salt/xfconf.sls
# -*- coding: utf-8 -*-
# vim: set syntax=yaml ts=2 sw=2 sts=2 et :
{% set gui_user = salt['cmd.shell']('groupmems --list --group qubes') %}
add_shortcut:
cmd.run:
- name: /usr/local/bin/xfconf_test
- runas: {{ gui_user }}
- /usr/local/bin/xfconf_test (mode:755):
#!/usr/bin/env bash
xfconf-query --channel xfce4-keyboard-shortcuts --property "/commands/custom/<Shift>Shift_R" --set xterm --create --type string
Here are the steps I did to reproduce the problem:
- Execute manually the script:
$ /usr/local/bin/xfconf_test
$ cd ~/.config/xfce4/xfconf/xfce-perchannel-xml
$ grep xterm xfce4-keyboard-shortcuts.xml
<property name="<Shift>Shift_R" type="string" value="xterm"/>
- Press Shift+Shift_R
The shortcut has been saved in the xml file
xfce is aware of the new shortcut
When the shortcut is pressed, an xterm window appears
Let’s bring the shortcuts to its initial state:
-
Open Qubes Application Menu
-
Go to System Settings > Keyboard > Application Shortcuts
-
Remove xterm: Shift+Shift_R
-
Execute the following commands:
$ sudo qubesctl --show-output state.sls xfconf
local:
----------
ID: add_shortcut
Function: cmd.run
Name: /usr/local/bin/xfconf_test
Result: True
Comment: Command "/usr/local/bin/xfconf_test" run
Started: 02:26:56.238803
Duration: 262.308 ms
Changes:
----------
pid:
10399
retcode:
0
stderr:
stdout:
Summary for local
------------
Succeeded: 1 (changed=1)
Failed: 0
------------
Total states run: 1
Total run time: 262.308 ms
$ grep xterm xfce4-keyboard-shortcuts.xml
- Press Shift+Shift_R
No shortcut has been saved in the xml file
xfce is not aware of the new shortcut
When the shortcut is pressed, nothing appears
There is no xterm
shortcut in System Settings > Keyboard > Application Shortcuts
Questions:
- Why does
xfconf-query
behave diffenrently when executed in salt vs manually in a terminal? - How do I make
xfconf-query
work in salt?
N.B. I tried with the xfconf-query
command written directly in the .sls file. When I execute qubesctl ...
, no shortcut is added.