From a7c79cb5a04562be10347856642a80f0c4be89fc Mon Sep 17 00:00:00 2001 From: delta Date: Fri, 17 Apr 2026 08:10:30 +0200 Subject: sync --- .config/awesome/ui/fresnel/init.lua | 19 +-- .config/awesome/ui/fresnel/text_input.lua | 4 +- .config/awesome/ui/osd/init.lua | 136 +++++++++++++----- .config/awesome/ui/statusbar/init.lua | 31 ++-- .../awesome/ui/statusbar/panel/widgets/mpris.lua | 158 ++++++++++----------- 5 files changed, 209 insertions(+), 139 deletions(-) (limited to '.config/awesome/ui') diff --git a/.config/awesome/ui/fresnel/init.lua b/.config/awesome/ui/fresnel/init.lua index dc8e333..613bc9c 100644 --- a/.config/awesome/ui/fresnel/init.lua +++ b/.config/awesome/ui/fresnel/init.lua @@ -1,7 +1,5 @@ local text_input = require "ui.fresnel.text_input" local awful = require "awful" -local qdebug = require "quarrel.debug" -local cfg = require "misc.cfg" local gshape = require "gears.shape" local gtable = require "gears.table" local qanim = require "quarrel.animation" @@ -152,7 +150,7 @@ function fresnel:_exec_entry(entry) local exec = entry.exec if type(exec) ~= "userdata" and type(exec) ~= "nil" then if exec[2] then - awful.spawn(cfg.terminal .. " -e /bin/sh -c " .. exec[1] .. " 1>/dev/null 2>&1") + awful.spawn.with_shell("xdg-terminal-exec /bin/sh -c '" .. exec[1]:gsub("'", [[\']]) .. "' 1>/dev/null 2>&1") else awful.spawn.with_shell(exec[1] .. " 1>/dev/null 2>&1") end @@ -318,17 +316,17 @@ fresnel._w_status = wibox.widget { widget = wibox.widget.textbox, text = "0/0", } -fresnel._w_popup = qui.popup { +fresnel._w_popup = qui.animateable_shape(qui.popup { -- visible = false, ontop = true, placement = false, - shape = function(cr, w) - gshape.partially_rounded_rect(cr, w, 0, false, false, true, true, qui.BORDER_RADIUS) + shape = function(cr, w, h) + gshape.partially_rounded_rect(cr, w, h, false, false, true, true, qui.BORDER_RADIUS) end, x = width / 2, + y = -qui.BORDER_WIDTH, minimum_width = width, maximum_width = width, - -- maximum_height = max_height, widget = { qui.styled { widget = wibox.container.background, @@ -373,7 +371,7 @@ fresnel._w_popup = qui.popup { }, layout = wibox.layout.align.vertical, }, -} +}) function fresnel:show() self._prev_scroll_amount = DEFAULT_SCROLL_AMOUNT @@ -406,13 +404,10 @@ fresnel._t_height = qanim:new { pos = 0, easing = qvars.easing, subscribed = function(pos) - fresnel._w_popup.shape = function(cr, w) - gshape.partially_rounded_rect(cr, w, pos, false, false, true, true, qui.BORDER_RADIUS) - end + fresnel._w_popup.shape_height = pos end, } --- TODO: optimize the search algo to be more efficient and not require making fresnel invisible fresnel._t_opacity = rubato.timed { duration = qvars.anim_duration, pos = 0, diff --git a/.config/awesome/ui/fresnel/text_input.lua b/.config/awesome/ui/fresnel/text_input.lua index 2dc7368..5b6525b 100644 --- a/.config/awesome/ui/fresnel/text_input.lua +++ b/.config/awesome/ui/fresnel/text_input.lua @@ -3,8 +3,8 @@ -- @copyright 2021-2025 Kasper24 ------------------------------------------- local lgi = require('lgi') -local Gtk = lgi.require('Gtk', '3.0') -local Gdk = lgi.require('Gdk', '3.0') +local Gtk = lgi.require('Gtk', '3.0')-- somewm:ignore +local Gdk = lgi.require('Gdk', '3.0')-- somewm:ignore local Pango = lgi.Pango local awful = require("awful") local gtable = require("gears.table") diff --git a/.config/awesome/ui/osd/init.lua b/.config/awesome/ui/osd/init.lua index 4310f17..85cb1d7 100644 --- a/.config/awesome/ui/osd/init.lua +++ b/.config/awesome/ui/osd/init.lua @@ -4,24 +4,49 @@ local gtimer = require "gears.timer" local phosphor = require "assets.phosphor" local qmath = require "quarrel.math" local qui = require "quarrel.ui" +local qdebug = require "quarrel.debug" +local gshape = require "gears.shape" +local qanim = require "quarrel.animation" local qvars = require "quarrel.vars" local rubato = require "lib.rubato" local wibox = require "wibox" -- local mpris_widget = require "ui.osd.mpris" -local osd = {} +local MAX_HEIGHT = qui.BIG_PADDING * 2 + qui.CHAR_HEIGHT -local widget = awful.popup(qui.styled { +local M = { + _toggled = false +} + +local geo = awful.screen.focused().geometry + +M._w_popup = qui.animateable_shape(qui.popup { ontop = true, visible = true, - placement = function(d) - awful.placement.top(d, { - margins = { - top = beautiful.useless_gap * 2, - }, + shape = function(cr, w, h) + gshape.partially_rounded_rect(cr, w, h, true, true, false, false, qui.BORDER_RADIUS) + end, + placement = function (d) + return (awful.placement.bottom + awful.placement.center_horizontal)(d, { + offset = { + y = qui.BORDER_WIDTH + 1 -- Needs one more pixel to fully occlude the bottom border for some reason + } }) end, - minimum_height = qui.CHAR_HEIGHT * 3, + -- placement = function(d) + -- awful.placement.bottom(d, { + -- margins = { + -- top = beautiful.useless_gap * 2, + -- }, + -- }) + -- end, + -- x = geo.width / 2, + -- y = geo.height - 10, + minimum_height = qui.CHAR_HEIGHT, + widget = { + widget = wibox.widget.textbox, + text = "blah" + } -- widget = mpris_widget -- minimum_width = awful.screen.focused().geometry.width / 2, -- widget = { @@ -65,38 +90,85 @@ local widget = awful.popup(qui.styled { -- }, }) -local timer +M._t_height = qanim:new { + duration = qvars.anim_duration, + pos = 0, + easing = qvars.easing, + subscribed = function(pos) + M._w_popup.shape_height = pos + end, +} -local anim = rubato.timed { +-- TODO: optimize the search algo to be more efficient and not require making fresnel invisible +M._t_opacity = rubato.timed { duration = qvars.anim_duration, - intro = qvars.anim_intro, - pos = 1, + pos = 0, subscribed = function(pos) - widget.opacity = pos + M._w_popup.opacity = pos + if pos == 0 then - widget.visible = false - elseif not widget.visible then - widget.visible = true - elseif pos == 1 then - -- timer:start() + M._w_popup.visible = false + else + M._w_popup.visible = true end end, } -timer = gtimer { - timeout = 1, - callback = function() - -- anim.target = 0 - end, - single_shot = true, -} +M._t_height:set(qui.BIG_PADDING * 2 + qui.CHAR_HEIGHT) +M._t_opacity.target = 1 + +function M:show() + self._toggled = true + self._t_opacity.target = 1 + self._t_height:set(MAX_HEIGHT) +end -function osd.notify(icon, value, max) - anim.target = 1 - widget:get_children_by_id("icon")[1].image = icon - widget:get_children_by_id("progress")[1].value = value - widget:get_children_by_id("progress")[1].max_value = max - widget:get_children_by_id("percentage")[1].text = tostring(qmath.percentage(value, max)) .. "%" +function M:hide() + self._toggled = false + self._t_opacity.target = 0 + self._t_height:set(0) end -return osd +function M:toggle() + if self._toggled then + self:hide() + else + self:show() + end +end + +-- local timer +-- +-- local anim = rubato.timed { +-- duration = qvars.anim_duration, +-- intro = qvars.anim_intro, +-- pos = 1, +-- subscribed = function(pos) +-- widget.opacity = pos +-- if pos == 0 then +-- widget.visible = false +-- elseif not widget.visible then +-- widget.visible = true +-- elseif pos == 1 then +-- -- timer:start() +-- end +-- end, +-- } +-- +-- timer = gtimer { +-- timeout = 1, +-- callback = function() +-- -- anim.target = 0 +-- end, +-- single_shot = true, +-- } + +-- function M.notify(icon, value, max) +-- anim.target = 1 +-- widget:get_children_by_id("icon")[1].image = icon +-- widget:get_children_by_id("progress")[1].value = value +-- widget:get_children_by_id("progress")[1].max_value = max +-- widget:get_children_by_id("percentage")[1].text = tostring(qmath.percentage(value, max)) .. "%" +-- end + +return M diff --git a/.config/awesome/ui/statusbar/init.lua b/.config/awesome/ui/statusbar/init.lua index 0a1198a..baaf2fa 100644 --- a/.config/awesome/ui/statusbar/init.lua +++ b/.config/awesome/ui/statusbar/init.lua @@ -15,7 +15,7 @@ local keyboardlayout = require "ui.statusbar.widgets.keyboardlayout" local taglist = require "ui.statusbar.widgets.taglist_new" screen.connect_signal("request::desktop_decoration", function(s) - local bar = qui.popup { + local bar = qui.animateable_shape(qui.popup { placement = function(d) return awful.placement.left(d, { margins = beautiful.useless_gap * 2, @@ -59,13 +59,14 @@ screen.connect_signal("request::desktop_decoration", function(s) }, toggled = false, - } + }) - local bar_width = bar.width + qui.BORDER_WIDTH * 2 + local bar_width = bar.width - bar.shape = function(cr, _, h) - qui.shape(cr, bar_width, h) - end + bar.shape_width = bar_width + -- bar.shape = function(cr, _, h) + -- qui.shape(cr, bar_width, h) + -- end bar:struts { left = bar_width + beautiful.useless_gap * 4, @@ -73,20 +74,30 @@ screen.connect_signal("request::desktop_decoration", function(s) bar.widget.widget.third = panel + local idle = true + local timed = qanim:new { duration = qvars.anim_duration, pos = bar_width, easing = qvars.easing, subscribed = function(pos) - if pos ~= bar_width and bar.toggled then + if idle and pos ~= bar_width and bar.toggled then bar.ontop = true + -- panel.visible = true + idle = false elseif pos == bar_width and not bar.toggled then bar.ontop = false + -- panel.visible = false + idle = true + elseif pos == bar_width + M.EXPANDED_BAR_SIZE then + idle = true end - bar.shape = function(cr, _, h) - qui.shape(cr, pos, h) - end + bar.shape_width = pos + + -- bar.shape = function(cr, _, h) + -- + -- end end, } diff --git a/.config/awesome/ui/statusbar/panel/widgets/mpris.lua b/.config/awesome/ui/statusbar/panel/widgets/mpris.lua index 687bbb1..f462ea3 100644 --- a/.config/awesome/ui/statusbar/panel/widgets/mpris.lua +++ b/.config/awesome/ui/statusbar/panel/widgets/mpris.lua @@ -99,106 +99,98 @@ M.widget = wibox.widget(qui.styled { { widget = client_background, { - nil, - qui.padded_big { + nil, + qui.padded_big { + { + { + widget = wibox.widget.textbox, + text = DEFAULTS.progresstext.position .. " / " .. DEFAULTS.progresstext.length, -- position / length + id = "progresstext", + }, { + widget = wibox.container.place, { - widget = wibox.container.background, - bg = qcolor.palette.bg(), + widget = wibox.widget.progressbar, + value = DEFAULTS.position, + max_value = DEFAULTS.length, + background_color = qcolor.palette.bg.lowest, + color = qcolor.palette.yellow(), + forced_height = qui.BORDER_RADIUS, + border_width = 0, shape = qui.shape, - { - widget = wibox.widget.imagebox, - image = DEFAULTS.art, - forced_height = qui.CHAR_HEIGHT * 5, - forced_width = qui.CHAR_HEIGHT * 5, - valign = "center", - halign = "center", - stylesheet = qui.recolor(qcolor.palette.bg.highest), - id = "cover", - }, + -- - forced_width = qui.CHAR_HEIGHT, + id = "progressbar", }, + }, + layout = wibox.layout.fixed.horizontal, + spacing = qui.BIG_PADDING, + }, + -- { + -- widget = wibox.container.background, + -- bg = qcolor.palette.bg(), + -- shape = qui.shape, + { + widget = wibox.widget.imagebox, + image = DEFAULTS.art, + forced_height = qui.CHAR_HEIGHT * 8, + forced_width = qui.CHAR_HEIGHT * 8, + valign = "center", + halign = "center", + stylesheet = qui.recolor(qcolor.palette.bg.highest), + clip_shape = qui.shape, + id = "cover", + }, + -- }, + { + { + widget = wibox.container.constraint, + height = qui.CHAR_HEIGHT * 2.5, + strategy = "max", { - widget = wibox.container.margin, - left = qui.BIG_PADDING, - { - { - widget = wibox.container.constraint, - height = qui.CHAR_HEIGHT * 2.5, - strategy = "max", - { - widget = wibox.widget.textbox, - text = DEFAULTS.title, -- Song - id = "song", - valign = "top", - }, - }, - { - widget = wibox.container.constraint, - height = qui.CHAR_HEIGHT * 2.5, - strategy = "max", - { - widget = wibox.container.background, - fg = qcolor.palette.fg.low, - { - widget = wibox.widget.textbox, - text = DEFAULTS.artist_album, -- Artist - Album Name - id = "artist_album", - valign = "top", - }, - }, - }, - layout = wibox.layout.fixed.vertical, - }, + widget = wibox.widget.textbox, + text = DEFAULTS.title, -- Song + id = "song", + valign = "top", }, - layout = wibox.layout.fixed.horizontal, }, - nil, { - widget = wibox.container.margin, - top = qui.BIG_PADDING, + widget = wibox.container.constraint, + height = qui.CHAR_HEIGHT * 2.5, + strategy = "max", { + widget = wibox.container.background, + fg = qcolor.palette.fg.low, { widget = wibox.widget.textbox, - text = DEFAULTS.progresstext.position .. " / " .. DEFAULTS.progresstext.length, -- position / length - id = "progresstext", - }, - { - widget = wibox.container.place, - { - widget = wibox.widget.progressbar, - forced_height = qui.PADDING, - color = qcolor.palette.yellow(), - value = DEFAULTS.position, - max_value = DEFAULTS.length, - background_color = qcolor.palette.bg.lowest, - bar_shape = qui.shape, - shape = qui.shape, - id = "progressbar", - }, + text = DEFAULTS.artist_album, -- Artist - Album Name + id = "artist_album", + valign = "top", }, - layout = wibox.layout.fixed.horizontal, - spacing = qui.BIG_PADDING, }, }, - layout = wibox.layout.align.vertical, + layout = wibox.layout.fixed.vertical, + spacing = qui.PADDING + }, + layout = wibox.layout.fixed.vertical, + spacing = qui.BIG_PADDING, + }, + { + qui.separator { + size = qui.BORDER_WIDTH, + vertical = true }, { - qui.separator { - size = qui.BORDER_WIDTH, - vertical = true - }, - { - widget = wibox.container.background, - bg = qcolor.palette.bg.high, - qui.padded_big { - layout = wibox.layout.flex.vertical, - spacing = qui.BIG_PADDING, - id = "client_list", - } - }, - layout = wibox.layout.fixed.horizontal, + widget = wibox.container.background, + bg = qcolor.palette.bg.high, + qui.padded_big { + layout = wibox.layout.flex.vertical, + spacing = qui.BIG_PADDING, + id = "client_list", + } }, - layout = wibox.layout.align.horizontal, + layout = wibox.layout.fixed.horizontal, + }, + layout = wibox.layout.align.horizontal, }, }, }) -- cgit v1.2.3