Shortcut Keys - Ubuntu: Questions and Answers (2014)

Ubuntu: Questions and Answers (2014)

Shortcut Keys

Questions

Q: How to make keyboard work like OSX System Wide?

Tags: shortcut-keys (Next Q)

I switch back and forth between two computers constantly:

· OSX Snow Leopard

· Ubuntu 10.10

I'd like to be able to make Ubuntu use the same keyboard shortcuts as OSX System Wide, for the following keyboard sequences only (ie I don't want to make Ctrl act like Super)

· Super+C -> Copy

· Super+V -> Paste

· Super+T -> Open a new tab in whatever browser I'm in.

· Super+W -> Close a tab in whatever browser I'm in.

So in short, is there anyway for me to map just these keyboard sequences to the following, system wide ?

· Super+C -> Ctrl+C

· Super+V -> Ctrl+V

· Super+T -> Ctrl+T

· Super+W -> Ctrl+W

I know there are ways for me to do this for vim, and Firefox, and I'm sure specifically for most applications... but I would prefer to have to do this just once and have it work that way system wide!

I'm using a standard PC keyboard, that is "Generic 105 key (intl) PC" on Ubuntu. I'm also using the same keyboard on my Mac mini.

Tags: shortcut-keys (Next Q)

User: brad-parks


Answer by cscarney

If you install the xautomation package, you can add a command in System/Preferences/Keyboard Shortcuts/Custom like:

xte "keyup Meta_L" "keyup c" "keydown Control_L" "key c" "keyup Control_L"

and map that to Meta-C.


Alternative Solution:

Install AutoKey (apt-get install autokey-gtk) and set a phrase to:

Phrase Text: <ctrl>+C (actually type out the <ctrl>+ here)

Paste Using: Keyboard

Abbreviation: None

Hotkey: <super>+v

Window Filter: None


Tags: shortcut-keys (Next Q)


Q: Quickly place a window to another screen using only the keyboard

Tags: shortcut-keys (Next Q), window-manager (Next Q), multiple-monitors (Next Q)

I know that using Alt-F7, I can use the keyboard to move the window around. I can also use the "Grid" plugin of Compiz to position quickly the window around my current monitor. The grid plugin doesn't seem work across monitor however.

What I need is a quicker way to move the current window to the other screen. In my current dual-monitor setup, I find myself needing to move the focus window to the other monitor as I focus on working on something else (and move it back afterward).

If I use XMonad (or other tiling managers), this would be rather easy. However, many applications that I use (Gnome Do, MATLAB, image viewers, custom apps that I write, ...) do not work well with a tiling manager.

So my question is: is there a shortcut key combination that moves the currently focused window to the other monitor (and back)?

Tags: shortcut-keys (Next Q), window-manager (Next Q), multiple-monitors (Next Q)

User: dat-chu


Answer by grizzly

1. Install CompizConfig Settings Manager Install compizconfig-settings-manager

2. apt-get install compizconfig-settings-manager

2. Run it → Go to bottom (Window Management) → Go to "Put"

3. Enable the plugin

4. Configure shortcut for "Put to next Output"

If the plugin put doesn't appear in CCSM, install the compiz-plugins Install compiz-pluginspackage. (sudo apt-get update && sudo apt-get install compiz-plugins)

EDIT: The required plugin package is now called compiz-plugins on 12.10 and higher. compiz-plugins-extra is still used for 12.04.


Tags: shortcut-keys (Next Q), window-manager (Next Q), multiple-monitors (Next Q)


Q: How do I remap certain keys or devices?

Tags: shortcut-keys (Next Q), xorg (Next Q), keyboard (Next Q)

I'm searching for a way to remap certain keys in ubuntu.

i.e.

I'd like to change PgUp to Home or PgDown to End.

Does a built-in command or a tool exist reassign keys in Ubuntu/GNOME?

Tags: shortcut-keys (Next Q), xorg (Next Q), keyboard (Next Q)

User: nes


Answer by nes

For remapping certain keys you need two tools. First xev (command-line tool) and second xmodmap (also command-line tool). Both should be available in Ubuntu without extra installing them.

