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

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

Post by kjdixo »

Thanks Rex.
I enjoy it.
Those seppalta pages that you linked to look fantastic.
I will bookmark them.
Thanks.
KD
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 »

He is also a very active contributor on this forum. Reading his posts is just like sitting in class and listening to some professor dispense knowledge. I love it. I believe that he has lxde (or a modified version of it) on three separate Operating Systems. I am lucky to have it on one. We all can't be brilliant.
Rex
seppalta
Posts: 449
Joined: Tue Sep 20, 2011 6:09 am
Location: USA
Contact:

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

Post by seppalta »

Thanks, Rex, but I'm just an ordinary user. For anybody interested, I picked up on kjdixo's use of xdotool to put a characters map directly into the Openbox Menu. I'll attach an image of the result. For details, see http://lxlinux.com/openbox.html#7.
Attachments
characters.png
(142.17 KiB) Not downloaded yet
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 »

Instant Screen Shot
from the Right Click Menu

An impressive and very useful shortcut for the Right Click Menu.
1. Install mtPaint.
2. Add this code to menu1.xml

Code: Select all

<item label="Snap" icon="/usr/share/pixmaps/mtpaint.png"><action name="Execute"><command>mtpaint -s</command></action></item>
When this command is launched it will open mtPaint with a Screen Shot (useful for grabbing images from web pages).
Select an area on the captured image > then in the mtPaint menu go to Image > Crop.

To configure mtPaint go to - File > Actions > Configure.
There are several useful tasks that can be configured incuding - time delayed screenshot and create thumbnails.
It should be possible to run any of the mtPaint 'Configure File Action' commands directly from the Right Click Menu, simply include them as items in menu1.xml.
I use a different program called Mirage to make my thumbnails.
KD
GrouchyGaijin
Posts: 5
Joined: Wed May 28, 2014 8:15 pm
Location: Sweden

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

Post by GrouchyGaijin »

Hi thank you for posting such a thourough tutorial!
I am brand new to lubuntu after having used Unity for a few years.

I have a question that I hope someone can help me with. I've read through this tutorial and attempted to follow the instructions, however my question is:
How exactly do you make a new menu within the right click menu?
When I look at the menu.xml file I see:

Code: Select all

<menu id="apps-accessories-menu" label="Accessories">
<menu id="apps-net-menu" label="Internet">
<menu id="apps-office-menu" label="Office">
<menu id="apps-multimedia-menu" label="Multimedia">
<menu id="system-menu" label="System">
<menu id="root-menu" label="Lubuntu">


I have tried to create my own menu called scripts with no luck.
I used this block of code in the menu.xml file:

Code: Select all

<menu id="scripts-menu" label="scripts">
		<item label="test">
			<action name="Execute">
				<execute>gome-terminal -x /home/john/scripts/exrate</execute>
			</action>
		</item>
	</menu>
What am I doing wrong? I can get individual menu items to appear within preexisting menus, but I can't seem to add a new menu.
Perhaps menu is the wrong word? What I mean is a new section with the lable of scripts in the menu that appears when you right click on the desktop.

Thank you - I really appreciate any help someone can give me with this.

GG
Thank you,

GG
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 »

Welcome to the LXDE forum. We are a small forum with just a few active members.
Rex
seppalta
Posts: 449
Joined: Tue Sep 20, 2011 6:09 am
Location: USA
Contact:

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

Post by seppalta »

but I can't seem to add a new menu
See http://lxlinux.com/openbox.html for a guide.
GrouchyGaijin
Posts: 5
Joined: Wed May 28, 2014 8:15 pm
Location: Sweden

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

Post by GrouchyGaijin »

Thank you - I ended up scrapping the preexisting menu and making a totally new one.
In the menu I made from scratch I am able to get it to do exactly what I want.
Thank you,

GG
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 »

Please see my next post.
Last edited by kjdixo on Thu Jun 05, 2014 12:18 pm, edited 1 time 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 »

