SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2010-03-19 19:06:06

iggykoopa
Script Master
Registered: 2008-12-13
Posts: 1,480

rc.xml keybindings for conky

I know people had asked for some automated way to get all of their keybindings into conky. Well I'm taking an xml class now and learning xquery, so I figured I'd whip something up:

declare default element namespace "http://openbox.org/3.4/rc";
declare option saxon:output "method=text";

for $keybind in doc("rc.xml")/openbox_config/keyboard/keybind
 return concat("key: ", 
                $keybind/@key/data(.), 
                "		name: ", 
                string-join($keybind/action/@name/data(.), ","),
                " ",
                $keybind/action/desktop/text(),
                " ",
                $keybind/action/command/text(),
                $keybind/action/execute/text(),
                "
")

save this as rc.xquery and change the doc("rc.xml") part to the path to your rc.xml. Then install saxonb, it's in the repos, and put it in your conky like:
${exec saxonb-xquery /path/to/rc.xquery}


I say never be complete, I say stop being perfect, I say lets evolve, let the chips fall where they may.

Offline

Help fund CrunchBang, donate to the project!

#2 2010-03-20 03:37:21

johnraff
#!Drunkard
From: Nagoya, Japan
Registered: 2009-01-07
Posts: 2,497
Website

Re: rc.xml keybindings for conky

Haven't tried it yet, but the package itself is called libsaxonb-java in jaunty.

btw, there's another neat xml processing package called xmlstarlet, just in case you haven't run into it.
You can probably get much more out of it than me - at the moment I'm just using it to extract items from rss feeds.


John
--------------------
( a boring Japan blog , and idle twitterings )

Offline

#3 2010-03-21 03:56:18

johnraff
#!Drunkard
From: Nagoya, Japan
Registered: 2009-01-07
Posts: 2,497
Website

Re: rc.xml keybindings for conky

Hi iggykoopa, bit of feedback:

change the doc("rc.xml") part to the path to your rc.xml

I had to put the path relative to my home directory (ie .config/openbox/rc.xml). Is that always the case, or because my rc.xquery was in ~/?

Here's the output in a terminal - looks good, though I had some trouble getting conky to display it all. That's another issue I guess roll

john@raffles3:~$ saxonb-xquery ~/rc.xquery 
key: A-Menu        name:   
 key: C-A-Left        name: DesktopLeft  
 key: C-A-Right        name: DesktopRight  
 key: C-A-Up        name: DesktopUp  
 key: C-A-Down        name: DesktopDown  
 key: S-A-Left        name: SendToDesktopLeft  
 key: S-A-Right        name: SendToDesktopRight  
 key: S-A-Up        name: SendToDesktopUp  
 key: S-A-Down        name: SendToDesktopDown  
 key: W-F1        name: Desktop 1 
 key: W-F2        name: Desktop 2 
 key: W-F3        name: Desktop 3 
 key: W-F4        name: Desktop 4 
 key: W-d        name: ToggleShowDesktop  
 key: A-F4        name: Close  
 key: A-Escape        name: Lower,FocusToBottom,Unfocus  
 key: A-space        name: ShowMenu  
 key: A-Tab        name: NextWindow  
 key: A-S-Tab        name: PreviousWindow  
 key: C-A-Tab        name: NextWindow yes 
 key: Print        name: Execute  scrot '%Y-%m-%d--%s_$wx$h_scrot.png' -e 'mv $f ~/images/screenshots/ & gthumb ~/images/screenshots/$f'
 key: A-Print        name: Execute  scrot -d 10 '%Y-%m-%d--%s_$wx$h_scrot.png' -e 'mv $f ~/images/screenshots/ & gthumb ~/images/screenshots/$f'
 key: C-A-s        name: Execute  /home/john/scripts/shutdown-lock.sh
 key: C-A-u        name: Execute  update-manager
 key: A-F2        name: Execute  gmrun
 key: A-F3        name: Execute  ~/.config/dmenu/dmenu-bind.sh
 key: W-f        name: Execute  thunar
 key: W-p        name: Execute  pcmanfm
 key: W-t        name: Execute  urxvt
 key: W-h        name: Execute  urxvt -e htop
 key: W-w        name: Execute  /home/john/scripts/words.sh
 key: W-l        name: Execute  /home/john/scripts/make_tmp_list.sh
 key: W-a        name: Execute  /home/john/scripts/alc.sh
 key: W-g        name: Execute  /home/john/scripts/g.sh
 key: C-A-l        name: Execute  gnome-screensaver-command -l
 key: W-e        name: Execute  gedit
 key: W-m        name: Execute  mplayer-terminal
 key: W-v        name: Execute  gnome-volume-control
 key: W-u        name: Execute  system-update
 key: W-c        name: Execute  ~/.config/gworldclock/gworldclock.sh
 key: C-A-x        name: Execute  openbox-logout
 key: W-Tab        name: ShowMenu  
 key: W-space        name: ShowMenu  
 key: Menu        name: ShowMenu  
 key: A-C-q        name: ShowMenu  
 key: S-C-W-t        name: ShowMenu  
 key: S-C-W-r        name: ShowMenu  
 key: S-C-W-p        name: ShowMenu

John
--------------------
( a boring Japan blog , and idle twitterings )

Offline

#4 2010-03-21 08:07:48

iggykoopa
Script Master
Registered: 2008-12-13
Posts: 1,480

Re: rc.xml keybindings for conky

now that you mention it, I used a relative path as well. I just assumed it would work with absolute, but I hadn't tested it. Thanks for pointing it out.


I say never be complete, I say stop being perfect, I say lets evolve, let the chips fall where they may.

Offline

#5 2010-03-21 10:01:51

johnraff
#!Drunkard
From: Nagoya, Japan
Registered: 2009-01-07
Posts: 2,497
Website

Re: rc.xml keybindings for conky

...relative to where rc.xquery is, presumably?


John
--------------------
( a boring Japan blog , and idle twitterings )

Offline

#6 2010-03-21 11:55:55

iggykoopa
Script Master
Registered: 2008-12-13
Posts: 1,480

Re: rc.xml keybindings for conky

I'm not actually sure if it's relative to the rc.xquery or where the command is run from. I tried installing statler and wiped out my ubuntu install, but statler didn't want to play nice, so I'm actually on win 7 now. Once I get things straightened out I can test it.


I say never be complete, I say stop being perfect, I say lets evolve, let the chips fall where they may.

Offline

#7 2010-07-24 20:14:00

SuNjACk
#! Die Hard
Registered: 2010-05-23
Posts: 538

Re: rc.xml keybindings for conky

I found this for openbox keybindings in conky

http://u-scripts.blogspot.com/2010/03/h … tcuts.html


this work on my #! crunchbang 9.04


"I'd rather run Linux on a 6.5KHz machine through an ARM emulator than run Vista"

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.

Debian Logo