All times are UTC-06:00




Post new topic  Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Fri Nov 30, 2012 8:01 am 
Offline

Joined: Fri Feb 17, 2012 11:02 am
Posts: 18
Location: Cambrils , Ca
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.


Top
   
PostPosted: Fri Nov 30, 2012 9:43 am 
Offline

Joined: Tue Apr 17, 2012 3:15 am
Posts: 44
Location: Barcelona, Spain
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 '{
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)
}
}'
(that's just a quick hack...if your awk-fu is stronger than mine, you can probably shrink it a bit)

Here's my .conkyrc
Code:
out_to_console yes
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}
And the relevant line in my .xsession file:
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.

_________________
http://www.brandoninvergo.com


Top
   
PostPosted: Mon Dec 03, 2012 6:34 am 
Offline

Joined: Fri Feb 17, 2012 11:02 am
Posts: 18
Location: Cambrils , Ca
thanks a lot jakobcreutzfeldt,
It's all I needed. Now I have to translate it to awesome with lua!
thanks again


Top
   
PostPosted: Mon Dec 03, 2012 12:26 pm 
Offline

Joined: Fri Feb 17, 2012 11:02 am
Posts: 18
Location: Cambrils , Ca
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.


Top
   
PostPosted: Tue Dec 04, 2012 4:30 am 
Offline

Joined: Tue Apr 17, 2012 3:15 am
Posts: 44
Location: Barcelona, Spain
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.

_________________
http://www.brandoninvergo.com


Top
   
PostPosted: Wed Dec 05, 2012 1:06 pm 
Offline

Joined: Fri Aug 19, 2011 10:58 am
Posts: 17
Location: Denmark
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.


Top
   
PostPosted: Sun Dec 23, 2012 1:21 pm 
Offline

Joined: Fri Feb 17, 2012 11:02 am
Posts: 18
Location: Cambrils , Ca
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/ {
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") }'
I copied it as battery_script in /usr/local/bin/

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.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 7 posts ] 

All times are UTC-06:00


Who is online

Users browsing this forum: No registered users and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
PowerDeveloper.org: Copyright © 2004-2012, Genesi USA, Inc. The Power Architecture and Power.org wordmarks and the Power and Power.org logos and related marks are trademarks and service marks licensed by Power.org.
All other names and trademarks used are property of their respective owners. Privacy Policy
Powered by phpBB® Forum Software © phpBB Group