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.

Commodore 64 Nostalgia

In contrast to what I could find for Windows, the Linux world contains multiple free Commodore 64 emulators. Finding these in the software repository list brought back memories to all those endless hours spent using these 8-bit machines with 64 KB of memory.
Vice seems to be pretty good. The emulator is easily installed through the package manager at your favorite distribution. At the link below there are also links to C64 software repositories where you can find apps and games for this platform.
Some links and discussions - (link) and a great photo of the device:


Here are some C64 software repositories and related sites:

Monday, April 23, 2012

Desktop Search in KDE / Linux

I am quite used to using a desktop search to find files I need. Either by their file name or contents. On Windows I am still using Google Desktop and partially built-in Windows Search.
On Linux, it was really good to see built-in desktop search in KDE. First I searched the Internet for recommendations and found Beagle and Recoll. I tried Recoll and, while it was indexing, read more about the little icon in the tray, called Nepomuk. Nepomuk is a desktop search library that is utilized through other programs / user interfaces. A very simple one, conveniently placed, is Dolphin, the file manager. The search built into it uses Nepomuk and is quite powerful. Simply click 'Find' icon in the toolbar and type the search term.
Below the search text box there are options whether to search by Filename or by Content. One can also search the current location and below or everywhere.
Additional filtering is possible by choosing a file type (document, audio, video, image), date when it was last edited, and by rating that can be given to files.

Setting up Wine in Linux

Some basic concepts:

Tips:
  • Download Gecko for offline installation (link)
  • Get winetricks (link)
To set Wine prefix:
export WINEPREFIX=$HOME/wine/quicken/
# If you want a 32-bit system, use this before creating prefix.
export WINEARCH=win32
# Eventually, set a specific locale.
export LANG="en_AU"
winecfg
wine "d:\Setup.exe"
# clear
unset WINEPREFIX
These commands are used for manually setting the prefix in the current console.

It is important to note that, when creating a Wine prefix, the specified directory should not exist. It will get created when executing winecfg.

System Monitors for Linux

Here is a list of system monitors for Linux I came across.

  • gnome-system-monitor (default Gnome GUI system monitor and process viewer)
  • gkrellm (link)
  • KDE has a built-in widget for system monitoring but the issues are its size and the level of customization
  • conky
For network-only monitors, please see a separate post.

Friday, April 20, 2012

Network Activity Monitor on Linux

A few tools for monitoring the network activity:

  • NetHogs - shows real-time traffic per process.
  • KNemo - Can be configured to monitor a particular network interface. Has graphical representation of the traffic.
  • Net Activity Viewer (netactview) - Similar to netstat. Displays all network connections on the system.

Installing BlueGriffon on Fedora 16 (x64)

I'm looking to do some HTML editing in linux and, so far, the best recommended application was Quanta Plus. However, there is no support for HTML 5 DTD. Not that it is a big deal but I wanted to try another app that has HTML 5 support - BlueGriffon. I have also used BlueGriffon on Windows but not for too long, so I wanted to continue using it and see how good does it do the job.

BlueGriffon can be downloaded from here. A little problem is posed by the fact that BlueGriffon is a 32-bit application and requires 32-bit libraries. The package that needs to be installed is 'gtk2-engines-2.20.2-2.fc15.i686.rpm' and can be installed from default repositories with

yum install gtk2-engines.i686

As you can see, the package from Fedora 15 also works on v16. Note that, if you are installing 32-bit libraries, they are still accessible from default x64 repository by adding the .i686 at the end.
After some confusion with repository priorities, I got it working. The instructions are available here. The command that will install all the require dependencies is:


yum install libXt.i686 oxygen-gtk.i686 oxygen-gtk gtk2-engines.i686


Thursday, April 19, 2012

aero-drop Mouse Theme: Windows Nostalgia on Linux Desktop

After setting the rotating desktop background on KDE, I added Aero Mouse Cursors with Drop Shadow as a mouse cursors theme.
Now the overall look of my KDE desktop is freaking me at times, thinking it is still Windows running in the background.

Download cursor theme - Link.
Then put the contents into /usr/share/icons/ and set the theme with gnome-tweak-tool.

Customizing KDE Fonts

