diff --git a/awesome/bindings/bindtotags.lua b/awesome/bindings/bindtotags.lua index 748feea..1c70318 100644 --- a/awesome/bindings/bindtotags.lua +++ b/awesome/bindings/bindtotags.lua @@ -42,9 +42,11 @@ function _M.get(globalkeys) "#" .. i + 9, function() local screen = awful.screen.focused() - local tag = screen.tags[i] - if tag then - client.focus:move_to_tag(tag) + 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"} diff --git a/awesome/bindings/clientkeys.lua b/awesome/bindings/clientkeys.lua index a53d6e3..cd63b40 100644 --- a/awesome/bindings/clientkeys.lua +++ b/awesome/bindings/clientkeys.lua @@ -25,8 +25,8 @@ function _M.get() { description = "Close window", group = "Client" } ), awful.key( - { modkey, "Control" }, - "Space", + { modkey }, + "space", awful.client.floating.toggle, { description = "Toggle floating window", group = "Client" } ), diff --git a/awesome/bindings/globalkeys.lua b/awesome/bindings/globalkeys.lua index c1eaeca..951df02 100644 --- a/awesome/bindings/globalkeys.lua +++ b/awesome/bindings/globalkeys.lua @@ -170,14 +170,6 @@ function _M.get() end, {description = "Decrease the number of columns", group = "Layout"} ), - awful.key( - { modkey }, - "space", - function () - awful.layout.inc( 1) - end, - {description = "Select next", group = "Layout"} - ), awful.key( { modkey, "Shift" }, "space", @@ -333,7 +325,7 @@ function _M.get() { modkey }, "F5", function (c) - awful.spawn("xbacklight -inc 10") + 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") @@ -343,10 +335,10 @@ function _M.get() { modkey }, "F4", function (c) - awful.spawn("xbacklight -dec 10") + 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") - awesome.emit_signal("widget::brightness_osd:rerun") end ), awful.key( @@ -356,6 +348,13 @@ function _M.get() local t = awful.screen.focused().selected_tag t:delete() end + ), + awful.key( + { }, + "Escape", + function () + awesome.emit_signal("module::powermenu:hide") + end ) ) diff --git a/awesome/deco/statusbar.lua b/awesome/deco/statusbar.lua index 9505e7e..380e7a7 100644 --- a/awesome/deco/statusbar.lua +++ b/awesome/deco/statusbar.lua @@ -49,7 +49,7 @@ awful.screen.connect_for_each_screen( end, layout = wibox.layout.flex.horizontal } - + -- Bar for all the widgets s.top_right = awful.popup { widget = { @@ -71,26 +71,39 @@ awful.screen.connect_for_each_screen( s.calendar_osd_container = awful.popup{ widget = {}, ontop = true, - bg = "#00000000", - border_width = dpi(1), - border_color = "#454545", - shape = function (cr, height, width) - gears.shape.rounded_rect(cr, dpi(500), dpi(300)) + shape = function (cr, width, height) + gears.shape.rounded_rect(cr, width, height, 10) end, + border_width = dpi(0), + border_color = colors.color["Grey800"], placement = function (c) - awful.placement.top_left(c, {margins = dpi(10)}) + awful.placement.top_right(c, { + margins = { + right = dpi(100), + top = dpi(60) + } + }) end, + visible = false + } + + local hide_osd = gears.timer{ + timeout = 0.25, + autostart = true, + callback = function () + s.calendar_osd_container.visible = false + end } -- OSD Container - s.osd_container = awful.popup{ + s.volume_container = awful.popup{ widget = { margins = dpi(10), widget = wibox.container.margin }, ontop = true, bg = "#00000000", - border_width = dpi(1), + border_width = dpi(0), border_color = "#454545", shape = function (cr, width, height) gears.shape.rounded_rect(cr, width, height, 10) @@ -98,6 +111,53 @@ awful.screen.connect_for_each_screen( placement = function (c) awful.placement.bottom_right(c, {margins = dpi(10)}) end, + visible = false, + } + + local hide_volume_osd = gears.timer{ + timeout = 1, + autostart = true, + callback = function () + s.volume_container.visible = false + end + } + + s.brightness_container = awful.popup{ + widget = { + margins = dpi(10), + widget = wibox.container.margin + }, + ontop = true, + bg = "#00000000", + border_width = dpi(0), + border_color = "#454545", + shape = function (cr, width, height) + gears.shape.rounded_rect(cr, width, height, 10) + end, + placement = function (c) + awful.placement.bottom_right(c, {margins = dpi(10)}) + end, + visible = false + } + + local hide_brightness_osd = gears.timer{ + timeout = 1, + autostart = true, + callback = function () + s.brightness_container.visible = false + end + } + + s.powermenu_container = wibox{ + 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 } -- All the modules and widgets @@ -109,11 +169,11 @@ awful.screen.connect_for_each_screen( s.date = require("theme.crylia.widgets.date")() s.clock = require("theme.crylia.widgets.clock")() s.bluetooth = require("theme.crylia.widgets.bluetooth")() - s.calendar_osd = require("theme.crylia.modules.calendar_osd") - --s.addtag = require("theme.crylia.widgets.addtag")() + s.calendar_osd = require("theme.crylia.modules.calendar_osd")() s.layoutlist = require("theme.crylia.widgets.layout_list")() s.powerbutton = require("theme.crylia.widgets.power")() - + s.kblayout = require("theme.crylia.widgets.kblayout")() + s.powermenu = require("theme.crylia.modules.powermenu")() s.top_left:setup { nil, @@ -186,6 +246,14 @@ awful.screen.connect_for_each_screen( bottom = dpi(6), widget = wibox.container.margin }, + { + s.kblayout, + left = dpi(3), + right = dpi(3), + top = dpi(6), + bottom = dpi(6), + widget = wibox.container.margin + }, { s.date, left = dpi(3), @@ -201,7 +269,8 @@ awful.screen.connect_for_each_screen( top = dpi(6), bottom = dpi(6), widget = wibox.container.margin - },{ + }, + { s.powerbutton, left = dpi(3), right = dpi(6), @@ -215,31 +284,166 @@ awful.screen.connect_for_each_screen( layout = wibox.layout.align.horizontal } - s.osd_container:setup{ - { - s.volume_osd, - layout = wibox.layout.fixed.horizontal - }, - spacing = dpi(10), - { - s.brightness_osd, - layout = wibox.layout.fixed.horizontal - - }, - layout = wibox.layout.align.vertical + s.volume_container:setup{ + s.volume_osd, + layout = wibox.layout.fixed.horizontal } + + s.brightness_container:setup{ + s.brightness_osd, + layout = wibox.layout.fixed.horizontal + } + s.calendar_osd_container:setup{ s.calendar_osd, - visible = false, layout = wibox.layout.align.horizontal } + s.powermenu_container:setup{ + s.powermenu, + layout = wibox.layout.flex.horizontal + } + + s.powermenu_container:buttons( + gears.table.join( + awful.button( + {}, + 3, + function () + awesome.emit_signal("module::powermenu:hide") + end + ) + ) + ) + -- Signals + awesome.connect_signal( + "module::powermenu:show", + function() + for s in screen do + s.powermenu_container.visible = false + end + awful.screen.focused().powermenu_container.visible = true + end + ) + + awesome.connect_signal( + "module::powermenu:hide", + function() + for s in screen do + s.powermenu_container.visible = false + end + end + ) + awesome.connect_signal( "hide_centerbar", function (hide) s.top_center.visible = hide end ) + + 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 () + s.brightness_container.visible = true + end + ) + + s.brightness_container:connect_signal( + "mouse::enter", + function () + s.brightness_container.visible = true + hide_brightness_osd:stop() + end + ) + + s.brightness_container:connect_signal( + "mouse::leave", + function () + s.brightness_container.visible = true + hide_brightness_osd:again() + end + ) + + awesome.connect_signal( + "module::volume_osd:show", + function () + s.volume_container.visible = true + end + ) + + s.volume_container:connect_signal( + "mouse::enter", + function () + s.volume_container.visible = true + hide_volume_osd:stop() + end + ) + + s.volume_container:connect_signal( + "mouse::leave", + function () + s.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 + ) + + s.calendar_osd_container:connect_signal( + "mouse::enter", + function () + s.calendar_osd_container.visible = true + hide_osd:stop() + end + ) + + s.calendar_osd_container:connect_signal( + "mouse::leave", + function () + s.calendar_osd_container.visible = false + hide_osd:stop() + end + ) + + awesome.connect_signal( + "widget::calendar_osd:stop", + function () + s.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/main/menu.lua b/awesome/main/menu.lua index 5deb118..5512728 100644 --- a/awesome/main/menu.lua +++ b/awesome/main/menu.lua @@ -19,7 +19,7 @@ M.session = { } M.applications = { - { "Brave", "brave-browser" }, + { "Firefox", "firefox" }, { "VS Code", "code" }, { "Blender", "blender" }, { "Steam", "steam" }, diff --git a/awesome/main/rules.lua b/awesome/main/rules.lua index 1eb11c1..35e51cf 100644 --- a/awesome/main/rules.lua +++ b/awesome/main/rules.lua @@ -37,13 +37,14 @@ function _M.get(clientkeys, clientbuttons) "pop-up" } }, - properties = { floating = true } + properties = { floating = true, titlebars_enabled = true } }, { + id = "titlebar", rule_any = { - type = { "normal", "dialog" } + type = { "normal", "dialog", "modal", "utility" } }, - properties = { titlebars_enabled = false } + properties = { titlebars_enabled = true } } } return rules diff --git a/awesome/main/signals.lua b/awesome/main/signals.lua index a58c146..094273b 100644 --- a/awesome/main/signals.lua +++ b/awesome/main/signals.lua @@ -1,7 +1,6 @@ -- Awesome Libs local awful = require("awful") local beautiful = require("beautiful") -local naughty = require("naughty") client.connect_signal( @@ -43,6 +42,7 @@ client.connect_signal( end ) + -- Sloppy focus client.connect_signal("mouse::enter", function(c) c:emit_signal("request::activate", "mouse_enter", {raise = false}) @@ -51,7 +51,7 @@ 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 = "#bdbdbd" + c.border_color = "#616161" end) client.connect_signal("unfocus", function (c) diff --git a/awesome/rc.lua b/awesome/rc.lua index efed895..7d44aee 100644 --- a/awesome/rc.lua +++ b/awesome/rc.lua @@ -87,6 +87,9 @@ awful.rules.rules = main.rules( -- Signals require("main.signals") +-- Titlebar +require("theme.crylia.modules.titlebar") + -- Autostart programs --awful.spawn.with_shell("~/.screenlayout/single_screen.sh") awful.spawn.with_shell("picom --experimental-backends") diff --git a/awesome/theme/crylia/assets/icons/kblayout/keyboard.svg b/awesome/theme/crylia/assets/icons/kblayout/keyboard.svg new file mode 100644 index 0000000..b8f8511 --- /dev/null +++ b/awesome/theme/crylia/assets/icons/kblayout/keyboard.svg @@ -0,0 +1 @@ + \ 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 new file mode 100644 index 0000000..4adef78 --- /dev/null +++ b/awesome/theme/crylia/assets/icons/powermenu/defaultpfp.svg @@ -0,0 +1 @@ + \ 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 new file mode 100644 index 0000000..1aa03e1 --- /dev/null +++ b/awesome/theme/crylia/assets/icons/powermenu/lock.svg @@ -0,0 +1 @@ + \ 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 new file mode 100644 index 0000000..ac9680f --- /dev/null +++ b/awesome/theme/crylia/assets/icons/powermenu/logout.svg @@ -0,0 +1 @@ + \ 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 new file mode 100644 index 0000000..ebe3f16 --- /dev/null +++ b/awesome/theme/crylia/assets/icons/powermenu/reboot.svg @@ -0,0 +1 @@ + \ 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 new file mode 100644 index 0000000..343d1ba --- /dev/null +++ b/awesome/theme/crylia/assets/icons/powermenu/shutdown.svg @@ -0,0 +1 @@ + \ 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 new file mode 100644 index 0000000..8ab0482 --- /dev/null +++ b/awesome/theme/crylia/assets/icons/powermenu/suspend.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/awesome/theme/crylia/assets/icons/titlebar/close.svg b/awesome/theme/crylia/assets/icons/titlebar/close.svg new file mode 100644 index 0000000..989837c --- /dev/null +++ b/awesome/theme/crylia/assets/icons/titlebar/close.svg @@ -0,0 +1 @@ + \ 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 new file mode 100644 index 0000000..d4a435b --- /dev/null +++ b/awesome/theme/crylia/assets/icons/titlebar/maximize.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/awesome/theme/crylia/assets/icons/titlebar/minimize.svg b/awesome/theme/crylia/assets/icons/titlebar/minimize.svg new file mode 100644 index 0000000..36a771f --- /dev/null +++ b/awesome/theme/crylia/assets/icons/titlebar/minimize.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/awesome/theme/crylia/assets/userpfp/crylia.png b/awesome/theme/crylia/assets/userpfp/crylia.png new file mode 100644 index 0000000..20e1e11 Binary files /dev/null and b/awesome/theme/crylia/assets/userpfp/crylia.png differ diff --git a/awesome/theme/crylia/assets/userpfp/rickastley.jpg b/awesome/theme/crylia/assets/userpfp/rickastley.jpg new file mode 100644 index 0000000..962cd11 Binary files /dev/null and b/awesome/theme/crylia/assets/userpfp/rickastley.jpg differ diff --git a/awesome/theme/crylia/assets/wallpaper.jpg.bak b/awesome/theme/crylia/assets/wallpaper.jpg.bak new file mode 100644 index 0000000..f6ff102 Binary files /dev/null and b/awesome/theme/crylia/assets/wallpaper.jpg.bak differ diff --git a/awesome/theme/crylia/assets/wallpaper.png b/awesome/theme/crylia/assets/wallpaper.png new file mode 100644 index 0000000..f806d10 Binary files /dev/null and b/awesome/theme/crylia/assets/wallpaper.png differ diff --git a/awesome/theme/crylia/modules/brightness_osd.lua b/awesome/theme/crylia/modules/brightness_osd.lua index 88ab0dc..e7ce6f6 100644 --- a/awesome/theme/crylia/modules/brightness_osd.lua +++ b/awesome/theme/crylia/modules/brightness_osd.lua @@ -9,10 +9,12 @@ local dpi = require("beautiful").xresources.apply_dpi local gears = require("gears") local wibox = require("wibox") +local naughty = require("naughty") + -- Icon directory path local icondir = awful.util.getdir("config") .. "theme/crylia/assets/icons/brightness/" ---TODO: fix backlight keys and osd not working correctly +-- TODO: fix backlight keys and osd not working correctly return function () local brightness_osd_widget = wibox.widget{ @@ -28,7 +30,7 @@ return function () }, nil, { - ic = "value", + id = "value", text = "0%", align = "center", valign = "center", @@ -81,10 +83,10 @@ return function () right = dpi(24), widget = wibox.container.margin }, - bg = color.color["Grey900"] .. '44', + bg = color.color["Grey900"], widget = wibox.container.background, ontop = true, - visible = false, + visible = true, type = "notification", forced_height = dpi(100), forced_width = dpi(300), @@ -95,9 +97,8 @@ return function () "property::value", function () local brightness_value = brightness_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.brightness_slider:get_value() - -- Performance is horrible, or it overrides and executes at the same time as the keybindings - awful.spawn("xbacklight -set " .. brightness_value .. "%", false) + --awful.spawn("xbacklight -set " .. brightness_value, false) brightness_osd_widget.container.osd_layout.label_value_layout.value:set_text(brightness_value .. "%") awesome.emit_signal( @@ -134,44 +135,6 @@ return function () ) end - local hide_osd = gears.timer{ - timeout = 5, - autostart = true, - callback = function () - brightness_osd_widget.visible = false - end - } - - -- Signals - brightness_osd_widget:connect_signal( - "mouse::enter", - function () - brightness_osd_widget.visible = true - hide_osd:stop() - end - ) - - brightness_osd_widget:connect_signal( - "mouse::leave", - function () - brightness_osd_widget.visible = true - hide_osd:again() - end - ) - - awesome.connect_signal( - "widget::brightness_osd:rerun", - function () - if hide_osd.started then - hide_osd:again() - else - hide_osd:start() - end - end - ) - - update_slider() - awesome.connect_signal( "module::brightness_slider:update", function () @@ -186,13 +149,6 @@ return function () end ) - awesome.connect_signal( - "module::brightness_osd:show", - function () - brightness_osd_widget.visible = true - end - ) - update_slider() return brightness_osd_widget end \ 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 887a6a3..413300d 100644 --- a/awesome/theme/crylia/modules/calendar_osd.lua +++ b/awesome/theme/crylia/modules/calendar_osd.lua @@ -1,78 +1,122 @@ +--------------------------------------- +-- This is the calendar_osd module -- +--------------------------------------- + +-- Awesome Libs + local wibox = require("wibox") -local awful = require("awful") local gears = require("gears") -local naughty = require("naughty") local dpi = require("beautiful").xresources.apply_dpi local color = require("theme.crylia.colors") -local styles = {} +return function () + local styles = {} -styles.month = { - padding = 15, - bg_color = color.color["Grey900"], - border_width = 1, - shape = function (cr, width, height) - gears.shape.rounded_rect(cr, width, height, 5) - end -} -styles.normal = { - shape = function (cr, width, height) - gears.shape.rounded_rect(cr, width, height, 5) - end -} -styles.focus = { - fg_color = color.color["Grey900"], - bg_color = color.color["TealA200"], - shape = function (cr, width, height) - gears.shape.rounded_rect(cr, width, height, 5) - end -} -styles.header = { - fg_color = color.color["Teal200"], - markup = function(t) return '' .. t .. '' end, - shape = function (cr, width, height) - gears.shape.rounded_rect(cr, width, height, 5) - end -} -styles.weekday = { - padding = 8, - fg_color = color.color["Teal200"], - markup = function(t) return '' .. t .. '' end, - shape = function (cr, width, height) - gears.shape.rounded_rect(cr, width, height, 5) - end -} -local function decorate_cell(widget, flag, date) - if flag=='monthheader' and not styles.monthheader then - flag = 'header' - end - local props = styles[flag] or {} - if props.markup and widget.get_text and widget.set_markup then - widget:set_markup(props.markup(widget:get_text())) - end - -- Change bg color for weekends - local d = {year=date.year, month=(date.month or 1), day=(date.day or 1)} - local weekday = tonumber(os.date('%w', os.time(d))) - local default_bg = (weekday==0 or weekday==6) and color.color["Grey900"] or color.color["Grey800"] - local ret = wibox.widget { - { - widget, - margins = 10, - widget = wibox.container.margin - }, - shape = props.shape, - shape_border_color = color.color["Grey800"], - shape_border_width = 1, - fg = props.fg_color or '#999999', - bg = props.bg_color or default_bg, - widget = wibox.container.background + styles.month = { + padding = 15, + bg_color = color.color["Grey900"], + border_width = 1, + shape = function (cr, width, height) + gears.shape.rounded_rect(cr, width, height, 5) + end + } + styles.normal = { + fg_color = color.color["Grey900"], + font = "JetBrainsMonoExtraBold NF", + shape = function (cr, width, height) + gears.shape.rounded_rect(cr, width, height, 5) + end + } + styles.focus = { + fg_color = color.color["Grey900"], + bg_color = color.color["Purple200"], + shape = function (cr, width, height) + gears.shape.rounded_rect(cr, width, height, 5) + end + } + styles.header = { + fg_color = color.color["Grey900"], + bg_color = color.color["Teal200"], + markup = function(t) return '' .. t .. '' end, + shape = function (cr, width, height) + gears.shape.rounded_rect(cr, width, height, 5) + end + } + styles.weekday = { + padding = 8, + fg_color = color.color["Grey900"], + bg_color = color.color["Teal200"], + markup = function(t) return '' .. t .. '' end, + shape = function (cr, width, height) + gears.shape.rounded_rect(cr, width, height, 5) + end + } + local function decorate_cell(widget, flag, date) + if flag=='monthheader' and not styles.monthheader then + flag = 'header' + end + local props = styles[flag] or {} + if props.markup and widget.get_text and widget.set_markup then + widget:set_markup(props.markup(widget:get_text())) + end + -- Change bg color for weekends + local d = {year=date.year, month=(date.month or 1), day=(date.day or 1)} + local weekday = tonumber(os.date('%w', os.time(d))) + local default_bg = (weekday == 0 or weekday == 6) and color.color["Red200"] or color.color["White"] + local ret = wibox.widget { + { + widget, + left = dpi(8), + right = dpi(8), + top = dpi(4), + bottom = dpi(4), + widget = wibox.container.margin + }, + shape = function (cr, width, height) + gears.shape.rounded_rect(cr, width, height, 5) + end, + fg = props.fg_color or '#999999', + bg = props.bg_color or default_bg, + widget = wibox.container.background + } + return ret + end + local calendar = wibox.widget { + date = os.date('*t'), + fn_embed = decorate_cell, + widget = wibox.widget.calendar.month, + font = "JetBrainsMonoExtraBold NF", + spacing = dpi(10) } - return ret -end -local cal = wibox.widget { - date = os.date('*t'), - fn_embed = decorate_cell, - widget = wibox.widget.calendar.month -} -return cal \ No newline at end of file + local calendar_osd_widget = wibox.widget{ + { + widget = wibox.widget.textbox, + fg = "#ffffff", + align = "center", + valign = "center", + font = "DS-Digital, Bold Italic 50", + id = "digital_clock" + }, + { + widget = calendar + }, + visible = true, + layout = wibox.layout.fixed.vertical + } + + local set_clock = function () + calendar_osd_widget.digital_clock:set_text(os.date("%H:%M")) + end + + local calendar_clock_update = gears.timer { + timeout = 5, + autostart = true, + call_now = true, + callback = function () + set_clock() + end + } + + return calendar_osd_widget +end \ No newline at end of file diff --git a/awesome/theme/crylia/modules/powermenu.lua b/awesome/theme/crylia/modules/powermenu.lua new file mode 100644 index 0000000..e4a395d --- /dev/null +++ b/awesome/theme/crylia/modules/powermenu.lua @@ -0,0 +1,243 @@ +-------------------------------- +-- This is the network widget -- +-------------------------------- + +-- Awesome Libs +local awful = require("awful") +local color = require("theme.crylia.colors") +local dpi = require("beautiful").xresources.apply_dpi +local gears = require("gears") +local wibox = require("wibox") +local naughty = require("naughty") + +-- Icon directory path +local icondir = awful.util.getdir("config") .. "theme/crylia/assets/icons/powermenu/" + +return function () + + local profile_picture = wibox.widget { + image = icondir .. "defaultpfp.svg", + resize = true, + forced_height = dpi(200), + clip_shape = function (cr, width, height) + gears.shape.rounded_rect(cr, width, height, 30) + end, + widget = wibox.widget.imagebox + } + + local profile_name = wibox.widget { + align = 'center', + valign = 'center', + text = " ", + font = "JetBrains Mono Bold 30", + widget = wibox.widget.textbox + } + + local update_profile_picture = function () + awful.spawn.easy_async_with_shell( + [=[ + iconPath="/var/lib/AccountsService/icons/${USER}" + userIconPath="${HOME}/.config/awesome/theme/crylia/assets/userpfp/" + if [[ -f "${userIconPath}" ]]; + then + if [[ -f "${iconPath}" ]]; + then + if ! cmp --silent "${userIconPath}.png" "${iconPath}"; + then + cp "${iconPath}" "${userIconPath}${USER}.png" + fi + printf "${userIconPath}.png" + else + printf "${userIconPath}.png" + fi + exit; + else + if [[ -f "${iconPath}" ]]; + then + cp "${iconPath}" "${userIconPath}${USER}.png" + printf "${userIconPath}${USER}.png" + exit; + fi + fi + ]=], + function (stdout) + if stdout then + profile_picture:set_image(stdout:gsub("\n", "")) + else + profile_picture:set_image(icondir .. "defaultpfp.svg") + end + end + ) + end + + update_profile_picture() + local namestyle = "userhost" + local update_user_name = function() + awful.spawn.easy_async_with_shell( + [=[ + fullname="$(getent passwd `whoami` | cut -d ':' -f 5)" + user="$(whoami)" + host="$(hostname)" + if [[ "]=] .. namestyle .. [=[" == "userhost" ]]; + then + printf "$user@$host" + elif [[ "]=] .. namestyle .. [=[" == "fullname" ]]; + then + printf "$fullname" + else + printf "Rick Astley" + fi + ]=], + function(stdout) + if stdout:gsub("\n", "") == "Rick Astley" then + profile_picture:set_image(awful.util.getdir("config") .. "theme/crylia/assets/userpfp/" .. "rickastley.jpg") + end + profile_name:set_text(stdout) + end + ) + end + update_user_name() + + local button = function(name, icon, bg_color, callback) + local item = wibox.widget{ + { + { + { + { + { + --image = gears.color.recolor_image(icon, color.color["Grey900"]), + image = icon, + resize = true, + forced_height = dpi(30), + widget = wibox.widget.imagebox + }, + margins = dpi(0), + widget = wibox.container.margin + }, + { + { + text = name, + font = "JetBrains Mono Bold 30", + widget = wibox.widget.textbox + }, + margins = dpi(0), + widget = wibox.container.margin + }, + widget = wibox.layout.fixed.horizontal + }, + margins = dpi(10), + widget = wibox.container.margin + }, + fg = color.color["Grey900"], + bg = bg_color, + shape = function (cr, width, height) + gears.shape.rounded_rect(cr, width, height, 10) + end, + widget = wibox.container.background + }, + spacing = dpi(0), + layout = wibox.layout.align.vertical + } + + item:connect_signal( + "button::release", + function() + callback() + end + ) + + return item + end + + local suspend_command = function() + awful.spawn.easy_async_with_shell("dm-tool lock & systemctl suspend") + awesome.emit_signal("module::powermenu:hide") + end + + local logout_command = function() + awesome.quit() + end + + local lock_command = function() + awful.spawn.easy_async_with_shell("dm-tool lock") + awesome.emit_signal("module::powermenu:hide") + end + + local shutdown_command = function() + awful.spawn.easy_async_with_shell("shutdown now") + awesome.emit_signal("module::powermenu:hide") + end + + local reboot_command = function() + awful.spawn.easy_async_with_shell("reboot") + awesome.emit_signal("module::powermenu:hide") + end + + local shutdown_button = button("Shutdown", icondir .. "shutdown.svg", color.color["Blue200"], shutdown_command) + local reboot_button = button("Reboot", icondir .. "reboot.svg", color.color["Red200"], reboot_command) + local suspend_button = button("Suspend", icondir .. "suspend.svg", color.color["Yellow200"], suspend_command) + local logout_button = button("Logout", icondir .. "logout.svg", color.color["Green200"], logout_command) + local lock_button = button("Lock", icondir .. "lock.svg", color.color["Orange200"], lock_command) + + local powermenu = wibox.widget { + layout = wibox.layout.align.vertical, + expand = "none", + nil, + { + { + nil, + { + { + nil, + { + nil, + { + profile_picture, + margins = dpi(0), + widget = wibox.container.margin + }, + nil, + expand = "none", + layout = wibox.layout.align.horizontal + }, + nil, + layout = wibox.layout.align.vertical, + expand = "none" + }, + spacing = dpi(50), + { + profile_name, + margins = dpi(0), + widget = wibox.container.margin + }, + layout = wibox.layout.fixed.vertical + }, + nil, + expand = "none", + layout = wibox.layout.align.horizontal + }, + { + nil, + { + { + shutdown_button, + reboot_button, + logout_button, + lock_button, + suspend_button, + spacing = dpi(30), + layout = wibox.layout.fixed.horizontal + }, + margins = dpi(0), + widget = wibox.container.margin + }, + nil, + expand = "none", + layout = wibox.layout.align.horizontal + }, + layout = wibox.layout.align.vertical + }, + nil + } + return powermenu +end \ No newline at end of file diff --git a/awesome/theme/crylia/modules/titlebar.lua b/awesome/theme/crylia/modules/titlebar.lua new file mode 100644 index 0000000..d3b3b04 --- /dev/null +++ b/awesome/theme/crylia/modules/titlebar.lua @@ -0,0 +1,180 @@ +----------------------------------- +-- This is the titlebar module -- +----------------------------------- + +-- Awesome Libs +local awful = require("awful") +local color = require("theme.crylia.colors") +local dpi = require("beautiful").xresources.apply_dpi +local gears = require("gears") +local wibox = require("wibox") + +awful.titlebar.enable_tooltip = true +awful.titlebar.fallback_name = 'Client' + +local double_click_event_handler = function(double_click_event) + if double_click_timer then + double_click_timer:stop() + double_click_timer = nil + double_click_event() + return + end + double_click_timer = gears.timer.start_new( + 0.20, + function() + double_click_timer = nil + return false + end + ) +end + +local create_click_events = function (c) + local buttons = gears.table.join( + awful.button( + {}, + 1, + function () + double_click_event_handler(function () + if c.floating then + c.float = false + return + end + c.maximized = not c.maximized + c:raise() + end) + c:activate { context = 'titlebar', action = 'mouse_move' } + end + ), + awful.button( + {}, + 3, + function () + c:activate { context = 'titlebar', action = 'mouse_resize' } + end + ) + ) + return buttons +end + +local create_titlebar = function (c, bg, size) + awful.titlebar(c, { position = "left", bg = bg, size = size }) : setup { + { + { + { + awful.titlebar.widget.closebutton(c), + widget = wibox.container.background, + bg = color.color["Red200"], + shape = function (cr, height, width) + gears.shape.rounded_rect(cr, width, height, 4) + end + }, + { + awful.titlebar.widget.maximizedbutton(c), + widget = wibox.container.background, + bg = color.color["Yellow200"], + shape = function (cr, height, width) + gears.shape.rounded_rect(cr, width, height, 4) + end + }, + { + awful.titlebar.widget.minimizebutton(c), + widget = wibox.container.background, + bg = color.color["Green200"], + shape = function (cr, height, width) + gears.shape.rounded_rect(cr, width, height, 4) + end + }, + spacing = dpi(10), + layout = wibox.layout.fixed.vertical + }, + margins = dpi(8), + widget = wibox.container.margin + }, + { + buttons = create_click_events(c), + layout = wibox.layout.flex.vertical + }, + nil, + layout = wibox.layout.align.vertical + } +end + +local create_titlebar_dialog = function(c, bg, size) + awful.titlebar(c, {position = "left", bg = bg, size = size}) : setup { + { + { + { + awful.titlebar.widget.closebutton(c), + widget = wibox.container.background, + bg = color.color["Red200"], + shape = function (cr, height, width) + gears.shape.rounded_rect(cr, width, height, 4) + end + }, + { + awful.titlebar.widget.minimizebutton(c), + widget = wibox.container.background, + bg = color.color["Green200"], + shape = function (cr, height, width) + gears.shape.rounded_rect(cr, width, height, 4) + end + }, + spacing = dpi(7), + layout = wibox.layout.fixed.vertical + }, + margins = dpi(8), + widget = wibox.container.margin + }, + { + buttons = create_click_events(c), + layout = wibox.layout.flex.vertical + }, + nil, + layout = wibox.layout.align.vertical + } +end + +local draw_titlebar = function (c) + if c.type == 'normal' then + if c.class == 'Firefox' then + create_titlebar(c, '#121212AA', 35) + elseif c.name == "Steam" then + create_titlebar(c, '#121212AA', 0) + elseif c.name == "Settings" then + create_titlebar(c, '#121212AA', 0) + elseif c.class == "gcr-prompter" or c.class == "Gcr-prompter" then + create_titlebar(c, '#121212AA', 0) + else + create_titlebar(c, '#121212AA', 35) + end + elseif c.type == 'dialog' then + create_titlebar_dialog(c, '#121212AA', 35) + elseif c.type == 'modal' then + create_titlebar(c, '#121212AA', 35) + end +end + +client.connect_signal( + "request::titlebars", + function (c) + draw_titlebar(c) + if not c.floating then + awful.titlebar.hide(c, 'left') + end + end +) + +client.connect_signal( + 'property::floating', + function (c) + if c.floating then + if c.class == "Steam" then + awful.titlebar.hide(c, 'left') + else + awful.titlebar.show(c, 'left') + end + else + awful.titlebar.hide(c, 'left') + end + end +) \ 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 6fff566..3f504a0 100644 --- a/awesome/theme/crylia/modules/volume_osd.lua +++ b/awesome/theme/crylia/modules/volume_osd.lua @@ -81,10 +81,10 @@ return function () right = dpi(24), widget = wibox.container.margin }, - bg = color.color["Grey900"] .. '44', + bg = color.color["Grey900"], widget = wibox.container.background, ontop = true, - visible = false, + visible = true, type = "notification", forced_height = dpi(100), forced_width = dpi(300), @@ -147,14 +147,6 @@ return function () ) end - local hide_osd = gears.timer{ - timeout = 5, - autostart = true, - callback = function () - volume_osd_widget.visible = false - end - } - -- Signals awesome.connect_signal( "module::slider:update", @@ -170,40 +162,6 @@ return function () end ) - awesome.connect_signal( - "module::volume_osd:show", - function () - volume_osd_widget.visible = true - end - ) - - volume_osd_widget:connect_signal( - "mouse::enter", - function () - volume_osd_widget.visible = true - hide_osd:stop() - end - ) - - volume_osd_widget:connect_signal( - "mouse::leave", - function () - volume_osd_widget.visible = true - hide_osd:again() - end - ) - - awesome.connect_signal( - "widget::volume_osd:rerun", - function () - if hide_osd.started then - hide_osd:again() - else - hide_osd:start() - end - end - ) - update_slider() return volume_osd_widget end \ No newline at end of file diff --git a/awesome/theme/crylia/theme_variables.lua b/awesome/theme/crylia/theme_variables.lua index a1e7c4d..b4191ed 100644 --- a/awesome/theme/crylia/theme_variables.lua +++ b/awesome/theme/crylia/theme_variables.lua @@ -7,8 +7,10 @@ local colors = require("theme.crylia.colors") local dpi = require("beautiful.xresources").apply_dpi local gears = require("gears") +local awful = require("awful") --- Note that most variables wont change anything since almost everything you see is individually themed +-- Icon directory path +local icondir = awful.util.getdir("config") .. "theme/crylia/assets/icons/titlebar/" Theme.font = "JetBrains Mono, Bold" @@ -23,9 +25,9 @@ Theme.fg_focus = colors.color["White"] Theme.fg_urgent = colors.color["White"] Theme.fg_minimize = colors.color["White"] -Theme.useless_gap = dpi(5) -- Change this if you dont like window gaps -Theme.border_width = dpi(1) -- Change this if you dont like borders -Theme.border_normal = colors.color["Grey600"] +Theme.useless_gap = dpi(5) -- Change this to 0 if you dont like window gaps +Theme.border_width = dpi(0) -- Change this to 0 if you dont like borders +Theme.border_normal = colors.color["Grey800"] --Theme.border_focus = colors.color["Red"] -- Doesnt work, no idea why; workaround is in signals.lua Theme.border_marked = colors.color["Red400"] @@ -35,8 +37,8 @@ Theme.menu_width = dpi(200) Theme.menu_bg_normal = colors.color["Grey900"] Theme.menu_bg_focus = colors.color["Grey800"] Theme.menu_fg_focus = colors.color["White"] -Theme.menu_border_color = colors.color["Grey600"] -Theme.menu_border_width = dpi(1) +Theme.menu_border_color = colors.color["Grey800"] +Theme.menu_border_width = dpi(0) Theme.taglist_fg_focus = colors.color["Grey900"] Theme.taglist_bg_focus = colors.color["White"] @@ -44,19 +46,23 @@ Theme.taglist_bg_focus = colors.color["White"] Theme.tooltip_border_color = colors.color["Grey700"] Theme.tooltip_bg = colors.color["Grey800"] Theme.tooltip_fg = colors.color["White"] -Theme.tooltip_border_width = dpi(1) +Theme.tooltip_border_width = dpi(0) Theme.tooltip_shape = function (cr, width, heigth) gears.shape.rounded_rect(cr, width, heigth, 10) end Theme.notification_bg = colors.color["Grey900"] Theme.notification_fg = colors.color["White"] -Theme.notification_border_width = dpi(1) -Theme.notification_border_color = colors.color["Grey800"] +Theme.notification_border_width = dpi(0) +Theme.notification_border_color = colors.color["Grey900"] Theme.notification_shape = function (cr, width, heigth) gears.shape.rounded_rect(cr, width, heigth, 10) end Theme.notification_margin = dpi(10) Theme.notification_max_width = dpi(400) Theme.notification_max_height = dpi(1000) -Theme.notification_icon_size = dpi(40) \ No newline at end of file +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" diff --git a/awesome/theme/crylia/widgets/audio.lua b/awesome/theme/crylia/widgets/audio.lua index 87cbed6..d932a83 100644 --- a/awesome/theme/crylia/widgets/audio.lua +++ b/awesome/theme/crylia/widgets/audio.lua @@ -115,6 +115,7 @@ return function () audio_widget:connect_signal( "button::press", function () + awesome.emit_signal("module::volume_osd:show", true) audio_widget.bg = color.color["Yellow200"] .. "bb" end ) @@ -137,13 +138,6 @@ return function () end ) - audio_widget:connect_signal( - "button::press", - function () - awesome.emit_signal("module::volume_osd:show", true) - end - ) - awesome.connect_signal( "widget::volume", function (c) diff --git a/awesome/theme/crylia/widgets/date.lua b/awesome/theme/crylia/widgets/date.lua index ab3c4b1..ce00c87 100644 --- a/awesome/theme/crylia/widgets/date.lua +++ b/awesome/theme/crylia/widgets/date.lua @@ -75,6 +75,7 @@ return function () 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 @@ -102,6 +103,7 @@ return function () date_widget:connect_signal( "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 diff --git a/awesome/theme/crylia/widgets/kblayout.lua b/awesome/theme/crylia/widgets/kblayout.lua new file mode 100644 index 0000000..1de56bf --- /dev/null +++ b/awesome/theme/crylia/widgets/kblayout.lua @@ -0,0 +1,121 @@ +------------------------------ +-- This is the audio widget -- +------------------------------ + +-- Awesome Libs +local awful = require("awful") +local color = require("theme.crylia.colors") +local dpi = require("beautiful").xresources.apply_dpi +local gears = require("gears") +local wibox = require("wibox") + +-- Icon directory path +local icondir = awful.util.getdir("config") .. "theme/crylia/assets/icons/kblayout/" + +return function () + local kblayout_widget = wibox.widget{ + { + { + { + { + { + id = "icon", + widget = wibox.widget.imagebox, + resize = false, + image = gears.color.recolor_image(icondir .. "keyboard.svg", color.color["Grey900"]) + }, + id = "icon_layout", + widget = wibox.container.place + }, + top = dpi(2), + widget = wibox.container.margin, + id = "icon_margin" + }, + spacing = dpi(6), + { + id = "label", + align = "center", + valign = "center", + widget = wibox.widget.textbox + }, + id = "kblayout_layout", + layout = wibox.layout.fixed.horizontal + }, + id = "container", + left = dpi(5), + right = dpi(10), + widget = wibox.container.margin + }, + bg = color.color["Green200"], + fg = color.color["Grey900"], + shape = function (cr, width, height) + gears.shape.rounded_rect(cr, width, height, 5) + end, + widget = wibox.widget.background + } + local layout = ""; + local get_kblayout = function () + awful.spawn.easy_async_with_shell( + [[ setxkbmap -query | grep layout | awk '{print $2}' ]], + function (stdout) + layout = stdout + kblayout_widget.container.kblayout_layout.label.text = stdout + return stdout + end + ) + return layout + end + + local set_kblayout = function (kblayout) + kblayout = "de" + if get_kblayout():gsub("\n", "") == "de" then + kblayout = "ru" + end + awful.spawn.easy_async_with_shell("setxkbmap -layout " .. kblayout) + get_kblayout() + 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 + ) + + 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 + ) + + get_kblayout() + return kblayout_widget +end \ No newline at end of file diff --git a/awesome/theme/crylia/widgets/network.lua b/awesome/theme/crylia/widgets/network.lua index cdc4dd1..2583b14 100644 --- a/awesome/theme/crylia/widgets/network.lua +++ b/awesome/theme/crylia/widgets/network.lua @@ -131,7 +131,7 @@ return function () [[ iw dev ]] .. interfaces.wlan_interface .. [[ link ]], function (stdout) local essid = stdout:match("SSID: (.-)\n") or "N/A" - local bitrate = stdout: match("tx bitrate: (.+/s)") or "N/A" + local bitrate = stdout:match("tx bitrate: (.+/s)") or "N/A" local message = "Connected to " .. essid .. "\nSignal strength " .. tostring(wifi_strength) .. "%\n" .. "Bit rate " .. tostring(bitrate) .. "" if healthy then @@ -177,7 +177,7 @@ return function () return end wifi_strength = tonumber(stdout) - network_widget.container.network_layout.spacing = dpi(10) + network_widget.container.network_layout.spacing = dpi(8) network_widget.container.network_layout.label.visible = true network_widget.container.network_layout.label:set_text(tostring(wifi_strength)) local wifi_strength_rounded = math.floor(wifi_strength / 25 + 0.5) @@ -259,7 +259,7 @@ return function () end network_widget.container.network_layout.label.visible = false update_tooltip("Network unreachable") - network_widget.test.test2.spacing = dpi(0) + network_widget.container.network_layout.spacing = dpi(0) network_widget.container.network_layout.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icondir .. icon .. ".svg", color.color["Grey900"])) end diff --git a/awesome/theme/crylia/widgets/power.lua b/awesome/theme/crylia/widgets/power.lua index 4f8bf29..b330283 100644 --- a/awesome/theme/crylia/widgets/power.lua +++ b/awesome/theme/crylia/widgets/power.lua @@ -75,7 +75,8 @@ return function () "button::release", function () power_widget.bg = color.color["Red200"] .. "dd" - 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") + 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 ) diff --git a/awesome/theme/crylia/widgets/taglist.lua b/awesome/theme/crylia/widgets/taglist.lua index 6e2e779..7465a7a 100644 --- a/awesome/theme/crylia/widgets/taglist.lua +++ b/awesome/theme/crylia/widgets/taglist.lua @@ -3,6 +3,7 @@ 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 list_update = function (widget, buttons, label, data, objects) widget:reset() @@ -63,7 +64,31 @@ local list_update = function (widget, buttons, label, data, objects) widget = wibox.widget.background } - tag_widget:buttons(buttons, object) + local function create_buttons(buttons, object) + if buttons then + local btns = {} + for _, b in ipairs(buttons) do + -- Create a proxy button object: it will receive the real + -- press and release events, and will propagate them to the + -- button object the user provided, but with the object as + -- argument. + local btn = awful.button { + modifiers = b.modifiers, + button = b.button, + on_press = function() + b:emit_signal('press', object) + end, + on_release = function() + b:emit_signal('release', object) + end + } + btns[#btns + 1] = btn + end + return btns + end + end + + tag_widget:buttons(create_buttons(buttons, object)) local text, bg_color, bg_image, icon, args = label(object, tag_label) @@ -94,7 +119,7 @@ local list_update = function (widget, buttons, label, data, objects) margins = dpi(6), widget = wibox.container.margin } - icon.icon_container.icon:set_image(client.icon) + icon.icon_container.icon:set_image(client:get_icon(1)) tag_widget.widget_margin.container:setup({ icon, layout = wibox.layout.align.horizontal @@ -110,7 +135,12 @@ local list_update = function (widget, buttons, label, data, objects) "mouse::enter", function () old_bg = tag_widget.bg - tag_widget.bg = "#3A475C" .. "dd" + --naughty.notify({title = tostring(old_bg)}) + if object == awful.screen.focused().selected_tag then + tag_widget.bg = '#dddddd' .. 'dd' + else + tag_widget.bg = '#3A475C' .. 'dd' + end local w = mouse.current_wibox if w then old_cursor, old_wibox = w.cursor, w @@ -122,14 +152,22 @@ local list_update = function (widget, buttons, label, data, objects) tag_widget:connect_signal( "button::press", function () - tag_widget.bg = "#3A475C" .. "bb" + if object == awful.screen.focused().selected_tag then + tag_widget.bg = '#bbbbbb' .. 'dd' + else + tag_widget.bg = '#3A475C' .. 'dd' + end end ) tag_widget:connect_signal( "button::release", function () - tag_widget.bg = "#3A475C" .. "dd" + if object == awful.screen.focused().selected_tag then + tag_widget.bg = '#dddddd' .. 'dd' + else + tag_widget.bg = '#3A475C' .. 'dd' + end end ) @@ -147,7 +185,6 @@ local list_update = function (widget, buttons, label, data, objects) widget:add(tag_widget) widget:set_spacing(dpi(6)) end - end local tag_list = function (s) diff --git a/awesome/theme/crylia/widgets/tasklist.lua b/awesome/theme/crylia/widgets/tasklist.lua index 4fe5e39..0763eb1 100644 --- a/awesome/theme/crylia/widgets/tasklist.lua +++ b/awesome/theme/crylia/widgets/tasklist.lua @@ -62,7 +62,31 @@ local list_update = function (widget, buttons, label, data, objects) delay_show = 1 } - task_widget:buttons(buttons, object) + local function create_buttons(buttons, object) + if buttons then + local btns = {} + for _, b in ipairs(buttons) do + -- Create a proxy button object: it will receive the real + -- press and release events, and will propagate them to the + -- button object the user provided, but with the object as + -- argument. + local btn = awful.button { + modifiers = b.modifiers, + button = b.button, + on_press = function() + b:emit_signal('press', object) + end, + on_release = function() + b:emit_signal('release', object) + end + } + btns[#btns + 1] = btn + end + return btns + end + end + + task_widget:buttons(create_buttons(buttons, object)) local text, bg, bg_image, icon, args = label(object, task_title) @@ -72,7 +96,7 @@ local list_update = function (widget, buttons, label, data, objects) else local text_full = text:match('>(.-)<') if text_full then - text = text_full + text = object.class:sub(1,20) task_tool_tip:set_text(text_full) task_tool_tip:add_to_object(task_widget) else @@ -88,7 +112,7 @@ local list_update = function (widget, buttons, label, data, objects) end if icon then - task_icon.icon:set_image(icon) + task_icon.icon:set_image(object:get_icon(1)) else task_icon_margin:set_margins(0) end @@ -101,7 +125,11 @@ local list_update = function (widget, buttons, label, data, objects) "mouse::enter", function () old_bg = task_widget.bg - task_widget.bg = "#ffffff" .. "bb" + if object == client.focus then + task_widget.bg = '#dddddddd' + else + task_widget.bg = '#3A475Cdd' + end local w = mouse.current_wibox if w then old_cursor, old_wibox = w.cursor, w @@ -113,14 +141,22 @@ local list_update = function (widget, buttons, label, data, objects) task_widget:connect_signal( "button::press", function () - task_widget.bg = "#ffffff" .. "aa" + if object == client.focus then + task_widget.bg = "#ffffffaa" + else + task_widget.bg = '#3A475Caa' + end end ) task_widget:connect_signal( "button::release", function () - task_widget.bg = "#ffffff" .. "bb" + if object == client.focus then + task_widget.bg = "#ffffffdd" + else + task_widget.bg = '#3A475Cdd' + end end ) @@ -148,21 +184,33 @@ return function(s) return awful.widget.tasklist( s, awful.widget.tasklist.filter.currenttags, - gears.table.join( + awful.util.table.join( awful.button( {}, 1, - function (c) + function(c) if c == client.focus then c.minimized = true else + -- Without this, the following + -- :isvisible() makes no sense c.minimized = false - if not c.invisible() and c.first_tag then - c:emit_signal("request::activate") - c:raise() + 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 end + ), + awful.button( + {}, + 3, + function(c) + c:kill() + end ) ), {},