laptop love
i got annoyed because i have four extra keys on my laptop keyboard that doesn’t
work as expected when i’m in gentoo. i’m callin’ them “compaq keys” coz i dont
know what they are called and its tiresome to know anyway…
in windows vista:
compaq key1: starts a program ‘dvdplay’ i think…
compaq key2: toggles the volume on or off
compaq key3: lowers the volume
compaw key4: does the opposite of key3
so i modified my keymap settings so that compaq keys2-4 are mapped to function keys
F13-F15 (i only have F1 to F12…)
-- .Xmodmap -- keycode 160 = F13 keycode 174 = F14 keycode 176 = F15
and my corresponding .fluxbox/keys file
-- snip -- # windows key Mod4 x :maximize Mod4 d :ShowDesktop Mod4 a :ExecCommand aterm +sb -tr -trsb -fg darkgray -fade 50% Mod4 w :ExecCommand audacious Mod4 e :ExecCommand /usr/bin/emelfm2 Mod4 b :ExecCommand /usr/bin/firefox Mod4 y :ExecCommand /usr/bin/gaim Mod4 m :ExecCommand /usr/bin/sylpheed Mod4 v :ExecCommand /usr/bin/gvim # laptop keymap F13 :ExecCommand /bin/bash ~/.mykbd F14 :ExecCommand /usr/bin/amixer sset PCM 5%- F15 :ExecCommand /usr/bin/amixer sset PCM 5%+ -- snip --
now, volume on/off toggling presented a mild challenge mainly because i didn’t
find implicit mute/unmute capability in amixer’s man page. so i did a little bash
mojo to get the desired functionality i want.
.mykdb
#!/bin/bash
SYSMIX=`which amixer`
GET_SPKR_STAT=$SYSMIX
STATUS=`$GET_SPKR_STAT get Speaker | grep -i off`
if [[ -z $STATUS ]]; then
$SYSMIX sset Speaker off 1> /dev/null
else
$SYSMIX sset Speaker on 100% 1> /dev/null
fi
it took me a whole goddamn 10 minutes to figure out that [[ ]] needs a space
separator on its expression field.
lesson learned. seriously, don’t do bash, brainfuck, and perl when you are sleep
deprived.

amixer toggle is your friend.
Comment by Ciaran McCreeshc — August 10, 2008 @ 6:31 pm
works like a charm.. thanks.
Comment by sleepy jenkins — August 16, 2008 @ 3:15 pm