How to Add a Launchbar To the Top of Your Screen, Puppy 4.3

Using applications, configuring, problems
Message
Author
User avatar
DaveS
Posts: 3685
Joined: Thu 09 Oct 2008, 16:01
Location: UK

How to Add a Launchbar To the Top of Your Screen, Puppy 4.3

#1 Post by DaveS »

Image

Puppy 4.1 and the brilliant new 4.3 provide a wonderful base upon which to build a distro customised exactly the way you want. This section deals with adding a launchbar to the top of your screen, WITHOUT resorting to adding more megabytes of new program.
A top launchbar is actually a JWM feature, all you have to do is set it up. It consists of nothing more than a text file called whatever you like, in your /root/ directory. Conventionally it is called
.jwmrc-tray-top
Once you have created the text file, you tell jwm where to find it by adding this code to /root/.jwmrc AND /etc/xdg/templates/_root_.jwmrc

Code: Select all

<Include>/root/.jwmrc-tray-top</Include>
Just find the section which has
<Include/root/.jwmrc-tray</Include>

and add your tray beneath it so that it looks like this

Code: Select all

<Include>/root/.jwmrc-tray</Include>
	 <Include>/root/.jwmrc-tray-top</Include>
The format for the tray text file is as below (this is my top tray)

Code: Select all

<JWM>
  <Tray autohide="true" insert="right" valign="top" halign="center" height="36" >
  <TrayButton popup="Account" icon="/usr/share/midi-icons/openofficeorg36-base.png">exec:sbase /mnt/sda3/my-documents/data/accounts.odb</TrayButton>
  <TrayButton popup="Files, Root" icon="/usr/share/midi-icons/home24.png">exec:rox</TrayButton>
  <TrayButton popup="My-Documents" icon="/usr/share/midi-icons/folder24.png">exec:rox /mnt/sda3/my-documents</TrayButton>
  <TrayButton popup="Email" icon="/usr/share/midi-icons/email24.png">exec:firefox</TrayButton>
  <TrayButton popup="Browser" icon="/usr/share/midi-icons/www24.png">exec:firefox</TrayButton>
 <!-- <TrayButton popup="Grsync" icon="/usr/local/lib/X11/pixmaps/grsync36.png">exec:grsync</TrayButton> -->
  <TrayButton popup="TKSpider" icon="/usr/share/mini-icons/mini-trebol.xpm">exec:tkspider</TrayButton>
  <TrayButton popup="Rxvt - terminal emulator" icon="/usr/share/midi-icons/console24.png">exec:rxvt</TrayButton>
  <TrayButton popup="Geany - text editor" icon="/usr/share/midi-icons/edit24.png">exec:geany</TrayButton>
  <TrayButton popup="Pfind - file finder" icon="/usr/local/lib/X11/mini-icons/mini-search.xpm">exec:pfind</TrayButton>
  <TrayButton popup="Pwireless - wireless scanner" icon="/usr/share/midi-icons/network24.png">exec:Pwireless</TrayButton>
  <TrayButton popup="Galculator - 3 way calculator" icon="/usr/share/pixmaps/galculator_48x48.png">exec:galculator</TrayButton>
  <TrayButton popup="CUPS Printer Wizard" icon="/usr/share/midi-icons/printer24.png">exec:cups_shell</TrayButton>
 </Tray>
</JWM>
You should be able to use this as a template to set it up just the way you want, which is what JWM is all about.
The top part of the code tells JWM where to put the tray. The line in the middle that starts <!-- and ends --> is the way you tell JWM to ignore an entry, and is more flexible than deleting the entry, in case you change your mind.

It looks like a lot of work, but this is how to get a system working JUST the way you want, and it is easier working with a template :)
Once you have set it up, re-start JWM to activate it, and customise the heck out of it!
Dont forget to add your 'include' command to the JWM master template at /etc/xdg/templates/_root_.jwmrc
Good luck.
Questions? Just ask................
Last edited by DaveS on Mon 14 Jun 2010, 06:48, edited 2 times in total.
Spup Frugal HD and USB
Root forever!

User avatar
DaveS
Posts: 3685
Joined: Thu 09 Oct 2008, 16:01
Location: UK

#2 Post by DaveS »

The Text File Format

Creating the text file .jwmrc-tray-top is no big problem, just use your favourite text editor, Geany is good.

It really consists of three sections, the overall 'envelope', the command that sets the screen position etc of the bar, and the commands the bar contains.

