Nicolás Brailovsky


A modern blog

Archive for the ‘Gnome’ Category

Starting Ubuntu in console mode

author Posted by: nico on date Oct 13th, 2011 | filed Filed under: Console, Gnome, Linux

Like it or not, Ubuntu is so easy to install that even for servers is very comfortable to just mount the iso and create as many virtual machines as you may need. Sometimes you already have an iso for Ubuntu, but are too lazy to download the server version. For those occasions you can either decide to waste precious RAM running a GUI for a server that will never need it, or you can remove all traces of the graphical login. Like this:

  1. sudo update-rc.d -f gdm remove

This will remove GDM from the startup scripts, meaning you can still fire up the graphical interface (*) if you want, but it will start Ubuntu without loading any graphics stuff. This is very useful to save on RAM, startup time and processing power, which even if not that useful for a desktop machine is incredible beneficial when you have several virtual machines running in a single physical server.

(*) More precisely, if you have users that need it. Remember though, if it can’t be done in console mode, it ain’t worth doing.

http://www.makarras.org/2008/06/17/gandalf/

DIY gnome applets

author Posted by: nico on date Sep 29th, 2011 | filed Filed under: Gnome

We all know Gnome, and similar GUIs, are there only as a fancy console multiplexer, but even so it’s useful to have widgets in your menus or dockbars to display useful data, like the release date of DNF (*). Gnome has a limited amount of applets from which you can choose, and most of them are crap or limited in their customization. You can always create your own widgets, but that’s a pain in the ass for lazy people like me. Fortunately we lazy people can now use something an order of magnitude more useful than widgets in Gnome : we can use console commands!

Using something called Compa you can add a meta-widget, that will display the output of any CLI program. This means, of course, that you have all the power of the console to use in your custom made widgets. Need to check your laptop’s battery? No need to search for a widget anymore, just cat /proc/acpi/battery/BAT0/state. Need to check the weather? Just wget your favorite forecast page and parse it with grep, sed an awk. OK, maybe that’s a little bit too much.

Once more this proves that anything can be done in console mode – and whatever you can’t isn’t worth doing anyway.

(*) Wow, this article has been written a LONG time ago!

Activating tildes and accents for a USA keyboard layout in Ubuntu

author Posted by: nico on date Sep 8th, 2011 | filed Filed under: Gnome

Wow. This time the title of the post may actually be longer than its contents. How do you enable accents and tildes in Ubuntu? You need it to type cool characters like á, Ó or ñ (hey, my name has one of these!).

If you are on Windows I think you have to install a new map, and then guess where the key would be. Or use an alt+something magic spell. In Ubuntu, it works by default you just need to add a compose key, Go to System > Preferences > Keyboard > Options > compose key position, select right alt (or whatever you fancy), there you go, now it works. Try it by typing alt + ‘ + a.

I thought we had deprecated regedit

author Posted by: nico on date Feb 22nd, 2011 | filed Filed under: Gnome, Grumpy

Guys, I thought we had already agreed on this a long time ago. Windows registry sucks. It’s a pain in the ass.

Why TF is regedit still used in Gnome? I’d switch to KDE, if only I wasn’t so lazy.

Redshift: Cool your monitor

author Posted by: nico on date Sep 21st, 2010 | filed Filed under: Gnome, Linux
I’ve been trying Redshift the last few days. It’s a really cool (pun intended) and simple program. It just sits there all day long, doing nothing. Yeap, it’s just one more pointless thing on your ps -ef list, up until noon, when it comes to life: it will adjust your monitor’s temperature, gradually, from a cool color to a warmer color.

Say what?
I know what you are thinking. “Why the hell did I eat so much cake?”. And probably something like “WTF? Monitor temperature? Mine is running cool, k thx bye” too. The monitor temperature (color temperature, to be more accurate) is the percieved temperature of an object emiting light at the specific wavelength of that color:

So, a blueish color means a higher temperature, and it’s the natural ambience light color you see during the day. Towards the night the color temperature begins too cool down towards a more orange color. This is the temperature Redshift changes.

So what?
Fair question. After a couple million years our brains got used to seeing a hot color temperature during the day (do I have any reader that old?) so staring at a blue monitor all day will keep you awake all night long, the theory being that switching its temperature towards a reder color will help you sleep at night.

Does it work?
Probably not, but that doesn’t make it any less cool (pun not intended). I think if you fine-tune this app to your sleeping hours it may be of some use, because otherwise you’ll get a very dark screen at 5pm (don’t you people know the timezone in Argentina is FOOBAR’d).

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!!