How to change the Trash shortcut in Ubuntu 11.10 oneiric ocelot

Unity’s default shortcut to use <Super>+T to open the trash has been bugging me for some time, mostly because it conflicts with my open terminal shortcut. Judging from the questions I found by googling, I don’t seem to be the only person who would like to configure it.

Turns out, there is no easy way. Although there are two different places where I can configure keyboard shortcuts, none of them can be used to change the shortcut used to open the trash window. It’s kind of odd how this is a shortcut at all. I mean, how often do I actually look into the trashcan to see what’s in there? That’s not even remotely close to being a common operation.

The cumbersome way

This being free software, there is of course another way, which you might or might not consider to be worth doing, that is downloading the source-code for a package, change it and compile it into a .deb package again (If you don’t know how to do that, consult the link I provided below).

Turns out changing the source code was really easy. Simple searching for “trash, I soon found “plugins/unityshell/src/TrashLauncherIcon.cpp” where I found the following code:

TrashLauncherIcon::TrashLauncherIcon(Launcher* IconManager)
  : SimpleLauncherIcon(IconManager)
  , proxy_("org.gnome.Nautilus", "/org/gnome/Nautilus", "org.gnome.Nautilus.FileOperations")
{
  tooltip_text = _("Trash");
  SetIconName("user-trash");
  SetQuirk(QUIRK_VISIBLE, true);
  SetQuirk(QUIRK_RUNNING, false);
  SetIconType(TYPE_TRASH);
  SetShortcut('t');

I changed the last line to set ‘x’ as the shortcut and build the package, which turned out to be multiple .deb files of which I found the right one by unpacking them into a temp directory and looking for the TrashLauncherIcon symbol.

I’m not sure the amount of work required to do this is really worth it, especially considering that I have to redo it every time the unity package is updated again, but for now I’m really satisfied.

Links:

Update: Added bugtracker URL for this.

Update2: Build and uploaded new .deb for new version (12.11.2011)

3 Comments

  1. — Your site deleted “” texts in my previous post, so, here the answer revised —

    Or you can use compizconfig-settings-manager :
    – Open CompizConfig Settings Manager
    – In the Desktop section, select “Ubuntu Unity Plugin”
    – In “Behaviour” tab, change “Key to show the launcher” (deactivate or set it to Super+space for example)

    Then set your “Launch a Terminal” shortcut to Super+t in System Parameters > Keyboard > Shortcuts > Launchers

  2. Sorry, that was no deletion, I was just too slow to approve teh comment.

    I did actually like the key to invoke the launcher. Of course you need to use declare +T to open a terminal. It was just that the trash would always override it.

    If your way works, it might a real alternative to using a patched .deb version.

  3. What you have posted is only partially true. Here’s how I get mine to work flawlessly….

    1) Open CompizConfig Settings Manager
    2) Go to Ubuntu Unity Plugin, Behavior tab, and deactivate or change the “Key to show the launcher”.
    3) Activate the “Commands” plugin in the general section.
    4) For Command 0, add gnome-terminal, then go to the key-bindings tab, and add the super+t.

    NOW it will work. For some reason, Unity, likes to hog the show and not let the gnome keyboard shortcuts work 100% of the time. So use the compiz commands plugin to force the key-bindings.

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.

© 2024 fforw.de

Theme by Anders NorénUp ↑