EDIT THE OPENBOX RIGHT CLICK MENU IN LXDE and ADD ICONS

The standard theme switcher of LXDE - http://wiki.lxde.org/en/LXAppearance
kjdixo
Posts: 21
Joined: Wed Jan 11, 2012 10:22 pm

EDIT THE OPENBOX RIGHT CLICK MENU IN LXDE and ADD ICONS

Post by kjdixo »

EDIT THE OPENBOX RIGHT CLICK MENU IN LXDE

Part 1 of 3: To create a user defined menu.xml
Right click on the LXDE Desktop.
Click Desktop Preferences.
Click the Advanced Tab.
Check the box 'Show menus provided by the window manager when desktop is clicked'.
Click Close.
Right click on the LXDE Desktop.
You should now see the Openbox 'right click menu'.
It is possible to edit this menu once the system has been set up to allow it.
The menu you see originates from /usr/share/lxde/openbox/menu.xml and any editing will be overwritten.
To create a user defined menu.xml
Copy: /usr/share/lxde/openbox/menu.xml
To: ~/.config/openbox/menu.xml

Part 2 of 3: To configure LXDE to obey your edits of menu.xml
Objective: Configure ~/.config/openbox/lxde-rc.xml to point to ~/.config/openbox/menu.xml
Open ~/.config/openbox/lxde-rc.xml in a text editor.
Scroll through the code or use your text editor's 'find' function to locate the following:
<!-- default menu file (or custom one in $HOME/.config/openbox/) -->
Change this: <file>/usr/share/lxde/openbox/menu.xml</file>
To this: <file>/home/user/.config/openbox/menu.xml</file>
Obviously substitute 'user' with your username.
This will direct the system to take notice of your user configurable menu.xml.

Part 3 of 3: To edit the Menu
You can edit menu.xml directly with a text editor, or an easier way is to install the Openbox Menu Editor: obmenu.
For the changes to take effect once the Openbox menu has been edited:
Right click on the LXDE Desktop.
Click 'Reload Config Files'.
Remember 'Reload Config Files' can also be edited out, so be careful.
In the event that you create an unusable menu, you can always delete your user defined menu.xml then repeat the steps above.

ICONS IN THE OPENBOX RIGHT CLICK MENU IN LXDE
Note: If you upgrade to Openbox 3.5.0-2 from Debian SID, it is then possible to have icons in the right click menu.
To do this.
Step 1: Upgrade to Openbox 3.5.0-2. I used Synaptic Package Manager to add the Debian SID repository then 'forced the newer version' of Openbox.
Step 2: Replace all occurances of <menu> with <menu><showIcons>yes</showIcons> in ~/.config/openbox/rc.xml.
Step 3: Add icon locations in ~/.config/openbox/menu.xml as shown in this example menu.xml.

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<openbox_menu xmlns="http://openbox.org/3.4/menu">
<menu id="root-menu" label="MENU 1">
<item label="PCMan" icon="/usr/share/icons/Tango/32x32/apps/file-manager.png"><action name="Execute"><command>pcmanfm</command></action></item>
<item label="Geany" icon="/usr/share/icons/hicolor/48x48/apps/geany.png"><action name="Execute"><command>geany</command></action></item>
<item label="Opera" icon="/usr/share/icons/hicolor/48x48/apps/opera-browser.png"><action name="Execute"><command>opera</command></action></item>
<item label="Firefox" icon="/usr/share/icons/hicolor/48x48/apps/iceweasel.png"><action name="Execute"><command>iceweasel</command></action></item>
<item label="Gimp" icon="/usr/share/icons/hicolor/48x48/apps/gimp.png"><action name="Execute"><command>gimp</command></action></item>
<item label="Filezilla" icon="/usr/share/icons/hicolor/48x48/apps/filezilla.png"><action name="Execute"><command>filezilla</command></action></item>
<item label="Xfburn" icon="/usr/share/icons/hicolor/48x48/stock/media/stock_xfburn-burn-cd.png"><action name="Execute"><command>xfburn</command></action></item>
<menu id="root-menu-675733" label="   ">
<item label="Desktop"><action name="Execute"><startupnotify><enabled>yes</enabled></startupnotify><command>pcmanfm --desktop-pref</command></action></item>
<item label="Themes"><action name="Execute"><startupnotify><enabled>yes</enabled></startupnotify><command>obconf</command></action></item>
<item label="Obmenu"><action name="Execute"><execute>obmenu</execute></action></item>
<item label="Reload"><action name="Reconfigure"/></item>
<item label="Exit"><action name="Execute"><command>lxde-logout</command></action></item>
</menu>
</menu>
</openbox_menu>
Have Fun.
Kevin Dixon

