Difference between revisions of "ThinkPad OSD"

From ArchWiki
Jump to: navigation, search
m (add ja link)
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Category:Laptops]]
+
[[Category:Lenovo]]
 
+
[[ja:ThinkPad OSD]]
= Getting ThinkPad OSD working on Arch Linux =
+
== General Note ==
+
 
New desktop environments ([[GNOME]], [[KDE]], and maybe even [[Xfce]]) support their own osd notifications for important events (volume up/down/mute and brightness up/down), which might be enough for most users. In order to use those notifications instead of the ones provided by TPB, map the keyboard-events of those keys to the proper keycodes.
 
New desktop environments ([[GNOME]], [[KDE]], and maybe even [[Xfce]]) support their own osd notifications for important events (volume up/down/mute and brightness up/down), which might be enough for most users. In order to use those notifications instead of the ones provided by TPB, map the keyboard-events of those keys to the proper keycodes.
  
Line 8: Line 6:
  
 
* Check with lsmod if the nvram module is loaded on boot
 
* Check with lsmod if the nvram module is loaded on boot
* If not, add {{ic|nvram}} to MODULES=(... nvram) in {{ic|/etc/rc.conf}}
+
* If not, add {{ic|nvram}} to {{ic|1=MODULES=(... nvram)}} in {{ic|/etc/rc.conf}}
 
* Check /dev/nvram permissions, your user must have read access to it.
 
* Check /dev/nvram permissions, your user must have read access to it.
* (udev 181-2) create /etc/udev/rules.d/tpb.rules:
+
* Edit /etc/udev/rules.d/51-arch.rules (WARNING: It will be overwritten with new udev update!)
KERNEL=="nvram", GROUP="audio", MODE="0640"
+
 
+
 
+
* (udev 119-1) Edit /etc/udev/rules.d/51-arch.rules (WARNING: It will be overwritten with new udev update!)
+
 
  KERNEL=="nvram",  NAME="misc/%k", SYMLINK+="%k", GROUP="kmem", MODE="0660"
 
  KERNEL=="nvram",  NAME="misc/%k", SYMLINK+="%k", GROUP="kmem", MODE="0660"
* (older udev) /etc/udev/rules.d/tpb.rules:
 
KERNEL=="nvram", NAME="misc/%k", SYMLINK+="%k", MODE="0660", GROUP="users"
 
 
* Note: this line seems to work better for some users:
 
* Note: this line seems to work better for some users:
 
  KERNEL=="nvram", GROUP="kmem", MODE="0660"
 
  KERNEL=="nvram", GROUP="kmem", MODE="0660"
Line 27: Line 19:
  
 
== Setting a more readable color and better placement ==
 
== Setting a more readable color and better placement ==
/etc/tpbrc:
+
{{hc|/etc/tpbrc|
OSDCOLOR    Green
+
OSDCOLOR    Green
OSDVERTICAL 0
+
OSDVERTICAL 0
OSDHORIZONTAL 0
+
OSDHORIZONTAL 0
OSDPOS      MIDDLE
+
OSDPOS      MIDDLE
OSDALIGN    CENTER
+
OSDALIGN    CENTER
 +
}}
  
 
== Starting with KDE ==
 
== Starting with KDE ==
~/.kde/Autostart/tpb-startup.sh:
+
{{hc|~/.kde/Autostart/tpb-startup.sh|
# Start Thinkpad OSD daemon
+
# Start Thinkpad OSD daemon
if [ -x /usr/bin/tpb ] &&  [ -w /dev/nvram ] && [ -r /dev/nvram ]; then
+
if [ -x /usr/bin/tpb ] &&  [ -w /dev/nvram ] && [ -r /dev/nvram ]; then
    /usr/bin/tpb -d
+
    /usr/bin/tpb -d
fi
+
fi
 +
}}
  
 
== Starting with Fluxbox ==
 