1. Start terminal window and run xev. Now it's active and waits for you to press a key. Then press the key whose behaviour you want to change. i.e. PgUp.

2. xev will output some information about the pressed key. The third line is important. It should look similar to:

3. state 0x10, keycode 110 (keysym 0xff55, Prior), same_screen YES,

in this example Prior is the name of the behaviour the key is assigned to at the moment, the number keycode is the internal id to recognize the key. Now do this with another key i.e. PgDown give this output

state 0x10, keycode 115 (keysym 0xff56, Next), same_screen YES,

Here again the interesting part for us is keycode 115 and Next - the name of the behaviour.

3. now when you want to swap the two keys use xmodmap.

4. xmodmap -e "keycode 110 = Next"

This changes the key with keycode 110 on your keyboard to the action Next. It's pretty simple.

Note that if the key you are mapping should have a different meaning when used with the Shift key (for example for British keyboard layouts, Shift+2 gives quotation marks) then you can simply list the secondary command after the first. For example if you want the key with code 53 to map to backslash normally, but to the bar symbol when used with shift, you might do:

xmodmap -e "keycode 53 = backslash bar"

Note: These change are for the active X session only and will be lost after reboot. When you want to save the changes permanently you have to run the following commands after the ones above:

xmodmap -pke >~/.Xmodmap

(it creates a file named .Xmodmap in your home directory (~))

Then you have to create a file named .xinitrc in your home directory where you put command xmodmap .Xmodmap in.

source: Ubuntu Foruns

Bonus stuff:

If the key you are remapping has different behavior depending on a state ( like how the keys in the numeric keyboard depend on NumLock) you simply have to do xmodmap -pm to get a list of modifiers and then do:

xmodmap -e "KEYCODE MODIFIER = behaviour behaviour_with_modifier"

Suppose, for example, that you want to get a period instead of a comma on the numeric keyboard (useful for most programmers), but you want to keep the "delete" behavior when NumLock is off.

xmodmap -e "keycode 91 mod2 = KP_Delete period"

mod2, because xmodmap -pm tells us that mod2 is Num_Lock, the other names are obtained by pressing the keys in xev.


Answer by peter.o