Just did two little customizations, to ease the transition from Windows. Namely, fonts. In KDE there is Tahoma font available. It is just a matter of setting the system to use it instead of Sans Serif. Adding anti-aliasing with

sub-pixel rendering: RGB
hinting style: Full

makes text in windows look pretty good. Another thing was adding Verdana from the Windows installation. The reason for this is that one of my sites uses Verdana font for the text (bad, bad coding) and it looks terrible under Linux. Adding Verdana font to the system will resolve the problem for me at least temporarily. Need to add a task to my to-do list for removing that Verdana from the site and setting a proper font settings.

Setting Priority for YUM Repositories

In the current phase of installing Linux, I find it downloads too many packages off the Internet. Having a limited network connection and an installation DVD at hand, this is not my preferred way of doing things.
Fortunately, there is a way to set priorities to yum repositories. It requires installing "yum-plugin-priorities" package and then simply adding a line
priority = N
to the repository config file in /etc/yum.repos.d. N is a number between 1 and 99, where 1 is the highest value and 99 the lowest.

source: link

Wednesday, April 18, 2012

Google Search Classic in Chrome for Linux

One more annoying thing that requires a tweak. Google Chrome's default search displays the Mobile version of the results page. That is a page without all the filtering options in the sidebar that I'm so used to by now.

I'm not sure what is the reason but the solution is simple. What I did on Linux is to add a new search engine, called Google Classic, with the following URL:

https://www.google.com/search?hl=en&safe=off&nomo=1&output=search&sclient=psy-ab&q=%s&oq=test&aq=f&aqi=g10&aql=&gs_l=hp.3..0l10.4172l4442l0l5141l4l4l0l0l0l0l129l363l3j1l4l0.

Now Chrome opens the Classic version of the results page. Note that not all of the above parameters might be required but I see no reason to clean them up. Another thing is that I have Safe Search off in the above case.

Adding Chrome to KDE Wallet

Using the default settings after installing Google Chrome in Linux (Fedora 16 with KDE) will result in KDE Wallet authorization window constantly popping up when Chrome accesses the values in there. I found that in KDE Wallet Configuration, tab Access Control, there was no entry for Google Chrome. Then I ran KWalletManager and just kept it open. The next time Chrome requested passwords or form data the pop-up was different. Among other options it prompted me to "Allow Always". Selecting yes resulted in a record being stored in KDE Wallet Configuration and now the authorization request dialog does not appear any more.

Monday, April 16, 2012

Setting up Yum repositories

Since I have a Fedora DVD, from which I installed the system, I want to use that as a source for various packages I'm installing. The default repositories are online which means that anything that is to be installed after the initial installation will be downloaded from the Internet.

So, to add the ISO image as a repository source, create a file (i.e. fedora-dvd.repo) in /etc/yum.repos.d/ with the following content:

[dvd]
name=dvd
baseurl=file:///media/Fedora%2016%20x86_64%20DVD/
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch
enabled=1
gpgcheck=1

Sunday, April 15, 2012

5-Button Mouse in Linux (VMWare Guest)

I just wrote a lengthy post about making 5-button IntelliMouse work under Fedora Linux v16, running as a guest OS in VMWare.
The post is available here. The text will be copied here but the original will remain on Google+. I find posting to Plus a bit easier but texts on the blog are better indexed by search engines.


5-Button Mouse in Linux

NOTE: If you are looking for a solution, just scroll down to the bottom of the post. If you're interested in the messy ways of getting things done then read on.

One very annoying thing I found in Linux, running in a VM, was that there was no support for a 5-mouse button. That's how it seemed, at least. So I searched for advice on how to enable this. Surprisingly, there were very few posts describing these sort of problems with mice and most of them were pretty old. This very much seemed like, if there were any issues, they were all sorted out long ago. XWindow configuration would probably properly detect hardware.
Anyway, in my case it didn't so I decided to make it work. The first time I read an article or two and poked around configuration files. Installed imwheel package and added some shell scripts. I expected that everything would work after that and that I could go back to what I was actually doing. So I did not bookmark URLs, nor wrote down the steps or anything useful. When it did not work, I was a bit concerned about those stale lines in configuration and init scripts.
Fortunately, reading the articles below went through all those scripts and I disabled them. Below is the log of my second try.

