You are not logged in.

#1 2009-03-23 06:27:07

CheesyBeef
Member
Registered: 2008-06-04
Posts: 190

HOWTO: Openbox Menu Icon in PyPanel

Using Openbox and PyPanel (or similar) and are tired of either having to minimize windows or adjust maximum window size to leave space for right-clicking on the desktop?  Do you have a keyboard shortcut set up to open the menu, but also want to be able to use the mouse to open the menu easier?  I have a solution!

Create an icon to launch the Openbox application menu on PyPanel.

This will allow you to click on an icon on PyPanel which opens the OpenBox menu, similar to Gnome's application menu.

Example:
200903222142241280x800s.th.png

Requirements:
Openbox Window Manager
PyPanel (dock/panel application)
xdotool
obkey - to edit key shortcuts to OpenBox's rc.xml (not required, but used in this howto)

Recommendations:
archlinux-artwork


Procedure:

1) If you don't already have PyPanel installed, install it now (as root).

pacman -S pypanel

2) Launch pypanel in an application launcher, or the terminal (as normal user):

pypanel &&

3) Install xdotool (allows for launching keyboard shortcuts via command line) (as root)

pacman -S xdotool

4) If you do not have obkey installed, install it with yaourt (recommended) or download the tar.gz and run the python script:

yaourt -S obkey-git

OR
Go to the obkey site or download the .tar.gz by clicking here
Extract the .tar.gz:

tar -xvf ./obkey-dev-abf0bb12.tar.gz

Enter the obkey-dev directory:

cd ./obkey-dev

Run obkey and point it to the openbox rc.xml (as normal user!):

./obkey ~/.config/openbox/rc.xml

5) In obkey, find an existing key or create a new key binding by clicking "Insert sibling key" at the top. Note: Ctrl+alt combinations did not seem to work for me to create this menu launcher.

- If it's an existing key, select it, then click on the action in the bottom right-hand pane.  A window should pop up.  Find and select "ShowMenu"
- If it's a new key, select it, enter in the key combination you want to use in the key (text) box (for example, C-M for Ctrl+M), then click the green "Insert Action" button at the bottom.  Click on the new "Focus" action.  A window should pop up.  Find and select "ShowMenu"

In the ShowMenu action, at the top there should be a box for "menu:"  Enter in "root-menu" in this box.
Now save by clicking the green arrow + hard drive in the top left corner of obkey.  Now you should be able to use that key combination to open the root-menu. If not, try restarting the X Server.

Example:
200903222316141280x800s.th.png

6) This is optional, but if you want a nice Arch icon for your new menu launcher, you can grab mine.  If you want to use your own image, it cannot be .svg, so I converted a .svg icon to .png from the the official Arch Artwork package (archlinux-artwork in the repos).  If you want to just use mine:

Enter the following commands to get the image and set it up for the next step:

mkdir ~/.icons/archlinux/icons/
wget -P ~/.icons/archlinux/icons/ http://img297.imageshack.us/img297/1378/archlinuxiconcrystal128.png

7) Open up your ~/.pypanelrc with your favorite text editor (e.g. nano or gedit). 

Scroll down to a line starting with "LAUNCH_LIST"  Most likely it will have a line like this by default:

("gimp-2.2", "/usr/share/imlib2/data/images/paper.png")

Change the line to the following to use xdotool and the key you assigned in step 5, as well as the icon image we just downloaded (Note: make sure to change /home/user to your specific home directory!):

("xdotool key ctrl+m", "/home/user/.icons/archlinux/icons/archlinuxiconcrystal128.png")

Next, locate a line about 15 more down starting with "APPICONS."  Change this value from 0 to 1.

APPICONS        = 1             # Show application icons

Finally, about 20 lines down, you will see a section for Panel Layout.
There are 5 sections for the panel:  Desktop, Tasks, Tray, Clock, and Launcher.  They can be assigned, in order of left to right on the panel, with numbers 1-5 and 0 for disabled.  Choose a location you want your Launcher to be and set the value from 1-5.  You can play around with this by setting the values, then restarting pypanel.

Here is how I have set mine (I disabled Desktop since I only use one desktop/workspace and do not need it to say which one I am on):

DESKTOP         = 0             # Desktop name section
TASKS           = 2             # Task names section 
TRAY            = 3             # System tray section
CLOCK           = 4             # Clock section
LAUNCHER        = 1             # Application launcher section

8) Finally, kill and restart PyPanel and enjoy!

killall pypanel && pypanel

9) Tell me how it went, what you think, what I could improve on, etc! smile

