Xfce Forum

Sub domains
 

You are not logged in.

#1 2022-08-29 20:04:50

Skaperen
Member
From: right by Jesus, our Saviour
Registered: 2013-06-15
Posts: 746

setting shortcuts by CLI

is there a command that can set/change a shortcut setting?

is it possible to set a shortcut to input some different keystroke instead of executing a command, such as (this is only an example) setting Alt+B to enter Ctrl+A?

Offline

#2 2022-08-29 22:21:00

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 9,211

Re: setting shortcuts by CLI

Skaperen wrote:

is there a command that can set/change a shortcut setting?

You can use xfconf-query. For example, on my system Super+e opens thunar:

$ xfconf-query -c xfce4-keyboard-shortcuts -lv | grep "<Super>e"
/commands/default/<Super>e                  thunar

If use xfconf-query to set a replacement, I need to replace "default" with "custom" (shortcuts you set should always belong to the custom key):

xfconf-query -c xfce4-keyboard-shortcuts -p "/commands/custom/<Super>e" -s mousepad

...and running the command from before:

$ xfconf-query -c xfce4-keyboard-shortcuts -lv | grep "<Super>e"
/commands/custom/<Super>e                  mousepad
/commands/default/<Super>e                 thunar

...and Super+e now starts mousepad.

is it possible to set a shortcut to input some different keystroke instead of executing a command, such as (this is only an example) setting Alt+B to enter Ctrl+A?

You would need to use a tool like xdotool as the shortcut command:

xdotool key Alt+B

Offline

#3 2022-09-01 02:22:26

Skaperen
Member
From: right by Jesus, our Saviour
Registered: 2013-06-15
Posts: 746

Re: setting shortcuts by CLI

xdotool has many flaws in the way it works.  but these are probably limitations of the X server.  i probably need to be looking at the code that carries out the checking for the shortcut being entered.  many observations about shortcuts suggest to me that this could be happening in the X server, once it is set up (maybe via an API thing).  if it is in X then i would need to be able to rebuild X from source code if i change things there (such as smart translations and filters).  but i have not ruled out this being a kernel thing or partly done in Xfce (whatever process is first getting keyboard input).

if i can get xdotool input to trigger a shortcut, then that tells me it is more likely in Xfce.  wherever it is, my objective is to find (or implement) a way to change the input stream as it comes in.

right now, i have sticky keys enabled (for all my regular userids).  that might complicate, or simplify, what i want to do.

Offline

#4 2022-09-01 23:35:53

Skaperen
Member
From: right by Jesus, our Saviour
Registered: 2013-06-15
Posts: 746

Re: setting shortcuts by CLI

i want to set a shortcut on key Alt+KP_Insert to do command "wmctrl -s 10" using xfconf-query.  how can that be done?  what confuses me is how to get the key in there.  i am using sticky keys but i might turn that off and still want this shortcut to work, so i don't want a solution that depends on sticky keys.

Offline

Board footer

Powered by FluxBB