diff options
| author | delta <darkussdelta@gmail.com> | 2023-03-04 22:04:55 +0100 |
|---|---|---|
| committer | delta <darkussdelta@gmail.com> | 2023-03-04 22:18:21 +0100 |
| commit | f0b32f45746c026d402651013b7e98315d6956a1 (patch) | |
| tree | f42609e98522da081cebdd21a674a702d1054bbc /.config/awesome/components | |
| parent | a0f8b5fa6acdd1c2477fb1881dd9067956bf0ae6 (diff) | |
restructure awesome config, add fresnel
Diffstat (limited to '.config/awesome/components')
17 files changed, 0 insertions, 1080 deletions
diff --git a/.config/awesome/components/info_center/init.lua b/.config/awesome/components/info_center/init.lua deleted file mode 100644 index d1c78f2..0000000 --- a/.config/awesome/components/info_center/init.lua +++ /dev/null @@ -1,8 +0,0 @@ -local awful = require "awful" -local vars = require "themes.prismite.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/components/keybinds/client.lua b/.config/awesome/components/keybinds/client.lua deleted file mode 100644 index 35680c4..0000000 --- a/.config/awesome/components/keybinds/client.lua +++ /dev/null @@ -1,15 +0,0 @@ -local awful = require "awful" - -client.connect_signal("request::default_mousebindings", function() - awful.mouse.append_client_mousebindings({ - awful.button({ }, 1, function (c) - c:activate { context = "mouse_click" } - end), - awful.button({ modkey }, 1, function (c) - c:activate { context = "mouse_click", action = "mouse_move" } - end), - awful.button({ modkey }, 3, function (c) - c:activate { context = "mouse_click", action = "mouse_resize" } - end) - }) -end) diff --git a/.config/awesome/components/keybinds/global.lua b/.config/awesome/components/keybinds/global.lua deleted file mode 100644 index 56e4ea0..0000000 --- a/.config/awesome/components/keybinds/global.lua +++ /dev/null @@ -1,149 +0,0 @@ -local awful = require "awful" -local gears = require "gears" -local naughty = require "naughty" -local hkp = require "awful.hotkeys_popup.widget" -local vars = require "themes.prismite.vars" - -local labels = { - Control = "Ctrl", - Mod1 = "Alt", - ISO_Level3_Shift = "Alt Gr", - Mod4 = "Super", - Insert = "Ins", - Delete = "Del", - Next = "PgDn", - Prior = "PgUp", - Left = "", - Up = "", - Right = "", - Down = "", - KP_End = "Num1", - KP_Down = "Num2", - KP_Next = "Num3", - KP_Left = "Num4", - KP_Begin = "Num5", - KP_Right = "Num6", - KP_Home = "Num7", - KP_Up = "Num8", - KP_Prior = "Num9", - KP_Insert = "Num0", - KP_Delete = "Num.", - KP_Divide = "Num/", - KP_Multiply = "Num*", - KP_Subtract = "Num-", - KP_Add = "Num+", - KP_Enter = "NumEnter", - -- Some "obvious" entries are necessary for the Escape sequence - -- and whitespace characters: - Escape = "Esc", - Tab = "Tab", - space = "Space", - Return = "Enter", - -- Dead keys aren't distinct from non-dead keys because no sane - -- layout should have both of the same kind: - dead_acute = "´", - dead_circumflex = "^", - dead_grave = "`", - -- Basic multimedia keys: - XF86MonBrightnessUp = "🔆+", - XF86MonBrightnessDown = "🔅-", - XF86AudioRaiseVolume = "ﱛ", - XF86AudioLowerVolume = "ﱜ", - XF86AudioMute = "ﱝ", - XF86AudioPlay = "⏯", - XF86AudioPrev = "⏮", - XF86AudioNext = "⏭", - XF86AudioStop = "⏹", -} - -local globalkeys = gears.table.join( - -- awesome - awful.key { - modifiers = { modkey, "Control" }, - key = "r", - on_press = awesome.restart, - group = "awesome", - description = "restart awesome" - }, - awful.key { - modifiers = { modkey, "Control" }, - key = "s", - on_press = function() - hkp.new { - shape = vars.shape, - modifiers_fg = "#8893a5", - labels = labels - }:show_help() - end, - group = "awesome", - description = "toggle help" - }, - - -- general - awful.key { - modifiers = {}, - key = "XF86AudioMute", - on_press = function() - naughty.notification { - message = "mute" - } - end, - group = "general", - description = "mute audio" - }, - - -- launcher - awful.key { - modifiers = { modkey }, - key = "Return", - on_press = function () - awful.spawn("kitty") - end, - group = "launcher", - description = "launch kitty" - }, - - -- client - awful.key { - modifiers = { modkey, "Control" }, - key = "q", - on_press = function() - local c = client.focus - if c then - c:kill() - end - end, - group = "client", - description = "kill client" - }, - awful.key { - modifiers = { modkey, "Control" }, - key = "f", - on_press = function() - local c = client.focus - if c then - c.fullscreen = not c.fullscreen - end - end, - group = "client", - description = "toggle fullscreen" - }, - - -- tag - awful.key { - modifiers = { modkey }, - key = "Up", - on_press = awful.tag.viewprev, - group = "tag", - description = "switch to previous tag" - }, - awful.key { - modifiers = { modkey }, - key = "Down", - on_press = awful.tag.viewnext, - group = "tag", - description = "switch to next tag" - } -) - -root.keys(globalkeys) diff --git a/.config/awesome/components/keybinds/init.lua b/.config/awesome/components/keybinds/init.lua deleted file mode 100644 index 25b8942..0000000 --- a/.config/awesome/components/keybinds/init.lua +++ /dev/null @@ -1,4 +0,0 @@ -modkey = "Mod4" - -require "components.keybinds.global" -require "components.keybinds.client" diff --git a/.config/awesome/components/signals/awesome.lua b/.config/awesome/components/signals/awesome.lua deleted file mode 100644 index 37b9bdb..0000000 --- a/.config/awesome/components/signals/awesome.lua +++ /dev/null @@ -1,32 +0,0 @@ --- Taken from https://www.reddit.com/r/awesomewm/comments/syjolb/comment/hy0xy35/ - -awesome.connect_signal('exit', function(reason_restart) - if not reason_restart then return end - - local file = io.open('/tmp/awesomewm-last-selected-tags', 'w+') - - for s in screen do - file:write(s.selected_tag.index, '\n') - end - - file:close() -end) - -awesome.connect_signal('startup', function() - local file = io.open('/tmp/awesomewm-last-selected-tags', 'r') - if not file then return end - - local selected_tags = {} - - for line in file:lines() do - table.insert(selected_tags, tonumber(line)) - end - - for s in screen do - local i = selected_tags[s.index] - local t = s.tags[i] - t:view_only() - end - - file:close() -end) diff --git a/.config/awesome/components/signals/client.lua b/.config/awesome/components/signals/client.lua deleted file mode 100644 index 0b44d62..0000000 --- a/.config/awesome/components/signals/client.lua +++ /dev/null @@ -1,104 +0,0 @@ -local awful = require "awful" -local beautiful = require "beautiful" --- local cairo = require "lgi".cairo -local gears = require "gears" -local xresources = require "beautiful.xresources" -local dpi = xresources.apply_dpi -local wibox = require "wibox" - -client.connect_signal("property::name", function(c) - if not c then return end -- Sometimes c is nil for some reason - if not c.pid then return end - - local out = io.popen("readlink /proc/" .. c.pid .. "/exe") - local name = c.name - if out ~= nil then - name = out:read("*a"):sub(0, -2):match("[^\\/]+$") or name - end - c.name = string.lower(name) -end) - -client.connect_signal("property::urgent", function(c) - if c.class ~= "kitty" then - c:activate({ - switch_to_tag = true - }) - c.urgent = false - end -end) - -client.connect_signal("request::manage", function (c) - local parent = c.transient_for - if parent then - c:move_to_tag(parent.first_tag) - end - - if not c.pid then return end - - awful.spawn.easy_async({ "readlink", "/proc/" .. c.pid .. "/exe" }, function(name) - c.name = string.lower(name:match("[^\\/]+$") or name) - end) - - -- Forcefully set the correct icon for a client - -- Taken from https://discord.com/channels/702548301299580939/893586726885425163/947173452073287722 (Author: Orlando#0171) and modified a little bit - -- local icon_cache = Get_icon(beautiful.get().icon_theme, c) - - -- if type(icon_cache) ~= "userdata" then - -- local s = gears.surface(icon_cache) - -- local img = cairo.ImageSurface.create(cairo.Format.ARGB32, s:get_width(), s:get_height()) - -- local cr = cairo.Context(img) - -- cr:set_source_surface(s, 0, 0) - -- cr:paint() - - -- c.icon = img._native - -- end -end) - -client.connect_signal("property::maximized", function(c) - c.border_width = beautiful.border_width -end) - -client.connect_signal("request::titlebars", function(c) - local buttons = gears.table.join( - awful.button({ }, 1, function() - c:emit_signal("request::activate", "titlebar", {raise = true}) - awful.mouse.client.move(c) - end), - awful.button({ }, 3, function() - c:emit_signal("request::activate", "titlebar", {raise = true}) - awful.mouse.client.resize(c) - end) - ) - - awful.titlebar.enable_tooltip = false - - awful.titlebar(c) : setup { - -- { - -- widget = wibox.container.margin, - -- left = dpi(8), - -- awful.titlebar.widget.titlewidget(c), - -- buttons = buttons - -- }, - nil, - - { - widget = wibox.widget.base.empty_widget(), - buttons = buttons - }, - { - - { - awful.titlebar.widget.maximizedbutton (c), - awful.titlebar.widget.minimizebutton (c), - awful.titlebar.widget.closebutton (c), - - spacing = dpi(4), - layout = wibox.layout.fixed.horizontal - }, - - margins = dpi(5), - widget = wibox.container.margin, - }, - layout = wibox.layout.align.horizontal - } -end) diff --git a/.config/awesome/components/signals/init.lua b/.config/awesome/components/signals/init.lua deleted file mode 100644 index 6e42252..0000000 --- a/.config/awesome/components/signals/init.lua +++ /dev/null @@ -1,5 +0,0 @@ -require "components.signals.naughty" -require "components.signals.awesome" -require "components.signals.client" -require "components.signals.rules" -require "components.signals.screen" diff --git a/.config/awesome/components/signals/naughty.lua b/.config/awesome/components/signals/naughty.lua deleted file mode 100644 index bab4712..0000000 --- a/.config/awesome/components/signals/naughty.lua +++ /dev/null @@ -1,64 +0,0 @@ -local awful = require "awful" -local vars = require "themes.prismite.vars" -local wibox = require "wibox" -local naughty = require "naughty" -local xresources = require "beautiful.xresources" -local dpi = xresources.apply_dpi - -function build_notification(n) - - - local popup = awful.popup { - widget = { - { - { - widget = naughty.widget.icon, - image = n.image, - forced_height = 64, - forced_width = 64, - clip_shape = vars.shape - }, - { - { - widget = wibox.widget.textbox, - text = n.title - }, - { - widget = wibox.widget.textbox, - text = n.message - }, - layout = wibox.layout.fixed.vertical - }, - layout = wibox.layout.fixed.horizontal - }, - widget = wibox.container.margin, - margins = dpi(4) - }, - border_color = vars.colors.bright.black, - border_width = vars.border_width, - ontop = true, - placement = function(d) - return awful.placement.bottom_right(d, { - honor_padding = true - }) - end, - bg = vars.colors.bg, - shape = vars.shape, - } - - -- popup.y = screen[1].tiling_area.height - - dpi(4) -end - --- naughty.connect_signal("request::display", build_notification) - -naughty.connect_signal("request::display", function(n) - naughty.layout.box { notification = n } -end) - -naughty.connect_signal("request::display_error", function(message, startup) - naughty.notification { - urgency = "critical", - title = "Oops, an error happened"..(startup and " during startup!" or "!"), - message = message - } -end) diff --git a/.config/awesome/components/signals/rules.lua b/.config/awesome/components/signals/rules.lua deleted file mode 100644 index 65db501..0000000 --- a/.config/awesome/components/signals/rules.lua +++ /dev/null @@ -1,102 +0,0 @@ -local ruled = require "ruled" -local beautiful = require "beautiful" -local awful = require "awful" -local vars = require "themes.prismite.vars" - -ruled.client.connect_signal("request::rules", function() - ruled.client.append_rule({ - id = "global", - rule = {}, - properties = { - border_width = beautiful.border_width, - border_color = beautiful.border_normal, - focus = awful.client.focus.filter, - raise = true, - screen = awful.screen.preferred, - placement = awful.placement.centered+awful.placement.no_offscreen, - floating = false, - shape = vars.shape, - honor_padding = true - -- tag = "1" - } - }) - - ruled.client.append_rule({ - id = "titlebars", - rule_any = { - type = { - "normal", - "dialog" - } - }, - properties = { - titlebars_enabled = true - } - }) - - ruled.client.append_rule({ - id = "steam", - rule_any = { - class = { "Steam" } - }, - properties = { - screen = 1, - tag = screen[1].tags[6] - } - }) - - ruled.client.append_rule({ - id = "browser_tag", - rule_any = { - class = { "firefox" } - }, - properties = { - screen = 1, - tag = screen[1].tags[2] - } - }) - - ruled.client.append_rule({ - id = "chat_tag", - rule_any = { - class = { "discord" } - }, - properties = { - screen = 1, - tag = screen[1].tags[3] - } - }) - - - ruled.client.append_rule({ - id = "music_tag", - rule_any = { - class = { "Spotify" } - }, - properties = { - screen = 1, - tag = screen[1].tags[4] - } - }) - - ruled.client.append_rule({ - id = "code_tag", - rule_any = { - class = { "lite-xl", "code_kitty" } - }, - properties = { - screen = 1, - tag = screen[1].tags[5] - } - }) - - ruled.client.append_rule({ - id = "pip", - rule = { - name = "Picture-in-Picture" - }, - properties = { - ontop = true - } - }) -end) diff --git a/.config/awesome/components/signals/screen.lua b/.config/awesome/components/signals/screen.lua deleted file mode 100644 index 3e49a68..0000000 --- a/.config/awesome/components/signals/screen.lua +++ /dev/null @@ -1,79 +0,0 @@ -local awful = require "awful" -local wibox = require "wibox" -local beautiful = require "beautiful" -local xresources = require "beautiful.xresources" -local dpi = xresources.apply_dpi - -screen.connect_signal("request::wallpaper", function(s) - awful.wallpaper { - screen = s, - widget = { - { - image = beautiful.wallpaper, - upscale = true, - downscale = true, - widget = wibox.widget.imagebox, - }, - valign = "center", - halign = "center", - tiled = false, - widget = wibox.container.tile, - } - } -end) - -screen.connect_signal("request::desktop_decoration", function(s) - -- s.padding = dpi(4) - - awful.tag.add( - "", - { - screen = s, - layout = awful.layout.suit.floating, - selected = true - } - ) - - awful.tag.add( - "", - { - screen = s, - layout = awful.layout.suit.floating, - - } - ) - - awful.tag.add( - "", - { - screen = s, - layout = awful.layout.suit.tile.left, - master_width_factor = 0.7 - } - ) - - awful.tag.add( - "", - { - screen = s, - layout = awful.layout.suit.tile - } - ) - - awful.tag.add( - "", - { - screen = s, - layout = awful.layout.suit.tile.right, - master_width_factor = 0.7 - } - ) - - awful.tag.add( - "", - { - screen = s, - layout = awful.layout.suit.floating, - } - ) -end) diff --git a/.config/awesome/components/statusbar/battery.lua b/.config/awesome/components/statusbar/battery.lua deleted file mode 100644 index 670b200..0000000 --- a/.config/awesome/components/statusbar/battery.lua +++ /dev/null @@ -1,78 +0,0 @@ -local awful = require "awful" -local xresources = require "beautiful.xresources" -local dpi = xresources.apply_dpi -local vars = require "themes.prismite.vars" -local wibox = require "wibox" - -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 -} - -awful.tooltip { - objects = { battery }, - timer_function = function() - return io.popen("cat /sys/class/power_supply/BAT0/capacity"):read("*a"):sub(0, -2) .. "%" - end, - bg = vars.colors.bg, - fg = vars.colors.fg, - border_color = vars.colors.bright.black, - border_width = vars.border_width, - font = vars.font, - shape = vars.shape, - margin_leftright = dpi(6), - margin_topbottom = dpi(6) -} - -return battery diff --git a/.config/awesome/components/statusbar/brightness.lua b/.config/awesome/components/statusbar/brightness.lua deleted file mode 100644 index eb37f06..0000000 --- a/.config/awesome/components/statusbar/brightness.lua +++ /dev/null @@ -1,33 +0,0 @@ -local awful = require "awful" -local xresources = require "beautiful.xresources" -local dpi = xresources.apply_dpi -local vars = require "themes.prismite.vars" -local wibox = require "wibox" - - -local brightness = wibox.widget { - widget = wibox.container.place, - { - widget = wibox.widget.textbox, - font = vars.font, - text = "" - }, -} - -awful.tooltip { - objects = { brightness }, - timer_function = function() - return math.floor(tonumber(io.popen("brightnessctl g"):read("*a"):sub(0, -2)) / 255 * 100) .. "%" - end, - timeout = 0.5, - bg = vars.colors.bg, - fg = vars.colors.fg, - border_color = vars.colors.bright.black, - border_width = vars.border_width, - font = vars.font, - shape = vars.shape, - margin_leftright = dpi(6), - margin_topbottom = dpi(6) -} - -return brightness diff --git a/.config/awesome/components/statusbar/clock.lua b/.config/awesome/components/statusbar/clock.lua deleted file mode 100644 index c88ea62..0000000 --- a/.config/awesome/components/statusbar/clock.lua +++ /dev/null @@ -1,32 +0,0 @@ -local awful = require "awful" -local xresources = require "beautiful.xresources" -local dpi = xresources.apply_dpi -local vars = require "themes.prismite.vars" -local wibox = require "wibox" - - -local clock = wibox.widget { - widget = wibox.container.place, - { - format = "%H\n%M", - widget = wibox.widget.textclock, - font = vars.font - }, -} - -awful.tooltip { - objects = { clock }, - timer_function = function() - return os.date("%a %d/%m/%y") - end, - bg = vars.colors.bg, - fg = vars.colors.fg, - border_color = vars.colors.bright.black, - border_width = vars.border_width, - font = vars.font, - shape = vars.shape, - margin_leftright = dpi(6), - margin_topbottom = dpi(6) -} - -return clock diff --git a/.config/awesome/components/statusbar/init.lua b/.config/awesome/components/statusbar/init.lua deleted file mode 100644 index c798669..0000000 --- a/.config/awesome/components/statusbar/init.lua +++ /dev/null @@ -1,57 +0,0 @@ -local awful = require "awful" -local beautiful = require "beautiful" -local xresources = require "beautiful.xresources" -local dpi = xresources.apply_dpi -local vars = require "themes.prismite.vars" -local wibox = require "wibox" - -local taglist = require "components.statusbar.taglist" -local clock = require "components.statusbar.clock" -local wifi = require "components.statusbar.wifi" -local battery = require "components.statusbar.battery" -local brightness = require "components.statusbar.brightness" - -screen.connect_signal("request::desktop_decoration", function(s) - local bar = awful.wibar({ - -- placement = function(d) - -- local place = awful.placement.left + awful.placement.maximize_vertically - -- return place(d, { - -- margins = beautiful.useless_gap - -- }) - -- end, - margins = dpi(4), - position = "left", - screen = s, - restrict_workarea = true, - height = s.geometry.height - (beautiful.useless_gap * 4 + vars.border_width * 2) - 2, - width = dpi(32), - border_width = vars.border_width, - border_color = vars.colors.bright.black, - shape = vars.shape, - bg = vars.colors.bg, - widget = { - { - margins = dpi(4), - widget = wibox.container.margin, - { - layout = wibox.layout.fixed.vertical, - taglist - } - }, - nil, - { - margins = dpi(4), - widget = wibox.container.margin, - { - layout = wibox.layout.fixed.vertical, - spacing = dpi(8), - brightness, - battery, - wifi, - clock - } - }, - layout = wibox.layout.align.vertical, - } - }) -end) diff --git a/.config/awesome/components/statusbar/taglist.lua b/.config/awesome/components/statusbar/taglist.lua deleted file mode 100644 index 8eb8d17..0000000 --- a/.config/awesome/components/statusbar/taglist.lua +++ /dev/null @@ -1,86 +0,0 @@ -local awful = require "awful" -local xresources = require "beautiful.xresources" -local dpi = xresources.apply_dpi -local vars = require "themes.prismite.vars" -local wibox = require "wibox" -local naughty = require "naughty" - -return awful.widget.taglist({ - screen = screen[1], - filter = awful.widget.taglist.filter.all, - style = { - shape = vars.shape - }, - layout = { - spacing = 8, - layout = wibox.layout.fixed.vertical - }, - widget_template = { - { - { - { - id = "text_role", - widget = wibox.widget.textbox, - }, - widget = wibox.container.place, - }, - { - widget = wibox.container.background, - bg = vars.colors.bright.black, - shape = vars.shape, - forced_height = dpi(2), - forced_width = dpi(16), - id = "indicator_role" - }, - layout = wibox.layout.fixed.vertical - }, - widget = wibox.container.place, - create_callback = function(self, tag) - local indicator = self:get_children_by_id("indicator_role")[1] - local text = self:get_children_by_id("text_role")[1] - -- naughty.notification { - -- message = "b ".. tostring(text.font) - -- } - - -- text.font = "FiraCode Nerd Font Mono SemiBold 12" - - -- naughty.notification { - -- message = "a " .. tostring(text.font) - -- } - - 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 - - indicator.bg = vars.colors.bright.black - end) - - if tag.selected then - indicator.bg = vars.colors.yellow - 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 - else - indicator.bg = vars.colors.bright.black - end - end - }, - buttons = { - awful.button({ }, 1, function(t) t:view_only() end), - awful.button({ modkey }, 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/components/statusbar/wifi.lua b/.config/awesome/components/statusbar/wifi.lua deleted file mode 100644 index e6431ce..0000000 --- a/.config/awesome/components/statusbar/wifi.lua +++ /dev/null @@ -1,60 +0,0 @@ -local awful = require "awful" -local xresources = require "beautiful.xresources" -local dpi = xresources.apply_dpi -local vars = require "themes.prismite.vars" -local wibox = require "wibox" - -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 -} - -awful.tooltip { - objects = { wifi }, - timer_function = function() - return io.popen("iwgetid -r"):read("*a"):sub(0, -2) - end, - bg = vars.colors.bg, - fg = vars.colors.fg, - border_color = vars.colors.bright.black, - border_width = vars.border_width, - font = vars.font, - shape = vars.shape, - margin_leftright = dpi(6), - margin_topbottom = dpi(6) -} - -return wifi diff --git a/.config/awesome/components/window_switcher/init.lua b/.config/awesome/components/window_switcher/init.lua deleted file mode 100644 index 2e565f5..0000000 --- a/.config/awesome/components/window_switcher/init.lua +++ /dev/null @@ -1,172 +0,0 @@ -local awful = require "awful" -local vars = require "themes.prismite.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 = dpi(4) - }, - 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 = dpi(4) - }, - 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 -} |
