From 7f28224bf1936fe7df8c3458a88d8abe28f06862 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 18 Nov 2021 19:30:30 +0100 Subject: [PATCH] panik --- awesome/.vscode/launch.json | 21 ++ awesome/.vscode/settings.json | 12 + awesome/Bindings/BindToTags.lua | 69 ++++ awesome/Bindings/ClientButtons.lua | 22 ++ awesome/Bindings/ClientKeys.lua | 52 +++ awesome/Bindings/GlobalButtons.lua | 14 + awesome/Bindings/GlobalKeys.lua | 352 ++++++++++++++++++ awesome/CryliaBar/CenterBar.lua | 42 +++ awesome/CryliaBar/LeftBar.lua | 49 +++ awesome/CryliaBar/RightBar.lua | 99 +++++ awesome/CryliaBar/init.lua | 34 ++ awesome/Main/ErrorHandling.lua | 33 ++ awesome/Main/Layouts.lua | 14 + awesome/Main/Menu.lua | 38 ++ awesome/Main/Rules.lua | 53 +++ awesome/Main/Signals.lua | 101 +++++ awesome/Main/Tags.lua | 23 ++ awesome/Main/Theme.lua | 19 + awesome/Main/UserVariables.lua | 18 + awesome/Main/Wallpaper.lua | 18 + awesome/rc.lua | 79 ++-- awesome/start-xephyr.sh | 2 + awesome/theme/crylia/Tools/IconHandler.lua | 21 ++ .../assets/icons/powermenu/defaultpfp.svg | 6 +- .../crylia/assets/icons/powermenu/lock.svg | 6 +- .../crylia/assets/icons/powermenu/logout.svg | 6 +- .../crylia/assets/icons/powermenu/reboot.svg | 6 +- .../assets/icons/powermenu/shutdown.svg | 6 +- .../crylia/assets/icons/powermenu/suspend.svg | 6 +- .../crylia/assets/icons/titlebar/maximize.svg | 2 +- .../crylia/assets/icons/titlebar/stick.svg | 1 + .../assets/icons/titlebar/unmaximize.svg | 1 + .../crylia/assets/icons/titlebar/unstick.svg | 1 + awesome/theme/crylia/layouts.lua | 8 +- .../theme/crylia/modules/brightness_osd.lua | 64 +++- awesome/theme/crylia/modules/calendar_osd.lua | 63 +++- awesome/theme/crylia/modules/powermenu.lua | 93 ++++- awesome/theme/crylia/modules/titlebar.lua | 149 +++++++- awesome/theme/crylia/modules/volume_osd.lua | 62 ++- awesome/theme/crylia/theme_variables.lua | 2 + awesome/theme/crylia/widgets/audio.lua | 37 +- awesome/theme/crylia/widgets/battery.lua | 41 +- awesome/theme/crylia/widgets/bluetooth.lua | 40 +- awesome/theme/crylia/widgets/clock.lua | 41 +- awesome/theme/crylia/widgets/date.lua | 30 +- awesome/theme/crylia/widgets/kblayout.lua | 34 +- awesome/theme/crylia/widgets/layout_list.lua | 36 +- awesome/theme/crylia/widgets/network.lua | 46 +-- awesome/theme/crylia/widgets/power.lua | 35 +- awesome/theme/crylia/widgets/taglist.lua | 47 ++- awesome/theme/crylia/widgets/tasklist.lua | 11 +- 51 files changed, 1632 insertions(+), 433 deletions(-) create mode 100644 awesome/.vscode/launch.json create mode 100644 awesome/.vscode/settings.json create mode 100644 awesome/Bindings/BindToTags.lua create mode 100644 awesome/Bindings/ClientButtons.lua create mode 100644 awesome/Bindings/ClientKeys.lua create mode 100644 awesome/Bindings/GlobalButtons.lua create mode 100644 awesome/Bindings/GlobalKeys.lua create mode 100644 awesome/CryliaBar/CenterBar.lua create mode 100644 awesome/CryliaBar/LeftBar.lua create mode 100644 awesome/CryliaBar/RightBar.lua create mode 100644 awesome/CryliaBar/init.lua create mode 100644 awesome/Main/ErrorHandling.lua create mode 100644 awesome/Main/Layouts.lua create mode 100644 awesome/Main/Menu.lua create mode 100644 awesome/Main/Rules.lua create mode 100644 awesome/Main/Signals.lua create mode 100644 awesome/Main/Tags.lua create mode 100644 awesome/Main/Theme.lua create mode 100644 awesome/Main/UserVariables.lua create mode 100644 awesome/Main/Wallpaper.lua create mode 100755 awesome/start-xephyr.sh create mode 100644 awesome/theme/crylia/Tools/IconHandler.lua create mode 100644 awesome/theme/crylia/assets/icons/titlebar/stick.svg create mode 100644 awesome/theme/crylia/assets/icons/titlebar/unmaximize.svg create mode 100644 awesome/theme/crylia/assets/icons/titlebar/unstick.svg diff --git a/awesome/.vscode/launch.json b/awesome/.vscode/launch.json new file mode 100644 index 0000000..db6a50c --- /dev/null +++ b/awesome/.vscode/launch.json @@ -0,0 +1,21 @@ +{ + // Verwendet IntelliSense zum Ermitteln möglicher Attribute. + // Zeigen Sie auf vorhandene Attribute, um die zugehörigen Beschreibungen anzuzeigen. + // Weitere Informationen finden Sie unter https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "lua-local", + "request": "launch", + "name": "Debug with Xephyr", + "program": { + "command": "${workspaceFolder}/start-xephyr.sh" + }, + "args": [ + "/usr/bin/Xephyr", + "/usr/bin/awesome", + "${workspaceFolder}/init.lua" + ], + } + ] +} \ No newline at end of file diff --git a/awesome/.vscode/settings.json b/awesome/.vscode/settings.json new file mode 100644 index 0000000..c579bc5 --- /dev/null +++ b/awesome/.vscode/settings.json @@ -0,0 +1,12 @@ +{ + "Lua.diagnostics.globals": [ + "awesome", + "client", + "screen", + "mouse", + "root", + "mykeyboardlayout", + "modkey", + "hover_signal" + ] +} \ No newline at end of file diff --git a/awesome/Bindings/BindToTags.lua b/awesome/Bindings/BindToTags.lua new file mode 100644 index 0000000..cea0778 --- /dev/null +++ b/awesome/Bindings/BindToTags.lua @@ -0,0 +1,69 @@ +-- Awesome Libs +local awful = require("awful") +local gears = require("gears") + +local modkey = RC.vars.modkey + +return function (globalkeys) + for i = 1, 9 do + globalkeys = gears.table.join(globalkeys, + + -- View tag only + awful.key( + {modkey}, + "#" .. i + 9, + function() + local screen = awful.screen.focused() + local tag = screen.tags[i] + if tag then + tag:view_only() + end + client.emit_signal("tag::switched") + end, + {description = "View Tag " .. i, group = "Tag"} + ), + -- Brings the window over without chaning the tag, reverts automatically on tag change + awful.key( + {modkey, "Control"}, + "#" .. i + 9, + function() + local screen = awful.screen.focused() + local tag = screen.tags[i] + if tag then + awful.tag.viewtoggle(tag) + end + end, + {description = "Toggle Tag " .. i, group = "Tag"} + ), + -- Brings the window over without chaning the tag, reverts automatically on tag change + awful.key( + {modkey, "Shift"}, + "#" .. i + 9, + function() + local screen = awful.screen.focused() + if client.focus then + local tag = screen.tags[i] + if tag then + client.focus:move_to_tag(tag) + end + end + end, + {description = "Move focused client on tag " .. i, group = "Tag"} + ), + -- Brings the window over without chaning the tag, reverts automatically on tag change + awful.key( + {modkey, "Control", "Shift"}, + "#" .. i + 9, + function() + local screen = awful.screen.focused() + local tag = screen.tags[i] + if tag then + awful.tag.viewtoggle(tag) + end + end, + {description = "Move focused client on tag " .. i, group = "Tag"} + ) + ) + end + return globalkeys +end \ No newline at end of file diff --git a/awesome/Bindings/ClientButtons.lua b/awesome/Bindings/ClientButtons.lua new file mode 100644 index 0000000..90758b9 --- /dev/null +++ b/awesome/Bindings/ClientButtons.lua @@ -0,0 +1,22 @@ +-- Awesome Libs +local awful = require("awful") +local gears = require("gears") + +local modkey = RC.vars.modkey + +return function () + local clientbuttons = gears.table.join( + awful.button({ }, 1, function (c) + c:emit_signal("request::activate", "mouse_click", { raise = true }) + end), + awful.button({ modkey }, 1, function (c) + c:emit_signal("request::activate", "mouse_click", { raise = true }) + awful.mouse.client.move(c) + end), + awful.button({ modkey }, 3, function (c) + c:emit_signal("request::activate", "mouse_click", { raise = true }) + awful.mouse.client.resize(c) + end) + ) + return clientbuttons +end \ No newline at end of file diff --git a/awesome/Bindings/ClientKeys.lua b/awesome/Bindings/ClientKeys.lua new file mode 100644 index 0000000..de0572d --- /dev/null +++ b/awesome/Bindings/ClientKeys.lua @@ -0,0 +1,52 @@ +-- Awesome Libs +local awful = require("awful") +local gears = require("gears") + +local modkey = RC.vars.modkey + +return function () + local clientkeys = gears.table.join( + awful.key( + { modkey }, + "f", + function(c) + c.fullscreen = not c.fullscreen + c:raise() + end, + { description = "Toggle fullscreen", group = "Client" } + ), + awful.key( + { modkey }, + "q", + function(c) + c:kill() + end, + { description = "Close window", group = "Client" } + ), + awful.key( + { modkey }, + "space", + awful.client.floating.toggle, + { description = "Toggle floating window", group = "Client" } + ), + awful.key( + { modkey}, + "m", + function (c) + c.maximized = not c.maximized + c:raise() + end , + {description = "(un)maximize", group = "client"} + ), + awful.key( + { modkey, "Control" }, + "m", + function (c) + c.maximized_vertical = not c.maximized_vertical + c:raise() + end, + { description = "Unmaximize", group = "client"} + ) + ) + return clientkeys +end \ No newline at end of file diff --git a/awesome/Bindings/GlobalButtons.lua b/awesome/Bindings/GlobalButtons.lua new file mode 100644 index 0000000..84f3c6b --- /dev/null +++ b/awesome/Bindings/GlobalButtons.lua @@ -0,0 +1,14 @@ +-- Awesome Libs +local gears = require("gears") +local awful = require("awful") + +return function () + local globalbuttons = gears.table.join( + awful.button({ }, 3, function() + RC.MainMenu:toggle() + end), + awful.button({ }, 4, awful.tag.viewnext), + awful.button({ }, 5, awful.tag.viewprev) + ) + return globalbuttons +end \ No newline at end of file diff --git a/awesome/Bindings/GlobalKeys.lua b/awesome/Bindings/GlobalKeys.lua new file mode 100644 index 0000000..acd64eb --- /dev/null +++ b/awesome/Bindings/GlobalKeys.lua @@ -0,0 +1,352 @@ +-- Awesome Libs +local gears = require("gears") +local awful = require("awful") +local hotkeys_popup = require("awful.hotkeys_popup") + +-- Resource Configuration +local modkey = RC.vars.modkey + +return function() + local globalkeys = gears.table.join( + awful.key( + { modkey }, + "s", + hotkeys_popup.show_help, + {description="Cheet Sheet", group="Awesome"} + ), + -- Tag browsing + awful.key( + { modkey }, + "Left", + awful.tag.viewprev, + {description = "View previous", group = "Tag"} + ), + awful.key( + { modkey }, + "Right", + awful.tag.viewnext, + {description = "View next", group = "Tag"} + ), + awful.key( + { modkey }, + "Escape", + awful.tag.history.restore, + {description = "Go back", group = "Tag"} + ), + awful.key( + { modkey }, + "j", + function () + awful.client.focus.byidx( 1) + end, + {description = "Focus next by index", group = "Client"} + ), + awful.key( + { modkey }, + "k", + function () + awful.client.focus.byidx(-1) + end, + {description = "Focus previous by index", group = "Client"} + ), + awful.key( + { modkey }, + "w", + function () + RC.MainMenu:show() + end, + {description = "Show main menu", group = "Awesome"} + ), + awful.key( + { modkey, "Shift" }, + "j", + function () + awful.client.swap.byidx( 1) + end, + {description = "Swap with next client by index", group = "Client"} + ), + awful.key( + { modkey, "Shift" }, + "k", + function () + awful.client.swap.byidx( -1) + end, + {description = "Swap with previous client by index", group = "Client"} + ), + awful.key( + { modkey, "Control" }, + "j", + function () + awful.screen.focus_relative( 1) + end, + {description = "Focus the next screen", group = "Screen"} + ), + awful.key( + { modkey, "Control" }, + "k", + function () + awful.screen.focus_relative(-1) + end, + {description = "Focus the previous screen", group = "Screen"} + ), + awful.key( + { modkey }, + "u", + awful.client.urgent.jumpto, + {description = "Jump to urgent client", group = "Client"}), + awful.key( + { modkey }, + "Tab", + function () + awful.client.focus.history.previous() + if client.focus then + client.focus:raise() + end + end, + {description = "Go back", group = "Client"} + ), + awful.key( + { modkey }, + "Return", + function () + awful.spawn("alacritty -o font.size=8") + end, + {description = "Open terminal", group = "Launcher"} + ), + awful.key( + { modkey, "Control" }, + "r", + awesome.restart, + {description = "Reload awesome", group = "Awesome"} + ), + awful.key( + { modkey }, + "l", + function () + awful.tag.incmwfact( 0.05) + end, + {description = "Increase master width factor", group = "Layout"} + ), + awful.key( + { modkey }, + "h", + function () + awful.tag.incmwfact(-0.05) + end, + {description = "Decrease master width factor", group = "Layout"} + ), + awful.key( + { modkey, "Shift" }, + "h", + function () + awful.tag.incnmaster( 1, nil, true) + end, + {description = "Increase the number of master clients", group = "Layout"} + ), + awful.key( + { modkey, "Shift" }, + "l", + function () + awful.tag.incnmaster(-1, nil, true) + end, + {description = "Decrease the number of master clients", group = "Layout"} + ), + awful.key( + { modkey, "Control" }, + "h", + function () + awful.tag.incncol( 1, nil, true) + end, + {description = "Increase the number of columns", group = "Layout"} + ), + awful.key( + { modkey, "Control" }, + "l", + function () + awful.tag.incncol(-1, nil, true) + end, + {description = "Decrease the number of columns", group = "Layout"} + ), + awful.key( + { modkey, "Shift" }, + "space", + function () + awful.layout.inc(-1) + end, + {description = "Select previous", group = "Layout"} + ), + awful.key( + { modkey, "Control" }, + "n", + function () + local c = awful.client.restore() + -- Focus restored client + if c then + c:emit_signal( + "request::activate", "key.unminimize", {raise = true} + ) + end + end, + {description = "Restore minimized", group = "Client"} + ), + awful.key( + { modkey, "Control" }, + "Up", + function () + awful.client.moveresize( 0, 0, 0, -20) + end + ), + awful.key( + { modkey, "Control" }, + "Down", + function () + awful.client.moveresize( 0, 0, 0, 20) + end + ), + awful.key( + { modkey, "Control" }, + "Left", + function () + awful.client.moveresize( 0, 0, -20, 0) + end + ), + awful.key( + { modkey, "Control" }, + "Right", + function () + awful.client.moveresize( 0, 0, 20, 0) + end + ), + awful.key( + { modkey, "Shift" }, + "Down", + function () + awful.client.moveresize( 0, 20, 0, 0) + end + ), + awful.key( + { modkey, "Shift" }, + "Up", + function () + awful.client.moveresize( 0, -20, 0, 0) + end + ), + awful.key( + { modkey, "Shift" }, + "Left", + function () + awful.client.moveresize(-20, 0, 0, 0) + end + ), + awful.key( + { modkey, "Shift" }, + "Right", + function () + awful.client.moveresize( 20, 0, 0, 0) + end + ), + awful.key( + { modkey }, + "d", + function () + awful.spawn("rofi -show drun -theme ~/.config/rofi/appmenu/rofi.rasi") + end, + { descripton = "Application searcher", group = "Application" } + ), + awful.key( + { modkey }, + "Tab", + function () + awful.spawn("rofi -show window -theme ~/.config/rofi/appmenu/rofi.rasi") + end, + { descripton = "Show all open windows", group = "Application" } + ), + awful.key( + { modkey }, + "e", + function () + awful.spawn("thunar") + end, + { descripton = "Open Thunar File Manager", group = "System" } + ), + awful.key( + { modkey, "Shift" }, + "e", + function () + awesome.emit_signal("module::powermenu:show") + end, + { descripton = "Open the exit window", group = "System" } + ), + awful.key( + { }, + "Print", + function () + awful.spawn("flameshot gui") + end + ), + awful.key( + { }, + "XF86AudioLowerVolume", + function (c) + awful.spawn("amixer sset Master 5%-") + awesome.emit_signal("widget::volume") + awesome.emit_signal("module::volume_osd:show", true) + awesome.emit_signal("module::slider:update") + awesome.emit_signal("widget::volume_osd:rerun") + end + ), + awful.key( + { }, + "XF86AudioRaiseVolume", + function (c) + awful.spawn("amixer sset Master 5%+") + awesome.emit_signal("widget::volume") + awesome.emit_signal("module::volume_osd:show", true) + awesome.emit_signal("module::slider:update") + awesome.emit_signal("widget::volume_osd:rerun") + end + ), + awful.key( + { }, + "XF86AudioMute", + function (c) + awful.spawn("pactl -- set-sink-mute @DEFAULT_SINK@ toggle") + awesome.emit_signal("widget::volume") + awesome.emit_signal("module::volume_osd:show", true) + awesome.emit_signal("module::slider:update") + awesome.emit_signal("widget::volume_osd:rerun") + + end + ), + awful.key( + { modkey }, + "F5", + function (c) + awful.spawn("xbacklight -inc 10%+") + awesome.emit_signal("module::brightness_osd:show", true) + awesome.emit_signal("module::brightness_slider:update") + awesome.emit_signal("widget::brightness_osd:rerun") + end + ), + awful.key( + { modkey }, + "F4", + function (c) + awful.spawn("xbacklight -dec 10%-") + awesome.emit_signal("widget::brightness_osd:rerun") + awesome.emit_signal("module::brightness_osd:show", true) + awesome.emit_signal("module::brightness_slider:update") + end + ), + awful.key( + { modkey, "Shift" }, + "q", + function () + local t = awful.screen.focused().selected_tag + t:delete() + end + ) + ) + + return globalkeys +end diff --git a/awesome/CryliaBar/CenterBar.lua b/awesome/CryliaBar/CenterBar.lua new file mode 100644 index 0000000..b6a5367 --- /dev/null +++ b/awesome/CryliaBar/CenterBar.lua @@ -0,0 +1,42 @@ +-------------------------------------------------------------------------------------------------------------- +-- This is the statusbar, every widget, module and so on is combined to all the stuff you see on the screen -- +-------------------------------------------------------------------------------------------------------------- +-- Awesome Libs +local awful = require("awful") +local colors = require ("theme.crylia.colors") +local dpi = require("beautiful").xresources.apply_dpi +local gears = require("gears") +local wibox = require("wibox") + +return function (s, widget) + + local top_center = awful.popup{ + widget = wibox.container.background, + ontop = false, + bg = colors.color["Grey900"], + stretch = false, + visible = true, + maximum_width = dpi(500), + placement = function (c) awful.placement.top(c, {margins = dpi(10)}) end, + shape = function (cr, width, height) + gears.shape.rounded_rect(cr, width, height, 10) + end + } + + top_center:setup{ + { + widget, + margins = dpi(6), + widget = wibox.container.margin + }, + forced_height = 45, + layout = wibox.layout.align.horizontal + } + + awesome.connect_signal( + "hide_centerbar", + function (hide) + top_center.visible = hide + end + ) +end \ No newline at end of file diff --git a/awesome/CryliaBar/LeftBar.lua b/awesome/CryliaBar/LeftBar.lua new file mode 100644 index 0000000..6552b9a --- /dev/null +++ b/awesome/CryliaBar/LeftBar.lua @@ -0,0 +1,49 @@ +-------------------------------------------------------------------------------------------------------------- +-- This is the statusbar, every widget, module and so on is combined to all the stuff you see on the screen -- +-------------------------------------------------------------------------------------------------------------- +-- Awesome Libs +local awful = require("awful") +local colors = require ("theme.crylia.colors") +local dpi = require("beautiful").xresources.apply_dpi +local gears = require("gears") +local wibox = require("wibox") + +return function (s, widgets) + + local top_left = awful.popup{ + widget = wibox.container.background, + ontop = false, + bg = colors.color["Grey900"], + stretch = false, + visible = true, + maximum_width = dpi(650), + placement = function(c) awful.placement.top_left(c, {margins = dpi(10)}) end, + shape = function (cr, width, height) + gears.shape.rounded_rect(cr, width, height, 10) + end + } + + top_left:struts{ + top = 55 + } + + top_left:setup { + nil, + nil, + { + { + widgets[1], + margins = dpi(6), + widget = wibox.container.margin + }, + { + widgets[2], + margins = dpi(6), + widget = wibox.container.margin + }, + forced_height = 45, + layout = wibox.layout.fixed.horizontal + }, + layout = wibox.layout.align.horizontal + } +end \ No newline at end of file diff --git a/awesome/CryliaBar/RightBar.lua b/awesome/CryliaBar/RightBar.lua new file mode 100644 index 0000000..5dc996c --- /dev/null +++ b/awesome/CryliaBar/RightBar.lua @@ -0,0 +1,99 @@ +-------------------------------------------------------------------------------------------------------------- +-- This is the statusbar, every widget, module and so on is combined to all the stuff you see on the screen -- +-------------------------------------------------------------------------------------------------------------- +-- Awesome Libs +local awful = require("awful") +local colors = require ("theme.crylia.colors") +local dpi = require("beautiful").xresources.apply_dpi +local gears = require("gears") +local wibox = require("wibox") + +return function (s, widgets) + + local top_right = awful.popup{ + widget = wibox.container.background, + ontop = false, + bg = colors.color["Grey900"], + stretch = false, + visible = true, + screen = s, + placement = function (c) awful.placement.top_right(c, {margins = dpi(10)}) end, + shape = function (cr, width, height) + gears.shape.rounded_rect(cr, width, height, 10) + end + } + + top_right:setup { + nil, + nil, + { + { + widgets[1], + left = dpi(6), + right = dpi(3), + top = dpi(6), + bottom = dpi(6), + widget = wibox.container.margin + }, + { + widgets[2], + left = dpi(3), + right = dpi(3), + top = dpi(6), + bottom = dpi(6), + widget = wibox.container.margin + }, + { + widgets[3], + left = dpi(3), + right = dpi(3), + top = dpi(6), + bottom = dpi(6), + widget = wibox.container.margin + }, + { + widgets[4], + left = dpi(3), + right = dpi(3), + top = dpi(6), + bottom = dpi(6), + widget = wibox.container.margin + }, + { + widgets[5], + left = dpi(3), + right = dpi(3), + top = dpi(6), + bottom = dpi(6), + widget = wibox.container.margin + }, + { + widgets[6], + left = dpi(3), + right = dpi(3), + top = dpi(6), + bottom = dpi(6), + widget = wibox.container.margin + }, + { + widgets[7], + left = dpi(3), + right = dpi(3), + top = dpi(6), + bottom = dpi(6), + widget = wibox.container.margin + }, + { + widgets[8], + left = dpi(3), + right = dpi(6), + top = dpi(6), + bottom = dpi(6), + widget = wibox.container.margin + }, + forced_height = 45, + layout = wibox.layout.fixed.horizontal + }, + layout = wibox.layout.align.horizontal + } +end \ No newline at end of file diff --git a/awesome/CryliaBar/init.lua b/awesome/CryliaBar/init.lua new file mode 100644 index 0000000..cb7266d --- /dev/null +++ b/awesome/CryliaBar/init.lua @@ -0,0 +1,34 @@ +-------------------------------------------------------------------------------------------------------------- +-- This is the statusbar, every widget, module and so on is combined to all the stuff you see on the screen -- +-------------------------------------------------------------------------------------------------------------- +-- Awesome Libs +local awful = require("awful") + +awful.screen.connect_for_each_screen( + function (s) + -- Modules + require("theme.crylia.modules.powermenu")(s) + require("theme.crylia.modules.calendar_osd")(s) + require("theme.crylia.modules.volume_osd")(s) + require("theme.crylia.modules.brightness_osd")(s) + require("theme.crylia.modules.titlebar") + + -- Widgets + s.battery = require("theme.crylia.widgets.battery")() + s.network = require("theme.crylia.widgets.network")() + s.audio = require("theme.crylia.widgets.audio")() + s.date = require("theme.crylia.widgets.date")() + s.clock = require("theme.crylia.widgets.clock")() + s.bluetooth = require("theme.crylia.widgets.bluetooth")() + s.layoutlist = require("theme.crylia.widgets.layout_list")() + s.powerbutton = require("theme.crylia.widgets.power")() + s.kblayout = require("theme.crylia.widgets.kblayout")() + s.taglist = require("theme.crylia.widgets.taglist")(s) + s.tasklist = require("theme.crylia.widgets.tasklist")(s) + + -- Bars + require("CryliaBar.LeftBar")(s, {s.layoutlist, s.taglist}) + require("CryliaBar.CenterBar")(s, s.tasklist) + require("CryliaBar.RightBar")(s, {s.battery, s.network, s.bluetooth, s.audio, s.kblayout, s.date, s.clock,s.powerbutton}) + end +) diff --git a/awesome/Main/ErrorHandling.lua b/awesome/Main/ErrorHandling.lua new file mode 100644 index 0000000..3036f68 --- /dev/null +++ b/awesome/Main/ErrorHandling.lua @@ -0,0 +1,33 @@ +---------------------------------------------------------------- +-- This class is to output an error if you fuck up the config -- +---------------------------------------------------------------- +-- Awesome Libs +local naughty = require("naughty") + +if awesome.startup_errors then + naughty.notify({ + preset = naughty.config.presets.critical, + title = "ERROR in Awesome config!", + text = awesome.startup_errors + }) +end + +do + local in_error = false + awesome.connect_signal( + "debug::error", + function (err) + if in_error then + return + end + in_error = true + + naughty.notify({ + preset = naughty.config.presets.critical, + title = "ERROR", + text = tostring(err) + }) + in_error = false + end + ) +end \ No newline at end of file diff --git a/awesome/Main/Layouts.lua b/awesome/Main/Layouts.lua new file mode 100644 index 0000000..89be572 --- /dev/null +++ b/awesome/Main/Layouts.lua @@ -0,0 +1,14 @@ +------------------------------------------------------------------------------------------ +-- Layout class, if you want to add or remove layouts from the list do it in this table -- +------------------------------------------------------------------------------------------ +-- Awesome Libs +local awful = require("awful") + +return function () + local layouts = { + awful.layout.suit.tile, + awful.layout.suit.floating, + } + + return layouts +end \ No newline at end of file diff --git a/awesome/Main/Menu.lua b/awesome/Main/Menu.lua new file mode 100644 index 0000000..3642a3b --- /dev/null +++ b/awesome/Main/Menu.lua @@ -0,0 +1,38 @@ +-------------------------------------------------------------- +-- Menu class, this is where you change the rightclick menu -- +-------------------------------------------------------------- +-- Awesome Libs +local awful = require("awful") + +-- Module Namespace +local _M = { } + +local session = { + { "Logout", function () awesome.quit() end }, + { "Shutdown", function () awful.spawn.with_shell('shutdown now') end }, + { "Reboot", function () awful.spawn.with_shell('reboot') end }, +} + +local applications = { + { "Firefox", "firefox" }, + { "VS Code", "code" }, + { "Blender", "blender" }, + { "Steam", "steam" }, + { "Lutris", "lutris" }, +} + +local settings = { + { "General Settings", "gnome-control-center" }, + { "Power Settings", "xfce4-power-manager-settings" }, + { "Display Settings", "arandr" } +} + +return function() + local MenuItems = { + { "Power Menu", session }, + { "Applications", applications }, + { "Open Terminal", RC.vars.terminal }, + { "Settings", settings }, + } + return MenuItems +end \ No newline at end of file diff --git a/awesome/Main/Rules.lua b/awesome/Main/Rules.lua new file mode 100644 index 0000000..056b236 --- /dev/null +++ b/awesome/Main/Rules.lua @@ -0,0 +1,53 @@ +------------------------------------------------------------------------------------------------- +-- This class contains rules for float exceptions or special themeing for certain applications -- +------------------------------------------------------------------------------------------------- + +-- Awesome Libs +local awful = require("awful") +local beautiful = require("beautiful") + +return function (clientkeys, clientbuttons) + local rules = { + { + rule = { }, + properties = { + border_width = beautiful.border_width, + border_color = beautiful.border_normal, + focus = awful.client.focus.filter, + raise = true, + keys = clientkeys, + buttons = clientbuttons, + screen = awful.screen.preferred, + placement = awful.placement.no_overlap+awful.placement.no_offscreen + } + }, + { + rule_any = { + instance = { }, + class = { + "Arandr", + "Lxappearance", + "kdeconnect.app", + "zoom", + "file-roller", + "File-roller" + }, + name = { }, + role = { + "AlarmWindow", + "ConfigManager", + "pop-up" + } + }, + properties = { floating = true, titlebars_enabled = true } + }, + { + id = "titlebar", + rule_any = { + type = { "normal", "dialog", "modal", "utility" } + }, + properties = { titlebars_enabled = true } + } + } + return rules +end \ No newline at end of file diff --git a/awesome/Main/Signals.lua b/awesome/Main/Signals.lua new file mode 100644 index 0000000..0e1735a --- /dev/null +++ b/awesome/Main/Signals.lua @@ -0,0 +1,101 @@ +-- Awesome Libs +local awful = require("awful") +local beautiful = require("beautiful") +local gears = require("gears") + + +client.connect_signal( + "manage", + function (c) + if awesome.startup and not c.size_hints.user_porition and not c.size_hints.program_position then + awful.placement.no_offscreen(c) + end + end +) + +client.connect_signal( + 'unmanage', + function(c) + if #awful.screen.focused().clients > 0 then + awful.screen.focused().clients[1]:emit_signal( + 'request::activate', + 'mouse_enter', + { + raise = true + } + ) + end + end +) + +client.connect_signal( + 'tag::switched', + function(c) + if #awful.screen.focused().clients > 0 then + awful.screen.focused().clients[1]:emit_signal( + 'request::activate', + 'mouse_enter', + { + raise = true + } + ) + end + end +) + + +-- Sloppy focus +client.connect_signal("mouse::enter", function(c) + c:emit_signal("request::activate", "mouse_enter", {raise = false}) +end) + +-- Workaround for focused border color, why in the love of god doesnt it work with +-- beautiful.border_focus +client.connect_signal("focus", function (c) + c.border_color = "#616161" +end) + +client.connect_signal("unfocus", function (c) + c.border_color = beautiful.border_normal +end) + +function hover_signal (widget, bg) + local old_wibox, old_cursor, old_bg + widget:connect_signal( + "mouse::enter", + function () + old_bg = widget.bg + widget.bg = bg .. 'dd' + local w = mouse.current_wibox + if w then + old_cursor, old_wibox = w.cursor, w + w.cursor = "hand1" + end + end + ) + + widget:connect_signal( + "button::press", + function () + widget.bg = bg .. 'bb' + end + ) + + widget:connect_signal( + "button::release", + function () + widget.bg = bg .. 'dd' + end + ) + + widget:connect_signal( + "mouse::leave", + function () + widget.bg = old_bg + if old_wibox then + old_wibox.cursor = old_cursor + old_wibox = nil + end + end + ) +end \ No newline at end of file diff --git a/awesome/Main/Tags.lua b/awesome/Main/Tags.lua new file mode 100644 index 0000000..3a1d01d --- /dev/null +++ b/awesome/Main/Tags.lua @@ -0,0 +1,23 @@ +----------------------------------------------------------------------------------------------------- +-- Here are the ammount of tags generated, edit the awful.tag args if you want a different ammount -- +----------------------------------------------------------------------------------------------------- + +-- Awesome Libs +local awful = require("awful") + +return function() + local tags = {} + awful.screen.connect_for_each_screen( + function (s) + tags[s] = awful.tag( + { + "1", "2", "3", "4", "5", "6", "7", "8", "9" + }, + s, + RC.Layouts[1] + ) + end + ) + + return tags +end \ No newline at end of file diff --git a/awesome/Main/Theme.lua b/awesome/Main/Theme.lua new file mode 100644 index 0000000..a7a83dd --- /dev/null +++ b/awesome/Main/Theme.lua @@ -0,0 +1,19 @@ +local awful = require("awful") +local beautiful = require("beautiful") +local gears = require("gears") +local home = os.getenv("HOME") + +beautiful.init(home .. "/.config/awesome/theme/crylia/theme.lua") + +if(RC.vars.wallpaper) then + local wallpaper = RC.vars.wallpaper + if awful.util.file_readable(wallpaper) then + Theme.wallpaper = wallpaper + end +end + +if beautiful.wallpaper then + for s = 1, screen.count() do + gears.wallpaper.maximized(beautiful.wallpaper, s, true) + end +end \ No newline at end of file diff --git a/awesome/Main/UserVariables.lua b/awesome/Main/UserVariables.lua new file mode 100644 index 0000000..e1ec608 --- /dev/null +++ b/awesome/Main/UserVariables.lua @@ -0,0 +1,18 @@ +------------------------------------------- +-- Uservariables are stored in this file -- +------------------------------------------- +local home = os.getenv("HOME") + +-- If you want different default programs, wallpaper path or modkey; edit this file. +local _M = { + -- This is your default Terminal + terminal = "alacritty", + -- This is the modkey 'mod4' = Super/Mod/WindowsKey, 'mod3' = alt... + modkey = "Mod4", + -- place your wallpaper at this path with this name, you could also try to change the path + wallpaper = home .. "/.config/awesome/theme/crylia/assets/wallpaper.jpg", + -- Naming scheme for the powermenu, userhost = "user@hostname", fullname = "Firstname Surname", something else ... + namestyle = "userhost" +} + +return _M \ No newline at end of file diff --git a/awesome/Main/Wallpaper.lua b/awesome/Main/Wallpaper.lua new file mode 100644 index 0000000..8c48c24 --- /dev/null +++ b/awesome/Main/Wallpaper.lua @@ -0,0 +1,18 @@ +--------------------------------------- +-- This function sets your wallpaper -- +--------------------------------------- +-- Awesome Libs +local gears = require("gears") +local beautiful = require("beautiful") + +function Set_wallpaper(s) + if beautiful.wallpaper then + local wallpaper = beautiful.wallpaper + if type(wallpaper) == "function" then + wallpaper = wallpaper(s) + end + gears.wallpaper.maximized(wallpaper, s, true) + end +end + +screen.connect_signal("property::geometry", Set_wallpaper) \ No newline at end of file diff --git a/awesome/rc.lua b/awesome/rc.lua index 7d44aee..dd13292 100644 --- a/awesome/rc.lua +++ b/awesome/rc.lua @@ -6,6 +6,10 @@ -- ██║ ██║╚███╔███╔╝███████╗███████║╚██████╔╝██║ ╚═╝ ██║███████╗╚███╔███╔╝██║ ╚═╝ ██║ -- -- ╚═╝ ╚═╝ ╚══╝╚══╝ ╚══════╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝ ╚══╝╚══╝ ╚═╝ ╚═╝ -- ----------------------------------------------------------------------------------------- +if os.getenv "LOCAL_LUA_DEBUGGER_VSCODE" == "1" then + require("lldebugger").start() +end + -- Default Awesome Libs local awful = require("awful") local beautiful = require("beautiful") @@ -14,84 +18,71 @@ local menubar = require("menubar") -- Global Namespace RC = {} -RC.vars = require("main.user_variables") +RC.vars = require("Main.UserVariables") -- Error Handling -require("main.error_handling") +require("Main.ErrorHandling") -- Default Theme and Custom Wallpaper beautiful.init(gears.filesystem.get_themes_dir() .. "default/theme.lua") beautiful.wallpaper = RC.vars.wallpaper modkey = RC.vars.modkey -require("main.theme") +require("Main.Theme") -- Load Local User Libs -local main = { - layouts = require("main.layouts"), - tags = require("main.tags"), - menu = require("main.menu"), - rules = require("main.rules") +local Main = { + Layouts = require("Main.Layouts"), + Tags = require("Main.Tags"), + Menu = require("Main.Menu"), + Rules = require("Main.Rules") } -- Load all Shortcuts from Local User Libs -local bindings = { - globalbuttons = require("bindings.globalbuttons"), - clientbuttons = require("bindings.clientbuttons"), - globalkeys = require("bindings.globalkeys"), - bindtotags = require("bindings.bindtotags"), - clientkeys = require("bindings.clientkeys") +local Bindings = { + GlobalButtons = require("Bindings.GlobalButtons"), + ClientButtons = require("Bindings.ClientButtons"), + GlobalKeys = require("Bindings.GlobalKeys"), + BindToTags = require("Bindings.BindToTags"), + ClientKeys = require("Bindings.ClientKeys") } --- Sets the local layout to Aweful.layout.inc -RC.layouts = main.layouts() -awful.layout.layouts = main.layouts() +RC.Layouts = Main.Layouts() --- Tag table which holds all screen tags -RC.tags = main.tags() +awful.layout.layouts = Main.Layouts() --- Creates a launcher widget and a main menu -RC.mainmenu = awful.menu({ - items = main.menu() +RC.Tags = Main.Tags() + +RC.MainMenu = awful.menu({ + items = Main.Menu() }) -- A Variable needed in Statusbar (helper) -RC.launcher = awful.widget.launcher({ - image = beautiful.awesome_icon, - menu = RC.mainmenu +RC.Launcher = awful.widget.launcher({ + Image = beautiful.awesome_icon, + Menu = RC.MainMenu }) -- Menubar configuration menubar.utils.terminal = RC.vars.terminal --- Sets the user Keybindings -RC.globalkeys = bindings.globalkeys() -RC.globalkeys = bindings.bindtotags(RC.globalkeys) - -- Set root -root.buttons(bindings.globalbuttons()) -root.keys(RC.globalkeys) +root.buttons(Bindings.GlobalButtons()) +root.keys(Bindings.BindToTags(Bindings.GlobalKeys())) --- Keymap -mykeyboardlayout = awful.widget.keyboardlayout() - --- Default statusbar, uncomment if you dont use a third party tool like polybar -require("deco.statusbar") +-- Default statusbar, comment if you want use a third party tool like polybar +require("CryliaBar.init") -- Rules to apply to new clients -awful.rules.rules = main.rules( - bindings.clientkeys(), - bindings.clientbuttons() +awful.rules.rules = Main.Rules( + Bindings.ClientKeys(), + Bindings.ClientButtons() ) -- Signals -require("main.signals") - --- Titlebar -require("theme.crylia.modules.titlebar") +require("Main.Signals") -- Autostart programs --awful.spawn.with_shell("~/.screenlayout/single_screen.sh") awful.spawn.with_shell("picom --experimental-backends") awful.spawn.with_shell("xfce4-power-manager") -awful.spawn.with_shell("~/.screenlayout/single_screen.sh") diff --git a/awesome/start-xephyr.sh b/awesome/start-xephyr.sh new file mode 100755 index 0000000..608a505 --- /dev/null +++ b/awesome/start-xephyr.sh @@ -0,0 +1,2 @@ +#!/bin/bash +awmtt -c rc.lua -S 1800x900 diff --git a/awesome/theme/crylia/Tools/IconHandler.lua b/awesome/theme/crylia/Tools/IconHandler.lua new file mode 100644 index 0000000..83607a2 --- /dev/null +++ b/awesome/theme/crylia/Tools/IconHandler.lua @@ -0,0 +1,21 @@ +------------------------------ +-- This is the audio widget -- +------------------------------ + +function GetIcon(theme, c) + if theme and c then + local clientName = string.lower(c.class) .. ".svg" + local resolutions = {"128x128", "96x96", "64x64", "48x48", "42x42", "32x32", "24x24", "16x16"} + local home = os.getenv("HOME") + for i, res in ipairs(resolutions) do + local iconDir = home .. "/.icons/" .. theme .. "/" .. res .."/apps/" + local ioStream = io.open(iconDir .. clientName, "r") + if ioStream ~= nil then + return iconDir .. clientName + else + return c:get_icon(1) + end + end + end + return nil +end \ No newline at end of file diff --git a/awesome/theme/crylia/assets/icons/powermenu/defaultpfp.svg b/awesome/theme/crylia/assets/icons/powermenu/defaultpfp.svg index 4adef78..6d69549 100644 --- a/awesome/theme/crylia/assets/icons/powermenu/defaultpfp.svg +++ b/awesome/theme/crylia/assets/icons/powermenu/defaultpfp.svg @@ -1 +1,5 @@ - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/awesome/theme/crylia/assets/icons/powermenu/lock.svg b/awesome/theme/crylia/assets/icons/powermenu/lock.svg index 1aa03e1..123bd04 100644 --- a/awesome/theme/crylia/assets/icons/powermenu/lock.svg +++ b/awesome/theme/crylia/assets/icons/powermenu/lock.svg @@ -1 +1,5 @@ - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/awesome/theme/crylia/assets/icons/powermenu/logout.svg b/awesome/theme/crylia/assets/icons/powermenu/logout.svg index ac9680f..b40ecd7 100644 --- a/awesome/theme/crylia/assets/icons/powermenu/logout.svg +++ b/awesome/theme/crylia/assets/icons/powermenu/logout.svg @@ -1 +1,5 @@ - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/awesome/theme/crylia/assets/icons/powermenu/reboot.svg b/awesome/theme/crylia/assets/icons/powermenu/reboot.svg index ebe3f16..7a91c5f 100644 --- a/awesome/theme/crylia/assets/icons/powermenu/reboot.svg +++ b/awesome/theme/crylia/assets/icons/powermenu/reboot.svg @@ -1 +1,5 @@ - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/awesome/theme/crylia/assets/icons/powermenu/shutdown.svg b/awesome/theme/crylia/assets/icons/powermenu/shutdown.svg index 343d1ba..3b4bebf 100644 --- a/awesome/theme/crylia/assets/icons/powermenu/shutdown.svg +++ b/awesome/theme/crylia/assets/icons/powermenu/shutdown.svg @@ -1 +1,5 @@ - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/awesome/theme/crylia/assets/icons/powermenu/suspend.svg b/awesome/theme/crylia/assets/icons/powermenu/suspend.svg index 8ab0482..8f12bc5 100644 --- a/awesome/theme/crylia/assets/icons/powermenu/suspend.svg +++ b/awesome/theme/crylia/assets/icons/powermenu/suspend.svg @@ -1 +1,5 @@ - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/awesome/theme/crylia/assets/icons/titlebar/maximize.svg b/awesome/theme/crylia/assets/icons/titlebar/maximize.svg index d4a435b..422ad55 100644 --- a/awesome/theme/crylia/assets/icons/titlebar/maximize.svg +++ b/awesome/theme/crylia/assets/icons/titlebar/maximize.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/awesome/theme/crylia/assets/icons/titlebar/stick.svg b/awesome/theme/crylia/assets/icons/titlebar/stick.svg new file mode 100644 index 0000000..c832e29 --- /dev/null +++ b/awesome/theme/crylia/assets/icons/titlebar/stick.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/awesome/theme/crylia/assets/icons/titlebar/unmaximize.svg b/awesome/theme/crylia/assets/icons/titlebar/unmaximize.svg new file mode 100644 index 0000000..12d171f --- /dev/null +++ b/awesome/theme/crylia/assets/icons/titlebar/unmaximize.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/awesome/theme/crylia/assets/icons/titlebar/unstick.svg b/awesome/theme/crylia/assets/icons/titlebar/unstick.svg new file mode 100644 index 0000000..475f722 --- /dev/null +++ b/awesome/theme/crylia/assets/icons/titlebar/unstick.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/awesome/theme/crylia/layouts.lua b/awesome/theme/crylia/layouts.lua index 67b1197..1033370 100644 --- a/awesome/theme/crylia/layouts.lua +++ b/awesome/theme/crylia/layouts.lua @@ -8,7 +8,7 @@ local layout_path = Theme_path .. "assets/layout/" -- Here are the icons for the layouts defined, if you want to add more layouts go to main/layouts.lua Theme.layout_floating = gears.color.recolor_image(layout_path .. "floating.svg", color.color["Grey900"]) Theme.layout_tile = gears.color.recolor_image(layout_path .. "tile.svg", color.color["Grey900"]) -Theme.layout_dwindle = gears.color.recolor_image(layout_path .. "dwindle.svg", color.color["Grey900"]) -Theme.layout_fairh = gears.color.recolor_image(layout_path .. "fairh.svg", color.color["Grey900"]) -Theme.layout_fullscreen = gears.color.recolor_image(layout_path .. "fullscreen.svg", color.color["Grey900"]) -Theme.layout_max = gears.color.recolor_image(layout_path .. "max.svg", color.color["Grey900"]) \ No newline at end of file +--Theme.layout_dwindle = gears.color.recolor_image(layout_path .. "dwindle.svg", color.color["Grey900"]) +--Theme.layout_fairh = gears.color.recolor_image(layout_path .. "fairh.svg", color.color["Grey900"]) +--Theme.layout_fullscreen = gears.color.recolor_image(layout_path .. "fullscreen.svg", color.color["Grey900"]) +--Theme.layout_max = gears.color.recolor_image(layout_path .. "max.svg", color.color["Grey900"]) \ No newline at end of file diff --git a/awesome/theme/crylia/modules/brightness_osd.lua b/awesome/theme/crylia/modules/brightness_osd.lua index e7ce6f6..bccd4ad 100644 --- a/awesome/theme/crylia/modules/brightness_osd.lua +++ b/awesome/theme/crylia/modules/brightness_osd.lua @@ -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 \ No newline at end of file diff --git a/awesome/theme/crylia/modules/calendar_osd.lua b/awesome/theme/crylia/modules/calendar_osd.lua index 413300d..dd4ffb3 100644 --- a/awesome/theme/crylia/modules/calendar_osd.lua +++ b/awesome/theme/crylia/modules/calendar_osd.lua @@ -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 \ No newline at end of file diff --git a/awesome/theme/crylia/modules/powermenu.lua b/awesome/theme/crylia/modules/powermenu.lua index e4a395d..2d1d617 100644 --- a/awesome/theme/crylia/modules/powermenu.lua +++ b/awesome/theme/crylia/modules/powermenu.lua @@ -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 \ No newline at end of file diff --git a/awesome/theme/crylia/modules/titlebar.lua b/awesome/theme/crylia/modules/titlebar.lua index d3b3b04..96f4cbc 100644 --- a/awesome/theme/crylia/modules/titlebar.lua +++ b/awesome/theme/crylia/modules/titlebar.lua @@ -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 ) \ No newline at end of file diff --git a/awesome/theme/crylia/modules/volume_osd.lua b/awesome/theme/crylia/modules/volume_osd.lua index 3f504a0..6c51d85 100644 --- a/awesome/theme/crylia/modules/volume_osd.lua +++ b/awesome/theme/crylia/modules/volume_osd.lua @@ -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 \ No newline at end of file diff --git a/awesome/theme/crylia/theme_variables.lua b/awesome/theme/crylia/theme_variables.lua index b4191ed..e651529 100644 --- a/awesome/theme/crylia/theme_variables.lua +++ b/awesome/theme/crylia/theme_variables.lua @@ -66,3 +66,5 @@ Theme.notification_icon_size = dpi(40) Theme.titlebar_close_button_normal = icondir .. "close.svg" Theme.titlebar_maximized_button_normal = icondir .. "maximize.svg" Theme.titlebar_minimize_button_normal = icondir .. "minimize.svg" +Theme.titlebar_maximized_button_active = icondir .. "maximize.svg" +Theme.titlebar_maximized_button_inactive = icondir .. "maximize.svg" \ No newline at end of file diff --git a/awesome/theme/crylia/widgets/audio.lua b/awesome/theme/crylia/widgets/audio.lua index d932a83..3196eef 100644 --- a/awesome/theme/crylia/widgets/audio.lua +++ b/awesome/theme/crylia/widgets/audio.lua @@ -8,6 +8,7 @@ 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/audio/" @@ -98,43 +99,15 @@ return function () end -- Signals - local old_wibox, old_cursor, old_bg - audio_widget:connect_signal( - "mouse::enter", - function () - old_bg = audio_widget.bg - audio_widget.bg = color.color["Yellow200"] .. "dd" - local w = mouse.current_wibox - if w then - old_cursor, old_wibox = w.cursor, w - w.cursor = "hand1" - end - end - ) + hover_signal(audio_widget, color.color["Yellow200"]) audio_widget:connect_signal( "button::press", function () + awesome.emit_signal("widget::volume") awesome.emit_signal("module::volume_osd:show", true) - audio_widget.bg = color.color["Yellow200"] .. "bb" - end - ) - - audio_widget:connect_signal( - "button::release", - function () - audio_widget.bg = color.color["Yellow200"] .. "dd" - end - ) - - audio_widget:connect_signal( - "mouse::leave", - function () - audio_widget.bg = old_bg - if old_wibox then - old_wibox.cursor = old_cursor - old_wibox = nil - end + awesome.emit_signal("module::slider:update") + awesome.emit_signal("widget::volume_osd:rerun") end ) diff --git a/awesome/theme/crylia/widgets/battery.lua b/awesome/theme/crylia/widgets/battery.lua index 1c7ac03..6a8bc98 100644 --- a/awesome/theme/crylia/widgets/battery.lua +++ b/awesome/theme/crylia/widgets/battery.lua @@ -10,6 +10,7 @@ local gears = require("gears") local naughty = require("naughty") local watch = awful.widget.watch local wibox = require("wibox") +require("Main.Signals") -- Icon directory path local icondir = awful.util.getdir("config") .. "theme/crylia/assets/icons/battery/" @@ -165,45 +166,7 @@ return function () ) end - local old_wibox, old_cursor, old_bg - battery_widget:connect_signal( - "mouse::enter", - function () - old_bg = battery_widget.bg - battery_widget.bg = color.color["Purple200"] .. "dd" - local w = mouse.current_wibox - if w then - old_cursor, old_wibox = w.cursor, w - w.cursor = "hand1" - end - end - ) - - -- Signals - battery_widget:connect_signal( - "button::press", - function () - battery_widget.bg = color.color["Purple200"] .. "bb" - end - ) - - battery_widget:connect_signal( - "button::release", - function () - battery_widget.bg = color.color["Purple200"] .. "dd" - end - ) - - battery_widget:connect_signal( - "mouse::leave", - function () - battery_widget.bg = old_bg - if old_wibox then - old_wibox.cursor = old_cursor - old_wibox = nil - end - end - ) + hover_signal(battery_widget, color.color["Purple200"]) battery_widget:connect_signal( 'button::press', diff --git a/awesome/theme/crylia/widgets/bluetooth.lua b/awesome/theme/crylia/widgets/bluetooth.lua index e7feb23..8adef0b 100644 --- a/awesome/theme/crylia/widgets/bluetooth.lua +++ b/awesome/theme/crylia/widgets/bluetooth.lua @@ -8,6 +8,7 @@ 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/bluetooth/" @@ -90,44 +91,7 @@ return function () } -- Signals - local old_wibox, old_cursor, old_bg - bluetooth_widget:connect_signal( - "mouse::enter", - function () - old_bg = bluetooth_widget.bg - bluetooth_widget.bg = color.color["Blue200"] .. "dd" - local w = mouse.current_wibox - if w then - old_cursor, old_wibox = w.cursor, w - w.cursor = "hand1" - end - end - ) - - bluetooth_widget:connect_signal( - "button::press", - function () - bluetooth_widget.bg = color.color["Blue200"] .. "bb" - end - ) - - bluetooth_widget:connect_signal( - "button::release", - function () - bluetooth_widget.bg = color.color["Blue200"] .. "dd" - end - ) - - bluetooth_widget:connect_signal( - "mouse::leave", - function () - bluetooth_widget.bg = old_bg - if old_wibox then - old_wibox.cursor = old_cursor - old_wibox = nil - end - end - ) + hover_signal(bluetooth_widget, color.color["Blue200"]) bluetooth_widget:connect_signal( "button::press", diff --git a/awesome/theme/crylia/widgets/clock.lua b/awesome/theme/crylia/widgets/clock.lua index a7bb12e..60f973b 100644 --- a/awesome/theme/crylia/widgets/clock.lua +++ b/awesome/theme/crylia/widgets/clock.lua @@ -8,6 +8,7 @@ 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/clock/" @@ -71,45 +72,7 @@ return function () end } - -- Signals - local old_wibox, old_cursor, old_bg - clock_widget:connect_signal( - "mouse::enter", - function () - old_bg = clock_widget.bg - clock_widget.bg = color.color["Orange200"] .. "dd" - local w = mouse.current_wibox - if w then - old_cursor, old_wibox = w.cursor, w - w.cursor = "hand1" - end - end - ) - - clock_widget:connect_signal( - "button::press", - function () - clock_widget.bg = color.color["Orange200"] .. "bb" - end - ) - - clock_widget:connect_signal( - "button::release", - function () - clock_widget.bg = color.color["Orange200"] .. "dd" - end - ) - - clock_widget:connect_signal( - "mouse::leave", - function () - clock_widget.bg = old_bg - if old_wibox then - old_wibox.cursor = old_cursor - old_wibox = nil - end - end - ) + hover_signal(clock_widget, color.color["Orange200"]) return clock_widget end \ No newline at end of file diff --git a/awesome/theme/crylia/widgets/date.lua b/awesome/theme/crylia/widgets/date.lua index ce00c87..c4bdb07 100644 --- a/awesome/theme/crylia/widgets/date.lua +++ b/awesome/theme/crylia/widgets/date.lua @@ -8,6 +8,7 @@ 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/date/" @@ -71,32 +72,12 @@ return function () } -- Signals - local old_wibox, old_cursor, old_bg + hover_signal(date_widget, color.color["Teal200"]) + date_widget:connect_signal( "mouse::enter", function () awesome.emit_signal("widget::calendar_osd:stop", true) - old_bg = date_widget.bg - date_widget.bg = color.color["Teal200"] .. "dd" - local w = mouse.current_wibox - if w then - old_cursor, old_wibox = w.cursor, w - w.cursor = "hand1" - end - end - ) - - date_widget:connect_signal( - "button::press", - function () - date_widget.bg = color.color["Teal200"] .. "bb" - end - ) - - date_widget:connect_signal( - "button::release", - function () - date_widget.bg = color.color["Teal200"] .. "dd" end ) @@ -104,11 +85,6 @@ return function () "mouse::leave", function () awesome.emit_signal("widget::calendar_osd:rerun", true) - date_widget.bg = old_bg - if old_wibox then - old_wibox.cursor = old_cursor - old_wibox = nil - end end ) diff --git a/awesome/theme/crylia/widgets/kblayout.lua b/awesome/theme/crylia/widgets/kblayout.lua index 1de56bf..e91cf12 100644 --- a/awesome/theme/crylia/widgets/kblayout.lua +++ b/awesome/theme/crylia/widgets/kblayout.lua @@ -8,6 +8,7 @@ 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/kblayout/" @@ -76,43 +77,12 @@ return function () end -- Signals - local old_wibox, old_cursor, old_bg - kblayout_widget:connect_signal( - "mouse::enter", - function () - old_bg = kblayout_widget.bg - kblayout_widget.bg = color.color["Green200"] .. "dd" - local w = mouse.current_wibox - if w then - old_cursor, old_wibox = w.cursor, w - w.cursor = "hand1" - end - end - ) + hover_signal(kblayout_widget, color.color["Green200"]) kblayout_widget:connect_signal( "button::press", function () set_kblayout() - kblayout_widget.bg = color.color["Green200"] .. "bb" - end - ) - - kblayout_widget:connect_signal( - "button::release", - function () - kblayout_widget.bg = color.color["Green200"] .. "dd" - end - ) - - kblayout_widget:connect_signal( - "mouse::leave", - function () - kblayout_widget.bg = old_bg - if old_wibox then - old_wibox.cursor = old_cursor - old_wibox = nil - end end ) diff --git a/awesome/theme/crylia/widgets/layout_list.lua b/awesome/theme/crylia/widgets/layout_list.lua index d17a454..7858d84 100644 --- a/awesome/theme/crylia/widgets/layout_list.lua +++ b/awesome/theme/crylia/widgets/layout_list.lua @@ -8,10 +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") -- Returns the layoutbox widget return function () - local layout = wibox.widget{ { awful.widget.layoutbox(), @@ -27,42 +27,12 @@ return function () } -- Signals - local old_wibox, old_cursor, old_bg - layout:connect_signal( - "mouse::enter", - function () - old_bg = layout.bg - layout.bg = color.color["LightBlue200"] .. "dd" - local w = mouse.current_wibox - if w then - old_cursor, old_wibox = w.cursor, w - w.cursor = "hand1" - end - end - ) + hover_signal(layout, color.color["LightBlue200"]) layout:connect_signal( "button::press", function () - layout.bg = color.color["LightBlue200"] .. "bb" - end - ) - - layout:connect_signal( - "button::release", - function () - layout.bg = color.color["LightBlue200"] .. "dd" - end - ) - - layout:connect_signal( - "mouse::leave", - function () - layout.bg = old_bg - if old_wibox then - old_wibox.cursor = old_cursor - old_wibox = nil - end + awful.layout.inc(-1) end ) diff --git a/awesome/theme/crylia/widgets/network.lua b/awesome/theme/crylia/widgets/network.lua index 2583b14..129a341 100644 --- a/awesome/theme/crylia/widgets/network.lua +++ b/awesome/theme/crylia/widgets/network.lua @@ -9,6 +9,7 @@ local dpi = require("beautiful").xresources.apply_dpi local gears = require("gears") local naughty = require("naughty") local wibox = require("wibox") +require("Main.Signals") -- Icon directory path local icondir = awful.util.getdir("config") .. "theme/crylia/assets/icons/network/" @@ -126,7 +127,7 @@ return function () network_notify(message, title, app_name, icon) end - local update_wireless_data = function (strength, healthy) + local update_wireless_data = function (healthy) awful.spawn.easy_async_with_shell( [[ iw dev ]] .. interfaces.wlan_interface .. [[ link ]], function (stdout) @@ -158,10 +159,10 @@ return function () awesome.emit_signal("system::network_connected") end icon = icon .. '-' .. tostring(strength) - update_wireless_data(wifi_strength_rounded, true) + update_wireless_data(true) else icon = icon .. "-" .. tostring(strength) - update_wireless_data(wifi_strength_rounded, false) + update_wireless_data(false) end network_widget.container.network_layout.spacing = dpi(8) network_widget.container.network_layout.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icondir .. icon .. ".svg", color.color["Grey900"])) @@ -323,44 +324,7 @@ return function () } -- Signals - local old_wibox, old_cursor, old_bg - network_widget:connect_signal( - "mouse::enter", - function () - old_bg = network_widget.bg - network_widget.bg = color.color["Red200"] .. "dd" - local w = mouse.current_wibox - if w then - old_cursor, old_wibox = w.cursor, w - w.cursor = "hand1" - end - end - ) - - network_widget:connect_signal( - "button::press", - function () - network_widget.bg = color.color["Red200"] .. "bb" - end - ) - - network_widget:connect_signal( - "button::release", - function () - network_widget.bg = color.color["Red200"] .. "dd" - end - ) - - network_widget:connect_signal( - "mouse::leave", - function () - network_widget.bg = old_bg - if old_wibox then - old_wibox.cursor = old_cursor - old_wibox = nil - end - end - ) + hover_signal(network_widget, color.color["Red200"]) network_widget:connect_signal( "button::press", diff --git a/awesome/theme/crylia/widgets/power.lua b/awesome/theme/crylia/widgets/power.lua index b330283..aa86c6c 100644 --- a/awesome/theme/crylia/widgets/power.lua +++ b/awesome/theme/crylia/widgets/power.lua @@ -9,6 +9,7 @@ local dpi = require("beautiful").xresources.apply_dpi local gears = require("gears") local naughty = require("naughty") local wibox = require("wibox") +require("Main.Signals") -- Icon directory path local icondir = awful.util.getdir("config") .. "theme/crylia/assets/icons/power/" @@ -50,44 +51,12 @@ return function () } -- Signals - local old_wibox, old_cursor, old_bg - power_widget:connect_signal( - "mouse::enter", - function () - old_bg = power_widget.bg - power_widget.bg = color.color["Red200"] .. "dd" - local w = mouse.current_wibox - if w then - old_cursor, old_wibox = w.cursor, w - w.cursor = "hand1" - end - end - ) - - power_widget:connect_signal( - "button::press", - function () - power_widget.bg = color.color["Red200"] .. "bb" - end - ) + hover_signal(power_widget, color.color["Red200"]) power_widget:connect_signal( "button::release", function () - power_widget.bg = color.color["Red200"] .. "dd" awesome.emit_signal("module::powermenu:show") - --awful.spawn("rofi -show power-menu -modi 'power-menu:~/.config/rofi/rofi-power-menu --choices=shutdown/reboot/logout/lockscreen' -theme ~/.config/rofi/powermenu/powermenu.rasi") - end - ) - - power_widget:connect_signal( - "mouse::leave", - function () - power_widget.bg = old_bg - if old_wibox then - old_wibox.cursor = old_cursor - old_wibox = nil - end end ) diff --git a/awesome/theme/crylia/widgets/taglist.lua b/awesome/theme/crylia/widgets/taglist.lua index 7465a7a..d3ad895 100644 --- a/awesome/theme/crylia/widgets/taglist.lua +++ b/awesome/theme/crylia/widgets/taglist.lua @@ -3,7 +3,8 @@ local awful = require("awful") local gears = require("gears") local dpi = require("beautiful").xresources.apply_dpi local color = require("theme.crylia.colors") -local naughty = require("naughty") +local naughty =require("naughty") +require("theme.crylia.Tools.IconHandler") local list_update = function (widget, buttons, label, data, objects) widget:reset() @@ -102,32 +103,27 @@ local list_update = function (widget, buttons, label, data, objects) end for _, client in ipairs(object:clients()) do - if client.icon then - tag_label_margin:set_right(0) - local icon = wibox.widget{ + tag_label_margin:set_right(0) + local icon = wibox.widget{ + { + id = "icon_container", { - id = "icon_container", - { - id = "icon", - resize = true, - widget = wibox.widget.imagebox - }, - widget = wibox.container.place + id = "icon", + resize = true, + widget = wibox.widget.imagebox }, - tag_icon, - forced_width = dpi(33), - margins = dpi(6), - widget = wibox.container.margin - } - icon.icon_container.icon:set_image(client:get_icon(1)) - tag_widget.widget_margin.container:setup({ - icon, - layout = wibox.layout.align.horizontal - }) - else - tag_icon_margin:set_margins(0) - tag_icon:set_forced_width(0) - end + widget = wibox.container.place + }, + tag_icon, + forced_width = dpi(33), + margins = dpi(6), + widget = wibox.container.margin + } + icon.icon_container.icon:set_image(GetIcon("Papirus", client)) + tag_widget.widget_margin.container:setup({ + icon, + layout = wibox.layout.align.horizontal + }) end local old_wibox, old_cursor, old_bg @@ -135,7 +131,6 @@ local list_update = function (widget, buttons, label, data, objects) "mouse::enter", function () old_bg = tag_widget.bg - --naughty.notify({title = tostring(old_bg)}) if object == awful.screen.focused().selected_tag then tag_widget.bg = '#dddddd' .. 'dd' else diff --git a/awesome/theme/crylia/widgets/tasklist.lua b/awesome/theme/crylia/widgets/tasklist.lua index 0763eb1..630c492 100644 --- a/awesome/theme/crylia/widgets/tasklist.lua +++ b/awesome/theme/crylia/widgets/tasklist.lua @@ -3,7 +3,6 @@ local wibox = require('wibox') local dpi = require('beautiful').xresources.apply_dpi local gears = require('gears') local color = require('theme.crylia.colors') -local naughty = require("naughty") local list_update = function (widget, buttons, label, data, objects) widget:reset() @@ -111,11 +110,7 @@ local list_update = function (widget, buttons, label, data, objects) task_title:set_text('') end - if icon then - task_icon.icon:set_image(object:get_icon(1)) - else - task_icon_margin:set_margins(0) - end + task_icon.icon:set_image(GetIcon("Papirus", object)) widget:add(task_widget) widget:set_spacing(dpi(6)) @@ -192,14 +187,10 @@ return function(s) if c == client.focus then c.minimized = true else - -- Without this, the following - -- :isvisible() makes no sense c.minimized = false if not c:isvisible() and c.first_tag then c.first_tag:view_only() end - -- This will also un-minimize - -- the client, if needed c:emit_signal('request::activate') c:raise() end