Nicolás Brailovsky


A modern blog

Archive for the ‘Gnome’ Category

Ubuntu: Dual screen still FUBAR’d

author Posted by: nico on date Apr 27th, 2010 | filed Filed under: Gnome

I’m quite sure I have written about this before but I’m too lazy to search for the article right now. Well, dual screens in Ubuntu still sucks. Much less than ever before, granted, but it still works quite bad. In my specific case the whole desktop is shown, in both monitors (which by itself is a huge improvement over previous versions) but the working area is clipped to the notebook’s monitor size. Not nice.

To fix this problem (more like hacking it away, actually) I keep a handy bash script in the top left corner on my desktop:

  1. xrandr –output HDMI-2 –right-of HDMI-1 –mode 1680×1050 –rotate normal

Also, as I have two nice rotable monitors at work it’s nice that now Ubuntu supports actually rotating the picture displayed in the monitor (thanks Ubuntu for coming up to speed… with windows 98, that is). Obviously I keep another script for this, as it doesn’t really work by default:

  1. xrandr –output HDMI-1 –left-of HDMI-2 –mode 1680×1050 –rotate left
  2. xrandr –output HDMI-2 –left-of HDMI-1 –mode 1680×1050 –rotate normal

Even though I love bashing Ubuntu (and bash) I’m quite confident most, if not all, of this issues will be gone in future versions of the OS.

Changing default file associations in gnome

author Posted by: nico on date Apr 13th, 2010 | filed Filed under: Gnome

It’s been a long time since I posted a Linux related tip. Not in the mood I guess… well, this is one which really annoyed me, until I found out how easy it is: I hate some of the default file associations in gnome. Movieplayer, for example, is a horrible choice. Breaking and devolving with each new distro release, I have decided to settle with vlc as my default movie player, yet I couldn’t easily change the default file type association. After fiddling around with the thingy in gnome resembling a regedit (ugh) I found out the easy way:

* Right click the file for which you want to change default associations and click properties
* Select “open with” tab
* …
* Profit!

Nice Ubuntu fonts + Vim Tip

author Posted by: nico on date Sep 8th, 2009 | filed Filed under: Gnome, Linux, Programming, Vim, Vim Tips
manuscrito It’s not unusual to hear someone complain about Ubuntu fonts. Apparently they are ugly. I guess that depends very much on a personal opinion, however not everyone knows there are alternative fonts in the common repositories (I think multiverse even has non-free fonts ported from Windows).

Someone recommended me Inconsolata as a nice programming font (it’s monospaced). I’m using it right now and it’s not bad. Let’s see how can you install it:

  1. sudo apt-get install ttf-inconsolata

incoshow

Easy and it looks even better when used with gVim. You can go to Edit > Select font to change the font preference, however this won’t set a new default for the next time you start gVim. To do this we need to add it to the .vimrc, and again, to do this we need to know the font’s name.

Type “:set guifont?” to see the font’s name. In my case it’s “Inconsolata Medium 14″ (I changed size and type). Now add the following to your .vimrc:

  1. if has(‘gui_running’)
  2.      set guifont=Inconsolata\ Medium\ 14
  3.  endif

Notice I added a backslash before the spaces, otherwise Vim will try to parse Medium and 14 as separated parameters to “Inconsolata”, which obviously won’t understand. Have fun with your new fonts.

Ubuntu: Dual monitors

author Posted by: nico on date Aug 11th, 2009 | filed Filed under: Gnome, Linux

There’s nothing better than feeling like a super villain by having a dual monitor setup. OK, three may be better, you probably couldn’t hold back the evil laughter, but my laptop won’t support three screens.

dilbert

Fortunately, in Ubuntu JJ having a dual screen setup is a breeze. Just plug the two monitors and hope it works. Of course, it may not. If that’s the case you can go to System > Preferences > Screen for a nice GUI, which will let you select each screen’s resolution and position. Nothing better for productivity than having your monitors swapped, or even better, flipped upside down.

Well, sometimes “Screen Preferences” won’t work either, too bad. In that’ case you’ll have to get dirty with xrandr. It’s not too difficult but it’s console based (you’re not scared of the console, are you?).

Though the man page for xrandr is a little bit intimidating at first you’ll just have to do it once, so I won’t write about using it, I will just copy & paste a script I keep in my desktop to fix the screen whenever it brakes (my lapop tends to foobar my screen when being docked or undocked, not sure why)

  1. xrandr –output HDMI-2 –right-of HDMI-1 –mode 1680×1050 –rotate normal

I am sure you can figure out the rest on your own – enjoy the dual screen setup!

Changing default shortcuts in gnome

author Posted by: nico on date Jan 31st, 2009 | filed Filed under: Gnome, Linux

Another of those thing I usually forget: changing default shortcut actions in gnome. In this case, I’m using MOC as my music player (see apt-get install new computer II and while it’s great it won’t integrate nicely with gnome. Fortunately (as most GNU/Linux applications do) it can be commanded via CLI so it isn’t hard to change this.

Now, gnome keyboard shortcuts already have defined actions, so how can we change them to invoke  a custom command? Easy enough:

  1. Open gconf-editor
  2. Go to apps > metacity > keybinding_commands
  3. Set a command from the list. In my case I’m going to set command_1 to “mocp -S”, command_2 to “mocp -f” and command_3 to “mocp -r”
  4. Go to apps > metacity > global_keybinding
  5. Set the corresponding run_command_* to the keyboard shortcut. For me that’s 0xA2 for run_command_1, 0xE9 for run_command_2 and 0xEA for run_command_3; beware it changes between keyboards.

Troubleshooting tips:

  • If you use gconf-editor for a key binding don’t use it again System > Preferences > Key bindings
  • For hex value keybindings (like the ones I used on the example) use uppercase
  • If it’s not working and you can’t figure out why try with an already working command and a simple keybinding (e.g. gnome-screenshot and <Ctrl>p) then change each one in turn, see where it breaks. Divide and conquer!!