Sorry I missed the last few comments.
Menu System.
The window focus behaviour when right-clicking changed about 6 months ago.
In some recent Ubuntu versions I found that the xdotool 'type' command in my menu did not enter the text (ie Portuguese characters) into text boxes or a text editor like it once did, because right clicking on the desktop now de-focusses the window where the text needs to be entered.
This was not the case when I first wrote my comments above.
When I originally wrote the article, left-clicking on the desktop de-focussed the window, whereas right-clicking did not and the window remained in focus.
However I have found a modern linux distro where the focussing is okay for my 'text entry' menu code.
The distro is Quirky Puppy tahr-6.0.5 which can use the ubuntu repositories and is a proper hard drive install and has a snapshot and restore system which is great for restoring the os after a failed tweak.
http://distro.ibiblio.org/quirky/quirky ... .5.usfs.xz
I used a Precise LXPup 12.12 liveCD to format a hard drive to ext4 using GParted,
then the following script to install Quirky Puppy to the hard drive.
http://distro.ibiblio.org/quirky/quirky ... rtition.sh
This does the os install, but with no boot loader.
Then use the grubconfig menu item in the LXPup 12.12 LiveCD to install (to MBR) the grub boot loader, it will probably be in sda1/boot/grub/
Another way to do it if you already have ubuntu installed is to modify the existing grub menu.
In that case use the command grub-mkconfig -o /boot/grub/grub.cfg to find the Puppy OS and add it to the existing boot menu.
I have found that all my tweaking works with this distro and the forums are very helpful.
When installing any programs with puppy first update the repository database and when installing always examine dependencies and install all required files. It all works very well.
Extra useful notes.
I have dual 22inch monitors and did not need to mess with xorg.conf.
If you have an Nvida graphics card and install the Nouveau driver.
Simply use xrandr to find out your monitor identities DVI-I-1 and VGA-1 for example and make sure they fit exactly the configured size up to 8192x8192 pixels.
Then put this script (example only ... put in your own configs) in your /root/Startup/ folder:
#!/bin/sh
xrandr --fb 1680x2100
xrandr --output VGA-1 --above DVI-I-1
Also another script for the fehbg wallpaper background, after installing feh:
#!/bin/sh
feh --bg-tile '/root/.wallpapers/ptv2.jpg'
Lastly for a system tray, install stalonetray and make a link to the stalonetray executable in the Startup folder.
Look at permissions and make the above scripts executable.
Don't forget to uninstall rox-filer as this takes control of the desktop and prevents some things working here.
The file /root/.jwmrc has the puppy jwm menu entries which can be manually copied and tags converted to the openbox menu xml format.
Edit (additional help) July 19th 2014:
Alternatively write a bash script (save it to your /root/Startup/ folder in Puppy Linux) to parse /root/.jwmrc and automatically write a jwm-menu.xml into the /root/.config/openbox/ menus folder. The script would keep the JWM sub menu layout, by parsing the JWM menu (/root/.jwmrc) and then converting it to the Openbox menu/sub menu format.
Or ... Simple example:
Write a bash script (save it to your /root/Startup folder in Puppy Linux) to parse the /usr/share/applications/ folder and automatically write a usr-share-applications-menu.xml into the /root/.config/openbox/ menus folder.
This will give you a 'flat', 'all-entries' menu, with no sub menus, but it is a good starting point for further experimentation, and it may suffice if you simply want to access all of the puppy installed programs and scripts.
The script below extracts the relevant menu entries from the .desktop files in the usr/share/applications/ folder and then writes an open box menu. That menu will then need to be integrated with (linked to) the other right click menus.

Code: Select all

#!/bin/bash
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
FINDDIR="/usr/share/applications"
OUTFILE="$HOME/.config/openbox/usr-share-applications-menu.xml"
FILES="$(find $FINDDIR -name '*.desktop')"
if [ -e $OUTFILE ];then
rm -f $OUTFILE
echo '<openbox_menu xmlns="http://openbox.org/">
<menu id="root-menu" label="usr-share-applications-menu">
<item label="" icon="/usr/share/icons/Tango/32x32/actions/go-home.png"><action name="Execute"><command>sh -c "cp /root/.config/openbox/menu1.xml /root/.config/openbox/menu.xml && openbox --reconfigure;xdotool mousemove_relative --polar 280 80; xdotool click 3;xdotool mousemove_relative  --polar 100 80"</command></action></item>' >>$OUTFILE
for lines in $FILES;do
echo '<item label="'"$(grep Name $lines | gawk -F"=" '{print $2}' | sed '2,1000d')"'" icon="/usr/local/share/icons/'"$(grep Icon $lines | gawk -F"=" '{print $2}' | sed '2,1000d')"'"><action name="Execute"><command>'"$(grep Exec $lines | gawk -F"=" '{print $2}' | sed '2,4d')"'</command></action></item>'  >> $OUTFILE
done
echo "</menu>
</openbox_menu>" >> $OUTFILE
sed -i 's/\/usr\/local\/share\/icons\/\//\//g' $OUTFILE
fi
IFS=$SAVEIFS
Edit (additional help) June 7th 2014:
Remember to first install openbox from the Puppy Package Manager, then use the puppy jwm menu to logout of the jwm window manager (command wmexit), this logs out of X.
To get to the openbox window manager type the command 'startx openbox' or 'startx jwm' for jwm.
The system remembers which window manager you used last, so you normally only have to do this once, to enable openbox as your window manager.
There are probably some menu item commands that could be written to enable single click toggling between the 2 window managers.
Puppy rant over.
Have lots of fun configuring and tweaking.

Edit (additional help) January 4th 2015:
This note is related to the posting above regarding monitors and xrandr, but is specifically relevant to small screen netbooks ... xrandr is very useful for configuring netbook screens to pan over larger display areas.
An example of where this is useful (necessary) is when taking screenshots using mtPaint, where the area of the screenshot extends to a size greater than the netbook screen.
To be concise I will just post my right click menu entries and let you experiment.

Code: Select all

<item label="Snap" icon="/usr/share/pixmaps/mtpaint.png"><action name="Execute"><command>mtpaint -s</command></action></item>
<item label="1kpx" icon="/usr/share/pixmaps/mtpaint.png"><action name="Execute"><command>xrandr --output LVDS1 --mode 1024x600 --panning 1024x1000 --scale 1.0x1.0</command></action></item>
<item label="600px" icon="/usr/share/pixmaps/mtpaint.png"><action name="Execute"><command>xrandr --output LVDS1 --mode 1024x600 --panning 1024x600 --scale 1.0x1.0</command></action></item>
In my opinion 'seriously useful and fun'.
More information from Linux Mint and Crunchbang forums.

http://forums.linuxmint.com/viewtopic.php?f=90&t=35652
http://crunchbang.org/forums/viewtopic.php?id=20634
Last edited by kjdixo on Sun Jan 04, 2015 6:50 pm, edited 5 times in total.
Locked