I've just had an afterthought.. I think you may mean something entirely different by "remap".. but I'll leave my answer as it is... (I don't know how to re-assign one key to behave as another)

UPDATE: my 'afterthought' has been confirmed; ( I've answered the wrong question :)... please see NES's Community Wiki answer (accepted above).

There are two general ways to remap rebind a key.

· locally to a particular program
(a key can be used for different things in different apps/windows)

· globally for a specific user
(a key has the same function in all windows)

For 'local to a program' methods, there is sometimes a way to change keybindings offered by the app itself... eg.

Firefox has an addon called keyconfig ... for some info see this MozillZine post

Most Ubuntu programs are Gnome based and there is a specific utility to modify the keybinding for any menu item of these Gnome apps... It is called Editable Menu Accelerator ... It is a very 'touchy' tool, but quite powerful.. You can enable it by running gconf-editor (via Terminal or Alt+F2)... navigate to desktop--gnome--interface and select can_change_accels .... You can then change menu items to virtual anything you like (per program/window)... I suggest you disable it as soon as you've done what you need..

Otherwise you can set up Global hotkeys. I use a program called xbindkeys Install xbindkeys, and there is also an option available via the Main Menu -- Preferences, called Keyboard Shortcuts

If you use xbindkeys, you will need to add it to your "Startup Applications" (Main Menu -- Preferences) ... Also (as suggested by Stefano Palazzo) I have previously written a more detailed description of xbindkeys in an answer on this askubuntu page


Answer by casey

If you're trying to move a Shift key, there are a few extra steps:

xmodmap -e "keycode 62 = Up" # Shift => Up

xmodmap -e "keycode 111 = Shift_R" # Up => Shift

xmodmap -e "add shift = Shift_R" # Make the new Shift key actually do shifting

xmodmap -e "remove shift = Up" # Prevent the old Shift key from shifting

xset r 62 # Make the new Up key autorepeat

xset -r 111 # Prevent the new Shift key from autorepeating


Tags: shortcut-keys (Next Q), xorg (Next Q), keyboard (Next Q)


Q: How do I deactivate F1 and F10 keybindings in gnome-terminal?

Tags: shortcut-keys (Next Q), gnome-terminal (Next Q)

How can I turn off the F1 (help) and F10 (notifications menu) key bindings?

First one I need for screen utility and second to exit mc in console.

There are no such key bindings in the Keyboard Shortcuts system settings.

Tags: shortcut-keys (Next Q), gnome-terminal (Next Q)

User: marko-kevac


Answer by alvin-row

11.04

Disabling the F1 shortcut

1. In a gnome-terminal open up Edit Keyboard Shortcuts.

2. Scroll down to the Help/Contents shortcut, click where it says "F1" and hit Backspace:

enter image description here

Disabling the F10 shortcut

1. Install the compizconfig-settings-managerInstall compizconfig-settings-managerpackage.

o Warning: What are some of the issues with ccsm and why should I not use it?

2. Open up CompizConfig Settings Manager.

o Hit Super to open the Dash, type "Compiz" and hit Enter.

3. Type "unity" in the Filter entry and select the Ubuntu Unity Plugin.

4. Click the button to the right of Key to open the first panel menu and uncheck the Enabled checkbox.

enter image description here

5. That disabled the global F10 shortcut, now disable gnome-terminal's F10 shortcut:

o In a gnome-terminal open up Keyboards Shortcuts (Edit Keyboard Shortcuts) and
uncheck Enable the menu shortcut key (F10 by default)

enter image description here

6. F10 is mapped to menubar_accel by something in Ubuntu. Gnome? Metacity? Not sure what exact thing it is that steals it, but the key doesn't make it to Eclipse.

o Run gconf-editor, browse to /desktop/gnome/interface then scroll down to menubar_accel and delete the F10 value. [Stolen from here]


Answer by paweł-gościcki

Disable F10 in gnome-terminal in 12.04

Type this in the console:

Skip code block

mkdir -p ~/.config/gtk-3.0

cat<<EOF > ~/.config/gtk-3.0/gtk.css

@binding-set NoKeyboardNavigation {

unbind "<shift>F10"

}

* {

gtk-key-bindings: NoKeyboardNavigation

}

EOF

Then close all terminal sessions. Now it should work as it should (in mc for example).

· https://bugs.launchpad.net/ubuntu/+source/unity/+bug/726639/comments/18

· https://bbs.archlinux.org/viewtopic.php?pid=1017546#p1017546


Answer by rinzwind

start gconf-editor and follow /apps/gnome-terminal/keybindings/help

enter image description here

Description:

"Keyboard shortcut key for launching help. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action."


Tags: shortcut-keys (Next Q), gnome-terminal (Next Q)


Q: What is the equivalent of 'Control-Alt-Delete'?

Tags: shortcut-keys (Next Q), process (Next Q)

On Windows anytime the system hangs Ctrl-Alt-Del brings up the Start Up Manager, from which you can end the program or process causing the hang.

Is there any command like this on Ubuntu?

Tags: shortcut-keys (Next Q), process (Next Q)

User: mysterio


Answer by vincent

System Monitor shows you an overview of running applications (under the Processes tab) and allows you to end them by right-clicking on the name and selecting the respective context menu item. You can set up keyboard shortcuts in the Keyboard settings (Shortcuts tab), so you can bind Ctrl+Alt+Del to gnome-system-monitor, the command to start System Monitor.

Another command you might be interested in is xkill. This is traditionally bound to Ctrl+Alt+Esc (not sure if by default) and allows you to click on a misbehaving window to close it.

Both of these might not work if your entire system hangs. If that happens, there are two things you can do. The first has to be enabled in advance when your system doesn't hang yet (you could do it right now): open Keyboard Layout settings (I believe this is merged into Keyboard in Ubuntu 12.04, but that hasn't been released yet), then click Options. One of the options is Key sequence to kill the X server, you can click that to enable Ctrl+Alt+Backspace. If you have done that, and your system hangs, you can press Ctrl+Alt+Backspace, which will effectively bring you back to the login screen.

If even that doesn't work, the last thing you can do is ensuring a sane shutdown (i.e. not pressing and holding the power button). This one is a bit hard to remember, but it involves pressing and holding Alt+PrtSc and then press in order R, E, I, S, U, B (a mnemonic is Reboot Even If System Utterly Broken).


Answer by cédric-julien

To stay in the spirit of magical shortcuts, here are some :

· ctrl+alt+backspace combination (disabled on default on 11.10) that can restart the GUI.

· ctrl+alt+F2 to F6, that will display a console from which you could login and then eventually kill the stucked application. Once you killed it you can return to the GUI by pressing alt-f7. Killing an application by name can be done by using this command:

· sudo killall <name-of-the-application>

If this doesn't work, use the -9 flag to kill it with berforce.

sudo killall -9 <name-of-the-application>

· IN CASE OF EMERGENCY : use the Magic SysReq Key to directly "speak" to the kernel.


Tags: shortcut-keys (Next Q), process (Next Q)


Q: How to use Alt+Shift to switch keyboard layouts?

Tags: shortcut-keys keyboard-layout (Next Q)

I recently upgraded to Ubuntu 13.10, with the new keyboard handling system. The little "switch keyboard" option does not let me set it to Alt+Shift. How can I get this keyboard binding, as I have absolutely no interest in using the Mac-esque Super+Space combo?

Tags: shortcut-keys keyboard-layout (Next Q)

User: rtpg


Answer by georgy-ivanov

A confirmed bug in Ubuntu 13.10 prevents users from switching layouts using combinations like Alt+Shift, Caps Lock, Ctrl+Shift etc.

The bug affects many people, its importance is set to "High", so we may expect that an official fix will be released soon. You can subscribe to notifications about this bug on launchpad.net, so that you receive an email when it's done.

Currently, a patch aimed at resolving this issue is being tested. By now it seems to work for most users, though certain problems remain. To install the patch, use the following commands:

sudo add-apt-repository ppa:attente/modifier-only-input-switch

sudo apt-get update

sudo apt-get upgrade

A system reboot was needed in my case to make it work (simple log out and log in may be sufficient).

Note: Originally, the patch was located at ppa:attente/1218322. If you have previously installed it from there, you can first purge it as follows

sudo ppa-purge ppa:attente/1218322

and then execute the three commands above.

Alternatively, you may consider using a combination containing a non-modifier key (a letter, digit, space): try, for instance, Alt+Shift+Space (this will work without installing any patches).

Note that the keyboard shortcuts for switching layouts still do not work on lock screen (it is a separate bug). If you are stuck on lock screen and unable to enter the password because of the wrong layout, simply click the language indicator icon on the right of the password field.


Answer by radu-rădeanu

Many thanks to William Hua (attente) for his Modifier-only input switch PPA. As he said, he will keep the PPA up-to-date until a correct fix for this bug is released.

After I added this PPA to my list of sources using the following command:

sudo add-apt-repository ppa:attente/modifier-only-input-switch

and after I upgraded my system using:

sudo apt-get update

sudo apt-get upgrade

I could change the default Super+Space keyboard shortcut to Alt+Shift:

Text Entry


Tags: shortcut-keys keyboard-layout (Next Q)


Q: How to make keyboard work like OSX System Wide?


Q: Quickly place a window to another screen using only the keyboard


Q: How do I remap certain keys or devices?


Q: What are Unity's keyboard and mouse shortcuts?


Q: How do I deactivate F1 and F10 keybindings in gnome-terminal?


Q: What is the "show desktop" keyboard shortcut?


Q: How can I set default terminal used in Unity?


Q: What is the equivalent of 'Control-Alt-Delete'?


Q: How do I modify or disable the HUD's use of the Alt key?


Q: How to use Alt+Shift to switch keyboard layouts?