More cleanup
This commit is contained in:
@ -1,4 +1,7 @@
|
||||
return {
|
||||
-- When everything is ready, call core.start()
|
||||
start = require("core.start")
|
||||
start = require("core.start"),
|
||||
|
||||
-- Utilities
|
||||
sound = require("core.sound")
|
||||
}
|
||||
|
@ -1,51 +0,0 @@
|
||||
local shortcuts = {}
|
||||
|
||||
function shortcuts:new(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 shortcuts
|
22
core/sound.lua
Normal file
22
core/sound.lua
Normal file
@ -0,0 +1,22 @@
|
||||
local sound = {}
|
||||
|
||||
sound.counter = 0
|
||||
|
||||
sound.play = function(sound_key)
|
||||
if (beautiful.sounds[sound_key] == nil) then
|
||||
naughty.notify({
|
||||
title = "Sound play error:",
|
||||
text = "There is no sound with key " .. sound_key
|
||||
})
|
||||
else
|
||||
if (sound.counter > 5) then
|
||||
return
|
||||
end
|
||||
sound.counter = sound.counter + 1
|
||||
awful.spawn.easy_async("play -q \"" .. beautiful.sounds[sound_key] .. "\"", function()
|
||||
sound.counter = sound.counter - 1
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
return sound
|
@ -2,11 +2,11 @@ local function start()
|
||||
local desktop = {
|
||||
widgets = {
|
||||
tasklist = require("core.tasklist"),
|
||||
textclock = require("core.textclock"),
|
||||
textclock = modules.simple_widgets.textclock,
|
||||
keymap = modules.ibus.widgets.ibus,
|
||||
volume = modules.volume.widgets.volume,
|
||||
launcher = modules.launcher.widgets.launcher,
|
||||
shortcut = require("core.shortcut"),
|
||||
shortcut = modules.simple_widgets.make_shortcut,
|
||||
|
||||
space = function(size)
|
||||
return wibox.widget {
|
||||
@ -141,7 +141,7 @@ local function start()
|
||||
desktop.widgets.space(6)
|
||||
}
|
||||
for k, v in pairs(conf.bar_shortcuts) do
|
||||
s.shortcuts[#s.shortcuts + 1] = desktop.widgets.shortcut:new(v[1], v[2])
|
||||
s.shortcuts[#s.shortcuts + 1] = desktop.widgets.shortcut(v[1], v[2])
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,48 +0,0 @@
|
||||
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.widget
|
Reference in New Issue
Block a user