diff options
| author | Reiner Herrmann <reiner@reiner-h.de> | 2014-11-16 11:42:18 +0100 |
|---|---|---|
| committer | Reiner Herrmann <reiner@reiner-h.de> | 2014-11-16 11:49:25 +0100 |
| commit | 5cae9b28d9c28cce69ee796fb82a19df805d5dd8 (patch) | |
| tree | dc7e1a404f4bff2bd9b7928e735f9126116b2f13 /awesome/rc.lua | |
| parent | 53194c74d56f71ee5317c2a16dffad5c35e12d60 (diff) | |
awesome: added customizations to rc.lua
- different default layout
- simpler time display
- added AC/battery and CPU widgets
- added some keyboard shortcuts
- changed prompt to use dmenu
- made mpv window floating
Diffstat (limited to 'awesome/rc.lua')
| -rw-r--r-- | awesome/rc.lua | 76 |
1 files changed, 70 insertions, 6 deletions
diff --git a/awesome/rc.lua b/awesome/rc.lua index 790a580..d2d2b65 100644 --- a/awesome/rc.lua +++ b/awesome/rc.lua @@ -7,6 +7,8 @@ require("beautiful") -- Notification library require("naughty") +require("vicious") + -- Load Debian menu entries require("debian.menu") @@ -37,7 +39,7 @@ end -- {{{ Variable definitions -- Themes define colours, icons, and wallpapers -beautiful.init("/usr/share/awesome/themes/default/theme.lua") +beautiful.init("/home/reiner/.config/awesome/theme.lua") -- This is used later as the default terminal and editor to run. terminal = "x-terminal-emulator" @@ -54,7 +56,6 @@ modkey = "Mod4" -- Table of layouts to cover with awful.layout.inc, order matters. layouts = { - awful.layout.suit.floating, awful.layout.suit.tile, awful.layout.suit.tile.left, awful.layout.suit.tile.bottom, @@ -65,7 +66,8 @@ layouts = awful.layout.suit.spiral.dwindle, awful.layout.suit.max, awful.layout.suit.max.fullscreen, - awful.layout.suit.magnifier + awful.layout.suit.magnifier, + awful.layout.suit.floating } -- }}} @@ -99,7 +101,47 @@ mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon), -- {{{ Wibox -- Create a textclock widget -mytextclock = awful.widget.textclock({ align = "right" }) +mytextclock = awful.widget.textclock({ align = "right" }, ' %H:%M ') + +acwidget = widget({ type = 'imagebox' }) +acwidget.image = image("/home/reiner/.config/awesome/power-ac.png") +acwidget.visible = true + +for bat = 0, 1 do + local batpath = '/sys/class/power_supply/BAT' .. bat + local batexists = io.open(batpath) + if batexists~=nil then + io.close(batexists) + batwidget = widget({ type = 'textbox', name = 'batwidget', align = 'right' }) + function batstate() + local fcur = io.open(batpath .. '/charge_now') + if not fcur then fcur = io.open(batpath .. '/energy_now') end + local ffull = io.open(batpath .. '/charge_full') + if not ffull then ffull = io.open(batpath .. '/energy_full') end + local acstate = io.open('/sys/class/power_supply/AC0/online') + if not acstate then acstate = io.open('/sys/class/power_supply/ACAD/online') end + + local cur = fcur:read() + local full = ffull:read() + local ac = acstate:read() + fcur:close() + ffull:close() + acstate:close() + + if ac:match("1") then + acwidget.visible = true + elseif ac:match("0") then + acwidget.visible = false + end + local battery = math.floor(cur*100/full) + return {battery} + end + vicious.register(batwidget, batstate, ' Bat:$1% ', 60) + end +end + +cpuwidget = widget({ type = 'textbox', name = 'cpuwidget', align = 'right' }) +vicious.register(cpuwidget, vicious.widgets.cpu, ' CPU:$2%/$3%/$4%/$5% ', 2) -- Create a systray mysystray = widget({ type = "systray" }) @@ -178,9 +220,12 @@ for s = 1, screen.count() do mypromptbox[s], layout = awful.widget.layout.horizontal.leftright }, - mylayoutbox[s], mytextclock, s == 1 and mysystray or nil, + mylayoutbox[s], + acwidget, + batwidget, + cpuwidget, mytasklist[s], layout = awful.widget.layout.horizontal.rightleft } @@ -229,6 +274,8 @@ globalkeys = awful.util.table.join( -- Standard program awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end), + awful.key({ modkey, }, "c", function () awful.util.spawn("/home/reiner/Apps/bin/osdcal.sh") end), + awful.key({ modkey, "Mod1" }, "l", nil, function () awful.util.spawn("xtrlock") end), awful.key({ modkey, "Control" }, "r", awesome.restart), awful.key({ modkey, "Shift" }, "q", awesome.quit), @@ -243,8 +290,23 @@ globalkeys = awful.util.table.join( awful.key({ modkey, "Control" }, "n", awful.client.restore), + -- Hotkeys + awful.key({}, "XF86AudioMute", function () awful.util.spawn('amixer -q -c 1 set Master toggle') end), + awful.key({}, "XF86AudioLowerVolume", function () awful.util.spawn('amixer -q -c 1 set Master 5dB-') end), + awful.key({}, "XF86AudioRaiseVolume", function () awful.util.spawn('amixer -q -c 1 set Master 5dB+') end), + --awful.key({}, "XF86Sleep", function () awful.util.spawn('xtrlock &') end), + --awful.key({}, "XF86WebCam", function () awful.util.spawn('') end), + --awful.key({}, "XF86WLAN", function () awful.util.spawn('') end), + --awful.key({}, "XF86Display", function () awful.util.spawn('') end), + --awful.key({}, "XF86AudioPrev", function () awful.util.spawn('') end), + --awful.key({}, "XF86AudioPlay", function () awful.util.spawn('') end), + --awful.key({}, "XF86AudioNext", function () awful.util.spawn('') end), + -- Prompt - awful.key({ modkey }, "r", function () mypromptbox[mouse.screen]:run() end), + -- awful.key({ modkey }, "r", function () mypromptbox[mouse.screen]:run() end), + awful.key({ modkey }, "r", function () + awful.util.spawn("dmenu_run -i -p 'Run command:' -nb '" .. beautiful.bg_normal .. "' -nf '" .. beautiful.fg_normal .. "' -sb '" .. beautiful.bg_focus .. "' -sf '" .. beautiful.fg_focus .. "'") + end), awful.key({ modkey }, "x", function () @@ -335,6 +397,8 @@ awful.rules.rules = { buttons = clientbuttons } }, { rule = { class = "MPlayer" }, properties = { floating = true } }, + { rule = { class = "mpv" }, + properties = { floating = true } }, { rule = { class = "pinentry" }, properties = { floating = true } }, { rule = { class = "gimp" }, |
