added powermenu
This commit is contained in:
@@ -9,10 +9,12 @@ local dpi = require("beautiful").xresources.apply_dpi
|
||||
local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
|
||||
local naughty = require("naughty")
|
||||
|
||||
-- Icon directory path
|
||||
local icondir = awful.util.getdir("config") .. "theme/crylia/assets/icons/brightness/"
|
||||
|
||||
--TODO: fix backlight keys and osd not working correctly
|
||||
-- TODO: fix backlight keys and osd not working correctly
|
||||
return function ()
|
||||
|
||||
local brightness_osd_widget = wibox.widget{
|
||||
@@ -28,7 +30,7 @@ return function ()
|
||||
},
|
||||
nil,
|
||||
{
|
||||
ic = "value",
|
||||
id = "value",
|
||||
text = "0%",
|
||||
align = "center",
|
||||
valign = "center",
|
||||
@@ -81,10 +83,10 @@ return function ()
|
||||
right = dpi(24),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
bg = color.color["Grey900"] .. '44',
|
||||
bg = color.color["Grey900"],
|
||||
widget = wibox.container.background,
|
||||
ontop = true,
|
||||
visible = false,
|
||||
visible = true,
|
||||
type = "notification",
|
||||
forced_height = dpi(100),
|
||||
forced_width = dpi(300),
|
||||
@@ -95,9 +97,8 @@ return function ()
|
||||
"property::value",
|
||||
function ()
|
||||
local brightness_value = brightness_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.brightness_slider:get_value()
|
||||
|
||||
-- Performance is horrible, or it overrides and executes at the same time as the keybindings
|
||||
awful.spawn("xbacklight -set " .. brightness_value .. "%", false)
|
||||
--awful.spawn("xbacklight -set " .. brightness_value, false)
|
||||
brightness_osd_widget.container.osd_layout.label_value_layout.value:set_text(brightness_value .. "%")
|
||||
|
||||
awesome.emit_signal(
|
||||
@@ -134,44 +135,6 @@ return function ()
|
||||
)
|
||||
end
|
||||
|
||||
local hide_osd = gears.timer{
|
||||
timeout = 5,
|
||||
autostart = true,
|
||||
callback = function ()
|
||||
brightness_osd_widget.visible = false
|
||||
end
|
||||
}
|
||||
|
||||
-- Signals
|
||||
brightness_osd_widget:connect_signal(
|
||||
"mouse::enter",
|
||||
function ()
|
||||
brightness_osd_widget.visible = true
|
||||
hide_osd:stop()
|
||||
end
|
||||
)
|
||||
|
||||
brightness_osd_widget:connect_signal(
|
||||
"mouse::leave",
|
||||
function ()
|
||||
brightness_osd_widget.visible = true
|
||||
hide_osd:again()
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
"widget::brightness_osd:rerun",
|
||||
function ()
|
||||
if hide_osd.started then
|
||||
hide_osd:again()
|
||||
else
|
||||
hide_osd:start()
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
update_slider()
|
||||
|
||||
awesome.connect_signal(
|
||||
"module::brightness_slider:update",
|
||||
function ()
|
||||
@@ -186,13 +149,6 @@ return function ()
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
"module::brightness_osd:show",
|
||||
function ()
|
||||
brightness_osd_widget.visible = true
|
||||
end
|
||||
)
|
||||
|
||||
update_slider()
|
||||
return brightness_osd_widget
|
||||
end
|
||||
@@ -1,78 +1,122 @@
|
||||
---------------------------------------
|
||||
-- This is the calendar_osd module --
|
||||
---------------------------------------
|
||||
|
||||
-- Awesome Libs
|
||||
|
||||
local wibox = require("wibox")
|
||||
local awful = require("awful")
|
||||
local gears = require("gears")
|
||||
local naughty = require("naughty")
|
||||
local dpi = require("beautiful").xresources.apply_dpi
|
||||
local color = require("theme.crylia.colors")
|
||||
|
||||
local styles = {}
|
||||
return function ()
|
||||
local styles = {}
|
||||
|
||||
styles.month = {
|
||||
padding = 15,
|
||||
bg_color = color.color["Grey900"],
|
||||
border_width = 1,
|
||||
shape = function (cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end
|
||||
}
|
||||
styles.normal = {
|
||||
shape = function (cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end
|
||||
}
|
||||
styles.focus = {
|
||||
fg_color = color.color["Grey900"],
|
||||
bg_color = color.color["TealA200"],
|
||||
shape = function (cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end
|
||||
}
|
||||
styles.header = {
|
||||
fg_color = color.color["Teal200"],
|
||||
markup = function(t) return '<b>' .. t .. '</b>' end,
|
||||
shape = function (cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end
|
||||
}
|
||||
styles.weekday = {
|
||||
padding = 8,
|
||||
fg_color = color.color["Teal200"],
|
||||
markup = function(t) return '<b>' .. t .. '</b>' end,
|
||||
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
|
||||
flag = 'header'
|
||||
end
|
||||
local props = styles[flag] or {}
|
||||
if props.markup and widget.get_text and widget.set_markup then
|
||||
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 weekday = tonumber(os.date('%w', os.time(d)))
|
||||
local default_bg = (weekday==0 or weekday==6) and color.color["Grey900"] or color.color["Grey800"]
|
||||
local ret = wibox.widget {
|
||||
{
|
||||
widget,
|
||||
margins = 10,
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
shape = props.shape,
|
||||
shape_border_color = color.color["Grey800"],
|
||||
shape_border_width = 1,
|
||||
fg = props.fg_color or '#999999',
|
||||
bg = props.bg_color or default_bg,
|
||||
widget = wibox.container.background
|
||||
styles.month = {
|
||||
padding = 15,
|
||||
bg_color = color.color["Grey900"],
|
||||
border_width = 1,
|
||||
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)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end
|
||||
}
|
||||
styles.focus = {
|
||||
fg_color = color.color["Grey900"],
|
||||
bg_color = color.color["Purple200"],
|
||||
shape = function (cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end
|
||||
}
|
||||
styles.header = {
|
||||
fg_color = color.color["Grey900"],
|
||||
bg_color = color.color["Teal200"],
|
||||
markup = function(t) return '<b>' .. t .. '</b>' end,
|
||||
shape = function (cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end
|
||||
}
|
||||
styles.weekday = {
|
||||
padding = 8,
|
||||
fg_color = color.color["Grey900"],
|
||||
bg_color = color.color["Teal200"],
|
||||
markup = function(t) return '<b>' .. t .. '</b>' end,
|
||||
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
|
||||
flag = 'header'
|
||||
end
|
||||
local props = styles[flag] or {}
|
||||
if props.markup and widget.get_text and widget.set_markup then
|
||||
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 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),
|
||||
bottom = dpi(4),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
shape = function (cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end,
|
||||
fg = props.fg_color or '#999999',
|
||||
bg = props.bg_color or default_bg,
|
||||
widget = wibox.container.background
|
||||
}
|
||||
return ret
|
||||
end
|
||||
local calendar = wibox.widget {
|
||||
date = os.date('*t'),
|
||||
fn_embed = decorate_cell,
|
||||
widget = wibox.widget.calendar.month,
|
||||
font = "JetBrainsMonoExtraBold NF",
|
||||
spacing = dpi(10)
|
||||
}
|
||||
return ret
|
||||
end
|
||||
local cal = wibox.widget {
|
||||
date = os.date('*t'),
|
||||
fn_embed = decorate_cell,
|
||||
widget = wibox.widget.calendar.month
|
||||
}
|
||||
|
||||
return cal
|
||||
local calendar_osd_widget = wibox.widget{
|
||||
{
|
||||
widget = wibox.widget.textbox,
|
||||
fg = "#ffffff",
|
||||
align = "center",
|
||||
valign = "center",
|
||||
font = "DS-Digital, Bold Italic 50",
|
||||
id = "digital_clock"
|
||||
},
|
||||
{
|
||||
widget = calendar
|
||||
},
|
||||
visible = true,
|
||||
layout = wibox.layout.fixed.vertical
|
||||
}
|
||||
|
||||
local set_clock = function ()
|
||||
calendar_osd_widget.digital_clock:set_text(os.date("%H:%M"))
|
||||
end
|
||||
|
||||
local calendar_clock_update = gears.timer {
|
||||
timeout = 5,
|
||||
autostart = true,
|
||||
call_now = true,
|
||||
callback = function ()
|
||||
set_clock()
|
||||
end
|
||||
}
|
||||
|
||||
return calendar_osd_widget
|
||||
end
|
||||
243
awesome/theme/crylia/modules/powermenu.lua
Normal file
243
awesome/theme/crylia/modules/powermenu.lua
Normal file
@@ -0,0 +1,243 @@
|
||||
--------------------------------
|
||||
-- This is the network widget --
|
||||
--------------------------------
|
||||
|
||||
-- Awesome Libs
|
||||
local awful = require("awful")
|
||||
local color = require("theme.crylia.colors")
|
||||
local dpi = require("beautiful").xresources.apply_dpi
|
||||
local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
local naughty = require("naughty")
|
||||
|
||||
-- Icon directory path
|
||||
local icondir = awful.util.getdir("config") .. "theme/crylia/assets/icons/powermenu/"
|
||||
|
||||
return function ()
|
||||
|
||||
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, width, height, 30)
|
||||
end,
|
||||
widget = wibox.widget.imagebox
|
||||
}
|
||||
|
||||
local profile_name = wibox.widget {
|
||||
align = 'center',
|
||||
valign = 'center',
|
||||
text = " ",
|
||||
font = "JetBrains Mono Bold 30",
|
||||
widget = wibox.widget.textbox
|
||||
}
|
||||
|
||||
local update_profile_picture = function ()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[=[
|
||||
iconPath="/var/lib/AccountsService/icons/${USER}"
|
||||
userIconPath="${HOME}/.config/awesome/theme/crylia/assets/userpfp/"
|
||||
if [[ -f "${userIconPath}" ]];
|
||||
then
|
||||
if [[ -f "${iconPath}" ]];
|
||||
then
|
||||
if ! cmp --silent "${userIconPath}.png" "${iconPath}";
|
||||
then
|
||||
cp "${iconPath}" "${userIconPath}${USER}.png"
|
||||
fi
|
||||
printf "${userIconPath}.png"
|
||||
else
|
||||
printf "${userIconPath}.png"
|
||||
fi
|
||||
exit;
|
||||
else
|
||||
if [[ -f "${iconPath}" ]];
|
||||
then
|
||||
cp "${iconPath}" "${userIconPath}${USER}.png"
|
||||
printf "${userIconPath}${USER}.png"
|
||||
exit;
|
||||
fi
|
||||
fi
|
||||
]=],
|
||||
function (stdout)
|
||||
if stdout then
|
||||
profile_picture:set_image(stdout:gsub("\n", ""))
|
||||
else
|
||||
profile_picture:set_image(icondir .. "defaultpfp.svg")
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
update_profile_picture()
|
||||
local namestyle = "userhost"
|
||||
local update_user_name = function()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[=[
|
||||
fullname="$(getent passwd `whoami` | cut -d ':' -f 5)"
|
||||
user="$(whoami)"
|
||||
host="$(hostname)"
|
||||
if [[ "]=] .. namestyle .. [=[" == "userhost" ]];
|
||||
then
|
||||
printf "$user@$host"
|
||||
elif [[ "]=] .. namestyle .. [=[" == "fullname" ]];
|
||||
then
|
||||
printf "$fullname"
|
||||
else
|
||||
printf "Rick Astley"
|
||||
fi
|
||||
]=],
|
||||
function(stdout)
|
||||
if stdout:gsub("\n", "") == "Rick Astley" then
|
||||
profile_picture:set_image(awful.util.getdir("config") .. "theme/crylia/assets/userpfp/" .. "rickastley.jpg")
|
||||
end
|
||||
profile_name:set_text(stdout)
|
||||
end
|
||||
)
|
||||
end
|
||||
update_user_name()
|
||||
|
||||
local button = function(name, icon, bg_color, callback)
|
||||
local item = wibox.widget{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
--image = gears.color.recolor_image(icon, color.color["Grey900"]),
|
||||
image = icon,
|
||||
resize = true,
|
||||
forced_height = dpi(30),
|
||||
widget = wibox.widget.imagebox
|
||||
},
|
||||
margins = dpi(0),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
{
|
||||
{
|
||||
text = name,
|
||||
font = "JetBrains Mono Bold 30",
|
||||
widget = wibox.widget.textbox
|
||||
},
|
||||
margins = dpi(0),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
widget = wibox.layout.fixed.horizontal
|
||||
},
|
||||
margins = dpi(10),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
fg = color.color["Grey900"],
|
||||
bg = bg_color,
|
||||
shape = function (cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 10)
|
||||
end,
|
||||
widget = wibox.container.background
|
||||
},
|
||||
spacing = dpi(0),
|
||||
layout = wibox.layout.align.vertical
|
||||
}
|
||||
|
||||
item:connect_signal(
|
||||
"button::release",
|
||||
function()
|
||||
callback()
|
||||
end
|
||||
)
|
||||
|
||||
return item
|
||||
end
|
||||
|
||||
local suspend_command = function()
|
||||
awful.spawn.easy_async_with_shell("dm-tool lock & systemctl suspend")
|
||||
awesome.emit_signal("module::powermenu:hide")
|
||||
end
|
||||
|
||||
local logout_command = function()
|
||||
awesome.quit()
|
||||
end
|
||||
|
||||
local lock_command = function()
|
||||
awful.spawn.easy_async_with_shell("dm-tool lock")
|
||||
awesome.emit_signal("module::powermenu:hide")
|
||||
end
|
||||
|
||||
local shutdown_command = function()
|
||||
awful.spawn.easy_async_with_shell("shutdown now")
|
||||
awesome.emit_signal("module::powermenu:hide")
|
||||
end
|
||||
|
||||
local reboot_command = function()
|
||||
awful.spawn.easy_async_with_shell("reboot")
|
||||
awesome.emit_signal("module::powermenu:hide")
|
||||
end
|
||||
|
||||
local shutdown_button = button("Shutdown", icondir .. "shutdown.svg", color.color["Blue200"], shutdown_command)
|
||||
local reboot_button = button("Reboot", icondir .. "reboot.svg", color.color["Red200"], reboot_command)
|
||||
local suspend_button = button("Suspend", icondir .. "suspend.svg", color.color["Yellow200"], suspend_command)
|
||||
local logout_button = button("Logout", icondir .. "logout.svg", color.color["Green200"], logout_command)
|
||||
local lock_button = button("Lock", icondir .. "lock.svg", color.color["Orange200"], lock_command)
|
||||
|
||||
local powermenu = wibox.widget {
|
||||
layout = wibox.layout.align.vertical,
|
||||
expand = "none",
|
||||
nil,
|
||||
{
|
||||
{
|
||||
nil,
|
||||
{
|
||||
{
|
||||
nil,
|
||||
{
|
||||
nil,
|
||||
{
|
||||
profile_picture,
|
||||
margins = dpi(0),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
nil,
|
||||
expand = "none",
|
||||
layout = wibox.layout.align.horizontal
|
||||
},
|
||||
nil,
|
||||
layout = wibox.layout.align.vertical,
|
||||
expand = "none"
|
||||
},
|
||||
spacing = dpi(50),
|
||||
{
|
||||
profile_name,
|
||||
margins = dpi(0),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
layout = wibox.layout.fixed.vertical
|
||||
},
|
||||
nil,
|
||||
expand = "none",
|
||||
layout = wibox.layout.align.horizontal
|
||||
},
|
||||
{
|
||||
nil,
|
||||
{
|
||||
{
|
||||
shutdown_button,
|
||||
reboot_button,
|
||||
logout_button,
|
||||
lock_button,
|
||||
suspend_button,
|
||||
spacing = dpi(30),
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
margins = dpi(0),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
nil,
|
||||
expand = "none",
|
||||
layout = wibox.layout.align.horizontal
|
||||
},
|
||||
layout = wibox.layout.align.vertical
|
||||
},
|
||||
nil
|
||||
}
|
||||
return powermenu
|
||||
end
|
||||
180
awesome/theme/crylia/modules/titlebar.lua
Normal file
180
awesome/theme/crylia/modules/titlebar.lua
Normal file
@@ -0,0 +1,180 @@
|
||||
-----------------------------------
|
||||
-- This is the titlebar module --
|
||||
-----------------------------------
|
||||
|
||||
-- Awesome Libs
|
||||
local awful = require("awful")
|
||||
local color = require("theme.crylia.colors")
|
||||
local dpi = require("beautiful").xresources.apply_dpi
|
||||
local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
|
||||
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
|
||||
)
|
||||
end
|
||||
|
||||
local create_click_events = function (c)
|
||||
local buttons = gears.table.join(
|
||||
awful.button(
|
||||
{},
|
||||
1,
|
||||
function ()
|
||||
double_click_event_handler(function ()
|
||||
if c.floating then
|
||||
c.float = false
|
||||
return
|
||||
end
|
||||
c.maximized = not c.maximized
|
||||
c:raise()
|
||||
end)
|
||||
c:activate { context = 'titlebar', action = 'mouse_move' }
|
||||
end
|
||||
),
|
||||
awful.button(
|
||||
{},
|
||||
3,
|
||||
function ()
|
||||
c:activate { context = 'titlebar', action = 'mouse_resize' }
|
||||
end
|
||||
)
|
||||
)
|
||||
return buttons
|
||||
end
|
||||
|
||||
local create_titlebar = function (c, bg, size)
|
||||
awful.titlebar(c, { position = "left", bg = bg, size = size }) : setup {
|
||||
{
|
||||
{
|
||||
{
|
||||
awful.titlebar.widget.closebutton(c),
|
||||
widget = wibox.container.background,
|
||||
bg = color.color["Red200"],
|
||||
shape = function (cr, height, width)
|
||||
gears.shape.rounded_rect(cr, width, height, 4)
|
||||
end
|
||||
},
|
||||
{
|
||||
awful.titlebar.widget.maximizedbutton(c),
|
||||
widget = wibox.container.background,
|
||||
bg = color.color["Yellow200"],
|
||||
shape = function (cr, height, width)
|
||||
gears.shape.rounded_rect(cr, width, height, 4)
|
||||
end
|
||||
},
|
||||
{
|
||||
awful.titlebar.widget.minimizebutton(c),
|
||||
widget = wibox.container.background,
|
||||
bg = color.color["Green200"],
|
||||
shape = function (cr, height, width)
|
||||
gears.shape.rounded_rect(cr, width, height, 4)
|
||||
end
|
||||
},
|
||||
spacing = dpi(10),
|
||||
layout = wibox.layout.fixed.vertical
|
||||
},
|
||||
margins = dpi(8),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
{
|
||||
buttons = create_click_events(c),
|
||||
layout = wibox.layout.flex.vertical
|
||||
},
|
||||
nil,
|
||||
layout = wibox.layout.align.vertical
|
||||
}
|
||||
end
|
||||
|
||||
local create_titlebar_dialog = function(c, bg, size)
|
||||
awful.titlebar(c, {position = "left", bg = bg, size = size}) : setup {
|
||||
{
|
||||
{
|
||||
{
|
||||
awful.titlebar.widget.closebutton(c),
|
||||
widget = wibox.container.background,
|
||||
bg = color.color["Red200"],
|
||||
shape = function (cr, height, width)
|
||||
gears.shape.rounded_rect(cr, width, height, 4)
|
||||
end
|
||||
},
|
||||
{
|
||||
awful.titlebar.widget.minimizebutton(c),
|
||||
widget = wibox.container.background,
|
||||
bg = color.color["Green200"],
|
||||
shape = function (cr, height, width)
|
||||
gears.shape.rounded_rect(cr, width, height, 4)
|
||||
end
|
||||
},
|
||||
spacing = dpi(7),
|
||||
layout = wibox.layout.fixed.vertical
|
||||
},
|
||||
margins = dpi(8),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
{
|
||||
buttons = create_click_events(c),
|
||||
layout = wibox.layout.flex.vertical
|
||||
},
|
||||
nil,
|
||||
layout = wibox.layout.align.vertical
|
||||
}
|
||||
end
|
||||
|
||||
local draw_titlebar = function (c)
|
||||
if c.type == 'normal' then
|
||||
if c.class == 'Firefox' then
|
||||
create_titlebar(c, '#121212AA', 35)
|
||||
elseif c.name == "Steam" then
|
||||
create_titlebar(c, '#121212AA', 0)
|
||||
elseif c.name == "Settings" then
|
||||
create_titlebar(c, '#121212AA', 0)
|
||||
elseif c.class == "gcr-prompter" or c.class == "Gcr-prompter" then
|
||||
create_titlebar(c, '#121212AA', 0)
|
||||
else
|
||||
create_titlebar(c, '#121212AA', 35)
|
||||
end
|
||||
elseif c.type == 'dialog' then
|
||||
create_titlebar_dialog(c, '#121212AA', 35)
|
||||
elseif c.type == 'modal' then
|
||||
create_titlebar(c, '#121212AA', 35)
|
||||
end
|
||||
end
|
||||
|
||||
client.connect_signal(
|
||||
"request::titlebars",
|
||||
function (c)
|
||||
draw_titlebar(c)
|
||||
if not c.floating then
|
||||
awful.titlebar.hide(c, 'left')
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
client.connect_signal(
|
||||
'property::floating',
|
||||
function (c)
|
||||
if c.floating then
|
||||
if c.class == "Steam" then
|
||||
awful.titlebar.hide(c, 'left')
|
||||
else
|
||||
awful.titlebar.show(c, 'left')
|
||||
end
|
||||
else
|
||||
awful.titlebar.hide(c, 'left')
|
||||
end
|
||||
end
|
||||
)
|
||||
@@ -81,10 +81,10 @@ return function ()
|
||||
right = dpi(24),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
bg = color.color["Grey900"] .. '44',
|
||||
bg = color.color["Grey900"],
|
||||
widget = wibox.container.background,
|
||||
ontop = true,
|
||||
visible = false,
|
||||
visible = true,
|
||||
type = "notification",
|
||||
forced_height = dpi(100),
|
||||
forced_width = dpi(300),
|
||||
@@ -147,14 +147,6 @@ return function ()
|
||||
)
|
||||
end
|
||||
|
||||
local hide_osd = gears.timer{
|
||||
timeout = 5,
|
||||
autostart = true,
|
||||
callback = function ()
|
||||
volume_osd_widget.visible = false
|
||||
end
|
||||
}
|
||||
|
||||
-- Signals
|
||||
awesome.connect_signal(
|
||||
"module::slider:update",
|
||||
@@ -170,40 +162,6 @@ return function ()
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
"module::volume_osd:show",
|
||||
function ()
|
||||
volume_osd_widget.visible = true
|
||||
end
|
||||
)
|
||||
|
||||
volume_osd_widget:connect_signal(
|
||||
"mouse::enter",
|
||||
function ()
|
||||
volume_osd_widget.visible = true
|
||||
hide_osd:stop()
|
||||
end
|
||||
)
|
||||
|
||||
volume_osd_widget:connect_signal(
|
||||
"mouse::leave",
|
||||
function ()
|
||||
volume_osd_widget.visible = true
|
||||
hide_osd:again()
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
"widget::volume_osd:rerun",
|
||||
function ()
|
||||
if hide_osd.started then
|
||||
hide_osd:again()
|
||||
else
|
||||
hide_osd:start()
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
update_slider()
|
||||
return volume_osd_widget
|
||||
end
|
||||
Reference in New Issue
Block a user