aboutsummaryrefslogtreecommitdiff
path: root/.config/awesome/ui
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
parenta0f8b5fa6acdd1c2477fb1881dd9067956bf0ae6 (diff)
restructure awesome config, add fresnel
Diffstat (limited to '.config/awesome/ui')
-rw-r--r--.config/awesome/ui/archaic/init.lua239
-rw-r--r--.config/awesome/ui/decorations/init.lua2
-rw-r--r--.config/awesome/ui/decorations/titlebar.lua84
-rw-r--r--.config/awesome/ui/decorations/wallpaper.lua28
-rw-r--r--.config/awesome/ui/fresnel/init.lua276
-rw-r--r--.config/awesome/ui/fresnel/lenses/.gitignore2
-rw-r--r--.config/awesome/ui/fresnel/lenses/Cargo.toml18
-rw-r--r--.config/awesome/ui/fresnel/lenses/install.log10
l---------.config/awesome/ui/fresnel/lenses/liblenses.so1
-rw-r--r--.config/awesome/ui/fresnel/lenses/rustfmt.toml3
-rw-r--r--.config/awesome/ui/fresnel/lenses/src/application.rs107
-rw-r--r--.config/awesome/ui/fresnel/lenses/src/calculator.rs25
-rw-r--r--.config/awesome/ui/fresnel/lenses/src/entry.rs20
-rw-r--r--.config/awesome/ui/fresnel/lenses/src/lib.rs16
-rw-r--r--.config/awesome/ui/info_center/init.lua8
-rw-r--r--.config/awesome/ui/init.lua4
-rw-r--r--.config/awesome/ui/insightful/init.lua273
-rw-r--r--.config/awesome/ui/statusbar/init.lua75
-rw-r--r--.config/awesome/ui/statusbar/widgets/app_launcher.lua6
-rw-r--r--.config/awesome/ui/statusbar/widgets/battery.lua67
-rw-r--r--.config/awesome/ui/statusbar/widgets/brightness.lua18
-rw-r--r--.config/awesome/ui/statusbar/widgets/clock.lua18
-rw-r--r--.config/awesome/ui/statusbar/widgets/keyboardlayout.lua327
-rw-r--r--.config/awesome/ui/statusbar/widgets/power_menu.lua0
-rw-r--r--.config/awesome/ui/statusbar/widgets/taglist.lua89
-rw-r--r--.config/awesome/ui/statusbar/widgets/wifi.lua48
-rw-r--r--.config/awesome/ui/wicked/_default.lua94
-rw-r--r--.config/awesome/ui/wicked/init.lua101
-rw-r--r--.config/awesome/ui/window_switcher/init.lua172
29 files changed, 2131 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
diff --git a/.config/awesome/ui/decorations/init.lua b/.config/awesome/ui/decorations/init.lua
new file mode 100644
index 0000000..9493a67
--- /dev/null
+++ b/.config/awesome/ui/decorations/init.lua
@@ -0,0 +1,2 @@
+require "ui.decorations.titlebar"
+require "ui.decorations.wallpaper"
diff --git a/.config/awesome/ui/decorations/titlebar.lua b/.config/awesome/ui/decorations/titlebar.lua
new file mode 100644
index 0000000..8451817
--- /dev/null
+++ b/.config/awesome/ui/decorations/titlebar.lua
@@ -0,0 +1,84 @@
+local awful = require "awful"
+local vars = require "misc.vars"
+local gears = require "gears"
+local wibox = require "wibox"
+local rubato = require "lib.rubato"
+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,
+ bg = color,
+ shape = vars.shape,
+ buttons = { callback }
+ }
+
+ widget:connect_signal("mouse::enter", function()
+ local timed = rubato.timed {
+ duration = 0.1,
+ intro = 0.05,
+ pos = vars.button_size,
+ subscribed = function(pos)
+ widget.forced_width = pos
+ end
+ }
+
+ timed.target = vars.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 = vars.button_size * 2,
+ subscribed = function(pos)
+ widget.forced_width = pos
+ end
+ }
+
+ timed.target = vars.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 = vars.button_size + vars.padding * 2
+ })
+
+ awful.titlebar.enable_tooltip = false
+
+ titlebar.widget = {
+ widget = wibox.container.margin,
+ margins = vars.padding,
+ {
+ nil,
+ nil,
+ {
+ button(vars.colors.green, vars.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()
+ gears.timer.delayed_call(function()
+ c.minimized = true
+ end)
+ end)),
+ button(vars.colors.red, vars.colors.bright.red, awful.button({}, 1, function()
+ c:kill()
+ end)),
+
+ spacing = vars.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
new file mode 100644
index 0000000..f7104ff
--- /dev/null
+++ b/.config/awesome/ui/decorations/wallpaper.lua
@@ -0,0 +1,28 @@
+local wallpaper = require "awful.wallpaper"
+local wibox = require "wibox"
+local vars = require "misc.vars"
+local h = require "misc.helpers"
+
+screen.connect_signal("request::wallpaper", function(s)
+ wallpaper {
+ bg = vars.colors.dim.bg,
+ screen = s,
+ widget = {
+ widget = wibox.container.place,
+ valign = "center",
+ halign = "center",
+ {
+ widget = wibox.widget.textbox,
+ font = h.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, " \\/__/")
+ }, "\n")
+ }
+ }
+ }
+end)
diff --git a/.config/awesome/ui/fresnel/init.lua b/.config/awesome/ui/fresnel/init.lua
new file mode 100644
index 0000000..cf1357a
--- /dev/null
+++ b/.config/awesome/ui/fresnel/init.lua
@@ -0,0 +1,276 @@
+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 cfg = require "misc.cfg"
+local vars = require "misc.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 = {}
+
+fresnel._toggled = false
+fresnel._entries_exec = {}
+fresnel._entries_offset = 0
+fresnel._entries_count = 0
+fresnel._visible_entries = 0
+fresnel._selected_index = 1
+
+function fresnel:_exec_entry(entry_index)
+ local exec = self._entries_exec[entry_index]
+ if type(exec) ~= "userdata" then
+ awful.spawn((exec[2] and cfg.terminal .. " -e " or "") .. exec[1])
+ end
+end
+
+function fresnel:_update(query, scrolled)
+ query = query or ""
+ scrolled = scrolled or false
+
+ if not scrolled then
+ self._selected_index = 1
+ self._entries_offset = 0
+ end
+
+ local layout = self._widget.widget:get_children_by_id("entry_layout")[1]
+ local status = self._widget.widget:get_children_by_id("status")[1]
+ local all_providers = {}
+ local entries_count = 0
+
+ self._entries_exec = {}
+ layout:reset()
+
+ for _, provider in h.opairs(lenses) do
+ local entries = provider(query)
+
+ table.sort(entries, function(a, b)
+ return a.message < b.message
+ end)
+
+ all_providers = gtable.join(all_providers, entries)
+ end
+
+ self._entries_count = #all_providers
+
+ for i, entry in ipairs(all_providers) do
+ if i <= self._entries_offset then
+ goto continue
+ end
+ if entries_count == max_entries then break end
+ table.insert(self._entries_exec, entry.exec)
+
+ local entry_widget = wibox.widget {
+ widget = wibox.container.background,
+ shape = vars.shape,
+ {
+ widget = wibox.container.margin,
+ margins = vars.padding,
+ {
+ widget = wibox.container.constraint,
+ strategy = "max",
+ height = vars.char_height,
+ {
+ {
+ widget = wibox.container.background,
+ fg = vars.colors.dim.fg,
+ {
+ widget = wibox.widget.textbox,
+ text = entry.provider .. " | "
+ }
+ },
+ {
+ widget = wibox.widget.textbox,
+ text = entry.message
+ },
+ spacing = vars.padding,
+ layout = wibox.layout.fixed.horizontal
+ }
+ }
+ },
+ buttons = {
+ awful.button {
+ modifiers = {},
+ button = btn.LEFT,
+ on_press = function()
+ self:_exec_entry(i)
+ end
+ }
+ },
+ _selected = false
+ }
+
+ if self._selected_index + self._entries_offset == i then
+ entry_widget._selected = true
+ entry_widget.bg = vars.colors.black
+ end
+
+ entry_widget:connect_signal("mouse::enter", function()
+ if entry_widget._selected == true then return end
+ entry_widget.bg = vars.colors.black
+ end)
+
+ entry_widget:connect_signal("mouse::leave", function()
+ if entry_widget._selected == true then return end
+ entry_widget.bg = vars.colors.bg
+ end)
+
+ layout:add(entry_widget)
+
+ entries_count = entries_count + 1
+ self._visible_entries = entries_count
+ ::continue::
+ end
+
+ status.text = self._entries_offset + self._selected_index .. "/" .. self._entries_count
+end
+
+fresnel._text = ""
+fresnel._prompt = al_prompt {
+ prompt = "",
+ reset_on_stop = true,
+ ul_cursor = "low",
+ bg_cursor = vars.colors.black,
+ changed_callback = function(text)
+ if fresnel._text == text then return end
+ if fresnel._toggled == false then return end
+ fresnel:_update(text)
+ fresnel._text = text
+ end,
+ keypressed_callback = function(mod, key)
+ if key == "Escape" or key == " " and mod.Mod4 then
+ fresnel:hide()
+ elseif key == "Return" then
+ fresnel:_exec_entry(fresnel._selected_index)
+ fresnel:hide()
+ elseif key == "Up" then
+ local next_index = fresnel._selected_index - 1
+ if next_index < 1 and fresnel._entries_offset == 0 then
+ return
+ elseif next_index < 1 and fresnel._entries_offset > 0 then
+ fresnel._entries_offset = fresnel._entries_offset - 1
+ else
+ fresnel._selected_index = next_index
+ end
+
+ fresnel:_update(fresnel._text, true)
+ elseif key == "Down" then
+ local next_index = fresnel._selected_index + 1
+ if next_index > fresnel._visible_entries and fresnel._entries_offset + fresnel._visible_entries == fresnel._entries_count then
+ return
+ elseif next_index > fresnel._visible_entries and fresnel._entries_offset + fresnel._visible_entries < fresnel._entries_count then
+ fresnel._entries_offset = fresnel._entries_offset + 1
+ else
+ fresnel._selected_index = next_index
+ end
+
+ fresnel:_update(fresnel._text, true)
+ end
+ end
+}
+
+fresnel._widget = h.popup {
+ visible = false,
+ ontop = true,
+ placement = function(d)
+ awful.placement.top(d, {
+ margins = {
+ top = beautiful.useless_gap * 2
+ }
+ })
+ end,
+ minimum_width = screen[1].geometry.width / 2,
+ maximum_width = screen[1].geometry.width / 2,
+ widget = {
+ {
+ widget = wibox.container.background,
+ bg = vars.colors.black,
+ fg = vars.colors.dim.fg,
+ shape = vars.shape,
+ {
+ widget = wibox.container.margin,
+ margins = vars.padding,
+ {
+ {
+ widget = wibox.widget.textbox,
+ text = ">"
+ },
+ {
+ widget = wibox.container.margin,
+ margins = {
+ left = vars.padding,
+ right = vars.padding
+ },
+ {
+ widget = wibox.container.constraint,
+ strategy = "max",
+ height = vars.char_height,
+ {
+ widget = wibox.container.background,
+ fg = vars.colors.fg,
+ fresnel._prompt.textbox
+ }
+ }
+ },
+ {
+ widget = wibox.widget.textbox,
+ text = "0/0",
+ id = "status"
+ },
+ layout = wibox.layout.align.horizontal
+ }
+ }
+ },
+ {
+ widget = wibox.container.margin,
+ margins = {
+ top = vars.padding
+ },
+ {
+ spacing = vars.padding,
+ layout = wibox.layout.fixed.vertical,
+ id = "entry_layout"
+ }
+ },
+ 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
+
+function fresnel:show()
+ self._toggled = true
+ self._timed.target = 1
+ self:_update()
+ self._prompt:start()
+end
+
+function fresnel:hide()
+ self._toggled = false
+ self._timed.target = 0
+ self._prompt:stop()
+end
+
+fresnel._timed = rubato.timed {
+ duration = vars.anim_duration,
+ intro = vars.anim_intro,
+ pos = 0,
+ subscribed = function(pos)
+ fresnel._widget.opacity = pos
+
+ if pos == 0 then
+ fresnel._widget.visible = false
+ else
+ fresnel._widget.visible = true
+ end
+ end
+}
+
+return fresnel
diff --git a/.config/awesome/ui/fresnel/lenses/.gitignore b/.config/awesome/ui/fresnel/lenses/.gitignore
new file mode 100644
index 0000000..4fffb2f
--- /dev/null
+++ b/.config/awesome/ui/fresnel/lenses/.gitignore
@@ -0,0 +1,2 @@
+/target
+/Cargo.lock
diff --git a/.config/awesome/ui/fresnel/lenses/Cargo.toml b/.config/awesome/ui/fresnel/lenses/Cargo.toml
new file mode 100644
index 0000000..4dcb8bc
--- /dev/null
+++ b/.config/awesome/ui/fresnel/lenses/Cargo.toml
@@ -0,0 +1,18 @@
+[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
new file mode 100644
index 0000000..c0f5d63
--- /dev/null
+++ b/.config/awesome/ui/fresnel/lenses/install.log
@@ -0,0 +1,10 @@
+[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
new file mode 120000
index 0000000..5f7fc45
--- /dev/null
+++ b/.config/awesome/ui/fresnel/lenses/liblenses.so
@@ -0,0 +1 @@
+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
new file mode 100644
index 0000000..36afbbd
--- /dev/null
+++ b/.config/awesome/ui/fresnel/lenses/rustfmt.toml
@@ -0,0 +1,3 @@
+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
new file mode 100644
index 0000000..0cf6c1a
--- /dev/null
+++ b/.config/awesome/ui/fresnel/lenses/src/application.rs
@@ -0,0 +1,107 @@
+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
new file mode 100644
index 0000000..792985d
--- /dev/null
+++ b/.config/awesome/ui/fresnel/lenses/src/calculator.rs
@@ -0,0 +1,25 @@
+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
new file mode 100644
index 0000000..d6e7467
--- /dev/null
+++ b/.config/awesome/ui/fresnel/lenses/src/entry.rs
@@ -0,0 +1,20 @@
+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
new file mode 100644
index 0000000..e4fc881
--- /dev/null
+++ b/.config/awesome/ui/fresnel/lenses/src/lib.rs
@@ -0,0 +1,16 @@
+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
new file mode 100644
index 0000000..e7f59cc
--- /dev/null
+++ b/.config/awesome/ui/info_center/init.lua
@@ -0,0 +1,8 @@
+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
new file mode 100644
index 0000000..4e6d98e
--- /dev/null
+++ b/.config/awesome/ui/init.lua
@@ -0,0 +1,4 @@
+-- require "ui.window_switcher"
+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
new file mode 100644
index 0000000..4ed6099
--- /dev/null
+++ b/.config/awesome/ui/insightful/init.lua
@@ -0,0 +1,273 @@
+local awful = require "awful"
+local gtable = require "gears.table"
+local h = require "misc.helpers"
+local vars = require "misc.vars"
+local wibox = require "wibox"
+local rubato = require "lib.rubato"
+local btn = awful.button.names
+
+local first_time = true
+local mouse = "󰍽 "
+
+local insightful = {}
+
+insightful._toggled = false
+insightful._bindings = {}
+insightful._selected_group = ""
+
+insightful._keymap = {
+ 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 = "🔆+",
+ XF86MonBrightnessDown = "🔅-",
+ XF86AudioRaiseVolume = "ﱛ",
+ XF86AudioLowerVolume = "ﱜ",
+ XF86AudioMute = "ﱝ",
+ XF86AudioPlay = "⏯",
+ XF86AudioPrev = "⏮",
+ XF86AudioNext = "⏭",
+ XF86AudioStop = "⏹",
+ [tostring(btn.LEFT)] = mouse .. "Left",
+ [tostring(btn.MIDDLE)] = mouse .. "Middle",
+ [tostring(btn.RIGHT)] = mouse .. "Right"
+}
+
+insightful._widget = h.popup {
+ visible = false,
+ ontop = true,
+ placement = awful.placement.centered,
+ minimum_height = screen[1].geometry.height / 2,
+ minimum_width = screen[1].geometry.width / 2,
+ widget = {
+ layout = wibox.layout.fixed.vertical,
+ spacing = vars.big_padding,
+ id = "layout_container"
+ }
+}
+
+function insightful:_generate()
+ local grouped_binds = {}
+ local layout_container = insightful._widget.widget.layout_container
+
+ for _, keybind in ipairs(self._bindings) do
+ local group = keybind.group or "general"
+ local group_exists = grouped_binds[group] ~= nil
+
+ if not group_exists then
+ grouped_binds[group] = {}
+ end
+
+ table.insert(grouped_binds[group], {
+ mods = keybind.mods,
+ triggers = keybind.triggers,
+ desc = keybind.desc
+ })
+ end
+
+ for group, keybinds in h.opairs(grouped_binds) do
+ local group_layout = {
+ spacing = vars.padding,
+ layout = wibox.layout.fixed.vertical
+ }
+
+ for _, keybind in ipairs(keybinds) do
+ local key_layout = {
+ layout = wibox.layout.fixed.horizontal
+ }
+
+ local key_and_desc_layout = {
+ nil, -- key
+ nil,
+ nil, -- description?
+ layout = wibox.layout.align.horizontal
+ }
+
+ for _, mod in ipairs(keybind.mods) do
+ table.insert(key_layout, 1, h.styled {
+ widget = wibox.container.background,
+ bg = vars.colors.bright.black,
+ border_width = 0,
+ {
+ widget = wibox.container.margin,
+ margins = vars.padding,
+ {
+ widget = wibox.widget.textbox,
+ text = insightful._keymap[mod] or mod
+ }
+ }
+ })
+ table.insert(key_layout, 2, {
+ widget = wibox.widget.textbox,
+ text = " + "
+ })
+ end
+
+ if type(keybind.triggers) == "string" or type(keybind.triggers) == "number" then
+ table.insert(key_layout, {
+ widget = wibox.widget.textbox,
+ text = insightful._keymap[tostring(keybind.triggers)] or keybind.triggers
+ })
+ elseif type(keybind.triggers) == "table" then
+ local display_trigger = {}
+ for _, trigger in ipairs(keybind.triggers) do
+ table.insert(display_trigger, insightful._keymap[trigger[1]] or trigger[1])
+ end
+ table.insert(key_layout, {
+ widget = wibox.widget.textbox,
+ text = table.concat(display_trigger, "/")
+ })
+ end
+
+ if keybind.desc then
+ key_and_desc_layout[3] = {
+ widget = wibox.container.background,
+ fg = vars.colors.dim.fg,
+ {
+ widget = wibox.widget.textbox,
+ text = keybind.desc
+ }
+ }
+ end
+
+ key_and_desc_layout[1] = key_layout
+
+ table.insert(group_layout, key_and_desc_layout)
+ end
+
+ layout_container:add {
+ {
+ {
+ widget = wibox.container.background,
+ bg = vars.colors.yellow,
+ fg = vars.colors.bg,
+ shape = vars.shape,
+ {
+ widget = wibox.container.margin,
+ margins = vars.padding,
+ {
+ widget = wibox.widget.textbox,
+ text = group
+ }
+ }
+ },
+ nil,
+ layout = wibox.layout.align.horizontal
+ },
+ group_layout,
+ spacing = vars.padding,
+ layout = wibox.layout.fixed.vertical
+ }
+ end
+end
+
+local timed = rubato.timed {
+ duration = vars.anim_duration,
+ intro = vars.anim_intro,
+ pos = 0,
+ subscribed = function(pos)
+ insightful._widget.opacity = pos
+
+ if pos == 0 then
+ insightful._widget.visible = false
+ else
+ insightful._widget.visible = true
+ end
+ end
+}
+
+function insightful:toggle()
+ if first_time then
+ insightful:_generate_widget()
+ first_time = false
+ end
+
+ timed.target = insightful._toggled and 0 or 1
+ 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
new file mode 100644
index 0000000..dfe2868
--- /dev/null
+++ b/.config/awesome/ui/statusbar/init.lua
@@ -0,0 +1,75 @@
+local awful = require "awful"
+local beautiful = require "beautiful"
+local xresources = require "beautiful.xresources"
+local dpi = xresources.apply_dpi
+local vars = require "misc.vars"
+local wibox = require "wibox"
+local h = require "misc.helpers"
+
+local taglist = require "ui.statusbar.widgets.taglist"
+local clock = require "ui.statusbar.widgets.clock"
+local wifi = require "ui.statusbar.widgets.wifi"
+local battery = require "ui.statusbar.widgets.battery"
+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 {
+ 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),
+ widget = {
+ {
+ {
+ widget = wibox.container.place,
+ valign = "top",
+ {
+ widget = wibox.widget.textbox,
+ text = "",
+ font = h.font(1.5)
+ }
+ },
+ taglist,
+ {
+ widget = wibox.container.place,
+ valign = "bottom",
+ {
+ layout = wibox.layout.fixed.vertical,
+ spacing = vars.padding * 2,
+ brightness,
+ battery,
+ wifi,
+ keyboardlayout,
+ clock
+ },
+ },
+ layout = wibox.layout.align.vertical,
+ expand = "outside",
+ },
+ -- {
+ -- 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
+ }
+ }
+
+ bar:struts {
+ left = dpi(16) + vars.big_padding * 2 + beautiful.useless_gap * 4
+ }
+end)
diff --git a/.config/awesome/ui/statusbar/widgets/app_launcher.lua b/.config/awesome/ui/statusbar/widgets/app_launcher.lua
new file mode 100644
index 0000000..2e1e10a
--- /dev/null
+++ b/.config/awesome/ui/statusbar/widgets/app_launcher.lua
@@ -0,0 +1,6 @@
+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
new file mode 100644
index 0000000..b041c3a
--- /dev/null
+++ b/.config/awesome/ui/statusbar/widgets/battery.lua
@@ -0,0 +1,67 @@
+local awful = require "awful"
+local xresources = require "beautiful.xresources"
+local vars = require "misc.vars"
+local wibox = require "wibox"
+local h = require "misc.helpers"
+
+local battery_inner = awful.widget.watch("cat /sys/class/power_supply/BAT0/capacity", 1, function(widget, stdout)
+ local icon = ""
+ local color = vars.colors.red
+
+ 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>")
+ 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
+}
+
+h.tooltip({ battery }, function()
+ return io.popen("cat /sys/class/power_supply/BAT0/capacity"):read("*a"):sub(0, -2) .. "%"
+end)
+
+return battery
diff --git a/.config/awesome/ui/statusbar/widgets/brightness.lua b/.config/awesome/ui/statusbar/widgets/brightness.lua
new file mode 100644
index 0000000..cceba89
--- /dev/null
+++ b/.config/awesome/ui/statusbar/widgets/brightness.lua
@@ -0,0 +1,18 @@
+local vars = require "misc.vars"
+local wibox = require "wibox"
+local h = require "misc.helpers"
+
+local brightness = wibox.widget {
+ widget = wibox.container.place,
+ {
+ widget = wibox.widget.textbox,
+ font = vars.font,
+ text = ""
+ },
+}
+
+h.tooltip({ brightness }, function()
+ return math.floor(tonumber(io.popen("brightnessctl g"):read("*a"):sub(0, -2)) / 255 * 100) .. "%"
+end)
+
+return brightness
diff --git a/.config/awesome/ui/statusbar/widgets/clock.lua b/.config/awesome/ui/statusbar/widgets/clock.lua
new file mode 100644
index 0000000..c7b3c29
--- /dev/null
+++ b/.config/awesome/ui/statusbar/widgets/clock.lua
@@ -0,0 +1,18 @@
+local vars = require "misc.vars"
+local wibox = require "wibox"
+local h = require "misc.helpers"
+
+local clock = wibox.widget {
+ widget = wibox.container.place,
+ {
+ format = "%H\n%M",
+ widget = wibox.widget.textclock,
+ font = vars.font
+ },
+}
+
+h.tooltip({ clock }, function()
+ return os.date("%a %d/%m/%y")
+end)
+
+return clock
diff --git a/.config/awesome/ui/statusbar/widgets/keyboardlayout.lua b/.config/awesome/ui/statusbar/widgets/keyboardlayout.lua
new file mode 100644
index 0000000..0bbbf14
--- /dev/null
+++ b/.config/awesome/ui/statusbar/widgets/keyboardlayout.lua
@@ -0,0 +1,327 @@
+-- Slightly modified to not take up as much space
+
+---------------------------------------------------------------------------
+-- Display the current keyboard layout name in a widget.
+--
+--
+-- @author Aleksey Fedotov &lt;lexa@cfotr.com&gt;
+-- @copyright 2015 Aleksey Fedotov
+-- @widgetmod awful.widget.keyboardlayout
+-- @supermodule wibox.widget.base
+---------------------------------------------------------------------------
+
+local capi = {awesome = awesome}
+local setmetatable = setmetatable
+local textbox = require("wibox.widget.textbox")
+local button = require("awful.button")
+local widget_base = require("wibox.widget.base")
+local gdebug = require("gears.debug")
+
+--- Keyboard Layout widget.
+-- awful.widget.keyboardlayout
+local keyboardlayout = { mt = {} }
+
+-- As to the country-code-like symbols below, refer to the names of XKB's
+-- data files in /.../xkb/symbols/*.
+keyboardlayout.xkeyboard_country_code = {
+ ["ad"] = true, -- Andorra
+ ["af"] = true, -- Afganistan
+ ["al"] = true, -- Albania
+ ["am"] = true, -- Armenia
+ ["ara"] = true, -- Arabic
+ ["at"] = true, -- Austria
+ ["az"] = true, -- Azerbaijan
+ ["ba"] = true, -- Bosnia and Herzegovina
+ ["bd"] = true, -- Bangladesh
+ ["be"] = true, -- Belgium
+ ["bg"] = true, -- Bulgaria
+ ["br"] = true, -- Brazil
+ ["bt"] = true, -- Bhutan
+ ["bw"] = true, -- Botswana
+ ["by"] = true, -- Belarus
+ ["ca"] = true, -- Canada
+ ["cd"] = true, -- Congo
+ ["ch"] = true, -- Switzerland
+ ["cm"] = true, -- Cameroon
+ ["cn"] = true, -- China
+ ["cz"] = true, -- Czechia
+ ["de"] = true, -- Germany
+ ["dk"] = true, -- Denmark
+ ["ee"] = true, -- Estonia
+ ["epo"] = true, -- Esperanto
+ ["es"] = true, -- Spain
+ ["et"] = true, -- Ethiopia
+ ["eu"] = true, -- EurKey
+ ["fi"] = true, -- Finland
+ ["fo"] = true, -- Faroe Islands
+ ["fr"] = true, -- France
+ ["gb"] = true, -- United Kingdom
+ ["ge"] = true, -- Georgia
+ ["gh"] = true, -- Ghana
+ ["gn"] = true, -- Guinea
+ ["gr"] = true, -- Greece
+ ["hr"] = true, -- Croatia
+ ["hu"] = true, -- Hungary
+ ["ie"] = true, -- Ireland
+ ["il"] = true, -- Israel
+ ["in"] = true, -- India
+ ["iq"] = true, -- Iraq
+ ["ir"] = true, -- Iran
+ ["is"] = true, -- Iceland
+ ["it"] = true, -- Italy
+ ["jp"] = true, -- Japan
+ ["ke"] = true, -- Kenya
+ ["kg"] = true, -- Kyrgyzstan
+ ["kh"] = true, -- Cambodia
+ ["kr"] = true, -- Korea
+ ["kz"] = true, -- Kazakhstan
+ ["la"] = true, -- Laos
+ ["latam"] = true, -- Latin America
+ ["latin"] = true, -- Latin
+ ["lk"] = true, -- Sri Lanka
+ ["lt"] = true, -- Lithuania
+ ["lv"] = true, -- Latvia
+ ["ma"] = true, -- Morocco
+ ["mao"] = true, -- Maori
+ ["me"] = true, -- Montenegro
+ ["mk"] = true, -- Macedonia
+ ["ml"] = true, -- Mali
+ ["mm"] = true, -- Myanmar
+ ["mn"] = true, -- Mongolia
+ ["mt"] = true, -- Malta
+ ["mv"] = true, -- Maldives
+ ["ng"] = true, -- Nigeria
+ ["nl"] = true, -- Netherlands
+ ["no"] = true, -- Norway
+ ["np"] = true, -- Nepal
+ ["ph"] = true, -- Philippines
+ ["pk"] = true, -- Pakistan
+ ["pl"] = true, -- Poland
+ ["pt"] = true, -- Portugal
+ ["ro"] = true, -- Romania
+ ["rs"] = true, -- Serbia
+ ["ru"] = true, -- Russia
+ ["se"] = true, -- Sweden
+ ["si"] = true, -- Slovenia
+ ["sk"] = true, -- Slovakia
+ ["sn"] = true, -- Senegal
+ ["sy"] = true, -- Syria
+ ["th"] = true, -- Thailand
+ ["tj"] = true, -- Tajikistan
+ ["tm"] = true, -- Turkmenistan
+ ["tr"] = true, -- Turkey
+ ["tw"] = true, -- Taiwan
+ ["tz"] = true, -- Tanzania
+ ["ua"] = true, -- Ukraine
+ ["us"] = true, -- USA
+ ["uz"] = true, -- Uzbekistan
+ ["vn"] = true, -- Vietnam
+ ["za"] = true, -- South Africa
+}
+
+-- Callback for updating current layout.
+local function update_status (self)
+ self._current = awesome.xkb_get_layout_group()
+ local text = ""
+ if #self._layout > 0 then
+ -- Please note that the group number reported by xkb_get_layout_group
+ -- is lower by one than the group numbers reported by xkb_get_group_names.
+ local name = self._layout[self._current+1]
+ if name then
+ text = name
+ end
+ end
+ self.widget:set_text(text)
+end
+
+--- Auxiliary function for the local function update_layout().
+-- Create an array whose element is a table consisting of the four fields:
+-- vendor, file, section and group_idx, which all correspond to the
+-- xkb_symbols pattern "vendor/file(section):group_idx".
+-- @tparam string group_names The string `awesome.xkb_get_group_names()` returns.
+-- @treturn table An array of tables whose keys are vendor, file, section, and group_idx.
+-- @staticfct awful.keyboardlayout.get_groups_from_group_names
+function keyboardlayout.get_groups_from_group_names(group_names)
+ if group_names == nil then
+ return nil
+ end
+
+ -- Pattern elements to be captured.
+ local word_pat = "([%w_]+)"
+ local sec_pat = "(%b())"
+ local idx_pat = ":(%d)"
+ -- Pairs of a pattern and its callback. In callbacks, set 'group_idx' to 1
+ -- and return it if there's no specification on 'group_idx' in the given
+ -- pattern.
+ local pattern_and_callback_pairs = {
+ -- vendor/file(section):group_idx
+ ["^" .. word_pat .. "/" .. word_pat .. sec_pat .. idx_pat .. "$"]
+ = function(token, pattern)
+ local vendor, file, section, group_idx = string.match(token, pattern)
+ return vendor, file, section, group_idx
+ end,
+ -- vendor/file(section)
+ ["^" .. word_pat .. "/" .. word_pat .. sec_pat .. "$"]
+ = function(token, pattern)
+ local vendor, file, section = string.match(token, pattern)
+ return vendor, file, section, 1
+ end,
+ -- vendor/file:group_idx
+ ["^" .. word_pat .. "/" .. word_pat .. idx_pat .. "$"]
+ = function(token, pattern)
+ local vendor, file, group_idx = string.match(token, pattern)
+ return vendor, file, nil, group_idx
+ end,
+ -- vendor/file
+ ["^" .. word_pat .. "/" .. word_pat .. "$"]
+ = function(token, pattern)
+ local vendor, file = string.match(token, pattern)
+ return vendor, file, nil, 1
+ end,
+ -- file(section):group_idx
+ ["^" .. word_pat .. sec_pat .. idx_pat .. "$"]
+ = function(token, pattern)
+ local file, section, group_idx = string.match(token, pattern)
+ return nil, file, section, group_idx
+ end,
+ -- file(section)
+ ["^" .. word_pat .. sec_pat .. "$"]
+ = function(token, pattern)
+ local file, section = string.match(token, pattern)
+ return nil, file, section, 1
+ end,
+ -- file:group_idx
+ ["^" .. word_pat .. idx_pat .. "$"]
+ = function(token, pattern)
+ local file, group_idx = string.match(token, pattern)
+ return nil, file, nil, group_idx
+ end,
+ -- file
+ ["^" .. word_pat .. "$"]
+ = function(token, pattern)
+ local file = string.match(token, pattern)
+ return nil, file, nil, 1
+ end
+ }
+
+ -- Split 'group_names' into 'tokens'. The separator is "+".
+ local tokens = {}
+ string.gsub(group_names, "[^+]+", function(match)
+ table.insert(tokens, match)
+ end)
+
+ -- For each token in 'tokens', check if it matches one of the patterns in
+ -- the array 'pattern_and_callback_pairs', where the patterns are used as
+ -- key. If a match is found, extract captured strings using the
+ -- corresponding callback function. Check if those extracted is country
+ -- specific part of a layout. If so, add it to 'layout_groups'; otherwise,
+ -- ignore it.
+ local layout_groups = {}
+ for i = 1, #tokens do
+ for pattern, callback in pairs(pattern_and_callback_pairs) do
+ local vendor, file, section, group_idx = callback(tokens[i], pattern)
+ if file then
+ if not keyboardlayout.xkeyboard_country_code[file] then
+ break
+ end
+
+ if section then
+ section = string.gsub(section, "%(([%w-_]+)%)", "%1")
+ end
+
+ table.insert(layout_groups, { vendor = vendor,
+ file = file,
+ section = section,
+ group_idx = tonumber(group_idx) })
+ break
+ end
+ end
+ end
+
+ return layout_groups
+end
+
+-- Callback for updating list of layouts
+local function update_layout(self)
+ self._layout = {};
+ local layouts = keyboardlayout.get_groups_from_group_names(awesome.xkb_get_group_names())
+ if layouts == nil or layouts[1] == nil then
+ gdebug.print_error("Failed to get list of keyboard groups")
+ return
+ end
+ if #layouts == 1 then
+ layouts[1].group_idx = 1
+ end
+ for _, v in ipairs(layouts) do
+ self._layout[v.group_idx] = self.layout_name(v)
+ end
+ update_status(self)
+end
+
+--- Select the next layout.
+-- @noreturn
+-- @method next_layout
+
+--- Create a keyboard layout widget.
+--
+-- It shows current keyboard layout name in a textbox.
+--
+-- @constructorfct awful.widget.keyboardlayout
+-- @treturn awful.widget.keyboardlayout A keyboard layout widget.
+function keyboardlayout.new()
+ local widget = textbox()
+ local self = widget_base.make_widget(widget, nil, {enable_properties=true})
+
+ self.widget = widget
+
+ self.layout_name = function(v)
+ local name = v.file
+ if v.section ~= nil then
+ name = name .. "(" .. v.section .. ")"
+ end
+ return name
+ end
+
+ self.next_layout = function()
+ self.set_layout((self._current + 1) % (#self._layout + 1))
+ end
+
+ self.set_layout = function(group_number)
+ if (0 > group_number) or (group_number > #self._layout) then
+ error("Invalid group number: " .. group_number ..
+ "expected number from 0 to " .. #self._layout)
+ return;
+ end
+ awesome.xkb_set_layout_group(group_number);
+ end
+
+ update_layout(self);
+
+ -- callback for processing layout changes
+ capi.awesome.connect_signal("xkb::map_changed",
+ function () update_layout(self) end)
+ capi.awesome.connect_signal("xkb::group_changed",
+ function () update_status(self) end);
+
+ -- Mouse bindings
+ self.buttons = {
+ button({ }, 1, self.next_layout)
+ }
+
+ return self
+end
+
+local _instance = nil;
+
+function keyboardlayout.mt:__call(...)
+ if _instance == nil then
+ _instance = keyboardlayout.new(...)
+ end
+ return _instance
+end
+
+
+return setmetatable(keyboardlayout, keyboardlayout.mt)
+
+-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
+
diff --git a/.config/awesome/ui/statusbar/widgets/power_menu.lua b/.config/awesome/ui/statusbar/widgets/power_menu.lua
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/.config/awesome/ui/statusbar/widgets/power_menu.lua
diff --git a/.config/awesome/ui/statusbar/widgets/taglist.lua b/.config/awesome/ui/statusbar/widgets/taglist.lua
new file mode 100644
index 0000000..751cbf0
--- /dev/null
+++ b/.config/awesome/ui/statusbar/widgets/taglist.lua
@@ -0,0 +1,89 @@
+local awful = require "awful"
+local vars = require "misc.vars"
+local wibox = require "wibox"
+local timed = require "lib.rubato".timed
+
+return awful.widget.taglist({
+ screen = screen[1],
+ filter = awful.widget.taglist.filter.all,
+ style = {
+ shape = vars.shape
+ },
+ layout = {
+ spacing = vars.padding,
+ layout = wibox.layout.fixed.vertical
+ },
+ widget_template = {
+ {
+ 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.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:connect_signal("mouse::enter", function()
+ if tag.selected then return end
+
+ indicator.bg = vars.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
+ end)
+ end,
+ update_callback = function(self, tag)
+ local indicator = self:get_children_by_id("indicator_role")[1]
+
+ 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
+ indicator.bg = vars.colors.bright.black
+ self._anim.target = vars.button_size
+ 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),
+ }
+})
diff --git a/.config/awesome/ui/statusbar/widgets/wifi.lua b/.config/awesome/ui/statusbar/widgets/wifi.lua
new file mode 100644
index 0000000..d0b7116
--- /dev/null
+++ b/.config/awesome/ui/statusbar/widgets/wifi.lua
@@ -0,0 +1,48 @@
+local awful = require "awful"
+local vars = require "misc.vars"
+local wibox = require "wibox"
+local h = require "misc.helpers"
+
+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
+
+ if stdout == "" then
+ widget:set_markup("<span color=\"" .. color .. "\">" .. icon .. "</span>")
+ 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
+}
+
+h.tooltip({ wifi }, function()
+ return io.popen("iwgetid -r"):read("*a"):sub(0, -2)
+end)
+
+return wifi
diff --git a/.config/awesome/ui/wicked/_default.lua b/.config/awesome/ui/wicked/_default.lua
new file mode 100644
index 0000000..25283f9
--- /dev/null
+++ b/.config/awesome/ui/wicked/_default.lua
@@ -0,0 +1,94 @@
+----------------------------------------------------------------------------
+--- The default widget template for the notifications.
+--
+-- @author Emmanuel Lepage Vallee &lt;elv1313@gmail.com&gt;
+-- @copyright 2019 Emmanuel Lepage Vallee
+-- @classmod naughty.widget._default
+----------------------------------------------------------------------------
+
+local wibox = require("wibox")
+local actionlist = require("naughty.list.actions")
+local wtitle = require("naughty.widget.title")
+local wmessage = require("naughty.widget.message")
+local wicon = require("naughty.widget.icon")
+local wbg = require("naughty.container.background")
+local beautiful = require("beautiful")
+local dpi = require("beautiful").xresources.apply_dpi
+
+-- It is not worth doing a special widget for this.
+local function notif_size()
+ local constraint = wibox.container.constraint()
+ constraint:set_strategy("max")
+ constraint:set_width(beautiful.notification_max_width or dpi(500))
+
+ rawset(constraint, "set_notification", function(_, notif)
+ constraint._private.notification = setmetatable({notif}, {__mode = "v"})
+ local s = false
+
+ if notif.width and notif.width ~= beautiful.notification_max_width then
+ constraint.width = notif.width
+ s = true
+ end
+ if notif.height then
+ constraint.height = notif.height
+ s = true
+ end
+
+ constraint.strategy = s and "exact" or "max"
+ end)
+
+ rawset(constraint, "get_notification", function()
+ return constraint._private.notification[1]
+ end)
+
+ return constraint
+end
+
+-- It is not worth doing a special widget for this either.
+local function notif_margins()
+ local margins = wibox.container.margin()
+ margins:set_margins(beautiful.notification_margin or 4)
+
+ rawset(margins, "set_notification", function(_, notif)
+ if notif.margin then
+ margins:set_margins(notif.margin)
+ end
+ end)
+
+ return margins
+end
+
+-- Used as a fallback when no widget_template is provided, emulate the legacy
+-- widget.
+return {
+ {
+ {
+ {
+ {
+ wicon,
+ {
+ widget = wibox.container.place,
+ valign = "center",
+ halign = "center",
+ {
+ wtitle,
+ wmessage,
+ -- spacing = 4,
+ layout = wibox.layout.fixed.vertical,
+ }
+ },
+ fill_space = true,
+ -- spacing = 4,
+ layout = wibox.layout.fixed.horizontal
+ },
+ actionlist,
+ -- spacing = 10,
+ layout = wibox.layout.fixed.vertical,
+ },
+ widget = notif_margins,
+ },
+ id = "background_role",
+ widget = wbg,
+ },
+ widget = notif_size,
+}
diff --git a/.config/awesome/ui/wicked/init.lua b/.config/awesome/ui/wicked/init.lua
new file mode 100644
index 0000000..5687b81
--- /dev/null
+++ b/.config/awesome/ui/wicked/init.lua
@@ -0,0 +1,101 @@
+local awful = require "awful"
+local vars = require "misc.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 wicked = {}
+
+wicked._active_notififcations = {}
+
+function wicked:notify(n)
+ -- local notif = wibox.widget {
+ local notif = h.popup {
+ -- widget = {
+ -- {
+ -- {
+ -- widget = naughty.widget.icon,
+ -- notification = n,
+ -- forced_height = 0,
+ -- forced_width = 0,
+ -- clip_shape = vars.shape,
+ -- id = "icon_role"
+ -- },
+ -- {
+ -- {
+ -- widget = naughty.widget.title,
+ -- notification = n
+ -- },
+ -- {
+ -- widget = naughty.widget.message,
+ -- notification = n
+ -- },
+ -- layout = wibox.layout.fixed.vertical
+ -- },
+ -- layout = wibox.layout.fixed.horizontal,
+ -- spacing = vars.padding
+ -- },
+ -- widget = wibox.container.margin,
+ -- margins = vars.padding
+ -- },
+ widget = {
+ -- {
+ {
+ widget = naughty.widget.icon,
+ notification = n
+ },
+ {
+ widget = wibox.container.place,
+ valign = "center",
+ halign = "center",
+ {
+ {
+ widget = naughty.widget.title,
+ notification = n
+ },
+ {
+ widget = naughty.widget.message,
+ notification = n
+ },
+ -- spacing = 4,
+ layout = wibox.layout.fixed.vertical,
+ }
+ },
+ fill_space = true,
+ -- spacing = 4,
+ layout = wibox.layout.fixed.horizontal
+ -- },
+ -- actionlist,
+ -- spacing = 10,
+ -- layout = wibox.layout.fixed.vertical,
+ },
+ placement = awful.placement.centered,
+ ontop = true
+ }
+
+ gtimer {
+ timeout = vars.notif_timeout,
+ autostart = true,
+ callback = function()
+ notif.visible = false
+ notif = nil
+ end
+ }
+
+ -- local icon = notif.widget:get_children_by_id("icon_role")[1]
+
+ -- if n.image then
+ -- icon.forced_height = dpi(32)
+ -- icon.forced_width = dpi(32)
+ -- end
+end
+
+return wicked
diff --git a/.config/awesome/ui/window_switcher/init.lua b/.config/awesome/ui/window_switcher/init.lua
new file mode 100644
index 0000000..f14c865
--- /dev/null
+++ b/.config/awesome/ui/window_switcher/init.lua
@@ -0,0 +1,172 @@
+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
+}