From f0b32f45746c026d402651013b7e98315d6956a1 Mon Sep 17 00:00:00 2001 From: delta Date: Sat, 4 Mar 2023 22:04:55 +0100 Subject: restructure awesome config, add fresnel --- .config/awesome/ui/decorations/init.lua | 2 + .config/awesome/ui/decorations/titlebar.lua | 84 ++++++++++++++++++++++++++++ .config/awesome/ui/decorations/wallpaper.lua | 28 ++++++++++ 3 files changed, 114 insertions(+) create mode 100644 .config/awesome/ui/decorations/init.lua create mode 100644 .config/awesome/ui/decorations/titlebar.lua create mode 100644 .config/awesome/ui/decorations/wallpaper.lua (limited to '.config/awesome/ui/decorations') diff --git a/.config/awesome/ui/decorations/init.lua b/.config/awesome/ui/decorations/init.lua new file mode 100644 index 0000000..9493a67 --- /dev/null +++ b/.config/awesome/ui/decorations/init.lua @@ -0,0 +1,2 @@ +require "ui.decorations.titlebar" +require "ui.decorations.wallpaper" diff --git a/.config/awesome/ui/decorations/titlebar.lua b/.config/awesome/ui/decorations/titlebar.lua new file mode 100644 index 0000000..8451817 --- /dev/null +++ b/.config/awesome/ui/decorations/titlebar.lua @@ -0,0 +1,84 @@ +local awful = require "awful" +local vars = require "misc.vars" +local gears = require "gears" +local wibox = require "wibox" +local rubato = require "lib.rubato" +local cfg = require "misc.cfg" + +local function button(color, color_focus, callback) + local widget = wibox.widget { + widget = wibox.container.background, + forced_height = vars.button_size, + forced_width = vars.button_size, + bg = color, + shape = vars.shape, + buttons = { callback } + } + + widget:connect_signal("mouse::enter", function() + local timed = rubato.timed { + duration = 0.1, + intro = 0.05, + pos = vars.button_size, + subscribed = function(pos) + widget.forced_width = pos + end + } + + timed.target = vars.button_size * 2 + widget.bg = color_focus + end) + + widget:connect_signal("mouse::leave", function() + local timed = rubato.timed { + duration = 0.1, + intro = 0.05, + pos = vars.button_size * 2, + subscribed = function(pos) + widget.forced_width = pos + end + } + + timed.target = vars.button_size + widget.bg = color + end) + + return widget +end + +client.connect_signal("request::titlebars", function(c) + if not cfg.draw_titlebar then return end + + local titlebar = awful.titlebar(c, { + position = "top", + size = vars.button_size + vars.padding * 2 + }) + + awful.titlebar.enable_tooltip = false + + titlebar.widget = { + widget = wibox.container.margin, + margins = vars.padding, + { + nil, + nil, + { + button(vars.colors.green, vars.colors.bright.green, awful.button({}, 1, function() + c.maximized = not c.maximized + end)), + button(vars.colors.yellow, vars.colors.bright.yellow, awful.button({}, 1, function() + gears.timer.delayed_call(function() + c.minimized = true + end) + end)), + button(vars.colors.red, vars.colors.bright.red, awful.button({}, 1, function() + c:kill() + end)), + + spacing = vars.padding, + layout = wibox.layout.fixed.horizontal + }, + layout = wibox.layout.align.horizontal + } + } +end) diff --git a/.config/awesome/ui/decorations/wallpaper.lua b/.config/awesome/ui/decorations/wallpaper.lua new file mode 100644 index 0000000..f7104ff --- /dev/null +++ b/.config/awesome/ui/decorations/wallpaper.lua @@ -0,0 +1,28 @@ +local wallpaper = require "awful.wallpaper" +local wibox = require "wibox" +local vars = require "misc.vars" +local h = require "misc.helpers" + +screen.connect_signal("request::wallpaper", function(s) + wallpaper { + bg = vars.colors.dim.bg, + screen = s, + widget = { + widget = wibox.container.place, + valign = "center", + halign = "center", + { + widget = wibox.widget.textbox, + font = h.font(1.5), + markup = table.concat({ + h.markup_fg(vars.colors.red, " ___"), + h.markup_fg(vars.colors.green, " /\\ \\"), + h.markup_fg(vars.colors.yellow, " /::\\ \\"), + h.markup_fg(vars.colors.blue, "/::\\:\\__\\"), + h.markup_fg(vars.colors.pink, "\\/\\::/ /"), + h.markup_fg(vars.colors.cyan, " \\/__/") + }, "\n") + } + } + } +end) -- cgit v1.2.3