diff options
author | delta <darkussdelta@gmail.com> | 2023-04-04 15:43:40 +0200 |
---|---|---|
committer | delta <darkussdelta@gmail.com> | 2023-04-04 15:43:40 +0200 |
commit | f7116d268aff3fae88d8de408e8c807295618a5c (patch) | |
tree | 6f52530d5799769e6af7c63bc5108f16f9aff742 /.config/awesome/ui | |
parent | f0b32f45746c026d402651013b7e98315d6956a1 (diff) |
restructure and improve config
Diffstat (limited to '.config/awesome/ui')
28 files changed, 526 insertions, 809 deletions
diff --git a/.config/awesome/ui/archaic/init.lua b/.config/awesome/ui/archaic/init.lua index eace674..df7bbda 100644 --- a/.config/awesome/ui/archaic/init.lua +++ b/.config/awesome/ui/archaic/init.lua @@ -2,41 +2,40 @@ 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 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 { - -- 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 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 = vars.shape, - forced_width = vars.bar_size * 4, - forced_height = vars.bar_size * 4, + 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 = vars.bar_size * 4, - forced_height = vars.bar_size * 4, - bg = vars.colors.black, - fg = vars.colors.dim.fg, - shape = vars.shape, + 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 = h.font(4) + font = qui.font(4) } }, id = "no_cover" @@ -52,15 +51,15 @@ local song = wibox.widget { local artist = wibox.widget { widget = wibox.widget.textbox, - markup = h.markup_fg(vars.colors.dim.fg, "Nothing Playing "), - font = h.font(0.8), + 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 = h.symbol_font(1.5), - forced_height = beautiful.get_font_height(h.symbol_font(0.5)) + font = qui.symbol_font(1.5), + forced_height = beautiful.get_font_height(qui.symbol_font(0.5)) } back:add_button(awful.button { modifiers = {}, @@ -73,8 +72,8 @@ back:add_button(awful.button { 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)) + font = qui.font(1.5), + forced_height = beautiful.get_font_height(qui.font(0.5)) } play_pause:add_button(awful.button { modifiers = {}, @@ -94,8 +93,8 @@ 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)) + font = qui.font(1.5), + forced_height = beautiful.get_font_height(qui.font(0.5)) } forward:add_button(awful.button { @@ -110,16 +109,16 @@ 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 + 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 = vars.anim_duration, - intro = vars.anim_intro, + duration = qvars.anim_duration, + intro = qvars.anim_intro, pos = 0, subscribed = function(pos) progress_bar.value = pos @@ -135,23 +134,23 @@ local archaic = {} archaic.playerctl = playerctl -archaic.widget = h.popup { +archaic.widget = qui.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_width = qvars.bar_size * 20, + maximum_width = qvars.bar_size * 20, minimum_height = height, maximum_height = height, widget = { - h.styled { + qui.styled { widget = wibox.container.background, { widget = wibox.container.margin, - margins = vars.big_padding, + margins = qvars.big_padding, { cover, { @@ -183,8 +182,8 @@ archaic.widget = h.popup { stops = { { 0, "#0000000" }, { 0.95, "#0000000" }, - { 0.95, vars.colors.bg .. "1a" }, - { 1, vars.colors.bg } + { 0.95, qvars.colors.bg .. "1a" }, + { 1, qvars.colors.bg } } } }, @@ -198,15 +197,15 @@ archaic.widget = h.popup { play_pause, forward, - spacing = vars.padding, + spacing = qvars.padding, layout = wibox.layout.fixed.horizontal }, - spacing = vars.big_padding, + spacing = qvars.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 + spacing = qvars.big_padding - qvars.border_width, -- for some reason awesome adds border_width here layout = wibox.layout.fixed.horizontal } } @@ -219,7 +218,7 @@ 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 .. " ")) + artist:set_markup(qui.markup_fg(qvars.colors.dim.fg, _artist .. " ")) if _cover == "" then cover.cover.visible = false cover.no_cover.visible = true diff --git a/.config/awesome/ui/conductor/init.lua b/.config/awesome/ui/conductor/init.lua new file mode 100644 index 0000000..1790d0d --- /dev/null +++ b/.config/awesome/ui/conductor/init.lua @@ -0,0 +1,26 @@ +local awful = require "awful" +local qui = require "quarrel.ui" +local q = require "quarrel" +local qvars = require "quarrel.vars" + +awful.keygrabber { + keybindings = { + awful.key { + modifiers = qvars.mods.A, + key = "Tab", + on_press = awful.client.focus.history.previous + }, + awful.key { + modifiers = qvars.mods.AS, + key = "Tab", + on_press = awful.client.focus.history.next + }, + }, + -- Note that it is using the key name and not the modifier name. + stop_key = "Mod1", + stop_event = "release", + -- start_callback = awful.client.focus.history.disable_tracking, + stop_callback = awful.client.focus.history.enable_tracking, + export_keybindings = true, + autostart = true +} diff --git a/.config/awesome/ui/decorations/titlebar.lua b/.config/awesome/ui/decorations/titlebar.lua index 8451817..9463dbc 100644 --- a/.config/awesome/ui/decorations/titlebar.lua +++ b/.config/awesome/ui/decorations/titlebar.lua @@ -1,5 +1,5 @@ local awful = require "awful" -local vars = require "misc.vars" +local qvars = require "quarrel.vars" local gears = require "gears" local wibox = require "wibox" local rubato = require "lib.rubato" @@ -8,10 +8,10 @@ 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, + forced_height = qvars.button_size, + forced_width = qvars.button_size, bg = color, - shape = vars.shape, + shape = qvars.shape, buttons = { callback } } @@ -19,13 +19,13 @@ local function button(color, color_focus, callback) local timed = rubato.timed { duration = 0.1, intro = 0.05, - pos = vars.button_size, + pos = qvars.button_size, subscribed = function(pos) widget.forced_width = pos end } - timed.target = vars.button_size * 2 + timed.target = qvars.button_size * 2 widget.bg = color_focus end) @@ -33,13 +33,13 @@ local function button(color, color_focus, callback) local timed = rubato.timed { duration = 0.1, intro = 0.05, - pos = vars.button_size * 2, + pos = qvars.button_size * 2, subscribed = function(pos) widget.forced_width = pos end } - timed.target = vars.button_size + timed.target = qvars.button_size widget.bg = color end) @@ -51,31 +51,31 @@ client.connect_signal("request::titlebars", function(c) local titlebar = awful.titlebar(c, { position = "top", - size = vars.button_size + vars.padding * 2 + size = qvars.button_size + qvars.padding * 2 }) awful.titlebar.enable_tooltip = false titlebar.widget = { widget = wibox.container.margin, - margins = vars.padding, + margins = qvars.padding, { nil, nil, { - button(vars.colors.green, vars.colors.bright.green, awful.button({}, 1, function() + button(qvars.colors.green, qvars.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() + button(qvars.colors.yellow, qvars.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() + button(qvars.colors.red, qvars.colors.bright.red, awful.button({}, 1, function() c:kill() end)), - spacing = vars.padding, + spacing = qvars.padding, layout = wibox.layout.fixed.horizontal }, layout = wibox.layout.align.horizontal diff --git a/.config/awesome/ui/decorations/wallpaper.lua b/.config/awesome/ui/decorations/wallpaper.lua index f7104ff..3c85b83 100644 --- a/.config/awesome/ui/decorations/wallpaper.lua +++ b/.config/awesome/ui/decorations/wallpaper.lua @@ -1,11 +1,11 @@ local wallpaper = require "awful.wallpaper" local wibox = require "wibox" -local vars = require "misc.vars" -local h = require "misc.helpers" +local qvars = require "quarrel.vars" +local qui = require "quarrel.ui" screen.connect_signal("request::wallpaper", function(s) wallpaper { - bg = vars.colors.dim.bg, + bg = qvars.colors.dim.bg, screen = s, widget = { widget = wibox.container.place, @@ -13,14 +13,14 @@ screen.connect_signal("request::wallpaper", function(s) halign = "center", { widget = wibox.widget.textbox, - font = h.font(1.5), + font = qui.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, " \\/__/") + qui.markup_fg(qvars.colors.red, " ___"), + qui.markup_fg(qvars.colors.green, " /\\ \\"), + qui.markup_fg(qvars.colors.yellow, " /::\\ \\"), + qui.markup_fg(qvars.colors.blue, "/::\\:\\__\\"), + qui.markup_fg(qvars.colors.pink, "\\/\\::/ /"), + qui.markup_fg(qvars.colors.cyan, " \\/__/") }, "\n") } } diff --git a/.config/awesome/ui/flashy/init.lua b/.config/awesome/ui/flashy/init.lua new file mode 100644 index 0000000..65f7518 --- /dev/null +++ b/.config/awesome/ui/flashy/init.lua @@ -0,0 +1,74 @@ +local awful = require "awful" +local gtable = require "gears.table" +local gdebug = require "gears.debug" +local gcolor = require "gears.color" +local qui = require "quarrel.ui" +local qvars = require "quarrel.vars" +local wibox = require "wibox" +local phosphor = require "assets.phosphor" +local beautiful = require "beautiful" +local rubato = require "lib.rubato" + +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/fresnel/init.lua b/.config/awesome/ui/fresnel/init.lua index cf1357a..242603f 100644 --- a/.config/awesome/ui/fresnel/init.lua +++ b/.config/awesome/ui/fresnel/init.lua @@ -1,19 +1,16 @@ local awful = require "awful" local gtable = require "gears.table" -local gdebug = require "gears.debug" -local gfs = require "gears.filesystem" -local h = require "misc.helpers" +local qui = require "quarrel.ui" +local qtable = require "quarrel.table" +local qnative = require "quarrel.native" local cfg = require "misc.cfg" -local vars = require "misc.vars" +local qvars = require "quarrel.vars" local wibox = require "wibox" local beautiful = require "beautiful" local rubato = require "lib.rubato" local al_prompt = require "lib.bling.widget.app_launcher.prompt" local btn = awful.button.names -package.cpath = package.cpath .. ";" .. gfs.get_configuration_dir() .. "ui/fresnel/lenses/target/debug/lib?.so" - -local lenses = require "lenses" local max_entries = 10 local fresnel = {} @@ -27,7 +24,7 @@ fresnel._selected_index = 1 function fresnel:_exec_entry(entry_index) local exec = self._entries_exec[entry_index] - if type(exec) ~= "userdata" then + if type(exec) ~= "userdata" and type(exec) ~= "nil" then awful.spawn((exec[2] and cfg.terminal .. " -e " or "") .. exec[1]) end end @@ -49,7 +46,7 @@ function fresnel:_update(query, scrolled) self._entries_exec = {} layout:reset() - for _, provider in h.opairs(lenses) do + for _, provider in qtable.opairs(qnative.lenses) do local entries = provider(query) table.sort(entries, function(a, b) @@ -70,18 +67,18 @@ function fresnel:_update(query, scrolled) local entry_widget = wibox.widget { widget = wibox.container.background, - shape = vars.shape, + shape = qvars.shape, { widget = wibox.container.margin, - margins = vars.padding, + margins = qvars.padding, { widget = wibox.container.constraint, strategy = "max", - height = vars.char_height, + height = qvars.char_height, { { widget = wibox.container.background, - fg = vars.colors.dim.fg, + fg = qvars.colors.dim.fg, { widget = wibox.widget.textbox, text = entry.provider .. " | " @@ -91,7 +88,7 @@ function fresnel:_update(query, scrolled) widget = wibox.widget.textbox, text = entry.message }, - spacing = vars.padding, + spacing = qvars.padding, layout = wibox.layout.fixed.horizontal } } @@ -110,17 +107,17 @@ function fresnel:_update(query, scrolled) if self._selected_index + self._entries_offset == i then entry_widget._selected = true - entry_widget.bg = vars.colors.black + entry_widget.bg = qvars.colors.black end entry_widget:connect_signal("mouse::enter", function() if entry_widget._selected == true then return end - entry_widget.bg = vars.colors.black + entry_widget.bg = qvars.colors.black end) entry_widget:connect_signal("mouse::leave", function() if entry_widget._selected == true then return end - entry_widget.bg = vars.colors.bg + entry_widget.bg = qvars.colors.bg end) layout:add(entry_widget) @@ -138,7 +135,7 @@ fresnel._prompt = al_prompt { prompt = "", reset_on_stop = true, ul_cursor = "low", - bg_cursor = vars.colors.black, + bg_cursor = qvars.colors.black, changed_callback = function(text) if fresnel._text == text then return end if fresnel._toggled == false then return end @@ -177,7 +174,7 @@ fresnel._prompt = al_prompt { end } -fresnel._widget = h.popup { +fresnel._widget = qui.popup { visible = false, ontop = true, placement = function(d) @@ -192,12 +189,12 @@ fresnel._widget = h.popup { widget = { { widget = wibox.container.background, - bg = vars.colors.black, - fg = vars.colors.dim.fg, - shape = vars.shape, + bg = qvars.colors.black, + fg = qvars.colors.dim.fg, + shape = qvars.shape, { widget = wibox.container.margin, - margins = vars.padding, + margins = qvars.padding, { { widget = wibox.widget.textbox, @@ -206,16 +203,16 @@ fresnel._widget = h.popup { { widget = wibox.container.margin, margins = { - left = vars.padding, - right = vars.padding + left = qvars.padding, + right = qvars.padding }, { widget = wibox.container.constraint, strategy = "max", - height = vars.char_height, + height = qvars.char_height, { widget = wibox.container.background, - fg = vars.colors.fg, + fg = qvars.colors.fg, fresnel._prompt.textbox } } @@ -232,10 +229,10 @@ fresnel._widget = h.popup { { widget = wibox.container.margin, margins = { - top = vars.padding + top = qvars.padding }, { - spacing = vars.padding, + spacing = qvars.padding, layout = wibox.layout.fixed.vertical, id = "entry_layout" } @@ -243,7 +240,7 @@ fresnel._widget = h.popup { layout = wibox.layout.align.vertical } } -fresnel._widget.maximum_height = vars.big_padding * 2 + (vars.padding * 2 + vars.char_height) * (1 + 10) + vars.padding + vars.padding * 9 +fresnel._widget.maximum_height = qvars.big_padding * 2 + (qvars.padding * 2 + qvars.char_height) * (1 + 10) + qvars.padding + qvars.padding * 9 function fresnel:show() self._toggled = true @@ -259,8 +256,8 @@ function fresnel:hide() end fresnel._timed = rubato.timed { - duration = vars.anim_duration, - intro = vars.anim_intro, + duration = qvars.anim_duration, + intro = qvars.anim_intro, pos = 0, subscribed = function(pos) fresnel._widget.opacity = pos diff --git a/.config/awesome/ui/fresnel/lenses/.gitignore b/.config/awesome/ui/fresnel/lenses/.gitignore deleted file mode 100644 index 4fffb2f..0000000 --- a/.config/awesome/ui/fresnel/lenses/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/target -/Cargo.lock diff --git a/.config/awesome/ui/fresnel/lenses/Cargo.toml b/.config/awesome/ui/fresnel/lenses/Cargo.toml deleted file mode 100644 index 4dcb8bc..0000000 --- a/.config/awesome/ui/fresnel/lenses/Cargo.toml +++ /dev/null @@ -1,18 +0,0 @@ -[package] -name = "lenses" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -freedesktop_entry_parser = "1.3.0" -meval = "0.2.0" -mlua = { version = "0.8.7", features = [ "module", "lua54", "serialize" ] } -parking_lot = "0.12.1" -rayon = "1.6.1" -serde = { version = "1.0.152", features = [ "derive" ] } -url = "2.3.1" - -[lib] -crate-type = ["cdylib"] diff --git a/.config/awesome/ui/fresnel/lenses/install.log b/.config/awesome/ui/fresnel/lenses/install.log deleted file mode 100644 index c0f5d63..0000000 --- a/.config/awesome/ui/fresnel/lenses/install.log +++ /dev/null @@ -1,10 +0,0 @@ -[03:45:24 2023-02-24] FETCHING Version 2.16.1 -[03:45:24 2023-02-24] CREATING /home/delta/.spicetify -[03:45:24 2023-02-24] DOWNLOADING https://github.com/spicetify/spicetify-cli/releases/download/v2.16.1/spicetify-2.16.1-linux-amd64.tar.gz -[03:45:34 2023-02-24] EXTRACTING /home/delta/.spicetify/spicetify.tar.gz -[03:45:34 2023-02-24] SETTING EXECUTABLE PERMISSIONS TO /home/delta/.spicetify/spicetify -[03:45:34 2023-02-24] REMOVING /home/delta/.spicetify/spicetify.tar.gz -[03:45:34 2023-02-24] APPENDING /home/delta/.spicetify to PATH in /home/delta/.config/fish/config.fish -[03:45:34 2023-02-24] Restart your shell to have spicetify in your PATH. -[03:45:34 2023-02-24] spicetify v2.16.1 was installed successfully to /home/delta/.spicetify -[03:45:34 2023-02-24] Run 'spicetify --help' to get started diff --git a/.config/awesome/ui/fresnel/lenses/liblenses.so b/.config/awesome/ui/fresnel/lenses/liblenses.so deleted file mode 120000 index 5f7fc45..0000000 --- a/.config/awesome/ui/fresnel/lenses/liblenses.so +++ /dev/null @@ -1 +0,0 @@ -target/liblenses.so
\ No newline at end of file diff --git a/.config/awesome/ui/fresnel/lenses/rustfmt.toml b/.config/awesome/ui/fresnel/lenses/rustfmt.toml deleted file mode 100644 index 36afbbd..0000000 --- a/.config/awesome/ui/fresnel/lenses/rustfmt.toml +++ /dev/null @@ -1,3 +0,0 @@ -imports_layout = "Vertical" -unstable_features = true -group_imports = "StdExternalCrate" diff --git a/.config/awesome/ui/fresnel/lenses/src/application.rs b/.config/awesome/ui/fresnel/lenses/src/application.rs deleted file mode 100644 index 0cf6c1a..0000000 --- a/.config/awesome/ui/fresnel/lenses/src/application.rs +++ /dev/null @@ -1,107 +0,0 @@ -use std::{ - fs::read_dir, - path::PathBuf, -}; - -use freedesktop_entry_parser as fd; -use mlua::prelude::*; -use parking_lot::Mutex; -use rayon::prelude::*; -use url::Url; - -use crate::entry::{ - entries_to_lua_table, - Entry, -}; - -fn parse_entry<'a>(entry: fd::Entry, path: PathBuf) -> Result<Entry, ()> { - let section = entry.section("Desktop Entry"); - let name = section.attr("Name").ok_or(())?.to_string(); - - if section.attr("Type").ok_or(())? != "Application" { - return Err(()); - } - - match section.attr("OnlyShowIn") { - Some(_) => return Err(()), - None => {} - } - - match section.attr("Hidden") { - Some(_) => return Err(()), - None => {} - } - - match section.attr("NoDisplay") { - Some(_) => return Err(()), - None => {} - } - - let exec = section.attr("Exec").ok_or(())?.to_string(); - let mut new_exec = exec.clone(); - for (index, _) in exec.match_indices("%") { - match exec.chars().nth(index + 1).unwrap().to_ascii_lowercase() { - 'i' => match section.attr("Icon") { - Some(icon) => new_exec.replace_range(index..index + 2, &format!("--icon {}", icon)), - None => {} - }, - 'c' => new_exec.replace_range(index..index + 2, &name), - 'k' => new_exec.replace_range(index..index + 2, Url::from_file_path(&path)?.as_str()), - - 'f' | 'u' | 'v' | 'm' | 'd' | 'n' => new_exec.replace_range(index..index + 2, ""), - _ => continue, - } - } - - Ok(Entry { - message: name, - exec: Some(( - new_exec, - section - .attr("Terminal") - .unwrap_or("false") - .parse() - .map_err(drop)?, - )), - provider: "Application".to_string(), - }) -} - -pub fn query(lua: &Lua, input: String) -> LuaResult<LuaTable> { - let applications_dir = "/usr/share/applications"; - let entries = read_dir(applications_dir)? - .map(|result| result.map(|e| e.path())) - .collect::<Result<Vec<_>, std::io::Error>>()?; - - let entries = entries - .into_iter() - .filter(|e| match e.extension() { - Some(ext) if ext == "desktop" => true, - None | _ => false, - }) - .collect::<Vec<_>>(); - - let mut parsed_entries: Mutex<Vec<Entry>> = Mutex::new(Vec::new()); - - entries.into_par_iter().for_each(|path| { - let entry = match fd::parse_entry(&path) { - Ok(entry) => entry, - Err(_) => return, - }; - - match parse_entry(entry, path) { - Ok(parsed_entry) => parsed_entries.lock().push(parsed_entry), - Err(_) => return, - } - }); - - Ok(entries_to_lua_table( - parsed_entries - .get_mut() - .iter() - .filter(|entry| entry.message.to_lowercase().contains(&input)) - .map(|entry| (*entry).clone()) - .collect(), - lua, - )) -} diff --git a/.config/awesome/ui/fresnel/lenses/src/calculator.rs b/.config/awesome/ui/fresnel/lenses/src/calculator.rs deleted file mode 100644 index 792985d..0000000 --- a/.config/awesome/ui/fresnel/lenses/src/calculator.rs +++ /dev/null @@ -1,25 +0,0 @@ -use meval::eval_str; -use mlua::prelude::*; - -use crate::entry::{ - entries_to_lua_table, - Entry, -}; - -pub fn query(lua: &Lua, input: String) -> LuaResult<LuaTable> { - println!("{:?}", input); - let result = match eval_str(input.trim()) { - Ok(ok) => ok.to_string(), - Err(_) => return Ok(lua.create_table()?), - }; - - Ok(entries_to_lua_table( - vec![Entry { - message: result, - exec: None, - // icon: '', - provider: "Calculator".to_string(), - }], - lua, - )) -} diff --git a/.config/awesome/ui/fresnel/lenses/src/entry.rs b/.config/awesome/ui/fresnel/lenses/src/entry.rs deleted file mode 100644 index d6e7467..0000000 --- a/.config/awesome/ui/fresnel/lenses/src/entry.rs +++ /dev/null @@ -1,20 +0,0 @@ -use mlua::{ - prelude::*, - LuaSerdeExt, -}; -use serde::Serialize; - -#[derive(Serialize, Clone)] -pub struct Entry { - pub message: String, - pub exec: Option<(String, bool)>, - // pub icon: char, - pub provider: String, -} - -pub fn entries_to_lua_table(entries: Vec<Entry>, lua: &Lua) -> LuaTable { - match lua.to_value(&entries).unwrap() { - LuaValue::Table(t) => t, - _ => unreachable!(), - } -} diff --git a/.config/awesome/ui/fresnel/lenses/src/lib.rs b/.config/awesome/ui/fresnel/lenses/src/lib.rs deleted file mode 100644 index e4fc881..0000000 --- a/.config/awesome/ui/fresnel/lenses/src/lib.rs +++ /dev/null @@ -1,16 +0,0 @@ -mod application; -mod calculator; -mod entry; - -use mlua::prelude::*; - -#[mlua::lua_module] -fn lenses(lua: &Lua) -> LuaResult<LuaTable> { - let exports = lua.create_table()?; - // lua.create_fun - // exports.push(application::query)?; - exports.set("1", lua.create_function(calculator::query)?)?; - exports.set("2", lua.create_function(application::query)?)?; - - Ok(exports) -} diff --git a/.config/awesome/ui/info_center/init.lua b/.config/awesome/ui/info_center/init.lua deleted file mode 100644 index e7f59cc..0000000 --- a/.config/awesome/ui/info_center/init.lua +++ /dev/null @@ -1,8 +0,0 @@ -local awful = require "awful" -local vars = require "misc.vars" -local wibox = require "wibox" -local obj = require "gears.object" -local debug = require "gears.debug" -local naughty = require "naughty" -local xresources = require "beautiful.xresources" -local dpi = xresources.apply_dpi diff --git a/.config/awesome/ui/init.lua b/.config/awesome/ui/init.lua index 4e6d98e..9ab3019 100644 --- a/.config/awesome/ui/init.lua +++ b/.config/awesome/ui/init.lua @@ -1,4 +1,5 @@ -- require "ui.window_switcher" +-- require "ui.conductor" require "ui.statusbar" -- require "ui.info_center" require "ui.decorations" diff --git a/.config/awesome/ui/insightful/init.lua b/.config/awesome/ui/insightful/init.lua index 4ed6099..1e61046 100644 --- a/.config/awesome/ui/insightful/init.lua +++ b/.config/awesome/ui/insightful/init.lua @@ -1,9 +1,11 @@ local awful = require "awful" local gtable = require "gears.table" -local h = require "misc.helpers" -local vars = require "misc.vars" +local qui = require "quarrel.ui" +local qtable = require "quarrel.table" +local qvars = require "quarrel.vars" local wibox = require "wibox" local rubato = require "lib.rubato" +local beautiful = require "beautiful" local btn = awful.button.names local first_time = true @@ -14,44 +16,45 @@ local insightful = {} insightful._toggled = false insightful._bindings = {} insightful._selected_group = "" +insightful._selected_group_index = 1 insightful._keymap = { - Control = "Control", - Mod1 = "Alt", + Control = "Control", + Mod1 = "Alt", ISO_Level3_Shift = "Alt Gr", - Mod4 = "Super", - Insert = "Insert", - Delete = "Delete", - Next = "Page Up", - Prior = "Page Down", - Left = "", - Up = "", - Right = "", - Down = "", - KP_End = "1", - KP_Down = "#2", - KP_Next = "#3", - KP_Left = "#4", - KP_Begin = "#5", - KP_Right = "#6", - KP_Home = "#7", - KP_Up = "#8", - KP_Prior = "#9", - KP_Insert = "#0", - KP_Delete = "#.", - KP_Divide = "#/", - KP_Multiply = "#*", - KP_Subtract = "#-", - KP_Add = "#+", - KP_Enter = "#Enter", - Escape = "Esc", - Tab = "Tab", - space = "Space", - Return = "Enter", - dead_acute = "´", - dead_circumflex = "^", - dead_grave = "`", - XF86MonBrightnessUp = "🔆+", + Mod4 = "Super", + Insert = "Insert", + Delete = "Delete", + Next = "Page Up", + Prior = "Page Down", + Left = "", + Up = "", + Right = "", + Down = "", + KP_End = "1", + KP_Down = "#2", + KP_Next = "#3", + KP_Left = "#4", + KP_Begin = "#5", + KP_Right = "#6", + KP_Home = "#7", + KP_Up = "#8", + KP_Prior = "#9", + KP_Insert = "#0", + KP_Delete = "#.", + KP_Divide = "#/", + KP_Multiply = "#*", + KP_Subtract = "#-", + KP_Add = "#+", + KP_Enter = "#Enter", + Escape = "Esc", + Tab = "Tab", + space = "Space", + Return = "Enter", + dead_acute = "´", + dead_circumflex = "^", + dead_grave = "`", + XF86MonBrightnessUp = "🔆+", XF86MonBrightnessDown = "🔅-", XF86AudioRaiseVolume = "ﱛ", XF86AudioLowerVolume = "ﱜ", @@ -65,15 +68,21 @@ insightful._keymap = { [tostring(btn.RIGHT)] = mouse .. "Right" } -insightful._widget = h.popup { +insightful._widget = qui.popup { visible = false, ontop = true, - placement = awful.placement.centered, + placement = function(d) + awful.placement.top(d, { + margins = { + top = beautiful.useless_gap * 2 + } + }) + end, minimum_height = screen[1].geometry.height / 2, minimum_width = screen[1].geometry.width / 2, widget = { layout = wibox.layout.fixed.vertical, - spacing = vars.big_padding, + spacing = qvars.big_padding, id = "layout_container" } } @@ -97,9 +106,9 @@ function insightful:_generate() }) end - for group, keybinds in h.opairs(grouped_binds) do + for group, keybinds in qtable.opairs(grouped_binds) do local group_layout = { - spacing = vars.padding, + spacing = qvars.padding, layout = wibox.layout.fixed.vertical } @@ -116,13 +125,13 @@ function insightful:_generate() } for _, mod in ipairs(keybind.mods) do - table.insert(key_layout, 1, h.styled { + table.insert(key_layout, 1, qui.styled { widget = wibox.container.background, - bg = vars.colors.bright.black, + bg = qvars.colors.bright.black, border_width = 0, { widget = wibox.container.margin, - margins = vars.padding, + margins = qvars.padding, { widget = wibox.widget.textbox, text = insightful._keymap[mod] or mod @@ -154,7 +163,7 @@ function insightful:_generate() if keybind.desc then key_and_desc_layout[3] = { widget = wibox.container.background, - fg = vars.colors.dim.fg, + fg = qvars.colors.dim.fg, { widget = wibox.widget.textbox, text = keybind.desc @@ -171,12 +180,12 @@ function insightful:_generate() { { widget = wibox.container.background, - bg = vars.colors.yellow, - fg = vars.colors.bg, - shape = vars.shape, + bg = qvars.colors.yellow, + fg = qvars.colors.bg, + shape = qvars.shape, { widget = wibox.container.margin, - margins = vars.padding, + margins = qvars.padding, { widget = wibox.widget.textbox, text = group @@ -187,15 +196,15 @@ function insightful:_generate() layout = wibox.layout.align.horizontal }, group_layout, - spacing = vars.padding, + spacing = qvars.padding, layout = wibox.layout.fixed.vertical } end end local timed = rubato.timed { - duration = vars.anim_duration, - intro = vars.anim_intro, + duration = qvars.anim_duration, + intro = qvars.anim_intro, pos = 0, subscribed = function(pos) insightful._widget.opacity = pos @@ -210,7 +219,7 @@ local timed = rubato.timed { function insightful:toggle() if first_time then - insightful:_generate_widget() + insightful:_generate() first_time = false end @@ -218,56 +227,4 @@ function insightful:toggle() insightful._toggled = not insightful._toggled end -local function get_binding_function(trigger) - if type(trigger) == "number" and trigger <= 5 and trigger > 0 then - return "button" - elseif type(trigger) == "string" then - return "key" - end - error("trigger can only be a mouse button or a key", 2) -end - -local function translate_binding(binding, trigger, multiple) - local value = nil - if multiple then - value = trigger[2] - trigger = trigger[1] - end - - local awful_binding = { - modifiers = binding.mods, - [get_binding_function(trigger)] = trigger, - on_press = multiple and function(...) binding.press(value, ...) end or binding.press - } - - if binding.desc then - awful_binding.description = binding.desc - end - if binding.group then - awful_binding.group = binding.group - end - - return awful[get_binding_function(trigger)](awful_binding) -end - -function insightful:bind(binding) - local awful_bindings = {} - table.insert(self._bindings, binding) - - if type(binding.triggers) == "table" then - for _, trigger in ipairs(binding.triggers) do - table.insert(awful_bindings, translate_binding(binding, trigger, true)) - end - elseif type(binding.triggers) == "string" or type(binding.triggers) == "number" then - return translate_binding(binding, binding.triggers, false) - else - error("binding.triggers can only be a string or a table") - end - - -- for some reason multi-trigger bindings only work if i do this - -- i spent a day debugging this - -- thanks awesome - return gtable.join(table.unpack(awful_bindings)) -end - return insightful diff --git a/.config/awesome/ui/statusbar/init.lua b/.config/awesome/ui/statusbar/init.lua index dfe2868..01d6498 100644 --- a/.config/awesome/ui/statusbar/init.lua +++ b/.config/awesome/ui/statusbar/init.lua @@ -1,10 +1,14 @@ local awful = require "awful" local beautiful = require "beautiful" -local xresources = require "beautiful.xresources" -local dpi = xresources.apply_dpi -local vars = require "misc.vars" +local qvars = require "quarrel.vars" local wibox = require "wibox" -local h = require "misc.helpers" +local qui = require "quarrel.ui" +local gcolor = require "gears.color" +local gdebug = require "gears.debug" +local phosphor = require "assets.phosphor" +local qbind = require "quarrel.bind" +local q = require "quarrel" +local rubato = require "lib.rubato" local taglist = require "ui.statusbar.widgets.taglist" local clock = require "ui.statusbar.widgets.clock" @@ -14,62 +18,148 @@ local brightness = require "ui.statusbar.widgets.brightness" local keyboardlayout = require "ui.statusbar.widgets.keyboardlayout" screen.connect_signal("request::desktop_decoration", function(s) - local bar = h.popup { + local expand_button = wibox.widget { + widget = wibox.container.place, + valign = "center", + halign = "center", + { + 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 + }, + _expanded = false + } + + local bar = qui.popup { placement = function(d) local place = awful.placement.left return place(d, { margins = beautiful.useless_gap * 2 }) end, - -- ontop = true, - minimum_width = vars.bar_size, - maximum_width = vars.bar_size * 20, - minimum_height = s.geometry.height - (beautiful.useless_gap * 4 + vars.border_width * 2), + minimum_height = s.geometry.height - (beautiful.useless_gap * 4 + qvars.border_width * 2), widget = { { + nil, { - widget = wibox.container.place, - valign = "top", - { - widget = wibox.widget.textbox, - text = "", - font = h.font(1.5) - } - }, - taglist, - { - widget = wibox.container.place, - valign = "bottom", { + expand_button, + taglist, layout = wibox.layout.fixed.vertical, - spacing = vars.padding * 2, - brightness, - battery, - wifi, - keyboardlayout, - clock + spacing = qvars.padding * 2, }, + nil, + { + widget = wibox.container.place, + valign = "bottom", + { + brightness, + battery, + wifi, + { + widget = wibox.container.place, + keyboardlayout + }, + clock, + layout = wibox.layout.fixed.vertical, + spacing = qvars.padding * 2 + }, + }, + layout = wibox.layout.align.vertical, + expand = "outside", }, - layout = wibox.layout.align.vertical, - expand = "outside", + nil, + layout = wibox.layout.align.horizontal }, - -- { - -- widget = wibox.container.background, - -- bg = vars.colors.fg, - -- fg = vars.colors.bg, - -- visible = false, - -- { - -- widget = wibox.widget.textbox, - -- text = "this is gay" - -- } - -- }, - -- spacing = vars.big_padding, - spacing = nil, - layout = wibox.layout.fixed.horizontal + nil, + nil, + layout = wibox.layout.align.horizontal, } } + local bar_width = bar.width + bar:struts { - left = dpi(16) + vars.big_padding * 2 + beautiful.useless_gap * 4 + -- left = qvars.bar_size + qvars.big_padding * 2 + beautiful.useless_gap * 4 + -- left = qvars.bar_size + qvars.border_width * 2 + beautiful.useless_gap * 4 + left = bar_width + qvars.border_width * 2 + beautiful.useless_gap * 4 + } + + local timed = rubato.timed { + duration = qvars.anim_duration, + intro = qvars.anim_intro, + pos = bar_width, + subscribed = function(pos) + if pos ~= bar_width and expand_button._expanded then + bar.widget.widget.third = wibox.widget { + { + widget = wibox.container.margin, + margins = { + left = qvars.big_padding + } + }, + { + widget = wibox.container.constraint, + width = qvars.bar_size * 6, + strategy = "min", + { + { + { + widget = wibox.container.background, + bg = qvars.colors.black, + { + widget = wibox.widget.textbox, + text = "1" + } + }, + { + widget = wibox.container.background, + bg = qvars.colors.black, + { + widget = wibox.widget.textbox, + text = "2" + } + }, + { + widget = wibox.container.background, + bg = qvars.colors.black, + { + widget = wibox.widget.textbox, + text = "3" + } + }, + spacing = qvars.padding, + layout = wibox.layout.flex.horizontal + }, + layout = wibox.layout.fixed.vertical + } + }, + layout = wibox.layout.fixed.horizontal + } + bar.ontop = true + elseif pos == bar_width and not expand_button._expanded then + bar.widget.widget.third = nil + bar.ontop = false + end + + bar.maximum_width = pos + end + } + + expand_button.buttons = { + qbind:new { + triggers = qvars.btns.left, + press = function() + if expand_button._expanded then + timed.target = bar_width + else + timed.target = bar_width + qvars.bar_size * 6 + end + + expand_button._expanded = not expand_button._expanded + end, + hidden = true + } } end) diff --git a/.config/awesome/ui/statusbar/widgets/app_launcher.lua b/.config/awesome/ui/statusbar/widgets/app_launcher.lua deleted file mode 100644 index 2e1e10a..0000000 --- a/.config/awesome/ui/statusbar/widgets/app_launcher.lua +++ /dev/null @@ -1,6 +0,0 @@ -local awful = require "awful" -local wibox = require "wibox" -local vars = require "misc.vars" -local h = require "misc.helpers" - - diff --git a/.config/awesome/ui/statusbar/widgets/battery.lua b/.config/awesome/ui/statusbar/widgets/battery.lua index b041c3a..dab98ca 100644 --- a/.config/awesome/ui/statusbar/widgets/battery.lua +++ b/.config/awesome/ui/statusbar/widgets/battery.lua @@ -1,67 +1,37 @@ -local awful = require "awful" -local xresources = require "beautiful.xresources" -local vars = require "misc.vars" +local qvars = require "quarrel.vars" local wibox = require "wibox" -local h = require "misc.helpers" +local qmath = require "quarrel.math" +local gcolor = require "gears.color" +local phosphor = require "assets.phosphor" -local battery_inner = awful.widget.watch("cat /sys/class/power_supply/BAT0/capacity", 1, function(widget, stdout) - local icon = "" - local color = vars.colors.red +local battery = wibox.widget { + widget = wibox.container.place, + valign = "center", + 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 + } +} - if io.popen("cat /sys/class/power_supply/BAT0/status"):read("*a"):sub(0, -2) == "Charging" then - icon = "" - color = vars.colors.green - widget:set_markup("<span color=\"" .. color .. "\">" .. icon .. "</span>") +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 percent = tonumber(stdout) - - if percent <= 5 then - icon = "" - color = vars.colors.red - elseif percent <= 10 then - icon = "" - color = vars.colors.red - elseif percent <= 20 then - icon = "" - color = vars.colors.red - elseif percent <= 30 then - icon = "" - color = vars.colors.yellow - elseif percent <= 40 then - icon = "" - color = vars.colors.yellow - elseif percent <= 50 then - icon = "" - color = vars.colors.yellow - elseif percent <= 60 then - icon = "" - color = vars.colors.yellow - elseif percent <= 70 then - icon = "" - color = vars.colors.yellow - elseif percent <= 80 then - icon = "" - color = vars.colors.green - elseif percent <= 90 then - icon = "" - color = vars.colors.green - elseif percent <= 100 then - icon = "" - color = vars.colors.green - end - - widget:set_markup("<span color=\"" .. color .. "\">" .. icon .. "</span>") -end) - -local battery = wibox.widget { - widget = wibox.container.place, - battery_inner -} + local icon_data = qmath.step_value(capacity, { + { 0, { "empty", "red" } }, + { 20, { "low", "red" } }, + { 40, { "medium", "yellow" } }, + { 60, { "high", "green" } }, + { 80, { "full", "green" } }, + { 100 } + }) -h.tooltip({ battery }, function() - return io.popen("cat /sys/class/power_supply/BAT0/capacity"):read("*a"):sub(0, -2) .. "%" + battery.widget.image = gcolor.recolor_image(phosphor["battery_vertical_" .. icon_data[1] .. "_fill"], qvars.colors[icon_data[2]]) end) return battery diff --git a/.config/awesome/ui/statusbar/widgets/brightness.lua b/.config/awesome/ui/statusbar/widgets/brightness.lua index cceba89..f8f6c17 100644 --- a/.config/awesome/ui/statusbar/widgets/brightness.lua +++ b/.config/awesome/ui/statusbar/widgets/brightness.lua @@ -1,18 +1,32 @@ -local vars = require "misc.vars" +local qvars = require "quarrel.vars" local wibox = require "wibox" -local h = require "misc.helpers" +local qmath = require "quarrel.math" +local gcolor = require "gears.color" +local phosphor = require "assets.phosphor" local brightness = wibox.widget { widget = wibox.container.place, + valign = "center", + halign = "center", { - widget = wibox.widget.textbox, - font = vars.font, - text = "" - }, + widget = wibox.widget.imagebox, + image = gcolor.recolor_image(phosphor.moon_fill, qvars.colors.fg), + forced_width = qvars.icon_size, + forced_height = qvars.icon_size + } } -h.tooltip({ brightness }, function() - return math.floor(tonumber(io.popen("brightnessctl g"):read("*a"):sub(0, -2)) / 255 * 100) .. "%" +awesome.connect_signal("services::brightness", function(value) + local icon_data = qmath.step_value(value, { + { 0, "cloud_moon" }, + { 51, "moon" }, + { 102, "sun_horizon" }, + { 153, "sun_dim" }, + { 204, "sun" }, + { 255 } + }) + + brightness.widget.image = gcolor.recolor_image(phosphor[icon_data .. "_fill"], qvars.colors.fg) end) return brightness diff --git a/.config/awesome/ui/statusbar/widgets/clock.lua b/.config/awesome/ui/statusbar/widgets/clock.lua index c7b3c29..77ce8ce 100644 --- a/.config/awesome/ui/statusbar/widgets/clock.lua +++ b/.config/awesome/ui/statusbar/widgets/clock.lua @@ -1,17 +1,17 @@ -local vars = require "misc.vars" +local qvars = require "quarrel.vars" local wibox = require "wibox" -local h = require "misc.helpers" +local qui = require "quarrel.ui" local clock = wibox.widget { widget = wibox.container.place, { format = "%H\n%M", widget = wibox.widget.textclock, - font = vars.font + font = qvars.font }, } -h.tooltip({ clock }, function() +qui.tooltip({ clock }, function() return os.date("%a %d/%m/%y") end) diff --git a/.config/awesome/ui/statusbar/widgets/taglist.lua b/.config/awesome/ui/statusbar/widgets/taglist.lua index 751cbf0..89eaf2f 100644 --- a/.config/awesome/ui/statusbar/widgets/taglist.lua +++ b/.config/awesome/ui/statusbar/widgets/taglist.lua @@ -1,89 +1,82 @@ local awful = require "awful" -local vars = require "misc.vars" +local qvars = require "quarrel.vars" local wibox = require "wibox" -local timed = require "lib.rubato".timed +local gcolor = require "gears.color" +local phosphor = require "assets.phosphor" +local qbind = require "quarrel.bind" -return awful.widget.taglist({ +return awful.widget.taglist { screen = screen[1], filter = awful.widget.taglist.filter.all, - style = { - shape = vars.shape - }, layout = { - spacing = vars.padding, + spacing = qvars.padding, layout = wibox.layout.fixed.vertical }, widget_template = { + widget = wibox.container.place, + valign = "center", + halign = "center", { - widget = wibox.container.background, - bg = vars.colors.bright.black, - shape = vars.shape, - forced_height = vars.button_size, - forced_width = vars.button_size, - id = "indicator_role" + widget = wibox.widget.imagebox, + image = gcolor.recolor_image(phosphor.circle_bold, qvars.colors.fg), + forced_width = qvars.icon_size, + forced_height = qvars.icon_size, + icon = phosphor.dot_fill }, - widget = wibox.container.place, create_callback = function(self, tag) - local indicator = self:get_children_by_id("indicator_role")[1] - - self._anim = timed { - duration = vars.anim_duration, - intro = vars.anim_intro, - pos = indicator.height, - subscribed = function(pos) - indicator.forced_height = pos - end - } - - if tag.selected then - indicator.bg = vars.colors.yellow - self._anim.target = vars.button_size * 2 - elseif next(tag:clients()) then - indicator.bg = vars.colors.bright.black - self._anim.target = vars.button_size * 1.5 - else - self._anim.target = vars.button_size - end + -- self.widget.icon = phosphor[next(tag:clients()) and "circle_fill" or "circle_bold"] self:connect_signal("mouse::enter", function() if tag.selected then return end - indicator.bg = vars.colors.yellow + self.widget.image = gcolor.recolor_image(self.widget.icon, qvars.colors.yellow) end) self:connect_signal("mouse::leave", function() if tag.selected then return end - if next(tag:clients()) then - indicator.bg = vars.colors.bright.black - return - end - - indicator.bg = vars.colors.bright.black + self.widget.image = gcolor.recolor_image(self.widget.icon, qvars.colors.fg) end) + + if tag.selected then + self.widget.image = gcolor.recolor_image(self.widget.icon, qvars.colors.yellow) + return + end + + self.widget.image = gcolor.recolor_image(self.widget.icon, qvars.colors.fg) end, update_callback = function(self, tag) - local indicator = self:get_children_by_id("indicator_role")[1] + -- self.widget.icon = phosphor[next(tag:clients()) and "circle_fill" or "circle_bold"] if tag.selected then - indicator.bg = vars.colors.yellow - self._anim.target = vars.button_size * 2 - elseif next(tag:clients()) then - indicator.bg = vars.colors.bright.black - self._anim.target = vars.button_size * 1.5 + self.widget.image = gcolor.recolor_image(self.widget.icon, qvars.colors.yellow) else - indicator.bg = vars.colors.bright.black - self._anim.target = vars.button_size + self.widget.image = gcolor.recolor_image(self.widget.icon, qvars.colors.fg) end end }, buttons = { - awful.button({ }, 1, function(t) t:view_only() end), - awful.button(vars.mods.M, 1, function(t) - if client.focus then - client.focus:move_to_tag(t) - end - end), - awful.button({ }, 3, awful.tag.viewtoggle), + qbind:new { + triggers = qvars.btns.left, + press = function(t) + t:view_only() + end, + hidden = true + }, + qbind:new { + mods = qvars.mods.M, + triggers = qvars.btns.left, + press = function(t) + if client.focus then + client.focus:move_to_tag(t) + end + end, + hidden = true + }, + qbind:new { + triggers = qvars.btns.right, + press = awful.tag.viewtoggle, + hidden = true + }, } -}) +} diff --git a/.config/awesome/ui/statusbar/widgets/power_menu.lua b/.config/awesome/ui/statusbar/widgets/volume.lua index e69de29..e69de29 100644 --- a/.config/awesome/ui/statusbar/widgets/power_menu.lua +++ b/.config/awesome/ui/statusbar/widgets/volume.lua diff --git a/.config/awesome/ui/statusbar/widgets/wifi.lua b/.config/awesome/ui/statusbar/widgets/wifi.lua index d0b7116..5f131b3 100644 --- a/.config/awesome/ui/statusbar/widgets/wifi.lua +++ b/.config/awesome/ui/statusbar/widgets/wifi.lua @@ -1,48 +1,36 @@ -local awful = require "awful" -local vars = require "misc.vars" +local qvars = require "quarrel.vars" local wibox = require "wibox" -local h = require "misc.helpers" +local qmath = require "quarrel.math" +local gcolor = require "gears.color" +local phosphor = require "assets.phosphor" -local wifi_inner = awful.widget.watch("awk 'NR==3 {printf(\"%.0f\", $3*10/7)}' /proc/net/wireless", 1, function(widget, stdout) - widget.font = "DejaVu Sans Mono wifi ramp Normal 8" - local icon = "" - local color = vars.colors.red +local wifi = wibox.widget { + widget = wibox.container.place, + valign = "center", + halign = "center", + { + 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 + } +} - if stdout == "" then - widget:set_markup("<span color=\"" .. color .. "\">" .. icon .. "</span>") +awesome.connect_signal("services::wifi", function(strength, connected) + if not connected then + wifi.widget.image = gcolor.recolor_image(phosphor.wifi_x_fill, qvars.colors.red) return end - local percent = tonumber(stdout) - - if percent <= 20 then - icon = "" - color = vars.colors.red - elseif percent <= 40 then - icon = "" - color = vars.colors.yellow - elseif percent <= 60 then - icon = "" - color = vars.colors.yellow - elseif percent <= 80 then - icon = "" - color = vars.colors.green - elseif percent <= 100 then - icon = "" - color = vars.colors.green - end - - - widget:set_markup("<span color=\"" .. color .. "\">" .. icon .. "</span>") -end) - -local wifi = wibox.widget { - widget = wibox.container.place, - wifi_inner -} + local icon_data = qmath.step_value(strength, { + { 0, { "none", "red" } }, + { 25, { "low", "yellow" } }, + { 50, { "medium", "yellow" } }, + { 75, { "high", "green" } }, + { 100 } + }) -h.tooltip({ wifi }, function() - return io.popen("iwgetid -r"):read("*a"):sub(0, -2) + wifi.widget.image = gcolor.recolor_image(phosphor["wifi_" .. icon_data[1] .. "_fill"], qvars.colors[icon_data[2]]) end) return wifi diff --git a/.config/awesome/ui/wicked/init.lua b/.config/awesome/ui/wicked/init.lua index 5687b81..5bd36be 100644 --- a/.config/awesome/ui/wicked/init.lua +++ b/.config/awesome/ui/wicked/init.lua @@ -1,16 +1,12 @@ local awful = require "awful" -local vars = require "misc.vars" +local qvars = require "quarrel.vars" local wibox = require "wibox" local debug = require "gears.debug" local gtimer = require "gears.timer" local naughty = require "naughty" -- local rubato = require "lib.rubato" local default = require "ui.wicked._default" -local h = require "misc.helpers" - -local beautiful = require "beautiful" -local xresources = require "beautiful.xresources" -local dpi = xresources.apply_dpi +local qui = require "quarrel.ui" local wicked = {} @@ -18,7 +14,7 @@ wicked._active_notififcations = {} function wicked:notify(n) -- local notif = wibox.widget { - local notif = h.popup { + local notif = qui.popup { -- widget = { -- { -- { @@ -26,7 +22,7 @@ function wicked:notify(n) -- notification = n, -- forced_height = 0, -- forced_width = 0, - -- clip_shape = vars.shape, + -- clip_shape = qvars.shape, -- id = "icon_role" -- }, -- { @@ -41,10 +37,10 @@ function wicked:notify(n) -- layout = wibox.layout.fixed.vertical -- }, -- layout = wibox.layout.fixed.horizontal, - -- spacing = vars.padding + -- spacing = qvars.padding -- }, -- widget = wibox.container.margin, - -- margins = vars.padding + -- margins = qvars.padding -- }, widget = { -- { @@ -82,7 +78,7 @@ function wicked:notify(n) } gtimer { - timeout = vars.notif_timeout, + timeout = qvars.notif_timeout, autostart = true, callback = function() notif.visible = false diff --git a/.config/awesome/ui/window_switcher/init.lua b/.config/awesome/ui/window_switcher/init.lua deleted file mode 100644 index f14c865..0000000 --- a/.config/awesome/ui/window_switcher/init.lua +++ /dev/null @@ -1,172 +0,0 @@ -local awful = require "awful" -local vars = require "misc.vars" -local wibox = require "wibox" -local obj = require "gears.object" -local debug = require "gears.debug" -local naughty = require "naughty" -local xresources = require "beautiful.xresources" -local dpi = xresources.apply_dpi - - -local ws = obj { - enable_properties = true, - enable_auto_signals = true -} - -ws.selected = 1 -ws.max = 0 - -local widget = awful.popup { - widget = { - { - widget = awful.widget.tasklist { - screen = screen[1], - filter = awful.widget.tasklist.filter.allscreen, - style = { - shape = vars.shape, - }, - layout = { - forced_num_rows = 1, - layout = wibox.layout.grid.vertical, - spacing = vars.padding - }, - widget_template = { - { - layout = wibox.layout.align.horizontal, - { - widget = wibox.container.place, - { - widget = wibox.container.margin, - margins = dpi(6), - { - id = "text_role", - widget = wibox.widget.textbox, - } - } - }, - nil, - { - widget = wibox.container.place, - { - widget = wibox.container.margin, - margins = dpi(6), - { - id = "tag_role", - widget = wibox.widget.textbox, - } - } - } - }, - forced_width = dpi(screen[1].geometry.width / 8), - bg = vars.colors.black, - border_width = vars.border_width, - border_color = vars.colors.black, - shape = vars.shape, - widget = wibox.container.background, - create_callback = function(self, client, i) - -- self:get_children_by_id("name_role")[1].text = client.name - self:get_children_by_id("tag_role")[1].text = client.first_tag.name - - ws:connect_signal("property::selected", function(selected) - naughty.notification { - urgency = "critical", - message = tostring(selected) .. " | " .. tostring(i) - } - - if selected == i then - self.border_color = vars.colors.yellow - else - self.border_color = vars.colors.black - end - end) - end - -- update_callback = function(self, _, i) - -- if ws.selected == i then - -- self.border_color = vars.colors.yellow - -- else - -- self.border_color = vars.colors.black - -- end - -- end - } - }, - id = "tasklist" - }, - widget = wibox.container.margin, - margins = vars.padding - }, - border_color = vars.colors.bright.black, - border_width = vars.border_width, - ontop = true, - placement = awful.placement.centered, - bg = vars.colors.bg, - shape = vars.shape, - visible = false -} - -ws.widget = widget - -ws.max = ws.widget.widget.tasklist.count - - - --- ws.widget:connect_signal("property::count", function(self) --- naughty.notification { --- urgency = "critical", --- message = tostring(ws.max) --- } --- ws.max = self.count --- end) - -awful.keygrabber { - keybindings = { - awful.key { - modifiers = { "Mod1" }, - key = "Tab", - on_press = function() - -- naughty.notification { - -- urgency = "critical", - -- message = tostring(WS.widget) - -- } - naughty.notification { - urgency = "critical", - message = tostring(ws.selected) - } - -- local file = io.open("/home/delta/.cache/awesome/tasklist_dump.txt", "w+") - -- file:write(debug.dump_return(WS.widget, "tasklist")) - -- file:close() - -- ws.widget:emit_signal_recursive("widget::layout_changed") - -- WS.widget:emit_signal("widget::redraw_needed") - if ws.selected + 1 > ws.max then - ws.selected = 1 - return - end - ws.selected = ws.selected + 1 - end - }, - awful.key { - modifiers = { "Mod1", "Shift" }, - key = "Tab", - on_press = function() - ws.widget:emit_signal("widget::layout_changed") - if ws.selected - 1 == 0 then - ws.selected = ws.max - return - end - ws.selected = ws.selected - 1 - end - }, - }, - stop_key = "Mod1", - stop_event = "release", - start_callback = function() - ws.widget.visible = true - naughty.notification { - urgency = "critical", - message = tostring(ws.max) -} - end, - stop_callback = function() - ws.widget.visible = false - end, - autostart = false -} |