i dont know much about lua right now but...
it would probably be optimal to implement this outside awesome as lilydjwg
suggested but if you really want to do this in your rc.lua you are going to
have to change some settings in your sudoers file to allow your user to use
the needed command(s) (see http://toast.djw.org.uk/qemu.html for example).
pasted from(
http://askubuntu.com/questions/17734/is-it-possible-to-setup-a-shortcut-for-enable-disable-wifi
)
#!/bin/bash
if [ $(rfkill list wifi | grep "Soft blocked: yes" | wc -l) -eq 1 ] ; then
rfkill unblock wifi
zenity --info --text "Enabled wireless"
else
rfkill block wifi
zenity --info --text "Disabled wireless"
fi
chmod +x script.sh
then add something like this to your rc.lua
awful.key({modkey }, "p", function() awful.util.spawn(
"location/of/script.sh" ) end),
On Sat, Jul 13, 2013 at 8:20 PM, Raphael Cervantes <
[email protected]> wrote:
> Hi guys,
> I want to have fn+F11 toggle my wifi on and off. I think I should set a
> shortcut in my rc.lua file so that fn+F11 does rfkill block wifi when wifi
> is on and rfkill unblock wifi when it's off. How can I do that? Is there a
> better way to do this besides rfkill. I need sudo permissions to run rfkill
> in a terminal.
>
> -Raphael
>