Monday, February 25, 2013

Firefox OS ♫ ♬

Firefox OS is incredible.
The bold move they have made should be an eye opener not only for Chrome OS but also for team Metro.

I feel personally gratified. I love JavaScript (and CoffeeScript) as a programming and scripting language and it was my dream to see it embedded in everything, say coffee machines. Mozilla made an essential step towards that dream.

Sunday, February 24, 2013

Custom Google and Youtube Search on Firefox

Just typing g hello in address bar will search google for the word hello. Entering y abc in address bar will search youtube for word abc. You want to remove the search box? Go ahead.


You can make it possible by creating following custom bookmarks with keywords g and y respectively:

  Name: Custom Google Search
  Location: http://www.google.com/search?complete=0&q=%s
  Keyword: g

  Name: Custom Youtube Search
  Location: https://www.youtube.com/results?search_query=%s&webm=1
  Keyword: y

Note: Youtube search will show only HTML5 videos because of &webm=1 and google search will disable annoying autocomplete because of complete=0&.

Saturday, February 23, 2013

Gnome 3 vs Cinnamon

Right now there are five types of users I can think of:

1. Mouse oriented users
2. Keyboard oriented
3. Touch oriented
4. Speech and gesture oriented
5. People with special needs


Technologies for 4 and 5 have a long way to go. Gnome 3 is ready for 1, 2 and 3. Cinnamon does better than Gnome for 1 but not for 2 and 3.

So I would install Mint+Cinnamon for my mom(1), I'll reserve Fedora+Gnome3 for myself(2).

yum yum yum yum yum

Having problem using yum with proxy?
Add proxy and timeout in /etc/yum.config:
proxy=http://172.10.20.30:4000
timeout=180


Hate download of updates/primary_db and all that automatic refresh?
yum --disableplugin=refresh-packagekit list  

Download only, don't install:
yum --downloadonly install PACKAGE

Try following commands:
yum list | more 
yum list installed
yum info curl
yum deplist curl
yum repolist

Thursday, February 21, 2013

Resize Gnome Panel

Gnome 3.8/Fedora 19


1. Create the folder: ~/.local/share/gnome-shell/extensions/panelsize@gnomepanelsize.com
    $ mkdir .local/share/gnome-shell/extensions
    $ mkdir ~/.local/share/gnome-shell/extensions/panelsize@gnomepanelsize.com
    $ cd ~/.local/share/gnome-shell/extensions/panelsize@gnomepanelsize.com/

2. Create three files in this newly created folder:

/*************** extension.js *******************/
const St = imports.gi.St;
const Shell = imports.gi.Shell;
const Main = imports.ui.main;

let  defaultStylesheet, patchStylesheet;

function init(extensionMeta)
{
  defaultStylesheet = Main.getThemeStylesheet();
  patchStylesheet = extensionMeta.path + '/stylesheet.css';
}

function enable()
{
  //imports.ui.main.panel.statusArea.appMenu.actor.hide();
  imports.ui.main.panel.statusArea.activities.actor.hide();
  imports.ui.main.panel.statusArea.a11y.actor.hide();
  imports.ui.main.panel.statusArea.userMenu.actor.hide();
  imports.ui.main.panel.statusArea.dateMenu.actor.hide();
  let themeContext = St.ThemeContext.get_for_stage(global.stage);
  let theme = new St.Theme ({ application_stylesheet: patchStylesheet,
  theme_stylesheet: "/usr/share/gnome-shell/theme/gnome-shell.css" });
  try { themeContext.set_theme(theme); }
  catch (e) { global.logError('Stylesheet parse error: ' + e); }
}

function disable()
{
  let themeContext = St.ThemeContext.get_for_stage(global.stage);
  let theme = new St.Theme ({ theme_stylesheet: defaultStylesheet });
  try { themeContext.set_theme(theme); }
  catch (e) { global.logError('Stylesheet parse error: ' + e); }
}


