Pages

Friday, April 27, 2012

Custom User Agent in Chrome

This must be the coolest thing ever. :) There was this very annoying thing with Google Chrome on Linux where Google servers would redirect my request for maps.google.com to the mobile version of the site and then, immediately, to Places instead of Maps. There was just no way to get the map view in the perfectly valid browser.
I analyzed the messages exchanged between the browser and the server and thought the server might be confused by the User Agent setting. Especially because everything worked perfectly fine in Firefox on the same machine. And I could open maps on the Android smartphone being used to relay the connection.
So, Open Source devs to the rescue. There is a command-line option to set the User Agent when starting Chromium-based browsers. It is as simple as running

google-chrome --user-agent="Firefox/3.5.5"

or whatever else you want. More appropriate would, probably, be to use "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.6 (KHTML, like Gecko) Chrome/20.0.1092.0 Safari/536.6" as that is the user agent string for one of the later Chrome browsers on Windows.

Nepomuk Desktop Search in Gnome

Dolphin is becoming my tool of choice lately. Nepomuk integration is great. It is replacing my dependency on Google Desktop in Windows.
However, Nepomuk is not running in Gnome by default. There is some other search engine running (which reminds me I should disable it at some point). Fortunately, it is quite easy to get Nepomuk search back. Since I have KDE installed, all that is required is to add nepomukserver to the list of startup applications.

Reference

Windows Key for Applications Menu in xfce

If you want to use Win key to open the Applications menu in xfce, follow the instructions here and, instead of typing "xfce-popup-menu", use "xfce-popup-applicationsmenu".

Thursday, April 26, 2012

64-bit Wine in Fedora 16

I'm not sure how wine was compiled and packaged in Fedora 16 but 64-bit package gave me nothing but trouble. This was the most common issue, popping up as soon as I'd try to create a 32-bit prefix:

wine: WINEARCH set to win32 but '.wine' is a 64-bit installation

After I uninstalled the x86_64 version of wine and installed i686 all the nuisances went away.

Update: See this post for the proper way to create a 32-bit prefix.

Mount ISO files in Linux

Mounting an ISO file in Linux is quite simple. The command looks like:
mount -o loop disk1.iso /mnt/cdrom
It is specifying a loop device and then mounting the listed ISO file under the given mount point, which has to exist prior to issuing the command.

Source: http://www.cyberciti.biz/tips/how-to-mount-iso-image-under-linux.html

Update: In Fedora 18, mounting ISOs is as easy as double-clicking on them in Nautilus (file manager). By default, ISO files will be handled with ISO Image Mounter and mounted to the file system. Then, in Nautilus, you will see the new device under Devices section, showing the contents of the ISO file. Quite handy and simple.

Tuesday, April 24, 2012

Changing Mouse Cursors in Gnome 3.2

Thanks to good people out there, here are instructions on how to change mouse cursors in Gnome (video link). These are not just a simple change in settings but are not far from that, either. Some Gnome settings are not reachable out of the box hence an installation of gnome-tweak-tool is required. I like Aero theme, as described here, so I already have it in the list of cursor themes in the tweak tool.
While the first part of the setup works ok, the second one is a problem because I don't have Compiz installed. However, after a minute or two I noticed the cursors appeared on new windows. So everything works just fine even without restarting.

Instructions:

Install:
gnome-tweak-tool
oxygen-cursor-theme
oxygen-cursor-theme-extra

Open Advanced Settings (gnome-tweak-tool)
Select new cursor theme

Open Terminal (Ctrl+Alt+T)
sudo update-alternatives --config x-cursor-theme

Press Alt+F2
compiz --replace
(Alternatively reboot if compiz --replace doesn't work) 

To undo the changes simply repeat all the commands above but choose DMZ-White Cursor theme.

Edit: I noticed that in Fedora 16 the default Gnome GUI is Shell, not Classic, and it does not use Compiz. Trying installing Compiz and running 'compiz --replace' crashed Gnome. For now I don't want to spend too much time just to get different mouse cursors.
There are also full Gnome Shell themes out there but I'm currently happy with the way my desktop looks and feels.

Transparent Conky Background in Gnome

I've finally seen Conky with a transparent background! After switching to Gnome and setting back the transparency option, as well as argb, the background simply became transparent.
Note that this is with feh rotating the desktop wallpapers, as described here. Below are the contents of my .conkyrc file.

My .conkyrc is now at Pastebin - here.

Setting Keyboard on LogOn Screen

To set the default keyboard at logon screen (in KDM), check keyboard-related files at /etc/X11/xorg.conf.d.
I have two files - "00-keyboard.conf" and "00-system-setup-keyboard.conf". There should not be two files affecting the keyboard but since the second one points to /dev/null, I guess it is ok to leave it.
The contents of the file are:


Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "dvorak"
EndSection

This will set Dvorak layout as the default for X. If you want to change the layout without having to restart the Xwindow session, type the following command in the console:

setxkbmap dvorak

#linux #Gnome

If you want to change the default keyboard in a console login window, there is a graphical interface in keyboard layout settings. In Gnome there is a tab System. Copying your current settings to system default will set the proper system files.
/etc/sysconfig/keyboard contains the keyboard settings

Setting Startup Applications in Gnome

To edit applications you want to start with Gnome, run

gnome-session-properties

There is also an option to remember the apps that were running on last log off / shutdown.

Rotating Wallpapers in Gnome

After switching from KDE to Gnome, I am missing the rotating wallpapers feature. I am used to seeing scenes of Australia or castles of Europe changing on my desktop every now and then. This is an option built into KDE, for example, but there is no GUI option to set in Gnome.
Fortunately, there are tons of ways of doing this so it is just a matter of little scripting. One app I found while I was looking on how to set a transparent background in conky is feh. Setting a background is as simple as


feh --bg-scale /path/to/image.file


Additional options are available. To quickly generate a script that rotates the images in a given directory (recursive!), paste the code below into a shell script:


#!/bin/sh

while true; do
 find ~/.wallpaper -type f \( -name '*.jpg' -o -name '*.png' \) -print0 |
  shuf -n1 -z | xargs -0 feh --bg-scale
 sleep 15m
done


where "~/.wallpaper" is the location you want the script to scan.