SEARCH

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

You are not logged in.

#1 2015-04-07 16:30:55

damo
#! gimpbanger
From: N51.5 W002.8 (mostly)
Registered: 2011-11-24
Posts: 5,434

Openbox pipemenu to display keybinds

Anyone want to try out a new pipemenu? It displays all your Openbox keybinds, and also can open rc.xml for editing after first making a backup.

obkb-pipemenu.py can be run in a terminal on its own, when it writes the keybinds to screen. They are saved in a textfile first (.config/openbox/kbinds.txt), which is what is read by the pipemenu.

If the textfile doesn't exist then the pipemenu runs the python script first.

EDIT: Now with added clickability! cool This only applies to menu items that have <action name=Execute>; those with Openbox window commands just close the menu.

9kprAFAz.jpg

You can get the scripts from my github
bl-kb-pipemenu
obkb-pipemenu.py
(Choose "Raw" and C&P in a text editor)

(If you just want a standalone script which displays your keybinds in a zenity text dialog or the terminal, then try
obkb.py wink )

I'd appreciate some feedback; and if you have suggestions about improving the code, then by all means say so smile

Last edited by damo (2015-04-08 13:57:14)


BunsenLabs Group on deviantArt
damo's gallery on deviantArt
Openbox themes
Forum Moderator smile

Offline

Help fund CrunchBang, donate to the project!

#2 2015-04-07 20:25:54

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Openbox pipemenu to display keybinds

I have an older obkb.py and obkb2.py soooooooo #3 ... but

 07 Apr 15 | 17:22:40 ~
    $ obkb3.py
  File "/home/sector11/bin/obkb3.py", line 34
    from lxml import etree
       ^
IndentationError: expected an indented block
 
 07 Apr 15 | 17:22:47 ~
    $ 

In Waldorf does that make a difference?  First two work.

Will try in Jessie later today.
EDIT:  Result the same in Jessie.


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#3 2015-04-07 21:13:09

ohnonot
...again
Registered: 2012-05-22
Posts: 2,205

Re: Openbox pipemenu to display keybinds

are the pipemenu entries clickable? meaning, do they execute the actual keybind? that would be cool.


i once did sth similar:
http://crunchbang.org/forums/viewtopic.php?id=29997

Offline

#4 2015-04-07 21:13:56

damo
#! gimpbanger
From: N51.5 W002.8 (mostly)
Registered: 2011-11-24
Posts: 5,434

Re: Openbox pipemenu to display keybinds

Sector11 wrote:

I have an older obkb.py and obkb2.py soooooooo #3 ... but

 07 Apr 15 | 17:22:40 ~
    $ obkb3.py
  File "/home/sector11/bin/obkb3.py", line 34
    from lxml import etree
       ^
IndentationError: expected an indented block
 
 07 Apr 15 | 17:22:47 ~
    $ 

In Waldorf does that make a difference?  First two work.

Will try in Jessie later today.
EDIT:  Result the same in Jessie.

You have an indentation error in the script. Python uses indents as part of the syntax, so that line should match the rest. One tab per indent, or 4 spaces per indent are commonly used.

Turn on whitespace in geany to see what is happening in your copy of the script.


BunsenLabs Group on deviantArt
damo's gallery on deviantArt
Openbox themes
Forum Moderator smile

Offline

#5 2015-04-07 21:20:31

damo
#! gimpbanger
From: N51.5 W002.8 (mostly)
Registered: 2011-11-24
Posts: 5,434

Re: Openbox pipemenu to display keybinds

ohnonot wrote:

are the pipemenu entries clickable? meaning, do they execute the actual keybind? that would be cool.


i once did sth similar:
http://crunchbang.org/forums/viewtopic.php?id=29997

I also did obkb.py which displays keybinds in a terminal or in a zenity text dialog. The pipemenu uses the output from the same script (slightly edited to take out the text formatting).

I tried it with clickable items. It works great for <command>bash command</command>, but throws up errors for the Openbox commands. I decided to use "echo >/dev/null 2>&1" as the menu item command, so the menu just closes.

Maybe version 2 will be clickable! (I'm working on it cool )

EDIT: In the meantime, if you want clickable menu items for those that have "<action name="Execute">", edit the bl-kb-pipemenu at line 51

#	menuItem "$curItem" "echo >/dev/null 2>&1" #<command> closes menu on screen
	menuItem "$curItem" "$b" #<command> uses command/execute

EDIT 2 : I really should get round to changing the deprecated <execute> to <command> in my rc.xml's  :8

Last edited by damo (2015-04-07 22:01:27)


BunsenLabs Group on deviantArt
damo's gallery on deviantArt
Openbox themes
Forum Moderator smile

Offline

#6 2015-04-08 00:05:30

damo
#! gimpbanger
From: N51.5 W002.8 (mostly)
Registered: 2011-11-24
Posts: 5,434

Re: Openbox pipemenu to display keybinds

EDIT: Now with added clickability! cool


BunsenLabs Group on deviantArt
damo's gallery on deviantArt
Openbox themes
Forum Moderator smile

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.
Server: acrobat

Debian Logo