Instructions on how to enable 5-button mouse (IntelliMouse) in Fedora Core #linux . 
http://fedorasolved.org/peripheral-solutions/intellimouse
However, I'm using imwheel addition to the mouse.sh script and things still don't work properly.

Then I tried 2nd approach:
http://www.linuxquestions.org/questions/linux-hardware-18/mice-difference-between-xorg-confs-buttonmapping-and-xmodmap-on-command-line-525840/

As this did not work either, I suspected VMWare had something to do with it. It turns out that VMWare only emulates 3-button mouse. No wonder Linux doesn't see more buttons, then.
http://communities.vmware.com/thread/109643
This did not work initially. However, the setting I added got overwritten so I'm not sure if it works. But I found another answer with a different setting:
http://superuser.com/questions/35830/back-forward-mouse-buttons-do-not-work-in-vmware-workstation-6-5-guest-os

In the vmx file, these are the options to add:

usb.generic.allowHID = TRUE
mouse.vusb.enable = "TRUE"

I added lines from both articles and finally got events for 'back' and 'forward' buttons appearing in xev (X Event Viewer). Yay! Now it was only a matter of configuration of X in order to see them. If at all. All the buttons and the mouse wheel fired events in xev, which was a good sign.

Now, opening Chrome browser to test. The back and forward buttons seem to work OK but the mouse wheel acts weird. Scrolling down and up acts exactly the same as back and forward buttons. Time to check the configuration.
Editing /etc/X11/xorg.conf is where all the settings are. No need to install any additional packages or init files and scripts. The way I was going now, reducing all the options I added in the meantime, it seemed I would end up going back to the original X configuration and just changing the number of buttons in the settings from 5 to 7.

In order to quickly restart X to test the settings, use Ctrl+Alt+Backspace keyboard shortcut. X will re-read the xorg.conf file and load the new settings.

So, at this point I had the back and forward buttons working fine. The problem I had now was to properly set up the mouse wheel so it doesn't go back and forth but actually scroll the page up and down. Xev showed that the events were OK. Scrolling events were different to clicking events so trying another client program could be useful. 
Running Dolphin, file browser, showed that scrolling up and down moved the cursor up and down the files but also back to previous directories. 
So I found this:
http://forums.majorgeeks.com/showthread.php?t=88937
This points to imwheel config. However, in imwheelrc file it is stated that sending button events is equivalent to having ZAxisMapping set to "4 5" in xorg.conf. This was the default config there, too.

So, again, the suspect is VMWare - 
http://communities.vmware.com/message/504906
Now adding 
Option "Protocol" "IMPS/2"
to xorg.conf. Some people reported changing the protocol to make mouse wheel work again.

Then I tried adding 
Option "SendCoreEvents" "true"
to xorg.conf, according to http://ask.fedoraproject.org/question/630/mouse-scroll-doesnt-work-in-fedora-15

Trying the old suggestions with imwheel again, fromhttp://forums.gentoo.org/viewtopic.php?t=21251
My .xinitrc in home directory still contained the call to imwheel. Disabling that did not change anything. Killing imwheel process causes scrolling to completely stop reacting to mouse wheel events.
Then I finally found all the references to imwheel and xmodmap in my ~/.xinitrc and commented them out. This brought back the scrolling after restart!
And the back and forward worked properly in Chrome!

CONCLUSION
So, to summarize what was necessary to make this work. First the VMWare settings. Add the following lines to .vmx file:

usb.generic.allowHID = TRUE
mouse.vusb.enable = "TRUE"

Not sure if both are required but everything works with this. Needs confirming whether only one of those is enough as they were advised in separate articles.
Then, set up the mouse config in xorg.conf:

Section "InputDevice"
  Identifier "AlensMouse"
  Driver "mouse"
  Option "Device" "/dev/input/mice"
  Option "Protocol" "IMPS/2"
  Option "Buttons" "7"
  Option "ButtonMapping" "1 2 3 6 7"
  Option "SendCoreEvents" "true"
EndSection

These settings might also be simpler. For example, putting "auto" as a protocol or removing "SendCoreEvents". But, as it is already very late, I will call it a day here and go to sleep happy after enabling the back and forward mouse buttons in browser under Linux (guest with VMWare).