/*************** metadata.json *******************/
{
    "shell-version": [
        "3.2",
        "3.4",
        "3.6",
        "3.7",
        "3.8"
    ],
    "uuid": "panelsize@gnomepanelsize.com",
    "name": "Panel Size",
    "description": "Panel Size for Gnome",
    "url" : "http://gnomepanelsize.com"
}

/*************** stylesheet.css *******************/
#panel { height: 1px; font-size: 1px; }
.panel-button { transition-duration: 100; height: 16px; font-size: 16px; color:black; }
/*.panel-button:hover { height:28px; font-size:28px; color:black; }*/


3. Issue the command
  $ gsettings set org.gnome.shell enabled-extensions "[ 'panelsize@gnomepanelsize.com' ]"

4. Restart gnome:
  Press Alt-F2
  Enter single letter 'r' as command 

Gnome 3.6.2/Fedora 18

1. Create the folder: ~/.local/share/gnome-shell/extensions/panelsize@gnomepanelsize.com

2. Create following three files in this newly created folder:
  
/*************** extension.js *******************/
const St = imports.gi.St; const Shell = imports.gi.Shell; const Main = imports.ui.main; let defaultStylesheet, patchStylesheet; 

function init(extensionMeta) { defaultStylesheet = Main.defaultCssStylesheet; patchStylesheet = extensionMeta.path + '/stylesheet.css'; } 

function enable() { let themeContext = St.ThemeContext.get_for_stage(global.stage); let theme = new St.Theme ({ application_stylesheet: patchStylesheet, theme_stylesheet: defaultStylesheet }); try { themeContext.set_theme(theme); } catch (e) { global.logError('Stylesheet parse error: ' + e); } } 

function disable() { let themeContext = St.ThemeContext.get_for_stage(global.stage); let theme = new St.Theme ({ theme_stylesheet: defaultStylesheet }); try { themeContext.set_theme(theme); } catch (e) { global.logError('Stylesheet parse error: ' + e); } } 

 

/*************** metadata.json *******************/ 
{ "shell-version": [ "3.2", "3.4", "3.6", "3.7" ], "uuid": "panelsize@gnomepanelsize.com", "name": "Panel Size", "description": "Panel Size for Gnome", "url" : "http://gnomepanelsize.com" } 


/*************** stylesheet.css *******************/ 
#panel { height: 1px; font-size: 1px; } 
.panel-button { transition-duration: 100; height: 1px; font-size: 1px; color:white; } 
.panel-button:hover { height:28px; font-size:28px; color:black; } 


3. Issue the command:
 gsettings set org.gnome.shell enabled-extensions "[ 'panelsize@gnomepanelsize.com' ]" 

4. Restart gnome: 
Press Alt-F2
Enter single letter 'r' as command


IMPORTANT: Panel has vanished but you can access individual panel items by moving pointer along the top edge of the screen. In case you don't like it you can do any of the following to get back the original panel:

1. Delete the files and folders that you created and restart gnome

2. Execute the following command and restart gnome:
gsettings set org.gnome.shell enabled-extensions "[ ]"

3. Do you love adventure? Play around with the file "stylesheet.css" and restart gnome.

Saturday, February 9, 2013

Two finger click on touchpad causes context menu to open which is annoying

1. Create a text file containing following lines:
(for me ~/.myscript)

   synclient TapButton2=1 
   synclient TapButton3=1

2. Use following command to make the newly created script file executable
chmod 755  ~/.myscript

3. Issue following command to launch gnome-session-properties:
gnome-session-properties

4. Click the "Add" button and provide full path of the command/script:
/home/YouUserName/.myscript

Next time when you login clicking with two or three fingers will be regarded as simple left click.

Thursday, February 7, 2013

Running QT/KDE applications like VLC Media Player on Fedora 18 without installing

It is quite difficult to provide precise steps how QT applications can be run on Fedora 18 without really installing them but today I succeeded to do that.

