SliTaz GNU/Linux official and community documentation wiki.
.png

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:guides:xbindkeys [2014/06/20 18:28]
sidini
en:guides:xbindkeys [2017/09/03 15:33] (current)
hgt [Configuration and detecting key codes]
Line 2: Line 2:
 ---- ----
  
-===== Xbindkeys ===== +====== Xbindkeys ======
- +
-=== Table of contents ​=== +
- +
-  * Introduction +
-  * Installing +
-  * Configuration and detecting key codes +
-  * Examples of functions +
-  * References +
- +
-----+
  
 ===== Introduction ===== ===== Introduction =====
  
  
-Xbindkeys is a program that allows you to launch shell commands with your keyboard or your mouse under X Window. It links commands to keys or mouse buttonsusing a configuration file. It'​s ​independant ​of the window manager and can capture all keyboard keys (ex: Power, Wake...).+Xbindkeys is a program that allows you to launch shell commands with your keyboard or your mouse under X Windows. It links commands to keys or mouse buttons using a configuration file. It'​s ​independent ​of the window manager and can capture all keyboard keys (ex: Power, Wake...).
    
-It is useful ​to make "dead keys" of a multimedia keyboard work. (ex: play, pause, browser homepage...)+It is handy to make "dead keys" of a multimedia keyboard work. (ex: play, pause, browser homepage...)
  
 ---- ----
Line 25: Line 15:
 ===== Installing ===== ===== Installing =====
  
-Use __tazpkg__ ​to quickly install //​xbindkeys//​ package. Open a terminal as //root// and type:+Use //​tazpkg// ​to quickly install //​xbindkeys//​ package. Open a terminal as //root// and type:
  
   # tazpkg get-install xbindkeys   # tazpkg get-install xbindkeys
-  
-Current package is //​xbindkeys-1.8.3//​. 
  
 ---- ----
Line 35: Line 23:
 ===== Configuration and detecting key codes ===== ===== Configuration and detecting key codes =====
  
-Xbindkeys uses a configuration file to link a command to a key on your keyboard. Usually this file is : //$HOME/.xbindkeyrc//​+Xbindkeys uses a configuration file to link a command to a key on your keyboard. Usually this file is : ''​$HOME/.xbindkeysrc''​ 
 You can have a default one created by using : You can have a default one created by using :
  
Line 50: Line 39:
 When a small white window shows up on screen, just press the desired key. Terminal will show you the 3-line code of the pressed key. Example: When a small white window shows up on screen, just press the desired key. Terminal will show you the 3-line code of the pressed key. Example:
  
-  "(special ​function)"​+  "(Scheme ​function)"​
   m:0x10 + c:180   m:0x10 + c:180
   Mod2 + XF86HomePage   Mod2 + XF86HomePage
  
-Now, close //xbindkeys// application to make changes on configuration file:+Now, close ''​xbindkeys'' ​application to make changes on configuration file:
  
   $ killall xbindkeys   $ killall xbindkeys
  
-Open //.xbindkeysrc// file on Leafpad and copy the 3-line code above to the end of the file. +Open ''​.xbindkeysrc'' ​file on Leafpad ​(or on your favorite text editor) ​and copy the 3-line code above to the end of the file. 
-We need to change the first code line to link the key code to a desired function. For example, we want that Leafpad be openned ​when the //XF86Homepage// key is pressed. To do thisjust change the first line to:+We need to change the first code line to link the key code to a desired function. For example, ​if we want to open Midori ​when ''​XF86Homepage'' ​key is pressed, ​we must change the first line to:
  
-  "leafpad"+  "midori"
   m:0x10 + c:180   m:0x10 + c:180
   Mod2 + XF86HomePage   Mod2 + XF86HomePage
  
-Save and close the //.xbindkeysrc// file. Restart ​//xbindkeys// program and your new shortcut is already working! +Save and close the ''​.xbindkeysrc'' ​file. Restart ​''​xbindkeys'' ​program and your new shortcut is already working! 
-To add other shortcuts, repeat the proceeding ​above. +To add other shortcuts, repeat the procedure ​above. 
-To detect a multi-key shortcut codelike CTRL+F, use:+ 
 +If you want to detect a multi-key shortcut code like CTRL+F, use:
  
   $ xbindkeys -mk   $ xbindkeys -mk
  
  
