a lot of stuff
This commit is contained in:
@@ -10,28 +10,28 @@ local gears = require("gears")
|
||||
local dpi = require("beautiful").xresources.apply_dpi
|
||||
local color = require("theme.crylia.colors")
|
||||
|
||||
return function (s)
|
||||
return function(s)
|
||||
local styles = {}
|
||||
|
||||
styles.month = {
|
||||
styles.month = {
|
||||
padding = 15,
|
||||
bg_color = color.color["Grey900"],
|
||||
border_width = 1,
|
||||
shape = function (cr, width, height)
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end
|
||||
}
|
||||
styles.normal = {
|
||||
fg_color = color.color["Grey900"],
|
||||
font = "JetBrainsMonoExtraBold NF",
|
||||
shape = function (cr, width, height)
|
||||
font = user_vars.vars.font.extrabold,
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end
|
||||
}
|
||||
styles.focus = {
|
||||
styles.focus = {
|
||||
fg_color = color.color["Grey900"],
|
||||
bg_color = color.color["Purple200"],
|
||||
shape = function (cr, width, height)
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end
|
||||
}
|
||||
@@ -39,7 +39,7 @@ return function (s)
|
||||
fg_color = color.color["Grey900"],
|
||||
bg_color = color.color["Teal200"],
|
||||
markup = function(t) return '<b>' .. t .. '</b>' end,
|
||||
shape = function (cr, width, height)
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end
|
||||
}
|
||||
@@ -48,12 +48,12 @@ return function (s)
|
||||
fg_color = color.color["Grey900"],
|
||||
bg_color = color.color["Teal200"],
|
||||
markup = function(t) return '<b>' .. t .. '</b>' end,
|
||||
shape = function (cr, width, height)
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end
|
||||
}
|
||||
local function decorate_cell(widget, flag, date)
|
||||
if flag=='monthheader' and not styles.monthheader then
|
||||
if flag == 'monthheader' and not styles.monthheader then
|
||||
flag = 'header'
|
||||
end
|
||||
local props = styles[flag] or {}
|
||||
@@ -61,19 +61,19 @@ return function (s)
|
||||
widget:set_markup(props.markup(widget:get_text()))
|
||||
end
|
||||
-- Change bg color for weekends
|
||||
local d = {year=date.year, month=(date.month or 1), day=(date.day or 1)}
|
||||
local d = { year = date.year, month = (date.month or 1), day = (date.day or 1) }
|
||||
local weekday = tonumber(os.date('%w', os.time(d)))
|
||||
local default_bg = (weekday == 0 or weekday == 6) and color.color["Red200"] or color.color["White"]
|
||||
local ret = wibox.widget {
|
||||
{
|
||||
widget,
|
||||
left = dpi(8),
|
||||
right = dpi(8),
|
||||
top = dpi(4),
|
||||
left = dpi(8),
|
||||
right = dpi(8),
|
||||
top = dpi(4),
|
||||
bottom = dpi(4),
|
||||
widget = wibox.container.margin
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
shape = function (cr, width, height)
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end,
|
||||
fg = props.fg_color or '#999999',
|
||||
@@ -82,15 +82,16 @@ return function (s)
|
||||
}
|
||||
return ret
|
||||
end
|
||||
|
||||
local calendar = wibox.widget {
|
||||
date = os.date('*t'),
|
||||
fn_embed = decorate_cell,
|
||||
widget = wibox.widget.calendar.month,
|
||||
font = "JetBrainsMonoExtraBold NF",
|
||||
font = user_vars.vars.font.extrabold,
|
||||
spacing = dpi(10)
|
||||
}
|
||||
|
||||
local calendar_osd_widget = wibox.widget{
|
||||
local calendar_osd_widget = wibox.widget {
|
||||
{
|
||||
widget = wibox.widget.textbox,
|
||||
fg = "#ffffff",
|
||||
@@ -106,7 +107,7 @@ return function (s)
|
||||
layout = wibox.layout.fixed.vertical
|
||||
}
|
||||
|
||||
local set_clock = function ()
|
||||
local set_clock = function()
|
||||
calendar_osd_widget.digital_clock:set_text(os.date("%H:%M"))
|
||||
end
|
||||
|
||||
@@ -114,40 +115,40 @@ return function (s)
|
||||
timeout = 5,
|
||||
autostart = true,
|
||||
call_now = true,
|
||||
callback = function ()
|
||||
callback = function()
|
||||
set_clock()
|
||||
end
|
||||
}
|
||||
|
||||
local calendar_osd_container = awful.popup{
|
||||
local calendar_osd_container = awful.popup {
|
||||
screen = s,
|
||||
widget = wibox.container.background,
|
||||
ontop = true,
|
||||
bg = color.color["Grey900"],
|
||||
stretch = false,
|
||||
visible = false,
|
||||
placement = function (c)awful.placement.top_right(c, {margins = {right = dpi(100),top = dpi(60)}})end,
|
||||
shape = function (cr, width, height)
|
||||
placement = function(c) awful.placement.top_right(c, { margins = { right = dpi(100), top = dpi(60) } }) end,
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end
|
||||
}
|
||||
|
||||
local hide_osd = gears.timer{
|
||||
local hide_osd = gears.timer {
|
||||
timeout = 0.25,
|
||||
autostart = true,
|
||||
callback = function ()
|
||||
callback = function()
|
||||
calendar_osd_container.visible = false
|
||||
end
|
||||
}
|
||||
|
||||
calendar_osd_container:setup{
|
||||
calendar_osd_container:setup {
|
||||
calendar_osd_widget,
|
||||
layout = wibox.layout.align.horizontal
|
||||
}
|
||||
|
||||
calendar_osd_container:connect_signal(
|
||||
"mouse::enter",
|
||||
function ()
|
||||
function()
|
||||
calendar_osd_container.visible = true
|
||||
hide_osd:stop()
|
||||
end
|
||||
@@ -155,7 +156,7 @@ return function (s)
|
||||
|
||||
calendar_osd_container:connect_signal(
|
||||
"mouse::leave",
|
||||
function ()
|
||||
function()
|
||||
calendar_osd_container.visible = false
|
||||
hide_osd:stop()
|
||||
end
|
||||
@@ -163,7 +164,7 @@ return function (s)
|
||||
|
||||
awesome.connect_signal(
|
||||
"widget::calendar_osd:stop",
|
||||
function ()
|
||||
function()
|
||||
calendar_osd_container.visible = true
|
||||
hide_osd:stop()
|
||||
end
|
||||
@@ -171,7 +172,7 @@ return function (s)
|
||||
|
||||
awesome.connect_signal(
|
||||
"widget::calendar_osd:rerun",
|
||||
function ()
|
||||
function()
|
||||
if hide_osd.started then
|
||||
hide_osd:again()
|
||||
else
|
||||
|
||||
@@ -13,15 +13,15 @@ require("main.signals")
|
||||
-- Icon directory path
|
||||
local icondir = awful.util.getdir("config") .. "theme/crylia/assets/icons/powermenu/"
|
||||
|
||||
return function (s)
|
||||
return function(s)
|
||||
|
||||
-- Profile picture imagebox
|
||||
local profile_picture = wibox.widget {
|
||||
image = icondir .. "defaultpfp.svg",
|
||||
resize = true,
|
||||
forced_height = dpi(200),
|
||||
clip_shape = function (cr, width, height)
|
||||
gears.shape.rounded_rect(cr, dpi(width), dpi(height), 30)
|
||||
clip_shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 30)
|
||||
end,
|
||||
widget = wibox.widget.imagebox
|
||||
}
|
||||
@@ -38,7 +38,7 @@ return function (s)
|
||||
-- Get the profile script from /var/lib/AccountsService/icons/${USER}
|
||||
-- and copy it to the assets folder
|
||||
-- TODO: If the user doesnt have AccountsService look into $HOME/.faces
|
||||
local update_profile_picture = function ()
|
||||
local update_profile_picture = function()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[=[
|
||||
iconPath="/var/lib/AccountsService/icons/${USER}"
|
||||
@@ -65,7 +65,7 @@ return function (s)
|
||||
fi
|
||||
fi
|
||||
]=],
|
||||
function (stdout)
|
||||
function(stdout)
|
||||
if stdout then
|
||||
profile_picture:set_image(stdout:gsub("\n", ""))
|
||||
else
|
||||
@@ -107,7 +107,7 @@ return function (s)
|
||||
|
||||
-- Universal Button widget
|
||||
local button = function(name, icon, bg_color, callback)
|
||||
local item = wibox.widget{
|
||||
local item = wibox.widget {
|
||||
{
|
||||
{
|
||||
{
|
||||
@@ -141,7 +141,7 @@ return function (s)
|
||||
},
|
||||
fg = color.color["Grey900"],
|
||||
bg = bg_color,
|
||||
shape = function (cr, width, height)
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 10)
|
||||
end,
|
||||
widget = wibox.container.background,
|
||||
@@ -194,11 +194,11 @@ return function (s)
|
||||
local lock_button = button("Lock", icondir .. "lock.svg", color.color["Orange200"], lock_command)
|
||||
|
||||
-- Signals to change color on hover
|
||||
hover_signal(shutdown_button.background, color.color["Blue200"])
|
||||
hover_signal(reboot_button.background, color.color["Red200"])
|
||||
hover_signal(suspend_button.background, color.color["Yellow200"])
|
||||
hover_signal(logout_button.background, color.color["Green200"])
|
||||
hover_signal(lock_button.background, color.color["Orange200"])
|
||||
Hover_signal(shutdown_button.background, color.color["Blue200"])
|
||||
Hover_signal(reboot_button.background, color.color["Red200"])
|
||||
Hover_signal(suspend_button.background, color.color["Yellow200"])
|
||||
Hover_signal(logout_button.background, color.color["Green200"])
|
||||
Hover_signal(lock_button.background, color.color["Orange200"])
|
||||
|
||||
-- The powermenu widget
|
||||
local powermenu = wibox.widget {
|
||||
@@ -263,7 +263,7 @@ return function (s)
|
||||
}
|
||||
|
||||
-- Container for the widget, covers the entire screen
|
||||
local powermenu_container = wibox{
|
||||
local powermenu_container = wibox {
|
||||
widget = powermenu,
|
||||
screen = s,
|
||||
type = "splash",
|
||||
@@ -282,7 +282,7 @@ return function (s)
|
||||
awful.button(
|
||||
{},
|
||||
3,
|
||||
function ()
|
||||
function()
|
||||
awesome.emit_signal("module::powermenu:hide")
|
||||
end
|
||||
)
|
||||
@@ -290,10 +290,10 @@ return function (s)
|
||||
)
|
||||
|
||||
-- Close on Escape
|
||||
local powermenu_keygrabber = awful.keygrabber{
|
||||
local powermenu_keygrabber = awful.keygrabber {
|
||||
autostart = false,
|
||||
stop_event = 'release',
|
||||
keypressed_callback = function (self, mod, key, command)
|
||||
keypressed_callback = function(self, mod, key, command)
|
||||
if key == 'Escape' then
|
||||
awesome.emit_signal("module::powermenu:hide")
|
||||
end
|
||||
@@ -317,4 +317,4 @@ return function (s)
|
||||
powermenu_container.visible = false
|
||||
end
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -17,28 +17,28 @@ awful.titlebar.enable_tooltip = true
|
||||
awful.titlebar.fallback_name = 'Client'
|
||||
|
||||
local double_click_event_handler = function(double_click_event)
|
||||
if double_click_timer then
|
||||
double_click_timer:stop()
|
||||
double_click_timer = nil
|
||||
double_click_event()
|
||||
return
|
||||
end
|
||||
double_click_timer = gears.timer.start_new(
|
||||
0.20,
|
||||
function()
|
||||
double_click_timer = nil
|
||||
return false
|
||||
end
|
||||
)
|
||||
if double_click_timer then
|
||||
double_click_timer:stop()
|
||||
double_click_timer = nil
|
||||
double_click_event()
|
||||
return
|
||||
end
|
||||
double_click_timer = gears.timer.start_new(
|
||||
0.20,
|
||||
function()
|
||||
double_click_timer = nil
|
||||
return false
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
local create_click_events = function (c)
|
||||
local create_click_events = function(c)
|
||||
local buttons = gears.table.join(
|
||||
awful.button(
|
||||
{},
|
||||
1,
|
||||
function ()
|
||||
double_click_event_handler(function ()
|
||||
function()
|
||||
double_click_event_handler(function()
|
||||
if c.floating then
|
||||
c.float = false
|
||||
return
|
||||
@@ -52,7 +52,7 @@ local create_click_events = function (c)
|
||||
awful.button(
|
||||
{},
|
||||
3,
|
||||
function ()
|
||||
function()
|
||||
c:activate { context = 'titlebar', action = 'mouse_resize' }
|
||||
end
|
||||
)
|
||||
@@ -60,12 +60,12 @@ local create_click_events = function (c)
|
||||
return buttons
|
||||
end
|
||||
|
||||
local createresize_click_events = function (c)
|
||||
local createresize_click_events = function(c)
|
||||
local buttons = gears.table.join(
|
||||
awful.button(
|
||||
{},
|
||||
1,
|
||||
function ()
|
||||
function()
|
||||
c:activate { context = 'titlebar', action = 'mouse_resize' }
|
||||
end
|
||||
)
|
||||
@@ -73,21 +73,21 @@ local createresize_click_events = function (c)
|
||||
return buttons
|
||||
end
|
||||
|
||||
local create_titlebar = function (c, bg, size)
|
||||
local create_titlebar = function(c, bg, size)
|
||||
local titlebar = awful.titlebar(c, {
|
||||
position = "left",
|
||||
bg = bg,
|
||||
size = size
|
||||
})
|
||||
|
||||
titlebar : setup {
|
||||
titlebar:setup {
|
||||
{
|
||||
{
|
||||
{
|
||||
awful.titlebar.widget.closebutton(c),
|
||||
widget = wibox.container.background,
|
||||
bg = color.color["Red200"],
|
||||
shape = function (cr, height, width)
|
||||
shape = function(cr, height, width)
|
||||
gears.shape.rounded_rect(cr, width, height, 4)
|
||||
end,
|
||||
id = "closebutton"
|
||||
@@ -96,7 +96,7 @@ local create_titlebar = function (c, bg, size)
|
||||
awful.titlebar.widget.maximizedbutton(c),
|
||||
widget = wibox.container.background,
|
||||
bg = color.color["Yellow200"],
|
||||
shape = function (cr, height, width)
|
||||
shape = function(cr, height, width)
|
||||
gears.shape.rounded_rect(cr, width, height, 4)
|
||||
end,
|
||||
id = "maximizebutton"
|
||||
@@ -105,22 +105,22 @@ local create_titlebar = function (c, bg, size)
|
||||
awful.titlebar.widget.minimizebutton(c),
|
||||
widget = wibox.container.background,
|
||||
bg = color.color["Green200"],
|
||||
shape = function (cr, height, width)
|
||||
shape = function(cr, height, width)
|
||||
gears.shape.rounded_rect(cr, width, height, 4)
|
||||
end,
|
||||
id = "minimizebutton"
|
||||
},
|
||||
spacing = dpi(10),
|
||||
layout = wibox.layout.fixed.vertical,
|
||||
id = "spacing"
|
||||
layout = wibox.layout.fixed.vertical,
|
||||
id = "spacing"
|
||||
},
|
||||
margins = dpi(8),
|
||||
widget = wibox.container.margin,
|
||||
id = "margin"
|
||||
},
|
||||
{
|
||||
buttons = create_click_events(c),
|
||||
layout = wibox.layout.flex.vertical
|
||||
buttons = create_click_events(c),
|
||||
layout = wibox.layout.flex.vertical
|
||||
},
|
||||
{
|
||||
{
|
||||
@@ -132,26 +132,26 @@ local create_titlebar = function (c, bg, size)
|
||||
layout = wibox.layout.align.vertical,
|
||||
id = "main"
|
||||
}
|
||||
hover_signal(titlebar.main.margin.spacing.closebutton, color.color["Red200"])
|
||||
hover_signal(titlebar.main.margin.spacing.maximizebutton, color.color["Yellow200"])
|
||||
hover_signal(titlebar.main.margin.spacing.minimizebutton, color.color["Green200"])
|
||||
Hover_signal(titlebar.main.margin.spacing.closebutton, color.color["Red200"])
|
||||
Hover_signal(titlebar.main.margin.spacing.maximizebutton, color.color["Yellow200"])
|
||||
Hover_signal(titlebar.main.margin.spacing.minimizebutton, color.color["Green200"])
|
||||
end
|
||||
|
||||
local create_titlebar_dialog = function(c, bg, size)
|
||||
local titlebar = awful.titlebar(c, {
|
||||
local titlebar = awful.titlebar(c, {
|
||||
position = "left",
|
||||
bg = bg,
|
||||
size = size
|
||||
})
|
||||
|
||||
titlebar : setup {
|
||||
titlebar:setup {
|
||||
{
|
||||
{
|
||||
{
|
||||
awful.titlebar.widget.closebutton(c),
|
||||
widget = wibox.container.background,
|
||||
bg = color.color["Red200"],
|
||||
shape = function (cr, height, width)
|
||||
shape = function(cr, height, width)
|
||||
gears.shape.rounded_rect(cr, width, height, 4)
|
||||
end,
|
||||
id = "closebutton"
|
||||
@@ -160,22 +160,22 @@ local create_titlebar_dialog = function(c, bg, size)
|
||||
awful.titlebar.widget.minimizebutton(c),
|
||||
widget = wibox.container.background,
|
||||
bg = color.color["Green200"],
|
||||
shape = function (cr, height, width)
|
||||
shape = function(cr, height, width)
|
||||
gears.shape.rounded_rect(cr, width, height, 4)
|
||||
end,
|
||||
id = "minimizebutton"
|
||||
},
|
||||
spacing = dpi(10),
|
||||
layout = wibox.layout.fixed.vertical,
|
||||
id = "spacing"
|
||||
layout = wibox.layout.fixed.vertical,
|
||||
id = "spacing"
|
||||
},
|
||||
margins = dpi(8),
|
||||
widget = wibox.container.margin,
|
||||
id = "margin"
|
||||
},
|
||||
{
|
||||
buttons = create_click_events(c),
|
||||
layout = wibox.layout.flex.vertical
|
||||
buttons = create_click_events(c),
|
||||
layout = wibox.layout.flex.vertical
|
||||
},
|
||||
{
|
||||
{
|
||||
@@ -187,33 +187,33 @@ local create_titlebar_dialog = function(c, bg, size)
|
||||
layout = wibox.layout.align.vertical,
|
||||
id = "main"
|
||||
}
|
||||
hover_signal(titlebar.main.margin.spacing.closebutton, color.color["Red200"])
|
||||
hover_signal(titlebar.main.margin.spacing.minimizebutton, color.color["Green200"])
|
||||
Hover_signal(titlebar.main.margin.spacing.closebutton, color.color["Red200"])
|
||||
Hover_signal(titlebar.main.margin.spacing.minimizebutton, color.color["Green200"])
|
||||
end
|
||||
|
||||
local create_titlebar_borderhack = function (c, bg, position)
|
||||
local create_titlebar_borderhack = function(c, bg, position)
|
||||
local borderhack = awful.titlebar(c, {
|
||||
position = position,
|
||||
bg = bg,
|
||||
size = "2"
|
||||
})
|
||||
borderhack : setup {
|
||||
borderhack:setup {
|
||||
{
|
||||
bg = bg,
|
||||
widget = wibox.container.background
|
||||
},
|
||||
{
|
||||
buttons = createresize_click_events(c),
|
||||
layout = wibox.layout.flex.vertical
|
||||
},
|
||||
nil,
|
||||
layout = wibox.layout.align.vertical
|
||||
}
|
||||
{
|
||||
buttons = createresize_click_events(c),
|
||||
layout = wibox.layout.flex.vertical
|
||||
},
|
||||
nil,
|
||||
layout = wibox.layout.align.vertical
|
||||
}
|
||||
|
||||
local old_wibox, old_cursor
|
||||
borderhack:connect_signal(
|
||||
"mouse::enter",
|
||||
function ()
|
||||
function()
|
||||
local w = mouse.current_client
|
||||
if w then
|
||||
old_cursor, old_wibox = w.cursor, w
|
||||
@@ -224,7 +224,7 @@ local create_titlebar_borderhack = function (c, bg, position)
|
||||
|
||||
borderhack:connect_signal(
|
||||
"mouse::leave",
|
||||
function ()
|
||||
function()
|
||||
if old_wibox then
|
||||
old_wibox.cursor = old_cursor
|
||||
old_wibox = nil
|
||||
@@ -234,8 +234,8 @@ local create_titlebar_borderhack = function (c, bg, position)
|
||||
|
||||
end
|
||||
|
||||
local draw_titlebar = function (c)
|
||||
if c.type == 'normal' and not c.requests_no_titlebar then
|
||||
local draw_titlebar = function(c)
|
||||
if c.type == 'normal' and not c.requests_no_titlebar then
|
||||
create_titlebar_borderhack(c, "#121212AA", "right")
|
||||
create_titlebar_borderhack(c, "#121212AA", "top")
|
||||
create_titlebar_borderhack(c, "#121212AA", "bottom")
|
||||
@@ -267,7 +267,7 @@ end
|
||||
|
||||
client.connect_signal(
|
||||
"property::maximized",
|
||||
function (c)
|
||||
function(c)
|
||||
if c.maximized then
|
||||
Theme.titlebar_maximized_button_normal = icondir .. "unmaximize.svg"
|
||||
Theme.titlebar_maximized_button_active = icondir .. "unmaximize.svg"
|
||||
@@ -282,7 +282,7 @@ client.connect_signal(
|
||||
|
||||
client.connect_signal(
|
||||
"request::titlebars",
|
||||
function (c)
|
||||
function(c)
|
||||
if c.maximized then
|
||||
Theme.titlebar_maximized_button_normal = icondir .. "unmaximize.svg"
|
||||
Theme.titlebar_maximized_button_active = icondir .. "unmaximize.svg"
|
||||
@@ -304,7 +304,7 @@ client.connect_signal(
|
||||
|
||||
client.connect_signal(
|
||||
'property::floating',
|
||||
function (c)
|
||||
function(c)
|
||||
if c.floating and not c.maximized then
|
||||
if c.class == "Steam" then
|
||||
awful.titlebar.hide(c, 'left')
|
||||
|
||||
@@ -13,9 +13,9 @@ local wibox = require("wibox")
|
||||
local icondir = awful.util.getdir("config") .. "theme/crylia/assets/icons/audio/"
|
||||
|
||||
-- Returns the volume_osd
|
||||
return function (s)
|
||||
return function(s)
|
||||
|
||||
local volume_osd_widget = wibox.widget{
|
||||
local volume_osd_widget = wibox.widget {
|
||||
{
|
||||
{
|
||||
{
|
||||
@@ -101,8 +101,6 @@ return function (s)
|
||||
|
||||
local function update_osd()
|
||||
local volume_level = volume_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.volume_slider:get_value()
|
||||
|
||||
awful.spawn("pactl set-sink-volume @DEFAULT_SINK@ ".. volume_level .. "%", false)
|
||||
awesome.emit_signal("widget::volume")
|
||||
volume_osd_widget.container.osd_layout.icon_slider_layout.label_value_layout.value:set_text(volume_level .. "%")
|
||||
|
||||
@@ -133,22 +131,26 @@ return function (s)
|
||||
|
||||
volume_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.volume_slider:connect_signal(
|
||||
"property::value",
|
||||
function ()
|
||||
function()
|
||||
update_osd()
|
||||
end
|
||||
)
|
||||
|
||||
local update_slider = function ()
|
||||
local update_slider = function()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[[ pacmd list-sinks | grep "muted" ]],
|
||||
function (stdout)
|
||||
function(stdout)
|
||||
if stdout:match("yes") then
|
||||
volume_osd_widget.container.osd_layout.icon_slider_layout.label_value_layout.value:set_text("0%")
|
||||
volume_osd_widget.container.osd_layout.icon_slider_layout.icon_margin1.icon_margin2.icon:set_image(icondir .. "volume-mute" .. ".svg")
|
||||
else
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[[ pacmd list-sinks | grep "volume: front" | awk '{print $5}' ]],
|
||||
function (stdout2)
|
||||
[[
|
||||
SINK="$(pacmd stat | awk -F": " '/^Default sink name: /{print $2}')"
|
||||
|
||||
echo $(pacmd list-sinks | awk '/^\s+name: /{indefault = $2 == "<'$SINK'>"} /^\s+volume: / && indefault {print $5; exit}')
|
||||
]],
|
||||
function(stdout2)
|
||||
stdout2 = stdout2:sub(1, -3)
|
||||
volume_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.volume_slider:set_value(tonumber(stdout2))
|
||||
update_osd()
|
||||
@@ -162,55 +164,55 @@ return function (s)
|
||||
-- Signals
|
||||
awesome.connect_signal(
|
||||
"module::slider:update",
|
||||
function ()
|
||||
function()
|
||||
update_slider()
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
"widget::volume:update",
|
||||
function (value)
|
||||
function(value)
|
||||
volume_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.volume_slider:set_value(tonumber(value))
|
||||
end
|
||||
)
|
||||
|
||||
update_slider()
|
||||
|
||||
local volume_container = awful.popup{
|
||||
local volume_container = awful.popup {
|
||||
widget = wibox.container.background,
|
||||
ontop = true,
|
||||
bg = color.color["Grey900"] .. "00",
|
||||
stretch = false,
|
||||
visible = false,
|
||||
placement = function (c) awful.placement.centered(c, {margins = {top = dpi(200)}}) end,
|
||||
shape = function (cr, width, height)
|
||||
placement = function(c) awful.placement.centered(c, { margins = { top = dpi(200) } }) end,
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 15)
|
||||
end
|
||||
}
|
||||
|
||||
local hide_volume_osd = gears.timer{
|
||||
local hide_volume_osd = gears.timer {
|
||||
timeout = 2,
|
||||
autostart = true,
|
||||
callback = function ()
|
||||
callback = function()
|
||||
volume_container.visible = false
|
||||
end
|
||||
}
|
||||
|
||||
volume_container:setup{
|
||||
volume_container:setup {
|
||||
volume_osd_widget,
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
}
|
||||
|
||||
awesome.connect_signal(
|
||||
"module::volume_osd:show",
|
||||
function ()
|
||||
function()
|
||||
volume_container.visible = true
|
||||
end
|
||||
)
|
||||
|
||||
volume_container:connect_signal(
|
||||
"mouse::enter",
|
||||
function ()
|
||||
function()
|
||||
volume_container.visible = true
|
||||
hide_volume_osd:stop()
|
||||
end
|
||||
@@ -218,7 +220,7 @@ return function (s)
|
||||
|
||||
volume_container:connect_signal(
|
||||
"mouse::leave",
|
||||
function ()
|
||||
function()
|
||||
volume_container.visible = true
|
||||
hide_volume_osd:again()
|
||||
end
|
||||
@@ -226,7 +228,7 @@ return function (s)
|
||||
|
||||
awesome.connect_signal(
|
||||
"widget::volume_osd:rerun",
|
||||
function ()
|
||||
function()
|
||||
if hide_volume_osd.started then
|
||||
hide_volume_osd:again()
|
||||
else
|
||||
@@ -234,4 +236,4 @@ return function (s)
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user