The envelope is just a command at the very top that says

Code: Select all

<JWM>
and at the very bottom a matching ending,

Code: Select all

</JWM>
The command that defines the bar is also a kind of envelope, it starts

Code: Select all

<Tray
, and ends

Code: Select all

</Tray>
The stuff in between are the commands you want. Here is a simple example:

Code: Select all

<JWM>
  <Tray autohide="true" insert="right" valign="top" halign="center" height="36" >
  <TrayButton popup="Browser" icon="/usr/share/midi-icons/www24.png">exec:firefox</TrayButton>
 </Tray>
</JWM>
This bar would sit at the top of the screen in the centre and would auto-hide. It would have a depth of 36. It would contain just one command, the command to launch Firefox (if you have it on your system of course).
The command line begins <TrayButton. Next is the word popup. Popup defines the text that will pop up if the mouse is hovered over the button, and the syntax is popup="Browser" where Browser is the word you want to appear. Next, comes the icon required and its path. This has fully defined the button itself, so it gets this > at the end of the definition, thus:

<TrayButton popup="Browser" icon="/usr/share/midi-icons/www24.png">

Next, we give the command to execute like this

Code: Select all

exec:firefox
, so now we have

<TrayButton popup="Browser" icon="/usr/share/midi-icons/www24.png">exec:firefox

Then we finish the command line with this

Code: Select all

</TrayButton>
to give us this:

<TrayButton popup="Browser" icon="/usr/share/midi-icons/www24.png">exec:firefox</TrayButton>


You can go on adding commands until you have the bar set up just the way you want.
Last edited by DaveS on Mon 21 Sep 2009, 12:28, edited 2 times in total.
Spup Frugal HD and USB
Root forever!

User avatar
DaveS
Posts: 3685
Joined: Thu 09 Oct 2008, 16:01
Location: UK

#3 Post by DaveS »

More Complex Launchers

Its worth bearing in mind that you can use these buttons to execute more complex commands. Suppose you use a particular file regularly, maybe a database or home banking file. Maybe you would go to the menu, launch Gnumeric, and then open your file. Well, you could add a launcher that would go straight to it. The command bit of the line would look something like this:

exec:gnumeric /root/my-documents/myfile.*

where myfile.* is the name of your file with its extension.

Pretty much if you can get a command to run in a terminal window, you can make the same command run via a JWM launcher button.
Last edited by DaveS on Mon 21 Sep 2009, 14:51, edited 1 time in total.
Spup Frugal HD and USB
Root forever!

aarf

#4 Post by aarf »

thanks for your efforts DaveS but.....

can we just have a pet to download and click :D , my mind is now reluctant to do anything more arduous now that puppy has spoiled me :lol:

User avatar
DaveS
Posts: 3685
Joined: Thu 09 Oct 2008, 16:01
Location: UK

#5 Post by DaveS »

aarf wrote:thanks for your efforts DaveS but.....

can we just have a pet to download and click :D , my mind is now reluctant to do anything more arduous now that puppy has spoiled me :lol:
LOL
Well I guess that is exactly what Ptray is, but it is tough to second guess what folks will add to their systems.
Spup Frugal HD and USB
Root forever!

aarf

#6 Post by aarf »

DaveS wrote:
aarf wrote:thanks for your efforts DaveS but.....

can we just have a pet to download and click :D , my mind is now reluctant to do anything more arduous now that puppy has spoiled me :lol:
LOL
Well I guess that is exactly what Ptray is, but it is tough to second guess what folks will add to their systems.
didnt see any complaints from the standard one in 421 so that composition would be a good start. if modification is required then they can do some reading here.

caleb72
Posts: 57
Joined: Fri 15 May 2009, 12:44

#7 Post by caleb72 »

Thanks for this - I didn't realise that you could do this without the application. I actually prefer this method of adding the launch bar.

Regards
Caleb

User avatar
DaveS
Posts: 3685
Joined: Thu 09 Oct 2008, 16:01
Location: UK

#8 Post by DaveS »

caleb72 wrote:Thanks for this - I didn't realise that you could do this without the application. I actually prefer this method of adding the launch bar.

Regards
Caleb
Great. Also, doing it this way adds about 1500 bytes! not Kilobytes or Megabytes, just Bytes! Less than writing an email.
Spup Frugal HD and USB
Root forever!

Kal
Posts: 626
Joined: Thu 05 May 2005, 16:59
Location: California, High Desert

