I know the easy way using the unity but is there a way to make a shortcut for chrome for example using the terminal.
-
2short cut how ? Start typing a command and use tab completion, how to create an alias, or how to write a .desktop file ? custom key strokes ? what ? – Panther May 06 '14 at 16:54
-
i mean if i want to add shortcut to chrome on the desktop using the terminal how can you do that ? – alkabary May 06 '14 at 17:36
-
See http://askubuntu.com/questions/106521/how-to-create-pin-unity-shortcut-to-a-specific-command-shellscript . You make a .desktop file, you can place it is various locations. – Panther May 06 '14 at 18:00
-
I am not sure what you mean by the easy way, but why not simply copy the existing desktop file from `/usr/share/applications` on to your desktop or wherever you want it to appear, and make it executable? You can do that via command line if you want to :) – Jacob Vlijm May 06 '14 at 19:35
1 Answers
One way of doing it is to use xbindkeys:
Install
xbindkeyssudo apt-get install xbindkeysCreate the default settings file:
xbindkeys --defaults > ~/.xbindkeysrcAdd the relevant lines to
~/.xbindkeysrc:printf '"google-chrome"\nControl+Shift+Mod2 + c\n' >> .xbindkeysrcThe keycodes above make Crtl Shift C launch
google-chrome.You might need to get the right keycodes for your keys. Run
xbindkeys -kand press your desired shortcut. That will print the relevant key sequence.Run
xbindkeys. To make this permanent, add a line containingxbindkeysto your~/.Xsession:echo xbindkeys >> ~/.Xsession
Now, once you have all that set up, and xbindkeys is running automatically every time you log in (because of step 4 above), you will be able to add new shortcut keys with this command:
printf '"ApplicationName"\n+Shortcut+Key\n' >> ~/.xbindkeysrc &&
killall xbindkeys ; xbindkyes
For example, this will make Ctrl+Shift+X launch xclock:
printf '"xclock"\nControl+Shift+Mod2 + x\n' >> ~/.xbindkeysrc &&
killall xbindkeys ; xbindkyes
You could then create a little script that does it for you. Save the following lines as ~/bin/keyb.sh:
#!/bin/bash
printf '"$1"\n$2\n' >> ~/.xbindkeysrc &&
killall xbindkeys ; xbindkyes
Make the script executable with chmod a+x ~/bin/keyb.sh. You can now add a new shortcut with
keyb.sh firefox 'Control+Shift+Mod2 + x'
- 98,183
- 15
- 197
- 293