From 3138ff48e380dae9e8326a3b7199c4508b8d85b6 Mon Sep 17 00:00:00 2001 From: Simonas Narbutas Date: Fri, 18 Jan 2019 13:16:39 +0100 Subject: [PATCH] Add volume to systray --- .../.config/awesome/rc.lua##Linux.epiphanius | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/.yadm/alt/.config/awesome/rc.lua##Linux.epiphanius b/.yadm/alt/.config/awesome/rc.lua##Linux.epiphanius index a4307f7..9aac96a 100644 --- a/.yadm/alt/.config/awesome/rc.lua##Linux.epiphanius +++ b/.yadm/alt/.config/awesome/rc.lua##Linux.epiphanius @@ -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, }, @@ -374,7 +379,15 @@ globalkeys = gears.table.join( function () 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} + 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),