Ptray

#9 Post by Kal »

Ptray was a little too involved and I had to modify the configure file all the time anyway. I earlier had added the top tray to 412, and 430, just the same as you have said. A very nice write up.

Here is a Tray Button I add for getting to the config file:

Code: Select all

<TrayButton popup="Tray Config" icon="utility24.png">exec:geany /root/.jwmrc-tray-top</TrayButton>
Kal

User avatar
DaveS
Posts: 3685
Joined: Thu 09 Oct 2008, 16:01
Location: UK

#10 Post by DaveS »

Dont forget, you are not restricted to only a top try, or even a single top tray. Here is the code for a side tray that I have for downloading podcasts when I want them:

Code: Select all

<JWM>
	<Tray autohide="true" border="0" y="10" halign="left" width="36" layout="vertical">
	    <TrayButton popup="Handel" icon="/usr/share/midi-icons/handel.png">exec:/usr/local/pods/call_handel.sh</TrayButton>
		<TrayButton popup="Tuxradar" icon="/usr/share/midi-icons/tuxradar.png">exec:/usr/local/pods/call_txradar.sh</TrayButton>
		<TrayButton popup="OTM" icon="/usr/share/midi-icons/otm.png">exec:/usr/local/pods/call_otm.sh</TrayButton>
		<TrayButton popup="Outlaws" icon="/usr/share/midi-icons/outlaws36.png">exec:/usr/local/pods/call_outlaws.sh</TrayButton>
		<TrayButton popup="Common Sense" icon="/usr/share/midi-icons/sense.png">exec:/usr/local/pods/call_sense.sh</TrayButton>
		<TrayButton popup="Hardcore History" icon="/usr/share/midi-icons/history.png">exec:/usr/local/pods/call_history.sh</TrayButton>
		<TrayButton popup="Radio Lab" icon="/usr/share/midi-icons/radiolab.png">exec:/usr/local/pods/call_radiolab.sh</TrayButton>
		<TrayButton popup="Friday Commedy" icon="/usr/share/midi-icons/fricom.png">exec:/usr/local/pods/call_fricom.sh</TrayButton>
		<TrayButton popup="Planet Money" icon="/usr/share/midi-icons/money.png">exec:/usr/local/pods/call_money.sh</TrayButton>
		<TrayButton popup="Aqualung audio player and ripper" icon="aqualung.png">exec:aqualung</TrayButton>
		<TrayButton popup="Files" icon="/usr/share/midi-icons/folder24.png">exec:rox ~/Podcast</TrayButton>
	</Tray>
</JWM>
Same approach, just specify the position you want.




Image


I have it set to auto-hide, so just touching the edge of the screen in the general area pops it out.
Spup Frugal HD and USB
Root forever!

aarf

#11 Post by aarf »

have found a time where my mind was not on strike or R&R.
from 421

Code: Select all

    <JWM>
 <Tray autohide="true" insert="right" valign="top" halign="center" height="36" >
  <TrayButton popup="Edit tray" icon="star48.png">exec:ptray</TrayButton>
  <TrayButton popup="" icon="nothing.png">exec:</TrayButton>
  <TrayButton popup="" icon="nothing.png">exec:</TrayButton>
  <TrayButton popup="" icon="nothing.png">exec:</TrayButton>
  
  <TrayButton popup="Rxvt - terminal emulator" icon="/usr/local/lib/X11/pixmaps/console48.png">exec:rxvt</TrayButton>
  <TrayButton popup="Leafpad - text editor" icon="/usr/local/lib/X11/pixmaps/leafpad.png">exec:leafpad</TrayButton>
  <TrayButton popup="Pfind - file finder" icon="/usr/local/lib/X11/mini-icons/mini-search.xpm">exec:pfind</TrayButton>
  <TrayButton popup="Pprocess - process manager" icon="/usr/local/lib/X11/mini-icons/mini-run.xpm">exec:pprocess</TrayButton>
  <TrayButton popup="Pwireless - wireless scanner" icon="/usr/local/lib/X11/mini-icons/Pwireless.png">exec:Pwireless</TrayButton>
  <TrayButton popup="" icon="/usr/local/lib/X11/mini-icons/tb_print.xpm">exec:exec defaulthtmlviewer http://localhost:631/</TrayButton>
  <TrayButton popup="Galculator - 3 way calculator" icon="/usr/share/pixmaps/galculator_48x48.png">exec:galculator</TrayButton>

  <TrayButton popup="" icon="nothing.png">exec:</TrayButton>
  <TrayButton popup="" icon="nothing.png">exec:</TrayButton>
  <TrayButton popup="" icon="nothing.png">exec:</TrayButton>
  <TrayButton popup="Show desktop" icon="show-desktop24.png">showdesktop</TrayButton>
  <TrayButton popup="Lock screen" icon="lock-screen48.png">exec:/usr/local/apps/Xlock/AppRun</TrayButton>
  <TrayButton popup="Power OFF computer" icon="exit24.png">exec:/usr/bin/shutdownjwm</TrayButton>
  </Tray>
