From 87bbcfa410bb60d9e3418f70b3cf129190148768 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Mon, 10 Oct 2011 21:14:30 +0200 Subject: awesome: Use UPower's dbus interface for suspend Also introduces cmds stores in cmds.lua --- .config/awesome/awesome.lua | 6 ++++-- .config/awesome/cmds.lua | 12 ++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 .config/awesome/cmds.lua (limited to '.config/awesome') diff --git a/.config/awesome/awesome.lua b/.config/awesome/awesome.lua index 391aab3..3593d23 100644 --- a/.config/awesome/awesome.lua +++ b/.config/awesome/awesome.lua @@ -17,6 +17,8 @@ beautiful.init(os.getenv("HOME") .. "/.local/share/awesome/themes/zenburn/theme. local runonce = require("runonce") +local cmd = require("cmds") + runonce.run("urxvtd -q -o -f") runonce.run("start-pulseaudio-x11") runonce.run("synergys") @@ -227,8 +229,8 @@ globalkeys = awful.util.table.join( awful.key({ }, "Print", function () awful.util.spawn("scrot") end), awful.key({ modkey, }, "Print", function () awful.util.spawn("scrot -s") end), - awful.key({ }, "XF86Suspend", function () awful.util.spawn("sudo pm-suspend") end), - awful.key({ }, "XF86Sleep", function () awful.util.spawn("sudo pm-suspend") end), + awful.key({ }, "XF86Suspend", function () awful.util.spawn(cmd.suspend) end), + awful.key({ }, "XF86Sleep", function () awful.util.spawn(cmd.suspend) end), awful.key({ }, "XF86MonBrightnessUp", function () awful.util.spawn("sudo brightness up") end), awful.key({ }, "XF86MonBrightnessDown", function () awful.util.spawn("sudo brightness down") end), awful.key({}, "XF86TouchpadToggle", function () awful.util.spawn(os.getenv("HOME") .. "/.scripts/toggle_touchpad.sh") end), diff --git a/.config/awesome/cmds.lua b/.config/awesome/cmds.lua new file mode 100644 index 0000000..713f807 --- /dev/null +++ b/.config/awesome/cmds.lua @@ -0,0 +1,12 @@ +module("eminent") + +local upower = "dbus-send --system --print-reply " .. + "--dest=org.freedesktop.UPower " .. + "/org/freedesktop/UPower " + +local cmds = { + suspend = upower .. "org.freedesktop.UPower.Suspend", + hibernate = upower .. "org.freedesktop.UPower.Hibernate", +} + +return cmds -- cgit