diff options
Diffstat (limited to '.config/awesome/ui/archaic/init.lua')
-rw-r--r-- | .config/awesome/ui/archaic/init.lua | 238 |
1 files changed, 0 insertions, 238 deletions
diff --git a/.config/awesome/ui/archaic/init.lua b/.config/awesome/ui/archaic/init.lua deleted file mode 100644 index df7bbda..0000000 --- a/.config/awesome/ui/archaic/init.lua +++ /dev/null @@ -1,238 +0,0 @@ -local awful = require "awful" -local btn = awful.button.names -local gc = require "gears.color" -local gs = require "gears.surface" -local qvars = require "quarrel.vars" -local qui = require "quarrel.ui" -local wibox = require "wibox" -local beautiful = require "beautiful" -local rubato = require "lib.rubato" -local playerctl = require "lib.bling.signal.playerctl".lib { - player = { "spotify", "cmus", "%any" } -} - -local height = screen[1].geometry.height - (beautiful.useless_gap * 4 + qvars.border_width * 2) -local inside_width = qvars.bar_size * 20 - (qvars.big_padding * 4 + qvars.border_width * 4 + qvars.bar_size * 4) - -local cover = wibox.widget { - { - widget = wibox.widget.imagebox, - clip_shape = qvars.shape, - forced_width = qvars.bar_size * 4, - forced_height = qvars.bar_size * 4, - visible = false, - id = "cover" - }, - { - widget = wibox.container.background, - forced_width = qvars.bar_size * 4, - forced_height = qvars.bar_size * 4, - bg = qvars.colors.black, - fg = qvars.colors.dim.fg, - shape = qvars.shape, - { - widget = wibox.container.place, - { - widget = wibox.widget.textbox, - text = "", - font = qui.font(4) - } - }, - id = "no_cover" - }, - layout = wibox.layout.stack -} - -local song = wibox.widget { - widget = wibox.widget.textbox, - text = "Nothing Playing ", - id = "song" -} - -local artist = wibox.widget { - widget = wibox.widget.textbox, - markup = qui.markup_fg(qvars.colors.dim.fg, "Nothing Playing "), - font = qui.font(0.8), -} - -local back = wibox.widget { - widget = wibox.widget.textbox, - text = "", - font = qui.symbol_font(1.5), - forced_height = beautiful.get_font_height(qui.symbol_font(0.5)) -} -back:add_button(awful.button { - modifiers = {}, - button = btn.LEFT, - on_press = function() - playerctl:previous() - end -}) - -local play_pause = wibox.widget { - widget = wibox.widget.textbox, - text = "", - font = qui.font(1.5), - forced_height = beautiful.get_font_height(qui.font(0.5)) -} -play_pause:add_button(awful.button { - modifiers = {}, - button = btn.LEFT, - on_press = function() - playerctl:play_pause() - end -}) -playerctl:connect_signal("playback_status", function(_, playing) - if playing then - play_pause:set_text("") - else - play_pause:set_text("") - end -end) - -local forward = wibox.widget { - widget = wibox.widget.textbox, - text = "", - font = qui.font(1.5), - forced_height = beautiful.get_font_height(qui.font(0.5)) -} -forward:add_button(awful.button { - - modifiers = {}, - button = btn.LEFT, - on_press = function() - playerctl:next() - end -}) - -local progress_bar = wibox.widget { - widget = wibox.widget.progressbar, - max_value = 1, - value = 0, - shape = qvars.shape, - bar_shape = qvars.shape, - forced_height = beautiful.get_font_height(qui.font(0.5)), - forced_width = inside_width - (qvars.padding * 2 + qvars.big_padding + back:get_preferred_size_at_dpi(screen[1].dpi) * 3), - color = qvars.colors.yellow, - background_color = qvars.colors.black -} -local progress_smoothing = rubato.timed { - duration = qvars.anim_duration, - intro = qvars.anim_intro, - pos = 0, - subscribed = function(pos) - progress_bar.value = pos - end -} -playerctl:connect_signal("position", function(_, pos, len) - -- progress_bar.value = pos - progress_smoothing.target = pos - progress_bar.max_value = len -end) - -local archaic = {} - -archaic.playerctl = playerctl - -archaic.widget = qui.popup { - placement = function(d) - return awful.placement.right(d, { - margins = beautiful.useless_gap * 2 - }) - end, - ontop = true, - minimum_width = qvars.bar_size * 20, - maximum_width = qvars.bar_size * 20, - minimum_height = height, - maximum_height = height, - widget = { - qui.styled { - widget = wibox.container.background, - { - widget = wibox.container.margin, - margins = qvars.big_padding, - { - cover, - { - { - { - { - widget = wibox.container.scroll.horizontal, - speed = 40, - fps = 60, - step_function = wibox.container.scroll.step_functions.waiting_nonlinear_back_and_forth, - song - }, - { - widget = wibox.container.scroll.horizontal, - speed = 40, - fps = 60, - step_function = wibox.container.scroll.step_functions.waiting_nonlinear_back_and_forth, - artist - }, - layout = wibox.layout.fixed.vertical - }, - { - widget = wibox.container.background, - bg = gc { - type = "linear", - from = { 0, 0 }, - to = { inside_width, 0 }, - -- ^-------------------------------------------------------------------------------------- 270px - stops = { - { 0, "#0000000" }, - { 0.95, "#0000000" }, - { 0.95, qvars.colors.bg .. "1a" }, - { 1, qvars.colors.bg } - } - } - }, - layout = wibox.layout.stack - }, - nil, - { - progress_bar, - { - back, - play_pause, - forward, - - spacing = qvars.padding, - layout = wibox.layout.fixed.horizontal - }, - spacing = qvars.big_padding, - layout = wibox.layout.fixed.horizontal - }, - layout = wibox.layout.align.vertical - }, - spacing = qvars.big_padding - qvars.border_width, -- for some reason awesome adds border_width here - layout = wibox.layout.fixed.horizontal - } - } - }, - layout = wibox.layout.fixed.vertical - } -} - -playerctl:connect_signal("metadata", function(_, _song, _artist, _cover) - -- n { message = "sus" } - song:set_text(_song .. " ") - -- ic.widget:emit_signal("widget::redraw_needed") - artist:set_markup(qui.markup_fg(qvars.colors.dim.fg, _artist .. " ")) - if _cover == "" then - cover.cover.visible = false - cover.no_cover.visible = true - return - end - cover.cover.image = gs.load_uncached(_cover) - cover.cover.visible = true - cover.no_cover.visible = false -end) - -function archaic:toggle() - self.widget.visible = not self.widget.visible -end - -archaic:toggle() - -return archaic |