Fri Jan 20, 2012: Post edited to improve readability = added 'CODE: SELECT ALL' text box.
Last edited by kjdixo on Fri Jan 20, 2012 3:07 pm, edited 8 times in total.
kjdixo
Posts: 21
Joined: Wed Jan 11, 2012 10:22 pm

Re: EDIT THE OPENBOX RIGHT CLICK MENU IN LXDE and ADD ICONS

Post by kjdixo »

Here is a Screenshot of the 'LXDE Openbox Right Click Menu with Icons'.
http://kdworld7.net/links/computers/lxd ... x-menu.jpg
Image
The curved back arrow in the LXPanel is for the standard LXDE Debian menu, I customized the icon.
KD
kjdixo
Posts: 21
Joined: Wed Jan 11, 2012 10:22 pm

Re: EDIT THE OPENBOX RIGHT CLICK MENU IN LXDE and ADD ICONS

Post by kjdixo »

With a little extra effort, instead of one menu.xml, you can have two selectable menus, menu1.xml and menu2.xml.

Image

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<openbox_menu xmlns="http://openbox.org/3.4/menu">
<menu id="root-menu" label="MENU 1">
<item label="Menu 1" icon="/usr/share/icons/Tango/32x32/emblems/emblem-favorite.png"><action name="Execute"><command>sh -c "cp /home/username/.config/openbox/menu2.xml /home/username/.config/openbox/menu.xml && openbox --reconfigure"</command></action></item>
<item label="PCMan" icon="/usr/share/icons/Tango/32x32/apps/file-manager.png"><action name="Execute"><command>pcmanfm</command></action></item>
<item label="Geany" icon="/usr/share/icons/hicolor/48x48/apps/geany.png"><action name="Execute"><command>geany</command></action></item>
<item label="Opera" icon="/usr/share/icons/hicolor/48x48/apps/opera-browser.png"><action name="Execute"><command>opera</command></action></item>
<item label="Firefox" icon="/usr/share/icons/hicolor/48x48/apps/iceweasel.png"><action name="Execute"><command>iceweasel</command></action></item>
<item label="Gimp" icon="/usr/share/icons/hicolor/48x48/apps/gimp.png"><action name="Execute"><command>gimp</command></action></item>
<item label="Filezilla" icon="/usr/share/icons/hicolor/48x48/apps/filezilla.png"><action name="Execute"><command>filezilla</command></action></item>
<item label="Xfburn" icon="/usr/share/icons/hicolor/48x48/stock/media/stock_xfburn-burn-cd.png"><action name="Execute"><command>xfburn</command></action></item>
</menu>
</openbox_menu>
Image

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<openbox_menu xmlns="http://openbox.org/3.4/menu">
<menu id="root-menu" label="MENU 2">
<item label="Menu 2" icon="/usr/share/icons/Tango/32x32/emblems/emblem-important.png"><action name="Execute"><command>sh -c "cp /home/username/.config/openbox/menu1.xml /home/username/.config/openbox/menu.xml && openbox --reconfigure"</command></action></item>
<item label="Desktop" icon="/usr/share/icons/Tango/32x32/places/user-desktop.png"><action name="Execute"><startupnotify><enabled>yes</enabled></startupnotify><command>pcmanfm --desktop-pref</command></action></item>
<item label="Themes" icon="/usr/share/icons/Tango/32x32/apps/preferences-desktop-theme.png"><action name="Execute"><startupnotify><enabled>yes</enabled></startupnotify><command>obconf</command></action></item>
<item label="Obmenu" icon="/usr/share/icons/Tango/32x32/actions/format-justify-fill.png"><action name="Execute"><command>obmenu</command></action></item>
<item label="Reload" icon="/usr/share/icons/Tango/32x32/actions/view-refresh.png"><action name="Reconfigure"/></item>
<item label="Exit" icon="/usr/share/icons/Tango/32x32/actions/system-log-out.png"><action name="Execute"><command>lxde-logout</command></action></item>
</menu>
</openbox_menu>
You still need a menu.xml, which initially can be identical to menu1.xml.
In my initial post I explained how to configure LXDE to respond to menu.xml :
Configure ~/.config/openbox/lxde-rc.xml to point to ~/.config/openbox/menu.xml
For extreme experimenters ... try using this menu system to write two versions of lxde-rc.xml.
Probably not advisable, but it does work.
KD