Last edited by CheesyBeef (2009-03-24 22:22:39)

Offline

#2 2009-03-24 21:55:20

Vighi
Member
Registered: 2008-08-16
Posts: 16

Re: HOWTO: Openbox Menu Icon in PyPanel

Very nice guide got it working almost straight away :-)
Had to restart X in order to get key-binding to work though. And I put /home/username/.icons/archlinux/icons/archlinuxiconcrystal128.png instead of ~/ because somehow I got couldn't find logo error when pypanel started.

BTW sexy pypanel look you have. All the info in your .dotfiles link? smile will get to it tomorrow I guess. Thanks!

Offline

#3 2009-03-24 22:04:57

CheesyBeef
Member
Registered: 2008-06-04
Posts: 190

Re: HOWTO: Openbox Menu Icon in PyPanel

Vighi wrote:

Very nice guide got it working almost straight away :-)
Had to restart X in order to get key-binding to work though. And I put /home/username/.icons/archlinux/icons/archlinuxiconcrystal128.png instead of ~/ because somehow I got couldn't find logo error when pypanel started.

BTW sexy pypanel look you have. All the info in your .dotfiles link? smile will get to it tomorrow I guess. Thanks!

Thanks very much for using my guide and responding! smile

I will fix that ~/ directory problem and say to use the home directory. 

And yes, that configuration is in my .dotfiles at the moment smile  You can follow that link or just grab it here: http://dotfiles.org/~CheesyBeef/.pypanelrc

Thanks again!

Offline

#4 2009-03-24 22:26:21

thunderogg
Member
From: Rio de Janeiro
Registered: 2008-07-13
Posts: 172

Re: HOWTO: Openbox Menu Icon in PyPanel

Offline

#5 2009-03-24 22:39:54

CheesyBeef
Member
Registered: 2008-06-04
Posts: 190

Re: HOWTO: Openbox Menu Icon in PyPanel

thunderogg wrote:

Yes, but that's where the pypanel part comes in tongue

Offline

#6 2009-03-24 22:44:44

thunderogg
Member
From: Rio de Janeiro
Registered: 2008-07-13
Posts: 172

Re: HOWTO: Openbox Menu Icon in PyPanel

Um, I see. I guess I put it my pypanel without thinking about what I was doing. tongue Nicely written.

Offline

#7 2009-03-24 23:33:44

CheesyBeef
Member
Registered: 2008-06-04
Posts: 190

Re: HOWTO: Openbox Menu Icon in PyPanel

thunderogg wrote:

Um, I see. I guess I put it my pypanel without thinking about what I was doing. tongue Nicely written.

Uh ok, well this is a guide I thought would be good to create.  It's specific to one thing and hopefully easy to follow.  You sure seem like a downer about it.

Offline

#8 2009-06-04 13:14:26

plurt
Member
Registered: 2008-10-16
Posts: 88

Re: HOWTO: Openbox Menu Icon in PyPanel

great explanation for something I was googling for smile

there's one thing you might want to add
although editing .xml files isn't pleasant, it get's a whole lot worse after using obkey, wich deleted a whole lot of tabs in my rc.xml.
A solution might be to just add these lines in the <keyboard></keyboard> section of this file, like this

<keyboard>
   <keybind key="C-m">
    <action name="ShowMenu">
            <menu>root-menu</menu>
    </action>
   </keybind>
</keyboard>

seems simpler than using the gui imho as well (kiss principle)

otherwise, again, this was just what I was looking for, thanks! smile


When everything's coming your way, you're in the wrong lane I say.
FAQ / Beginners Guide / The Arch Way

Offline

#9 2009-06-11 21:14:25

flaq
Member
Registered: 2009-05-13
Posts: 3

Re: HOWTO: Openbox Menu Icon in PyPanel

just leave space on the right and left of the panel, instead of using the whole bottom edge
whenever you wanna right click just move mouse to bottom left/right and right click


ArchLinux kdm + openbox,  Athlon XP2500, 1GB  DDR, 160gb IDE, ATI X800, Audigy, linksys wmp54gv2

Offline

#10 2009-06-11 21:22:27

arch0r
Member
From: From the Chron-o-John
Registered: 2008-05-13
Posts: 597

Re: HOWTO: Openbox Menu Icon in PyPanel

this is rly cool :>

Offline

#11 2009-08-11 06:45:53

roelof
Member
Registered: 2009-08-07
Posts: 99

Re: HOWTO: Openbox Menu Icon in PyPanel

Hello,

One question :

Can this also be done by using a mouse click ?

Roelof

Offline

Board footer

Powered by FluxBB