Launchpad Entry: https://launchpad.net/distros/ubuntu/+spec/kubuntu-laptop-buttons
Created: 2006-06-06 by JonathanRiddell
Contributors: JonathanRiddell, LukaRenko, JonathanJesse
Packages affected: kmilo, amarok, konqueror
Summary
Use the Ubuntu laptop buttons infrastructure in KDE.
(Make this: a stand-alone laptop button daemon with a KDE GUI. Read comments Elias12 for explanation.)
Rationale
Many laptops and also desktops have extra feature buttons which handle power management, display controls and other features. These should work as well in Kubuntu as they do in Ubuntu.
Use cases
Masie has a laptop with suspend and brightness buttons, when pressing these buttons nothing happens and she doesn't know how to make them work.
Bob notices that all his laptop buttons work in Ubuntu but none of them work in Kubuntu which would otherwise be his preferred environment.
Daniel follows the complex kmilo thinkpad instructions to get his thinkpad buttons working, he has to enable nvram writing to get this to work but wonders if it is a security risk.
Scope
Specific laptops are the problem of acpi-support and hotkey-setup, this spec is for making sure KDE does the right thing with the output of hotkey-setup.
Design
KDE has KMilo, a kde daemon module for handling laptop keys. KMilo has plugins for different types of laptop and each plugin for KMilo works in different ways and has different abilities. With the abstraction provided by hotkey-setup we no longer need different parts of KMilo for each laptop. We will create a new KMilo plugin for hotkey-support.
Implementation
Our KMilo hotkey-setup plugin will run xmodmap on startup to map the xevents from hotkey-setup to X keys. We will setup global bindings in KMix, Konqueror, Amarok and KubuntuPowerManagement to handle volume up/down, play/pause, suspend/hibernate, screen brightness and web browser control. The KMilo plugin will also have global bindings for volume and screen brightness and will show its on screen display to give feedback to the user, it will get its values by querying KMix and KubuntuPowerManagement with DCOP.
The KMilo plugin will also have global keybindings to listen for the e-mail and web browser buttons, these will run the default application which the user can set in the normal KDE way. Other application buttons will run the default Kubuntu application.
The existing KMilo plugins will be moved to a new unsupported package.
Unspecified buttons such as the "IBM Thinkpad" button will be mapped to X keys which can be set to almost any action using khotkeys, a standard part of KDE.
Keycode |
Keysym |
Handler |
229 |
XF86Search |
KMilo run kfmexec for KDE's default search page |
235 |
XF86MyComputer |
KMilo run kfmexec $HOME |
236 |
XF86Mail |
KMilo, run default e-mail application |
237 |
XF86AudioMedia |
KMilo run Amarok |
118 |
XF86Music |
KMilo run Amarok |
178 |
XF86WWW |
KMilo run default web browser |
no reliable standard |
XF86Calculator |
KMilo, run speedcrunch if installed else KCalc |
no reliable standard |
XF86Terminal |
KMilo run Konsole |
Keycode |
Keysym |
Handler |
162 |
XF86AudioPlay |
Amarok |
162 (same as play) |
XF86AudioPause |
Amarok |
164 |
XF86AudioStop |
Amarok |
144 |
XF86AudioPrev |
Amarok |
153 |
XF86AudioNext |
Amarok |
Keycode |
Keysym |
Handler |
160 |
XF86AudioMute |
KMix to change, KMilo for on screen display |
174 |
XF86AudioLowerVolume |
KMix to change, KMilo for on screen display |
176 |
XF86AudioRaiseVolume |
KMix to change, KMilo for on screen display |
Keycode |
Keysym |
Handler |
230 |
XF86Favorites |
Konqueror |
231 |
XF86Refresh |
Konqueror |
232 |
XF86Stop |
Konqueror |
233 |
XF86Forward |
Konqueror |
234 |
XF86Back |
Konqueror |
no reliable standard |
XF86Go |
Konqueror |
Keycode |
Keysym |
Handler |
222 (but also HAL?) |
XF86PowerOff |
|
223 |
XF86Standby |
|
165 |
XF86Sleep |
|
nothing |
XF86ContrastAdjust |
|
nothing |
XF86BrightnessAdjust |
Keycode |
Keysym |
Handler |
204 (mac only) |
XF86Eject |
run eject |
245 |
XF86Launch0 |
Help Key, launch KHelpCentre |
159 (Thinkpad key) |
XF86LaunchA |
none, user can set with KHotKeys |
241 (battery) |
XF86LaunchB |
none, user can set with KHotKeys |
205 (HP presentation) |
XF86LaunchC |
none, user can set with KHotKeys |
132 (Thinkpad Light) |
XF86LightBulb |
KMilo on screen display |
Comments
Elias12
- In order to make this thing successful I recommend to choose an approach similar to network-manager: A daemon running in the background and a KDE GUI to talk to it. Why? Because otherwise the point will come where you will throw away all your work and built a GUI for a daemon somebody else has written just like it was with knetworkmanager superseding kde-wireless-config or whatever it's name was.
- The success of network-manager lies in the fact that KDE could use it's advantages eventhough it comes from the gnome community. Another example is dbus which will replace dcop in KDE4. Both nm and dbus could be used by anyone without having to install gnome. This freedom ensures a wide acceptance and potentially attracts a big community driving the development of the project.
- On the contrary dcop did not survive since it was only available when installing all of kdelibs and all dependent packages (QT) as well.
- Therefore I cannot stress enough, if you want to create something with sustained success, something long lasting, then split your project in a daemon and a GUI part. The daemon should exist as a seperate project and consequently as a seperate package with no dependency to KDE. This will make your work available for other desktops as well. Nobody will have to reinvent the wheel. And laptop buttons could finally be available even for puristic console users - I never understood why all the cool stuff should only be available for desktop users. The GUI would either be a subproject of the daemon in a seperate package or some time become an official part of KDE with a dependancy to the daemon package.
- if your laptop key is not properly mapped, please report more info on LukaRenko/Keycodes page.
(2006-08-17): using xmodmap to load the keys, breaks when keyboard layout are used in 'Regional & Language' settings. It uses setxdkbmap to load a map, overriding the xmodmap settings. Same would happen if one use 2 (e.g. us and de) keyboard layouts and switched then with ALT-CTRL-K or the systray icon. One solution may be to use XDB options to include the 'laptop keys' settings.
xmodmap wil be moved to Xsession startup and just after setxkbmap in kxrb - that way Ubuntu map will be always active -- LukaRenko 2006-08-20 11:11:18
Lots of applications have Favorites, Stop, Forward, Back etc functionality. The special keys should not be globally assigned to just one app. Instead we should modify the keybindings of the apps where assignment of XF86<action> makes sense. I assume, that at least some of the XF86<*> keysyms can be assgined as a second Keybinding to a KDE STDAccel and are then automaticaly available in all apps that make use of them.
- Full screen mode: check that globally bound keys work also in full screen mode. I once used a tool (not kmilo) where e.g. Mute, etc. didn't work in full screen mode.
- The window used to display the message is far bigger than it needs to be which is very annoying if you're watching a video or something. Also there's no indication anywhere of how you might turn it off or change the behaviour.