Xfce Forum

Sub domains
 

You are not logged in.

#1 2016-09-02 02:11:36

Pheeble
Member
Registered: 2015-06-22
Posts: 20

Print keyboard shortcuts

Is there a relatively easy way to print out the keyboard shortcuts in XFCE?

I found the shortcuts in ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml, but I haven't found any way to easily print out the active shortcuts to a neat list suitable for printing.

I installed and messed about with various xml parsers (xmllint, xmlgrep, xml_grep, xmlstarlet), but being completely new to parsing xml and the parsers themselves it quickly turned into much more of a major project than I was expecting. So much so that I think it would be much easier to just manually transcode the information to a nice format by simple copying and pasting.

But before I did that, I thought I'd check here to see if anyone has already found a solution to this. I think it would be a better long-term solution to have a script to do this automatically.

If anyone can point me to a simpler method than having to plod through the frustratingly obscure man pages of the xml parsers I would be very appreciative.

Offline

#2 2016-09-02 02:46:13

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,998

Re: Print keyboard shortcuts

Does this help:

xfconf-query -c xfce4-keyboard-shortcuts -lv

Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2016-09-02 03:04:18

Pheeble
Member
Registered: 2015-06-22
Posts: 20

Re: Print keyboard shortcuts

ToZ wrote:

Does this help:

xfconf-query -c xfce4-keyboard-shortcuts -lv

Brilliant! That's perfect. I didn't even know there was such a thing as 'xfconf-query'.

Thanks a gazillion. big_smile

Offline

#4 2016-09-02 03:10:10

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,998

Re: Print keyboard shortcuts

xfconf-query is pretty useful. For more information about it, see http://docs.xfce.org/xfce/xfconf/xfconf-query.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#5 2016-09-02 06:38:08

Pheeble
Member
Registered: 2015-06-22
Posts: 20

Re: Print keyboard shortcuts

ToZ wrote:

xfconf-query is pretty useful. For more information about it, see http://docs.xfce.org/xfce/xfconf/xfconf-query.

I read the man file immediately after reading your first post smile

There doesn't seem to be any way to limit xfconf-query's results to the user's config alone (ie. ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml only), so it would be necessary to remove the system-defined shortcuts from the list.

Seeing as how I hate not knowing how to do things, I persisted with the xml parsing thing and came up with this monstrosity that extracts the values from the user's config, replaces <Super> with <Win> and <Primary> with <Ctrl>, and then formats the list into two columns (my apologies to anyone who knows how to do this properly - I'm just making it up as I go):

'xmlstarlet sel -T -t -v "//property[@name and @value and contains(@type, 'string')]/@name|//property[@name and @value and contains(@type, 'string')]/@value" ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml | awk '{getline line2;print $0, "@", line2}' | sed 's/<Super>/<Win>/g' | sed 's/<Primary>/<Ctrl>/g' | column -t -s @'

To sort on the first column, append ' | sort', and to sort on the second column append ' | sort -k 2'.

Last edited by Pheeble (2016-09-02 06:42:42)

Offline

Board footer

Powered by FluxBB