</JWM> 

my 430

Code: Select all

<JWM>
  <Tray autohide="true" insert="right" valign="top" halign="center" height="36" >
  <TrayButton popup="User" icon="/usr/local/lib/X11/mini-icons/dir_o.xpm">exec:rox /mnt/home/home/user/</TrayButton>
  <TrayButton popup="Puppy" icon="/usr/share/midi-icons/folder24.png">exec:rox /mnt/home/home/user/My Documents/puppy/</TrayButton>
  
  <TrayButton popup="Browser" icon="/usr/local/lib/X11/mini-icons/seamonkey16.xpm">exec:seamonkey</TrayButton>
 
  <TrayButton popup="Show desktop" icon="/usr/local/lib/X11/mini-icons/mini-desktop.xpm">showdesktop</TrayButton>
  <TrayButton popup="Rxvt - terminal emulator" icon="/usr/local/lib/X11/themes/Original/console48.png">exec:rxvt</TrayButton>
  <TrayButton popup="Geany - text editor" icon="/usr/share/icons/hicolor/48x48/apps/geany.png">exec:geany</TrayButton>
  <TrayButton popup="Pfind - file finder" icon="/usr/share/midi-icons/edit24.png">exec:pfind</TrayButton>
  <TrayButton popup="Pwireless - wireless scanner" icon="/usr/local/lib/X11/mini-icons/Pwireless.png">exec:Pwireless</TrayButton>
  <TrayButton popup="Calculator" icon="/usr/local/lib/X11/mini-icons/mini-calc.xpm">exec:ycalc</TrayButton>
   
</JWM>
would like the Power OFF computer what is its 430 equivalent?

aarf

#12 Post by aarf »

podcasts downloader looks good.
how do you change the background colour of the tray?
Last edited by aarf on Tue 22 Sep 2009, 17:19, edited 1 time in total.

User avatar
DaveS
Posts: 3685
Joined: Thu 09 Oct 2008, 16:01
Location: UK

#13 Post by DaveS »

Yay aarf, way to go. The poweroff command in 4.3 is wmpoweroff and is located in /usr/bin
Spup Frugal HD and USB
Root forever!

aarf

#14 Post by aarf »

DaveS wrote:Yay aarf, way to go. The poweroff command in 4.3 is wmpoweroff and is located in /usr/bin
ok got it thanks

Code: Select all

<TrayButton popup="Power OFF computer" icon="/usr/local/lib/X11/themes/Smooth-Color/shutdown24.png">exec:/usr/bin/wmpoweroff</TrayButton>

User avatar
DaveS
Posts: 3685
Joined: Thu 09 Oct 2008, 16:01
Location: UK

#15 Post by DaveS »

aarf wrote:
DaveS wrote:Yay aarf, way to go. The poweroff command in 4.3 is wmpoweroff and is located in /usr/bin
ok got it thanks

Code: Select all

<TrayButton popup="Power OFF computer" icon="/usr/local/lib/X11/themes/Smooth-Color/shutdown24.png">exec:/usr/bin/wmpoweroff</TrayButton>
As /usr/bin/ is in the 'path', so you probably only need

Code: Select all

exec:wmpoweroff
Re-boot is also useful, exec:wmreboot
Spup Frugal HD and USB
Root forever!

Jim1911
Posts: 2460
Joined: Mon 19 May 2008, 20:39
Location: Texas, USA

#16 Post by Jim1911 »

Dave,

Thank you for this tutorial. The new launchbar works great.

Thanks,
Jim

EDIT: I reread your first post and discovered that I had overlooked the template file that also had to be changed. Your reply was quicker than my edit. You are fast.
Last edited by Jim1911 on Thu 24 Sep 2009, 14:32, edited 2 times in total.

User avatar
DaveS
Posts: 3685
Joined: Thu 09 Oct 2008, 16:01
Location: UK