What makes the steps complicated is that each QT application has its own requirements and tweaks which are revealed only through error messages during the launch (or if you are God, you would like to infer all possible requirements by looking at the entire source code and configuration files).

The fundamental idea is to download rpm files and extract them to a local folder, say, ~/.qtapps/

1. Issue the installation command in download only mode:
yum --downloadonly install vlc

2. Copy or move the downloaded rpm files ( from /var/cache/yum/... ) to a local folder, say ~/sandbox.

3. Create a file named extract.sh containing following lines in ~/sandbox. When executed, this script will extract data from all the rpm files in ~/sandbox.

 OLDIFS=$IFS; IFS=$'\n'; fileArray=($(find . -type f -iname "*.rpm")); for file in ${fileArray[@]}; do rpm2cpio $file | cpio -midv; done; IFS=$OLDIFS;

4. You will see a folder called usr. Move it to .qtapps.
mv usr ~/.qtapps

5. Make system aware of ~/.qtapps/bin and ~/.qtapps/lib folders and also ~/.qtapps/sbin and ~/.qtapps/lib64 folders if they exist by setting PATH and using ldconfig.

To install more QT based apps just download the necessary rpm files, extract them and move the contents of extracted bin, sbin, lib and lib64 folders into corresponding folders in ~/.qtapps.

For easy launching of the newly added app, create a .desktop file as mentioned in an older post titled "custom 'open with' command".

Tuesday, February 5, 2013

Enable maximize and minimize buttons next to close button in titlebar in Fedora 18

Issue the command:

gsettings set org.gnome.shell.overrides button-layout ':minimize,maximize,close'

Bring close button to the left:

gsettings set org.gnome.shell.overrides button-layout ':close,minimize,maximize'

Remove close button entirely:
 
gsettings set org.gnome.shell.overrides button-layout ':minimize,maximize'

Sunday, February 3, 2013

"Create New Document" option missing from right click context menu in Fedora 18

1. See if you have ~/Templates folder. Create one if it is missing.
2. Now create an empty file from command prompt:
touch ~/Templates/Text\ File.txt

"Create Document" option is back again and you can create a new text file or a new document.

Modify "Places" menu in Nautilus (file viewer) on Fedora 18

Edit ~/.config/user-dirs.dirs and change appropriate lines to match with following lines:
XDG_MUSIC_DIR="$HOME/"
XDG_PICTURES_DIR="$HOME/"
XDG_VIDEOS_DIR="$HOME/"

Log out and log back in and you will find entries for Music, Pictures and Videos removed from "Places" menu in file viewer.

Disable "Recent" Documents in Ubuntu and Fedora 18

Issue the following commands:

rm .local/share/recently-used.xbel; 
mkdir .local/share/recently-used.xbel

Custom command for "open with" in Fedora 18

Suppose I want to open ~/Documents/help.chm with executable ~/Downloads/xchm 

First find out the MIME type of the file:

1. Right click help.chm and select "Properties" option.
2. In the popup, select "Open with" tab.
3. Select a known application, say, "Archive Manager" and click OK.
4. Now look in ~/.local/share/applications/mimeapps.list and find out the MIME type of the file.

Issue the following command and note down the mime type of the file:

file -i help.chm

I found an entry called "application/vnd.ms-htmlhelp"
Now I know the MIME type of help.chm.

5. Create either the file /usr/share/applications/xchm.desktop OR the file ~/.local/share/applications/xchm.desktop and add the following lines:

[Desktop Entry]
Encoding=UTF-8
Name=xCHM
GenericName=chm file viewer

Exec=/home/UserName/Downloads/xchm
Icon=/home/UserName/Downloads/xchm.xpm
Terminal=false
Type=Application
MimeType=application/vnd.ms-htmlhelp;
Categories=Utility;


6. Issue the command update-desktop-database .

Now you can simply double click help.chm or any other .chm file and it will automatically open with /home/YourUserName/Downloads/xchm.