aboutsummaryrefslogtreecommitdiff
path: root/.config/awesome/ui/archaic
diff options
context:
space:
mode:
authordelta <darkussdelta@gmail.com>2023-03-04 22:04:55 +0100
committerdelta <darkussdelta@gmail.com>2023-03-04 22:18:21 +0100
commitf0b32f45746c026d402651013b7e98315d6956a1 (patch)
treef42609e98522da081cebdd21a674a702d1054bbc /.config/awesome/ui/archaic
parenta0f8b5fa6acdd1c2477fb1881dd9067956bf0ae6 (diff)
restructure awesome config, add fresnel
Diffstat (limited to '.config/awesome/ui/archaic')
-rw-r--r--.config/awesome/ui/archaic/init.lua239
1 files changed, 239 insertions, 0 deletions
diff --git a/.config/awesome/ui/archaic/init.lua b/.config/awesome/ui/archaic/init.lua
new file mode 100644
index 0000000..eace674
--- /dev/null
+++ b/.config/awesome/ui/archaic/init.lua
@@ -0,0 +1,239 @@
+local awful = require "awful"
+local btn = awful.button.names
+local gc = require "gears.color"
+local gs = require "gears.surface"
+local vars = require "misc.vars"
+local h = require "misc.helpers"
+local wibox = require "wibox"
+local beautiful = require "beautiful"
+local rubato = require "lib.rubato"
+local playerctl = require "lib.bling.signal.playerctl".lib {
+ -- ignore = "firefox",
+ player = { "spotify", "cmus", "%any" }
+}
+
+local height = screen[1].geometry.height - (beautiful.useless_gap * 4 + vars.border_width * 2)
+local inside_width = vars.bar_size * 20 - (vars.big_padding * 4 + vars.border_width * 4 + vars.bar_size * 4)
+
+local cover = wibox.widget {
+ {
+ widget = wibox.widget.imagebox,
+ clip_shape = vars.shape,
+ forced_width = vars.bar_size * 4,
+ forced_height = vars.bar_size * 4,
+ visible = false,
+ id = "cover"
+ },
+ {
+ widget = wibox.container.background,
+ forced_width = vars.bar_size * 4,
+ forced_height = vars.bar_size * 4,
+ bg = vars.colors.black,
+ fg = vars.colors.dim.fg,
+ shape = vars.shape,
+ {
+ widget = wibox.container.place,
+ {
+ widget = wibox.widget.textbox,
+ text = "󰝚",
+ font = h.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 = h.markup_fg(vars.colors.dim.fg, "Nothing Playing "),
+ font = h.font(0.8),
+}
+
+local back = wibox.widget {
+ widget = wibox.widget.textbox,
+ text = "",
+ font = h.symbol_font(1.5),
+ forced_height = beautiful.get_font_height(h.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 = h.font(1.5),
+ forced_height = beautiful.get_font_height(h.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 = h.font(1.5),
+ forced_height = beautiful.get_font_height(h.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 = vars.shape,
+ bar_shape = vars.shape,
+ forced_height = beautiful.get_font_height(h.font(0.5)),
+ forced_width = inside_width - (vars.padding * 2 + vars.big_padding + back:get_preferred_size_at_dpi(screen[1].dpi) * 3),
+ color = vars.colors.yellow,
+ background_color = vars.colors.black
+}
+local progress_smoothing = rubato.timed {
+ duration = vars.anim_duration,
+ intro = vars.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 = h.popup {
+ placement = function(d)
+ return awful.placement.right(d, {
+ margins = beautiful.useless_gap * 2
+ })
+ end,
+ ontop = true,
+ minimum_width = vars.bar_size * 20,
+ maximum_width = vars.bar_size * 20,
+ minimum_height = height,
+ maximum_height = height,
+ widget = {
+ h.styled {
+ widget = wibox.container.background,
+ {
+ widget = wibox.container.margin,
+ margins = vars.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, vars.colors.bg .. "1a" },
+ { 1, vars.colors.bg }
+ }
+ }
+ },
+ layout = wibox.layout.stack
+ },
+ nil,
+ {
+ progress_bar,
+ {
+ back,
+ play_pause,
+ forward,
+
+ spacing = vars.padding,
+ layout = wibox.layout.fixed.horizontal
+ },
+ spacing = vars.big_padding,
+ layout = wibox.layout.fixed.horizontal
+ },
+ layout = wibox.layout.align.vertical
+ },
+ spacing = vars.big_padding - vars.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(h.markup_fg(vars.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