Multi-Search3
Showing posts with label Computers. Show all posts
Showing posts with label Computers. Show all posts

Power Up Puppy Lucid510 Linux.Part2-US Holidays In System Prompt And Four More Tips!


Puppy Lucid510 Linux Desktop


In the last article, we discussed start menu customization and LHS taskbar tray customization. Let us continue with four more important tasks here - setting the System Prompt, Aliases, Rightclick-Open/With and Default Programs - four tasks that are useful to any Puppy Lucid510 Linux user at any time whether used at logon or after it.


1. SETTING THE SYSTEM PROMPT 
When useful? At logon or anytime 

Start a terminal [Startmenu-Utility-Urxvt terminal emulator].
See the pound sign[#]?
Now type
#export PS1=''
What happened? Pound's gone. Vanished. We are poor now, too bad, wait a second. Now type
ls
See the file list? Type
df
See the used, free space allocation display?

Hey, stop stop, where do you think are we going with this now?

Easy! Cool down! We just saw the effects of setting the system prompt to null a minute ago with
export PS1='' and got impoverished. Let us reset the system prompt with a better prompt. Type
export PS1="\h"
Got the hostname!
export PS1="\h-\u"
Hostname and the username!
export PS1="\h-\u-\w"
Hostname, username and the current working directory!
export PS1="\h-\u-\w-#"
At last! This code gave us the hostname, userid, current working directory and our pound back! We are rich again now! But why is everything in black and white? Let's add some color to it and also thank a reference site on the net for sharing a variant of the line of code below we are building upon.
export PS1="\[\033[07;35m\]\[\033[07;31m\]\h-\[\033[07;35m\]\u-\[\033[32;40m\]\w-\[\033[00;31m\]#\[\e[m\]"
Now, we can add our own string[HelloWorld] to display at the very beginning of the system prompt.
export PS1="\[\033[07;34m\]HelloWorld-\[\033[07;31m\]\h-\[\033[07;35m\]\u-\[\033[32;40m\]\w-\[\033[00;31m\]#\[\e[m\]"


While this is okay for this session, we need to do more to get it into the startup configuration file so it will run at every logon.

Steps to change the system prompt

Let's say this is the code for our system prompt.
export PS1="\[\033[07;34m\]HelloWorld-\[\033[07;31m\]\h-\[\033[07;35m\]\u-\[\033[32;40m\]\w-\[\033[00;31m\]#\[\e[m\]"

Changing the system prompt for all users

1.Open a terminal as the root user and type
#cd /etc
2.Type
#geany profile & [Now put the above code at the end of the file, save and exit]
3.Run the command below
#. profile

Changing the system prompt for individual users only

1.Open a terminal as the user and type
$cd [user's home dir]
2.Type
$geany .profile & [Now put the above code at the end of the file, save and exit]
3.Run the command below
$. .profile


Note: In general, in any system where the user logs on using the bash, bourne and korn shells, the .profile file in the user's home directory is run first. In my Puppy Lucid510 Linux system, as I am the ONLY user on my system, I used the /etc/profile file to put this code in there even though it is a system-wide file. On bigger systems with many users, the individual .profile files in each user's home directory must be used instead!


JWhat's Bonus - Display US Holidays In The System Prompt!


Here's a little code block I came up with that you can append to your startup file [user's .profile or system's /etc/profile] to display the month, date and major US holidays in the system prompt. Thanks to a little oneliner I found on a reference site or forum on the net, we also get to colorize the system prompt and to display the hostname, username, and current working directory too!

What? Holidays in system prompt? Who'd want that? Everyone'll be home anyway!

Yeah, but for those who mess with their Linux systems all the time, it may make sense. Again you can add birthdays, anniversaries and important days to make it really useful even on regular days!!!

Requirement
The holiday prompt is refreshed only when the .profile or /etc/profile is run which is at every login/relogin or bootup/reboot. So, remember to put this line of code in a script and run it first thing everyday with cron.

For individual users run this line from a cron-scheduled script everyday at 00:01am
. .profile

For all users run this line from a cron-scheduled script everyday at 00:01am
. /etc/profile

Anyway, here is the code block
#========================================================
#Display major US holidays and more in the system prompt 
#========================================================
dat=`date +"%e,%b"`
if [ "$dat" == " 1,Jan" ]; then 
export PS1="\[\033[07;34m\]$dat-NewYear'sDay-\[\033[07;31m\]\h-\[\033[07;35m\]\u-\[\033[32;40m\]\w\[\033[00;31m\]#\[\e[m\]"
elif [ "$dat" == " 6,Jan" ]; then 
export PS1="\[\033[07;34m\]$dat-Epiphany-\[\033[07;31m\]\h-\[\033[07;35m\]\u-\[\033[32;40m\]\w\[\033[00;31m\]#\[\e[m\]"
elif [ "$dat" == " 2,Feb" ]; then 
export PS1="\[\033[07;34m\]$dat-GroundHogDay-\[\033[07;31m\]\h-\[\033[07;35m\]\u-\[\033[32;40m\]\w\[\033[00;31m\]#\[\e[m\]"
elif [ "$dat" == "14,Feb" ]; then 
export PS1="\[\033[07;34m\]$dat-Valentine'sDay-\[\033[07;31m\]\h-\[\033[07;35m\]\u-\[\033[32;40m\]\w\[\033[00;31m\]#\[\e[m\]"
elif [ "$dat" == " 8,Mar" ]; then 
export PS1="\[\033[07;34m\]$dat-Women'sDay-\[\033[07;31m\]\h-\[\033[07;35m\]\u-\[\033[32;40m\]\w\[\033[00;31m\]#\[\e[m\]"
elif [ "$dat" == " 1,Apr" ]; then 
export PS1="\[\033[07;34m\]$dat-AprilFool'sDay-\[\033[07;31m\]\h-\[\033[07;35m\]\u-\[\033[32;40m\]\w\[\033[00;31m\]#\[\e[m\]"
elif [ "$dat" == "14,Jun" ]; then 
export PS1="\[\033[07;34m\]$dat-FlagDay-\[\033[07;31m\]\h-\[\033[07;35m\]\u-\[\033[32;40m\]\w\[\033[00;31m\]#\[\e[m\]"
elif [ "$dat" == " 4,Jul" ]; then 
export PS1="\[\033[07;34m\]$dat-4thOfJuly-IndependenceDay-\[\033[07;31m\]\h-\[\033[07;35m\]\u-\[\033[32;40m\]\w\[\033[00;31m\]#\[\e[m\]"
elif [ "$dat" == "31,Oct" ]; then 
export PS1="\[\033[07;34m\]$dat-Halloween-\[\033[07;31m\]\h-\[\033[07;35m\]\u-\[\033[32;40m\]\w\[\033[00;31m\]#\[\e[m\]"
elif [ "$dat" == "11,Nov" ]; then 
export PS1="\[\033[07;34m\]$dat-Veteran'sDay-\[\033[07;31m\]\h-\[\033[07;35m\]\u-\[\033[32;40m\]\w\[\033[00;31m\]#\[\e[m\]"
elif [ "$dat" == " 8,Dec" ]; then 
export PS1="\[\033[07;34m\]$dat-ImmaculateConceptionOfBVM-\[\033[07;31m\]\h-\[\033[07;35m\]\u-\[\033[32;40m\]\w\[\033[00;31m\]#\[\e[m\]"
elif [ "$dat" == "24,Dec" ]; then 
export PS1="\[\033[07;34m\]$dat-ChristmasEve-\[\033[07;31m\]\h-\[\033[07;35m\]\u-\[\033[32;40m\]\w\[\033[00;31m\]#\[\e[m\]"
elif [ "$dat" == "31,Dec" ]; then 
export PS1="\[\033[07;34m\]$dat-NewYear'sEve-\[\033[07;31m\]\h-\[\033[07;35m\]\u-\[\033[32;40m\]\w\[\033[00;31m\]#\[\e[m\]"
else 
export PS1="\[\033[07;34m\]$dat-HelloWorld!-\[\033[07;31m\]\h-\[\033[07;35m\]\u-\[\033[32;40m\]\w\[\033[00;31m\]#\[\e[m\]"
fi
#========================================================


Now, let's make sure that the code block above works correctly!

1.Open the /etc/profile file. Copy the code block above and paste it at the end. Save it.
2.Open a terminal.
3.Set the date to January 1.
Press [Start menu], then [Desktop] and then [Set date and time]. Use arrows by the left and right of the month to go to [January] and set the date to [1]. Press [Ok].
4.In the next window [Set time tool], press [Ok].
5.In the next window [info], press [Ok] and wait for a few seconds.
6.Now, in the terminal, type
# . /etc/profile

If everything's fine we should be seeing "1,Jan-NewYear'sDay..." in the system prompt.

Here's the fun part!
You can accomplish lots of different things other than displaying the dull boring [#] or [$] symbol in the system prompt by modifying the code block above. For example, you can
* Birth days/Anniversaries: 
 Add your own birth day or important family or friends' anniversaries etc.
 [Eg. 3,Mar-Musa'sBirthDay!-puppypc-root-~-#]
* Holidays: 
 Change the holiday list by adding, deleting or changing the holidays.
 [Eg. 1,Jan-NewYear'sDay!-puppypc-root-~-#]
* Reminders[Yoga]: 
 Set aside a week or two and practice one yoga pose per day! 
 It's really fun.[Mountain, Cat, Cow, DFDog, Sphinx...]
 [Eg. 3,Mar-MountainPose!-puppypc-root-~-#]
* Reminders[Todo]: 
 Display a todo item till it is completed.
 [Eg. 3,Mar-CompleteHomePageRedesign!-puppypc-root-~-#]
* Affirmations: 
 Use a one-word affirmation from the list below. Many of these come from 
 a squidoo lens here
 Believe.Smile.Relax.Easy.Think.Practice.Exercise.Learn.Amaze.Build.
 Create.Nurture.Hope.Live.Peace.Listen.Improve.Forgive.Encourage.Dare.Act.
 Excel.
 [Eg. 3,Mar-Smile!-puppypc-root-~-#]
* Favorite Text: 
 Add your name or your favorite person's name or any text at the beginning 
 of the prompt by changing the [HelloWorld!] in the last export statement 
 before the [fi] at the very end if you'd like to. The possibilities are endless.
 [Eg. 3,Mar-Believe!-puppypc-root-~-#]

That's it for the system prompt configuration, let us move to aliases.

2. SETTING COMMAND SHORTCUTS WITH ALIAS
When useful? At logon or anytime

Consider the Linux command "ls". Let us type the following at the system prompt.
#ls -lstrh
This command displays a time sorted, human-readable listing of files in the current directory with the latest files at the end. It would be great if instead of typing
ls -lstrh
every time everywhere we create a shortcut like
l
wouldn't it? We can then type
#l
at the command prompt easily every time! That's what we did in the first line of the alias command list above [See image above]. For a one-time run, we can create a session-expiring alias like this. [Note: My system also allowed me to use single quotes instead of double quotes!]
#alias l="ls -lstrh" 
If we want to be more enterprising, we can put this shortcut into a persistent file that is run by default at every login. In Puppy Lucid510, this persistent config file /root/.bashrc has only one line pointing to
#. /etc/profile
and /etc/profile in turn is used to store all default login configuration parameters. So, let us open the /etc/profile file and put these lines at the end of the file. Since /etc/profile is run every time the /root/.bashrc file is run, which is at every logon, we're all set! [Note: Bigger systems with many users must use the .profile file at the user's home directory instead] Let's test it out real quick. First open /etc/profile with geany text editor.
#geany /etc/profile & 
Let's type this line at the end of this file.
alias l="ls -lstrh"
Let's save this file and run /root/.bashrc for our changes to take effect immediately.
#. /root/.bashrc
Once we have done the above we can then simply type 'l' at the dollar prompt from a terminal in any directory to view a neat, time-sorted and human-readable listing!
#l
Did you see the listing as we expected? I did!


3. CREATING SOFTLINKS FOR THE ROX-FILER RIGHTCLICK OPENWITH/SENDTO 
When useful? At logon or anytime

It's easy to customize the way we want to open different file types with different programs of our choice in Puppy Lucid510. For example, assume we want to rightclick on a html file and open it with Chromium, Firefox or Opera. This is what we need to do.

ln -s /usr/bin/chromium-browser /root/.config/rox.sourceforge.net/SendTo/chrome 
ln -s /usr/bin/firefox /root/.config/rox.sourceforge.net/SendTo/firefox 
ln -s /usr/bin/opera /root/.config/rox.sourceforge.net/SendTo/opera 

We have just created three softlinks for these three programs at the 
[/root/.config/rox.sourceforge.net/SendTo] folder. Changes take place immediately
so we can rightclick on a html file and select [OpenWith] to make sure we can open it with any of the
three browsers mentioned above.

NOTE: The information below comes from the window that opens when we rightclick on a file or folder and choose [File] or [Dir] menu, then select [Openwith] and then select [Customize] at the bottom.

The [Send To] menu provides a quick way to send some files to an application. 
The applications listed are those in the following directories:

/root/.config/rox.sourceforge.net/SendTo
/etc/xdg/rox.sourceforge.net/SendTo

I'll show you your SendTo directory now; you should symlink (Ctrl+Shift drag) 
any applications you want into it. The 'Send To' menu may be opened by Shift+Menu clicking over a file.

Advanced use:
You can also create subdirectories called '.text_html', '.text', etc which will 
only be shown for files of that type. '.group' is shown only when multiple files 
are selected.


4. SETTING DEFAULT PROGRAMS FOR DIFFERENT FILE TYPES
When useful? At logon or anytime 

What, you are not satisfied with a [Rightclick-Open/With] strategy? We can also easily configure a program to open a filetype by default whenever we click on it. Just run these lines from the commandline or from within a script
#browser-chromium
echo '#!/bin/sh
exec chromium-browser "$@" '> /usr/local/bin/defaultbrowser
Now whenever we click on ANY html file it will be opened by Chromium. Just change it to Firefox or Opera if required.


5. BONUS TIP: INFINITE LOOP TO CHECK STATUS OF FILE COPY OR FILE DOWNLOAD

Whether we are copying a giant 1gb or bigger file locally, or downloading stuff over slow internet, there is an easy way to check progress from the commandline.
while true; do du /your-folder/your-giant-file ; sleep 20; date; done
First note the size of the source file before copying/download begins. Then run this command and see how it keeps updating the terminal with the latest file size every 20 seconds and so if the file size is the same several times, the download probably stopped with success or errors. We can press [Ctrl-C] to break out of the loop and check if the file has been downloaded successfully or copied fully and/or rerun the loop command if needed. The [date] command gives a timestamp to tie up the [file size] to. Change the [time interval] to repeat as needed.


Bye! Bye! Woof! Woof!

This completes part2 and also concludes the PowerUp Puppy Lucid510 Linux-Tips To Customize The Startup Sequence Series. There are tons of Linux distributions out there but we need to pick and choose the best one for our needs and requirements. Puppy Linux is a great choice especially if you want a Linux Live CD distribution in the 100-200 MB category that comes with a great working base image and also has a host of pets and other utilities to build up on.

That's really great, isn't it?

Last Updated: 11/3/2013.

Power Up Puppy Lucid 510 Linux - Two Tips To Customize The Start Up Sequence!


Puppy Start Menu - Add A New Menu Group
I have seen a bunch of Live CD Linux distros but when it comes to packing a ton of packages in a small size [Puppy Lucid 5.1.0-where I am still at-under 130MB; the latest Puppy Lucid 5.2.8 just 133MB, download from here], nothing comes close to Puppy Linux. Extendable for even more versatility and power with the dev package and with the ability to run from RAM without even a hard disk, we have most of what we need to run a decent family pc or laptop! Not forgetting the save files that help us keep our sanity by storing persistent settings across shutdowns, and the multitude of open source gems out there, there is hardly very little we'll miss unless we're sitting on the bleeding edge of computing. Let us consider two simple ways to pack even more punch to the Puppy startup sequence, first by customizing the Start Menu and secondly by customizing the LHS tray. Remember we are working with Puppy Lucid 510 Linux here. Don't squat somewhere in Arch Linux and complain if you find things missing or not as found here :)

I. CUSTOMIZING THE START MENU

Before
 

After Adding New Menu[JCMenu]

Before we start anything, let's backup the /root/.jwmrc file.

$cp /root/.jwmrc /root/.jwmrc.bkup

This is the file we need to change to customize the Start Menu. We can edit, delete or even add new entries to the Start Menu by changing the entries here. It creates the Puppy Start Menu [see "Before" image above on the left].

< ?xml version="1.0"? >
< JWM >
< !-- IMPORTANT, ONLY EDIT /etc/xdg/templates/_root_.jwmrc -- >
< !-- jwm menu for puppy Linux -- >
< RootMenu label="Menu" labeled="false" height="24" onroot="3" >

< Menu label="Desktop" icon="x24.png" height="16" >
< Menu label="Desktop Settings" icon="mini.window3d.xpm" height="16" >
< Program label="Chtheme GTK theme chooser" icon="mini.window3d.xpm" >gtk-chtheme< /Program >
< Program label="Configure Xlock screen locking" icon="mini-lock.xpm" >/usr/local/apps/Xlock/AppRun -configure< /Program >
...
< /Menu>
 < Separator/ > 
... 
...
< Menu label="Shutdown" icon="shutdown24.png" height="16" >
< !-- < exit confirm="false" icon="prompt16.xpm" label="Exit to prompt" > -->
< Program label="Exit to prompt" icon="prompt16.xpm" >exec wmexit< /Program >
< Program label="Reboot computer" icon="mini-turn.xpm" >exec wmreboot< /Program >
< Program label="Power-off computer" icon="mini-stop.xpm" >exec wmpoweroff< /Program >
< Program label="Restart X server" icon="mini-x.xpm" >restartwm< /Program >
< Restart label="Restart JWM" icon="mini-windows.xpm"/>
< !-- < Program label="Change Window Manager" icon="mini-windows.xpm" >changewm.sh< /Program > -->
< /Menu >
< /RootMenu >
< /JWM >
< /exit >

Let's just look at the menus and programs at the start of the file since this is where we need to insert code if we wanted to add a new menu or programs. We'll keep things simple and consider only how to add a simple new menu [JCMenu] with a few puppy programs and one of our own scripts between two existing menus [Fun] and [JWhatGKFJ-1], (see "Before" image above on the left). Remember that we can use the [< Separator/ >] tag to separate menus or menu items(programs themselves) just as we have used two separators in our [JCMenu] to separate three program groups (see "After" image above on the right). Assume that we have coded our stuff into the following block [Note:All tags below have been padded with the space character as the second character on the LHS and the RHS. These are for code display and need to be removed before use]:

< Menu label="JCMenu" icon="games24.png" height="16" >
< Program label="ConfigureTouchpad" icon="picpuz.png" >flsynclient &< /Program >
< Program label="PupApps" icon="picpuz.png" >PupApps &< /Program >
< Program label="PupControl" icon="picpuz.png" >PupControl &< /Program >
< Program label="SearchMonkey" icon="picpuz.png" >searchmonkey &< /Program >
< Separator/ >
< Program label="HTop" icon="picpuz.png" >rxvt -e /usr/bin/htop &< /Program >
< Separator/ >
< Program label="FreeSpace1" icon="picpuz.png" >/bin/echo "Free Space[df -h] ">/tmp/1.out; /bin/df -h>>/tmp/1.out; /bin/echo>>/tmp/1.out; /bin/echo "free ">>/tmp/1.out; /bin/free>>/tmp/1.out; geany /tmp/1.out; rm /tmp/1.out< /Program >
< /Menu >
< Separator/ >


Notice how we have used a menu label, a couple of image icons and a program group for our menu above.

MENU LABEL: The label is where we name our menu [JCMenu].

ICONS: For simplicity we are reusing existing Puppy icons games24.png from /usr/local/lib/X11/pixmaps for the menu and picpuz.png from /usr/share/pixmaps/ for the menu items.

PROGRAMS: Here are three ways we can run programs from the Start Menu.

1.For starting up most puppy default programs, we can just call them by name like this.
< Program label="PupApps" icon="picpuz.png" >PupApps &< /Program >

2.Programs such as htop that require the terminal for the whole duration of their run may need to be called like this.
< Program label="HTop" icon="picpuz.png" >rxvt -e /usr/bin/htop &< /Program >

3.Finally we may run our own one liners, shell scripts and we may even run more than one program and display the output at once. For example consider the last menu entry in our code above.
< Program label="FreeSpace1" icon="picpuz.png" >/bin/echo "Free Space[df -h] ">/tmp/1.out; /bin/df -h>>/tmp/1.out; /bin/echo>>/tmp/1.out; /bin/echo "free ">>/tmp/1.out; /bin/free>>/tmp/1.out; geany /tmp/1.out; rm /tmp/1.out< /Program >

The command sequence above runs two commands, collects the output and opens the output file with the Geany editor automatically showing us a nice human-readable free space view and also the free memory view seen below.

Free Space[df -h] 
Filesystem            Size  Used Avail Use% Mounted on
rootfs                727M  100M  628M  14% /
tmpfs                 727M  100M  628M  14% /initrd/pup_rw
tmpfs                 293M  292M  704K 100% /initrd/mnt/tmpfs
/dev/loop0            292M  292M     0 100% /initrd/pup_ro2
unionfs               727M  100M  628M  14% /
shmfs                 287M  140K  287M   1% /dev/shm
/dev/sda1             3.8G  3.3G  489M  88% /mnt/sda1
/dev/sdb1             1.9G  1.6G  305M  85% /mnt/sdb1

free 
              total         used         free       shared      buffers
  Mem:      1488768      1274172       214596            0       117244
 Swap:            0            0            0
Total:      1488768      1274172       214596

Okay, let's take our favorite menu code [shown in color red below] and plug it into the existing code just below the menu called [Fun]. Notice how nicely we have arranged four Puppy programs, htop after these, and our own command sequence menu item grouped neatly into nice blocks with seperators! After the code insert it looks like this.

< ?xml version="1.0"? >
< JWM >
< !-- IMPORTANT, ONLY EDIT /etc/xdg/templates/_root_.jwmrc -- >
< !-- jwm menu for puppy Linux -- >
< RootMenu label="Menu" labeled="false" height="24" onroot="3" >

< Menu label="Desktop" icon="x24.png" height="16" >
< Menu label="Desktop Settings" icon="mini.window3d.xpm" height="16" >
< Program label="Chtheme GTK theme chooser" icon="mini.window3d.xpm" >gtk-chtheme< /Program >
< Program label="Configure Xlock screen locking" icon="mini-lock.xpm" >/usr/local/apps/Xlock/AppRun -configure< /Program >
...
< /Menu >
 < Separator/ > 
... 
...
...
< Menu label="Fun" icon="games24.png" height="16" >
< Program label="PicPuz jigsaw puzzle" icon="picpuz.png" >picpuz< /Program >
< Program label="Rubix cube" icon="cube16.xpm" >rubix< /Program >
< Program label="Tile slider game" icon="mini-modules.xpm" >tile< /Program >
< Program label="XEmeraldia drop blocks" icon="xemeraldia.xpm" >xemeraldia< /Program >
< Program label="Xinvaders3d Arcade Game  " icon="xinvaders.png" >xinv3d< /Program >
< Program label="Xsoldier - space arcade" icon="xsoldier.xpm" >xsoldier< /Program >
< /Menu >
< Separator/ >

< Menu label="JCMenu" icon="games24.png" height="16" >
< Program label="ConfigureTouchpad" icon="picpuz.png" >flsynclient &< /Program >
< Program label="PupApps" icon="picpuz.png" >PupApps &< /Program >
< Program label="PupControl" icon="picpuz.png" >PupControl &< /Program >
< Program label="SearchMonkey" icon="picpuz.png" >searchmonkey &< /Program >
< Separator/ >
< Program label="HTop" icon="picpuz.png" >rxvt -e /usr/bin/htop &< /Program >
< Separator/ >
< Program label="FreeSpace1" icon="picpuz.png" >/bin/echo "Free Space[df -h] ">/tmp/1.out; /bin/df -h>>/tmp/1.out; /bin/echo>>/tmp/1.out; /bin/echo "free ">>/tmp/1.out; /bin/free>>/tmp/1.out; geany /tmp/1.out; rm /tmp/1.out< /Program >
< /Menu >
< Separator/ >
...
...
< Program label="Help" icon="help24.png" >exec defaulthtmlviewer file:///usr/share/doc/index.html< /Program >

< Menu label="Shutdown" icon="shutdown24.png" height="16" >

< Program label="Exit to prompt" icon="prompt16.xpm" >exec wmexit< /Program >
< Program label="Reboot computer" icon="mini-turn.xpm" >exec wmreboot< /Program >
< Program label="Power-off computer" icon="mini-stop.xpm" >exec wmpoweroff< /Program >
< Program label="Restart X server" icon="mini-x.xpm" >restartwm< /Program >
< Restart label="Restart JWM" icon="mini-windows.xpm"/ >
< !-- < Program label="Change Window Manager" icon="mini-windows.xpm">changewm.sh< /Program > -- >
< /Menu >
< /RootMenu >
< /JWM >

Remember to run the Restart JWM menu option from the Puppy Start Menu every time after any change is made to the /root/.jwmrc file to view changes. [Menu->Shutdown->Restart JWM].
Run Restart JWM After Changes
Once we do that we get to see the new menu [JCMenu] displayed as seen on the "Before" and "After" images above. That's our very own customized Start Menu, don't you love it? I do!



II. CUSTOMIZING THE LHS TRAY ON THE TASKBAR AT THE BOTTOM

Taskbar LHS Tray-Before
  
Taskbar LHS Tray-After Adding More Program Icons
   

Let's look at how we can improve the LHS tray next to the Start Menu icon on the taskbar at the bottom by adding some more icons there. As you know, this is probably the best place to keep icons of the top few programs we run everytime day after day. This time we'll modify the /root/.jwmrc-tray file to add more items to the LHS tray. As usual, let's backup the current file before we start.

$cp /root/.jwmrc-tray /root/.jwmrc-tray.bkup

This is what the code looks like initially:
< JWM > 
   < Tray  autohide="false" insert="right" x="0" y="-1" border="1" height="28" > 
      < !-- Additional TrayButton attribute: label -- > 
      < TrayButton label="Menu" icon="mini-dog.xpm" >root:3< /TrayButton > 
      < !-- < traybutton icon="gexec.xpm" popup="Run commandline" >exec:gexec< /TrayButton > -- > 
      < TrayButton popup="Show Desktop" icon="mini-desktop.xpm" >showdesktop< /TrayButton > 
      < TrayButton popup="Free space in drives" icon="mini-hdisk.xpm" >exec:partview< /TrayButton > 
      < TrayButton popup="Choose Default Browser" icon="www24.png" >exec:browser-default< /TrayButton > 
        
      < !-- Additional Pager attributes; width, height -- > 
      < Pager/ > 
      < !-- Additional TaskList attribute: maxwidth -- > 
      < TaskList/ > 
      < Dock/ > 
      < !-- Additional Swallow attribute: height -- > 
      < Swallow name="blinky" > 
  blinkydelayed -bg "#4D525B"
      < /Swallow > 
      < !--  -- > 
      < !--    asapmshell -u 4 -- > 
      < !--  -- > 
      < Swallow name="freememapplet" width="34" > 
        freememappletshell 
      < /Swallow > 
      < Swallow name="xload" width="32" > 
  xload -nolabel -fg red -hl white -bg "gray45"
      < /Swallow > 
      < Clock >minixcal< /Clock > 
   < /Tray > 
< /JWM >

This below is our code to add more programs to the LHS tray RIGHT next to the Start Menu icon:

        < TrayButton popup="Pupdial" icon="/usr/local/apps/Connect/.DirIcon" >exec:/usr/sbin/pupdial< /TrayButton > 
        < TrayButton popup="Term" icon="/usr/local/lib/X11/pixmaps/console48.png" >exec:/usr/bin/urxvt< /TrayButton > 
        < TrayButton popup="Rox" icon="/usr/local/lib/X11/pixmaps/home48.png" >exec:/usr/local/bin/rox< /TrayButton > 
        < TrayButton popup="Gny" icon="/usr/local/lib/X11/pixmaps/edit48.png" >exec:/usr/local/bin/defaulttexteditor< /TrayButton > 
        < TrayButton popup="Lck" icon="/usr/local/apps/Xlock/.DirIcon" >exec:/usr/bin/xlock< /TrayButton >
        < TrayButton popup="Save" icon="/usr/local/lib/X11/pixmaps/save48.png" >exec:/usr/sbin/save2flash< /TrayButton >
        < TrayButton popup="Htop" icon="/usr/local/lib/X11/pixmaps/draw48.png" >exec:/usr/bin/urxvt -e /usr/bin/htop< /TrayButton >

This is the final code with our inserted code in red. Remember to remove the spaces at start and end of every line, if copy/pasting:

< JWM > 
   < Tray  autohide="false" insert="right" x="0" y="-1" border="1" height="28" > 
      < !-- Additional TrayButton attribute: label -- > 
      < TrayButton label="Menu" icon="mini-dog.xpm" >root:3< /TrayButton > 
   < !-- exec:gexec< /TrayButton > --> 
      < TrayButton popup="Show Desktop" icon="mini-desktop.xpm" >showdesktop< /TrayButton > 
      < TrayButton popup="Free space in drives" icon="mini-hdisk.xpm" >exec:partview< /TrayButton > 
      < TrayButton popup="Choose Default Browser" icon="www24.png" >exec:browser-default< /TrayButton > 

  
        < TrayButton popup="Pupdial" icon="/usr/local/apps/Connect/.DirIcon" >exec:/usr/sbin/pupdial< /TrayButton > 
        < TrayButton popup="Term" icon="/usr/local/lib/X11/pixmaps/console48.png" >exec:/usr/bin/urxvt< /TrayButton > 
        < TrayButton popup="Rox" icon="/usr/local/lib/X11/pixmaps/home48.png" >exec:/usr/local/bin/rox< /TrayButton > 
        < TrayButton popup="Gny" icon="/usr/local/lib/X11/pixmaps/edit48.png" >exec:/usr/local/bin/defaulttexteditor< /TrayButton > 
        < TrayButton popup="Lck" icon="/usr/local/apps/Xlock/.DirIcon" >exec:/usr/bin/xlock< /TrayButton >
        < TrayButton popup="Save" icon="/usr/local/lib/X11/pixmaps/save48.png" >exec:/usr/sbin/save2flash< /TrayButton >
        < TrayButton popup="Htop" icon="/usr/local/lib/X11/pixmaps/draw48.png" >exec:/usr/bin/urxvt -e /usr/bin/htop< /TrayButton >    
        
        
      < !-- Additional Pager attributes; width, height -- > 
      < Pager/ > 
      < !-- Additional TaskList attribute: maxwidth -- > 
      < TaskList/ > 
      < Dock/ > 
      < !-- Additional Swallow attribute: height -- > 
      < Swallow name="blinky" > 
  blinkydelayed -bg "#4D525B"
      < /Swallow > 
      < !--  -- > 
      < !--    asapmshell -u 4 -- > 
      < !--  -- > 
      < Swallow name="freememapplet" width="34" > 
        freememappletshell 
      < /Swallow > 
      < Swallow name="xload" width="32" > 
  xload -nolabel -fg red -hl white -bg "gray45"
      < /Swallow > 
      < Clock >minixcal< /Clock > 
   < /Tray > 
< /JWM >
< /traybutton >

Remember to run the Restart JWM menu option from the Puppy Start Menu every time after any change is made to the /root/.jwmrc-tray file to view changes. [Menu->Shutdown->Restart JWM] and look what we got! A whole new bunch of icons added to the LHS tray! Hooray!

Taskbar LHS Tray-Before

Taskbar LHS Tray-After Adding More Program Icons


Look at the image above to see the before and after views of how the LHS tray looks at the bottom of the screen. This completes the first set of two power tips to enrich the start up sequence of Puppy Lucid 510 Linux. More to follow soon!

IMPORTANT INFORMATION!

A [space] character has been inserted after the first character and before the last character of some xml tags in the display code blocks to protect display and need to be removed before use if copy/pasted. For example,

 < Menu >
 < Separator/ > 
 < TaskList/ > 
 < Dock/ > 
from code display must have the spaces removed when used in xml source code.

UPDATE

Remember to use the bulk replace option in the text editor you use to save time and also to 
prevent some angry cursing. For example, in Geany and gnome-text-editor I used this method to 
remove the extraneous spacing in a few key strokes and a few seconds instead of individual 
replacements that might have taken for ever. Make changes first in a fresh new blank editor page so you can transfer the text to the script after the editing is complete. Where it applies 
below, remove the square brackets used for accent and to mark out the space character.

GEANY
   Type [geany] leaving out the square brackets from command line or start it from [Start Menu]->[Accessories]
   Paste and select the text to change.
   Press [Ctrl-H] to bring up the replace box and click on [Replace All] to expand. 
   Type [< ] in the [Search for] input box. 
   Type [<] in the [Replace with] input box.
   Press the [In Selection] button to complete.
   Similarly, repeat the same steps for [ >].

GNOME TEXT EDITOR
   Type [gnome-text-editor] leaving out the square brackets from command line or start it from [Start Menu]->[Programming] and paste the code.
   Press [Ctrl-H] to bring up the replace box.
   Type [< ] in the [Find what] input box. 
   Type [<] in the [Replace with] input box.
   Click on [Replace all at once] to select it.
   Type [Find and replace] to complete.
   Similarly, repeat the same steps for [ >].


June 2013 - Sqlhtm Crosses Two Major Milestones!

The month of June, 2013 has been remarkably quiet for this blog and also the sqlhtm.com website. There has not been a whole lot of updates for several weeks since I am fighting all odds and keeping myself busy with adapting  Font3dTemplates wordart program for Linux (You must take a look at some samples made from this online application to start with!). So I really couldn't believe it when a couple of major milestones passed by very quietly and I was lucky to notice them! By the way, I am sure you'll love the fact the new version will have html5 drag and drop images, resize, css shapes and more new features.




Okay, here is the deal on the two milestones both of them all-time-highs for the sqlhtm website and the blog! [Hey, don't compare these with your-great-blog or your-great-website, okay?]




Blog - 10000 pageviews/month 
First we have crossed the 10,000 pageviews/month landmark on the sqlhtm blog [this blog, sqlhtm.blogspot.com]. 



Website - 3000 visits/month
We also have crossed the 3000 visits/month on the website [sqlhtm.com] for the first time!




It's so unbelievable! Awesome! 
Thank you dear readers and visitors!
Before you leave, don't forget to view the top pages on sqlhtm.com listed below and also download your choice of free scripts and tools!



About:about - Your Secret Tunnel To Tons Of Browser-related Information


We all know about "about:blank". Have you ever thought about "about:about"? I didn't, till recently. It's hard to believe, but this is how it happened! While on a search for finding something humorous about "about:blank", I stumbled on "about:about" and couldn't stop being amazed at how much browser-related information I missed all my life without knowing about it. There can be very few browser-related commands like "about:about". Type it in the address bar in every browser for the ultimate collection of any and every configurable and read-only browser-related parameter, a lot of which we may not find in regular Edit->Preferences. Once I knew about this obscure command, I ran it through the three browsers I have on my laptop and collected text and screenshots of the various options of this powerful command. Other than the Chrome, Firefox and Opera browsers you see in this article, I'm sure every other version of every other browser on every other operating system will have it's own unique implementation of this command.

1. OPERA-11.60 [Linux]


While Chrome and Firefox have links for the various about command options, Opera has only one pageful of important information. Just long static text with a few links but mostly read-only. Here's a quick look at a part of it.


Version information
Version 11.60
Build 1185
Platform Linux
System i686, 2.6.33.2

Browser identification
Opera/9.80 (X11; Linux i686; U; en) Presto/2.10.229 Version/11.60

Paths
Preferences /root/.opera/operaprefs.ini
Saved session /root/.opera/sessions/autopera.win
Bookmarks /root/.opera/bookmarks.adr
Opera directory /root/.opera
Cache /root/.opera/cache
Help documents /root/.opera/opcache
Mail directory /root/.opera/mail
Plug-in path /usr/lib/opera/plugins /usr/lib/mozilla/plugins
User CSS directory /root/.opera/styles/user

Third parties:
...

2. CHROMIUM-12.0 [Linux]

Chromium and Firefox present lists of links for various "about:about" options. One little thing that attracted my attention is that when you click on options such as  "about:flags" or type "about:flags" in the address bar, Chromium changes it to display "chrome://flags" etc. So, don't be alarmed to see this in the address bars of the four screenshots below. This happened only on Chromium and not on Firefox.

  • About:flags [Experiments such as for print preview and multiple profiles that can be enabled. Users are strictly warned to proceed at their own risk due to the experimental nature of these options].


  • About:memory [I found this to be very interesting. Displays memory allocated to every tab open. I was surprised to find that the summary on top displays memory used not just by the Chromium browser but also other currently-running browsers. [Opera and Firefox  you see that I had running].
 
  • About:plugins [Another location to enable/disable plugins other than from Wrench(Settings)->Preferences->Under the hood->Content settings->Plugins->Enable/disable individual plugins].


  • About:version [Remember to grab the command line equivalent of however you started Chromium from here for use in your shell scripts].

Some other options I found interesting that are not displayed with images as above:
  • About:view-http-cache [Displays cache contents]
  • About:credits [Displays webpage and licence links]
  • About:dns
  • About:histograms
  • About:net-internals

3. FIREFOX-13.0 [Linux]

Firefox 13.0 has the highest number of about:about options, a whopping 25! Chromium 12.0 has 18 clickable and 6 non-clickable options. [The non-clickable ones are for debugging only, you have to type them into the address bar every time].


  • About:addons [Configurable addons manager to download addons on demand. This panel also has tabs for extentions, themes and plugins].
  • About:cache [Displays disk and offline cache device locations and content].
  • About:config [Change internal defaults at your own risk. Click twice to change or rightclick for more options. Has so many obscure options that this could be the theme of a whole new article!].

  • About:home [Main dashboard. Start here].

  • About:permissions [Permissions manager for mozilla and all sites. Manage permissions for passwords, cookies, popups, share location and offline storage].




  • About:memory [You can view a neatly-presented memory allocation map for Firefox processes in a tree view].




Some other options not displayed with images as above:

About:plugins [Plugin-related information]
About:buildconfig [Machine/platform/tools builds and versions]

FINAL WORD

Browsers, there are a million but "About:about", there is only one. You don't have to be a digital ninja to try the experimental or debugging options of this command. Everyone can try "about:about" in every browser and start reaping the benefits of read-only and configurable browser parameters! Back to my search for something humorous about "about:blank". At this time, the only funny thing that comes to my mind is to say "He is the inventor of 'about:blank'" about every half-baked, pompous type around! If you find anything funnier, let me know at sqlhtm@sqlhtm.com.



Five Quick Suggestions For No-Nonsense, Superfast Text Browsing!



Sick and tired of image and multimedia overload in everyday browsing and want to skip images for a while but need to read the text at the same time? Travelling and stuck with low bandwidth? Researching reference sites and need text browsing by choice? There may be a hundred and one reasons, but let us set out to find a few easy ways for text browsing.

1.GOOGLE SEARCH PAGE


Select [CACHED OPTION] from the pulldown menu at the end of the second line of every search page result and then click on [TEXT-ONLY VERSION] to view the text-only version of the page. If you know the address of the website, you can first type cache:www.website.com and then select the [TEXT-ONLY VERSION] from the top-right.

2.CHROMIUM 12.0[LINUX]

Chromium


Select [DO NOT SHOW ANY IMAGES] radio button from the SETTINGS wrench with the tool tip "customize and control chromium"->[PREFERENCES]->[UNDER THE HOOD]->[PRIVACY]->[CONTENT SETTINGS]->[IMAGES].

3.FIREFOX 13.0[LINUX]

FireFox
Uncheck the [LOAD IMAGES AUTOMATICALLY] checkbox on the [CONTENT] panel from [EDIT] Menu->[PREFERENCES].

4.OPERA 11.60[LINUX]

Opera

Select [NO IMAGES] from the [IMAGES] pulldown menu from the [Opera] button on the top left->[SETTINGS]->[PREFERENCES]->[WEB PAGES] tab.

NOTE: Differences in browsers, browser versions and the Operating systems mentioned above and the others that aren't, may mean slightly different changes in locations and labels.

5.LYNX[Linux/Win and others]

Lynx

Okay, having the newer browsers covered, let us spend the rest of the article
with the CLI[command line interface] of the slightly older Lynx Text Browser to
get to the text or html versions of a web page and also get lists of links within
the same page.

DOWNLOAD THE LYNX BROWSER


First download the lynx browser from http://lynx.browser.org. Lynx 2.8.7 runs
on Un*x, MacOS, VMS, Windows 95/98/NT, DOS386+. I use it with Puppy Lucid 5.1 Linux on my Toshiba Satellite laptop. Once we have downloaded and installed the Lynx browser, we can browse the text version of the websites on the web with the default program or we can also use the CLI to get things done from the commandline like we do in this article. Once we have the address of the web page, we can use the -base, -dump, -listonly and -nonumbers options of the lynx CLI to get things going. I am using the geany text editor on my linux system to view the results of the lynx command for this article. Use a text editor , location and filenames of your choice.

TYPICAL USES OF THE LYNX COMMAND

cd /tmp

USAGE1: Get the pure html source of the webpage
lynx -source "http://www.sqlhtm.com/About.htm">lynx.txt; geany lynx.txt

USAGE2: Get the text of the webpage with numbered links, no images[image tags only]
and lists of reference and hidden links at the bottom
lynx -dump "http://www.sqlhtm.com/About.htm">lynx.txt; geany lynx.txt

USAGE3: Get the lists of links in the webpage only[no text or images]:
lynx -dump -listonly "http://www.sqlhtm.com/About.htm">lynx.txt; geany lynx.txt

USAGE4: Get the lists of links only without link numbering and without text:
lynx -dump -listonly -nonumbers "http://www.sqlhtm.com/About.htm">lynx.txt; geany lynx.txt

USAGE5: Get the text of page and the links at the bottom but disable the link numbering
lynx -dump -nonumbers "http://www.sqlhtm.com/About.htm">lynx.txt; geany lynx.txt

USAGE6: Get the text, link lists at bottom with numbers from webpage with no images[only image tags]
lynx -dump -base "http://www.sqlhtm.com/About.htm" >lynx.txt; geany lynx.txt

USAGE7: Get the text with no images[only image tags] and no lists of links at the bottom:
lynx -dump -base "http://www.sqlhtm.com/About.htm"|sed 'References/,$d' >lynx.txt; geany lynx.txt
[sed note: valid as on may2013]

GETTING LINKS FROM GOOGLE SERP[Search Engine Results Page] FOR THE LYNX CLI USAGE SUCH AS ABOVE



CASE1: CLEAN LINK ON THE SECOND LINE BELOW THE TITLE LINE

If we have a good link with a clean format such as http://www.sqlhtm.com/About.htm, we'll have absolutely no problems but if we're going to depend on google search for links, we might get lucky or unlucky depending on what the SERP[search engine results page] deigns to provide us. Look at the image above and consider the two cases below. First we have some results with a clean web address on the second line of the result below the top title line such as the one below. We can grab this just like it is and use it without changes.

EXAMPLE

Sed Command in Unix and Linux Examples
www.folkstalk.com/2012/01/sed-command-in-unix-examples.html‎


CASE2: MESSY LINK TO CLEAN UP FOR LYNX CLI USAGE

While an address such as the one above is what we want, oftentimes we run out of luck and end up having to rightclick on the title and select the [copy link
address] option to get a really messy google-formatted link with characters that
need to be cleaned up so the link is acceptable to the lynx command line deity.
To do this, we need to delete a portion at the beginning of the messy address,
delete another at the end, and also replace the code [%3A] with colon [:] and [%2F] with forward slash [/] in the reminder of the address.

EXAMPLE

Linux / Unix: sed Command Print Only Matching Lines - nixCraft
www.cyberciti.biz/.../unix-linux-sed-print-only-matching-lines-comman...‎


Do you notice the three dots from hell leading to nowhere in the middle and also at the end? This is no good. So we'll rightclick on the top title link and select the [copy link address] option to get an equally-lousy-if-not-worse address below.

http://www.google.co.in/url?sa=t&rct=j&q=Sed+Command+in+Unix+and+Linux+Examples&source=web&cd=5&cad=rja&ved=0CE8QFjAE&url=http%3A%2F%2Fwww.cyberciti.biz%2Ffaq%2Funix-linux-sed-print-only-matching-lines-command%2F&ei=_IOHUdT3IILqrQfiu4CgDg&usg=AFQjCNEpchgcEfzvOIjMDj0bLJhdPyrSig&sig2=UFZgetDwLrizo9LQ0Km5jQ

Lynx CLI hates this address, throws an error message! Deciphering this address
is not rocket science but everyone can only have so much patience for things of
this sort, don't you agree? Let us keep moving and finish cleaning up this scary
mess as much as we can.

1.Delete from the beginning all the way upto [URL=].
ie. Delete this from the beginning [http://www.google.co.in/url?sa=t&rct=j&q=Sed+Command+in+Unix+and+Linux+Examples&source=web&cd=5&cad=rja&ved=0CE8QFjAE&url=]

2.Delete everything from &ei till the end of line.
ie. Delete this at the end of the address:
[&ei=_IOHUdT3IILqrQfiu4CgDg&usg=AFQjCNEpchgcEfzvOIjMDj0bLJhdPyrSig&sig2=UFZgetDwLrizo9LQ0Km5jQ]


3.Replace [%3A] with [:] and [%2F] with forward slash[/] in the leftover address.
In this step, we start with address [http%3A%2F%2Fwww.cyberciti.biz%2Ffaq%2Funix-linux-sed-print-only-matching-lines-command%2F] and
end up with the address[http://www.cyberciti.biz/faq/unix-linux-sed-print-only-matching-lines-command]

There, we got what we needed, a really clean lynx CLI-acceptable address!
Using this address in any of the several ways above, we can get what we want - the html or text version of the page with or without the links on the page!

REDIRECTS

If the link we are using is a redirect, then we may not get the text of the
page at once, but only an alternate link in the output of the lynx command. We need to run the same lynx command again with this redirect link and then we will get the required text source of the page.

FINAL WORD

While a picture may be worth a thousand words, it is nice to be able to be content with words for a change, at least once in a while, at least considering the useless, bloated, unhealthy or harmful images on the net! But dude, I know where you are headed right after reading this - right back to your G+s, pinterests and tumblrs, but really can't blame you. Who'd want to stay with text only other than those stuck with dial-up or slow internet?

BlogCollage


Blog Collage - Top Random Posts In No Particular Order

Mouseover the images for title and comments