-**//To be continued... Please, don'​t ​modify ​this page yet.//**+==== Summary ==== 
 +Summary of commands: 
 + 
 +  # tazpkg get-install xbindkeys 
 +  $ xbindkeys --defaults > $HOME/.xbindkeysrc 
 +  $ xbindkeys 
 +  $ xbindkeys -k 
 +  $ killall xbindkeys 
 +  $ leafpad HOME/.xbindkeysrc 
 +  $ xbindkeys 
 + 
 +==== Adding xbindkeys in autostarted applications ==== 
 + 
 +In the //PCManFM// in your //home// folder search for hidden folder //.config//, open it, next open //openbox// folder and open //​autostart.sh//​ in your text editor. Add these lines at the end of your file: 
 + 
 +  # Fn Keys 
 +  xbindkeys & 
 + 
 +Save and quit text editor. All custom shortcuts will stay after you reboot or switch off/on your machine. 
 + 
 + 
 +---- 
 + 
 + 
 +===== Examples and tips ===== 
 +This section shows you many command codes ready to useKey codes (last two of 3-line key code) may vary from keyboard to keyboardso it's up to you to catch them using //​xbindkeys//​. 
 + 
 +=== Volume control (Alsa mixer) === 
 + 
 +  #​Muter/​UnMute 
 +  "​amixer set "​Master"​ toggle"​ 
 +  m:0x00 + c:121 
 +  XF86AudioMute 
 + 
 +  #Volume up 
 +  "​amixer set "​Master"​ 5%+" 
 +  m:0x0 + c:123 
 +  XF86AudioRaiseVolume 
 + 
 +  #Volume down 
 +  "​amixer set "​Master"​ 5%-" 
 +  m:0x0 + c:122 
 +  XF86AudioLowerVolume 
 + 
 +=== Alsaplayer === 
 + 
 +  #stop alsaplayer 
 +  "​alsaplayer --pause"​ 
 +  m:0x0 + c:172 
 +  XF86AudioPlay 
 + 
 +  #next alsaplayer 
 +  "​alsaplayer --next"​ 
 +  m:0x0 + c:171 
 +  XF86AudioNext 
 + 
 +  #previous alsaplayer"​ 
 +  "​alsaplayer --prev"​ 
 +  m:0x0 + c:173 
 +  XF86AudioPrev 
 + 
 +=== Midori Browser === 
 + 
 +  #Open Midori at Homepage 
 +  "​midori --execute Homepage"​ 
 +  m:0x10 + c:180 
 +  Mod2 + XF86HomePage 
 + 
 +  #Back for previous page 
 +  "​midori --execute Back"​ 
 +  m:0x10 + c:166 
 +  Mod2 + XF86Back 
 + 
 +  #Forward to next page 
 +  "​midori --execute Forward"​ 
 +  m:0x10 + c:167 
 +  Mod2 + XF86Forward 
 + 
 +  #Stop loading current page 
 +  "​midori --execute Stop"​ 
 +  m:0x10 + c:136 
 +  Mod2 + Cancel 
 + 
 +  #​Reload/​Refresh current page 
 +  "​midori --execute Reload"​ 
 +  m:0x10 + c:181 
 +  Mod2 + XF86Reload 
 + 
 +NOTES: If you use Firefox or Google Chrome, there'​s no need to modify //​xbindkeysrc//​ file: these browsers automatically recognize the multimedia keys. 
 +Also, if you change from Midori to Firefox or Chrome, you must comment (#) or delete the shortcuts above. If you don'​t ​do this, it will open a Midori window when you press a navigation button. 
 + 
 +=== Power management === 
 + 
 +  #suspend to ram 
 +  "sudo pm-suspend"​ 
 +  m:0x0 + c:150 
 +  XF86Sleep 
 + 
 +NOTE: this one (suspend to ram) works if you install //​pm-utils//​. 
 + 
 +  #power off button 
 +  "​poweroff"​ 
 +  m:0x0 + c:124 
 +  XF86PowerOff 
 + 
 +=== Screenshots === 
 + 
 +  #​screenshot 
 +  "​mtpaint -s" 
 +  m:0x0 + c:107 
 +  Print 
 + 
 +=== Applications Menu (Start Menu) === 
 + 
 +  #Show Start Menu with left windows-key 
 +  "​lxpanelctl menu"​ 
 +  m:0x50 + c:133 
 +  Mod2+Mod4 + Super_L 
 + 
 +  #Show Start Menu with right windows-key 
 +  "​lxpanelctl menu"​ 
 +  m:0x50 + c:134 
 +  Mod2+Mod4 + Super_R 
 + 
 +---- 
 + 
 +===== References ===== 
 + 
 +Xbindkeys homepage: 
 + 
 +http://​www.nongnu.org/​xbindkeys/​xbindkeys.html 
 + 
 +Forum topics: 
 + 
 +http://​forum.slitaz.org/​topic/​make-fn-keys-work 
 + 
 +http://​forum.slitaz.org/​topic/​slitaz-40-how-to-made-screen-shots-captures-d-ecran 
 + 
 +http://​forum.slitaz.org/​topic/​keyboard-shortcutshooks 
 + 
 +http://​forum.slitaz.org/​topic/​keyboard-shortcuts-how-create-them 
 + 
 +http://​forum.slitaz.org/​topic/​magic-sysrq-keys-power-button 
 + 
 +http://​forum.slitaz.org/​topic/​power-button-shutdown 
 + 
 +http://​forum.slitaz.org/topic/fn-key
  
  
 +---- 
 +\\
 +^  Page Review Section ​ ^^ 
 +|Quality| ​  |
 +|Review| ​  |
 +|Priority| ​ |
 +|Problems| |
 +|How to Improve| Add new rows like this ;-)|
  
  
 +\\
 
en/guides/xbindkeys.1403281692.txt.gz · Last modified: 2014/06/20 18:28 by sidini