diff --git a/Xorg/.xprofile b/Xorg/.xprofile index c78235f..73f0462 100644 --- a/Xorg/.xprofile +++ b/Xorg/.xprofile @@ -3,3 +3,4 @@ setxkbmap -option compose:caps xset -b owncloud & +hash xscreensaver && xscreensaver -no-splash & diff --git a/awesome/.config/awesome/battery.lua b/awesome/.config/awesome/battery.lua new file mode 100644 index 0000000..ed6ab19 --- /dev/null +++ b/awesome/.config/awesome/battery.lua @@ -0,0 +1,67 @@ +local naughty = require("naughty") +local beautiful = require("beautiful") +local vicious = require("vicious") +local wibox = require("wibox") +local pairs = pairs + +module("battery") + +-- Battery (based on http://awesome.naquadah.org/wiki/Gigamo_Battery_Widget) +-- Edited by TobiasKappe + +local limits = { {25, 5}, + {12, 3}, + { 7, 1}, + {0}} + +local function getnextlim (num) + for ind, pair in pairs(limits) do + lim = pair[1]; step = pair[2]; nextlim = limits[ind+1][1] or 0 + if num > nextlim then + repeat + lim = lim - step + until num > lim + if lim < nextlim then + lim = nextlim + end + return lim + end + end +end + +function batclosure () + local nextlim = limits[1][1] + return function (_, args) + local prefix = "⚡" + local state, charge = args[1], args[2] + if not charge then return end + + if state == "−" then + dirsign = "↓" + prefix = "Bat:" + if charge <= nextlim then + naughty.notify({ + title = "⚡ Waarschuwing! ⚡", + text = "Accu bijna leeg ( ⚡ " ..charge.."%)!", + timeout = 7, + position = "bottom_right", + fg = beautiful.fg_focus, + bg = beautiful.bg_focus + }) + nextlim = getnextlim(charge) + end + elseif state == "+" then + dirsign = "↑" + nextlim = limits[1][1] + else + return " ⚡ " + end + if dir ~= 0 then charge = charge.."%" end + return " "..prefix.." "..dirsign..charge..dirsign.." " + end +end + +local widget = wibox.widget.textbox() +vicious.register(widget, vicious.widgets.bat, batclosure(), 31, "BAT0") + +return widget diff --git a/awesome/.config/awesome/rc.lua b/awesome/.config/awesome/rc.lua index 42689c3..69099be 100644 --- a/awesome/.config/awesome/rc.lua +++ b/awesome/.config/awesome/rc.lua @@ -58,7 +58,7 @@ local layouts = awful.layout.suit.spiral, awful.layout.suit.floating, awful.layout.suit.tile, - awful.layout.suit.fair, + awful.layout.suit.fair.horizontal, awful.layout.suit.max, awful.layout.suit.magnifier } @@ -184,10 +184,17 @@ for s = 1, screen.count() do -- Widgets that are aligned to the right local right_layout = wibox.layout.fixed.horizontal() - if s == 1 then right_layout:add(wibox.widget.systray()) end + if s == 1 then + right_layout:add(wibox.widget.systray()) + end + + local battery = require("battery") + right_layout:add(mytextclock) + right_layout:add(battery) right_layout:add(mylayoutbox[s]) + -- Now bring it all together (with the tasklist in the middle) local layout = wibox.layout.align.horizontal() layout:set_left(left_layout) @@ -267,7 +274,13 @@ globalkeys = awful.util.table.join( awful.util.getdir("cache") .. "/history_eval") end), -- Menubar - awful.key({ modkey }, "p", function() menubar.show() end) + awful.key({ modkey }, "p", function() menubar.show() end), + + -- Backlight control + awful.key({ }, "XF86MonBrightnessDown", function () + awful.util.spawn("xbacklight -dec 15") end), + awful.key({ }, "XF86MonBrightnessUp", function () + awful.util.spawn("xbacklight -inc 15") end) ) clientkeys = awful.util.table.join(