panik
This commit is contained in:
@@ -9,13 +9,11 @@ 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
|
||||
return function ()
|
||||
return function (s)
|
||||
|
||||
local brightness_osd_widget = wibox.widget{
|
||||
{
|
||||
@@ -150,5 +148,63 @@ return function ()
|
||||
)
|
||||
|
||||
update_slider()
|
||||
return brightness_osd_widget
|
||||
|
||||
local brightness_container = awful.popup{
|
||||
widget = wibox.container.background,
|
||||
ontop = true,
|
||||
bg = color.color["Grey900"],
|
||||
stretch = false,
|
||||
visible = false,
|
||||
placement = function (c) awful.placement.bottom_right(c, {margins = dpi(10)}) end,
|
||||
shape = function (cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end
|
||||
}
|
||||
|
||||
local hide_brightness_osd = gears.timer{
|
||||
timeout = 1,
|
||||
autostart = true,
|
||||
callback = function ()
|
||||
brightness_container.visible = false
|
||||
end
|
||||
}
|
||||
|
||||
brightness_container:setup{
|
||||
brightness_osd_widget,
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
}
|
||||
|
||||
awesome.connect_signal(
|
||||
"widget::brightness_osd:rerun",
|
||||
function ()
|
||||
if hide_brightness_osd.started then
|
||||
hide_brightness_osd:again()
|
||||
else
|
||||
hide_brightness_osd:start()
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
"module::brightness_osd:show",
|
||||
function ()
|
||||
brightness_container.visible = true
|
||||
end
|
||||
)
|
||||
|
||||
brightness_container:connect_signal(
|
||||
"mouse::enter",
|
||||
function ()
|
||||
brightness_container.visible = true
|
||||
hide_brightness_osd:stop()
|
||||
end
|
||||
)
|
||||
|
||||
brightness_container:connect_signal(
|
||||
"mouse::leave",
|
||||
function ()
|
||||
brightness_container.visible = true
|
||||
hide_brightness_osd:again()
|
||||
end
|
||||
)
|
||||
end
|
||||
@@ -4,12 +4,13 @@
|
||||
|
||||
-- Awesome Libs
|
||||
|
||||
local awful = require("awful")
|
||||
local wibox = require("wibox")
|
||||
local gears = require("gears")
|
||||
local dpi = require("beautiful").xresources.apply_dpi
|
||||
local color = require("theme.crylia.colors")
|
||||
|
||||
return function ()
|
||||
return function (s)
|
||||
local styles = {}
|
||||
|
||||
styles.month = {
|
||||
@@ -118,5 +119,63 @@ return function ()
|
||||
end
|
||||
}
|
||||
|
||||
return calendar_osd_widget
|
||||
local calendar_osd_container = awful.popup{
|
||||
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)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end
|
||||
}
|
||||
|
||||
local hide_osd = gears.timer{
|
||||
timeout = 0.25,
|
||||
autostart = true,
|
||||
callback = function ()
|
||||
calendar_osd_container.visible = false
|
||||
end
|
||||
}
|
||||
|
||||
calendar_osd_container:setup{
|
||||
calendar_osd_widget,
|
||||
layout = wibox.layout.align.horizontal
|
||||
}
|
||||
|
||||
calendar_osd_container:connect_signal(
|
||||
"mouse::enter",
|
||||
function ()
|
||||
calendar_osd_container.visible = true
|
||||
hide_osd:stop()
|
||||
end
|
||||
)
|
||||
|
||||
calendar_osd_container:connect_signal(
|
||||
"mouse::leave",
|
||||
function ()
|
||||
calendar_osd_container.visible = false
|
||||
hide_osd:stop()
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
"widget::calendar_osd:stop",
|
||||
function ()
|
||||
calendar_osd_container.visible = true
|
||||
hide_osd:stop()
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
"widget::calendar_osd:rerun",
|
||||
function ()
|
||||
if hide_osd.started then
|
||||
hide_osd:again()
|
||||
else
|
||||
hide_osd:start()
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
@@ -8,23 +8,25 @@ 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")
|
||||
require("Main.Signals")
|
||||
|
||||
-- Icon directory path
|
||||
local icondir = awful.util.getdir("config") .. "theme/crylia/assets/icons/powermenu/"
|
||||
|
||||
return function ()
|
||||
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, width, height, 30)
|
||||
gears.shape.rounded_rect(cr, dpi(width), dpi(height), 30)
|
||||
end,
|
||||
widget = wibox.widget.imagebox
|
||||
}
|
||||
|
||||
-- Username textbox
|
||||
local profile_name = wibox.widget {
|
||||
align = 'center',
|
||||
valign = 'center',
|
||||
@@ -33,6 +35,9 @@ return function ()
|
||||
widget = wibox.widget.textbox
|
||||
}
|
||||
|
||||
-- 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 ()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[=[
|
||||
@@ -69,9 +74,11 @@ return function ()
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
update_profile_picture()
|
||||
local namestyle = "userhost"
|
||||
|
||||
-- Will determin the display style
|
||||
local namestyle = RC.vars.namestyle
|
||||
-- Get the full username(if set) and the username + hostname
|
||||
local update_user_name = function()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[=[
|
||||
@@ -98,6 +105,7 @@ return function ()
|
||||
end
|
||||
update_user_name()
|
||||
|
||||
-- Universal Button widget
|
||||
local button = function(name, icon, bg_color, callback)
|
||||
local item = wibox.widget{
|
||||
{
|
||||
@@ -105,7 +113,10 @@ return function ()
|
||||
{
|
||||
{
|
||||
{
|
||||
--image = gears.color.recolor_image(icon, color.color["Grey900"]),
|
||||
-- TODO: using gears.color to recolor a SVG will make it look super low res
|
||||
-- currently I recolor it in the .svg file directly, but later implement
|
||||
-- a better way to recolor a SVG
|
||||
-- image = gears.color.recolor_image(icon, color.color["Grey900"]),
|
||||
image = icon,
|
||||
resize = true,
|
||||
forced_height = dpi(30),
|
||||
@@ -133,7 +144,8 @@ return function ()
|
||||
shape = function (cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 10)
|
||||
end,
|
||||
widget = wibox.container.background
|
||||
widget = wibox.container.background,
|
||||
id = 'background'
|
||||
},
|
||||
spacing = dpi(0),
|
||||
layout = wibox.layout.align.vertical
|
||||
@@ -149,6 +161,7 @@ return function ()
|
||||
return item
|
||||
end
|
||||
|
||||
-- Create the power menu actions
|
||||
local suspend_command = function()
|
||||
awful.spawn.easy_async_with_shell("dm-tool lock & systemctl suspend")
|
||||
awesome.emit_signal("module::powermenu:hide")
|
||||
@@ -173,12 +186,21 @@ return function ()
|
||||
awesome.emit_signal("module::powermenu:hide")
|
||||
end
|
||||
|
||||
-- Create the buttons with their command and name etc
|
||||
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)
|
||||
|
||||
-- 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"])
|
||||
|
||||
-- The powermenu widget
|
||||
local powermenu = wibox.widget {
|
||||
layout = wibox.layout.align.vertical,
|
||||
expand = "none",
|
||||
@@ -239,5 +261,60 @@ return function ()
|
||||
},
|
||||
nil
|
||||
}
|
||||
return powermenu
|
||||
|
||||
-- Container for the widget, covers the entire screen
|
||||
local powermenu_container = wibox{
|
||||
widget = powermenu,
|
||||
screen = s,
|
||||
type = "splash",
|
||||
visible = false,
|
||||
ontop = true,
|
||||
bg = "#21212188",
|
||||
height = s.geometry.height,
|
||||
width = s.geometry.width,
|
||||
x = s.geometry.x,
|
||||
y = s.geometry.y
|
||||
}
|
||||
|
||||
-- Close on rightclick
|
||||
powermenu_container:buttons(
|
||||
gears.table.join(
|
||||
awful.button(
|
||||
{},
|
||||
3,
|
||||
function ()
|
||||
awesome.emit_signal("module::powermenu:hide")
|
||||
end
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
-- Close on Escape
|
||||
local powermenu_keygrabber = awful.keygrabber{
|
||||
autostart = false,
|
||||
stop_event = 'release',
|
||||
keypressed_callback = function (self, mod, key, command)
|
||||
if key == 'Escape' then
|
||||
awesome.emit_signal("module::powermenu:hide")
|
||||
end
|
||||
end
|
||||
}
|
||||
|
||||
-- Signals
|
||||
awesome.connect_signal(
|
||||
"module::powermenu:show",
|
||||
function()
|
||||
powermenu_container.visible = false
|
||||
powermenu_container.visible = true
|
||||
powermenu_keygrabber:start()
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
"module::powermenu:hide",
|
||||
function()
|
||||
powermenu_keygrabber:stop()
|
||||
powermenu_container.visible = false
|
||||
end
|
||||
)
|
||||
end
|
||||
@@ -8,6 +8,10 @@ local color = require("theme.crylia.colors")
|
||||
local dpi = require("beautiful").xresources.apply_dpi
|
||||
local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
require("Main.Signals")
|
||||
|
||||
-- Icon directory path
|
||||
local icondir = awful.util.getdir("config") .. "theme/crylia/assets/icons/titlebar/"
|
||||
|
||||
awful.titlebar.enable_tooltip = true
|
||||
awful.titlebar.fallback_name = 'Client'
|
||||
@@ -56,8 +60,27 @@ local create_click_events = function (c)
|
||||
return buttons
|
||||
end
|
||||
|
||||
local createresize_click_events = function (c)
|
||||
local buttons = gears.table.join(
|
||||
awful.button(
|
||||
{},
|
||||
1,
|
||||
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 {
|
||||
local titlebar = awful.titlebar(c, {
|
||||
position = "left",
|
||||
bg = bg,
|
||||
size = size
|
||||
})
|
||||
|
||||
titlebar : setup {
|
||||
{
|
||||
{
|
||||
{
|
||||
@@ -66,7 +89,8 @@ local create_titlebar = function (c, bg, size)
|
||||
bg = color.color["Red200"],
|
||||
shape = function (cr, height, width)
|
||||
gears.shape.rounded_rect(cr, width, height, 4)
|
||||
end
|
||||
end,
|
||||
id = "closebutton"
|
||||
},
|
||||
{
|
||||
awful.titlebar.widget.maximizedbutton(c),
|
||||
@@ -74,7 +98,8 @@ local create_titlebar = function (c, bg, size)
|
||||
bg = color.color["Yellow200"],
|
||||
shape = function (cr, height, width)
|
||||
gears.shape.rounded_rect(cr, width, height, 4)
|
||||
end
|
||||
end,
|
||||
id = "maximizebutton"
|
||||
},
|
||||
{
|
||||
awful.titlebar.widget.minimizebutton(c),
|
||||
@@ -82,21 +107,34 @@ local create_titlebar = function (c, bg, size)
|
||||
bg = color.color["Green200"],
|
||||
shape = function (cr, height, width)
|
||||
gears.shape.rounded_rect(cr, width, height, 4)
|
||||
end
|
||||
end,
|
||||
id = "minimizebutton"
|
||||
},
|
||||
spacing = dpi(10),
|
||||
layout = wibox.layout.fixed.vertical
|
||||
layout = wibox.layout.fixed.vertical,
|
||||
id = "spacing"
|
||||
},
|
||||
margins = dpi(8),
|
||||
widget = wibox.container.margin
|
||||
widget = wibox.container.margin,
|
||||
id = "margin"
|
||||
},
|
||||
{
|
||||
buttons = create_click_events(c),
|
||||
layout = wibox.layout.flex.vertical
|
||||
},
|
||||
nil,
|
||||
layout = wibox.layout.align.vertical
|
||||
{
|
||||
{
|
||||
widget = awful.widget.clienticon(c)
|
||||
},
|
||||
margins = dpi(5),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
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"])
|
||||
end
|
||||
|
||||
local create_titlebar_dialog = function(c, bg, size)
|
||||
@@ -134,8 +172,55 @@ local create_titlebar_dialog = function(c, bg, size)
|
||||
}
|
||||
end
|
||||
|
||||
local create_titlebar_borderhack = function (c, bg, position)
|
||||
local borderhack = awful.titlebar(c, {
|
||||
position = position,
|
||||
bg = bg,
|
||||
size = "2"
|
||||
})
|
||||
borderhack : setup {
|
||||
{
|
||||
bg = bg,
|
||||
widget = wibox.container.background
|
||||
},
|
||||
{
|
||||
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 ()
|
||||
local w = mouse.current_client
|
||||
if w then
|
||||
old_cursor, old_wibox = w.cursor, w
|
||||
w.cursor = "hand1"
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
borderhack:connect_signal(
|
||||
"mouse::leave",
|
||||
function ()
|
||||
if old_wibox then
|
||||
old_wibox.cursor = old_cursor
|
||||
old_wibox = nil
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
end
|
||||
|
||||
local draw_titlebar = function (c)
|
||||
if c.type == 'normal' then
|
||||
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")
|
||||
|
||||
if c.class == 'Firefox' then
|
||||
create_titlebar(c, '#121212AA', 35)
|
||||
elseif c.name == "Steam" then
|
||||
@@ -150,16 +235,47 @@ local draw_titlebar = function (c)
|
||||
elseif c.type == 'dialog' then
|
||||
create_titlebar_dialog(c, '#121212AA', 35)
|
||||
elseif c.type == 'modal' then
|
||||
create_titlebar(c, '#121212AA', 35)
|
||||
else
|
||||
create_titlebar_borderhack(c, "#121212AA", "right")
|
||||
create_titlebar_borderhack(c, "#121212AA", "top")
|
||||
create_titlebar_borderhack(c, "#121212AA", "bottom")
|
||||
create_titlebar_borderhack(c, "#121212AA", "left")
|
||||
end
|
||||
end
|
||||
|
||||
client.connect_signal(
|
||||
"property::maximized",
|
||||
function (c)
|
||||
if c.maximized then
|
||||
Theme.titlebar_maximized_button_normal = icondir .. "unmaximize.svg"
|
||||
Theme.titlebar_maximized_button_active = icondir .. "unmaximize.svg"
|
||||
Theme.titlebar_maximized_button_inactive = icondir .. "unmaximize.svg"
|
||||
elseif not c.minimized then
|
||||
Theme.titlebar_maximized_button_normal = icondir .. "maximize.svg"
|
||||
Theme.titlebar_maximized_button_active = icondir .. "maximize.svg"
|
||||
Theme.titlebar_maximized_button_inactive = icondir .. "maximize.svg"
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
client.connect_signal(
|
||||
"request::titlebars",
|
||||
function (c)
|
||||
if c.maximized then
|
||||
Theme.titlebar_maximized_button_normal = icondir .. "unmaximize.svg"
|
||||
Theme.titlebar_maximized_button_active = icondir .. "unmaximize.svg"
|
||||
Theme.titlebar_maximized_button_inactive = icondir .. "unmaximize.svg"
|
||||
elseif not c.minimized then
|
||||
Theme.titlebar_maximized_button_normal = icondir .. "maximize.svg"
|
||||
Theme.titlebar_maximized_button_active = icondir .. "maximize.svg"
|
||||
Theme.titlebar_maximized_button_inactive = icondir .. "maximize.svg"
|
||||
end
|
||||
draw_titlebar(c)
|
||||
if not c.floating then
|
||||
if not c.floating or c.maximized then
|
||||
awful.titlebar.hide(c, 'left')
|
||||
awful.titlebar.hide(c, 'right')
|
||||
awful.titlebar.hide(c, 'top')
|
||||
awful.titlebar.hide(c, 'bottom')
|
||||
end
|
||||
end
|
||||
)
|
||||
@@ -167,14 +283,23 @@ client.connect_signal(
|
||||
client.connect_signal(
|
||||
'property::floating',
|
||||
function (c)
|
||||
if c.floating then
|
||||
if c.floating and not c.maximized then
|
||||
if c.class == "Steam" then
|
||||
awful.titlebar.hide(c, 'left')
|
||||
awful.titlebar.hide(c, 'right')
|
||||
awful.titlebar.hide(c, 'top')
|
||||
awful.titlebar.hide(c, 'bottom')
|
||||
else
|
||||
awful.titlebar.show(c, 'left')
|
||||
awful.titlebar.show(c, 'right')
|
||||
awful.titlebar.show(c, 'top')
|
||||
awful.titlebar.show(c, 'bottom')
|
||||
end
|
||||
else
|
||||
awful.titlebar.hide(c, 'left')
|
||||
awful.titlebar.hide(c, 'right')
|
||||
awful.titlebar.hide(c, 'top')
|
||||
awful.titlebar.hide(c, 'bottom')
|
||||
end
|
||||
end
|
||||
)
|
||||
@@ -13,7 +13,7 @@ local wibox = require("wibox")
|
||||
local icondir = awful.util.getdir("config") .. "theme/crylia/assets/icons/audio/"
|
||||
|
||||
-- Returns the volume_osd
|
||||
return function ()
|
||||
return function (s)
|
||||
|
||||
local volume_osd_widget = wibox.widget{
|
||||
{
|
||||
@@ -163,5 +163,63 @@ return function ()
|
||||
)
|
||||
|
||||
update_slider()
|
||||
return volume_osd_widget
|
||||
|
||||
local volume_container = awful.popup{
|
||||
widget = wibox.container.background,
|
||||
ontop = true,
|
||||
bg = color.color["Grey900"],
|
||||
stretch = false,
|
||||
visible = false,
|
||||
placement = function (c) awful.placement.bottom_right(c, {margins = dpi(10)}) end,
|
||||
shape = function (cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end
|
||||
}
|
||||
|
||||
local hide_volume_osd = gears.timer{
|
||||
timeout = 2,
|
||||
autostart = true,
|
||||
callback = function ()
|
||||
volume_container.visible = false
|
||||
end
|
||||
}
|
||||
|
||||
volume_container:setup{
|
||||
volume_osd_widget,
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
}
|
||||
|
||||
awesome.connect_signal(
|
||||
"module::volume_osd:show",
|
||||
function ()
|
||||
volume_container.visible = true
|
||||
end
|
||||
)
|
||||
|
||||
volume_container:connect_signal(
|
||||
"mouse::enter",
|
||||
function ()
|
||||
volume_container.visible = true
|
||||
hide_volume_osd:stop()
|
||||
end
|
||||
)
|
||||
|
||||
volume_container:connect_signal(
|
||||
"mouse::leave",
|
||||
function ()
|
||||
volume_container.visible = true
|
||||
hide_volume_osd:again()
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
"widget::volume_osd:rerun",
|
||||
function ()
|
||||
if hide_volume_osd.started then
|
||||
hide_volume_osd:again()
|
||||
else
|
||||
hide_volume_osd:start()
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
Reference in New Issue
Block a user