1
0
mirror of https://github.com/bertptrs/vimconfig.git synced 2025-12-25 20:40:32 +01:00

Better Awesome config.

This commit is contained in:
Bert Peters
2016-12-27 19:10:19 +01:00
parent 0e57e08dee
commit 767a92fd7b
3 changed files with 84 additions and 3 deletions

View File

@@ -3,3 +3,4 @@ setxkbmap -option compose:caps
xset -b
owncloud &
hash xscreensaver && xscreensaver -no-splash &

View File

@@ -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

View File

@@ -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(