个人工具

“UbuntuHelp:XfceMultimediaKeys”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
第6行: 第6行:
 
</li><li>For each keypress, xev will output a bunch of gobbledegook that looks like this:</li></ol>
 
</li><li>For each keypress, xev will output a bunch of gobbledegook that looks like this:</li></ol>
  
<pre><nowiki>KeyPress event, serial 31, synthetic NO, window 0x3c00001,
+
<pre><nowiki>
 +
KeyPress event, serial 31, synthetic NO, window 0x3c00001,
 
root 0x44, subw 0x0, time 2040314804, (174,-11), root:(725,318),
 
root 0x44, subw 0x0, time 2040314804, (174,-11), root:(725,318),
 
state 0x0, '''keycode 42''' (keysym 0x67, g), same_screen YES,
 
state 0x0, '''keycode 42''' (keysym 0x67, g), same_screen YES,
第19行: 第20行:
 
We're interested in the keycodes.
 
We're interested in the keycodes.
 
1.#4 Write down each keycode and its corresponding media key (you'll have to remember the order you pressed them in, unless you want to type xev in over and over again).
 
1.#4 Write down each keycode and its corresponding media key (you'll have to remember the order you pressed them in, unless you want to type xev in over and over again).
<ol><li>Check out this page: [http://keytouch.sourceforge.net/howto_keyboard.html]  Scroll down for a bit and it will show you all of the special XF86 symlinks.  They all start with XF86.
+
<ol><li>Check out this page: [[http://keytouch.sourceforge.net/howto_keyboard.html]]  Scroll down for a bit and it will show you all of the special XF86 symlinks.  They all start with XF86.
 
</li><li>In your home directory, create a new file .Xmodmap (you can actually name it whatever you want, but .Xmodmap is conventional)
 
</li><li>In your home directory, create a new file .Xmodmap (you can actually name it whatever you want, but .Xmodmap is conventional)
 
</li><li>Follow this format to create your file:</li></ol>
 
</li><li>Follow this format to create your file:</li></ol>
  
<pre><nowiki>keycode 174 = XF86AudioLowerVolume
+
<pre><nowiki>
 +
keycode 174 = XF86AudioLowerVolume
 
keycode 176 = XF86AudioRaiseVolume
 
keycode 176 = XF86AudioRaiseVolume
 
keycode 162 = XF86AudioPlay
 
keycode 162 = XF86AudioPlay
第44行: 第46行:
 
* mpc prev
 
* mpc prev
 
(''sudo apt-get install mpd mpc gmpc'' to install [http://www.musicpd.org/ MPD] and its two client programs, (G)MPC)
 
(''sudo apt-get install mpd mpc gmpc'' to install [http://www.musicpd.org/ MPD] and its two client programs, (G)MPC)
 +
* exaile (show/hide player)
 +
* exaile -t (play/pause)
 +
* exaile -s (stop)
 +
* exaile -p (previous)
 +
* exaile -n (next)
 +
(''sudo apt-get install exaile'' to install exaile (amarok based player for GTK/Gnome, not KDE)
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2008年10月19日 (日) 18:22的版本

GNOME directly queries X11 for its media keys support, so you don't need to manually configure it. However, Xfce doesn't, and you'll have to manually get the keycodes and set the symlinks. This is actually kind of simple if you know how to do it. Here's how:

  1. In terminal, type xev.
  2. A window will pop up. Press all of the media keys you want to enable, one-by-one. Then Alt+F4 out of the popup.
  3. For each keypress, xev will output a bunch of gobbledegook that looks like this:
KeyPress event, serial 31, synthetic NO, window 0x3c00001,
root 0x44, subw 0x0, time 2040314804, (174,-11), root:(725,318),
state 0x0, '''keycode 42''' (keysym 0x67, g), same_screen YES,
XLookupString gives 1 bytes: (67) "g"
XmbLookupString gives 1 bytes: (67) "g"
XFilterEvent returns: False

KeyRelease event, serial 31, synthetic NO, window 0x3c00001,
root 0x44, subw 0x0, time 2040314884, (174,-11), root:(725,318),
state 0x0, '''keycode 42''' (keysym 0x67, g), same_screen YES,
XLookupString gives 1 bytes: (67) "g"

We're interested in the keycodes. 1.#4 Write down each keycode and its corresponding media key (you'll have to remember the order you pressed them in, unless you want to type xev in over and over again).

  1. Check out this page: [[1]] Scroll down for a bit and it will show you all of the special XF86 symlinks. They all start with XF86.
  2. In your home directory, create a new file .Xmodmap (you can actually name it whatever you want, but .Xmodmap is conventional)
  3. Follow this format to create your file:
keycode 174 = XF86AudioLowerVolume
keycode 176 = XF86AudioRaiseVolume
keycode 162 = XF86AudioPlay
keycode 164 = XF86AudioStop
keycode 144 = XF86AudioPrev
keycode 153 = XF86AudioNext

If xev gave keycode 174 when you hit your Volume Down button, you would have keycode 174 = XF86AudioLowerVolume just like here. 1.#8 Don't give up! Almost done. Go to your Xfce Menu -> Settings -> Keyboard Settings. Go to the Shortcuts tab and hit the left "Add" button to create your own Shortcut Profile.

  1. At this point, you'll have to create shortcuts for each button. You will need to figure out the command line instructions for your media player on your own, but once you know them, hit the right "Add" button, enter the command, hit your media key and you're done.
  2. Last step: In terminal, make sure you're in your home directory and type xmodmap .Xmodmap. This will activate the symlinks.

Here are some examples of command line instructions for different media players:

  • dcop amarok play
  • dcop amarok prev

(sudo apt-get install amarok to install amaroK)

  • aumix -v+10
  • aumix -v-10

(sudo apt-get install aumix to install aumix's command-line volume changing support)

  • mpc next
  • mpc prev

(sudo apt-get install mpd mpc gmpc to install MPD and its two client programs, (G)MPC)

  • exaile (show/hide player)
  • exaile -t (play/pause)
  • exaile -s (stop)
  • exaile -p (previous)
  • exaile -n (next)

(sudo apt-get install exaile to install exaile (amarok based player for GTK/Gnome, not KDE)