#17 Post by DaveS »

Jim1911 wrote:Dave,

Thank you for this tutorial. The new launchbar works great, however, I have one problem. Whenever, I add a pet or make any changes that affect the menu, I have to go back and edit the /root/.jwmrc to add the include code back. What file should this code be placed into so that the code is automatically included in updates?

Thanks,
Jim
OK, Jim, there is a template file which has to be edited. I mentioned it in the first section of the post. It is in /etc/xdg/templates and is called _root_jwmrc
Just add your tray include command there, and you will then be set.
Spup Frugal HD and USB
Root forever!

aarf

#18 Post by aarf »

note that My Documents as in

Code: Select all

<TrayButton popup="Puppy" icon="/usr/share/midi-icons/folder24.png">exec:rox /mnt/home/home/user/My Documents/puppy/</TrayButton> 
 
wont work because of the space in the address directory.

added restart.
now would now like to add screenshot it has something to do with /usr/share/applicatios/mtPaint-snapshot-screen-capture.desktop but i need help getting it into the launcher.

edit: so have fixed the blank space in the directory path by drag, drop and symlinking puppy folder to a different location.

Code: Select all

<TrayButton popup="Puppy" icon="/usr/local/lib/X11/themes/Silver-Marble/pet48.png">exec:rox /mnt/home/home/puppy/</TrayButton> 
also changed the icon.
didnt want to rename it because it is use by Xandros.

User avatar
DaveS
Posts: 3685
Joined: Thu 09 Oct 2008, 16:01
Location: UK

#19 Post by DaveS »

For screen capture, I like to put that one in the bottom tray next to the menu button. Here is the code for that, which goes in .jwmrc-tray

Code: Select all

<TrayButton popup="Take Screenshot" icon="/usr/local/lib/X11/mini-icons/gtkam.png">exec:mtpaintsnapshot.sh</TrayButton>
Same code for the top tray.
When you see a file in Puppy with a *.sh extension, mtpaintsnapshot.sh in this case, it means it is a little text file that has been set to run as a program, or, a 'script'. I will add a post later giving some basic ideas about scripts, because they are the most incredibly useful things :)
Spup Frugal HD and USB
Root forever!

User avatar
`f00
Posts: 807
Joined: Thu 06 Nov 2008, 19:13
Location: the Western Reserve

#20 Post by `f00 »

(gr8 howto, DaveS :D )
..started up as includes in /etc/xdg/templates/_root_.jwmrc - since I use wbar as a more-or-less universal launcher and conky for info (with htop for more detail if desired) in various wms, I break up the 'usual' .jwmrc-tray (and comment it out in the template) into these simple autohide trays for jwm..

0) .jwmrc-tray-bottom (fairly minimal, optional small pager)

Code: Select all

<JWM>
	<Tray  autohide="true" insert="right" x="0" y="-1" border="0" height="20" >
		<TrayButton popup="showdesktop" icon="mini-desktop.xpm">showdesktop</TrayButton>
		<Pager/>
		<!-- Additional TaskList attribute: maxwidth -->
		<TaskList maxwidth="80" />
	</Tray>
</JWM>
1) .jwmrc-tray-left (oversized pager)

Code: Select all

<JWM>
	<Tray autohide="true" border="0" y="40" halign="left" width="200" layout="vertical">
		<!-- Additional Pager attributes; width, height -->
		<Pager/>
	</Tray>
</JWM>
2) .jwmrc-tray-right (jwm-dock)

Code: Select all

<JWM>
	<Tray autohide="true" border="0" y="180" halign="right" width="32" layout="vertical">
		<Dock/>
	</Tray>
</JWM>
3) .jwmrc-tray-top (re-X button, xload/freemem)

Code: Select all

<JWM>
 <Tray autohide="true" insert="right" valign="top" halign="right" height="27" >
  <TrayButton icon="x24.png">exec:restartwm</TrayButton>  
		<Swallow name="xload" width="90">
			xload -nolabel -fg red -hl white -bg "#24163D"
		</Swallow>
		<Swallow name="freememapplet" width="33">
			freememapplet
		</Swallow>
 </Tray>
</JWM>
:lol: those were from my p412-bone1 and some things change (like using xrefresh from wbar more than the 'hard' re-X as well as modding the lower part of jwm mainmenu via the template to keep jwm-specific menu items in jwm), hope those few samples weren't too terribly off-topic for this thread..

Post Reply