Power Developer https://powerdeveloper.org/forums/ |
|
Brightness and pm with awesome https://powerdeveloper.org/forums/viewtopic.php?f=7&t=2686 |
Page 1 of 1 |
Author: | Aleix Orti [ Fri Nov 30, 2012 8:01 am ] |
Post subject: | Brightness and pm with awesome |
Hello Some days ago I've changed from xfce desktop to awesome window manager in my smartbook. I liked the change a lot: with window tiling I can use all the screen size easely, and with the key bindings I avoid using the mouse. But with this change i've lost the keys for up and down screen brightness. They don't run at all. I also lost volume keys but I fixed it using alsamixer instead. And finally I don't know how can I know how many battery remains. Someone can help me with brightness and power management? Thanks in advance. |
Author: | jakobcreutzfeldt [ Fri Nov 30, 2012 9:43 am ] |
Post subject: | Re: Brightness and pm with awesome |
I'm in a similar situation but I opted for dwm since it's far more lightweight than Awesome. For brightness, see http://www.powerdeveloper.org/forums/vi ... f=1&t=2084 There are a couple ways to do it. I took the easy way out by letting a script handle it. The C program mentioned in the last post is probably nicer. As for battery life, I use Conky to generate a status bar using the output of a script which calls upower to tell me how much time is left on the battery (or how much time is left to charge): Code:
upower -i `upower -e | grep battery` | grep time | awk '{
(that's just a quick hack...if your awk-fu is stronger than mine, you can probably shrink it a bit)if($3 == "empty:"){ if($5 == "minutes") printf("Bat: %.1fM | ", $4) else printf("Bat: %.1fH | ", $4) } else{ if($5 == "minutes") printf("Bat: -%.1fM | ", $4) else printf("Bat: -%.1fH | ", $4) } }' Here's my .conkyrc Code:
out_to_console yes
And the relevant line in my .xsession file:out_to_x no background no update_interval 2 total_run_times 0 use_spacer none pad_percents 2 short_units TEXT ${color #8193a6}\ ${execi 10 echo "`/home/brandon/src/scripts/new_mail.sh`"}\ ${execi 10 echo "`/home/brandon/src/scripts/new_news.sh`"}\ ${execi 10 echo "`/home/brandon/src/scripts/battery_status.sh`"}\ ${execi 10 [[ $(nm-online -xq) ]] || echo "[*] | "}\ CPU: $cpubar | \ Mem: $membar | \ ${time %b %d %H:%M} Code:
conky | while read -r; do xsetroot -name "$REPLY"; done &
I think with Awesome you'll instead need to use their widgets and do everything in Lua, but hopefully this info can help a bit.
|
Author: | Aleix Orti [ Mon Dec 03, 2012 6:34 am ] |
Post subject: | Re: Brightness and pm with awesome |
thanks a lot jakobcreutzfeldt, It's all I needed. Now I have to translate it to awesome with lua! thanks again |
Author: | Aleix Orti [ Mon Dec 03, 2012 12:26 pm ] |
Post subject: | Re: Brightness and pm with awesome |
This is my solution for brightness buttons with awesome: First I downloaded bright.c from this threath: http://www.powerdeveloper.org/forums/vi ... f=1&t=2084 (thanks @mchack) I compiled and renamed as setbright and moved to /usr/sbin. Then I added os library to rc.lua by adding require("os") at the top of the file. And, also in rc.lua, inside "globalkeys = awful.util.table.join" I have added: awful.key({ }, "XF86MonBrightnessDown", function () os.execute("sudo setbright -8") end), awful.key({ }, "XF86MonBrightnessUp", function () os.execute("sudo setbright +8") end), to map the buttons with setbright. When my lua skills would be better I tried to translate bright.c to lua ;) Finally, to work without password with sudo I use NOPASSWD: in sudoers file. |
Author: | jakobcreutzfeldt [ Tue Dec 04, 2012 4:30 am ] |
Post subject: | Re: Brightness and pm with awesome |
I also switched to using mchack's C solution since it's nicer. Instead of calling sudo, you can setuid root the binary (which wasn't possible with a script): Code:
$ sudo chmod u+s /usr/bin/setbright
(note that it's in /usr/bin) Then, when you run it, the program will run under root and will have access to the brightness system file.
|
Author: | elmerfudd [ Wed Dec 05, 2012 1:06 pm ] |
Post subject: | Re: Brightness and pm with awesome |
I run awesome on my smartBook and I find the name of the window manager pretty describable of how it's like to use. It has a system tray so you can simply start a power manager applet. I've added the following to the botton of my rc.lua : run_once("gnome-power-manager") But you can just make it start you favorite powermanager. A better solution for autostarting stuff in awesome is adding this: awful.util.spawn("/home/<user>/.config/autostart.sh") And then make an executable autostart.sh script that starts whatever is put in the common wm autostart dir $HOME/.config/autostart: ---------- #!/bin/bash function Run() { prg=$(basename "$1") pgrep -u $USER -x "$prg" || ( "$1" &>/dev/null & ) } while read f do Run "$HOME/.config/autostart/$f" done < <(cd "$HOME/.config/autostart" && ls -1) ---------- All you need then is to symlink in the apps you want to start. |
Author: | Aleix Orti [ Sun Dec 23, 2012 1:21 pm ] |
Post subject: | Re: Brightness and pm with awesome |
This is my first solution to show battery status easely with awesome (it will work with others wm too). I liked a lot xbattbar. This program shows the battery that remains like a thin bar down the screen. Xbattbar use by default apm but It've a option to insert battery values by a script. This is my script (thanks @jakobcreutzfeldt): Code: upower -i `upower -e` | awk '/percentage/ {
I copied it as battery_script in /usr/local/bin/printf("battery=%.2s\n", $2)}' upower -i `upower -e` | awk '/state/ { if ($2=="discharging") printf("ac_line=off\n") else printf("ac_line=on\n") }' Then in rc.lua I bind F6 with "xbattbar -t 1 -p 60 -s /usr/local/bin/battery_script &" to show battery state and, F7 with "pkill xbattbar" to quit battery state. |
Page 1 of 1 | All times are UTC-06:00 |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |