diff options
author | delta <darkussdelta@gmail.com> | 2023-05-12 16:18:24 +0200 |
---|---|---|
committer | delta <darkussdelta@gmail.com> | 2023-05-12 16:18:24 +0200 |
commit | f5612f081db0dc69f5c0ebc69e67fa3b098a9ad9 (patch) | |
tree | 7a04027efe5fede7f08688a9524c5dbe6628635b /.config/awesome/ui | |
parent | ea1bdf6585caed2c0ba8669ca5c3b3b92232281a (diff) |
restructure services, add get_essid to quarrel.native and other wip work
Diffstat (limited to '.config/awesome/ui')
18 files changed, 267 insertions, 580 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 diff --git a/.config/awesome/ui/decorations/init.lua b/.config/awesome/ui/decorations/init.lua index 9493a67..5b33dc3 100644 --- a/.config/awesome/ui/decorations/init.lua +++ b/.config/awesome/ui/decorations/init.lua @@ -1,2 +1,2 @@ -require "ui.decorations.titlebar" require "ui.decorations.wallpaper" +-- require "ui.decorations.clippy" diff --git a/.config/awesome/ui/decorations/titlebar.lua b/.config/awesome/ui/decorations/titlebar.lua deleted file mode 100644 index ab96457..0000000 --- a/.config/awesome/ui/decorations/titlebar.lua +++ /dev/null @@ -1,84 +0,0 @@ -local awful = require "awful" -local cfg = require "misc.cfg" -local gears = require "gears" -local qvars = require "quarrel.vars" -local rubato = require "lib.rubato" -local wibox = require "wibox" - -local function button(color, color_focus, callback) - local widget = wibox.widget { - widget = wibox.container.background, - forced_height = qvars.button_size, - forced_width = qvars.button_size, - bg = color, - shape = qvars.shape, - buttons = { callback } - } - - widget:connect_signal("mouse::enter", function() - local timed = rubato.timed { - duration = 0.1, - intro = 0.05, - pos = qvars.button_size, - subscribed = function(pos) - widget.forced_width = pos - end - } - - timed.target = qvars.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 = qvars.button_size * 2, - subscribed = function(pos) - widget.forced_width = pos - end - } - - timed.target = qvars.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 = qvars.button_size + qvars.padding * 2 - }) - - awful.titlebar.enable_tooltip = false - - titlebar.widget = { - widget = wibox.container.margin, - margins = qvars.padding, - { - nil, - nil, - { - button(qvars.colors.green, qvars.colors.bright.green, awful.button({}, 1, function() - c.maximized = not c.maximized - end)), - button(qvars.colors.yellow, qvars.colors.bright.yellow, awful.button({}, 1, function() - gears.timer.delayed_call(function() - c.minimized = true - end) - end)), - button(qvars.colors.red, qvars.colors.bright.red, awful.button({}, 1, function() - c:kill() - end)), - - spacing = qvars.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 index e1323b8..dbe54ee 100644 --- a/.config/awesome/ui/decorations/wallpaper.lua +++ b/.config/awesome/ui/decorations/wallpaper.lua @@ -25,7 +25,8 @@ screen.connect_signal("request::wallpaper", function(s) }, "\n") } -- { - -- image = gfs.get_configuration_dir() .. "assets/nightmare_fuel.png", + -- -- image = gfs.get_configuration_dir() .. "assets/nightmare_fuel.png", + -- image = "/home/delta/Desktop/offline vs online.jpg", -- resize = true, -- widget = wibox.widget.imagebox, -- }, diff --git a/.config/awesome/ui/flashy/init.lua b/.config/awesome/ui/flashy/init.lua deleted file mode 100644 index 68f1e13..0000000 --- a/.config/awesome/ui/flashy/init.lua +++ /dev/null @@ -1,74 +0,0 @@ -local awful = require "awful" -local beautiful = require "beautiful" -local gcolor = require "gears.color" -local gdebug = require "gears.debug" -local gtable = require "gears.table" -local phosphor = require "assets.phosphor" -local qui = require "quarrel.ui" -local qvars = require "quarrel.vars" -local rubato = require "lib.rubato" -local wibox = require "wibox" - -local flashy = {} -flashy._timeout_timer = {} - -flashy._widget = qui.popup { - placement = awful.placement.centered, - ontop = true, - minimum_width = qvars.button_size * 15, - maximum_width = qvars.button_size * 15, - minimum_height = qvars.button_size * 15, - maximum_height = qvars.button_size * 15, - visible = false, - widget = { - { - widget = wibox.container.place, - valign = "center", - haligh = "center", - -- widget = wibox.container.margin, - -- margins = qvars.big_padding * 8, - { - widget = wibox.widget.imagebox, - image = gcolor.recolor_image(phosphor.battery_warning, qvars.colors.fg), - -- image = phosphor["battery_warning"], - forced_width = qvars.button_size * 15 - (qvars.border_width * 2 + qvars.big_padding * 2), - forced_height = qvars.button_size * 14 - (qvars.border_width * 2 + qvars.big_padding * 2) - } - }, - { - widget = wibox.widget.progressbar, - max_value = 100, - value = 50, - forced_height = qvars.button_size; - shape = qvars.shape, - color = qvars.colors.yellow, - background_color = qvars.colors.black - }, - layout = wibox.layout.fixed.vertical - } -} - -flashy._timed = rubato.timed { - duration = qvars.anim_duration, - intro = qvars.anim_intro, - pos = 0, - subscribed = function(pos) - flashy._widget.opacity = pos - - if pos == 0 then - flashy._widget.visible = false - else - flashy._widget.visible = true - end - end -} - -function flashy:show() - self._timed.target = 1 -end - -function flashy:hide() - self._timed.target = 0 -end - -return flashy diff --git a/.config/awesome/ui/init.lua b/.config/awesome/ui/init.lua index 9ab3019..e41644f 100644 --- a/.config/awesome/ui/init.lua +++ b/.config/awesome/ui/init.lua @@ -1,5 +1,2 @@ --- require "ui.window_switcher" --- require "ui.conductor" require "ui.statusbar" --- require "ui.info_center" require "ui.decorations" diff --git a/.config/awesome/ui/statusbar/init.lua b/.config/awesome/ui/statusbar/init.lua index e923473..7400a76 100644 --- a/.config/awesome/ui/statusbar/init.lua +++ b/.config/awesome/ui/statusbar/init.lua @@ -14,6 +14,7 @@ local brightness = require "ui.statusbar.widgets.brightness" local clock = require "ui.statusbar.widgets.clock" local keyboardlayout = require "ui.statusbar.widgets.keyboardlayout" local taglist = require "ui.statusbar.widgets.taglist" +local volume = require "ui.statusbar.widgets.volume" local wifi = require "ui.statusbar.widgets.wifi" screen.connect_signal("request::desktop_decoration", function(s) @@ -24,8 +25,8 @@ screen.connect_signal("request::desktop_decoration", function(s) { widget = wibox.widget.imagebox, image = gcolor.recolor_image(phosphor.caret_right_fill, qvars.colors.fg), - forced_width = qvars.icon_size, - forced_height = qvars.icon_size + forced_width = qvars.char_height, + forced_height = qvars.char_height }, _expanded = false } @@ -51,14 +52,15 @@ screen.connect_signal("request::desktop_decoration", function(s) widget = wibox.container.place, valign = "bottom", { + brightness, + volume, + battery, + wifi, { widget = wibox.container.place, keyboardlayout }, clock, - wifi, - brightness, - battery, layout = wibox.layout.fixed.vertical, spacing = qvars.padding * 2 }, @@ -69,7 +71,7 @@ screen.connect_signal("request::desktop_decoration", function(s) nil, nil, layout = wibox.layout.align.horizontal, - } + }, } local bar_width = bar.width + qvars.border_width * 2 @@ -78,6 +80,8 @@ screen.connect_signal("request::desktop_decoration", function(s) left = bar_width + beautiful.useless_gap * 4 } + local panel_width + local timed = rubato.timed { duration = qvars.anim_duration, intro = qvars.anim_intro, @@ -85,6 +89,9 @@ screen.connect_signal("request::desktop_decoration", function(s) subscribed = function(pos) if pos ~= bar_width and expand_button._expanded then bar.widget.widget.third = panel + if panel_width == nil then + panel_width = bar.widget.widget.third.width + end bar.ontop = true elseif pos == bar_width and not expand_button._expanded then bar.widget.widget.third = nil @@ -104,12 +111,15 @@ screen.connect_signal("request::desktop_decoration", function(s) if expand_button._expanded then timed.target = bar_width else - timed.target = bar_width + qvars.bar_size * 6 + timed.target = bar_width + qvars.expanded_bar_size + -- timed.target = bar_width + qvars.big_padding + (qvars.big_padding * 2 + qvars.element_size * 4) * 3 + qvars.padding * 2 end + -- q.debug(tostring(panel_width)) expand_button._expanded = not expand_button._expanded end, hidden = true } } + end) diff --git a/.config/awesome/ui/statusbar/panel/init.lua b/.config/awesome/ui/statusbar/panel/init.lua index fe66789..b9b414c 100644 --- a/.config/awesome/ui/statusbar/panel/init.lua +++ b/.config/awesome/ui/statusbar/panel/init.lua @@ -1,65 +1,46 @@ local qvars = require "quarrel.vars" local wibox = require "wibox" -local battery_bar = require "ui.statusbar.panel.widgets.battery_bar" -local brightness_bar = require "ui.statusbar.panel.widgets.brightness_bar" +local displays = require "ui.statusbar.panel.widgets.displays" +local power_menu = require "ui.statusbar.panel.widgets.power_menu" + local panel = wibox.widget { - { + -- widget = wibox.container.constraint, + -- width = qvars.expanded_bar_size, + -- strategy = "exact", + -- { widget = wibox.container.margin, margins = { - left = qvars.big_padding * 2 - } - }, - { - widget = wibox.container.constraint, - width = qvars.bar_size * 6, - strategy = "exact", + left = qvars.big_padding + }, { - widget = wibox.container.margin, - margins = { - right = qvars.big_padding * 4 - }, { + widget = wibox.container.place, + valign = "top", { - widget = wibox.widget.calendar.month, - date = os.date("*t"), - font = qvars.font, - -- long_weekdays = true, - -- flex_height = true, - -- fn_embed = decorate_cell - }, - { - widget = wibox.container.background, - -- bg = qvars.colors.blue, - { - widget = wibox.widget.textbox, - text = ":)" - } - }, + displays.battery, + displays.volume, + displays.brightness, + layout = wibox.layout.fixed.horizontal, + spacing = qvars.padding, + } + }, + { + widget = wibox.container.background, { - widget = wibox.container.place, - valign = "bottom", - { - { - widget = wibox.widget.separator, - forced_height = qvars.char_height * 4 + qvars.padding * 4, - color = qvars.colors.transparent, - }, - brightness_bar, - battery_bar, - layout = wibox.layout.fixed.vertical, - spacing = qvars.padding * 2 - }, - }, - layout = wibox.layout.align.vertical, - } + widget = wibox.widget.textbox, + text = ":)" + } + }, + { + widget = wibox.container.place, + valign = "bottom", + power_menu + }, + layout = wibox.layout.align.vertical, } - }, - layout = wibox.layout.fixed.horizontal + -- } } --- panel:get_children_by_id("ratio_layout"):adjust_ratio(2, 0.3, 0.7, 0) --- gdebug.dump(panel:get_children_by_id("ratio_layout")) - return panel diff --git a/.config/awesome/ui/statusbar/panel/widgets/battery_bar.lua b/.config/awesome/ui/statusbar/panel/widgets/battery_bar.lua deleted file mode 100644 index c1466f4..0000000 --- a/.config/awesome/ui/statusbar/panel/widgets/battery_bar.lua +++ /dev/null @@ -1,60 +0,0 @@ -local qmath = require "quarrel.math" -local qvars = require "quarrel.vars" -local wibox = require "wibox" - -local battery_bar = wibox.widget { - widget = wibox.container.place, - forced_height = qvars.char_height, - { - { - widget = wibox.container.constraint, - width = qvars.char_width * 4, - strategy = "exact", - { - widget = wibox.widget.textbox, - text = "0%" - }, - id = "text" - }, - nil, - { - widget = wibox.container.margin, - margins = { - left = qvars.padding - }, - { - widget = wibox.container.place, - { - widget = wibox.widget.progressbar, - max_value = 100, - value = 0, - forced_height = qvars.char_height / 4, - shape = qvars.shape, - background_color = qvars.colors.black, - color = qvars.colors.red, - } - }, - id = "bar" - }, - layout = wibox.layout.align.horizontal, - -- expand = "outside" - } -} - -awesome.connect_signal("services::battery", function(capacity) - local color = qmath.step_value(capacity, { - { 0, "red" }, - { 20, "red" }, - { 40, "yellow" }, - { 60, "green" }, - { 80, "green" }, - { 100 } - }) - - battery_bar.widget.bar.widget.widget.color = qvars.colors[color] - battery_bar.widget.bar.widget.widget.value = capacity - - battery_bar.widget.text.widget.text = capacity .. "%" -end) - -return battery_bar diff --git a/.config/awesome/ui/statusbar/panel/widgets/brightness_bar.lua b/.config/awesome/ui/statusbar/panel/widgets/brightness_bar.lua deleted file mode 100644 index 7d3e5f0..0000000 --- a/.config/awesome/ui/statusbar/panel/widgets/brightness_bar.lua +++ /dev/null @@ -1,46 +0,0 @@ -local qmath = require "quarrel.math" -local qvars = require "quarrel.vars" -local wibox = require "wibox" - -local brightness_bar = wibox.widget { - widget = wibox.container.place, - forced_height = qvars.char_height, - { - { - widget = wibox.widget.textbox, - text = "0%", - id = "text" - }, - nil, - { - widget = wibox.container.margin, - margins = { - left = qvars.padding - }, - { - widget = wibox.container.place, - { - widget = wibox.widget.progressbar, - max_value = 100, - value = 0, - forced_height = qvars.char_height / 4, - shape = qvars.shape, - background_color = qvars.colors.black, - color = qvars.colors.fg, - } - }, - id = "bar" - }, - layout = wibox.layout.align.horizontal, - } -} - -awesome.connect_signal("services::brightness", function(brightness) - brightness = math.floor(qmath.translate_range(brightness, 0, 255, 0, 100)) - - brightness_bar.widget.bar.widget.widget.value = brightness - - brightness_bar.widget.text.text = brightness .. "%" -end) - -return brightness_bar diff --git a/.config/awesome/ui/statusbar/panel/widgets/calendar.lua b/.config/awesome/ui/statusbar/panel/widgets/calendar.lua index e69de29..8b13789 100644 --- a/.config/awesome/ui/statusbar/panel/widgets/calendar.lua +++ b/.config/awesome/ui/statusbar/panel/widgets/calendar.lua @@ -0,0 +1 @@ + diff --git a/.config/awesome/ui/statusbar/panel/widgets/displays.lua b/.config/awesome/ui/statusbar/panel/widgets/displays.lua new file mode 100644 index 0000000..cd05253 --- /dev/null +++ b/.config/awesome/ui/statusbar/panel/widgets/displays.lua @@ -0,0 +1,104 @@ +local qmath = require "quarrel.math" +local qvars = require "quarrel.vars" +local qui = require "quarrel.ui" +local wibox = require "wibox" +local phosphor = require "assets.phosphor" +local gcolor = require "gears.color" + +local function create_display(icon, color) + return wibox.widget(qui.styled { + widget = wibox.container.background, + { + widget = wibox.container.margin, + margins = qvars.big_padding, + { + widget = wibox.container.place, + { + { + widget = wibox.container.radialprogressbar, + max_value = 100, + border_color = qvars.colors.black, + color = color, + border_width = qvars.border_width * 2, + forced_height = qvars.element_size * 4, + forced_width = qvars.element_size * 4, + { + widget = wibox.container.place, + { + widget = wibox.widget.imagebox, + image = icon, + forced_height = qvars.char_height, + forced_width = qvars.char_height, + id = "icon" + } + }, + id = "indicator" + }, + { + widget = wibox.container.place, + { + widget = wibox.widget.textbox, + text = "0%", + id = "text" + } + }, + layout = wibox.layout.fixed.vertical, + spacing = qvars.big_padding + } + } + } + }) +end + +local d_battery = create_display(gcolor.recolor_image(phosphor.battery_vertical_warning_fill, qvars.colors.fg), qvars.colors.red) + +awesome.connect_signal("services::battery", function(capacity, status) + local icon_data = status == "Charging" and { "charging", "green" } or qmath.step_value(capacity, { + { 0, { "empty", "red" } }, + { 20, { "low", "red" } }, + { 40, { "medium", "yellow" } }, + { 60, { "high", "green" } }, + { 80, { "full", "green" } }, + { 100 } + }) + + d_battery:get_children_by_id("indicator")[1].color = qvars.colors[icon_data[2]] + d_battery:get_children_by_id("indicator")[1].value = capacity + d_battery:get_children_by_id("icon")[1].image = gcolor.recolor_image(phosphor["battery_vertical_" .. icon_data[1] .. "_fill"], qvars.colors[icon_data[2]]) + + d_battery:get_children_by_id("text")[1].text = capacity .. "%" +end) + +local d_volume = create_display(gcolor.recolor_image(phosphor.speaker_simple_high_fill, qvars.colors.fg), qvars.colors.fg) + +awesome.connect_signal("services::audio", function(volume, muted) + d_volume:get_children_by_id("indicator")[1].value = math.min(volume, 100) + d_volume:get_children_by_id("text")[1].text = volume .. "%" + + if muted then + d_volume:get_children_by_id("icon")[1].image = gcolor.recolor_image(phosphor["speaker_simple_x_fill"], qvars.colors.red) + return + end + + local icon_data = qmath.step_value(volume, { + { 0, "slash" }, + { 25, "none" }, + { 50, "low" }, + { 75, "high" }, + { 100 } + }) + + d_volume:get_children_by_id("icon")[1].image = gcolor.recolor_image(phosphor["speaker_simple_" .. icon_data .. "_fill"], qvars.colors.fg) +end) + +local d_brightness = create_display(gcolor.recolor_image(phosphor.sun_fill, qvars.colors.fg), qvars.colors.fg) + +awesome.connect_signal("services::brightness", function(brightness) + brightness = math.floor(qmath.translate_range(brightness, 0, 255, 0, 100)) + + d_brightness:get_children_by_id("indicator")[1].value = brightness + + d_brightness:get_children_by_id("text")[1].text = brightness .. "%" +end) + +return { battery = d_battery, volume = d_volume, brightness = d_brightness } diff --git a/.config/awesome/ui/statusbar/panel/widgets/power_menu.lua b/.config/awesome/ui/statusbar/panel/widgets/power_menu.lua new file mode 100644 index 0000000..ffb5a76 --- /dev/null +++ b/.config/awesome/ui/statusbar/panel/widgets/power_menu.lua @@ -0,0 +1,62 @@ +local q = require "quarrel" +local qbind = require "quarrel.bind" +local qvars = require "quarrel.vars" +local qui = require "quarrel.ui" +local wibox = require "wibox" + +local power_menu = wibox.widget { + qui.styled { + widget = wibox.container.background, + bg = qvars.colors.black, + { + widget = wibox.widget.textbox, + text = "1", + buttons = { + qbind:new { + triggers = qvars.btns.left, + press = function() + q.debug("from 1") + end, + hidden = true + } + } + } + }, + qui.styled { + widget = wibox.container.background, + bg = qvars.colors.black, + { + widget = wibox.widget.textbox, + text = "2", + buttons = { + qbind:new { + triggers = qvars.btns.left, + press = function() + q.debug("from 2") + end, + hidden = true + } + } + } + }, + qui.styled { + widget = wibox.container.background, + bg = qvars.colors.black, + { + widget = wibox.widget.textbox, + text = "3", + buttons = { + qbind:new { + triggers = qvars.btns.left, + press = function() + q.debug("from 3") + end, + hidden = true + } + } + } + }, + layout = wibox.layout.flex.horizontal +} + +return power_menu diff --git a/.config/awesome/ui/statusbar/widgets/battery.lua b/.config/awesome/ui/statusbar/widgets/battery.lua index 98af803..f220ff1 100644 --- a/.config/awesome/ui/statusbar/widgets/battery.lua +++ b/.config/awesome/ui/statusbar/widgets/battery.lua @@ -10,19 +10,14 @@ local battery = wibox.widget { halign = "center", { widget = wibox.widget.imagebox, - image = gcolor.recolor_image(phosphor.battery_warning_vertical_fill, qvars.colors.red), - forced_width = qvars.icon_size, - forced_height = qvars.icon_size + image = gcolor.recolor_image(phosphor.battery_vertical_warning_fill, qvars.colors.red), + forced_width = qvars.char_height, + forced_height = qvars.char_height } } awesome.connect_signal("services::battery", function(capacity, status) - if status == "Charging" then - battery.widget.image = gcolor.recolor_image(phosphor.battery_charging_vertical_fill, qvars.colors.green) - return - end - - local icon_data = qmath.step_value(capacity, { + local icon_data = status == "Charging" and { "charging", "green" } or qmath.step_value(capacity, { { 0, { "empty", "red" } }, { 20, { "low", "red" } }, { 40, { "medium", "yellow" } }, diff --git a/.config/awesome/ui/statusbar/widgets/brightness.lua b/.config/awesome/ui/statusbar/widgets/brightness.lua index 5c1cb16..bfb8e91 100644 --- a/.config/awesome/ui/statusbar/widgets/brightness.lua +++ b/.config/awesome/ui/statusbar/widgets/brightness.lua @@ -11,8 +11,8 @@ local brightness = wibox.widget { { widget = wibox.widget.imagebox, image = gcolor.recolor_image(phosphor.moon_fill, qvars.colors.fg), - forced_width = qvars.icon_size, - forced_height = qvars.icon_size + forced_width = qvars.char_height, + forced_height = qvars.char_height } } diff --git a/.config/awesome/ui/statusbar/widgets/taglist.lua b/.config/awesome/ui/statusbar/widgets/taglist.lua index 5b479bc..10618aa 100644 --- a/.config/awesome/ui/statusbar/widgets/taglist.lua +++ b/.config/awesome/ui/statusbar/widgets/taglist.lua @@ -19,8 +19,8 @@ return awful.widget.taglist { { widget = wibox.widget.imagebox, image = gcolor.recolor_image(phosphor.circle_bold, qvars.colors.fg), - forced_width = qvars.icon_size, - forced_height = qvars.icon_size, + forced_width = qvars.char_height, + forced_height = qvars.char_height, icon = phosphor.dot_fill }, create_callback = function(self, tag) diff --git a/.config/awesome/ui/statusbar/widgets/volume.lua b/.config/awesome/ui/statusbar/widgets/volume.lua index e69de29..72723a0 100644 --- a/.config/awesome/ui/statusbar/widgets/volume.lua +++ b/.config/awesome/ui/statusbar/widgets/volume.lua @@ -0,0 +1,36 @@ +local gcolor = require "gears.color" +local phosphor = require "assets.phosphor" +local qmath = require "quarrel.math" +local qvars = require "quarrel.vars" +local wibox = require "wibox" + +local volume_widget = wibox.widget { + widget = wibox.container.place, + valign = "center", + halign = "center", + { + widget = wibox.widget.imagebox, + image = gcolor.recolor_image(phosphor.speaker_simple_slash_fill, qvars.colors.red), + forced_width = qvars.char_height, + forced_height = qvars.char_height + } +} + +awesome.connect_signal("services::audio", function(volume, muted) + if muted then + volume_widget.widget.image = gcolor.recolor_image(phosphor["speaker_simple_x_fill"], qvars.colors.red) + return + end + + local icon_data = qmath.step_value(volume, { + { 0, "slash" }, + { 25, "none" }, + { 50, "low" }, + { 75, "high" }, + { 100 } + }) + + volume_widget.widget.image = gcolor.recolor_image(phosphor["speaker_simple_" .. icon_data .. "_fill"], qvars.colors.fg) +end) + +return volume_widget diff --git a/.config/awesome/ui/statusbar/widgets/wifi.lua b/.config/awesome/ui/statusbar/widgets/wifi.lua index ec5b72c..c895b0a 100644 --- a/.config/awesome/ui/statusbar/widgets/wifi.lua +++ b/.config/awesome/ui/statusbar/widgets/wifi.lua @@ -3,6 +3,8 @@ local phosphor = require "assets.phosphor" local qmath = require "quarrel.math" local qvars = require "quarrel.vars" local wibox = require "wibox" +local q = require "quarrel" +local gdebug = require "gears.debug" local wifi = wibox.widget { widget = wibox.container.place, @@ -11,12 +13,12 @@ local wifi = wibox.widget { { widget = wibox.widget.imagebox, image = gcolor.recolor_image(phosphor.wifi_x_fill, qvars.colors.red), - forced_width = qvars.icon_size, - forced_height = qvars.icon_size + forced_width = qvars.char_height, + forced_height = qvars.char_height } } -awesome.connect_signal("services::wifi", function(strength, connected) +awesome.connect_signal("services::wifi", function(essid, strength, connected) if not connected then wifi.widget.image = gcolor.recolor_image(phosphor.wifi_x_fill, qvars.colors.red) return |