Fri Jan 20, 2012: Post edited to improve readability = added 'CODE: SELECT ALL' text boxes.
Last edited by kjdixo on Fri Jan 20, 2012 2:43 pm, edited 8 times in total.
kjdixo
Posts: 21
Joined: Wed Jan 11, 2012 10:22 pm

Re: EDIT THE OPENBOX RIGHT CLICK MENU IN LXDE and ADD ICONS

Post by kjdixo »

There are lots of possible configurations.
The 3 part menu shown below is a simple example.
menu1.xml has 'frequently used' applications.
menu2.xml has 'sometimes used' applications.
menu3.xml has 'settings' etc.
I scaled down icon images that were too big for the menus, to 48x48 using Gimp.

Image

Three menus: menu1.xml, menu2.xml and menu3.xml.
You could also create a menu item (shortcut) for opening all the above xml files in Geany, so they can be edited.

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<openbox_menu xmlns="http://openbox.org/3.4/menu">
<menu id="root-menu" label="MENU 1">
<item label="PCMan" icon="/usr/share/icons/Tango/32x32/apps/file-manager.png"><action name="Execute"><command>pcmanfm</command></action></item>
<item label="Geany" icon="/usr/share/icons/hicolor/48x48/apps/geany.png"><action name="Execute"><command>geany</command></action></item>
<item label="Opera" icon="/usr/share/icons/hicolor/48x48/apps/opera-browser.png"><action name="Execute"><command>opera</command></action></item>
<item label="Firefox" icon="/usr/share/icons/hicolor/48x48/apps/iceweasel.png"><action name="Execute"><command>iceweasel</command></action></item>
<item label="Gimp" icon="/usr/share/icons/hicolor/48x48/apps/gimp.png"><action name="Execute"><command>gimp</command></action></item>
<item label="Filezilla" icon="/usr/share/icons/hicolor/48x48/apps/filezilla.png"><action name="Execute"><command>filezilla</command></action></item>
<item label="Exit" icon="/usr/share/icons/Tango/32x32/actions/system-log-out.png"><action name="Execute"><command>lxde-logout</command></action></item>
<item label="" icon="/usr/share/icons/oxygen/48x48/actions/arrow-down.png"><action name="Execute"><command>sh -c "cp /home/username/.config/openbox/menu2.xml /home/username/.config/openbox/menu.xml && openbox --reconfigure"</command></action></item>
</menu>
</openbox_menu>

