Schlagwort-Archiv: linux

Resize images directly from nautilus

The more often we need to a certain task, the more direct access we want to have to it. We don’t want to click through 10 sub-menus to create a new folder (that’s why it is right in the context menu of nautilus). When web searches became more and more frequent, browser developers invented the search bar next to the address bar and with the usage of the address bar continuing to decrease the two have been merged in recent versions of most browsers.

I my opinion this „usage frequency/accessibility“ ratio is far too high in common linux distributions (and all windows installations I have worked with for that matter), when it comes to resizing an image. Say you want to share some of your vacation photos with your friends, firing up GIMP and resizing them all manually seems like the worst case, but it really does not get much better in a standard GNOME environment. (This is just from personal experience, if I’m wrong please leave a comment).

GIMP surely does the trick. Also it opens like 5 windows by default. WHY???

A quick terminal command that I have used for a long time is described here. It uses the convert tool from the ImageMagicK package (which is much more powerful than just a simple resizer). To resize an image you just need to run

convert image.jpg -resize 50%

To reduce to size of the image to 50%. You can also convert multiple images at a time, for more details on this click here! I any case, you still have to open a terminal, cd to the right folder and enter the command. As a user who generally uses a GUI (namely nautilus, GNOMEs default file browser) to browse files, this is still too much work.

I have finally found what I was looking for in nautilus-image-manipulator. (formerly nautilus-image-converter). It is a neat little nautilus extension written in python that plugs itself right into the context menu (i.e. the right click menu) in nautilus. Whenever you right click on an image file there is an entry „Resize image“ giving you this:

nautilus-image-manipulator gives you a couple of options on what to do with your images.

The rest is self explanatory, you can choose the exact size, or just give a percentage. Also you can replace the originals or store resized copies. The best thing is, that it works flawlessly with multiple images at the same time.

Arch users can build and install nautilus-image-manipulator from AUR. It has a couple of python specific dependencies, all of which are available through AUR or the pacman repositories.

File backup with rsync

Most people would agree, that backing up your files regularly is very important. However: Most people don’t. I don’t have any scientific data to support this, but it is my personal experience.

© Peter Steinfeld

When I switched from Windows to Linux (a long time ago) I was used to nice GUI based backup tools like Cobian backup, which just sits there in the background and takes care of everything. I wanted something similar for linux. So I tried mostly GUI stuff like Unison, but I never got it to work quite properly. If you are looking for a GUI backup solution, I can’t help you… please stop reading and close your browser… maybe take a walk? (Or look here)

There are many different ways to back up your system or files. You can choose to mirror your whole hard drive including all partitions and boot information and what not. You can back up your operating system, so you can go „back in time“ if you misconfigure something in the future. Or you can just backup your personal files: Pictures, Videos, Music, Documents. For me the latter is sufficient since after a complete hardware crash I would setup a fresh system anyway.

I finally found a suitable program in rsync which is the go to guy of file synchronization in *nix systems. Many other tools even rely on it, e.g. Unison. Rsync is very feature rich, has support for SSH and can run as a daemon. (However none of this is important for a backup solution).

So here is what I do: Every once in a while I think it’s a good day for a backup, plug in my external hard drive and run a shell script that calls rsync with a couple of parameters. (A more organized person would probably have some sort of schedule. Not me. Please don’t judge!) Here is what it looks like:

#!/bin/bash
rsync -avP --exclude-from='/home/niklas/rsync_excludelist' --delete-excluded --delete --stats /home/niklas/ /media/Backup/niklas

