More cleanup

This commit is contained in:
2022-07-16 17:18:27 -07:00
parent f25ff7f8c2
commit 7d1a0b6155
8 changed files with 18 additions and 16 deletions

View File

@ -0,0 +1,4 @@
return {
textclock = require("modules.simple_widgets.textclock").widget,
make_shortcut = require("modules.simple_widgets.shortcut")
}

View File

@ -0,0 +1,49 @@
local function make_shortcut(command, icon)
local widget = wibox.widget {
{
{ -- Right space
widget = wibox.widget.separator,
color = beautiful.color.transparent,
forced_width = beautiful.dpi(3)
},
{
wibox.widget {
resize = true,
image = conf.app_icon_dir .. icon,
widget = wibox.widget.imagebox
},
top = beautiful.dpi(3),
bottom = beautiful.dpi(3),
layout = wibox.container.margin,
},
{ -- Left space
widget = wibox.widget.separator,
color = beautiful.color.transparent,
forced_width = beautiful.dpi(3)
},
layout = wibox.layout.align.horizontal,
},
layout = wibox.container.background
}
widget:connect_signal("mouse::enter", function(result)
result.bg = beautiful.color.bar.hover_bg
end)
widget:connect_signal("mouse::leave", function(result)
result.bg = beautiful.color.transparent
end)
widget:connect_signal("button::press",
function(_, _, _, button, mods)
if (button == 1) then
awful.spawn(command, false)
end
end
)
return widget
end
return make_shortcut

View File

@ -0,0 +1,46 @@
local textclock = {}
textclock.widget = wibox.widget {
{
{ -- Right spacer
widget = wibox.widget.separator,
color = beautiful.color.transparent,
forced_width = beautiful.dpi(3)
},
wibox.widget {
wibox.widget.textclock("%m/%d"),
wibox.widget.textclock("%I:%M", 60),
-- Long format:
-- wibox.widget.textclock("%m/%d/%y"),
-- wibox.widget.textclock("%I:%M:%S", 1),
-- %H - 24-hour time
-- %I - 12-hour time
forced_num_cols = 1,
forced_num_rows = 2,
homogeneous = true,
expand = true,
layout = wibox.layout.grid
},
{ -- Left spacer
widget = wibox.widget.separator,
color = beautiful.color.transparent,
forced_width = beautiful.dpi(3)
},
layout = wibox.layout.align.horizontal,
},
layout = wibox.container.background,
}
-- Change background when mouse is over widget
textclock.widget:connect_signal("mouse::enter", function(result)
textclock.widget.bg = beautiful.color.bar.hover_bg
end)
textclock.widget:connect_signal("mouse::leave", function(result)
textclock.widget.bg = beautiful.color.transparent
end)
return textclock

View File

@ -81,7 +81,7 @@ volume.volume_up = function()
end
volume.commands:up()
Sound.play("volume_up")
core.sound.play("volume_up")
volume.exec_hooks()
end
@ -92,7 +92,7 @@ volume.volume_down = function()
end
volume.commands:down()
Sound.play("volume_down")
core.sound.play("volume_down")
volume.exec_hooks()
end