Some of my scripts for daily use on a linux desktop

Wednesday, March 10, 2010

How to display Openbox's Shortcuts


I am an Openbox + Ubuntu user but sometimes, I can't remember some shortcuts. So I wrote a script to display the shorcuts (keyboard+mouse) from rc.xml in a conky window, and this window is called with a shortcut (!) only when I need it, it's a kind of help window :-)

Maybe this kind of script already exist but I didn't find it .

All the scripts can be downloaded from ubuntu forums.
In french, it's here on ubuntu-fr forum.

First I need a conkyrc template.
The python script will read this file and write shortcuts at the end of this file but in a new file.
The only thing to do in this file is to choose your colors for display.
The name of the file is conky_template.

Second, the python script shortcuts.py read the openbox's rc.xml file.
There are some parameters to set at the beginning of the script :


#full path and name of the rc.xml file
rc_path_file="/home/ll/.config/openbox/rc.xml"
#template of conkyrc to use
conkytemplate_path_file ="/home/wlourf/scripts/raccourcis/conky_template"

#column width (Ms = souris, Kb= clavier)
lgColMs=50
lgColKb=40

#Number of lines per Column (Ms = souris, Kb= clavier)
nbLnMs=30
nbLnKb=30

#in "Keyboard" array, "appliFirst" will display application name before shorcut
appliFirst=True

#END OF THE PARAMETERS !



Third, a little bash script launcher.sh needed to run the python script and to call conky. Don't forget to make it executable.


And, for finish, in rc.xml, two shortcuts to run launcher.sh with parameters :


<command>/home/wlourf/scripts/raccourcis/launcher.sh /tmp/conky_kb k</command>

<command>/home/wlourf/scripts/raccourcis/launcher.sh /tmp/conky_ms m</command>


Voilà, when I call the script, the conky display the above image for the keyboard or this one for the mouse :







Today I also updated the audio_spectrum script : it can display the bargraph widget in a circular way, like this :

And a short video :

1 comment:

  1. Very useful, thanks for sharing and credits to all cool scripts you make :)

    ReplyDelete