what does it all mean?

  • -a (archive) tells rsynch to leave file properties intact (i.e. owner, access rights, etc) This only works if you are not backing up to a different file system!
  • -v lets rsync be verbose and -P gives you a progress bar
  • –exclude-from specifies the exclude file, I will talk about that later
  • –delete makes sure files you delete in your original data will also be deleted from the backup
  • –delete-excluded means that files or directories you choose to exclude later will then be deleted from the backup
  • –stats lets rsync summarize the whole operation after it is done
  • then you must give the source and destination directories (for me that is my home folder and a folder on my external drive called „Backup“

I chose to exclude several directories, my exclude file looks like this:

Dropbox
Downloads
.gvfs

The reason for excluding Dropbox is obvious: It would be super dumb and redundant. I do not backup my Downloads folder, because there it’s often quite big, full of crap and if I want to keep something I move it to another folder. .gvfs (for GNOME virtual file system) is where remote file systems are mounted. I frequently mount my home folder at the university and don’t want it included in the backup (I am not sure if it even works that way).

Syncing your Google calendar data with gnome 3 without evolution

I use Google calendar to manage all my appointments, because of the nice synchronization with android. But sometimes when I need to quickly check if I’m free on some day I want my calendar within a one-click distance.

The GNOME 3 shell has a built in calendar (which appears if you click on the top bar), which natively is managed by evolution. Since I don’t care for that (I use Thunderbird for Mails and … well nothing for my calendar), I was looking for a way to get my Google calendar data directly into the top bar.

The gnome 3 top bar gives you a nice quick overview over your calendar.

Luckily there is a nice tool available that does just that. It goes by the name gnome-shell-google-calendar and is available to arch users through AUR.

It has a client server like architecture, meaning that whenever you open the gnome shell calendar it will dispatch a service call, that will somehow be answered by gnome-shell-google-calendar. I not sure how it exactly works, but what you need to take away from this is, that the script needs to be running all the time to answer to the gnome shell.

The best way to achieve this is to add it to your startup applications:

 gnome-session-properties

opens the „startup applications preferences“ (It is beyond me, why the window title differs from the command). Click add, insert „gnome-shell-google-calendar“ and you’re good to go.

At first start the script will ask for your Google login information and store the password within the gnome keyring.

In case you want to exclude specific calendars from being fed to gnome, you can do so by placing a file .gnome-shell-google-calendar-excludes in your home directory and list the unwelcome calendars each on a separate line.

Turning Gnome 3 into a usable thing

Note: Please keep in mind that this article was written in March 2012, so it may or may not be partially out of date.

Much has been said about the usability or the lack thereof in GNOME 3 and I don’t want to start a whole rant here (although I fear, I will anyways). I just want to say that one of the main reasons I turned away from Ubuntu by the end of 2011, was the fact that they tried to turn my Computer, on which I do actual work, into a smartphone like entertainment device. Yes, I am talking about the Unity Desktop Environment.

So I was a bit shocked when I finally installed Arch and GNOME 3 on my laptop and found that it had almost the same flaws that drove me away from Unity. I was this close to switching to OpenBox or something similar, but I decided to give GNOME a shot.

I quickly learned that there are a lot people out there that were as annoyed as I was and put a whole lot of effort into turning GNOME 3 into a usable desktop environment. So I made a lot of changes and am now quite comfortable with my system.

In this post I would like to present the changes that I have made to my GNOME 3 installation that I found made it usable for my needs.

Getting a Taskbar

The problem:

GNOME 3 does not have a taskbar. Which means when you are working in one program there is no way of seeing what other programs you have running and what they are doing (without pressing a button). Apparently the idea behind this is to avoid distraction, I personally prefer to have an overview over running programs and find it hardly distracting.

The solution:

I found a solution to this problem in tint2 (arch-wiki) a panel/taskbar that was actually developed for window managers like OpenBox that did not come with anything like that. Well, guess what, GNOME 3 doesn’t come with anything like that either and tint2 works just as well.

A screenshot of GNOME 3 with tint2
Tint2 integrates well into the GNOME 3 desktop. It is not overlapped by windows and is extremely customizable.

Getting the desktop icons back

The problem:

As ridiculous as it may sound: GNOME 3 has a Desktop (i.e. you can select a Wallpaper), it has a folder called „Desktop“, but it does not display the contained files on the actual desktop.

The solution:

There is a very useful tool when it comes to customizing GNOME, namely the gnome-tweak-tool. It can be installed from the repositories and offers a lot of options GNOME does not offer natively. For example

Make use of the emptiness in the top bar

While lacking a taskbar GNOME 3 features a fancy monochrome top bar that displays the time, the currently focused window and a little more. Mainly it displays the color black.

Seriously, two thirds of it are not used at all. (I am guessing it is to not distract the user… I cant see which programs are running, but must stare at the bluetooth symbol all the time…really?)

Enter extensions.gnome.org, a site that features plugins for GNOME mostly affecting the functionality of the top bar and the user menu (the drop down menu that appears when you click on your username in the top right corner). And the site is actually hosted by the gnome people themselves? That must mean they are coming to senses! Yay!

While still described as in „Alpha“ state the site is really convenient to use, you just look for an extension you like, click on a little switch next to it and the extension gets installed and activated. Clicking on the switch again turns it off again.

My personal favorites are:

  • Alternative status menu: It modifies the usermenu and adds Suspend, Hibernate and Power off as separate entries, so you don’t have to hit Alt before you can switch off your machine.
  • Show Desktop Button: Adds a button that hides all windows with one click.
  • Presentation Mode: Adds a switch to the usermenu that lets you enable „presentation mode“ which keeps the screen from going black. (Useful not only for presentations, but also for watching DVDs)
  • Remove Accessibility: Removes the never used by me accessibility symbol. It is sad that an extension is needed for something like that.

But there are much more nice little tweaks, just browse the site and try stuff.

Conveniently delete stuff

The problem:

On every Desktop environment that I have ever used, I was able to delete files by selecting them and then hitting the delete key… not in GNOME 3, I can’t!

The solution:

To get the power of your delete key back, open dconf-editor, go to

org -> gnome -> desktop -> interface

and check the „can-change-accels“ box. Now open nautilus, select a file, click „edit“, hover over the „Move to Trash“ entry and hit delete. That way you assign „delete“ as a shortcut to „Move to Trash“. (You should probably uncheck „can-change-accels“ after you are done, to prevent undesired changes)

That is all I can think of for the moment. There are more specific things like integrating your Google calendar with GNOME 3, but I will deal with that in a separate post, because it is not as general as the stuff I described here.

I hope I could help some of you out and am always happy about suggestions and comments.

Global volume control with esekeyd

Something that has been bugging me ever since I first tried Linux (Ubuntu when it used to be… not shitty) is the fact, that the media button of my Laptop, especially the volume control, never seemed to work in fullscreen applications. And since I recently started playing Battle for Wesnoth again, I decided to tackle the problem once and for all.

A fairly simple way to fix it is esekeyd a deamon that listens to keyboard events and then executes whatever command you wish. It is available in the arch repositories, so first install it using pacman:

sudo pacman -S esekeyd

After you installed it you need to edit the config file /etc/esekeyd.conf which holds entries like the following:

#VOLUMEDOWN:amixer set Master 5%- &
#VOLUMEUP:amixer set Master 5%+ &
#MUTE:amixer set Master toggle &

If you simply want your volume control to work, uncommenting these lines should suffice. However If you are not sure what the buttons are called or if you simply want to check if esekeyd receives the keystrokes correctly, you can use the handy keytest tool, which is also part of the esekeyd package:

sudo /usr/bin/keytest

The tool will print the names of the pressed keys to the screen.

After you are done with the config file, start the daemon (and add it to your DAEMONS list in /etc/rc.conf if you want it to automatically start during boot):

sudo /etc/rc.d/esekeyd start

When I first tried this nothing seemed to work and it turned out that for some reason I didn’t have amixer installed, so make sure you have the package alsa-utils on your computer.