== Starting with Fluxbox ==
~/.fluxbox/startup
+
{{hc|~/.fluxbox/startup|
# Start Thinkpad OSD daemon
+
# Start Thinkpad OSD daemon
if [ -x /usr/bin/tpb ] &&  [ -w /dev/nvram ] && [ -r /dev/nvram ]; then
+
if [ -x /usr/bin/tpb ] &&  [ -w /dev/nvram ] && [ -r /dev/nvram ]; then
    /usr/bin/tpb -d
+
    /usr/bin/tpb -d
fi
+
fi
 +
}}
  
 
== Play a sound on volume change ==
 
== Play a sound on volume change ==
Line 52: Line 47:
 
You can play a sound when using the volume buttons (mac like).
 
You can play a sound when using the volume buttons (mac like).
  
* /etc/tpbrc
+
{{hc|/etc/tpbrc|
CALLBACK /usr/local/bin/callback_volume.sh
+
CALLBACK /usr/local/bin/callback_volume.sh
 +
}}
  
* /usr/local/bin/callback_volume.sh
+
{{hc|head=/usr/local/bin/callback_volume.sh|output=
#!/bin/sh
+
#!/bin/sh
[ "$1" = "volume" ] && exec canberra-gtk-play --file=/usr/share/sounds/freedesktop/stereo/audio-volume-change.oga
+
[ "$1" = "volume" ] && exec canberra-gtk-play --file=/usr/share/sounds/freedesktop/stereo/audio-volume-change.oga
 +
}}
  
 +
Then:
 
  # chmod +x /usr/local/bin/callback_volume.sh
 
  # chmod +x /usr/local/bin/callback_volume.sh
  
* Then restart tpb.
+
Finally, restart tpb.
  
 
== See also ==
 
== See also ==
 
* http://www.thinkwiki.org/wiki/Tpb
 
* http://www.thinkwiki.org/wiki/Tpb

Latest revision as of 09:27, 10 December 2015

New desktop environments (GNOME, KDE, and maybe even Xfce) support their own osd notifications for important events (volume up/down/mute and brightness up/down), which might be enough for most users. In order to use those notifications instead of the ones provided by TPB, map the keyboard-events of those keys to the proper keycodes.

Loading nvram at boot and give permission to access /dev/nvram

  • Check with lsmod if the nvram module is loaded on boot
  • If not, add nvram to MODULES=(... nvram) in /etc/rc.conf
  • Check /dev/nvram permissions, your user must have read access to it.
  • Edit /etc/udev/rules.d/51-arch.rules (WARNING: It will be overwritten with new udev update!)
KERNEL=="nvram",   NAME="misc/%k", SYMLINK+="%k", GROUP="kmem", MODE="0660"
  • Note: this line seems to work better for some users:
KERNEL=="nvram", GROUP="kmem", MODE="0660"
Note: Check if there is already a line matching nvram in the /etc/udev/rules.d/ directory. In this case, you have to modify the existing entry, and do not create a tpb.rules.
Note: Write access to nvram is only needed to set volume with MIXER ON. see /etc/tpbrc.

Setting a more readable color and better placement

/etc/tpbrc
OSDCOLOR    Green
OSDVERTICAL 0
OSDHORIZONTAL 0
OSDPOS      MIDDLE
OSDALIGN    CENTER

Starting with KDE

~/.kde/Autostart/tpb-startup.sh
# Start Thinkpad OSD daemon
if [ -x /usr/bin/tpb ] &&  [ -w /dev/nvram ] && [ -r /dev/nvram ]; then
    /usr/bin/tpb -d
fi

Starting with Fluxbox

~/.fluxbox/startup
# Start Thinkpad OSD daemon
if [ -x /usr/bin/tpb ] &&  [ -w /dev/nvram ] && [ -r /dev/nvram ]; then
    /usr/bin/tpb -d
fi

Play a sound on volume change

You can play a sound when using the volume buttons (mac like).

/etc/tpbrc
CALLBACK /usr/local/bin/callback_volume.sh
/usr/local/bin/callback_volume.sh
#!/bin/sh
[ "$1" = "volume" ] && exec canberra-gtk-play --file=/usr/share/sounds/freedesktop/stereo/audio-volume-change.oga

Then:

# chmod +x /usr/local/bin/callback_volume.sh

Finally, restart tpb.

See also