Initial Commit

This commit is contained in:
2021-04-26 11:20:41 +03:00
commit 5a99cb9e82
125 changed files with 6148 additions and 0 deletions

50
widget/volume.lua Normal file
View File

@@ -0,0 +1,50 @@
local awful = require("awful")
local wibox = require('wibox')
local mat_list_item = require('widget.material.list-item')
local dpi = require('beautiful').xresources.apply_dpi
local watch = require('awful.widget.watch')
local beautiful = require('beautiful')
local volume_icon = wibox.widget.textbox()
volume_icon.font = beautiful.icon_font
local volume_widget = wibox.widget.textbox()
volume_widget.align = 'center'
volume_widget.valign = 'center'
volume_widget.font = beautiful.font
local volume
function update_volume()
awful.spawn.easy_async_with_shell("bash -c 'amixer -D pulse sget Master'", function(stdout)
volume = string.match(stdout, '(%d?%d?%d)%%')
awful.spawn.easy_async_with_shell("bash -c 'pacmd list-sinks | awk '/muted/ { print $2 }''", function(muted)
muted = string.gsub(muted, "%s+", "")
if muted == 'muted:no' and (volume > '50' or volume == '100') then
volume_icon.text = ''
elseif muted == 'muted:no' and volume <= '50' and volume > '0' then
volume_icon.text = '奔'
elseif muted == 'muted:yes' then
volume_icon.text = ''
elseif volume == '0' then
volume_icon.text = ''
end
volume_widget.text = volume
end)
collectgarbage('collect')
end)
end
watch('bash -c', 3, function(_, stdout)
update_volume()
end)
return wibox.widget {
wibox.widget{
volume_icon,
fg = beautiful.accent.hue_100,
widget = wibox.container.background
},
volume_widget,
spacing = dpi(2),
layout = wibox.layout.fixed.horizontal
}