36 lines
924 B
Lua
36 lines
924 B
Lua
-- Special thanks to JavaCafe01
|
|
|
|
local awful = require("awful")
|
|
local gears = require("gears")
|
|
local beautiful = require("beautiful")
|
|
local xresources = require("beautiful.xresources")
|
|
local dpi = xresources.apply_dpi
|
|
local wibox = require("wibox")
|
|
local naughty = require("naughty")
|
|
|
|
local helpers = {}
|
|
|
|
function helpers.volume_control(step)
|
|
local cmd
|
|
if step == 0 then
|
|
cmd = "pactl set-sink-mute @DEFAULT_SINK@ toggle"
|
|
else
|
|
sign = step > 0 and "+" or ""
|
|
cmd =
|
|
"pactl set-sink-mute @DEFAULT_SINK@ 0 && pactl set-sink-volume @DEFAULT_SINK@ " ..
|
|
sign .. tostring(step) .. "%"
|
|
end
|
|
awful.spawn.with_shell(cmd)
|
|
end
|
|
|
|
function helpers.colorize_text(txt)
|
|
return "<span>" .. txt .. "</span>"
|
|
end
|
|
|
|
helpers.rrect = function(radius)
|
|
return function(cr, width, height)
|
|
gears.shape.rounded_rect(cr, width, height, radius)
|
|
end
|
|
end
|
|
|
|
return helpers |