Friday, March 02, 2012

5.1 amd64 K43U: ksh script for Asus K43U keyboard shortcut in spectrwm.

Hi,

I've written a simple script to use my K43U keyboard shortcuts. As stated previously, Fn+F1 (sleep) and Fn+F7 (Off LCD) shortcuts is working. But as the Fn button is undetected in OpenBSD or xorg, I cannot use the Fn button to create other shorcuts, instead I need rely on spectrwm's MOD key. I might change this back to Fn key if later on it's workable.

What's the purpose of this (current) script?
- MOD+F10 to mute/unmute master volume (mixerctl outputs.master.mute)
- MOD+F11 to decrease master volume (mixerctl outputs.master. For both LR channel)
- MOF+F12 to increase master volume (mixerctl outputs.master. For both LR channel)

If you're using xstatbar, like me, xstatbar will show a graph of master volume for each Left/Right channel. So by using this script, you can see how much percentage of the volume you increase/decrease.

Why ksh? Because OpenBSD's default SHELL is ksh and I'm using it. This script might work with other shell.

Copy the asusfn.sh to either your $HOME or if you want to use it exclusively for spectrwm (scrotwm), copy it to /usr/local/share/scrotwm/ but make sure to alter my .scrotwm.conf below accordingly as I put my asusfn.sh in $HOME. Make sure to chmod the asusfn.sh to executable.

Manual usage is:
$ ./asusfn.sh [param]

Replace [param] with:
aup : To increase volume.
adn : To decrease volume.
amt : To mute/unmute volume.

This top part is snippet of my $HOME/.scrotwm.conf. As stated above, alter accordingly.



And this part above is the asusfn.sh. If you read the script carefully, you can see that you can also use the command:

$ ./asusfn.sh info

Which is basically my debugging for the script. I'm not an expert on ksh scripting so I used that to check values/env/bla bla etc.

Future (might be) improvements:
- MOD+F2 to enable/disable athn0 (Wireless LAN)
- MOD+F8 to change display output
- MOD+F9 to enable/disable touchpad

I also found that there's acpiasus which is the Hotkeys driver for Asus's laptop. Currently not automatically working with this machine-o-mine so I need to search for clues on it.

Legal stuff. You can freely copy/use/alter the script any way you want. Don't mock my programming skill because I'm not a programmer and I know this script can be made more simpler. If you alter the script and gave it somebody, make sure you tell them it's not my version. If you find this script useful, thank me or don't either way it's ok. Later.

1 comment:

Benjamin Francom said...

Thanks! Getting it to work in my OpenBSD 6.0 with i3wm.

6.5 amd64: Modify existing certbot certificates.

Hi, It's been quite some time eh. As you can see, I still upgrade my OpenBSD system regularly but currently I do not have the time to ...