<?xml version="1.0" encoding="utf-8"?>
<openbox_menu xmlns="http://openbox.org/3.4/menu">
<menu id="root-menu" label="MENU 2">
<item label="" icon="/usr/share/icons/oxygen/48x48/actions/arrow-up.png"><action name="Execute"><command>sh -c "cp /home/username/.config/openbox/menu1.xml /home/username/.config/openbox/menu.xml && openbox --reconfigure"</command></action></item>
<item label="Abiword" icon="/usr/share/pixmaps/abiword_48.png"><action name="Execute"><command>abiword</command></action></item>
<item label="Gnumeric" icon="/usr/share/icons/hicolor/48x48/apps/gnumeric.png"><action name="Execute"><command>gnumeric</command></action></item>
<item label="GPicView" icon="/usr/share/pixmaps/gpicview.png"><action name="Execute"><command>gpicview</command></action></item>
<item label="Mirage" icon="/usr/share/pixmaps/mirage_scaled.png"><action name="Execute"><command>mirage</command></action></item>
<item label="LXMusic" icon="/usr/share/pixmaps/lxmusic_scaled.png"><action name="Execute"><command>lxmusic</command></action></item>
<item label="SMPlayer" icon="/usr/share/pixmaps/smplayer.xpm"><action name="Execute"><command>smplayer</command></action></item>
<item label="WinFF" icon="/usr/share/pixmaps/winff.xpm"><action name="Execute"><command>winff</command></action></item>
<item label="Xfburn" icon="/usr/share/icons/hicolor/48x48/stock/media/stock_xfburn-burn-cd.png"><action name="Execute"><command>xfburn</command></action></item>
<item label="Scanner" icon="/usr/share/icons/gnome/48x48/devices/scanner.png"><action name="Execute"><command>xsane</command></action></item>
<item label="Ruler" icon="/usr/share/screenruler/screenruler-icon-32x32.png"><action name="Execute"><command>screenruler</command></action></item>
<item label="Exit" icon="/usr/share/icons/Tango/32x32/actions/system-log-out.png"><action name="Execute"><command>lxde-logout</command></action></item>
<item label="" icon="/usr/share/icons/oxygen/48x48/actions/arrow-down.png"><action name="Execute"><command>sh -c "cp /home/username/.config/openbox/menu3.xml /home/username/.config/openbox/menu.xml && openbox --reconfigure"</command></action></item>
</menu>
</openbox_menu>

