]>
git.madduck.net Git - etc/awesome.git/blobdiff - widgets/alsabar.lua
madduck's git repository
Every one of the projects in this repository is available at the canonical
URL git://git.madduck.net/madduck/pub/<projectpath> — see
each project's metadata for the exact URL.
All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@ git. madduck. net .
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
SSH access, as well as push access can be individually
arranged .
If you use my repositories frequently, consider adding the following
snippet to ~/.gitconfig and using the third clone URL listed for each
project:
[url "git://git.madduck.net/madduck/"]
insteadOf = madduck:
+local newtimer = require("lain.helpers").newtimer
+
local awful = require("awful")
local beautiful = require("beautiful")
local naughty = require("naughty")
local awful = require("awful")
local beautiful = require("beautiful")
local naughty = require("naughty")
+ terminal = terminal or "xterm",
mixer = terminal .. " -e alsamixer",
notifications =
{
font = beautiful.font:sub(beautiful.font:find(""), beautiful.font:find(" ")),
font_size = "11",
mixer = terminal .. " -e alsamixer",
notifications =
{
font = beautiful.font:sub(beautiful.font:find(""), beautiful.font:find(" ")),
font_size = "11",
+ color = beautiful.fg_focus,
bar_size = 18 -- Awesome default
},
bar_size = 18 -- Awesome default
},
local preset =
{
title = "", text = "",
local preset =
{
title = "", text = "",
font = alsabar.notifications.font .. " " .. alsabar.notifications.font_size,
font = alsabar.notifications.font .. " " .. alsabar.notifications.font_size,
- fg = beautiful.fg_focus
+ fg = alsabar.notifications.color
+local function worker(args)
local args = args or {}
local width = args.width or 63
local height = args.heigth or 1
local args = args or {}
local width = args.width or 63
local height = args.heigth or 1
alsabar.notifications = args.notifications or alsabar.notifications
alsabar.bar = awful.widget.progressbar()
alsabar.notifications = args.notifications or alsabar.notifications
alsabar.bar = awful.widget.progressbar()
alsabar.bar:set_background_color(alsabar.colors.background)
alsabar.bar:set_color(alsabar.colors.unmute)
alsabar.tooltip = awful.tooltip({ objects = { alsabar.bar } })
alsabar.bar:set_background_color(alsabar.colors.background)
alsabar.bar:set_color(alsabar.colors.unmute)
alsabar.tooltip = awful.tooltip({ objects = { alsabar.bar } })
alsabar.bar:set_vertical(true)
end
alsabar.bar:set_vertical(true)
end
- local myvolumebarupdate = function ()
-- Get mixer control contents
local f = io.popen("amixer get " .. alsabar.channel)
local mixer = f:read("*all")
f:close()
-- Capture mixer control state: [5%] ... ... [on]
-- Get mixer control contents
local f = io.popen("amixer get " .. alsabar.channel)
local mixer = f:read("*all")
f:close()
-- Capture mixer control state: [5%] ... ... [on]
- local volu, mute = string.match(mixer, "([%d]+)%%.*%[([%l]*)")
- -- Handle mixers without data
+ local volu, mute = string.match(mixer, "([%d]+)%%.*%[([%l]*)")
+
- volu = 0
- mute = "off"
+ volu = 0
+ mute = "off"
end
alsabar._current_level = tonumber(volu) / 100
end
alsabar._current_level = tonumber(volu) / 100
- local myvolumebartimer = timer({ timeout = 5 })
- myvolumebartimer:connect_signal("timeout", myvolumebarupdate)
- myvolumebartimer:start()
- myvolumebartimer:emit_signal("timeout")
+ newtimer("alsabar", 5, update)
alsabar.bar:buttons (awful.util.table.join (
awful.button ({}, 1, function()
alsabar.bar:buttons (awful.util.table.join (
awful.button ({}, 1, function()
- return { widget = alsabar.bar,
- channel = alsabar.channel,
- step = alsabar.step,
- notify = function()
- myvolumebarupdate()
- alsabar.notify()
- end
- }
+ return {
+ widget = alsabar.bar,
+ channel = alsabar.channel,
+ step = alsabar.step,
+ notify = function()
+ update()
+ alsabar.notify()
+ end
+ }
end
return setmetatable(alsabar, { __call = function(_, ...) return worker(...) end })
end
return setmetatable(alsabar, { __call = function(_, ...) return worker(...) end })