Add volume to systray
This commit is contained in:
@@ -118,7 +118,10 @@ menubar.utils.terminal = terminal -- Set the terminal for applications that requ
|
||||
|
||||
-- Keyboard map indicator and switcher
|
||||
mykeyboardlayout = awful.widget.keyboardlayout()
|
||||
|
||||
-- Volume
|
||||
volumewidget = wibox.widget.textbox(awful.spawn.easy_async("pamixer --sink 0 --get-volume",function(stdout, stderr, reason, exit_code)
|
||||
volumewidget:set_text(" 🔈:"..stdout)
|
||||
end))
|
||||
-- Battery
|
||||
batterywidget = wibox.widget.textbox()
|
||||
-- {{{ Wibar
|
||||
@@ -163,6 +166,7 @@ mykeyboardlayout:connect_signal("button::release",
|
||||
end)
|
||||
|
||||
-- }}}
|
||||
|
||||
-- Create a wibox for each screen and add it
|
||||
local taglist_buttons = gears.table.join(
|
||||
awful.button({ }, 1, function(t) t:view_only() end),
|
||||
@@ -262,6 +266,7 @@ awful.screen.connect_for_each_screen(function(s)
|
||||
mykeyboardlayout,
|
||||
wibox.widget.systray(),
|
||||
mytextclock,
|
||||
volumewidget,
|
||||
batterywidget,
|
||||
s.mylayoutbox,
|
||||
},
|
||||
@@ -375,6 +380,14 @@ globalkeys = gears.table.join(
|
||||
awful.util.spawn("pamixer --sink 0 -t", false)
|
||||
awful.spawn.easy_async("pamixer --sink 0 --get-mute", function(stdout, stderr, reason, exit_code)
|
||||
naughty.notify {title = "mute", text = stdout, timeout = 0.5}
|
||||
if string.match(stdout, "true" ) then
|
||||
volumewidget:set_text(" 🔇 ")
|
||||
else
|
||||
awful.spawn.easy_async("pamixer --sink 0 --get-volume", function(stdout, stderr, reason, exit_code)
|
||||
volumewidget:set_text(" 🔈:"..stdout)
|
||||
naughty.notify {title = "Inc", text = stdout, timeout = 0.5}
|
||||
end)
|
||||
end
|
||||
end)
|
||||
end),
|
||||
awful.key({ }, "XF86AudioMicMute",
|
||||
@@ -387,12 +400,15 @@ globalkeys = gears.table.join(
|
||||
awful.key({ }, "XF86AudioLowerVolume",
|
||||
function ()
|
||||
awful.spawn.easy_async("pamixer --sink 0 -d 5 --get-volume", function(stdout, stderr, reason, exit_code)
|
||||
volumewidget:set_text(" 🔈:"..stdout)
|
||||
naughty.notify {title = "Inc", text = stdout, timeout = 0.5}
|
||||
end)
|
||||
end),
|
||||
awful.key({ }, "XF86AudioRaiseVolume",
|
||||
function ()
|
||||
awful.spawn.easy_async("pamixer --sink 0 -i 5 --get-volume", function(stdout, stderr, reason, exit_code)
|
||||
volumewidget:set_text(" 🔈:"..stdout)
|
||||
|
||||
naughty.notify {title = "Dec", text = stdout, timeout = 0.5}
|
||||
end)
|
||||
end),
|
||||
|
||||
Reference in New Issue
Block a user