You are not logged in.
Has anybody done this? My eeepc 900 doesn't have keyboard leds, so it would be really useful for me to just have a couple of textboxes indicating whether capslock and numlock are on in the toolbar. If nothing else, does anybody know a way to read this status out of somewhere in /proc or wherever? I tried using setleds, but it doesn't work in X. It really makes a mess if I hit J repeatedly in vi not realizing capslock is still on.
EDIT: I threw together a quick and dirty wicked widget to do this, and a brief shell script to do the actual readings. It was pretty straight forward, but if anyone not too savvy with bash or lua ends up needing it I could post it here on request. Thanks a lot.
Last edited by josomebody (2009-03-28 20:14:06)
: () { : | :& } ;:
Offline
$ xset q | grep LED
Will tell you the status, each number coresponds to a state, caps, scroll, both. Writing a widget would be extremely easy and it would be a nice little exercise for you: http://awesome.naquadah.org/wiki/index. … nd_widgets You could also allow changing states with mouse clicks (read man xset).
You need to install an RTFM interface.
Offline
Cool I think that's all I'll need. Thanks a ton.
: () { : | :& } ;:
Offline
Has anybody done this? My eeepc 900 doesn't have keyboard leds, so it would be really useful for me to just have a couple of textboxes indicating whether capslock and numlock are on in the toolbar. If nothing else, does anybody know a way to read this status out of somewhere in /proc or wherever? I tried using setleds, but it doesn't work in X. It really makes a mess if I hit J repeatedly in vi not realizing capslock is still on.
EDIT: I threw together a quick and dirty wicked widget to do this, and a brief shell script to do the actual readings. It was pretty straight forward, but if anyone not too savvy with bash or lua ends up needing it I could post it here on request. Thanks a lot.
this is a great idea!
i would love to see the script
Offline
There's really not much to it.
My shell scripts is just called leds
#! /bin/bash
ledstate=`xset q 2>/dev/null | grep LED`
ledstate=`echo $ledstate | sed s/[^1-9]//g`
case "$ledstate" in
'1')
echo "C."
;;
'2')
echo ".N"
;;
'3')
echo "CN"
;;
*)
echo ".."
esac
In mine, C=capslock on, N=numlock on, and dots for not on. I have no use to scroll lock. you can change that as needed in the case...esac echos.
And be sure to require "wicked" in your rc.lua and have wicked installed, then the actual widget is like
myledbox = widget({ type = "textbox", name = "myledbox" , align = "right" })
function run_script()
local filedescripter = io.popen('leds')
local value = filedescripter:read()
filedescripter:close()
return value
end
wicked.register(myledbox, run_script, "$1", 1)
That updates every second. Change the last value in the wicked.register() statement to speed it up or slow it down, and then just include it somewhere in your list of stuff in the toolbar.
: () { : | :& } ;:
Offline
thank you.
i have a problem though. when i make the bash script executable then awesome3 will crash/freeze.
Offline
Do you have wicked installed? Follow the wicked widgets guide on awesome's wiki, make sure there aren't any typos or mistakes in your rc.lua.
: () { : | :& } ;:
Offline
i dunno everytime i called xset from wicked, awesome would just freeze... ??
i worked it around by basically calling it from awful.hooks writing the output of your leds script to a file then output it with wicked.
thanks though
Offline
Oh you were doing differently from me. The first script I put up is a bash script, then all wicked got was the output of that script (in the form of echo's).
: () { : | :& } ;:
Offline