Fix the Count Badge of Firefox in Ubuntu Unity

Firefox Count Badge

Firefox Count Badge

With Ubuntu’s Unity interface comes a nice feature of displaying progress or count badge for the application in their Launcher, just as in the picture here. Today however when I updated by browser to Firefox 23 on my Ubuntu 13.04 system, my system crashed (not because of Firefox) and I had to close everything that was open.

I was in a process of downloading two files in Firefox when this crash happened. Everything was working fine after that expect that the count badge and progress was stuck for Firefox. Even a system restart didn’t help.

A Solution of My Own

My natural reaction was to Google it but on this rare occasion, Uncle Google had no answer for me or maybe I wasn’t putting search expression well enough. Anyway, I though of looking for the user profile files and see if any clue was there. So the following is what I did and it worked for me.

I listed all the directories and files in my home directory using ls -la and ls -la ~/.config
Which is a common place for configuration files for various application but unfortunately Firefox isn’t one of those. But what I did find was the hidden .mozilla folder. So after going deeper into the directory structure, this is the file which had answer to my question:

~$ ls -la ~/.mozilla/firefox/nlqcscp8.default/downloads.sqlite
SQLite Database Browser

SQLite Database Browser

One more was that I didn’t have any program to open SQLite file, so I had to install such a software also:

~$ sudo apt-get install sqlitebrowser

Now all I had to do was to open this Application, locate the downloads.sqlite file and delete the rows as should in the picture. Save and done!

Firefox back to normal 🙂

Change Display/Screen Resolution using Linux Command

Display Application in Ubuntu

Display Application in Ubuntu

To change the Screen Resolution in Ubuntu, simply type Display in the Unity Launcher and run the application. The snapshot of the Display application is taken from Ubuntu 12.10 and is also the same in previous versions also. Similar application is available in other Linux distributions.

But there is a handy command that can do the same thing even faster or can help you create a script (depends how creative and productive you plan to be). The command is simple:

xrandr

This will display all the possible resolution profiles available for the current system (more can also be added and you can find help on http://www.x.org/archive/X11R7.5/doc/man/man1/xrandr.1.html).

To change to a known resolution:

xrandr -s 1024x768

And you have it! 🙂

Enable/Disable Touchpad on HP Envy Ultrabook running Ubuntu

HP Envy Touchpad

HP Envy Touchpad

As mentioned in a previous post, I mentioned about my HP Envy and Ubuntu. One more feature I noticed missing was the ability to enable and disable the touchpad. As shown in the picture, the touchpad has a special tap area on its left top corner which acts as a toggle button. But this is not working under Ubuntu. But ofcourse I had to solve this problem and here is the solution I came up with:

First of all we need to list all the input devices available. This can be done by the command:

xinput list

Output:

⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ Logitech USB Receiver                   	id=9	[slave  pointer  (2)]
⎜   ↳ Logitech USB Receiver                   	id=10	[slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad              	id=13	[slave  pointer  (2)]
⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
    ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
    ↳ Power Button                            	id=6	[slave  keyboard (3)]
    ↳ Video Bus                               	id=7	[slave  keyboard (3)]
    ↳ Power Button                            	id=8	[slave  keyboard (3)]
    ↳ HP Truevision HD                        	id=11	[slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard            	id=12	[slave  keyboard (3)]
    ↳ HP WMI hotkeys                          	id=14	[slave  keyboard (3)]

Notice the 4th entry under Virtual core pointer which is SynPS/2 Synaptics TouchPad having id=13. To be very sure we can also test it using the command:

xinput test 13

As I move my finger on the touchpad, the data is displayed which is a surety that I made the right choice. Now we need to create a script to enable/disable the touchpad.

Create a new file for instance toggle and place it in the current folder. Add the following contents to this file:

SYNSTATE=$(xinput list-props "13" | grep Enabled | grep -Eo '.$')
if [ $SYNSTATE = 0 ]; then xinput set-prop "13" "Device Enabled" 1
else xinput set-prop "13" "Device Enabled" 0; fi

Notice the “13” in all three lines, this is the id which we noticed earlier. Save and close the file. To run this script, we need to change the permissions to executable:

chmod +x toggle

Finally we can enable and disable the touchpad:

./toggle

Running this command will disable it, which you can test also. Running it again will enable it again. This is enough and works fine. However you will notice that these id numbers at times do change on different system boots. The solution can be to use the complete name its of the id in the script:

SYNSTATE=$(xinput list-props "SynPS/2 Synaptics TouchPad" | grep Enabled | grep -Eo '.$')
if [ $SYNSTATE = 0 ]; then xinput set-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 1
else xinput set-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 0; fi
Ubuntu Keyboard

Ubuntu Keyboard

As an additional step, we can also assign a keyboard shortcut for this file. Open the Keyboard program from Unity dash and go to the second tab named Shortcuts. Add a new shortcut as shown in the picture. Give a name, path of the file and a key combination.

Now pressing these keys will toggle the touchpad 🙂

Remove Ubuntu Message Envelope from Panel

Ubuntu Message Envelope

Ubuntu Message Envelope

Ubuntu and in fact Gnome desktop offers the Message Applet as shown in the picture to display all the messenger and mail details. However since I don’t use it, this applet bothers me. Here is how you can remove it.

Run the command:

sudo apt-get remove indicator-messages

Next, either restart or run any of the following command depending on your desktop:
For Ubuntu

killall unity-panel-service

For Gnome:

killall gnome-panel

Its gone now!

Adding an Applicant/File to Unity Launcher

Ubuntu’s Unity has become very stable and user-friendly since its early days. Most applications when installed using the Ubuntu Software Center will add their icon to the Unity Launcher (on the left). But this tip will help you add icons as you like.

Adding any Running Application to Launcher

Simply right click on the application’s icon that is shown in the Unity Launcher. A pop-up menu will be shown up. This menu although may slightly vary as it has undergone minor design changes over the last few Unity based distributions. The option labeled Keep in Launcher is responsible for this task. Clicking it will ensure that this icon remains their even if the program is closed.

Similarly, if you would like to remove it, just right click on the icon again and clicking on Keep in Launcher will remove it from the Unity Launcher.

Unity also allows you to easily reorder the items in the Launcher by simply dragging and dropping.

Adding a Custom Icon to Launcher

Although adding an icon to the Launcher is easy but at times a user defined icon or an application not installed from the Software Center with a custom icon. For that the following file needs to be created with the following contents (as a sample I will be creating this file for Komodo Edit):

[Desktop Entry]
Encoding=UTF-8
Name=Komodo Edit 6.1
GenericName=Editor
Comment=Free multi-platform editor that makes it easy to write quality code.
Exec=/home/user1/Komodo-Edit-6/bin/komodo %F
Icon=/home/user1/Komodo-Edit-6/share/icons/komodo128.png
Terminal=false
Type=Application
MimeType=text/plain;
Categories=Application;Development;Editor;Utility;TextEditor;

The important lines are Name, Exec, Icon, Terminal and Type.

Now save this file with the name komodo.desktop and move it to the required application folder.

For system-wide access:

sudo mv komodo.desktop /usr/share/applications/

For user-only access:

sudo mv komodo.desktop ~/.local/share/applications/

This will also enable your application to appear in the Dash, as shown below:

Finally, open your application from Dash and click on the Keep in Launcher option as explained above. That’s it!