mirror of
https://github.com/kastdeur/dotfiles.git
synced 2025-06-18 05:06:38 +02:00
Updated mainprofile, removed autoindent in vim. Set up awesome.lua with xinitrc. See if it works
This commit is contained in:
parent
3bbb4d6c9a
commit
cc8ca493c8
15 changed files with 600 additions and 507 deletions
51
awesome/widgets/volume2.lua
Normal file
51
awesome/widgets/volume2.lua
Normal file
|
@ -0,0 +1,51 @@
|
|||
local wibox = require("wibox")
|
||||
local awful = require("awful")
|
||||
|
||||
volume_widget = wibox.widget.textbox()
|
||||
volume_widget:set_align("right")
|
||||
|
||||
function raise_volume()
|
||||
os.execute("amixer sset Master 1%+")
|
||||
end
|
||||
|
||||
function lower_volume ()
|
||||
os.execute("amixer sset Master 1%-")
|
||||
end
|
||||
|
||||
function toggle_volume ()
|
||||
os.execute("amixer sset Master toggle")
|
||||
end
|
||||
|
||||
function update_volume(widget)
|
||||
local fd = io.popen("amixer sget Master")
|
||||
local status = fd:read("*all")
|
||||
fd:close()
|
||||
|
||||
local volume = tonumber(string.match(status, "(%d?%d?%d)%%"))
|
||||
-- volume = string.format("% 3d", volume)
|
||||
|
||||
status = string.match(status, "%[(o[^%]]*)%]")
|
||||
|
||||
-- starting colour
|
||||
local sr, sg, sb = 0x3F, 0x3F, 0x3F
|
||||
-- ending colour
|
||||
local er, eg, eb = 0xDC, 0xDC, 0xCC
|
||||
|
||||
local ir = math.floor(volume/100 * (er - sr) + sr)
|
||||
local ig = math.floor(volume/100 * (eg - sg) + sg)
|
||||
local ib = math.floor(volume/100 * (eb - sb) + sb)
|
||||
interpol_colour = string.format("%.2x%.2x%.2x", sr, ig, sb)
|
||||
if string.find(status, "on", 1, true) then
|
||||
volume = " <span color='blue' background='#" .. interpol_colour .. "'> ".. math.floor(volume) .. "% </span>"
|
||||
else
|
||||
volume = " <span color='red' background='#" .. interpol_colour .. "'> M(".. math.floor(volume) .."%) </span>"
|
||||
end
|
||||
widget:set_markup(volume)
|
||||
end
|
||||
|
||||
|
||||
-- start updating
|
||||
update_volume(volume_widget)
|
||||
mytimer = timer({ timeout = 1 })
|
||||
mytimer:connect_signal("timeout", function () update_volume(volume_widget) end)
|
||||
mytimer:start()
|
Loading…
Add table
Add a link
Reference in a new issue