<?xml version="1.0" encoding="utf-8"?>
<openbox_menu xmlns="http://openbox.org/3.4/menu">
<menu id="root-menu" label="MENU 3">
<item label="" icon="/usr/share/icons/oxygen/48x48/actions/arrow-up.png"><action name="Execute"><command>sh -c "cp /home/username/.config/openbox/menu2.xml /home/username/.config/openbox/menu.xml && openbox --reconfigure"</command></action></item>
<item label="PCMan" icon="/usr/share/icons/Tango/32x32/apps/file-manager.png"><action name="Execute"><command>pcmanfm</command></action></item>
<item label="Desktop" icon="/usr/share/icons/Tango/32x32/places/user-desktop.png"><action name="Execute"><command>pcmanfm --desktop-pref</command></action></item>
<item label="Catfish" icon="/usr/share/icons/gnome/48x48/actions/edit-find.png"><action name="Execute"><command>catfish</command></action></item>
<item label="Themes" icon="/usr/share/icons/Tango/32x32/apps/preferences-desktop-theme.png"><action name="Execute"><command>obconf</command></action></item>
<item label="Look &" icon="/usr/share/icons/oxygen/48x48/apps/preferences-desktop-font.png"><action name="Execute"><command>lxappearance</command></action></item>
<item label="Synaptic" icon="/usr/share/synaptic/pixmaps/synaptic_32x32.xpm"><action name="Execute"><command>gksu /usr/sbin/synaptic</command></action></item>
<item label="Update" icon="/usr/share/icons/hicolor/48x48/apps/software-properties.png"><action name="Execute"><command>update-manager</command></action></item>
<item label="Exit" icon="/usr/share/icons/Tango/32x32/actions/system-log-out.png"><action name="Execute"><command>lxde-logout</command></action></item>
</menu>
</openbox_menu>
Note: Keep things simple, a complicated menu system is frustrating to use (... don't laugh).
KD
kjdixo
Posts: 21
Joined: Wed Jan 11, 2012 10:22 pm

Re: EDIT THE OPENBOX RIGHT CLICK MENU IN LXDE and ADD ICONS

Post by kjdixo »

Shortcut menu item for editing menus:
<item label="M Edit" icon="/usr/share/icons/Tango/32x32/apps/accessories-text-editor.png"><action name="Execute"><command>geany /home/username/.config/openbox/menu1.xml /home/username/.config/openbox/menu2.xml /home/username/.config/openbox/menu3.xml</command></action></item>
Add the above code to one of your menus, menu3.xml for example.
Usage:
Click 'M Edit' and Geany will open all 3 menus ready for editing.
Changes saved in Geany will 'stick' once the edited menu has been written (reloaded) to menu.xml (when openbox --reconfigure is next triggered).
KD
kjdixo
Posts: 21
Joined: Wed Jan 11, 2012 10:22 pm

Re: EDIT THE OPENBOX RIGHT CLICK MENU IN LXDE and ADD ICONS

Post by kjdixo »

This little modification reduces the number of right clicks required when switching between multiple menus.
I use the very useful program 'xdotool' to emulate a 'right mouse click' after selecting the alternative menu.
The menu then 'pops up immediately' without requiring another 'right mouse click'.

Image

'xdotool' lets you programatically (or manually) simulate keyboard input and mouse activity, move and resize windows, etc.
It is installable from Synaptic.

The code added to my menus is:-
';xdotool click 3' after every 'openbox --reconfigure'.
'click' identifies the mouse and '3' identifies the right button.

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<openbox_menu xmlns="http://openbox.org/3.4/menu">
<menu id="root-menu" label="MENU 1">
<item label="" icon="/usr/share/icons/Tango/32x32/actions/down.png"><action name="Execute"><command>sh -c "cp /home/username/.config/openbox/menu2.xml /home/username/.config/openbox/menu.xml && openbox --reconfigure; xdotool click 3"</command></action></item>
<item label="Thunar" icon="/usr/share/icons/Tango/32x32/apps/file-manager.png"><action name="Execute"><command>thunar</command></action></item>
<item label="Geany" icon="/usr/share/icons/hicolor/48x48/apps/geany.png"><action name="Execute"><command>geany</command></action></item>
<item label="Firefox" icon="/home/username/.config/firefox.png"><action name="Execute"><command>firefox</command></action></item>
<item label="Opera" icon="/usr/share/icons/hicolor/48x48/apps/opera-browser.png"><action name="Execute"><command>opera</command></action></item>
<item label="Filezilla" icon="/usr/share/icons/hicolor/48x48/apps/filezilla.png"><action name="Execute"><command>filezilla</command></action></item>
<item label="GIMP" icon="/usr/share/icons/hicolor/48x48/apps/gimp.png"><action name="Execute"><command>gimp</command></action></item>
<item label="GPicView" icon="/usr/share/pixmaps/gpicview.png"><action name="Execute"><command>gpicview</command></action></item>
<item label="Mirage" icon="/home/username/.config/mirage/mirage.png"><action name="Execute"><command>mirage</command></action></item>
<item label="SMPlayer" icon="/usr/share/pixmaps/smplayer.xpm"><action name="Execute"><command>smplayer</command></action></item>
<item label="Exaile" icon="/home/username/.config/exaile.png"><action name="Execute"><command>exaile</command></action></item>
<item label="Autokey" icon="/usr/share/pixmaps/akicon.png"><action name="Execute"><command>autokey</command></action></item>
<item label="WinFF" icon="/usr/share/pixmaps/winff.xpm"><action name="Execute"><command>winff</command></action></item>
<item label="Exit" icon="/usr/share/icons/Tango/32x32/actions/system-log-out.png"><action name="Execute"><command>openbox --exit</command></action></item>
</menu>
</openbox_menu>

<?xml version="1.0" encoding="utf-8"?>
<openbox_menu xmlns="http://openbox.org/3.4/menu">
<menu id="root-menu" label="MENU 2">
<item label="" icon="/usr/share/icons/Tango/32x32/actions/up.png"><action name="Execute"><command>sh -c "cp /home/username/.config/openbox/menu1.xml /home/username/.config/openbox/menu.xml && openbox --reconfigure; xdotool click 3"</command></action></item>
<item label="Thunar" icon="/usr/share/icons/Tango/32x32/apps/file-manager.png"><action name="Execute"><command>thunar</command></action></item>
<item label="Abiword" icon="/usr/share/pixmaps/abiword_48.png"><action name="Execute"><command>abiword</command></action></item>
<item label="Gnumeric" icon="/usr/share/icons/hicolor/48x48/apps/gnumeric.png"><action name="Execute"><command>gnumeric</command></action></item>
<item label="Tasks" icon="/home/username/.config/processor.png"><action name="Execute"><command>lxtask</command></action></item>
<item label="Terminal" icon="/usr/share/pixmaps/gnome-term-linux.png"><action name="Execute"><command>lxterminal</command></action></item>
<item label="GColor2" icon="/usr/share/pixmaps/gcolor2/icon.png"><action name="Execute"><command>gcolor2</command></action></item>
<item label="Settings" icon="/usr/share/icons/Tango/32x32/apps/preferences-desktop-theme.png"><action name="Execute"><command>obconf</command></action></item>
<item label="Settings" icon="/usr/share/pixmaps/obconf.png"><action name="Execute"><command>lxappearance</command></action></item>
<item label="Update" icon="/usr/share/icons/hicolor/48x48/apps/software-properties.png"><action name="Execute"><command>update-manager</command></action></item>
<item label="Mount" icon="/usr/share/pixmaps/mm.xpm"><action name="Execute"><command>gksu mountmanager</command></action></item>
<item label="Xfburn" icon="/usr/share/icons/hicolor/48x48/stock/media/stock_xfburn-burn-cd.png"><action name="Execute"><command>xfburn</command></action></item>
<item label="MENUS" icon="/usr/share/icons/Tango/32x32/apps/accessories-text-editor.png"><action name="Execute"><command>geany /home/username/.config/openbox/menu1.xml /home/username/.config/openbox/menu2.xml</command></action></item>
<item label="Synaptic" icon="/usr/share/synaptic/pixmaps/synaptic_32x32.xpm"><action name="Execute"><command>gksu /usr/sbin/synaptic</command></action></item>
<item label="Scanner" icon="/usr/share/icons/Tango/32x32/actions/view-fullscreen.png"><action name="Execute"><command>simple-scan</command></action></item>
<item label="NVIDIA" icon="/usr/share/pixmaps/nvidia-current-settings.png"><action name="Execute"><command>/usr/lib/nvidia-settings/bin/nvidia-settings</command></action></item>
<item label="Exit" icon="/usr/share/icons/Tango/32x32/actions/system-log-out.png"><action name="Execute"><command>openbox --exit</command></action></item>
</menu>
</openbox_menu>

I am currently running Lubuntu without the LXDE desktop, ie. Openbox only.
I am using 'trayer' as the notification tray, so I can see my network status etc.
Code for the two menus is also at
http://kdworld7.net/links/computers/xdt ... u1.xml.txt
http://kdworld7.net/links/computers/xdt ... u2.xml.txt
Remember to replace the word 'username' with your own username.
Remember to initialize everything as described in my previous posts.
That means menu.xml should be made the same as menu1.xml and then if necessary type in a terminal 'openbox --reconfigure'.
I also created some of my own 48x48 icons as the existing icons were too large for the menus, the icons are linked to in the menus.

This modification makes menu switching faster and 'xdotool' enables a whole new range of possibilities.
I hope this is useful somewhere.
KD

Edited to change menu2.xml code: mountmanager to gksu mountmanager
Last edited by kjdixo on Sun Jan 29, 2012 11:28 am, edited 2 times in total.
kjdixo
Posts: 21
Joined: Wed Jan 11, 2012 10:22 pm

Re: EDIT THE OPENBOX RIGHT CLICK MENU IN LXDE and ADD ICONS

Post by kjdixo »

For the xdotool modification, during repeated switching events between menu1 and menu2, the mouse cursor repositions itself over the top left corner of the new menu.
The overall effect of this, is to move the menu down and to the right each time it is switched.
This can be annoying, so to counteract the effect I used some more xdotool code.
My method here is very 'rough and ready' and can probably be improved upon.

Old: xdotool click 3
New: xdotool mousemove_relative --polar 280 80; xdotool click 3; xdotool mousemove_relative --polar 100 80

xdotool:
http://www.semicomplete.com/projects/xd ... tool.xhtml

Modified menus:
http://kdworld7.net/links/computers/xdt ... u1.xml.txt
http://kdworld7.net/links/computers/xdt ... u2.xml.txt

IMPORTANT NOTE:
If the menus don't work initially then check you have changed 'username' in the menus to your own username.
Also:
Adding this extra bit of 'xdotool code' causes a slight flicker of the menu whilst the code executes.
So not perfect.
However I am hoping that this is not going to be too much of a problem.
KD
kjdixo
Posts: 21
Joined: Wed Jan 11, 2012 10:22 pm

Re: EDIT THE OPENBOX RIGHT CLICK MENU IN LXDE and ADD ICONS

Post by kjdixo »

Make a virtual keyboard in the Openbox Right Click Menu.
Example - Portuguese Accented Characters.
Image
My system is set up as en-gb and I sometimes want to type in pt (portuguese).
The menu can be adapted for other languages (character sets) - research on the internet to find the codes (e.g. &#192;) you want to use.

1.Ensure xdotool is installed.

Review and understand previous posts in this topic http://forum.lxde.org/viewtopic.php?f=24&t=31525

Create a new menu 'MENU3' - menu3.xml

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<openbox_menu xmlns="http://openbox.org/3.4/menu">
<menu id="root-menu" label="MENU 3">
<item label="" icon="/usr/share/icons/Tango/32x32/actions/go-home.png"><action name="Execute"><command>sh -c "cp /home/username/.config/openbox/menu1.xml /home/username/.config/openbox/menu.xml && openbox --reconfigure;xdotool mousemove_relative --polar 280 80; xdotool click 3;xdotool mousemove_relative  --polar 100 80"</command></action></item>
<item label="&#192;" icon="/usr/share/icons/oxygen/48x48/apps/preferences-desktop-keyboard.png"><action name="Execute"><command>xdotool type &#192;</command></action></item>
<item label="&#193;" icon="/usr/share/icons/oxygen/48x48/apps/preferences-desktop-keyboard.png"><action name="Execute"><command>xdotool type &#193;</command></action></item>
<item label="&#194;" icon="/usr/share/icons/oxygen/48x48/apps/preferences-desktop-keyboard.png"><action name="Execute"><command>xdotool type &#194;</command></action></item>
<item label="&#195;" icon="/usr/share/icons/oxygen/48x48/apps/preferences-desktop-keyboard.png"><action name="Execute"><command>xdotool type &#195;</command></action></item>
<item label="&#199;" icon="/usr/share/icons/oxygen/48x48/apps/preferences-desktop-keyboard.png"><action name="Execute"><command>xdotool type &#199;</command></action></item>
<item label="&#201;" icon="/usr/share/icons/oxygen/48x48/apps/preferences-desktop-keyboard.png"><action name="Execute"><command>xdotool type &#201;</command></action></item>
<item label="&#202;" icon="/usr/share/icons/oxygen/48x48/apps/preferences-desktop-keyboard.png"><action name="Execute"><command>xdotool type &#202;</command></action></item>
<item label="&#205;" icon="/usr/share/icons/oxygen/48x48/apps/preferences-desktop-keyboard.png"><action name="Execute"><command>xdotool type &#205;</command></action></item>
<item label="&#211;" icon="/usr/share/icons/oxygen/48x48/apps/preferences-desktop-keyboard.png"><action name="Execute"><command>xdotool type &#211;</command></action></item>
<item label="&#212;" icon="/usr/share/icons/oxygen/48x48/apps/preferences-desktop-keyboard.png"><action name="Execute"><command>xdotool type &#212;</command></action></item>
<item label="&#213;" icon="/usr/share/icons/oxygen/48x48/apps/preferences-desktop-keyboard.png"><action name="Execute"><command>xdotool type &#213;</command></action></item>
<item label="&#218;" icon="/usr/share/icons/oxygen/48x48/apps/preferences-desktop-keyboard.png"><action name="Execute"><command>xdotool type &#218;</command></action></item>
<item label="&#171;" icon="/usr/share/icons/oxygen/48x48/apps/preferences-desktop-keyboard.png"><action name="Execute"><command>xdotool type &#171;</command></action></item>
<item label="&#187;" icon="/usr/share/icons/oxygen/48x48/apps/preferences-desktop-keyboard.png"><action name="Execute"><command>xdotool type &#187;</command></action></item>
<item label="&#170;" icon="/usr/share/icons/oxygen/48x48/apps/preferences-desktop-keyboard.png"><action name="Execute"><command>xdotool type &#170;</command></action></item>
<item label="&#186;" icon="/usr/share/icons/oxygen/48x48/apps/preferences-desktop-keyboard.png"><action name="Execute"><command>xdotool type &#186;</command></action></item>
<item label="GB" icon="/usr/share/icons/oxygen/48x48/apps/preferences-desktop-keyboard.png"><action name="Execute"><command>setxkbmap gb</command></action></item>
<item label="PT" icon="/usr/share/icons/oxygen/48x48/apps/preferences-desktop-keyboard.png"><action name="Execute"><command>setxkbmap pt</command></action></item>
</menu>
</openbox_menu>
2. Link to 'MENU3' from 'MENU1' by adding the following line to menu1.xml (see previous posts and integrate the line below into the menu system).

Code: Select all

<item label="PT" icon="/usr/share/icons/oxygen/48x48/apps/preferences-desktop-keyboard.png"><action name="Execute"><command>sh -c "cp /home/username/.config/openbox/menu3.xml /home/username/.config/openbox/menu.xml && openbox --reconfigure;xdotool mousemove_relative --polar 280 80; xdotool click 3;xdotool mousemove_relative  --polar 100 80"</command></action></item>
http://kdworld7.net/links/computers/xdt ... u3.xml.txt

IMPORTANT NOTE:
If the menus don't work initially then check you have changed 'username' in the menus to your own username.

3. Summary
The first 16 xdotool commands type accented characters.
Use the caps lock key to toggle upper and lower case.
I have used upper case characters in my menu because they are easier to read (larger) in the right click menu.
Codes do exist for upper e.g.(&#192; =À) case and lower e.g.(&#224; = à) case, however I found only upper case necessary, in conjunction with the caps lock key.

4. Extras
The last 2 setxkbmap commands change the layout of the keyboard to either PT or GB and they are nothing to do with the xdotool commands.
If you wish, you can omit the setxkbmap commands, or only use them - instead of the xdotool commands, I added them for those who prefer to learn and use keyboard shortcuts.
Instructions for keyboard shortcuts when in PT mode (setxkbmap pt)

Use the caps lock key to toggle upper and lower case.
Type # then a to get ã.
Type Shift and ] then a to get à.
Type ] then a to get á.
Type ] then e to get é.
Type ] then i to get í.
Type ] then o to get ó.
Type ] then u to get ú.
Type ; to get ç.
Type = to get «.
Type Shift and = to get ».
Type ' to get º.
Type Shift and ' to get ª.
etcetera.
There are many more virtual keyboard shortcuts.
I find the keyboard shortcuts difficult and prefer to use the right click menu.
Of course - I could go and buy a proper Portuguese keyboard instead.
This web page is useful http://www.branah.com/portuguese
kjdixo
Posts: 21
Joined: Wed Jan 11, 2012 10:22 pm

Re: EDIT THE OPENBOX RIGHT CLICK MENU IN LXDE and ADD ICONS

Post by kjdixo »

This post on Linux Village forum might also be of interest.
It shows more pictures of my right click menu and also talks about (scroll up the page) feh and stalonetray.
http://forum.linuxvillage.org/index.php?topic=58.0

KD
Last edited by kjdixo on Mon Feb 10, 2014 10:17 pm, edited 1 time in total.
Rex Bouwense
Posts: 1093
Joined: Sat Aug 27, 2011 5:44 pm
Location: Sierra Vista, Arizona USA
Contact:

Re: EDIT THE OPENBOX RIGHT CLICK MENU IN LXDE and ADD ICONS

Post by Rex Bouwense »

I am surprised that no one has thanked you for placing so much information in one location. The only other person who has went to such length is seppalta and his web sites:
http://lxlinux.com/#index
http://lxlinux.com/introduction.html
http://lxlinux.com/debian.html
People like you folks make it a little easier for those of us who are still typing with two fingers. Thanks.
Rex
Locked