diff --git a/config/awesome/configuration/autostart b/config/awesome/configuration/autostart
index 71cb9eb..00ad5ca 100755
--- a/config/awesome/configuration/autostart
+++ b/config/awesome/configuration/autostart
@@ -20,4 +20,6 @@ start /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
# load X colors
start xrdb $HOME/.Xresources
-start xwallpaper --zoom ~/Pictures/city-topview.png
+# network manager
+start nm-applet
+start optimus-manager-qt
diff --git a/config/awesome/configuration/extras.lua b/config/awesome/configuration/extras.lua
index 86245ab..42942a2 100644
--- a/config/awesome/configuration/extras.lua
+++ b/config/awesome/configuration/extras.lua
@@ -9,57 +9,50 @@ local wibox = require("wibox")
-- Theme handling library
local beautiful = require("beautiful")
-
-- Check if awesome encountered an error during startup and fell back to
-- another config (This code will only ever execute for the fallback config)
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
- }
+ naughty.notification({
+ urgency = "critical",
+ title = "Oops, an error happened" .. (startup and " during startup!" or "!"),
+ message = message,
+ })
end)
client.connect_signal("request::manage", function(c)
- -- Add missing icon to client
- if not c.icon then
- local icon = gears.surface(beautiful.awesome_logo)
- c.icon = icon._native
- icon:finish()
- end
+ -- Add missing icon to client
+ if not c.icon then
+ local icon = gears.surface(beautiful.awesome_logo)
+ c.icon = icon._native
+ icon:finish()
+ end
- -- Set the windows at the slave,
- if awesome.startup and not c.size_hints.user_position and
- not c.size_hints.program_position then
- -- Prevent clients from being unreachable after screen count changes.
- awful.placement.no_offscreen(c)
- end
+ -- Set the windows at the slave,
+ if awesome.startup and not c.size_hints.user_position and not c.size_hints.program_position then
+ -- Prevent clients from being unreachable after screen count changes.
+ awful.placement.no_offscreen(c)
+ end
end)
-- Enable sloppy focus, so that focus follows mouse.
client.connect_signal("mouse::enter", function(c)
- c:emit_signal("request::activate", "mouse_enter", {raise = false})
+ c:emit_signal("request::activate", "mouse_enter", { raise = false })
end)
-client.connect_signal("focus",
- function(c) c.border_color = beautiful.border_focus end)
-
-client.connect_signal("unfocus",
- function(c) c.border_color = beautiful.border_normal end)
-
-
-- Hide all windows when a splash is shown
awesome.connect_signal("widgets::splash::visibility", function(vis)
- local t = screen.primary.selected_tag
- if vis then
- for idx, c in ipairs(t:clients()) do c.hidden = true end
- else
- for idx, c in ipairs(t:clients()) do c.hidden = false end
- end
+ local t = screen.primary.selected_tag
+ if vis then
+ for idx, c in ipairs(t:clients()) do
+ c.hidden = true
+ end
+ else
+ for idx, c in ipairs(t:clients()) do
+ c.hidden = false
+ end
+ end
end)
-
--Bling
----------
@@ -68,29 +61,24 @@ local bling = require("module.bling")
bling.module.flash_focus.enable()
-- Tag Preview
-bling.widget.tag_preview.enable {
- show_client_content = false,
- placement_fn = function(c)
- awful.placement.top_left(c, {
- margins = {
- top = 99,
- left = beautiful.wibar_width + 55
- }
- })
- end,
- scale = 0.15,
- honor_padding = true,
- honor_workarea = false,
- background_widget = wibox.widget {
- -- image = beautiful.wallpaper,
- -- horizontal_fit_policy = "fit",
- -- vertical_fit_policy = "fit",
- -- widget = wibox.widget.imagebox
- bg = beautiful.wibar_bg,
- widget = wibox.container.bg
- }
-}
-
-require('ui.widgets.window_switcher').enable()
-
-
+bling.widget.tag_preview.enable({
+ show_client_content = false,
+ placement_fn = function(c)
+ awful.placement.top(c, {
+ margins = {
+ top = dpi(80),
+ },
+ })
+ end,
+ scale = 0.20,
+ honor_padding = true,
+ honor_workarea = false,
+ background_widget = wibox.widget({
+ -- image = beautiful.wallpaper,
+ -- horizontal_fit_policy = "fit",
+ -- vertical_fit_policy = "fit",
+ -- widget = wibox.widget.imagebox
+ bg = beautiful.darker_bg,
+ widget = wibox.container.bg,
+ }),
+})
diff --git a/config/awesome/configuration/init.lua b/config/awesome/configuration/init.lua
index 7eac3a4..49915bf 100644
--- a/config/awesome/configuration/init.lua
+++ b/config/awesome/configuration/init.lua
@@ -17,13 +17,6 @@ local bling = require("module.bling")
local machi = require("module.layout-machi")
beautiful.layout_machi = machi.get_icon()
--- This is to slave windows' positions in floating layout
-require("module.savefloats")
-
--- Better mouse resizing on tiled
-require("module.better-resize")
-
-
-- Desktop
-------------
@@ -35,36 +28,45 @@ local equal = bling.layout.equalarea
local deck = bling.layout.deck
machi.editor.nested_layouts = {
- ["0"] = deck,
- ["1"] = awful.layout.suit.spiral,
- ["2"] = awful.layout.suit.fair,
- ["3"] = awful.layout.suit.fair.horizontal
+ ["0"] = deck,
+ ["1"] = awful.layout.suit.spiral,
+ ["2"] = awful.layout.suit.fair,
+ ["3"] = awful.layout.suit.fair.horizontal,
}
-- Set the layouts
tag.connect_signal("request::default_layouts", function()
- awful.layout.append_default_layouts({
- awful.layout.suit.tile, awful.layout.suit.floating, centered, mstab,
- horizontal, machi.default_layout, equal, deck
- })
+ awful.layout.append_default_layouts({
+ awful.layout.suit.tile,
+ awful.layout.suit.floating,
+ centered,
+ mstab,
+ horizontal,
+ machi.default_layout,
+ equal,
+ deck,
+ })
end)
-- Screen Padding and Tags
screen.connect_signal("request::desktop_decoration", function(s)
- -- Screen padding
- screen[s].padding = {left = dpi(40), right = dpi(15), top = dpi(15), bottom = dpi(15)}
- -- Each screen has its own tag table.
- awful.tag({"1", "2", "3", "4", "5"}, s, awful.layout.layouts[1])
+ -- Screen padding
+ screen[s].padding = { left = dpi(10), right = dpi(10), top = dpi(20), bottom = dpi(10) }
+ -- -- Each screen has its own tag table.
+ awful.tag({ "1", "2", "3", "4", "5" }, s, awful.layout.layouts[1])
end)
-- Wallpapers
--- set wallpapers
awful.screen.connect_for_each_screen(function(s)
- -- gears.wallpaper.maximized(beautiful.wallpaper, s, false, nil)
- gears.wallpaper.set(beautiful.xcolor8)
+ gears.wallpaper.maximized(
+ gears.surface.load_uncached(gfs.get_configuration_dir() .. "theme/assets/wallpaper.jpg"),
+ s,
+ false,
+ nil
+ )
end)
--- Set Tile Wallpaper
+-- Set tile wallpaper
-- bling.module.tiled_wallpaper("", s, {
-- fg = beautiful.lighter_bg,
-- bg = beautiful.xbackground,
@@ -76,10 +78,7 @@ end)
-- zickzack = true
-- })
-
--- Stuff
------------
-
+-- Import configuration stuff
require("configuration.keys")
require("configuration.ruled")
require("configuration.extras")
diff --git a/config/awesome/configuration/keys.lua b/config/awesome/configuration/keys.lua
index 2b9413c..16b15c6 100644
--- a/config/awesome/configuration/keys.lua
+++ b/config/awesome/configuration/keys.lua
@@ -2,14 +2,7 @@
local gears = require("gears")
local awful = require("awful")
local hotkeys_popup = require("awful.hotkeys_popup")
-
--- Theme handling library
-local beautiful = require("beautiful")
-
--- Theme library
-local beautiful = require("beautiful")
-local xresources = require("beautiful.xresources")
-local dpi = xresources.apply_dpi
+local gfs = require("gears.filesystem")
-- Notifications library
local naughty = require("naughty")
@@ -24,18 +17,6 @@ local machi = require("module.layout-machi")
-- Helpers
local helpers = require("helpers")
--- GALLANT FUNCTION
-local function run_once(cmd)
- local findme = cmd
- local firstspace = cmd:find(' ')
- if firstspace then findme = cmd:sub(0, firstspace - 1) end
- awful.spawn.with_shell(string.format(
- 'pgrep -u $USER -x %s > /dev/null || (%s)',
- findme, cmd), false)
-end
-
-
-
-- Default modkey.
modkey = "Mod4"
alt = "Mod1"
@@ -44,387 +25,340 @@ shift = "Shift"
-- Launcher
awful.keyboard.append_global_keybindings({
- awful.key({modkey}, "Return", function()
- awful.spawn(terminal)
- end,
- {description = "open terminal", group = "launcher"}),
- awful.key({modkey}, "d", function()
- awful.spawn(launcher)
- end,
- {description = "open applications menu", group = "launcher"}),
- awful.key({modkey, shift}, "d", function()
- dashboard_toggle()
- end,
- {description = "toggle dashboard", group = "launcher"}),
- awful.key({modkey}, "f", function()
- awful.spawn(file_manager)
- end,
- {description = "open file manager", group = "launcher"}),
- awful.key({modkey}, "w", function()
- awful.spawn.with_shell(browser)
- end,
- {description = "open web browser", group = "launcher"}),
- awful.key({modkey}, "x", function()
- awful.spawn.with_shell("xcolor-pick")
- end,
- {description = "open color-picker", group = "launcher"})
+ awful.key({ modkey }, "Return", function()
+ awful.spawn(terminal)
+ end, { description = "open terminal", group = "launcher" }),
+ awful.key({ modkey, shift }, "f", function()
+ awful.spawn(file_manager)
+ end, { description = "open file manager", group = "launcher" }),
+ awful.key({ modkey, shift }, "w", function()
+ awful.spawn.with_shell(browser)
+ end, { description = "open web browser", group = "launcher" }),
+ awful.key({ modkey, shift }, "x", function()
+ awful.spawn.with_shell("xcolor-pick")
+ end, { description = "open color picker", group = "launcher" }),
+ awful.key({ modkey, shift }, "d", function()
+ central_panel:toggle()
+ end, { description = "toggle dashboard", group = "launcher" }),
+ awful.key({ modkey, shift }, "t", function()
+ systray_toggle()
+ end, { description = "toggle systray", group = "launcher" }),
})
-- Client and Tabs Bindings
awful.keyboard.append_global_keybindings({
- awful.key({alt}, "a", function()
- bling.module.tabbed.pick_with_dmenu()
- end,
- {description = "pick client to add to tab group", group = "tabs"}),
- awful.key({alt}, "s", function()
- bling.module.tabbed.iter()
- end,
- {description = "iterate through tabbing group", group = "tabs"}),
- awful.key({alt}, "d", function()
- bling.module.tabbed.pop()
- end,
- {description = "remove focused client from tabbing group",group = "tabs"}),
- awful.key({modkey}, "Down", function()
- awful.client.focus.bydirection("down")
- bling.module.flash_focus.flashfocus(client.focus)
- end,
- {description = "focus down", group = "client"}),
- awful.key({modkey}, "Up", function()
- awful.client.focus.bydirection("up")
- bling.module.flash_focus.flashfocus(client.focus)
- end,
- {description = "focus up", group = "client"}),
- awful.key({modkey}, "Left", function()
- awful.client.focus.bydirection("left")
- bling.module.flash_focus.flashfocus(client.focus)
- end,
- {description = "focus left", group = "client"}),
- awful.key({modkey}, "Right", function()
- awful.client.focus.bydirection("right")
- bling.module.flash_focus.flashfocus(client.focus)
- end,
- {description = "focus right", group = "client"}),
- awful.key({modkey}, "j", function()
- awful.client.focus.byidx(1)
- end,
- {description = "focus next by index", group = "client"}),
- awful.key({modkey}, "k", function()
- awful.client.focus.byidx(-1)
- end,
- {description = "focus previous by index", group = "client"}),
- awful.key({modkey, "Shift"}, "j", function()
- awful.client.swap.byidx(1)
- end,
- {description = "swap with next client by index", group = "client"}),
- awful.key({modkey, "Shift"}, "k", function()
- awful.client.swap.byidx(-1)
- end,
- {description = "swap with previous client by index", group = "client"}),
- awful.key({modkey}, "u",
- awful.client.urgent.jumpto,
- {description = "jump to urgent client", group = "client"}),
- awful.key({alt}, "Tab", function()
- awesome.emit_signal("bling::window_switcher::turn_on")
- end,
- {description = "window switcher", group = "client"})
+ awful.key({ alt }, "a", function()
+ bling.module.tabbed.pick_with_dmenu()
+ end, { description = "pick client to add to tab group", group = "tabs" }),
+ awful.key({ alt }, "s", function()
+ bling.module.tabbed.iter()
+ end, { description = "iterate through tabbing group", group = "tabs" }),
+ awful.key({ alt }, "d", function()
+ bling.module.tabbed.pop()
+ end, { description = "remove focused client from tabbing group", group = "tabs" }),
+ awful.key({ modkey }, "Down", function()
+ awful.client.focus.bydirection("down")
+ bling.module.flash_focus.flashfocus(client.focus)
+ end, { description = "focus down", group = "client" }),
+ awful.key({ modkey }, "Up", function()
+ awful.client.focus.bydirection("up")
+ bling.module.flash_focus.flashfocus(client.focus)
+ end, { description = "focus up", group = "client" }),
+ awful.key({ modkey }, "Left", function()
+ awful.client.focus.bydirection("left")
+ bling.module.flash_focus.flashfocus(client.focus)
+ end, { description = "focus left", group = "client" }),
+ awful.key({ modkey }, "Right", function()
+ awful.client.focus.bydirection("right")
+ bling.module.flash_focus.flashfocus(client.focus)
+ end, { description = "focus right", group = "client" }),
+ awful.key({ modkey }, "j", function()
+ awful.client.focus.byidx(1)
+ end, { description = "focus next by index", group = "client" }),
+ awful.key({ modkey }, "k", function()
+ awful.client.focus.byidx(-1)
+ end, { description = "focus previous by index", group = "client" }),
+ awful.key({ modkey, shift }, "j", function()
+ awful.client.swap.byidx(1)
+ end, { description = "swap with next client by index", group = "client" }),
+ awful.key({ modkey, shift }, "k", function()
+ awful.client.swap.byidx(-1)
+ end, { description = "swap with previous client by index", group = "client" }),
+ awful.key({ modkey }, "u", awful.client.urgent.jumpto, { description = "jump to urgent client", group = "client" }),
+ awful.key({ alt }, "Tab", function()
+ awesome.emit_signal("bling::window_switcher::turn_on")
+ end, { description = "window switcher", group = "client" }),
})
-- Hotkeys
awful.keyboard.append_global_keybindings({
- -- Brightness Control
- awful.key({}, "XF86MonBrightnessUp", function()
- awful.spawn("brightnessctl set 5%+ -q")
- end,
- {description = "increase brightness", group = "hotkeys"}),
- awful.key({}, "XF86MonBrightnessDown", function()
- awful.spawn("brightnessctl set 5%- -q")
- end,
- {description = "decrease brightness", group = "hotkeys"}),
+ -- Brightness Control
+ awful.key({}, "XF86MonBrightnessUp", function()
+ awful.spawn("brightnessctl set 5%+ -q")
+ end, { description = "increase brightness", group = "hotkeys" }),
+ awful.key({}, "XF86MonBrightnessDown", function()
+ awful.spawn("brightnessctl set 5%- -q")
+ end, { description = "decrease brightness", group = "hotkeys" }),
- -- Volume control
- awful.key({}, "XF86AudioRaiseVolume", function()
- helpers.volume_control(5)
- end,
- {description = "increase volume", group = "hotkeys"}),
- awful.key({}, "XF86AudioLowerVolume", function()
- helpers.volume_control(-5)
- end,
- {description = "decrease volume", group = "hotkeys"}),
- awful.key({}, "XF86AudioMute", function()
- helpers.volume_control(0)
- end,
- {description = "mute volume", group = "hotkeys"}),
+ -- Volume control
+ awful.key({}, "XF86AudioRaiseVolume", function()
+ helpers.volume_control(5)
+ end, { description = "increase volume", group = "hotkeys" }),
+ awful.key({}, "XF86AudioLowerVolume", function()
+ helpers.volume_control(-5)
+ end, { description = "decrease volume", group = "hotkeys" }),
+ awful.key({}, "XF86AudioMute", function()
+ helpers.volume_control(0)
+ end, { description = "mute volume", group = "hotkeys" }),
- -- Music
- awful.key({}, "XF86AudioPlay", function()
- run_once("mpc toggle")
- end,
- {description = "toggle music", group = "hotkeys"}),
+ -- Music
+ awful.key({}, "XF86AudioPlay", function()
+ playerctl:play_pause()
+ end, { description = "toggle music", group = "hotkeys" }),
- awful.key({}, "XF86AudioPause", function()
- run_once("mpc toggle")
- end,
- {description = "fuck you awesomeWM", group = "hotkeys"}),
+ awful.key({}, "XF86AudioPrev", function()
+ playerctl:previous()
+ end, { description = "previous music", group = "hotkeys" }),
- awful.key({}, "XF86AudioPrev", function()
- playerctl:previous()
- end,
- {description = "previous music", group = "hotkeys"}),
+ awful.key({}, "XF86AudioNext", function()
+ playerctl:next()
+ end, { description = "next music", group = "hotkeys" }),
- awful.key({}, "XF86AudioNext", function()
- run_once("mpc next")
- end,
- {description = "next music", group = "hotkeys"}),
+ -- Screenshots
+ awful.key({}, "Print", function()
+ awful.spawn.with_shell("screensht full")
+ end, { description = "take a full screenshot", group = "hotkeys" }),
- -- Screenshots
- awful.key({}, "Print", function()
- awful.spawn.with_shell("screensht full")
- end,
- {description = "take a full screenshot", group = "hotkeys"}),
+ awful.key({ alt }, "Print", function()
+ awful.spawn.with_shell("screensht area")
+ end, { description = "take a area screenshot", group = "hotkeys" }),
- awful.key({alt, shift}, "s", function()
- awful.spawn.with_shell("wackysnap area")
- end,
- {description = "take a area screenshot", group = "hotkeys"}),
-
- -- Lockscreen
- awful.key({modkey, ctrl}, "l", function()
- lock_screen_show()
- end,
- {description = "lock screen", group = "hotkeys"})
+ -- Lockscreen
+ awful.key({ modkey, ctrl }, "l", function()
+ lock_screen_show()
+ end, { description = "lock screen", group = "hotkeys" }),
})
-- Awesome stuff
awful.keyboard.append_global_keybindings({
- awful.key({modkey}, "F1",
- hotkeys_popup.show_help,
- {description = "show help", group = "awesome"}),
- awful.key({modkey, ctrl}, "r",
- awesome.restart,
- {description = "reload awesome", group = "awesome"}),
- awful.key({modkey, ctrl}, "q",
- awesome.quit,
- {description = "quit awesome", group = "awesome"})
+ awful.key({ modkey }, "F1", hotkeys_popup.show_help, { description = "show help", group = "awesome" }),
+ awful.key({ modkey, ctrl }, "r", awesome.restart, { description = "reload awesome", group = "awesome" }),
+ awful.key({ modkey, ctrl }, "q", awesome.quit, { description = "quit awesome", group = "awesome" }),
})
-- Layout Machi
awful.keyboard.append_global_keybindings({
- awful.key({modkey}, ".", function()
- machi.default_editor.start_interactive()
- end,
- {description = "edit the current layout if it is a machi layout", group = "layout"}),
- awful.key({modkey}, "/", function()
- machi.switcher.start(client.focus)
- end,
- {description = "switch between windows for a machi layout", group = "layout"})
+ awful.key({ modkey }, ".", function()
+ machi.default_editor.start_interactive()
+ end, { description = "edit the current layout if it is a machi layout", group = "layout" }),
+ awful.key({ modkey }, "/", function()
+ machi.switcher.start(client.focus)
+ end, { description = "switch between windows for a machi layout", group = "layout" }),
})
-
awful.keyboard.append_global_keybindings({
- -- Screen
- awful.key({modkey, "Control"}, "j", function()
- awful.screen.focus_relative(1)
- end,
- {description = "focus the next screen", group = "screen"}),
- awful.key({modkey, "Control"}, "k", function()
- awful.screen.focus_relative(-1)
- end,
- {description = "focus the previous screen", group = "screen"}),
+ -- Screen
+ awful.key({ modkey, "Control" }, "j", function()
+ awful.screen.focus_relative(1)
+ end, { description = "focus the next screen", group = "screen" }),
+ awful.key({ modkey, "Control" }, "k", function()
+ awful.screen.focus_relative(-1)
+ end, { description = "focus the previous screen", group = "screen" }),
- -- Layout
- awful.key({modkey}, "l", function()
- awful.tag.incmwfact(0.05)
- end,
- {description = "increase master width factor", group = "layout"}),
- awful.key({modkey}, "h", function()
- awful.tag.incmwfact(-0.05)
- end,
- {description = "decrease master width factor", group = "layout"}),
- awful.key({modkey, "Shift"}, "h", function()
- awful.tag.incnmaster(1, nil, true)
- end,
- {description = "increase the number of master clients", group = "layout"}),
- awful.key({modkey, "Shift"}, "l", function()
- awful.tag.incnmaster(-1, nil, true)
- end,
- {description = "decrease the number of master clients", group = "layout"}),
- awful.key({modkey, "Control"}, "h", function()
- awful.tag.incncol(1, nil, true)
- end,
- {description = "increase the number of columns", group = "layout"}),
- awful.key({modkey, "Control"}, "l", function()
- awful.tag.incncol(-1, nil, true)
- end,
- {description = "decrease the number of columns", group = "layout"}),
- awful.key({modkey}, "space", function()
- awful.layout.inc(1)
- end,
- {description = "select next layout", group = "layout"}),
- awful.key({modkey, "Shift"}, "space", function()
- awful.layout.inc(-1)
- end,
- {description = "select previous layout", group = "layout"}),
+ -- Layout
+ awful.key({ modkey }, "l", function()
+ awful.tag.incmwfact(0.05)
+ end, { description = "increase master width factor", group = "layout" }),
+ awful.key({ modkey }, "h", function()
+ awful.tag.incmwfact(-0.05)
+ end, { description = "decrease master width factor", group = "layout" }),
+ awful.key({ modkey, shift }, "h", function()
+ awful.tag.incnmaster(1, nil, true)
+ end, { description = "increase the number of master clients", group = "layout" }),
+ awful.key({ modkey, shift }, "l", function()
+ awful.tag.incnmaster(-1, nil, true)
+ end, { description = "decrease the number of master clients", group = "layout" }),
+ awful.key({ modkey, "Control" }, "h", function()
+ awful.tag.incncol(1, nil, true)
+ end, { description = "increase the number of columns", group = "layout" }),
+ awful.key({ modkey, "Control" }, "l", function()
+ awful.tag.incncol(-1, nil, true)
+ end, { description = "decrease the number of columns", group = "layout" }),
+ awful.key({ modkey }, "space", function()
+ awful.layout.inc(1)
+ end, { description = "select next layout", group = "layout" }),
+ awful.key({ modkey, shift }, "space", function()
+ awful.layout.inc(-1)
+ end, { description = "select previous layout", group = "layout" }),
- -- Tag
- awful.key({ modkey, alt}, "Left",
- awful.tag.viewprev,
- {description = "view previous", group = "tag"}),
- awful.key({ modkey, alt}, "Right",
- awful.tag.viewnext,
- {description = "view next", group = "tag"}),
- awful.key({ modkey}, "Escape",
- awful.tag.history.restore,
- {description = "go back", group = "tag"}),
+ -- Tag
+ awful.key({ modkey, alt }, "Left", awful.tag.viewprev, { description = "view previous", group = "tag" }),
+ awful.key({ modkey, alt }, "Right", awful.tag.viewnext, { description = "view next", group = "tag" }),
+ awful.key({ modkey }, "Escape", awful.tag.history.restore, { description = "go back", group = "tag" }),
- -- Set Layout
- awful.key({modkey, "Control"}, "w", function()
- awful.layout.set(awful.layout.suit.max)
- end,
- {description = "set max layout", group = "tag"}),
- awful.key({modkey}, "s", function()
- awful.layout.set(awful.layout.suit.tile)
- end,
- {description = "set tile layout", group = "tag"}),
- awful.key({modkey, shift}, "s", function()
- awful.layout.set(awful.layout.suit.floating)
- end,
- {description = "set floating layout", group = "tag"}),
+ -- Set Layout
+ awful.key({ modkey, "Control" }, "w", function()
+ awful.layout.set(awful.layout.suit.max)
+ end, { description = "set max layout", group = "tag" }),
+ awful.key({ modkey }, "s", function()
+ awful.layout.set(awful.layout.suit.tile)
+ end, { description = "set tile layout", group = "tag" }),
+ awful.key({ modkey, shift }, "s", function()
+ awful.layout.set(awful.layout.suit.floating)
+ end, { description = "set floating layout", group = "tag" }),
- --Client
- awful.key({modkey, "Control"}, "n", function()
- local c = awful.client.restore()
- -- Focus restored client
- if c then
- c:emit_signal("request::activate", "key.unminimize", {raise = true})
- end
- end,
- {description = "restore minimized", group = "client"})
+ --Client
+ awful.key({ modkey, "Control" }, "n", function()
+ local c = awful.client.restore()
+ -- Focus restored client
+ if c then
+ c:emit_signal("request::activate", "key.unminimize", { raise = true })
+ end
+ end, { description = "restore minimized", group = "client" }),
})
-- Client management keybinds
client.connect_signal("request::default_keybindings", function()
- awful.keyboard.append_client_keybindings({
- awful.key({modkey, "Shift"}, "f", function(c)
- c.fullscreen = not c.fullscreen
- c:raise()
- end,
- {description = "toggle fullscreen", group = "client"}),
- awful.key({modkey}, "q", function(c)
- c:kill()
- end,
- {description = "close", group = "client"}),
- awful.key({modkey, "Control"}, "space",
- awful.client.floating.toggle,
- {description = "toggle floating", group = "client"}),
- awful.key({modkey, "Control"}, "Return", function(c)
- c:swap(awful.client.getmaster())
- end,
- {description = "move to master", group = "client"}),
- awful.key({modkey}, "o", function(c)
- c:move_to_screen() end,
- {description = "move to screen", group = "client"}),
- awful.key({modkey, shift}, "b", function(c)
- c.floating = not c.floating
- c.width = 400
- c.height = 200
- awful.placement.bottom_right(c)
- c.sticky = not c.sticky
- end,
- {description = "toggle keep on top", group = "client"}),
+ awful.keyboard.append_client_keybindings({
+ awful.key({ modkey }, "f", function(c)
+ c.fullscreen = not c.fullscreen
+ c:raise()
+ end, { description = "toggle fullscreen", group = "client" }),
+ awful.key({ modkey }, "q", function(c)
+ c:kill()
+ end, { description = "close", group = "client" }),
+ -- Kill all visible clients for the current tag
+ awful.key({ modkey, shift }, "q", function()
+ local clients = awful.screen.focused().clients
+ for _, c in pairs(clients) do
+ c:kill()
+ end
+ end, { description = "kill all visible clients for the current tag", group = "client" }),
+ awful.key(
+ { modkey, "Control" },
+ "space",
+ awful.client.floating.toggle,
+ { description = "toggle floating", group = "client" }
+ ),
+ awful.key({ modkey, "Control" }, "Return", function(c)
+ c:swap(awful.client.getmaster())
+ end, { description = "move to master", group = "client" }),
+ awful.key({ modkey }, "o", function(c)
+ c:move_to_screen()
+ end, { description = "move to screen", group = "client" }),
+ awful.key({ modkey, shift }, "b", function(c)
+ c.floating = not c.floating
+ c.width = 400
+ c.height = 200
+ awful.placement.bottom_right(c)
+ c.sticky = not c.sticky
+ end, { description = "toggle keep on top", group = "client" }),
- awful.key({modkey}, "n", function(c)
- -- The client currently has the input focus, so it cannot be
- -- minimized, since minimized clients can't have the focus.
- c.minimized = true
- end, {description = "minimize", group = "client"}),
- awful.key({modkey}, "m", function(c)
- c.maximized = not c.maximized
- c:raise()
- end, {description = "(un)maximize", group = "client"}),
- awful.key({modkey, "Control"}, "m", function(c)
- c.maximized_vertical = not c.maximized_vertical
- c:raise()
- end, {description = "(un)maximize vertically", group = "client"}),
- awful.key({modkey, "Shift"}, "m", function(c)
- c.maximized_horizontal = not c.maximized_horizontal
- c:raise()
- end, {description = "(un)maximize horizontally", group = "client"}),
+ awful.key({ modkey }, "n", function(c)
+ -- The client currently has the input focus, so it cannot be
+ -- minimized, since minimized clients can't have the focus.
+ c.minimized = true
+ end, { description = "minimize", group = "client" }),
+ awful.key({ modkey }, "m", function(c)
+ c.maximized = not c.maximized
+ c:raise()
+ end, { description = "(un)maximize", group = "client" }),
+ awful.key({ modkey, "Control" }, "m", function(c)
+ c.maximized_vertical = not c.maximized_vertical
+ c:raise()
+ end, { description = "(un)maximize vertically", group = "client" }),
+ awful.key({ modkey, shift }, "m", function(c)
+ c.maximized_horizontal = not c.maximized_horizontal
+ c:raise()
+ end, { description = "(un)maximize horizontally", group = "client" }),
- -- On the fly padding change
- awful.key({modkey, shift}, "=",
- function() helpers.resize_padding(5) end,
- {description = "add padding", group = "screen"}),
- awful.key({modkey, shift}, "-",
- function() helpers.resize_padding(-5) end,
- {description = "subtract padding", group = "screen"}),
+ -- On the fly padding change
+ awful.key({ modkey, shift }, "=", function()
+ helpers.resize_padding(5)
+ end, { description = "add padding", group = "screen" }),
+ awful.key({ modkey, shift }, "-", function()
+ helpers.resize_padding(-5)
+ end, { description = "subtract padding", group = "screen" }),
- -- On the fly useless gaps change
- awful.key({modkey}, "=", function() helpers.resize_gaps(5) end,
- {description = "add gaps", group = "screen"}),
+ -- On the fly useless gaps change
+ awful.key({ modkey }, "=", function()
+ helpers.resize_gaps(5)
+ end, { description = "add gaps", group = "screen" }),
- awful.key({modkey}, "-", function() helpers.resize_gaps(-5) end,
- {description = "subtract gaps", group = "screen"}),
- -- Single tap: Center client
- -- Double tap: Center client + Floating + Resize
- awful.key({modkey}, "c", function(c)
- awful.placement.centered(c, {
- honor_workarea = true,
- honor_padding = true
- })
- helpers.single_double_tap(nil, function()
- helpers.float_and_resize(c, screen_width * 0.25,
- screen_height * 0.28)
- end)
- end)
- })
+ awful.key({ modkey }, "-", function()
+ helpers.resize_gaps(-5)
+ end, { description = "subtract gaps", group = "screen" }),
+ -- Single tap: Center client
+ -- Double tap: Center client + Floating + Resize
+ awful.key({ modkey }, "c", function(c)
+ awful.placement.centered(c, {
+ honor_workarea = true,
+ honor_padding = true,
+ })
+ helpers.single_double_tap(nil, function()
+ helpers.float_and_resize(c, screen_width * 0.25, screen_height * 0.28)
+ end)
+ end),
+ })
end)
-- Num row keybinds
awful.keyboard.append_global_keybindings({
- awful.key {
- modifiers = {modkey},
- keygroup = "numrow",
- description = "only view tag",
- group = "tag",
- on_press = function(index)
- local screen = awful.screen.focused()
- local tag = screen.tags[index]
- if tag then tag:view_only() end
- end
- }, awful.key {
- modifiers = {modkey, "Control"},
- keygroup = "numrow",
- description = "toggle tag",
- group = "tag",
- on_press = function(index)
- local screen = awful.screen.focused()
- local tag = screen.tags[index]
- if tag then awful.tag.viewtoggle(tag) end
- end
- }, awful.key {
- modifiers = {modkey, "Shift"},
- keygroup = "numrow",
- description = "move focused client to tag",
- group = "tag",
- on_press = function(index)
- if client.focus then
- local tag = client.focus.screen.tags[index]
- if tag then client.focus:move_to_tag(tag) end
- end
- end
- }, awful.key {
- modifiers = {modkey, "Control", "Shift"},
- keygroup = "numrow",
- description = "toggle focused client on tag",
- group = "tag",
- on_press = function(index)
- if client.focus then
- local tag = client.focus.screen.tags[index]
- if tag then client.focus:toggle_tag(tag) end
- end
- end
- }
+ awful.key({
+ modifiers = { modkey },
+ keygroup = "numrow",
+ description = "only view tag",
+ group = "tag",
+ on_press = function(index)
+ local screen = awful.screen.focused()
+ local tag = screen.tags[index]
+ if tag then
+ tag:view_only()
+ end
+ end,
+ }),
+ awful.key({
+ modifiers = { modkey, "Control" },
+ keygroup = "numrow",
+ description = "toggle tag",
+ group = "tag",
+ on_press = function(index)
+ local screen = awful.screen.focused()
+ local tag = screen.tags[index]
+ if tag then
+ awful.tag.viewtoggle(tag)
+ end
+ end,
+ }),
+ awful.key({
+ modifiers = { modkey, shift },
+ keygroup = "numrow",
+ description = "move focused client to tag",
+ group = "tag",
+ on_press = function(index)
+ if client.focus then
+ local tag = client.focus.screen.tags[index]
+ if tag then
+ client.focus:move_to_tag(tag)
+ end
+ end
+ end,
+ }),
+ awful.key({
+ modifiers = { modkey, "Control", shift },
+ keygroup = "numrow",
+ description = "toggle focused client on tag",
+ group = "tag",
+ on_press = function(index)
+ if client.focus then
+ local tag = client.focus.screen.tags[index]
+ if tag then
+ client.focus:toggle_tag(tag)
+ end
+ end
+ end,
+ }),
})
-- Mouse bindings on desktop
@@ -432,44 +366,42 @@ awful.keyboard.append_global_keybindings({
awful.mouse.append_global_mousebindings({
- -- Left click
- awful.button({}, 1, function()
- naughty.destroy_all_notifications()
- if mymainmenu then
- mymainmenu:hide()
- end
- end),
+ -- Left click
+ awful.button({}, 1, function()
+ naughty.destroy_all_notifications()
+ if mymainmenu then
+ mymainmenu:hide()
+ end
+ end),
- -- Middle click
- awful.button({}, 2, function()
- dashboard_toggle()
- end),
+ -- Middle click
+ awful.button({}, 2, function()
+ central_panel:toggle()
+ end),
- -- Right click
- awful.button({}, 3, function()
- mymainmenu:toggle()
- end),
-
- -- Side key
- awful.button({}, 4, awful.tag.viewprev),
- awful.button({}, 5, awful.tag.viewnext)
+ -- Right click
+ awful.button({}, 3, function()
+ mymainmenu:toggle()
+ end),
+ -- Side key
+ awful.button({}, 4, awful.tag.viewprev),
+ awful.button({}, 5, awful.tag.viewnext),
})
-- Mouse buttons on the client
--------------------------------
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)
- })
+ 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/configuration/menu.lua b/config/awesome/configuration/menu.lua
index 06015f6..c3aa50b 100644
--- a/config/awesome/configuration/menu.lua
+++ b/config/awesome/configuration/menu.lua
@@ -8,41 +8,89 @@ local helpers = require("helpers")
-- Create a launcher widget and a main menu
awful.screen.connect_for_each_screen(function(s)
+ -- Submenu
+ awesomemenu = {
+ {
+ "Hotkeys",
+ function()
+ hotkeys_popup.show_help(nil, awful.screen.focused())
+ end,
+ },
+ { "Manual", terminal .. " -e man awesome" },
+ { "Edit Config", editor .. " " .. awesome.conffile },
+ { "Restart", awesome.restart },
+ {
+ "Quit",
+ function()
+ awesome.quit()
+ end,
+ },
+ }
- -- Submenu
- awesomemenu = {
- {"Hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end},
- {"Manual", terminal .. " start man awesome"},
- {"Edit Config", editor .. " " .. awesome.conffile},
- {"Restart", awesome.restart},
- {"Quit", function() awesome.quit() end}
- }
-
- -- Powermenu
- powermenu = {
- {"Power OFF", function() awful.spawn.with_shell("systemctl poweroff") end},
- {"Reboot", function() awful.spawn.with_shell("systemctl reboot") end},
- {"Suspend", function()
- lock_screen_show()
- awful.spawn.with_shell("systemctl suspend")
- end},
- {"Lock Screen", function() lock_screen_show() end}
- }
-
- -- Mainmenu
- mymainmenu = awful.menu({
- items = {
- {"Terminal", function() awful.spawn.with_shell(terminal) end},
- {"Code Editor", function() awful.spawn.with_shell(vscode) end},
- {"File Manager", function() awful.spawn.with_shell(file_manager) end},
- {"Web Browser", function() awful.spawn.with_shell(browser) end},
- {"Music", function() awful.spawn.with_shell(music_client) end},
- {"AwesomeWM", awesomemenu, beautiful.awesome_logo},
- {"Power Menu", powermenu}
- }
- })
-
- mymainmenu.wibox.shape = helpers.rrect(beautiful.border_radius)
+ -- Powermenu
+ powermenu = {
+ {
+ "Power OFF",
+ function()
+ awful.spawn.with_shell("systemctl poweroff")
+ end,
+ },
+ {
+ "Reboot",
+ function()
+ awful.spawn.with_shell("systemctl reboot")
+ end,
+ },
+ {
+ "Suspend",
+ function()
+ lock_screen_show()
+ awful.spawn.with_shell("systemctl suspend")
+ end,
+ },
+ {
+ "Lock Screen",
+ function()
+ lock_screen_show()
+ end,
+ },
+ }
+ -- Mainmenu
+ mymainmenu = awful.menu({
+ items = {
+ {
+ "Terminal",
+ function()
+ awful.spawn.with_shell(terminal)
+ end,
+ },
+ {
+ "Code Editor",
+ function()
+ awful.spawn.with_shell(vscode)
+ end,
+ },
+ {
+ "File Manager",
+ function()
+ awful.spawn.with_shell(file_manager)
+ end,
+ },
+ {
+ "Web Browser",
+ function()
+ awful.spawn.with_shell(browser)
+ end,
+ },
+ {
+ "Music",
+ function()
+ awful.spawn.with_shell(music_client)
+ end,
+ },
+ { "AwesomeWM", awesomemenu, beautiful.awesome_logo },
+ { "Power Menu", powermenu },
+ },
+ })
end)
-
diff --git a/config/awesome/configuration/ruled.lua b/config/awesome/configuration/ruled.lua
index 160eca8..359674a 100644
--- a/config/awesome/configuration/ruled.lua
+++ b/config/awesome/configuration/ruled.lua
@@ -19,156 +19,139 @@ local screen_width = awful.screen.focused().geometry.width
local screen_height = awful.screen.focused().geometry.height
ruled.client.connect_signal("request::rules", function()
+ -- Global
+ ruled.client.append_rule({
+ id = "global",
+ rule = {},
+ properties = {
+ focus = awful.client.focus.filter,
+ raise = true,
+ size_hints_honor = false,
+ screen = awful.screen.preferred,
+ titlebars_enabled = beautiful.titlebar_enabled,
+ placement = awful.placement.no_overlap + awful.placement.no_offscreen,
+ },
+ })
- -- Global
- ruled.client.append_rule {
- id = "global",
- rule = {},
- properties = {
- focus = awful.client.focus.filter,
- raise = true,
- size_hints_honor = false,
- screen = awful.screen.preferred,
- titlebars_enabled = beautiful.titlebar_enabled,
- placement = awful.placement.no_overlap+awful.placement.no_offscreen
- }
- }
+ -- Tasklist order
+ ruled.client.append_rule({
+ id = "tasklist_order",
+ rule = {},
+ properties = {},
+ callback = awful.client.setslave,
+ })
- -- Tasklist order
- ruled.client.append_rule {
- id = "tasklist_order",
- rule = {},
- properties = {},
- callback = awful.client.setslave
- }
+ -- Titlebar rules
+ ruled.client.append_rule({
+ id = "titlebars",
+ rule_any = {
+ class = {
+ "discord",
+ "Spotify",
+ "Org.gnome.Nautilus",
+ },
+ type = {
+ "splash",
+ },
+ name = {
+ "^discord.com is sharing your screen.$", -- Discord (running in browser) screen sharing popup
+ },
+ },
+ properties = {
+ titlebars_enabled = false,
+ },
+ })
- -- Titlebar rules
- ruled.client.append_rule {
- id = "titlebars",
- rule_any = {
- class = {
- "discord",
- "Spotify",
- "firefox",
- "Org.gnome.Nautilus"
- },
- type = {
- "splash"
- },
- name = {
- "^discord.com is sharing your screen.$" -- Discord (running in browser) screen sharing popup
- }
- },
- properties = {
- titlebars_enabled = false
- }
- }
+ -- Float
+ ruled.client.append_rule({
+ id = "floating",
+ rule_any = {
+ instance = {
+ "Devtools", -- Firefox devtools
+ },
+ class = {
+ "Lxappearance",
+ "Nm-connection-editor",
+ },
+ name = {
+ "Event Tester", -- xev
+ },
+ role = {
+ "AlarmWindow",
+ "pop-up",
+ "GtkFileChooserDialog",
+ "conversation",
+ },
+ type = {
+ "dialog",
+ },
+ },
+ properties = { floating = true, placement = helpers.centered_client_placement },
+ })
- -- Float
- ruled.client.append_rule {
- id = "floating",
- rule_any = {
- instance = {
- "Devtools", -- Firefox devtools
- },
- class = {
- "Lxappearance",
- "Nm-connection-editor",
- },
- name = {
- "Event Tester", -- xev
- },
- role = {
- "AlarmWindow",
- "pop-up",
- "GtkFileChooserDialog",
- "conversation",
- },
- type = {
- "dialog",
- }
- },
- properties = { floating = true, placement = helpers.centered_client_placement }
- }
+ -- Centered
+ ruled.client.append_rule({
+ id = "centered",
+ rule_any = {
+ type = {
+ "dialog",
+ },
+ class = {
+ -- "discord",
+ },
+ role = {
+ "GtkFileChooserDialog",
+ "conversation",
+ },
+ },
+ properties = { placement = helpers.centered_client_placement },
+ })
- -- Centered
- ruled.client.append_rule {
- id = "centered",
- rule_any = {
- type = {
- "dialog",
- },
- class = {
- -- "discord",
- },
- role = {
- "GtkFileChooserDialog",
- "conversation",
- }
- },
- properties = { placement = helpers.centered_client_placement },
- }
+ -- Music clients (usually a terminal running ncmpcpp)
- -- Music clients (usually a terminal running ncmpcpp)
- ruled.client.append_rule {
- rule_any = {
- class = {
- "music"
- },
- instance = {
- "music"
- }
- },
- properties = {
- floating = false
-
- }
- }
+ -- Image viewers
+ ruled.client.append_rule({
+ rule_any = {
+ class = {
+ "feh",
+ "imv",
+ },
+ },
+ properties = {
+ floating = true,
+ width = screen_width * 0.7,
+ height = screen_height * 0.75,
+ },
+ callback = function(c)
+ awful.placement.centered(c, { honor_padding = true, honor_workarea = true })
+ end,
+ })
- -- Image viewers
- ruled.client.append_rule {
- rule_any = {
- class = {
- "feh",
- "imv"
- }
- },
- properties = {
- floating = true,
- width = screen_width * 0.7,
- height = screen_height * 0.75
- },
- callback = function (c)
- awful.placement.centered(c,{honor_padding = true, honor_workarea=true})
- end
- }
+ -- Mpv
+ ruled.client.append_rule({
+ rule = { class = "mpv" },
+ properties = {},
+ callback = function(c)
+ -- make it floating, ontop and move it out of the way if the current tag is maximized
+ if awful.layout.get(awful.screen.focused()) == awful.layout.suit.floating then
+ c.floating = true
+ c.ontop = true
+ c.width = screen_width * 0.30
+ c.height = screen_height * 0.35
+ awful.placement.bottom_right(c, {
+ honor_padding = true,
+ honor_workarea = true,
+ margins = { bottom = beautiful.useless_gap * 2, right = beautiful.useless_gap * 2 },
+ })
+ awful.titlebar.hide(c, beautiful.titlebar_pos)
+ end
- -- Mpv
- ruled.client.append_rule {
- rule = { class = "mpv" },
- properties = {},
- callback = function (c)
- -- make it floating, ontop and move it out of the way if the current tag is maximized
- if awful.layout.get(awful.screen.focused()) == awful.layout.suit.floating then
- c.floating = true
- c.ontop = true
- c.width = screen_width * 0.30
- c.height = screen_height * 0.35
- awful.placement.bottom_right(c, {
- honor_padding = true,
- honor_workarea = true,
- margins = { bottom = beautiful.useless_gap * 2, right = beautiful.useless_gap * 2 }
- })
- awful.titlebar.hide(c, beautiful.titlebar_pos)
- end
-
- -- restore `ontop` after fullscreen is disabled
- c:connect_signal("property::fullscreen", function ()
- if not c.fullscreen then
- c.ontop = true
- end
- end)
- end
- }
+ -- restore `ontop` after fullscreen is disabled
+ c:connect_signal("property::fullscreen", function()
+ if not c.fullscreen then
+ c.ontop = true
+ end
+ end)
+ end,
+ })
end)
-
diff --git a/config/awesome/helpers.lua b/config/awesome/helpers.lua
index 7109e03..4c0034c 100644
--- a/config/awesome/helpers.lua
+++ b/config/awesome/helpers.lua
@@ -8,6 +8,7 @@ local xresources = require("beautiful.xresources")
local dpi = xresources.apply_dpi
local wibox = require("wibox")
local naughty = require("naughty")
+
local helpers = {}
function helpers.contains(_table, _c)
@@ -20,235 +21,249 @@ function helpers.contains(_table, _c)
end
function helpers.find(rule)
- local function matcher(c) return awful.rules.match(c, rule) end
- local clients = client.get()
- local findex = gears.table.hasitem(clients, client.focus) or 1
- local start = gears.math.cycle(#clients, findex + 1)
+ local function matcher(c)
+ return awful.rules.match(c, rule)
+ end
+ local clients = client.get()
+ local findex = gears.table.hasitem(clients, client.focus) or 1
+ local start = gears.math.cycle(#clients, findex + 1)
- local matches = {}
- for c in awful.client.iterate(matcher, start) do
- matches[#matches + 1] = c
- end
+ local matches = {}
+ for c in awful.client.iterate(matcher, start) do
+ matches[#matches + 1] = c
+ end
- return matches
+ return matches
end
-- Adds a maximized mask to a screen
function helpers.screen_mask(s, bg)
- local mask = wibox({
- visible = false,
- ontop = true,
- type = "splash",
- screen = s
- })
- awful.placement.maximize(mask)
- mask.bg = bg
- return mask
+ local mask = wibox({
+ visible = false,
+ ontop = true,
+ type = "splash",
+ screen = s,
+ })
+ awful.placement.maximize(mask)
+ mask.bg = bg
+ return mask
end
function helpers.custom_shape(cr, width, height)
- cr:move_to(0, height / 25)
- cr:line_to(height / 25, 0)
- cr:line_to(width, 0)
- cr:line_to(width, height - height / 25)
- cr:line_to(width - height / 25, height)
- cr:line_to(0, height)
- cr:close_path()
+ cr:move_to(0, height / 25)
+ cr:line_to(height / 25, 0)
+ cr:line_to(width, 0)
+ cr:line_to(width, height - height / 25)
+ cr:line_to(width - height / 25, height)
+ cr:line_to(0, height)
+ cr:close_path()
end
-- Resize gaps on the fly
helpers.resize_gaps = function(amt)
- local t = awful.screen.focused().selected_tag
- t.gap = t.gap + tonumber(amt)
- awful.layout.arrange(awful.screen.focused())
+ local t = awful.screen.focused().selected_tag
+ t.gap = t.gap + tonumber(amt)
+ awful.layout.arrange(awful.screen.focused())
end
-- Resize padding on the fly
helpers.resize_padding = function(amt)
- local s = awful.screen.focused()
- local l = s.padding.left
- local r = s.padding.right
- local t = s.padding.top
- local b = s.padding.bottom
- s.padding = {
- left = l + amt,
- right = r + amt,
- top = t + amt,
- bottom = b + amt
- }
- awful.layout.arrange(awful.screen.focused())
+ local s = awful.screen.focused()
+ local l = s.padding.left
+ local r = s.padding.right
+ local t = s.padding.top
+ local b = s.padding.bottom
+ s.padding = {
+ left = l + amt,
+ right = r + amt,
+ top = t + amt,
+ bottom = b + amt,
+ }
+ awful.layout.arrange(awful.screen.focused())
end
-- Create rounded rectangle shape (in one line)
helpers.rrect = function(radius)
- return function(cr, width, height)
- gears.shape.rounded_rect(cr, width, height, radius)
- end
+ return function(cr, width, height)
+ gears.shape.rounded_rect(cr, width, height, radius)
+ end
+end
+
+helpers.squircle = function(rate, delta)
+ return function(cr, width, height)
+ gears.shape.squircle(cr, width, height, rate, delta)
+ end
+end
+helpers.psquircle = function(rate, delta, tl, tr, br, bl)
+ return function(cr, width, height)
+ gears.shape.partial_squircle(cr, width, height, tl, tr, br, bl, rate, delta)
+ end
end
-- Create pi
helpers.pie = function(width, height, start_angle, end_angle, radius)
- return function(cr)
- gears.shape.pie(cr, width, height, start_angle, end_angle, radius)
- end
+ return function(cr)
+ gears.shape.pie(cr, width, height, start_angle, end_angle, radius)
+ end
end
-- Create parallelogram
helpers.prgram = function(height, base)
- return function(cr, width)
- gears.shape.parallelogram(cr, width, height, base)
- end
+ return function(cr, width)
+ gears.shape.parallelogram(cr, width, height, base)
+ end
end
-- Create partially rounded rect
helpers.prrect = function(radius, tl, tr, br, bl)
- return function(cr, width, height)
- gears.shape.partially_rounded_rect(cr, width, height, tl, tr, br, bl,
- radius)
- end
+ return function(cr, width, height)
+ gears.shape.partially_rounded_rect(cr, width, height, tl, tr, br, bl, radius)
+ end
end
-- Create rounded bar
helpers.rbar = function(width, height)
- return function(cr)
- gears.shape.rounded_bar(cr, width, height)
- end
+ return function(cr)
+ gears.shape.rounded_bar(cr, width, height)
+ end
end
-- Markup helper
function helpers.colorize_text(txt, fg)
- return "" .. txt .. ""
+ return "" .. txt .. ""
end
function helpers.client_menu_toggle()
- local instance = nil
+ local instance = nil
- return function()
- if instance and instance.wibox.visible then
- instance:hide()
- instance = nil
- else
- instance = awful.menu.clients({theme = {width = dpi(250)}})
- end
- end
+ return function()
+ if instance and instance.wibox.visible then
+ instance:hide()
+ instance = nil
+ else
+ instance = awful.menu.clients({ theme = { width = dpi(250) } })
+ end
+ end
end
-- Escapes a string so that it can be displayed inside pango markup
-- tags. Modified from:
-- https://github.com/kernelsauce/turbo/blob/master/turbo/escape.lua
function helpers.pango_escape(s)
- return (string.gsub(s, "[&<>]",
- {["&"] = "&", ["<"] = "<", [">"] = ">"}))
+ return (string.gsub(s, "[&<>]", { ["&"] = "&", ["<"] = "<", [">"] = ">" }))
end
function helpers.vertical_pad(height)
- return wibox.widget {
- forced_height = height,
- layout = wibox.layout.fixed.vertical
- }
+ return wibox.widget({
+ forced_height = height,
+ layout = wibox.layout.fixed.vertical,
+ })
end
function helpers.horizontal_pad(width)
- return wibox.widget {
- forced_width = width,
- layout = wibox.layout.fixed.horizontal
- }
+ return wibox.widget({
+ forced_width = width,
+ layout = wibox.layout.fixed.horizontal,
+ })
end
-- Maximizes client and also respects gaps
function helpers.maximize(c)
- c.maximized = not c.maximized
- if c.maximized then
- awful.placement.maximize(c, {
- honor_padding = true,
- honor_workarea = true,
- margins = beautiful.useless_gap * 2
- })
-
- end
- c:raise()
+ c.maximized = not c.maximized
+ if c.maximized then
+ awful.placement.maximize(c, {
+ honor_padding = true,
+ honor_workarea = true,
+ margins = beautiful.useless_gap * 2,
+ })
+ end
+ c:raise()
end
function helpers.move_to_edge(c, direction)
- -- local workarea = awful.screen.focused().workarea
- -- local client_geometry = c:geometry()
- if direction == "up" then
- local old_x = c:geometry().x
- awful.placement.top(c, {
- honor_padding = true,
- honor_workarea = true,
- honor_padding = true
- })
- c.x = old_x
- -- c:geometry({ nil, y = workarea.y + beautiful.screen_margin * 2, nil, nil })
- elseif direction == "down" then
- local old_x = c:geometry().x
- awful.placement.bottom(c, {
- honor_padding = true,
- honor_workarea = true,
- honor_padding = true
- })
- c.x = old_x
- -- c:geometry({ nil, y = workarea.height + workarea.y - client_geometry.height - beautiful.screen_margin * 2 - beautiful.border_width * 2, nil, nil })
- elseif direction == "left" then
- local old_y = c:geometry().y
- awful.placement.left(c, {
- honor_padding = true,
- honor_workarea = true,
- honor_padding = true
- })
- c.y = old_y
- -- c:geometry({ x = workarea.x + beautiful.screen_margin * 2, nil, nil, nil })
- elseif direction == "right" then
- local old_y = c:geometry().y
- awful.placement.right(c, {
- honor_padding = true,
- honor_workarea = true,
- honor_padding = true
- })
- c.y = old_y
- -- c:geometry({ x = workarea.width + workarea.x - client_geometry.width - beautiful.screen_margin * 2 - beautiful.border_width * 2, nil, nil, nil })
- end
+ -- local workarea = awful.screen.focused().workarea
+ -- local client_geometry = c:geometry()
+ if direction == "up" then
+ local old_x = c:geometry().x
+ awful.placement.top(c, {
+ honor_padding = true,
+ honor_workarea = true,
+ honor_padding = true,
+ })
+ c.x = old_x
+ -- c:geometry({ nil, y = workarea.y + beautiful.screen_margin * 2, nil, nil })
+ elseif direction == "down" then
+ local old_x = c:geometry().x
+ awful.placement.bottom(c, {
+ honor_padding = true,
+ honor_workarea = true,
+ honor_padding = true,
+ })
+ c.x = old_x
+ -- c:geometry({ nil, y = workarea.height + workarea.y - client_geometry.height - beautiful.screen_margin * 2 - beautiful.border_width * 2, nil, nil })
+ elseif direction == "left" then
+ local old_y = c:geometry().y
+ awful.placement.left(c, {
+ honor_padding = true,
+ honor_workarea = true,
+ honor_padding = true,
+ })
+ c.y = old_y
+ -- c:geometry({ x = workarea.x + beautiful.screen_margin * 2, nil, nil, nil })
+ elseif direction == "right" then
+ local old_y = c:geometry().y
+ awful.placement.right(c, {
+ honor_padding = true,
+ honor_workarea = true,
+ honor_padding = true,
+ })
+ c.y = old_y
+ -- c:geometry({ x = workarea.width + workarea.x - client_geometry.width - beautiful.screen_margin * 2 - beautiful.border_width * 2, nil, nil, nil })
+ end
end
local double_tap_timer = nil
function helpers.single_double_tap(single_tap_function, double_tap_function)
- if double_tap_timer then
- double_tap_timer:stop()
- double_tap_timer = nil
- double_tap_function()
- -- naughty.notify({text = "We got a double tap"})
- return
- end
+ if double_tap_timer then
+ double_tap_timer:stop()
+ double_tap_timer = nil
+ double_tap_function()
+ -- naughty.notify({text = "We got a double tap"})
+ return
+ end
- double_tap_timer = gears.timer.start_new(0.20, function()
- double_tap_timer = nil
- -- naughty.notify({text = "We got a single tap"})
- if single_tap_function then single_tap_function() end
- return false
- end)
+ double_tap_timer = gears.timer.start_new(0.20, function()
+ double_tap_timer = nil
+ -- naughty.notify({text = "We got a single tap"})
+ if single_tap_function then
+ single_tap_function()
+ end
+ return false
+ end)
end
-- Used as a custom command in rofi to move a window into the current tag
-- instead of following it.
-- Rofi has access to the X window id of the client.
function helpers.rofi_move_client_here(window)
- local win = function(c) return awful.rules.match(c, {window = window}) end
+ local win = function(c)
+ return awful.rules.match(c, { window = window })
+ end
- for c in awful.client.iterate(win) do
- c.minimized = false
- c:move_to_tag(mouse.screen.selected_tag)
- client.focus = c
- c:raise()
- end
+ for c in awful.client.iterate(win) do
+ c.minimized = false
+ c:move_to_tag(mouse.screen.selected_tag)
+ client.focus = c
+ c:raise()
+ end
end
-- Add a hover cursor to a widget by changing the cursor on
@@ -258,17 +273,21 @@ end
-- For example: "hand1" is the cursor that appears when hovering over
-- links
function helpers.add_hover_cursor(w, hover_cursor)
- local original_cursor = "left_ptr"
+ local original_cursor = "left_ptr"
- w:connect_signal("mouse::enter", function()
- local w = _G.mouse.current_wibox
- if w then w.cursor = hover_cursor end
- end)
+ w:connect_signal("mouse::enter", function()
+ local w = _G.mouse.current_wibox
+ if w then
+ w.cursor = hover_cursor
+ end
+ end)
- w:connect_signal("mouse::leave", function()
- local w = _G.mouse.current_wibox
- if w then w.cursor = original_cursor end
- end)
+ w:connect_signal("mouse::leave", function()
+ local w = _G.mouse.current_wibox
+ if w then
+ w.cursor = original_cursor
+ end
+ end)
end
-- Tag back and forth:
@@ -281,24 +300,24 @@ end
-- client, the urgent client is unfocused but still covers all other windows
-- (even the currently focused window).
function helpers.tag_back_and_forth(tag_index)
- local s = mouse.screen
- local tag = s.tags[tag_index]
- if tag then
- if tag == s.selected_tag then
- awful.tag.history.restore()
- else
- tag:view_only()
- end
+ local s = mouse.screen
+ local tag = s.tags[tag_index]
+ if tag then
+ if tag == s.selected_tag then
+ awful.tag.history.restore()
+ else
+ tag:view_only()
+ end
- local urgent_clients = function(c)
- return awful.rules.match(c, {urgent = true, first_tag = tag})
- end
+ local urgent_clients = function(c)
+ return awful.rules.match(c, { urgent = true, first_tag = tag })
+ end
- for c in awful.client.iterate(urgent_clients) do
- client.focus = c
- c:raise()
- end
- end
+ for c in awful.client.iterate(urgent_clients) do
+ client.focus = c
+ c:raise()
+ end
+ end
end
-- Resize DWIM (Do What I Mean)
@@ -308,54 +327,59 @@ local floating_resize_amount = dpi(20)
local tiling_resize_factor = 0.05
---------------
function helpers.resize_dwim(c, direction)
- if awful.layout.get(mouse.screen) == awful.layout.suit.floating or
- (c and c.floating) then
- if direction == "up" then
- c:relative_move(0, 0, 0, -floating_resize_amount)
- elseif direction == "down" then
- c:relative_move(0, 0, 0, floating_resize_amount)
- elseif direction == "left" then
- c:relative_move(0, 0, -floating_resize_amount, 0)
- elseif direction == "right" then
- c:relative_move(0, 0, floating_resize_amount, 0)
- end
- else
- if direction == "up" then
- awful.client.incwfact(-tiling_resize_factor)
- elseif direction == "down" then
- awful.client.incwfact(tiling_resize_factor)
- elseif direction == "left" then
- awful.tag.incmwfact(-tiling_resize_factor)
- elseif direction == "right" then
- awful.tag.incmwfact(tiling_resize_factor)
- end
- end
+ if awful.layout.get(mouse.screen) == awful.layout.suit.floating or (c and c.floating) then
+ if direction == "up" then
+ c:relative_move(0, 0, 0, -floating_resize_amount)
+ elseif direction == "down" then
+ c:relative_move(0, 0, 0, floating_resize_amount)
+ elseif direction == "left" then
+ c:relative_move(0, 0, -floating_resize_amount, 0)
+ elseif direction == "right" then
+ c:relative_move(0, 0, floating_resize_amount, 0)
+ end
+ else
+ if direction == "up" then
+ awful.client.incwfact(-tiling_resize_factor)
+ elseif direction == "down" then
+ awful.client.incwfact(tiling_resize_factor)
+ elseif direction == "left" then
+ awful.tag.incmwfact(-tiling_resize_factor)
+ elseif direction == "right" then
+ awful.tag.incmwfact(tiling_resize_factor)
+ end
+ end
end
-- Move client to screen edge, respecting the screen workarea
function helpers.move_to_edge(c, direction)
- local workarea = awful.screen.focused().workarea
- if direction == "up" then
- c:geometry({nil, y = workarea.y + beautiful.useless_gap * 2, nil, nil})
- elseif direction == "down" then
- c:geometry({
- nil,
- y = workarea.height + workarea.y - c:geometry().height -
- beautiful.useless_gap * 2 - beautiful.border_width * 2,
- nil,
- nil
- })
- elseif direction == "left" then
- c:geometry({x = workarea.x + beautiful.useless_gap * 2, nil, nil, nil})
- elseif direction == "right" then
- c:geometry({
- x = workarea.width + workarea.x - c:geometry().width -
- beautiful.useless_gap * 2 - beautiful.border_width * 2,
- nil,
- nil,
- nil
- })
- end
+ local workarea = awful.screen.focused().workarea
+ if direction == "up" then
+ c:geometry({ nil, y = workarea.y + beautiful.useless_gap * 2, nil, nil })
+ elseif direction == "down" then
+ c:geometry({
+ nil,
+ y = workarea.height
+ + workarea.y
+ - c:geometry().height
+ - beautiful.useless_gap * 2
+ - beautiful.border_width * 2,
+ nil,
+ nil,
+ })
+ elseif direction == "left" then
+ c:geometry({ x = workarea.x + beautiful.useless_gap * 2, nil, nil, nil })
+ elseif direction == "right" then
+ c:geometry({
+ x = workarea.width
+ + workarea.x
+ - c:geometry().width
+ - beautiful.useless_gap * 2
+ - beautiful.border_width * 2,
+ nil,
+ nil,
+ nil,
+ })
+ end
end
-- Move client DWIM (Do What I Mean)
@@ -363,120 +387,97 @@ end
-- Swap by index if maximized
-- Else swap client by direction
function helpers.move_client_dwim(c, direction)
- if c.floating or
- (awful.layout.get(mouse.screen) == awful.layout.suit.floating) then
- helpers.move_to_edge(c, direction)
- elseif awful.layout.get(mouse.screen) == awful.layout.suit.max then
- if direction == "up" or direction == "left" then
- awful.client.swap.byidx(-1, c)
- elseif direction == "down" or direction == "right" then
- awful.client.swap.byidx(1, c)
- end
- else
- awful.client.swap.bydirection(direction, c, nil)
- end
+ if c.floating or (awful.layout.get(mouse.screen) == awful.layout.suit.floating) then
+ helpers.move_to_edge(c, direction)
+ elseif awful.layout.get(mouse.screen) == awful.layout.suit.max then
+ if direction == "up" or direction == "left" then
+ awful.client.swap.byidx(-1, c)
+ elseif direction == "down" or direction == "right" then
+ awful.client.swap.byidx(1, c)
+ end
+ else
+ awful.client.swap.bydirection(direction, c, nil)
+ end
end
-- Make client floating and snap to the desired edge
function helpers.float_and_edge_snap(c, direction)
- -- if not c.floating then
- -- c.floating = true
- -- end
- naughty.notify({text = "double tap"})
- c.floating = true
- local workarea = awful.screen.focused().workarea
- if direction == "up" then
- local axis = 'horizontally'
- local f = awful.placement.scale + awful.placement.top +
- (axis and awful.placement['maximize_' .. axis] or nil)
- local geo = f(client.focus, {
- honor_padding = true,
- honor_workarea = true,
- to_percent = 0.5
- })
- elseif direction == "down" then
- local axis = 'horizontally'
- local f = awful.placement.scale + awful.placement.bottom +
- (axis and awful.placement['maximize_' .. axis] or nil)
- local geo = f(client.focus, {
- honor_padding = true,
- honor_workarea = true,
- to_percent = 0.5
- })
- elseif direction == "left" then
- local axis = 'vertically'
- local f = awful.placement.scale + awful.placement.left +
- (axis and awful.placement['maximize_' .. axis] or nil)
- local geo = f(client.focus, {
- honor_padding = true,
- honor_workarea = true,
- to_percent = 0.5
- })
- elseif direction == "right" then
- local axis = 'vertically'
- local f = awful.placement.scale + awful.placement.right +
- (axis and awful.placement['maximize_' .. axis] or nil)
- local geo = f(client.focus, {
- honor_padding = true,
- honor_workarea = true,
- to_percent = 0.5
- })
- end
+ -- if not c.floating then
+ -- c.floating = true
+ -- end
+ naughty.notify({ text = "double tap" })
+ c.floating = true
+ local workarea = awful.screen.focused().workarea
+ if direction == "up" then
+ local axis = "horizontally"
+ local f = awful.placement.scale + awful.placement.top + (axis and awful.placement["maximize_" .. axis] or nil)
+ local geo = f(client.focus, {
+ honor_padding = true,
+ honor_workarea = true,
+ to_percent = 0.5,
+ })
+ elseif direction == "down" then
+ local axis = "horizontally"
+ local f = awful.placement.scale
+ + awful.placement.bottom
+ + (axis and awful.placement["maximize_" .. axis] or nil)
+ local geo = f(client.focus, {
+ honor_padding = true,
+ honor_workarea = true,
+ to_percent = 0.5,
+ })
+ elseif direction == "left" then
+ local axis = "vertically"
+ local f = awful.placement.scale + awful.placement.left + (axis and awful.placement["maximize_" .. axis] or nil)
+ local geo = f(client.focus, {
+ honor_padding = true,
+ honor_workarea = true,
+ to_percent = 0.5,
+ })
+ elseif direction == "right" then
+ local axis = "vertically"
+ local f = awful.placement.scale + awful.placement.right + (axis and awful.placement["maximize_" .. axis] or nil)
+ local geo = f(client.focus, {
+ honor_padding = true,
+ honor_workarea = true,
+ to_percent = 0.5,
+ })
+ end
end
-- Rounds a number to any number of decimals
function helpers.round(number, decimals)
- local power = 10 ^ decimals
- return math.floor(number * power) / power
+ local power = 10 ^ decimals
+ return math.floor(number * power) / power
end
function helpers.fake_escape()
- root.fake_input('key_press', "Escape")
- root.fake_input('key_release', "Escape")
-end
-
-function helpers.run_or_raise(match, move, spawn_cmd, spawn_args)
- local matcher = function(c) return awful.rules.match(c, match) end
-
- -- Find and raise
- local found = false
- for c in awful.client.iterate(matcher) do
- found = true
- c.minimized = false
- if move then
- c:move_to_tag(mouse.screen.selected_tag)
- client.focus = c
- c:raise()
- else
- c:jump_to()
- end
- break
- end
-
- -- Spawn if not found
- if not found then awful.spawn(spawn_cmd, spawn_args) end
+ root.fake_input("key_press", "Escape")
+ root.fake_input("key_release", "Escape")
end
function helpers.pad(size)
- local str = ""
- for i = 1, size do str = str .. " " end
- local pad = wibox.widget.textbox(str)
- return pad
+ local str = ""
+ for i = 1, size do
+ str = str .. " "
+ end
+ local pad = wibox.widget.textbox(str)
+ return pad
end
function helpers.float_and_resize(c, width, height)
- c.width = width
- c.height = height
- awful.placement.centered(c, {honor_workarea = true, honor_padding = true})
- awful.client.property.set(c, 'floating_geometry', c:geometry())
- c.floating = true
- c:raise()
+ c.width = width
+ c.height = height
+ awful.placement.centered(c, { honor_workarea = true, honor_padding = true })
+ awful.client.property.set(c, "floating_geometry", c:geometry())
+ c.floating = true
+ c:raise()
end
function helpers.centered_client_placement(c)
- return gears.timer.delayed_call(function ()
- awful.placement.centered(c, {honor_padding = true, honor_workarea=true})
- end)
+ return gears.timer.delayed_call(function()
+ awful.placement.centered(c, { honor_padding = true, honor_workarea = true })
+ end)
end
-- Useful for periodically checking the output of a command that
@@ -487,75 +488,191 @@ end
-- time to determine whether to run the command again or not.
-- Passes the output of `command` to `callback` function.
function helpers.remote_watch(command, interval, output_file, callback)
- local run_the_thing = function()
- -- Pass output to callback AND write it to file
- awful.spawn.easy_async_with_shell(command.." | tee "..output_file, function(out) callback(out) end)
- end
+ local run_the_thing = function()
+ -- Pass output to callback AND write it to file
+ awful.spawn.easy_async_with_shell(command .. " | tee " .. output_file, function(out)
+ callback(out)
+ end)
+ end
- local timer
- timer = gears.timer {
- timeout = interval,
- call_now = true,
- autostart = true,
- single_shot = false,
- callback = function()
- awful.spawn.easy_async_with_shell("date -r "..output_file.." +%s", function(last_update, _, __, exitcode)
- -- Probably the file does not exist yet (first time
- -- running after reboot)
- if exitcode == 1 then
- run_the_thing()
- return
- end
+ local timer
+ timer = gears.timer({
+ timeout = interval,
+ call_now = true,
+ autostart = true,
+ single_shot = false,
+ callback = function()
+ awful.spawn.easy_async_with_shell(
+ "date -r " .. output_file .. " +%s",
+ function(last_update, _, __, exitcode)
+ -- Probably the file does not exist yet (first time
+ -- running after reboot)
+ if exitcode == 1 then
+ run_the_thing()
+ return
+ end
- local diff = os.time() - tonumber(last_update)
- if diff >= interval then
- run_the_thing()
- else
- -- Pass the date saved in the file since it is fresh enough
- awful.spawn.easy_async_with_shell("cat "..output_file, function(out) callback(out) end)
+ local diff = os.time() - tonumber(last_update)
+ if diff >= interval then
+ run_the_thing()
+ else
+ -- Pass the date saved in the file since it is fresh enough
+ awful.spawn.easy_async_with_shell("cat " .. output_file, function(out)
+ callback(out)
+ end)
- -- Schedule an update for when the remaining time to complete the interval passes
- timer:stop()
- gears.timer.start_new(interval - diff, function()
- run_the_thing()
- timer:again()
- end)
- end
- end)
- end
- }
+ -- Schedule an update for when the remaining time to complete the interval passes
+ timer:stop()
+ gears.timer.start_new(interval - diff, function()
+ run_the_thing()
+ timer:again()
+ end)
+ end
+ end
+ )
+ end,
+ })
end
-- Volume Control
function helpers.volume_control(step)
- local cmd
- if step == 0 then
- cmd = "pactl set-sink-mute @DEFAULT_SINK@ toggle"
- else
- sign = step > 0 and "+" or ""
- cmd = "pactl set-sink-mute @DEFAULT_SINK@ 0 && pactl set-sink-volume @DEFAULT_SINK@ "..sign..tostring(step).."%"
- end
- awful.spawn.with_shell(cmd)
+ local cmd
+ if step == 0 then
+ cmd = "pactl set-sink-mute @DEFAULT_SINK@ toggle"
+ else
+ sign = step > 0 and "+" or ""
+ cmd = "pactl set-sink-mute @DEFAULT_SINK@ 0 && pactl set-sink-volume @DEFAULT_SINK@ "
+ .. sign
+ .. tostring(step)
+ .. "%"
+ end
+ awful.spawn.with_shell(cmd)
end
function helpers.music_control(state)
- local cmd
- if state == "toggle" then
- cmd = "mpc toggle"
- elseif state == "prev" then
- cmd = "mpc prev"
- elseif state == "next" then
- cmd = "mpc next"
- end
- awful.spawn.with_shell(cmd)
+ local cmd
+ if state == "toggle" then
+ cmd = "playerctl -p spotify,mpd play-pause"
+ elseif state == "prev" then
+ cmd = "playerctl -p spotify,mpd previous"
+ elseif state == "next" then
+ cmd = "playerctl -p spotify,mpd next"
+ end
+ awful.spawn.with_shell(cmd)
end
function helpers.send_key(c, key)
- awful.spawn.with_shell("xdotool key --window "..tostring(c.window).." "..key)
+ awful.spawn.with_shell("xdotool key --window " .. tostring(c.window) .. " " .. key)
end
function helpers.send_key_sequence(c, seq)
- awful.spawn.with_shell("xdotool type --delay 5 --window "..tostring(c.window).." "..seq)
+ awful.spawn.with_shell("xdotool type --delay 5 --window " .. tostring(c.window) .. " " .. seq)
+end
+
+local prompt_font = beautiful.prompt_font
+function helpers.prompt(action, textbox, prompt, callback)
+ if action == "run" then
+ awful.prompt.run({
+ prompt = prompt,
+ textbox = textbox,
+ font = prompt_font,
+ done_callback = callback,
+ exe_callback = awful.spawn,
+ completion_callback = awful.completion.shell,
+ history_path = awful.util.get_cache_dir() .. "/history",
+ })
+ elseif action == "web_search" then
+ awful.prompt.run({
+ prompt = prompt,
+ textbox = textbox,
+ font = prompt_font,
+ history_path = awful.util.get_cache_dir() .. "/history_web",
+ done_callback = callback,
+ exe_callback = function(input)
+ if not input or #input == 0 then
+ return
+ end
+ awful.spawn.with_shell("noglob " .. web_search_cmd .. "'" .. input .. "'")
+ naughty.notify({
+ title = "Searching the web for",
+ text = input,
+ urgency = "low",
+ })
+ end,
+ })
+ end
+end
+
+-- Given a `match` condition, returns an array with clients that match it, or
+-- just the first found client if `first_only` is true
+function helpers.find_clients(match, first_only)
+ local matcher = function(c)
+ return awful.rules.match(c, match)
+ end
+
+ if first_only then
+ for c in awful.client.iterate(matcher) do
+ return c
+ end
+ else
+ local clients = {}
+ for c in awful.client.iterate(matcher) do
+ table.insert(clients, c)
+ end
+ return clients
+ end
+ return nil
+end
+
+-- Given a `match` condition, calls the specified function `f_do` on all the
+-- clients that match it
+function helpers.find_clients_and_do(match, f_do)
+ local matcher = function(c)
+ return awful.rules.match(c, match)
+ end
+
+ for c in awful.client.iterate(matcher) do
+ f_do(c)
+ end
+end
+
+function helpers.run_or_raise(match, move, spawn_cmd, spawn_args)
+ local matcher = function(c)
+ return awful.rules.match(c, match)
+ end
+
+ -- Find and raise
+ local found = false
+ for c in awful.client.iterate(matcher) do
+ found = true
+ c.minimized = false
+ if move then
+ c:move_to_tag(mouse.screen.selected_tag)
+ client.focus = c
+ else
+ c:jump_to()
+ end
+ break
+ end
+
+ -- Spawn if not found
+ if not found then
+ awful.spawn(spawn_cmd, spawn_args)
+ end
+end
+
+-- Run raise or minimize a client (scratchpad style)
+-- Depends on helpers.run_or_raise
+-- If it not running, spawn it
+-- If it is running, focus it
+-- If it is focused, minimize it
+function helpers.scratchpad(match, spawn_cmd, spawn_args)
+ local cf = client.focus
+ if cf and awful.rules.match(cf, match) then
+ cf.minimized = true
+ else
+ helpers.run_or_raise(match, true, spawn_cmd, spawn_args)
+ end
end
return helpers
diff --git a/config/awesome/module/better-resize.lua b/config/awesome/module/better-resize.lua
index 7812ff5..7c87ff5 100644
--- a/config/awesome/module/better-resize.lua
+++ b/config/awesome/module/better-resize.lua
@@ -1,127 +1,129 @@
local capi = {
- client = client,
- mouse = mouse,
- screen = screen,
- mousegrabber = mousegrabber
+ client = client,
+ mouse = mouse,
+ screen = screen,
+ mousegrabber = mousegrabber,
}
local awful = require("awful")
local function mouse_resize_handler(m, c)
- awful.client.incwfact(0, c) -- needed to fix normalization at start
- local start = m(capi.mouse.coords())
- local x, y = start.x, start.y
- local wa = m(c.screen.workarea)
- local idx = awful.client.idx(c)
- local c_above, c_below
- local idx_above, idx_below
- local wfact_above, wfact_below
- local jump_to = {x = x, y = y}
- local move_mwfact = false
+ awful.client.incwfact(0, c) -- needed to fix normalization at start
+ local start = m(capi.mouse.coords())
+ local x, y = start.x, start.y
+ local wa = m(c.screen.workarea)
+ local idx = awful.client.idx(c)
+ local c_above, c_below
+ local idx_above, idx_below
+ local wfact_above, wfact_below
+ local jump_to = { x = x, y = y }
+ local move_mwfact = false
- do
- local g = m(c:geometry())
+ do
+ local g = m(c:geometry())
- local v_border = 0.2 * g.height
+ local v_border = 0.2 * g.height
- if idx.idx > 1 and y >= g.y and y <= g.y + v_border then
- -- we are near the top edge of the window
- c_above = awful.client.next(-1, c)
- c_below = c
- jump_to.y = g.y
- idx_above = idx.idx - 1
- idx_below = idx.idx
- elseif idx.idx < (idx.num) and y >= g.y + g.height - v_border then
- -- we are near the bottom edge of the window
- c_above = c
- c_below = awful.client.next(1, c)
- idx_above = idx.idx
- idx_below = idx.idx + 1
- jump_to.y = g.y + g.height
- end
+ if idx.idx > 1 and y >= g.y and y <= g.y + v_border then
+ -- we are near the top edge of the window
+ c_above = awful.client.next(-1, c)
+ c_below = c
+ jump_to.y = g.y
+ idx_above = idx.idx - 1
+ idx_below = idx.idx
+ elseif idx.idx < idx.num and y >= g.y + g.height - v_border then
+ -- we are near the bottom edge of the window
+ c_above = c
+ c_below = awful.client.next(1, c)
+ idx_above = idx.idx
+ idx_below = idx.idx + 1
+ jump_to.y = g.y + g.height
+ end
- local mw_split = wa.x + wa.width *
- c.screen.selected_tag.master_width_factor
+ local mw_split = wa.x + wa.width * c.screen.selected_tag.master_width_factor
- if math.abs(mw_split - x) > wa.width / 6 then
- move_mwfact = false
- else
- move_mwfact = true
- jump_to.x = mw_split
- end
- end
+ if math.abs(mw_split - x) > wa.width / 6 then
+ move_mwfact = false
+ else
+ move_mwfact = true
+ jump_to.x = mw_split
+ end
+ end
- if idx_above then
- local t = c.screen.selected_tag
- local data = t.windowfact or {}
- local colfact = data[idx.col] or {}
- wfact_above = colfact[idx_above] or 1
- wfact_below = colfact[idx_below] or 1
- end
+ if idx_above then
+ local t = c.screen.selected_tag
+ local data = t.windowfact or {}
+ local colfact = data[idx.col] or {}
+ wfact_above = colfact[idx_above] or 1
+ wfact_below = colfact[idx_below] or 1
+ end
- if idx_above and move_mwfact then
- cursor = "cross"
- elseif idx_above then
- cursor = m({y = "sb_v_double_arrow", x = "sb_h_double_arrow"}).y
- elseif move_mwfact then
- cursor = m({y = "sb_v_double_arrow", x = "sb_h_double_arrow"}).x
- else
- return false
- end
+ if idx_above and move_mwfact then
+ cursor = "cross"
+ elseif idx_above then
+ cursor = m({ y = "sb_v_double_arrow", x = "sb_h_double_arrow" }).y
+ elseif move_mwfact then
+ cursor = m({ y = "sb_v_double_arrow", x = "sb_h_double_arrow" }).x
+ else
+ return false
+ end
- capi.mouse.coords(m(jump_to))
+ capi.mouse.coords(m(jump_to))
- capi.mousegrabber.run(function(_mouse)
- if not c.valid then return false end
+ capi.mousegrabber.run(function(_mouse)
+ if not c.valid then
+ return false
+ end
- local pressed = false
- for _, v in ipairs(_mouse.buttons) do
- if v then
- pressed = true
- break
- end
- end
+ local pressed = false
+ for _, v in ipairs(_mouse.buttons) do
+ if v then
+ pressed = true
+ break
+ end
+ end
- _mouse = m(_mouse)
+ _mouse = m(_mouse)
- if pressed then
- if move_mwfact then
- c.screen.selected_tag.master_width_factor =
- math.min(math.max((_mouse.x - wa.x) / wa.width, 0.01), 0.99)
- end
+ if pressed then
+ if move_mwfact then
+ c.screen.selected_tag.master_width_factor = math.min(math.max((_mouse.x - wa.x) / wa.width, 0.01), 0.99)
+ end
- if idx_above then
- local factor_delta = (_mouse.y - jump_to.y) / wa.height
+ if idx_above then
+ local factor_delta = (_mouse.y - jump_to.y) / wa.height
- if factor_delta < 0 then
- factor_delta = math.max(factor_delta, -(wfact_above - 0.05))
- else
- factor_delta = math.min(factor_delta, wfact_below - 0.05)
- end
+ if factor_delta < 0 then
+ factor_delta = math.max(factor_delta, -(wfact_above - 0.05))
+ else
+ factor_delta = math.min(factor_delta, wfact_below - 0.05)
+ end
- local t = c.screen.selected_tag
- local data = t.windowfact or {}
- local colfact = data[idx.col] or {}
- colfact[idx_above] = wfact_above + factor_delta
- colfact[idx_below] = wfact_below - factor_delta
- awful.client.incwfact(0, c_above) -- just in case
- end
- return true
- else
- return false
- end
- end, cursor)
+ local t = c.screen.selected_tag
+ local data = t.windowfact or {}
+ local colfact = data[idx.col] or {}
+ colfact[idx_above] = wfact_above + factor_delta
+ colfact[idx_below] = wfact_below - factor_delta
+ awful.client.incwfact(0, c_above) -- just in case
+ end
+ return true
+ else
+ return false
+ end
+ end, cursor)
- return true
+ return true
end
-awful.layout.suit.tile.mouse_resize_handler =
- function(c) return mouse_resize_handler(function(x) return x end, c) end
-awful.layout.suit.tile.bottom.mouse_resize_handler =
- function(c)
- return mouse_resize_handler(function(q)
- return {x = q.y, y = q.x, width = q.height, height = q.width}
- end, c)
- end
+awful.layout.suit.tile.mouse_resize_handler = function(c)
+ return mouse_resize_handler(function(x)
+ return x
+ end, c)
+end
+awful.layout.suit.tile.bottom.mouse_resize_handler = function(c)
+ return mouse_resize_handler(function(q)
+ return { x = q.y, y = q.x, width = q.height, height = q.width }
+ end, c)
+end
-- local old_coords = mouse.coords
diff --git a/config/awesome/module/dock.lua b/config/awesome/module/dock.lua
new file mode 100644
index 0000000..19e28e6
--- /dev/null
+++ b/config/awesome/module/dock.lua
@@ -0,0 +1,296 @@
+local wibox = require("wibox")
+local beautiful = require("beautiful")
+local awful = require("awful")
+local gears = require("gears")
+
+local chel = require("module.dock_helpers").color
+local rubato = require("module.rubato")
+
+local dpi = beautiful.xresources.apply_dpi
+
+local function init(s, h, o, shape, pinneds)
+ --local function init(args)
+ --[[ if args.screen == nil then return end
+-- local s = args.screen
+-- local h = args.height or dpi(50)
+-- local o = args.offset or 0
+-- local shape = args.shape or gears.shape.rectangle
+-- local pinneds = args.pinneds or nil]]
+
+ -- tasklist creation {{{
+ local tasklist = awful.widget.tasklist({
+ screen = s,
+ source = function()
+ local ret = {}
+ for _, t in ipairs(s.tags) do
+ gears.table.merge(ret, t:clients())
+ end
+ return ret
+ end, --sorts clients in order of their tags
+ filter = awful.widget.tasklist.filter.alltags,
+ forced_height = h,
+ style = {
+ shape = shape,
+ },
+ layout = {
+ layout = wibox.layout.fixed.horizontal,
+ },
+ widget_template = {
+ {
+ {
+ nil,
+ {
+ {
+ awful.widget.clienticon,
+ widget = wibox.container.place,
+ halign = "center",
+ valign = "center",
+ },
+ widget = wibox.container.margin,
+ margins = h / 10,
+ },
+ {
+ {
+ wibox.widget.base.make_widget(),
+ forced_height = h / 10,
+ forced_width = h / 10,
+ id = "status",
+ bg = beautiful.dock_focused_bg,
+ shape = shape,
+ widget = wibox.container.background,
+ },
+ widget = wibox.container.place, --so the bg widget doesnt get stretched
+ },
+ layout = wibox.layout.align.vertical,
+ },
+ id = "bg",
+ widget = wibox.container.background,
+ bg = beautiful.dock_bg,
+ shape = shape,
+ },
+ widget = wibox.container.margin,
+ margins = h / 10,
+ forced_height = h,
+ forced_width = h,
+ create_callback = function(self, c, _, _)
+ local function hover(p, t) --so gc can collect all the timed objects that are flying around
+ local on_hover = rubato.timed({
+ intro = 0.02,
+ outro = 0.02,
+ duration = 0.2,
+ rate = 30,
+ pos = p,
+ subscribed = function(pos)
+ self:get_children_by_id("bg")[1].bg = chel.col_shift(beautiful.dock_bg, pos)
+ end,
+ })
+ on_hover.target = t
+ end
+ self:connect_signal("mouse::enter", function()
+ hover(0, 20)
+ end)
+ self:connect_signal("mouse::leave", function()
+ hover(20, 0)
+ end)
+ self:add_button(awful.button({
+ modifiers = {},
+ button = 1,
+ on_press = function()
+ if not c.active then
+ c:activate({
+ context = "through_dock",
+ switch_to_tag = true,
+ })
+ else
+ c.minimized = true
+ end
+ end,
+ }))
+ end,
+ update_callback = function(self, c, _, _) --praying to the gc that this is getting cleared properly, didnt show problems in testing
+ collectgarbage("collect")
+ local status_w = rubato.timed({
+ intro = 0.02,
+ outro = 0.02,
+ duration = 0.1,
+ rate = 30,
+ pos = self:get_children_by_id("status")[1].forced_width,
+ subscribed = function(pos)
+ self:get_children_by_id("status")[1].forced_width = pos
+ end,
+ })
+ local bg_col = beautiful.dock_focused_bg
+ local bg_focus_col = beautiful.dock_accent
+ local sh_r, sh_g, sh_b, _ = chel.col_diff(bg_col, bg_focus_col)
+
+ local status_c = rubato.timed({
+ intro = 0.04,
+ outro = 0.04,
+ duration = 0.2,
+ rate = 30,
+ pos = 0,
+ subscribed = function(pos)
+ self:get_children_by_id("status")[1].bg = chel.col_shift(
+ bg_col,
+ math.floor(pos * (255 * sh_r)),
+ math.floor((sh_g * 255) * pos),
+ math.floor((sh_b * 255) * pos)
+ )
+ end,
+ })
+ --this here sets width and colors depending on the status of the client a widget in the tasklist represents
+ if c.active then
+ status_w.target = h / 2
+ status_c.target = 1
+ elseif c.minimized then
+ status_w.target = h / 10
+ status_c.target = 0
+ else
+ status_w.target = h / 3
+ status_c.target = 0
+ end
+ end,
+ },
+ })
+
+ -- }}}
+ -- the funny desktop starters {{{
+ local pinned_apps = pinneds and { layout = wibox.layout.fixed.horizontal } or nil
+ if pinneds then
+ for _, p in ipairs(pinneds) do
+ pinned_apps[#pinned_apps + 1] = wibox.widget({
+ {
+ {
+ nil,
+ {
+ {
+ {
+ widget = wibox.widget.imagebox,
+ image = p.icon,
+ resize = true,
+ },
+ margins = dpi(5),
+ widget = wibox.container.margin,
+ },
+ widget = wibox.container.place,
+ halign = "center",
+ valign = "center",
+ },
+ {
+ {
+ wibox.widget.base.make_widget(),
+ forced_height = h / 10,
+ forced_width = h / 10,
+ id = "status",
+ shape = shape,
+ widget = wibox.container.background,
+ },
+ widget = wibox.container.place, --so the bg widget doesnt get stretched
+ halign = "center",
+ },
+ layout = wibox.layout.align.vertical,
+ },
+ widget = wibox.container.background,
+ shape = shape,
+ id = "bg",
+ buttons = awful.button({}, 1, function()
+ awful.spawn.easy_async(p.start_cmd)
+ end),
+ },
+ widget = wibox.container.margin,
+ margins = h / 10,
+ forced_width = h,
+ forced_height = h,
+ })
+ local self = pinned_apps[#pinned_apps]
+ local function hover(po, t) --so gc can collect all the timed objects that are flying around
+ local on_hover = rubato.timed({
+ intro = 0.02,
+ outro = 0.02,
+ duration = 0.2,
+ rate = 30,
+ pos = po,
+ subscribed = function(pos)
+ self:get_children_by_id("bg")[1].bg = chel.col_shift(beautiful.dock_bg, pos)
+ end,
+ })
+ on_hover.target = t
+ end
+ self:connect_signal("mouse::enter", function()
+ hover(0, 20)
+ end)
+ self:connect_signal("mouse::leave", function()
+ hover(20, 0)
+ end)
+ self:add_button(
+ awful.button({ --this is very hacky. Please do NOT COPY if you are looking for suggestions on how to implement this
+ modifiers = {},
+ button = 1,
+ on_press = function() end,
+ })
+ )
+ end
+ end
+ -- }}}
+ local dock_box = awful.popup({
+ ontop = true,
+ screen = s,
+ x = s.geometry.x + s.geometry.width / 2,
+ y = s.geometry.y + s.geometry.height - (h + o),
+ shape = shape,
+ widget = {
+ {
+ {
+ {
+ pinned_apps,
+ tasklist,
+ layout = wibox.layout.fixed.horizontal,
+ },
+ widget = wibox.container.margin,
+ margin = dpi(5),
+ },
+ widget = wibox.container.background,
+ bg = beautiful.dock_bg,
+ shape = shape,
+ },
+ widget = wibox.container.place,
+ halign = "center",
+ },
+ })
+
+ dock_box:connect_signal("property::width", function() --for centered placement, wanted to keep the offset
+ dock_box.x = s.geometry.x + s.geometry.width / 2 - dock_box.width / 2
+ end)
+
+ local autohideanim = rubato.timed({
+ intro = 0.3,
+ outro = 0.1,
+ duration = 0.4,
+ pos = 0,
+ rate = 60,
+ easing = rubato.quadratic,
+ subscribed = function(pos)
+ dock_box.y = s.geometry.y + s.geometry.height - ((pos * h) + o)
+ dock_box.opacity = pos
+ end,
+ })
+ local autohidetimer = gears.timer({
+ timeout = 1,
+ single_shot = true,
+ callback = function()
+ autohideanim.target = 0
+ end,
+ })
+ dock_box:connect_signal("mouse::leave", function()
+ autohidetimer:again()
+ end)
+ dock_box:connect_signal("mouse::enter", function()
+ autohideanim.target = 1
+ autohidetimer:stop()
+ end)
+ return dock_box
+end
+
+return {
+ init = init,
+}
diff --git a/config/awesome/module/dock_helpers.lua b/config/awesome/module/dock_helpers.lua
new file mode 100644
index 0000000..c36b10d
--- /dev/null
+++ b/config/awesome/module/dock_helpers.lua
@@ -0,0 +1,87 @@
+local gears = require("gears")
+
+--typesafe function overloader (copied from lua-users.org) {{{
+--source: http://lua-users.org/wiki/OverloadedFunctions
+local function overloaded()
+ local fns = {}
+ local mt = {}
+ local function oerror()
+ return error("Invalid argument types to overloaded function")
+ end
+ function mt:__call(...)
+ local arg = {...}
+ local default = self.default
+ local signature = {}
+ for i,arg in ipairs {...} do
+ signature[i] = type(arg)
+ end
+ signature = table.concat(signature, ",")
+ return (fns[signature] or self.default)(...)
+ end
+ function mt:__index(key)
+ local signature = {}
+ local function __newindex(self, key, value)
+ print(key, type(key), value, type(value))
+ signature[#signature+1] = key
+ fns[table.concat(signature, ",")] = value
+ print("bind", table.concat(signature, ", "))
+ end
+ local function __index(self, key)
+ print("I", key, type(key))
+ signature[#signature+1] = key
+ return setmetatable({}, { __index = __index, __newindex = __newindex })
+ end
+ return __index(self, key)
+ end
+ function mt:__newindex(key, value)
+ fns[key] = value
+ end
+ return setmetatable({ default = oerror }, mt)
+ end
+--}}}
+
+local function dec_hex(IN)
+ local B,K,OUT,I,D=16,"0123456789ABCDEF","",0
+ while IN>0 do
+ I=I+1
+ IN,D=math.floor(IN/B),(IN%B)+1
+ OUT=string.sub(K,D,D)..OUT
+ end
+ return #OUT == 2 and OUT or "0" .. OUT
+end
+
+-- color helpers {{{
+local color = {}
+
+color.col_shift = overloaded()
+color.col_shift.string.number = function(c, s)
+ local r,g,b,o = gears.color.parse_color(c)
+ return "#" .. dec_hex(r*255+s)
+ .. dec_hex(g*255+s)
+ .. dec_hex(b*255+s)
+ .. dec_hex(o*255)
+end
+color.col_shift.string.number.number.number = function(c,sr,sg,sb)
+ local r,g,b,o = gears.color.parse_color(c)
+ return "#" .. dec_hex(r*255+sr)
+ .. dec_hex(g*255+sg)
+ .. dec_hex(b*255+sb)
+ .. dec_hex(o*255)
+end
+color.col_shift.string.number.number.number.number = function(c,sr,sg,sb,so)
+ local r,g,b,o = gears.color.parse_color(c)
+ return "#" .. dec_hex(r*255+sr)
+ .. dec_hex(g*255+sg)
+ .. dec_hex(b*255+sb)
+ .. dec_hex(o*255+so)
+end
+
+color.col_diff = function(f, s)
+ local fr, fg, fb, fo = gears.color.parse_color(f)
+ local sr, sg, sb, so = gears.color.parse_color(s)
+ return sr-fr,sg-fg,sb-fb,so-fo
+end
+--}}}
+return {
+ color = color
+}
diff --git a/config/awesome/module/exit-screen.lua b/config/awesome/module/exit-screen.lua
new file mode 100644
index 0000000..63b0a61
--- /dev/null
+++ b/config/awesome/module/exit-screen.lua
@@ -0,0 +1,185 @@
+local awful = require("awful")
+local gears = require("gears")
+local wibox = require("wibox")
+local beautiful = require("beautiful")
+local dpi = beautiful.xresources.apply_dpi
+local helpers = require("helpers")
+local lock_screen = require("module.lockscreen")
+lock_screen.init()
+
+-- Icons
+local icon_font = "icomoon bold 45"
+local poweroff_text_icon = ""
+local reboot_text_icon = ""
+local suspend_text_icon = ""
+local exit_text_icon = ""
+local lock_text_icon = ""
+
+local button_bg = beautiful.xbackground
+local button_size = dpi(120)
+
+-- Commands
+local poweroff_command = function()
+ awful.spawn.with_shell("systemctl poweroff")
+ awesome.emit_signal("module::exit_screen:hide")
+end
+
+local reboot_command = function()
+ awful.spawn.with_shell("systemctl reboot")
+ awesome.emit_signal("module::exit_screen:hide")
+end
+
+local suspend_command = function()
+ awesome.emit_signal("module::exit_screen:hide")
+ lock_screen_show()
+ awful.spawn.with_shell("systemctl suspend")
+end
+
+local exit_command = function()
+ awesome.quit()
+end
+
+local lock_command = function()
+ awesome.emit_signal("module::exit_screen:hide")
+ lock_screen_show()
+end
+
+-- Helpers
+local create_button = function(symbol, hover_color, text, command)
+ local icon = wibox.widget({
+ forced_height = button_size,
+ forced_width = button_size,
+ align = "center",
+ valign = "center",
+ font = icon_font,
+ markup = helpers.colorize_text(symbol, beautiful.xforeground .. 55),
+ widget = wibox.widget.textbox(),
+ })
+
+ local button = wibox.widget({
+ {
+ nil,
+ icon,
+ expand = "none",
+ layout = wibox.layout.align.horizontal,
+ },
+ forced_height = button_size,
+ forced_width = button_size,
+ border_width = dpi(8),
+ border_color = button_bg,
+ shape = helpers.rrect(dpi(20)),
+ bg = button_bg,
+ widget = wibox.container.background,
+ })
+
+ button:buttons(gears.table.join(awful.button({}, 1, function()
+ command()
+ end)))
+
+ button:connect_signal("mouse::enter", function()
+ icon.markup = helpers.colorize_text(icon.text, hover_color)
+ button.border_color = hover_color
+ end)
+ button:connect_signal("mouse::leave", function()
+ icon.markup = helpers.colorize_text(icon.text, beautiful.xforeground .. 55)
+ button.border_color = beautiful.widget_border_color
+ end)
+
+ helpers.add_hover_cursor(button, "hand1")
+
+ return button
+end
+
+-- Create the buttons
+local poweroff = create_button(poweroff_text_icon, beautiful.xcolor1, "Poweroff", poweroff_command)
+local reboot = create_button(reboot_text_icon, beautiful.xcolor2, "Reboot", reboot_command)
+local suspend = create_button(suspend_text_icon, beautiful.xcolor3, "Suspend", suspend_command)
+local exit = create_button(exit_text_icon, beautiful.xcolor4, "Exit", exit_command)
+local lock = create_button(lock_text_icon, beautiful.xcolor5, "Lock", lock_command)
+
+local create_exit_screen = function(s)
+ s.exit_screen = wibox({
+ screen = s,
+ type = "splash",
+ visible = false,
+ ontop = true,
+ bg = beautiful.transparent,
+ fg = beautiful.fg_normal,
+ height = s.geometry.height,
+ width = s.geometry.width,
+ x = s.geometry.x,
+ y = s.geometry.y,
+ })
+
+ s.exit_screen:buttons(gears.table.join(
+ awful.button({}, 2, function()
+ awesome.emit_signal("module::exit_screen:hide")
+ end),
+ awful.button({}, 3, function()
+ awesome.emit_signal("module::exit_screen:hide")
+ end)
+ ))
+
+ s.exit_screen:setup({
+ nil,
+ {
+ nil,
+ {
+ poweroff,
+ reboot,
+ suspend,
+ exit,
+ lock,
+ spacing = dpi(50),
+ layout = wibox.layout.fixed.horizontal,
+ },
+ expand = "none",
+ layout = wibox.layout.align.horizontal,
+ },
+ expand = "none",
+ layout = wibox.layout.align.vertical,
+ })
+end
+
+screen.connect_signal("request::desktop_decoration", function(s)
+ create_exit_screen(s)
+end)
+
+screen.connect_signal("removed", function(s)
+ create_exit_screen(s)
+end)
+
+local exit_screen_grabber = awful.keygrabber({
+ auto_start = true,
+ stop_event = "release",
+ keypressed_callback = function(self, mod, key, command)
+ if key == "s" then
+ suspend_command()
+ elseif key == "e" then
+ exit_command()
+ elseif key == "l" then
+ lock_command()
+ elseif key == "p" then
+ poweroff_command()
+ elseif key == "r" then
+ reboot_command()
+ elseif key == "Escape" or key == "q" or key == "x" then
+ awesome.emit_signal("module::exit_screen:hide")
+ end
+ end,
+})
+
+awesome.connect_signal("module::exit_screen:show", function()
+ for s in screen do
+ s.exit_screen.visible = false
+ end
+ awful.screen.focused().exit_screen.visible = true
+ exit_screen_grabber:start()
+end)
+
+awesome.connect_signal("module::exit_screen:hide", function()
+ exit_screen_grabber:stop()
+ for s in screen do
+ s.exit_screen.visible = false
+ end
+end)
diff --git a/config/awesome/module/init.lua b/config/awesome/module/init.lua
new file mode 100644
index 0000000..330e9ff
--- /dev/null
+++ b/config/awesome/module/init.lua
@@ -0,0 +1,12 @@
+local gears = require("gears")
+local dock = require("module.dock")
+dock.init(screen.primary, 50, 5, gears.shape.rounded_rect)
+
+require("module.bling")
+require("module.rubato")
+require("module.layout-machi")
+require("module.better-resize")
+require("module.exit-screen")
+require("module.tooltip")
+require("module.savefloats")
+require("module.window_switcher").enable()
diff --git a/config/awesome/module/lockscreen/init.lua b/config/awesome/module/lockscreen/init.lua
new file mode 100644
index 0000000..5a9f122
--- /dev/null
+++ b/config/awesome/module/lockscreen/init.lua
@@ -0,0 +1,18 @@
+local awful = require("awful")
+local gfs = require("gears.filesystem")
+
+local lock_screen = {}
+
+local config_dir = gfs.get_configuration_dir()
+package.cpath = package.cpath .. ";" .. config_dir .. "module/lockscreen/lib/?.so;"
+
+lock_screen.init = function()
+ local pam = require("liblua_pam")
+ lock_screen.authenticate = function(password)
+ return pam.auth_current_user(password)
+ -- return password == "awesome"
+ end
+ require("module.lockscreen.lockscreen")
+end
+
+return lock_screen
diff --git a/config/awesome/module/lockscreen/lib/liblua_pam.so b/config/awesome/module/lockscreen/lib/liblua_pam.so
new file mode 100755
index 0000000..fb05778
Binary files /dev/null and b/config/awesome/module/lockscreen/lib/liblua_pam.so differ
diff --git a/config/awesome/module/lockscreen/lockscreen.lua b/config/awesome/module/lockscreen/lockscreen.lua
new file mode 100644
index 0000000..02068f3
--- /dev/null
+++ b/config/awesome/module/lockscreen/lockscreen.lua
@@ -0,0 +1,410 @@
+-- Standard awesome library
+local gears = require("gears")
+local awful = require("awful")
+
+-- Theme handling library
+local beautiful = require("beautiful")
+
+-- Widget library
+local wibox = require("wibox")
+
+-- Helpers
+local helpers = require("helpers")
+
+-- Lock
+local lock_screen = require("module.lockscreen")
+
+-- Word Clock Lock Screen
+----------------
+
+local lock_screen_symbol = helpers.colorize_text("", beautiful.accent)
+local lock_screen_fail_symbol = helpers.colorize_text("", beautiful.accent)
+local lock_animation_icon = wibox.widget({
+ -- Set forced size to prevent flickering when the icon rotates
+ forced_height = dpi(80),
+ forced_width = dpi(80),
+ font = beautiful.icon_font_name .. "40",
+ align = "center",
+ valign = "center",
+ widget = wibox.widget.textbox(lock_screen_symbol),
+})
+
+local some_textbox = wibox.widget.textbox()
+
+lock_screen_box = wibox({ visible = false, ontop = true, type = "splash", screen = screen.primary })
+awful.placement.maximize(lock_screen_box)
+
+lock_screen_box.bg = beautiful.transparent
+lock_screen_box.fg = beautiful.xforeground
+
+-- Add lockscreen to each screen
+awful.screen.connect_for_each_screen(function(s)
+ if s == screen.primary then
+ s.mylockscreen = lock_screen_box
+ else
+ s.mylockscreen = helpers.screen_mask(s, beautiful.darker_bg)
+ end
+end)
+
+local function set_visibility(v)
+ for s in screen do
+ s.mylockscreen.visible = v
+ end
+end
+
+-- Widgets
+-------------
+
+local char =
+ "I T L I S A S A M P M A C Q U A R T E R D C T W E N T Y F I V E X H A L F S T E N F T O P A S T E R U N I N E O N E S I X T H R E E F O U R F I V E T W O E I G H T E L E V E N S E V E N T W E L V E T E N S E O C L O C K"
+
+local pos_map = {
+ ["it"] = { 1, 2 },
+ ["is"] = { 4, 5 },
+ ["a"] = { 12, 12 },
+ ["quarter"] = { 14, 20 },
+ ["twenty"] = { 23, 28 },
+ ["five"] = { 29, 32 },
+ ["half"] = { 34, 37 },
+ ["ten"] = { 39, 41 },
+ ["past"] = { 45, 48 },
+ ["to"] = { 43, 44 },
+ ["1"] = { 56, 58 },
+ ["2"] = { 75, 77 },
+ ["3"] = { 62, 66 },
+ ["4"] = { 67, 70 },
+ ["5"] = { 71, 74 },
+ ["6"] = { 59, 61 },
+ ["7"] = { 89, 93 },
+ ["8"] = { 78, 82 },
+ ["9"] = { 52, 55 },
+ ["10"] = { 100, 102 },
+ ["11"] = { 83, 88 },
+ ["12"] = { 94, 99 },
+ ["oclock"] = { 105, 110 },
+}
+
+local char_map = {
+ ["it"] = {},
+ ["is"] = {},
+ ["a"] = {},
+ ["quarter"] = {},
+ ["twenty"] = {},
+ ["five"] = {},
+ ["half"] = {},
+ ["ten"] = {},
+ ["past"] = {},
+ ["to"] = {},
+ ["1"] = {},
+ ["2"] = {},
+ ["3"] = {},
+ ["4"] = {},
+ ["5"] = {},
+ ["6"] = {},
+ ["7"] = {},
+ ["8"] = {},
+ ["9"] = {},
+ ["10"] = {},
+ ["11"] = {},
+ ["12"] = {},
+ ["oclock"] = {},
+}
+
+local reset_map = { 4, 12, 14, 23, 29, 34, 39, 43, 45, 52, 56, 59, 62, 67, 71, 75, 78, 83, 89, 94, 100, 105 }
+
+function split_str(s, delimiter)
+ result = {}
+ for match in (s .. delimiter):gmatch("(.-)" .. delimiter) do
+ table.insert(result, match)
+ end
+
+ return result
+end
+
+local time_char = split_str(char, " ")
+
+local time = wibox.widget({
+ forced_num_cols = 11,
+ spacing = beautiful.useless_gap,
+ layout = wibox.layout.grid,
+})
+
+local function create_text_widget(index, w)
+ local text_widget = wibox.widget({
+ id = "t" .. index,
+ markup = w,
+ font = beautiful.font_name .. "bold 18",
+ align = "center",
+ valign = "center",
+ forced_width = dpi(25),
+ forced_height = dpi(30),
+ widget = wibox.widget.textbox,
+ })
+
+ time:add(text_widget)
+
+ return text_widget
+end
+
+local var_count = 0
+for i, m in pairs(time_char) do
+ local text = helpers.colorize_text(m, beautiful.accent .. "55")
+
+ var_count = var_count + 1
+ local create_dummy_text = true
+
+ for j, k in pairs(pos_map) do
+ if i >= pos_map[j][1] and i <= pos_map[j][2] then
+ char_map[j][var_count] = create_text_widget(i, text)
+ create_dummy_text = false
+ end
+
+ for _, n in pairs(reset_map) do
+ if i == n then
+ var_count = 1
+ end
+ end
+ end
+
+ if create_dummy_text then
+ create_text_widget(i, text)
+ end
+end
+
+local function activate_word(w)
+ for i, m in pairs(char_map[w]) do
+ local text = m.text
+
+ m.markup = helpers.colorize_text(text, beautiful.accent)
+ end
+end
+
+local function deactivate_word(w)
+ for i, m in pairs(char_map[w]) do
+ local text = m.text
+ m.markup = helpers.colorize_text(text, beautiful.accent .. "55")
+ end
+end
+
+local function reset_time()
+ for j, k in pairs(char_map) do
+ deactivate_word(j)
+ end
+
+ activate_word("it")
+ activate_word("is")
+end
+
+gears.timer({
+ timeout = 1,
+ call_now = true,
+ autostart = true,
+ callback = function()
+ local time = os.date("%I" .. ":%M")
+ local h, m = time:match("(%d+):(%d+)")
+ local min = tonumber(m)
+ local hour = tonumber(h)
+
+ reset_time()
+
+ if min >= 0 and min <= 2 or min >= 58 and min <= 59 then
+ activate_word("oclock")
+ elseif min >= 3 and min <= 7 or min >= 53 and min <= 57 then
+ activate_word("five")
+ elseif min >= 8 and min <= 12 or min >= 48 and min <= 52 then
+ activate_word("ten")
+ elseif min >= 13 and min <= 17 or min >= 43 and min <= 47 then
+ activate_word("a")
+ activate_word("quarter")
+ elseif min >= 18 and min <= 22 or min >= 38 and min <= 42 then
+ activate_word("twenty")
+ elseif min >= 23 and min <= 27 or min >= 33 and min <= 37 then
+ activate_word("twenty")
+ activate_word("five")
+ elseif min >= 28 and min <= 32 then
+ activate_word("half")
+ end
+
+ if min >= 3 and min <= 32 then
+ activate_word("past")
+ elseif min >= 33 and min <= 57 then
+ activate_word("to")
+ end
+
+ local hh
+
+ if min >= 0 and min <= 30 then
+ hh = hour
+ else
+ hh = hour + 1
+ end
+
+ if hh > 12 then
+ hh = hh - 12
+ end
+
+ activate_word(tostring(hh))
+ end,
+})
+
+-- Lock animation
+local lock_animation_widget_rotate = wibox.container.rotate()
+
+local arc = function()
+ return function(cr, width, height)
+ gears.shape.arc(cr, width, height, dpi(5), 0, math.pi / 2, true, true)
+ end
+end
+
+local lock_animation_arc = wibox.widget({
+ shape = arc(),
+ bg = "#00000000",
+ forced_width = dpi(100),
+ forced_height = dpi(100),
+ widget = wibox.container.background,
+})
+
+local lock_animation = {
+ {
+ lock_animation_arc,
+ widget = lock_animation_widget_rotate,
+ },
+ lock_animation_icon,
+ layout = wibox.layout.stack,
+}
+
+-- Lock helper functions
+local characters_entered = 0
+local function reset()
+ characters_entered = 0
+ lock_animation_icon.markup = lock_screen_symbol
+ lock_animation_widget_rotate.direction = "north"
+ lock_animation_arc.bg = "#00000000"
+end
+
+local function fail()
+ characters_entered = 0
+ lock_animation_icon.markup = lock_screen_fail_symbol
+ lock_animation_widget_rotate.direction = "north"
+ lock_animation_arc.bg = "#00000000"
+end
+
+local animation_colors = {
+ -- Rainbow sequence =)
+ beautiful.xcolor1,
+ beautiful.xcolor5,
+ beautiful.xcolor4,
+ beautiful.xcolor6,
+ beautiful.xcolor2,
+ beautiful.xcolor3,
+}
+
+local animation_directions = { "north", "west", "south", "east" }
+
+-- Function that "animates" every key press
+local function key_animation(char_inserted)
+ local color
+ local direction = animation_directions[(characters_entered % 4) + 1]
+ if char_inserted then
+ color = animation_colors[(characters_entered % 6) + 1]
+ lock_animation_icon.markup = lock_screen_symbol
+ else
+ if characters_entered == 0 then
+ reset()
+ else
+ color = beautiful.accent .. "55"
+ end
+ end
+
+ lock_animation_arc.bg = color
+ lock_animation_widget_rotate.direction = direction
+end
+
+-- Get input from user
+local function grab_password()
+ awful.prompt.run({
+ hooks = {
+ -- Custom escape behaviour: Do not cancel input with Escape
+ -- Instead, this will just clear any input received so far.
+ {
+ {},
+ "Escape",
+ function(_)
+ reset()
+ grab_password()
+ end,
+ },
+ -- Fix for Control+Delete crashing the keygrabber
+ {
+ { "Control" },
+ "Delete",
+ function()
+ reset()
+ grab_password()
+ end,
+ },
+ },
+ keypressed_callback = function(mod, key, cmd)
+ -- Only count single character keys (thus preventing
+ -- "Shift", "Escape", etc from triggering the animation)
+ if #key == 1 then
+ characters_entered = characters_entered + 1
+ key_animation(true)
+ elseif key == "BackSpace" then
+ if characters_entered > 0 then
+ characters_entered = characters_entered - 1
+ end
+ key_animation(false)
+ end
+ end,
+ exe_callback = function(input)
+ -- Check input
+ if lock_screen.authenticate(input) then
+ -- YAY
+ reset()
+ set_visibility(false)
+ else
+ -- NAY
+ fail()
+ grab_password()
+ end
+ end,
+ textbox = some_textbox,
+ })
+end
+
+function lock_screen_show()
+ set_visibility(true)
+ grab_password()
+end
+
+lock_screen_box:setup({
+ -- Horizontal centering
+ nil,
+ {
+ -- Vertical centering
+ nil,
+ {
+ {
+ {
+ helpers.vertical_pad(dpi(10)),
+ time,
+ lock_animation,
+ spacing = dpi(50),
+ layout = wibox.layout.fixed.vertical,
+ },
+ bottom = dpi(60),
+ right = dpi(60),
+ left = dpi(60),
+ widget = wibox.container.margin,
+ },
+ shape = helpers.rrect(beautiful.border_radius),
+ bg = beautiful.darker_bg,
+ widget = wibox.container.background,
+ },
+ expand = "none",
+ layout = wibox.layout.align.vertical,
+ },
+ expand = "none",
+ layout = wibox.layout.align.horizontal,
+})
diff --git a/config/awesome/module/savefloats.lua b/config/awesome/module/savefloats.lua
index f7c7dcf..c605de7 100644
--- a/config/awesome/module/savefloats.lua
+++ b/config/awesome/module/savefloats.lua
@@ -1,43 +1,46 @@
local awful = require("awful")
local function rel(screen, win)
- return {
- x = (win.x - screen.x) / screen.width,
- y = (win.y - screen.y) / screen.height,
- width = win.width / screen.width,
- aspect = win.height / win.width
- }
+ return {
+ x = (win.x - screen.x) / screen.width,
+ y = (win.y - screen.y) / screen.height,
+ width = win.width / screen.width,
+ aspect = win.height / win.width,
+ }
end
local function unrel(s, rel)
- return rel and {
- x = s.x + s.width * rel.x,
- y = s.y + s.height * rel.y,
- width = s.width * rel.width,
- height = rel.aspect * s.width * rel.width
- }
+ return rel
+ and {
+ x = s.x + s.width * rel.x,
+ y = s.y + s.height * rel.y,
+ width = s.width * rel.width,
+ height = rel.aspect * s.width * rel.width,
+ }
end
local stored = {}
-local function forget(c) stored[c] = nil end
+local function forget(c)
+ stored[c] = nil
+end
local floating = awful.layout.suit.floating
function remember(c)
- if floating == awful.layout.get(c.screen) or c.floating then
- stored[c.window] = rel(c.screen.geometry, c:geometry())
- end
+ if floating == awful.layout.get(c.screen) or c.floating then
+ stored[c.window] = rel(c.screen.geometry, c:geometry())
+ end
end
function restore(c)
- local s = stored[c.window]
- if s then
- c:geometry(unrel(c.screen.geometry, stored[c.window]))
- return true
- else
- return false
- end
+ local s = stored[c.window]
+ if s then
+ c:geometry(unrel(c.screen.geometry, stored[c.window]))
+ return true
+ else
+ return false
+ end
end
client.connect_signal("manage", remember)
@@ -45,11 +48,11 @@ client.connect_signal("property::geometry", remember)
client.connect_signal("unmanage", forget)
tag.connect_signal("property::layout", function(t)
- if floating == awful.layout.get(t.screen) then
- for _, c in ipairs(t:clients()) do
- c:geometry(unrel(t.screen.geometry, stored[c.window]))
- end
- end
+ if floating == awful.layout.get(t.screen) then
+ for _, c in ipairs(t:clients()) do
+ c:geometry(unrel(t.screen.geometry, stored[c.window]))
+ end
+ end
end)
return restore
diff --git a/config/awesome/module/tooltip.lua b/config/awesome/module/tooltip.lua
new file mode 100644
index 0000000..0830416
--- /dev/null
+++ b/config/awesome/module/tooltip.lua
@@ -0,0 +1,226 @@
+local gears = require("gears")
+local awful = require("awful")
+local beautiful = require("beautiful")
+local wibox = require("wibox")
+local helpers = require("helpers")
+
+local function create_boxed_widget(widget_to_be_boxed, width, height, inner_pad)
+ local box_container = wibox.container.background()
+ box_container.bg = beautiful.tooltip_widget_bg
+ box_container.forced_height = height
+ box_container.forced_width = width
+ box_container.shape = helpers.rrect(beautiful.tooltip_box_border_radius)
+
+ local inner = dpi(0)
+
+ if inner_pad then
+ inner = beautiful.tooltip_box_margin
+ end
+
+ local boxed_widget = wibox.widget({
+ -- Add margins
+ {
+ -- Add background color
+ {
+ -- The actual widget goes here
+ widget_to_be_boxed,
+ margins = inner,
+ widget = wibox.container.margin,
+ },
+ widget = box_container,
+ },
+ margins = beautiful.tooltip_gap / 2,
+ color = "#FF000000",
+ widget = wibox.container.margin,
+ })
+
+ return boxed_widget
+end
+
+-- Tooltip widgets
+---------------------
+
+awful.screen.connect_for_each_screen(function(s)
+ -- Battery
+ -------------
+ local cute_battery_face = require("ui.widgets.cute-battery-face")
+
+ -- Date
+ ----------
+ local date_day = wibox.widget({
+ font = beautiful.font_name .. "bold 10",
+ format = helpers.colorize_text("%A", beautiful.xforeground),
+ align = "center",
+ valign = "center",
+ widget = wibox.widget.textclock,
+ })
+
+ local date_month = wibox.widget({
+ font = beautiful.font_name .. "bold 14",
+ format = "%d %B %Y",
+ align = "center",
+ valign = "center",
+ widget = wibox.widget.textclock,
+ })
+
+ local date = wibox.widget({
+ date_day,
+ nil,
+ date_month,
+ layout = wibox.layout.align.vertical,
+ })
+
+ -- Separator
+ ---------------
+ local separator = wibox.widget({
+ {
+ bg = beautiful.accent,
+ shape = helpers.rrect(dpi(5)),
+ forced_width = dpi(3),
+ widget = wibox.container.background,
+ },
+ right = dpi(5),
+ widget = wibox.container.margin,
+ })
+
+ -- Analog clock
+ ------------------
+ local analog_clock = require("ui.widgets.analog-clock")
+
+ -- Wifi
+ ----------
+ local wifi_status_icon = wibox.widget({
+ markup = "",
+ font = beautiful.icon_font_name .. "14",
+ valign = "center",
+ align = "center",
+ widget = wibox.widget.textbox,
+ })
+
+ local wifi = wibox.widget({
+ wifi_status_icon,
+ forced_width = dpi(30),
+ forced_height = dpi(30),
+ bg = beautiful.tooltip_bg,
+ shape = gears.shape.circle,
+ widget = wibox.container.background,
+ })
+
+ local wifi_status = false
+
+ awesome.connect_signal("signal::network", function(status, ssid)
+ wifi_status = status
+ awesome.emit_signal("widget::network")
+ end)
+
+ awesome.connect_signal("widget::network", function()
+ local w, fill_color
+ if wifi_status == true then
+ w = ""
+ fill_color = beautiful.xcolor2
+ else
+ w = ""
+ fill_color = beautiful.xcolor1
+ end
+
+ wifi.shape_border_color = fill_color
+ wifi_status_icon.markup = helpers.colorize_text(w, fill_color)
+ end)
+
+ -- UpTime
+ ------------
+ local uptime_label = wibox.widget({
+ font = beautiful.font_name .. "medium 9",
+ markup = helpers.colorize_text("Uptime", beautiful.accent),
+ valign = "center",
+ widget = wibox.widget.textbox,
+ })
+
+ local uptime_text = wibox.widget({
+ font = beautiful.font_name .. "bold 13",
+ markup = helpers.colorize_text("-", beautiful.accent),
+ valign = "center",
+ widget = wibox.widget.textbox,
+ })
+
+ awesome.connect_signal("signal::uptime", function(uptime_value)
+ uptime_text.markup = uptime_value
+ end)
+
+ local uptime_container = wibox.widget({
+ separator,
+ {
+ uptime_label,
+ nil,
+ uptime_text,
+ layout = wibox.layout.align.vertical,
+ },
+ {
+ wifi,
+ layout = wibox.layout.align.vertical,
+ },
+ layout = wibox.layout.align.horizontal,
+ })
+
+ -- Widget
+ ------------
+ local uptime_boxed = create_boxed_widget(uptime_container, dpi(170), dpi(50), true)
+ local analog_clock_boxed = create_boxed_widget(analog_clock, dpi(110), dpi(110), true)
+
+ -- Tooltip setup
+ -------------------
+ s.stats_tooltip = wibox({
+ type = "dock",
+ screen = s,
+ height = beautiful.tooltip_height,
+ width = beautiful.tooltip_width,
+ bg = beautiful.transparent,
+ ontop = true,
+ visible = false,
+ })
+
+ awful.placement.top_right(s.stats_tooltip, {
+ margins = {
+ top = beautiful.useless_gap * 16,
+ bottom = beautiful.useless_gap * 6,
+ left = beautiful.useless_gap * 6,
+ right = beautiful.useless_gap * 6,
+ },
+ })
+
+ s.stats_tooltip:setup({
+ {
+ {
+ {
+ {
+ date,
+ {
+ analog_clock_boxed,
+ nil,
+ cute_battery_face,
+ expand = "none",
+ layout = wibox.layout.fixed.horizontal,
+ },
+ layout = wibox.layout.fixed.vertical,
+ },
+ layout = wibox.layout.fixed.horizontal,
+ },
+ {
+ uptime_boxed,
+ layout = wibox.layout.fixed.horizontal,
+ },
+ layout = wibox.layout.fixed.vertical,
+ },
+ margins = beautiful.tooltip_gap,
+ widget = wibox.container.margin,
+ },
+ shape = helpers.rrect(beautiful.tooltip_border_radius),
+ bg = beautiful.tooltip_bg,
+ widget = wibox.container.background,
+ })
+end)
+
+function tooltip_toggle()
+ local s = awful.screen.focused()
+ s.stats_tooltip.visible = not s.stats_tooltip.visible
+end
diff --git a/config/awesome/module/window_switcher.lua b/config/awesome/module/window_switcher.lua
new file mode 100644
index 0000000..ece26fc
--- /dev/null
+++ b/config/awesome/module/window_switcher.lua
@@ -0,0 +1,390 @@
+local cairo = require("lgi").cairo
+local awful = require("awful")
+local gears = require("gears")
+local wibox = require("wibox")
+local beautiful = require("beautiful")
+local helpers = require("helpers")
+
+local window_switcher_first_client -- The client that was focused when the window_switcher was activated
+local window_switcher_minimized_clients = {} -- The clients that were minimized when the window switcher was activated
+local window_switcher_grabber
+
+local get_num_clients = function()
+ local minimized_clients_in_tag = 0
+ local matcher = function(c)
+ return awful.rules.match(c, {
+ minimized = true,
+ skip_taskbar = false,
+ hidden = false,
+ first_tag = awful.screen.focused().selected_tag,
+ })
+ end
+ for c in awful.client.iterate(matcher) do
+ minimized_clients_in_tag = minimized_clients_in_tag + 1
+ end
+ return minimized_clients_in_tag + #awful.screen.focused().clients
+end
+
+local window_switcher_hide = function(window_switcher_box)
+ -- Add currently focused client to history
+ if client.focus then
+ local window_switcher_last_client = client.focus
+ awful.client.focus.history.add(window_switcher_last_client)
+ -- Raise client that was focused originally
+ -- Then raise last focused client
+ if window_switcher_first_client and window_switcher_first_client.valid then
+ window_switcher_first_client:raise()
+ window_switcher_last_client:raise()
+ end
+ end
+
+ -- Minimize originally minimized clients
+ local s = awful.screen.focused()
+ for _, c in pairs(window_switcher_minimized_clients) do
+ if c and c.valid and not (client.focus and client.focus == c) then
+ c.minimized = true
+ end
+ end
+ -- Reset helper table
+ window_switcher_minimized_clients = {}
+
+ -- Resume recording focus history
+ awful.client.focus.history.enable_tracking()
+ -- Stop and hide window_switcher
+ awful.keygrabber.stop(window_switcher_grabber)
+ window_switcher_box.visible = false
+ window_switcher_box.widget = nil
+ collectgarbage("collect")
+end
+
+local function draw_widget(
+ type,
+ background,
+ border_width,
+ border_radius,
+ border_color,
+ clients_spacing,
+ client_icon_horizontal_spacing,
+ client_width,
+ client_height,
+ client_margins,
+ thumbnail_margins,
+ thumbnail_scale,
+ name_margins,
+ name_valign,
+ name_forced_width,
+ name_font,
+ name_normal_color,
+ name_focus_color,
+ icon_valign,
+ icon_width,
+ mouse_keys
+)
+ local tasklist_widget = awful.widget.tasklist({
+ screen = awful.screen.focused(),
+ filter = awful.widget.tasklist.filter.currenttags,
+ buttons = mouse_keys,
+ style = {
+ font = beautiful.font_name .. "medium 9",
+ fg_normal = beautiful.xforeground,
+ fg_focus = beautiful.accent,
+ },
+ layout = {
+ layout = wibox.layout.flex.horizontal,
+ max_widget_size = dpi(300),
+ spacing = dpi(10),
+ },
+ widget_template = {
+ widget = wibox.container.background,
+ bg = beautiful.lighter_bg,
+ shape = helpers.rrect(beautiful.border_radius),
+ id = "bg_role",
+ forced_width = dpi(450),
+ create_callback = function(self, c, _, __)
+ local content = gears.surface(c.content)
+ local cr = cairo.Context(content)
+ local x, y, w, h = cr:clip_extents()
+ local img = cairo.ImageSurface.create(cairo.Format.ARGB32, w - x, h - y)
+ cr = cairo.Context(img)
+ cr:set_source_surface(content, 0, 0)
+ cr.operator = cairo.Operator.SOURCE
+ cr:paint()
+ self:get_children_by_id("thumbnail")[1].image = gears.surface.load(img)
+ end,
+ {
+ {
+ {
+ {
+ {
+ horizontal_fit_policy = "auto",
+ vertical_fit_policy = "auto",
+ id = "thumbnail",
+ clip_shape = helpers.rrect(dpi(6)),
+ widget = wibox.widget.imagebox,
+ },
+ margins = dpi(0),
+ widget = wibox.container.margin,
+ },
+ halign = "center",
+ valign = "center",
+ widget = wibox.container.place,
+ },
+ {
+ {
+ {
+ widget = awful.widget.clienticon,
+ },
+ forced_width = dpi(30),
+ valign = "center",
+ widget = wibox.container.place,
+ },
+ {
+ {
+ forced_width = dpi(200),
+ valign = "center",
+ id = "text_role",
+ widget = wibox.widget.textbox,
+ },
+ left = dpi(10),
+ right = dpi(10),
+ widget = wibox.container.margin,
+ },
+ layout = wibox.layout.align.horizontal,
+ },
+ layout = wibox.layout.flex.vertical,
+ },
+ left = dpi(20),
+ right = dpi(20),
+ top = dpi(20),
+ widget = wibox.container.margin,
+ },
+ },
+ })
+
+ return wibox.widget({
+ {
+ {
+ tasklist_widget,
+ margins = dpi(300),
+ widget = wibox.container.margin,
+ },
+ halign = "center",
+ content_fill_horizontal = true,
+ widget = wibox.container.place,
+ },
+ bg = "#00000000",
+ widget = wibox.container.background,
+ })
+end
+
+local enable = function(opts)
+ local opts = opts or {}
+
+ local type = opts.type or "thumbnail"
+ local background = beautiful.window_switcher_widget_bg or "#00000000"
+ local border_width = beautiful.window_switcher_widget_border_width or dpi(3)
+ local border_radius = beautiful.window_switcher_widget_border_radius or dpi(6)
+ local border_color = beautiful.window_switcher_widget_border_color or "#ffffff"
+ local clients_spacing = beautiful.window_switcher_clients_spacing or dpi(20)
+ local client_icon_horizontal_spacing = beautiful.window_switcher_client_icon_horizontal_spacing or dpi(5)
+ local client_width = beautiful.window_switcher_client_width or dpi(type == "thumbnail" and 150 or 500)
+ local client_height = beautiful.window_switcher_client_height or dpi(type == "thumbnail" and 250 or 50)
+ local client_margins = beautiful.window_switcher_client_margins or dpi(10)
+ local thumbnail_margins = beautiful.window_switcher_thumbnail_margins or dpi(5)
+ local thumbnail_scale = beautiful.thumbnail_scale or false
+ local name_margins = beautiful.window_switcher_name_margins or dpi(10)
+ local name_valign = beautiful.window_switcher_name_valign or "center"
+ local name_forced_width = beautiful.window_switcher_name_forced_width or dpi(type == "thumbnail" and 200 or 550)
+ local name_font = beautiful.window_switcher_name_font or beautiful.font_name .. "medium 10"
+ local name_normal_color = beautiful.window_switcher_name_normal_color or beautiful.xforeground
+ local name_focus_color = beautiful.window_switcher_name_focus_color or beautiful.accent
+ local icon_valign = beautiful.window_switcher_icon_valign or "center"
+ local icon_width = beautiful.window_switcher_icon_width or dpi(40)
+ local hide_window_switcher_key = opts.hide_window_switcher_key or "Escape"
+ local select_client_key = opts.select_client_key or 1
+ local minimize_key = opts.minimize_key or "n"
+ local unminimize_key = opts.unminimize_key or "N"
+ local kill_client_key = opts.kill_client_key or "q"
+ local cycle_key = opts.cycle_key or "Tab"
+ local previous_key = opts.previous_key or "Left"
+ local next_key = opts.next_key or "Right"
+ local vim_previous_key = opts.vim_previous_key or "h"
+ local vim_next_key = opts.vim_next_key or "l"
+ local scroll_previous_key = opts.scroll_previous_key or 4
+ local scroll_next_key = opts.scroll_next_key or 5
+ local window_switcher_box = wibox({
+ bg = "#00000000",
+ visible = false,
+ ontop = true,
+ type = "splash",
+ screen = awful.screen.focused(),
+ widget = wibox.container.background, -- A dummy widget to make awful.popup not scream
+ widget = {
+ {
+ draw_widget(),
+ margins = dpi(10),
+ widget = wibox.container.margin,
+ },
+ shape_border_width = beautiful.widget_border_width,
+ shape_border_color = beautiful.widget_border_color,
+ bg = "#00000000",
+ shape = helpers.rrect(dpi(6)),
+ widget = wibox.container.background,
+ },
+ })
+
+ awful.placement.maximize(window_switcher_box)
+
+ local mouse_keys = gears.table.join(
+ awful.button({
+ modifiers = { "Any" },
+ button = select_client_key,
+ on_press = function(c)
+ client.focus = c
+ end,
+ }),
+
+ awful.button({
+ modifiers = { "Any" },
+ button = scroll_previous_key,
+ on_press = function()
+ awful.client.focus.byidx(-1)
+ end,
+ }),
+
+ awful.button({
+ modifiers = { "Any" },
+ button = scroll_next_key,
+ on_press = function()
+ awful.client.focus.byidx(1)
+ end,
+ })
+ )
+
+ local keyboard_keys = {
+ [hide_window_switcher_key] = function()
+ window_switcher_hide(window_switcher_box)
+ end,
+
+ [minimize_key] = function()
+ if client.focus then
+ client.focus.minimized = true
+ end
+ end,
+ [unminimize_key] = function()
+ if awful.client.restore() then
+ client.focus = awful.client.restore()
+ end
+ end,
+ [kill_client_key] = function()
+ if client.focus then
+ client.focus:kill()
+ end
+ end,
+
+ [cycle_key] = function()
+ awful.client.focus.byidx(1)
+ end,
+
+ [previous_key] = function()
+ awful.client.focus.byidx(1)
+ end,
+ [next_key] = function()
+ awful.client.focus.byidx(-1)
+ end,
+
+ [vim_previous_key] = function()
+ awful.client.focus.byidx(1)
+ end,
+ [vim_next_key] = function()
+ awful.client.focus.byidx(-1)
+ end,
+ }
+
+ window_switcher_box:connect_signal("property::width", function()
+ if window_switcher_box.visible and get_num_clients() == 0 then
+ window_switcher_hide(window_switcher_box)
+ end
+ end)
+
+ window_switcher_box:connect_signal("property::height", function()
+ if window_switcher_box.visible and get_num_clients() == 0 then
+ window_switcher_hide(window_switcher_box)
+ end
+ end)
+
+ awesome.connect_signal("bling::window_switcher::turn_on", function()
+ local number_of_clients = get_num_clients()
+ if number_of_clients == 0 then
+ return
+ end
+
+ -- Store client that is focused in a variable
+ window_switcher_first_client = client.focus
+
+ -- Stop recording focus history
+ awful.client.focus.history.disable_tracking()
+
+ -- Go to previously focused client (in the tag)
+ awful.client.focus.history.previous()
+
+ -- Track minimized clients
+ -- Unminimize them
+ -- Lower them so that they are always below other
+ -- originally unminimized windows
+ local clients = awful.screen.focused().selected_tag:clients()
+ for _, c in pairs(clients) do
+ if c.minimized then
+ table.insert(window_switcher_minimized_clients, c)
+ c.minimized = false
+ c:lower()
+ end
+ end
+
+ -- Start the keygrabber
+ window_switcher_grabber = awful.keygrabber.run(function(_, key, event)
+ if event == "release" then
+ -- Hide if the modifier was released
+ -- We try to match Super or Alt or Control since we do not know which keybind is
+ -- used to activate the window switcher (the keybind is set by the user in keys.lua)
+ if key:match("Super") or key:match("Alt") or key:match("Control") then
+ window_switcher_hide(window_switcher_box)
+ end
+ -- Do nothing
+ return
+ end
+
+ -- Run function attached to key, if it exists
+ if keyboard_keys[key] then
+ keyboard_keys[key]()
+ end
+ end)
+
+ window_switcher_box.widget = draw_widget(
+ type,
+ background,
+ border_width,
+ border_radius,
+ border_color,
+ clients_spacing,
+ client_icon_horizontal_spacing,
+ client_width,
+ client_height,
+ client_margins,
+ thumbnail_margins,
+ thumbnail_scale,
+ name_margins,
+ name_valign,
+ name_forced_width,
+ name_font,
+ name_normal_color,
+ name_focus_color,
+ icon_valign,
+ icon_width,
+ mouse_keys
+ )
+ window_switcher_box.visible = true
+ end)
+end
+
+return { enable = enable }
diff --git a/config/awesome/rc.lua b/config/awesome/rc.lua
index d42d51d..783e26e 100644
--- a/config/awesome/rc.lua
+++ b/config/awesome/rc.lua
@@ -1,51 +1,60 @@
+pcall(require, "luarocks.loader")
--[[
_____ __ _ __ _____ _____ _____ _______ _____
| | | | | ___| ___| | | ___|
| - | | | | ___|___ | | | | | | ___|
|__|__|_______|_____|_____|_____|__|_|__|_____|
- ~ AestheticArch ~
- rxyhn
+
+============== @author rxyhn ==================
+======== https://github.com/rxyhn =============
--]]
-pcall(require, "luarocks.loader")
--- Standard awesome library
-local gfs = require("gears.filesystem")
-local awful = require("awful")
-
--- Theme handling library
-local beautiful = require("beautiful")
-dpi = beautiful.xresources.apply_dpi
-beautiful.init(gfs.get_configuration_dir() .. "theme/theme.lua")
-
--- Default Applications
+-- 🎨 Themes
+themes = {
+ "day", -- [1] 🌕 Beautiful Light Colorscheme
+ "night", -- [2] 🌑 Aesthetic Dark Colorscheme
+}
+theme = themes[2]
+-- ===================================================================
+-- 🌊 Default Applications
terminal = "kitty"
-editor = "emacs -nw"
-vscode = "emacs -nw"
+editor = "nvim"
+vscode = "code"
browser = "firefox"
-launcher = "rofi -show drun -theme " .. os.getenv("HOME") .. "/.config/awesome/theme/rofi.rasi"
+web_search_cmd = "xdg-open https://google.com/search?q="
file_manager = "nautilus"
-music_client = "kitty --class music byobu"
+music_client = terminal .. " --class music -e ncmpcpp"
--- Weather API
+-- 🌏 Weather API
openweathermap_key = "" -- API Key
openweathermap_city_id = "" -- City ID
-weather_units = "metric" -- Unit
-
--- Global Vars
+weather_units = "metric"
+-- ===================================================================
+-- 📚 Library
+local gfs = require("gears.filesystem")
+local awful = require("awful")
+local beautiful = require("beautiful")
+dpi = beautiful.xresources.apply_dpi
+-- ===================================================================
+-- 🌟 Load theme
+local theme_dir = gfs.get_configuration_dir() .. "theme/" .. theme .. "/"
+beautiful.init(theme_dir .. "theme.lua")
+-- ===================================================================
+-- 🖥 Get screen geometry
screen_width = awful.screen.focused().geometry.width
screen_height = awful.screen.focused().geometry.height
-
--- Autostart
+-- ===================================================================
+-- 🚀 Launch Autostart
awful.spawn.with_shell(gfs.get_configuration_dir() .. "configuration/autostart")
-
--- Import Configuration
+-- ===================================================================
+-- 🤖 Import Configuration & module
require("configuration")
-
--- Import Daemons and Widgets
+require("module")
+-- ===================================================================
+-- ✨ Import Daemons, UI & Widgets
require("signal")
require("ui")
-
--- Garbage Collector Settings
+-- ===================================================================
+-- 🗑 Garbage Collector Settings
collectgarbage("setpause", 110)
collectgarbage("setstepmul", 1000)
-
diff --git a/config/awesome/signal/battery.lua b/config/awesome/signal/battery.lua
index a7945dd..73f13b4 100644
--- a/config/awesome/signal/battery.lua
+++ b/config/awesome/signal/battery.lua
@@ -18,42 +18,51 @@ local charger_script = [[
-- First get battery file path
-- If there are multiple, only get the first one
-- TODO support multiple batteries
-awful.spawn.easy_async_with_shell("sh -c 'out=\"$(find /sys/class/power_supply/BAT?/capacity)\" && (echo \"$out\" | head -1) || false' ", function (battery_file, _, __, exit_code)
- -- No battery file found
- if not (exit_code == 0) then
- return
- end
- -- Periodically get battery info
- awful.widget.watch("cat "..battery_file, update_interval, function(_, stdout)
- -- awful.widget.watch("check-battery", update_interval, function(_, stdout)
- awesome.emit_signal("signal::battery", tonumber(stdout))
- end)
-end)
+awful.spawn.easy_async_with_shell(
+ 'sh -c \'out="$(find /sys/class/power_supply/BAT?/capacity)" && (echo "$out" | head -1) || false\' ',
+ function(battery_file, _, __, exit_code)
+ -- No battery file found
+ if not (exit_code == 0) then
+ return
+ end
+ -- Periodically get battery info
+ awful.widget.watch("cat " .. battery_file, update_interval, function(_, stdout)
+ -- awful.widget.watch("check-battery", update_interval, function(_, stdout)
+ awesome.emit_signal("signal::battery", tonumber(stdout))
+ end)
+ end
+)
-- First get charger file path
-awful.spawn.easy_async_with_shell("sh -c 'out=\"$(find /sys/class/power_supply/*/online)\" && (echo \"$out\" | head -1) || false' ", function (charger_file, _, __, exit_code)
- -- No charger file found
- if not (exit_code == 0) then
- return
- end
- -- Then initialize function that emits charger info
- local emit_charger_info = function()
- awful.spawn.easy_async_with_shell("cat "..charger_file, function (out)
- local status = tonumber(out) == 1
- awesome.emit_signal("signal::charger", status)
- end)
- end
+awful.spawn.easy_async_with_shell(
+ 'sh -c \'out="$(find /sys/class/power_supply/*/online)" && (echo "$out" | head -1) || false\' ',
+ function(charger_file, _, __, exit_code)
+ -- No charger file found
+ if not (exit_code == 0) then
+ return
+ end
+ -- Then initialize function that emits charger info
+ local emit_charger_info = function()
+ awful.spawn.easy_async_with_shell("cat " .. charger_file, function(out)
+ local status = tonumber(out) == 1
+ awesome.emit_signal("signal::charger", status)
+ end)
+ end
- -- Run once to initialize widgets
- emit_charger_info()
+ -- Run once to initialize widgets
+ emit_charger_info()
- -- Kill old acpi_listen process
- awful.spawn.easy_async_with_shell("ps x | grep \"acpi_listen\" | grep -v grep | awk '{print $1}' | xargs kill", function ()
- -- Update charger status with each line printed
- awful.spawn.with_line_callback(charger_script, {
- stdout = function(_)
- emit_charger_info()
- end
- })
- end)
-end)
+ -- Kill old acpi_listen process
+ awful.spawn.easy_async_with_shell(
+ "ps x | grep \"acpi_listen\" | grep -v grep | awk '{print $1}' | xargs kill",
+ function()
+ -- Update charger status with each line printed
+ awful.spawn.with_line_callback(charger_script, {
+ stdout = function(_)
+ emit_charger_info()
+ end,
+ })
+ end
+ )
+ end
+)
diff --git a/config/awesome/signal/brightness.lua b/config/awesome/signal/brightness.lua
index 61f43b8..9273f30 100644
--- a/config/awesome/signal/brightness.lua
+++ b/config/awesome/signal/brightness.lua
@@ -16,23 +16,26 @@ local brightness_script = [[
"]]
local emit_brightness_info = function()
- awful.spawn.with_line_callback(brightness_script, {
- stdout = function(line)
- percentage = math.floor(tonumber(line))
- awesome.emit_signal("signal::brightness", percentage)
- end
- })
+ awful.spawn.with_line_callback(brightness_script, {
+ stdout = function(line)
+ percentage = math.floor(tonumber(line))
+ awesome.emit_signal("signal::brightness", percentage)
+ end,
+ })
end
-- Run once to initialize widgets
emit_brightness_info()
-- Kill old inotifywait process
-awful.spawn.easy_async_with_shell("ps x | grep \"inotifywait -e modify /sys/class/backlight\" | grep -v grep | awk '{print $1}' | xargs kill", function ()
- -- Update brightness status with each line printed
- awful.spawn.with_line_callback(brightness_subscribe_script, {
- stdout = function(_)
- emit_brightness_info()
- end
- })
-end)
+awful.spawn.easy_async_with_shell(
+ "ps x | grep \"inotifywait -e modify /sys/class/backlight\" | grep -v grep | awk '{print $1}' | xargs kill",
+ function()
+ -- Update brightness status with each line printed
+ awful.spawn.with_line_callback(brightness_subscribe_script, {
+ stdout = function(_)
+ emit_brightness_info()
+ end,
+ })
+ end
+)
diff --git a/config/awesome/signal/cpu.lua b/config/awesome/signal/cpu.lua
index f1492de..bdbf8e4 100644
--- a/config/awesome/signal/cpu.lua
+++ b/config/awesome/signal/cpu.lua
@@ -11,8 +11,8 @@ local cpu_idle_script = [[
-- Periodically get cpu info
awful.widget.watch(cpu_idle_script, update_interval, function(widget, stdout)
- -- local cpu_idle = stdout:match('+(.*)%.%d...(.*)%(')
- local cpu_idle = stdout
- cpu_idle = string.gsub(cpu_idle, '^%s*(.-)%s*$', '%1')
- awesome.emit_signal("signal::cpu", 100 - tonumber(cpu_idle))
+ -- local cpu_idle = stdout:match('+(.*)%.%d...(.*)%(')
+ local cpu_idle = stdout
+ cpu_idle = string.gsub(cpu_idle, "^%s*(.-)%s*$", "%1")
+ awesome.emit_signal("signal::cpu", 100 - tonumber(cpu_idle))
end)
diff --git a/config/awesome/signal/disk.lua b/config/awesome/signal/disk.lua
index 005d275..7296932 100644
--- a/config/awesome/signal/disk.lua
+++ b/config/awesome/signal/disk.lua
@@ -10,16 +10,16 @@ local update_interval = 180 -- every 3 minutes
-- Use /dev/sdxY according to your setup
local disk_script = [[
bash -c "
- df -kH -B 1MB /dev/sda7 | tail -1 | awk '{printf \"%d@%d\", $4, $3}'
+ df -kH -B 1MB /dev/sda3 | tail -1 | awk '{printf \"%d@%d\", $4, $3}'
"
]]
-- Periodically get disk space info
awful.widget.watch(disk_script, update_interval, function(_, stdout)
- -- Get `available` and `used` instead of `used` and `total`,
- -- since the total size reported by the `df` command includes
- -- the 5% storage reserved for `root`, which is misleading.
- local available = tonumber(stdout:match('^(.*)@')) / 1000
- local used = tonumber(stdout:match('@(.*)$')) / 1000
- awesome.emit_signal("signal::disk", used, used + available)
+ -- Get `available` and `used` instead of `used` and `total`,
+ -- since the total size reported by the `df` command includes
+ -- the 5% storage reserved for `root`, which is misleading.
+ local available = tonumber(stdout:match("^(.*)@")) / 1000
+ local used = tonumber(stdout:match("@(.*)$")) / 1000
+ awesome.emit_signal("signal::disk", used, used + available)
end)
diff --git a/config/awesome/signal/init.lua b/config/awesome/signal/init.lua
index a4272d7..1d21ffe 100644
--- a/config/awesome/signal/init.lua
+++ b/config/awesome/signal/init.lua
@@ -1,8 +1,11 @@
require("signal.battery")
require("signal.brightness")
-require("signal.volume")
require("signal.cpu")
-require("signal.ram")
-require("signal.weather")
+require("signal.disk")
require("signal.network")
+require("signal.playerctl")
+require("signal.ram")
+require("signal.todo")
require("signal.uptime")
+require("signal.volume")
+require("signal.weather")
\ No newline at end of file
diff --git a/config/awesome/signal/network.lua b/config/awesome/signal/network.lua
index 55722c2..05c4680 100644
--- a/config/awesome/signal/network.lua
+++ b/config/awesome/signal/network.lua
@@ -13,15 +13,14 @@ local network_script = [[
-- Periodically get cpu info
awful.widget.watch(network_script, update_interval, function(_, stdout)
- -- local network = stdout:match('+(.*)%.%d...(.*)%(')
- local net_ssid = stdout
- local net_status = true
+ -- local network = stdout:match('+(.*)%.%d...(.*)%(')
+ local net_ssid = stdout
+ local net_status = true
- if net_ssid == "" then
- net_status = false
- end
+ if net_ssid == "" then
+ net_status = false
+ end
- net_ssid = string.gsub(net_ssid, '^%s*(.-)%s*$', '%1')
- awesome.emit_signal("signal::network", net_status, net_ssid)
+ net_ssid = string.gsub(net_ssid, "^%s*(.-)%s*$", "%1")
+ awesome.emit_signal("signal::network", net_status, net_ssid)
end)
-
diff --git a/config/awesome/signal/playerctl.lua b/config/awesome/signal/playerctl.lua
index 330058b..40ef01a 100644
--- a/config/awesome/signal/playerctl.lua
+++ b/config/awesome/signal/playerctl.lua
@@ -5,12 +5,12 @@ local naughty = require("naughty")
local playerctl = require("module.bling").signal.playerctl.lib()
playerctl:connect_signal("metadata", function(_, title, artist, album_path, album, new, player_name)
- if new == true then
- naughty.notify ({
- app_name = 'Music',
- title = title,
- text = artist,
- image = album_path
- })
- end
+ if new == true then
+ naughty.notify({
+ app_name = "Music",
+ title = title,
+ text = artist,
+ image = album_path,
+ })
+ end
end)
diff --git a/config/awesome/signal/ram.lua b/config/awesome/signal/ram.lua
index 649be18..2a5bfb5 100644
--- a/config/awesome/signal/ram.lua
+++ b/config/awesome/signal/ram.lua
@@ -16,8 +16,8 @@ local ram_script = [[
-- Periodically get ram info
awful.widget.watch(ram_script, update_interval, function(widget, stdout)
- local available = stdout:match('(.*)@@')
- local total = stdout:match('@@(.*)@')
- local used = tonumber(total) - tonumber(available)
- awesome.emit_signal("signal::ram", used, tonumber(total))
+ local available = stdout:match("(.*)@@")
+ local total = stdout:match("@@(.*)@")
+ local used = tonumber(total) - tonumber(available)
+ awesome.emit_signal("signal::ram", used, tonumber(total))
end)
diff --git a/config/awesome/signal/todo.lua b/config/awesome/signal/todo.lua
index 6def273..8a47aaa 100644
--- a/config/awesome/signal/todo.lua
+++ b/config/awesome/signal/todo.lua
@@ -5,7 +5,7 @@
-- undone (integer)
local awful = require("awful")
-local todo_file_path = os.getenv("TODO_PATH")
+local todo_file_path = "~/.config/awesome/"
-- Subscribe to todo changes
-- Requires inotify-tools
@@ -23,26 +23,28 @@ local todo_script = [[
"]]
local emit_todo_info = function()
- awful.spawn.with_line_callback(todo_script, {
- stdout = function(line)
- local done = tonumber(line:match('(.*)@@'))
- local undone = tonumber(line:match('@@(.*)'))
- local total = undone + done
- awesome.emit_signal("signal::todo", total, done, undone)
- end
- })
+ awful.spawn.with_line_callback(todo_script, {
+ stdout = function(line)
+ local done = tonumber(line:match("(.*)@@"))
+ local undone = tonumber(line:match("@@(.*)"))
+ local total = undone + done
+ awesome.emit_signal("signal::todo", total, done, undone)
+ end,
+ })
end
-- Run once to initialize widgets
emit_todo_info()
-- Kill old inotifywait process
-awful.spawn.easy_async_with_shell("ps x | grep \"inotifywait -e modify " .. todo_file_path .. "\" | grep -v grep | awk '{print $1}' | xargs kill", function ()
- -- Update todo status with each line printed
- awful.spawn.with_line_callback(todo_subscribe_script, {
- stdout = function(_)
- emit_todo_info()
- end
- })
-end)
-
+awful.spawn.easy_async_with_shell(
+ 'ps x | grep "inotifywait -e modify ' .. todo_file_path .. "\" | grep -v grep | awk '{print $1}' | xargs kill",
+ function()
+ -- Update todo status with each line printed
+ awful.spawn.with_line_callback(todo_subscribe_script, {
+ stdout = function(_)
+ emit_todo_info()
+ end,
+ })
+ end
+)
diff --git a/config/awesome/signal/uptime.lua b/config/awesome/signal/uptime.lua
index 10b5a07..5ac010c 100644
--- a/config/awesome/signal/uptime.lua
+++ b/config/awesome/signal/uptime.lua
@@ -40,9 +40,8 @@ local update_interval = 60
-- Periodically get uptime info
awful.widget.watch(uptime_script, update_interval, function(_, stdout)
- local uptime_value = stdout
+ local uptime_value = stdout
- uptime_value = string.gsub(uptime_value, '^%s*(.-)%s*$', '%1')
- awesome.emit_signal("signal::uptime", uptime_value)
+ uptime_value = string.gsub(uptime_value, "^%s*(.-)%s*$", "%1")
+ awesome.emit_signal("signal::uptime", uptime_value)
end)
-
diff --git a/config/awesome/signal/volume.lua b/config/awesome/signal/volume.lua
index c8478cb..5b929f5 100644
--- a/config/awesome/signal/volume.lua
+++ b/config/awesome/signal/volume.lua
@@ -7,30 +7,31 @@ local awful = require("awful")
local volume_old = -1
local muted_old = -1
local function emit_volume_info()
- -- Get volume info of the currently active sink
- -- The currently active sink has a star `*` in front of its index
- -- In the output of `pacmd list-sinks`, lines +7 and +11 after "* index:"
- -- contain the volume level and muted state respectively
- -- This is why we are using `awk` to print them.
- awful.spawn.easy_async_with_shell(
- "pacmd list-sinks | awk '/\\* index: /{nr[NR+7];nr[NR+11]}; NR in nr'",
- function(stdout)
- local volume = stdout:match('(%d+)%% /')
- local muted = stdout:match('muted:(%s+)[yes]')
- local muted_int = muted and 1 or 0
- local volume_int = tonumber(volume)
- -- Only send signal if there was a change
- -- We need this since we use `pactl subscribe` to detect
- -- volume events. These are not only triggered when the
- -- user adjusts the volume through a keybind, but also
- -- through `pavucontrol` or even without user intervention,
- -- when a media file starts playing.
- if volume_int ~= volume_old or muted_int ~= muted_old then
- awesome.emit_signal("signal::volume", volume_int, muted)
- volume_old = volume_int
- muted_old = muted_int
- end
- end)
+ -- Get volume info of the currently active sink
+ -- The currently active sink has a star `*` in front of its index
+ -- In the output of `pacmd list-sinks`, lines +7 and +11 after "* index:"
+ -- contain the volume level and muted state respectively
+ -- This is why we are using `awk` to print them.
+ awful.spawn.easy_async_with_shell(
+ "pacmd list-sinks | awk '/\\* index: /{nr[NR+7];nr[NR+11]}; NR in nr'",
+ function(stdout)
+ local volume = stdout:match("(%d+)%% /")
+ local muted = stdout:match("muted:(%s+)[yes]")
+ local muted_int = muted and 1 or 0
+ local volume_int = tonumber(volume)
+ -- Only send signal if there was a change
+ -- We need this since we use `pactl subscribe` to detect
+ -- volume events. These are not only triggered when the
+ -- user adjusts the volume through a keybind, but also
+ -- through `pavucontrol` or even without user intervention,
+ -- when a media file starts playing.
+ if volume_int ~= volume_old or muted_int ~= muted_old then
+ awesome.emit_signal("signal::volume", volume_int, muted)
+ volume_old = volume_int
+ muted_old = muted_int
+ end
+ end
+ )
end
-- Run once to initialize widgets
@@ -42,15 +43,18 @@ local volume_script = [[
LANG=C pactl subscribe 2> /dev/null | grep --line-buffered \"Event 'change' on sink #\"
"]]
-
-- Kill old pactl subscribe processes
awful.spawn.easy_async({
- "pkill", "--full", "--uid", os.getenv("USER"), "^pactl subscribe"
-}, function ()
- -- Run emit_volume_info() with each line printed
- awful.spawn.with_line_callback(volume_script, {
- stdout = function(line) emit_volume_info() end
- })
+ "pkill",
+ "--full",
+ "--uid",
+ os.getenv("USER"),
+ "^pactl subscribe",
+}, function()
+ -- Run emit_volume_info() with each line printed
+ awful.spawn.with_line_callback(volume_script, {
+ stdout = function(line)
+ emit_volume_info()
+ end,
+ })
end)
-
-
diff --git a/config/awesome/signal/weather.lua b/config/awesome/signal/weather.lua
index 368d4c6..e7f70c7 100644
--- a/config/awesome/signal/weather.lua
+++ b/config/awesome/signal/weather.lua
@@ -13,7 +13,7 @@ local city_id = openweathermap_city_id
local units = weather_units
-- Don't update too often, because your requests might get blocked for 24 hours
local update_interval = 1200
-local temp_file = "/tmp/awesomewm-signal-weather-"..city_id.."-"..units
+local temp_file = "/tmp/awesomewm-signal-weather-" .. city_id .. "-" .. units
local sun_icon = ""
local moon_icon = ""
@@ -27,34 +27,34 @@ local mist_icon = ""
local whatever_icon = ""
local weather_icons = {
- ["01d"] = { icon = sun_icon, color = beautiful.xcolor3 },
- ["01n"] = { icon = moon_icon, color = beautiful.xcolor4 },
- ["02d"] = { icon = dcloud_icon, color = beautiful.xcolor3 },
- ["02n"] = { icon = ncloud_icon, color = beautiful.xcolor6 },
- ["03d"] = { icon = cloud_icon, color = beautiful.xforeground },
- ["03n"] = { icon = cloud_icon, color = beautiful.xforeground },
- ["04d"] = { icon = cloud_icon, color = beautiful.xforeground },
- ["04n"] = { icon = cloud_icon, color = beautiful.xforeground },
- ["09d"] = { icon = rain_icon, color = beautiful.xcolor4 },
- ["09n"] = { icon = rain_icon, color = beautiful.xcolor4 },
- ["10d"] = { icon = rain_icon, color = beautiful.xcolor4 },
- ["10n"] = { icon = rain_icon, color = beautiful.xcolor4 },
- ["11d"] = { icon = storm_icon, color = beautiful.xforeground },
- ["11n"] = { icon = storm_icon, color = beautiful.xforeground },
- ["13d"] = { icon = snow_icon, color = beautiful.xcolor6 },
- ["13n"] = { icon = snow_icon, color = beautiful.xcolor6 },
- ["40d"] = { icon = mist_icon, color = beautiful.xcolor5 },
- ["40n"] = { icon = mist_icon, color = beautiful.xcolor5 },
- ["50d"] = { icon = mist_icon, color = beautiful.xcolor5 },
- ["50n"] = { icon = mist_icon, color = beautiful.xcolor5 },
- ["_"] = { icon = whatever_icon, color = beautiful.xcolor2 },
+ ["01d"] = { icon = sun_icon, color = beautiful.xcolor3 },
+ ["01n"] = { icon = moon_icon, color = beautiful.xcolor4 },
+ ["02d"] = { icon = dcloud_icon, color = beautiful.xcolor3 },
+ ["02n"] = { icon = ncloud_icon, color = beautiful.xcolor6 },
+ ["03d"] = { icon = cloud_icon, color = beautiful.xforeground },
+ ["03n"] = { icon = cloud_icon, color = beautiful.xforeground },
+ ["04d"] = { icon = cloud_icon, color = beautiful.xforeground },
+ ["04n"] = { icon = cloud_icon, color = beautiful.xforeground },
+ ["09d"] = { icon = rain_icon, color = beautiful.xcolor4 },
+ ["09n"] = { icon = rain_icon, color = beautiful.xcolor4 },
+ ["10d"] = { icon = rain_icon, color = beautiful.xcolor4 },
+ ["10n"] = { icon = rain_icon, color = beautiful.xcolor4 },
+ ["11d"] = { icon = storm_icon, color = beautiful.xforeground },
+ ["11n"] = { icon = storm_icon, color = beautiful.xforeground },
+ ["13d"] = { icon = snow_icon, color = beautiful.xcolor6 },
+ ["13n"] = { icon = snow_icon, color = beautiful.xcolor6 },
+ ["40d"] = { icon = mist_icon, color = beautiful.xcolor5 },
+ ["40n"] = { icon = mist_icon, color = beautiful.xcolor5 },
+ ["50d"] = { icon = mist_icon, color = beautiful.xcolor5 },
+ ["50n"] = { icon = mist_icon, color = beautiful.xcolor5 },
+ ["_"] = { icon = whatever_icon, color = beautiful.xcolor2 },
}
local weather_details_script = [[
bash -c '
- KEY="]]..key..[["
- CITY="]]..city_id..[["
- UNITS="]]..units..[["
+ KEY="]] .. key .. [["
+ CITY="]] .. city_id .. [["
+ UNITS="]] .. units .. [["
weather=$(curl -sf "http://api.openweathermap.org/data/2.5/weather?APPID=$KEY&id=$CITY&units=$UNITS")
@@ -70,31 +70,30 @@ local weather_details_script = [[
']]
helpers.remote_watch(weather_details_script, update_interval, temp_file, function(stdout)
- local icon_code = string.sub(stdout, 1, 3)
- local weather_details = string.sub(stdout, 5)
- weather_details = string.gsub(weather_details, '^%s*(.-)%s*$', '%1')
- -- Replace "-0" with "0" degrees
- weather_details = string.gsub(weather_details, '%-0', '0')
- -- Capitalize first letter of the description
- weather_details = weather_details:sub(1,1):upper()..weather_details:sub(2)
- local description = weather_details:match('(.*)@@')
- local temperature = weather_details:match('@@(.*)')
- local icon
- local color
- local weather_icon
+ local icon_code = string.sub(stdout, 1, 3)
+ local weather_details = string.sub(stdout, 5)
+ weather_details = string.gsub(weather_details, "^%s*(.-)%s*$", "%1")
+ -- Replace "-0" with "0" degrees
+ weather_details = string.gsub(weather_details, "%-0", "0")
+ -- Capitalize first letter of the description
+ weather_details = weather_details:sub(1, 1):upper() .. weather_details:sub(2)
+ local description = weather_details:match("(.*)@@")
+ local temperature = weather_details:match("@@(.*)")
+ local icon
+ local color
+ local weather_icon
- if icon_code == "..." then
- -- Remove temp_file to force an update the next time
- awful.spawn.with_shell("rm "..temp_file)
- icon = weather_icons['_'].icon
- color = weather_icons['_'].color
- weather_icon = helpers.colorize_text(icon, color)
- awesome.emit_signal("signal::weather", 999, "Weather unavailable", weather_icon)
- else
- icon = weather_icons[icon_code].icon
- color = weather_icons[icon_code].color
- weather_icon = helpers.colorize_text(icon, color)
- awesome.emit_signal("signal::weather", tonumber(temperature), description, weather_icon)
- end
+ if icon_code == "..." then
+ -- Remove temp_file to force an update the next time
+ awful.spawn.with_shell("rm " .. temp_file)
+ icon = weather_icons["_"].icon
+ color = weather_icons["_"].color
+ weather_icon = helpers.colorize_text(icon, color)
+ awesome.emit_signal("signal::weather", 999, "Weather unavailable", weather_icon)
+ else
+ icon = weather_icons[icon_code].icon
+ color = weather_icons[icon_code].color
+ weather_icon = helpers.colorize_text(icon, color)
+ awesome.emit_signal("signal::weather", tonumber(temperature), description, weather_icon)
+ end
end)
-
diff --git a/config/awesome/theme/assets/icons/awesome_logo.svg b/config/awesome/theme/assets/icons/awesome_logo.svg
new file mode 100644
index 0000000..80ae1a3
--- /dev/null
+++ b/config/awesome/theme/assets/icons/awesome_logo.svg
@@ -0,0 +1,9 @@
+
+
diff --git a/config/awesome/theme/assets/icons/awesome_logo_and_name.svg b/config/awesome/theme/assets/icons/awesome_logo_and_name.svg
new file mode 100644
index 0000000..1338398
--- /dev/null
+++ b/config/awesome/theme/assets/icons/awesome_logo_and_name.svg
@@ -0,0 +1,9 @@
+
+
diff --git a/config/awesome/theme/assets/icons/cpu.svg b/config/awesome/theme/assets/icons/cpu.svg
new file mode 100755
index 0000000..9b21cca
--- /dev/null
+++ b/config/awesome/theme/assets/icons/cpu.svg
@@ -0,0 +1,119 @@
+
+
diff --git a/config/awesome/theme/assets/icons/disk.svg b/config/awesome/theme/assets/icons/disk.svg
new file mode 100755
index 0000000..432d33e
--- /dev/null
+++ b/config/awesome/theme/assets/icons/disk.svg
@@ -0,0 +1,40 @@
+
+
diff --git a/config/awesome/theme/assets/icons/init.lua b/config/awesome/theme/assets/icons/init.lua
new file mode 100644
index 0000000..4a5eb99
--- /dev/null
+++ b/config/awesome/theme/assets/icons/init.lua
@@ -0,0 +1,14 @@
+-- Icons directory
+local dir = os.getenv("HOME") .. "/.config/awesome/theme/assets/icons/"
+
+return {
+ -- notifs
+ notification = dir .. "notification.svg",
+ notification_bell = dir .. "notification_bell.svg",
+
+ -- system
+ ram = dir .. "ram.svg",
+ cpu = dir .. "cpu.svg",
+ temp = dir .. "temp.svg",
+ disk = dir .. "disk.svg",
+}
diff --git a/config/awesome/theme/assets/icons/notification.svg b/config/awesome/theme/assets/icons/notification.svg
new file mode 100644
index 0000000..0083afb
--- /dev/null
+++ b/config/awesome/theme/assets/icons/notification.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/config/awesome/theme/assets/icons/notification_bell.svg b/config/awesome/theme/assets/icons/notification_bell.svg
new file mode 100644
index 0000000..bc2cce7
--- /dev/null
+++ b/config/awesome/theme/assets/icons/notification_bell.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/config/awesome/theme/assets/icons/ram.svg b/config/awesome/theme/assets/icons/ram.svg
new file mode 100755
index 0000000..403612d
--- /dev/null
+++ b/config/awesome/theme/assets/icons/ram.svg
@@ -0,0 +1,35 @@
+
+
diff --git a/config/awesome/theme/assets/icons/temp.svg b/config/awesome/theme/assets/icons/temp.svg
new file mode 100755
index 0000000..2a99da3
--- /dev/null
+++ b/config/awesome/theme/assets/icons/temp.svg
@@ -0,0 +1,67 @@
+
+
diff --git a/config/awesome/theme/assets/no_music.png b/config/awesome/theme/assets/no_music.png
index 5411784..9dd2c7f 100644
Binary files a/config/awesome/theme/assets/no_music.png and b/config/awesome/theme/assets/no_music.png differ
diff --git a/config/awesome/theme/assets/wallpaper.jpg b/config/awesome/theme/assets/wallpaper.jpg
new file mode 100755
index 0000000..2c58630
Binary files /dev/null and b/config/awesome/theme/assets/wallpaper.jpg differ
diff --git a/config/awesome/theme/assets/wallpaperbak.jpg b/config/awesome/theme/assets/wallpaperbak.jpg
new file mode 100644
index 0000000..234060d
Binary files /dev/null and b/config/awesome/theme/assets/wallpaperbak.jpg differ
diff --git a/config/awesome/theme/day/theme.lua b/config/awesome/theme/day/theme.lua
new file mode 100644
index 0000000..74acb4e
--- /dev/null
+++ b/config/awesome/theme/day/theme.lua
@@ -0,0 +1,284 @@
+-- Standard awesome library
+local gears = require("gears")
+local gfs = require("gears.filesystem")
+
+-- Theme handling library
+local themes_path = gfs.get_themes_dir()
+local theme = dofile(themes_path .. "default/theme.lua")
+local theme_assets = require("beautiful.theme_assets")
+local xresources = require("beautiful.xresources")
+local xrdb = xresources.get_current_theme()
+
+-- Helpers
+local helpers = require("helpers")
+
+-- Beautiful Day Theme
+--------------------------
+
+-- Catppuccin Dawn Colorscheme
+local color_palette = {
+ rosewater = "#DC907F",
+ flamingo = "#DD7878",
+ pink = "#EC83D0",
+ mauve = "#9247ED",
+ red = "#BB0D33",
+ maroon = "#E63B4A",
+ peach = "#FE640B",
+ yellow = "#E49320",
+ green = "#53A947",
+ teal = "#23979F",
+ sky = "#04A5E5",
+ blue = "#3474EE",
+ sapphire = "#209FB5",
+ lavender = "#7287FD",
+ white = "#575279",
+ gray2 = "#696486",
+ gray1 = "#7B7794",
+ gray0 = "#8E89A1",
+ black5 = "#A09BAE",
+ black4 = "#B2AEBC",
+ black0 = "#C4C0C9",
+ black3 = "#D7D2D6",
+ black1 = "#E9E5E4",
+ black2 = "#FBF7F1",
+}
+
+theme.xbackground = color_palette.black2
+theme.xforeground = color_palette.white
+theme.xcolor0 = color_palette.gray0
+theme.xcolor1 = color_palette.red
+theme.xcolor2 = color_palette.green
+theme.xcolor3 = color_palette.yellow
+theme.xcolor4 = color_palette.blue
+theme.xcolor5 = color_palette.mauve
+theme.xcolor6 = color_palette.pink
+theme.xcolor7 = color_palette.white
+theme.xcolor8 = color_palette.gray1
+theme.xcolor9 = color_palette.maroon
+theme.xcolor10 = color_palette.teal
+theme.xcolor11 = color_palette.peach
+theme.xcolor12 = color_palette.sky
+theme.xcolor13 = color_palette.lavender
+theme.xcolor14 = color_palette.flamingo
+theme.xcolor15 = color_palette.white
+theme.darker_bg = color_palette.black1
+theme.lighter_bg = color_palette.black3
+theme.dashboard_fg = color_palette.gray2
+theme.transparent = "#00000000"
+
+-- PFP
+theme.pfp = gears.surface.load_uncached(gfs.get_configuration_dir() .. "theme/assets/pfp.png")
+
+-- Awesome Logo
+theme.awesome_logo = gears.surface.load_uncached(gfs.get_configuration_dir() .. "theme/assets/icons/awesome_logo.svg")
+
+-- Fonts
+theme.font_name = "Iosevka Nerd Font Mono "
+theme.font = theme.font_name .. "8"
+theme.icon_font_name = "Material Design Icons Desktop "
+theme.icon_font = theme.icon_font_name .. "18"
+theme.font_taglist = theme.icon_font_name .. "16"
+theme.prompt_font = theme.font_name .. "Bold 10"
+
+-- Background Colors
+theme.bg_dark = theme.darker_bg
+theme.bg_normal = theme.xbackground
+theme.bg_focus = theme.xbackground
+theme.bg_urgent = theme.xbackground
+theme.bg_minimize = theme.xbackground
+theme.bg_secondary = theme.darker_bg
+theme.bg_accent = theme.lighter_bg
+
+-- Accent colors
+theme.accent = theme.xcolor6
+theme.hover_effect = theme.accent .. "44"
+
+-- Foreground Colors
+theme.fg_normal = theme.xforeground
+theme.fg_focus = theme.xforeground
+theme.fg_urgent = theme.xcolor1
+theme.fg_minimize = theme.xcolor0
+
+-- Borders
+theme.border_width = dpi(0)
+theme.oof_border_width = dpi(0)
+theme.border_normal = theme.darker_bg
+theme.border_focus = theme.darker_bg
+theme.widget_border_width = dpi(2)
+theme.widget_border_color = theme.darker_bg
+
+-- Radius
+theme.border_radius = dpi(10)
+theme.client_radius = theme.border_radius
+theme.dashboard_radius = theme.border_radius
+theme.widget_radius = theme.border_radius
+
+-- Titlebars
+theme.titlebar_enabled = true
+theme.titlebar_bg = theme.xbackground
+theme.titlebar_fg = theme.xforeground
+
+-- Music
+theme.music_bg = theme.xbackground
+theme.music_bg_accent = theme.darker_bg
+theme.music_accent = theme.lighter_bg
+
+-- Pop up notifications
+theme.pop_size = dpi(190)
+theme.pop_bg = theme.xbackground
+theme.pop_vol_color = theme.accent
+theme.pop_brightness_color = theme.accent
+theme.pop_bar_bg = theme.accent .. "44"
+theme.pop_fg = theme.xforeground
+theme.pop_border_radius = theme.border_radius
+
+-- Tooltip
+theme.tooltip_bg = theme.darker_bg
+theme.tooltip_widget_bg = theme.xbackground
+theme.tooltip_height = dpi(245)
+theme.tooltip_width = dpi(200)
+theme.tooltip_gap = dpi(10)
+theme.tooltip_box_margin = dpi(10)
+theme.tooltip_border_radius = theme.border_radius
+theme.tooltip_box_border_radius = theme.widget_radius
+
+-- Edge snap
+theme.snap_bg = theme.xcolor8
+theme.snap_shape = helpers.rrect(0)
+
+-- Prompts
+theme.prompt_bg = theme.transparent
+theme.prompt_fg = theme.xforeground
+
+-- Dashboard
+theme.dashboard_bg = theme.darker_bg
+theme.dashboard_box_bg = theme.xbackground
+theme.dashboard_box_fg = theme.dashboard_fg
+
+-- Control center
+theme.control_center_radius = dpi(20)
+theme.control_center_widget_radius = theme.border_radius
+theme.control_center_bg = theme.darker_bg
+theme.control_center_widget_bg = theme.xbackground
+theme.control_center_button_bg = theme.lighter_bg
+
+-- Playerctl
+theme.playerctl_ignore = { "firefox", "qutebrowser", "chromium", "brave" }
+theme.playerctl_player = { "spotify", "mpd", "%any" }
+theme.playerctl_update_on_activity = true
+theme.playerctl_position_update_interval = 1
+
+-- Mainmenu
+theme.menu_font = theme.font_name .. "medium 10"
+theme.menu_height = dpi(30)
+theme.menu_width = dpi(150)
+theme.menu_bg_normal = theme.xbackground
+theme.menu_bg_focus = theme.lighter_bg
+theme.menu_fg_normal = theme.xforeground
+theme.menu_fg_focus = theme.accent
+theme.menu_border_width = dpi(0)
+theme.menu_border_color = theme.xcolor0
+theme.menu_submenu = "» "
+theme.menu_submenu_icon = nil
+
+-- Hotkeys Pop Up
+theme.hotkeys_bg = theme.xbackground
+theme.hotkeys_fg = theme.xforeground
+theme.hotkeys_modifiers_fg = theme.xforeground
+theme.hotkeys_font = theme.font_name .. "11"
+theme.hotkeys_description_font = theme.font_name .. "9"
+theme.hotkeys_shape = helpers.rrect(theme.border_radius)
+theme.hotkeys_group_margin = dpi(40)
+
+-- Layout List
+theme.layoutlist_border_color = theme.lighter_bg
+theme.layoutlist_border_width = theme.border_width
+theme.layoutlist_shape_selected = helpers.rrect(dpi(10))
+theme.layoutlist_bg_selected = theme.lighter_bg
+
+-- Recolor Layout icons:
+theme = theme_assets.recolor_layout(theme, theme.xforeground)
+
+-- Gaps
+theme.useless_gap = dpi(5)
+
+-- Wibar
+theme.wibar_bg = theme.darker_bg
+theme.wibar_widget_bg = theme.xbackground
+
+-- Dock
+theme.dock_bg = theme.wibar_bg
+theme.dock_focused_bg = theme.lighter_bg
+theme.dock_accent = theme.accent
+
+-- Systray
+theme.systray_icon_spacing = dpi(15)
+theme.bg_systray = theme.wibar_bg
+theme.systray_icon_size = dpi(15)
+theme.systray_max_rows = 2
+
+-- Tabs
+theme.mstab_bar_height = dpi(60)
+theme.mstab_bar_padding = dpi(0)
+theme.mstab_border_radius = theme.border_radius
+theme.tabbar_disable = true
+theme.tabbar_style = "modern"
+theme.tabbar_bg_focus = theme.lighter_bg
+theme.tabbar_bg_normal = theme.darker_bg
+theme.tabbar_fg_focus = theme.xforeground
+theme.tabbar_fg_normal = theme.xcolor0
+theme.tabbar_position = "bottom"
+theme.tabbar_AA_radius = 0
+theme.tabbar_size = 40
+theme.mstab_bar_ontop = true
+
+-- Notifications
+theme.notification_spacing = dpi(20)
+theme.notification_border_radius = theme.border_radius
+theme.notification_border_width = dpi(0)
+
+-- Notif center
+theme.notif_center_radius = theme.border_radius
+theme.notif_center_box_radius = theme.notif_center_radius / 2
+theme.notif_center_notifs_bg = theme.xbackground
+theme.notif_center_notifs_bg_accent = theme.darker_bg
+theme.notif_center_notifs_accent = theme.lighter_bg
+
+-- Swallowing
+theme.dont_swallow_classname_list = {
+ "firefox",
+ "gimp",
+ "Google-chrome",
+ "Thunar",
+}
+
+-- Layout Machi
+theme.machi_switcher_border_color = theme.darker_bg
+theme.machi_switcher_border_opacity = 0.25
+theme.machi_editor_border_color = theme.darker_bg
+theme.machi_editor_border_opacity = 0.25
+theme.machi_editor_active_opacity = 0.25
+
+-- Tag Preview
+theme.tag_preview_client_border_radius = dpi(6)
+theme.tag_preview_client_opacity = 0.1
+theme.tag_preview_client_bg = theme.xbackground
+theme.tag_preview_client_border_color = theme.darker_bg
+theme.tag_preview_client_border_width = theme.widget_border_width
+
+theme.tag_preview_widget_border_radius = theme.border_radius
+theme.tag_preview_widget_bg = theme.xbackground
+theme.tag_preview_widget_border_color = theme.widget_border_color
+theme.tag_preview_widget_border_width = theme.widget_border_width * 0
+theme.tag_preview_widget_margin = dpi(10)
+
+-- Task Preview
+theme.task_preview_widget_border_radius = dpi(10)
+theme.task_preview_widget_bg = theme.xbackground
+theme.task_preview_widget_border_color = theme.widget_border_color
+theme.task_preview_widget_border_width = theme.widget_border_width * 0
+theme.task_preview_widget_margin = dpi(15)
+
+theme.fade_duration = 250
+
+return theme
diff --git a/config/awesome/theme/night/theme.lua b/config/awesome/theme/night/theme.lua
new file mode 100644
index 0000000..9ede486
--- /dev/null
+++ b/config/awesome/theme/night/theme.lua
@@ -0,0 +1,281 @@
+-- Standard awesome library
+local gears = require("gears")
+local gfs = require("gears.filesystem")
+
+-- Theme handling library
+local themes_path = gfs.get_themes_dir()
+local theme = dofile(themes_path .. "default/theme.lua")
+local theme_assets = require("beautiful.theme_assets")
+local xresources = require("beautiful.xresources")
+local xrdb = xresources.get_current_theme()
+
+-- Helpers
+local helpers = require("helpers")
+
+-- Aesthetic Night Theme
+---------------------------
+
+-- Rxyhn's Catppuccin Colorscheme
+local color_palette = {
+ rosewater = "#F5E0DC", -- Rosewater
+ flamingo = "#F2CDCD", -- Flamingo
+ mauve = "#DDB6F2", -- Mauve
+ pink = "#F5C2E7", -- Pink
+ red = "#F28FAD", -- Red
+ maroon = "#E8A2AF", -- Maroon
+ peach = "#F8BD96", -- Peach
+ yellow = "#FAE3B0", -- Yellow
+ green = "#ABE9B3", -- Green
+ blue = "#96CDFB", -- Blue
+ sky = "#89DCEB", -- Sky
+ teal = "#B5E8E0", -- Teal
+ lavender = "#C9CBFF", -- Lavender
+ white = "#c5c8c9",
+ black0 = "#0d1416",
+ black1 = "#111719",
+ black2 = "#131a1c",
+ black3 = "#192022",
+ black4 = "#202729",
+ gray0 = "#363D3E",
+ gray1 = "#4A5051",
+ gray2 = "#5C6262",
+}
+
+theme.xbackground = color_palette.black2
+theme.xforeground = color_palette.white
+theme.xcolor0 = color_palette.gray0
+theme.xcolor1 = color_palette.red
+theme.xcolor2 = color_palette.green
+theme.xcolor3 = color_palette.yellow
+theme.xcolor4 = color_palette.blue
+theme.xcolor5 = color_palette.mauve
+theme.xcolor6 = color_palette.pink
+theme.xcolor7 = color_palette.white
+theme.xcolor8 = color_palette.gray1
+theme.xcolor9 = color_palette.maroon
+theme.xcolor10 = color_palette.teal
+theme.xcolor11 = color_palette.peach
+theme.xcolor12 = color_palette.sky
+theme.xcolor13 = color_palette.lavender
+theme.xcolor14 = color_palette.flamingo
+theme.xcolor15 = color_palette.white
+theme.darker_bg = color_palette.black0
+theme.lighter_bg = color_palette.black3
+theme.dashboard_fg = color_palette.gray2
+theme.transparent = "#00000000"
+
+-- PFP
+theme.pfp = gears.surface.load_uncached(gfs.get_configuration_dir() .. "theme/assets/pfp.png")
+
+-- Awesome Logo
+theme.awesome_logo = gears.surface.load_uncached(gfs.get_configuration_dir() .. "theme/assets/icons/awesome_logo.svg")
+
+-- Fonts
+theme.font_name = "Iosevka Nerd Font Mono "
+theme.font = theme.font_name .. "8"
+theme.icon_font_name = "Material Design Icons Desktop "
+theme.icon_font = theme.icon_font_name .. "18"
+theme.font_taglist = theme.icon_font_name .. "16"
+theme.prompt_font = theme.font_name .. "Bold 10"
+
+-- Background Colors
+theme.bg_dark = theme.darker_bg
+theme.bg_normal = theme.xbackground
+theme.bg_focus = theme.xbackground
+theme.bg_urgent = theme.xbackground
+theme.bg_minimize = theme.xbackground
+theme.bg_secondary = theme.darker_bg
+theme.bg_accent = theme.lighter_bg
+
+-- Accent colors
+theme.accent = theme.xcolor4
+theme.hover_effect = theme.accent .. "44"
+
+-- Foreground Colors
+theme.fg_normal = theme.xforeground
+theme.fg_focus = theme.accent
+theme.fg_urgent = theme.xcolor1
+theme.fg_minimize = theme.xcolor0
+
+-- Borders
+theme.border_width = dpi(0)
+theme.oof_border_width = dpi(0)
+theme.border_normal = theme.darker_bg
+theme.border_focus = theme.darker_bg
+theme.widget_border_width = dpi(2)
+theme.widget_border_color = theme.darker_bg
+
+-- Radius
+theme.border_radius = dpi(10)
+theme.client_radius = theme.border_radius
+theme.dashboard_radius = theme.border_radius
+theme.widget_radius = theme.border_radius
+
+-- Titlebars
+theme.titlebar_enabled = true
+theme.titlebar_bg = theme.xbackground
+theme.titlebar_fg = theme.xforeground
+
+-- Music
+theme.music_bg = theme.xbackground
+theme.music_bg_accent = theme.darker_bg
+theme.music_accent = theme.lighter_bg
+
+-- Pop up
+theme.pop_size = dpi(190)
+theme.pop_bg = theme.xbackground
+theme.pop_vol_color = theme.accent
+theme.pop_brightness_color = theme.accent
+theme.pop_bar_bg = theme.accent .. "44"
+theme.pop_fg = theme.xforeground
+theme.pop_border_radius = theme.border_radius
+
+-- Tooltip
+theme.tooltip_bg = theme.darker_bg
+theme.tooltip_widget_bg = theme.xbackground
+theme.tooltip_height = dpi(245)
+theme.tooltip_width = dpi(200)
+theme.tooltip_gap = dpi(10)
+theme.tooltip_box_margin = dpi(10)
+theme.tooltip_border_radius = theme.border_radius
+theme.tooltip_box_border_radius = theme.widget_radius
+
+-- Edge snap
+theme.snap_bg = theme.xcolor8
+theme.snap_shape = helpers.rrect(0)
+
+-- Prompts
+theme.prompt_bg = theme.transparent
+theme.prompt_fg = theme.xforeground
+
+-- Dashboard
+theme.dashboard_bg = theme.darker_bg
+theme.dashboard_box_bg = theme.lighter_bg
+theme.dashboard_box_fg = theme.dashboard_fg
+
+-- Control center
+theme.control_center_radius = dpi(20)
+theme.control_center_widget_radius = theme.border_radius
+theme.control_center_bg = theme.darker_bg
+theme.control_center_widget_bg = theme.xbackground
+theme.control_center_button_bg = theme.lighter_bg
+
+-- Playerctl
+theme.playerctl_ignore = { "firefox", "qutebrowser", "chromium", "brave" }
+theme.playerctl_player = { "spotify", "mpd", "%any" }
+theme.playerctl_update_on_activity = true
+theme.playerctl_position_update_interval = 1
+
+-- Mainmenu
+theme.menu_font = theme.font_name .. "medium 10"
+theme.menu_height = dpi(30)
+theme.menu_width = dpi(150)
+theme.menu_bg_normal = theme.xbackground
+theme.menu_bg_focus = theme.lighter_bg
+theme.menu_fg_normal = theme.xforeground
+theme.menu_fg_focus = theme.accent
+theme.menu_border_width = dpi(0)
+theme.menu_border_color = theme.xcolor0
+theme.menu_submenu = "» "
+theme.menu_submenu_icon = nil
+
+-- Hotkeys Pop Up
+theme.hotkeys_bg = theme.xbackground
+theme.hotkeys_fg = theme.xforeground
+theme.hotkeys_modifiers_fg = theme.xforeground
+theme.hotkeys_font = theme.font_name .. "11"
+theme.hotkeys_description_font = theme.font_name .. "9"
+theme.hotkeys_shape = helpers.rrect(theme.border_radius)
+theme.hotkeys_group_margin = dpi(40)
+
+-- Layout List
+theme.layoutlist_border_color = theme.lighter_bg
+theme.layoutlist_border_width = theme.border_width
+theme.layoutlist_shape_selected = helpers.rrect(dpi(10))
+theme.layoutlist_bg_selected = theme.lighter_bg
+
+-- Recolor Layout icons:
+theme = theme_assets.recolor_layout(theme, theme.xforeground)
+
+-- Gaps
+theme.useless_gap = dpi(5)
+
+-- Wibar
+theme.wibar_bg = theme.darker_bg
+theme.wibar_widget_bg = theme.lighter_bg
+
+-- Dock
+theme.dock_bg = theme.wibar_bg
+theme.dock_focused_bg = theme.lighter_bg
+theme.dock_accent = theme.accent
+
+-- Systray
+theme.systray_icon_spacing = dpi(15)
+theme.bg_systray = theme.wibar_bg
+theme.systray_icon_size = dpi(15)
+theme.systray_max_rows = 2
+
+-- Tabs
+theme.mstab_bar_height = dpi(60)
+theme.mstab_bar_padding = dpi(0)
+theme.mstab_border_radius = theme.border_radius
+theme.tabbar_disable = true
+theme.tabbar_style = "modern"
+theme.tabbar_bg_focus = theme.lighter_bg
+theme.tabbar_bg_normal = theme.darker_bg
+theme.tabbar_fg_focus = theme.xforeground
+theme.tabbar_fg_normal = theme.xcolor0
+theme.tabbar_position = "bottom"
+theme.tabbar_AA_radius = 0
+theme.tabbar_size = 40
+theme.mstab_bar_ontop = true
+
+-- Notifications
+theme.notification_spacing = dpi(20)
+theme.notification_border_radius = theme.border_radius
+theme.notification_border_width = dpi(0)
+
+-- Notif center
+theme.notif_center_radius = theme.border_radius
+theme.notif_center_box_radius = theme.notif_center_radius / 2
+theme.notif_center_notifs_bg = theme.lighter_bg
+theme.notif_center_notifs_accent = theme.xcolor0
+
+-- Swallowing
+theme.dont_swallow_classname_list = {
+ "firefox",
+ "gimp",
+ "Google-chrome",
+ "Thunar",
+}
+
+-- Layout Machi
+theme.machi_switcher_border_color = theme.darker_bg
+theme.machi_switcher_border_opacity = 0.25
+theme.machi_editor_border_color = theme.darker_bg
+theme.machi_editor_border_opacity = 0.25
+theme.machi_editor_active_opacity = 0.25
+
+-- Tag Preview
+theme.tag_preview_client_border_radius = dpi(5)
+theme.tag_preview_client_opacity = 0.1
+theme.tag_preview_client_bg = theme.xbackground
+theme.tag_preview_client_border_color = theme.darker_bg
+theme.tag_preview_client_border_width = theme.widget_border_width
+
+theme.tag_preview_widget_border_radius = theme.border_radius
+theme.tag_preview_widget_bg = theme.xbackground
+theme.tag_preview_widget_border_color = theme.widget_border_color
+theme.tag_preview_widget_border_width = theme.widget_border_width * 0
+theme.tag_preview_widget_margin = dpi(10)
+
+-- Task Preview
+theme.task_preview_widget_border_radius = theme.border_radius
+theme.task_preview_widget_bg = theme.xbackground
+theme.task_preview_widget_border_color = theme.widget_border_color
+theme.task_preview_widget_border_width = theme.widget_border_width * 0
+theme.task_preview_widget_margin = dpi(15)
+
+theme.fade_duration = 250
+
+return theme
diff --git a/config/awesome/theme/picom.conf b/config/awesome/theme/picom.conf
index 3842c15..7621479 100644
--- a/config/awesome/theme/picom.conf
+++ b/config/awesome/theme/picom.conf
@@ -11,7 +11,7 @@ round-borders-exclude = [
];
#========================= Shadows =========================#
-shadow = false;
+shadow-opacity = 0.50;
shadow-radius = 14;
shadow-opacity = 0.50;
shadow-offset-x = -14;
diff --git a/config/awesome/theme/themes b/config/awesome/theme/themes
new file mode 100755
index 0000000..ed688f8
--- /dev/null
+++ b/config/awesome/theme/themes
@@ -0,0 +1,43 @@
+#!/bin/sh
+# Simple theme-switcher script.
+# author https://github.com/rxyhn
+
+# var
+########
+awesome=$HOME/.config/awesome/rc.lua
+theme=$HOME/.config/awesome/theme
+term=$HOME/.config/alacritty/alacritty.yml
+
+# Beautiful day themes
+#########################
+day () {
+ # colorscheme
+ sed -i "17s/.*/theme = themes[1]/g" $awesome
+ # picom
+ sed -i "14s/.*/shadow-opacity = 0.25;/g" $theme/picom.conf
+ # alacritty
+ sed -i "4s/.*/ - .config\/alacritty\/themes\/day.yml/g" $term
+}
+
+# Aesthetic night themes
+###########################
+night () {
+ # colorscheme
+ sed -i "17s/.*/theme = themes[2]/g" $awesome
+ # picom
+ sed -i "14s/.*/shadow-opacity = 0.50;/g" $theme/picom.conf
+ # alacritty
+ sed -i "4s/.*/ - .config\/alacritty\/themes\/night.yml/g" $term
+}
+
+case $1 in
+ day)
+ day
+ ;;
+
+ night)
+ night
+ ;;
+
+ *)
+esac
diff --git a/config/awesome/ui/bar/init.lua b/config/awesome/ui/bar/init.lua
index 3c705ce..0a68d79 100644
--- a/config/awesome/ui/bar/init.lua
+++ b/config/awesome/ui/bar/init.lua
@@ -1,371 +1 @@
--- Standard awesome library
-local awful = require("awful")
-local gears = require("gears")
-
--- Widget library
-local wibox = require("wibox")
-
--- Theme handling library
-local beautiful = require("beautiful")
-local xresources = require("beautiful.xresources")
-local dpi = xresources.apply_dpi
-
--- Rubato
-local rubato = require("module.rubato")
-
--- Helpers
-local helpers = require("helpers")
-
--- Get screen geometry
-local screen_width = awful.screen.focused().geometry.width
-local screen_height = awful.screen.focused().geometry.height
-
-
--- Helpers
--------------
-
-local wrap_widget = function(widget)
- return {
- widget,
- margins = dpi(6),
- widget = wibox.container.margin
- }
-end
-
-
--- Wibar
------------
-
-screen.connect_signal("request::desktop_decoration", function(s)
-
- -- Launcher
- -------------
-
- local awesome_icon = wibox.widget {
- {
- widget = wibox.widget.imagebox,
- image = beautiful.awesome_logo,
- resize = true
- },
- margins = dpi(4),
- widget = wibox.container.margin
- }
-
- helpers.add_hover_cursor(awesome_icon, "hand2")
-
-
- -- Battery
- -------------
-
- local charge_icon = wibox.widget{
- bg = beautiful.xcolor8,
- widget = wibox.container.background,
- visible = false
- }
-
- local batt = wibox.widget{
- charge_icon,
- color = {beautiful.xcolor2},
- bg = beautiful.xcolor8 .. "88",
- value = 50,
- min_value = 0,
- max_value = 100,
- thickness = dpi(4),
- padding = dpi(2),
- -- rounded_edge = true,
- start_angle = math.pi * 3 / 2,
- widget = wibox.container.arcchart
- }
-
- awesome.connect_signal("signal::battery", function(value)
- local fill_color = beautiful.xcolor2
-
- if value >= 11 and value <= 30 then
- fill_color = beautiful.xcolor3
- elseif value <= 10 then
- fill_color = beautiful.xcolor1
- end
-
- batt.colors = {fill_color}
- batt.value = value
- end)
-
- awesome.connect_signal("signal::charger", function(state)
- if state then
- charge_icon.visible = true
- else
- charge_icon.visible = false
- end
- end)
-
-
- -- Time
- ----------
-
- local hour = wibox.widget{
- font = beautiful.font_name .. "bold 14",
- format = "%H",
- align = "center",
- valign = "center",
- widget = wibox.widget.textclock
- }
-
- local min = wibox.widget{
- font = beautiful.font_name .. "bold 14",
- format = "%M",
- align = "center",
- valign = "center",
- widget = wibox.widget.textclock
- }
-
- local clock = wibox.widget{
- {
- {
- hour,
- min,
- spacing = dpi(5),
- layout = wibox.layout.fixed.vertical
- },
- top = dpi(5),
- bottom = dpi(5),
- widget = wibox.container.margin
- },
- bg = beautiful.lighter_bg,
- shape = helpers.rrect(beautiful.bar_radius),
- widget = wibox.container.background
- }
-
-
- -- Stats
- -----------
-
- local stats = wibox.widget{
- {
- wrap_widget(batt),
- clock,
- spacing = dpi(5),
- layout = wibox.layout.fixed.vertical
- },
- bg = beautiful.xcolor0,
- shape = helpers.rrect(beautiful.bar_radius),
- widget = wibox.container.background
- }
-
- stats:connect_signal("mouse::enter", function()
- stats.bg = beautiful.xcolor8
- stats_tooltip_show()
- end)
-
- stats:connect_signal("mouse::leave", function()
- stats.bg = beautiful.xcolor0
- stats_tooltip_hide()
- end)
-
-
- -- Notification center
- -------------------------
-
- notif_center = wibox({
- type = "dock",
- screen = screen.primary,
- height = screen_height - dpi(50),
- width = dpi(300),
- shape = helpers.rrect(beautiful.notif_center_radius),
- ontop = true,
- visible = false
- })
- notif_center.y = dpi(25)
-
- -- Rubato
- local slide = rubato.timed{
- pos = dpi(-300),
- rate = 60,
- intro = 0.3,
- duration = 0.8,
- easing = rubato.quadratic,
- awestore_compat = true,
- subscribed = function(pos) notif_center.x = pos end
- }
-
- local notif_center_status = false
-
- slide.ended:subscribe(function()
- if notif_center_status then
- notif_center.visible = false
- end
- end)
-
- -- Make toogle button
- local notif_center_show = function()
- notif_center.visible = true
- slide:set(dpi(100))
- notif_center_status = false
- end
-
- local notif_center_hide = function()
- slide:set(dpi(-375))
- notif_center_status = true
- end
-
- local notif_center_toggle = function()
- if notif_center.visible then
- notif_center_hide()
- else
- notif_center_show()
- end
- end
-
- -- notif_center setup
- s.notif_center = require('ui.notifs.notif-center')(s)
-
- notif_center:setup {
- s.notif_center,
- margins = dpi(15),
- widget = wibox.container.margin
- }
-
- local notif_center_button = wibox.widget{
- markup = helpers.colorize_text("", beautiful.xcolor4),
- font = beautiful.font_name .. "18",
- align = "center",
- valign = "center",
- widget = wibox.widget.textbox
- }
-
- notif_center_button:connect_signal("mouse::enter", function()
- notif_center_button.markup = helpers.colorize_text(notif_center_button.text, beautiful.xcolor4 .. 55)
- end)
-
- notif_center_button:connect_signal("mouse::leave", function()
- notif_center_button.markup = helpers.colorize_text(notif_center_button.text, beautiful.xcolor4)
- end)
-
- notif_center_button:buttons(gears.table.join(
- awful.button({}, 1, function()
- notif_center_toggle()
- end)
- ))
- helpers.add_hover_cursor(notif_center_button, "hand2")
-
-
--- Setup wibar
------------------
-
- -- Create a promptbox for each screen
- s.mypromptbox = awful.widget.prompt()
-
- -- Layoutbox
- local layoutbox_buttons = gears.table.join(
- -- Left click
- awful.button({}, 1, function (c)
- awful.layout.inc(1)
- end),
-
- -- Right click
- awful.button({}, 3, function (c)
- awful.layout.inc(-1)
- end),
-
- -- Scrolling
- awful.button({}, 4, function ()
- awful.layout.inc(-1)
- end),
- awful.button({}, 5, function ()
- awful.layout.inc(1)
- end)
- )
-
- s.mylayoutbox = awful.widget.layoutbox(s)
- s.mylayoutbox:buttons(layoutbox_buttons)
-
- local layoutbox = wibox.widget{
- s.mylayoutbox,
- margins = {bottom = dpi(7), left = dpi(8), right = dpi(8)},
- widget = wibox.container.margin
- }
-
- helpers.add_hover_cursor(layoutbox, "hand2")
-
-
- -- Create the wibar
- s.mywibar = awful.wibar({
- type = "dock",
- position = "left",
- screen = s,
- height = awful.screen.focused().geometry.height - dpi(50),
- width = dpi(50),
- shape = helpers.rrect(beautiful.border_radius),
- bg = beautiful.transparent,
- ontop = true,
- visible = true
- })
-
- awesome_icon:buttons(gears.table.join(
- awful.button({}, 1, function ()
- dashboard_toggle()
- end)
- ))
-
- -- Remove wibar on full screen
- local function remove_wibar(c)
- if c.fullscreen or c.maximized then
- c.screen.mywibar.visible = false
- else
- c.screen.mywibar.visible = true
- end
- end
-
- -- Remove wibar on full screen
- local function add_wibar(c)
- if c.fullscreen or c.maximized then
- c.screen.mywibar.visible = true
- end
- end
-
- client.connect_signal("property::fullscreen", remove_wibar)
-
- client.connect_signal("request::unmanage", add_wibar)
-
- -- Create the taglist widget
- s.mytaglist = require("ui.widgets.pacman_taglist")(s)
-
- local taglist = wibox.widget{
- s.mytaglist,
- shape = beautiful.taglist_shape_focus,
- bg = beautiful.xcolor0,
- widget = wibox.container.background
- }
-
- -- Add widgets to wibar
- s.mywibar:setup {
- {
- {
- layout = wibox.layout.align.vertical,
- expand = "none",
- { -- top
- awesome_icon,
- taglist,
- spacing = dpi(10),
- layout = wibox.layout.fixed.vertical
- },
- -- middle
- nil,
- { -- bottom
- stats,
- notif_center_button,
- layoutbox,
- spacing = dpi(8),
- layout = wibox.layout.fixed.vertical
- }
- },
- margins = dpi(8),
- widget = wibox.container.margin
- },
- bg = beautiful.darker_bg,
- shape = helpers.rrect(beautiful.border_radius),
- widget = wibox.container.background
- }
-
- -- wibar position
- s.mywibar.x = dpi(25)
-end)
+require("ui.bar.topwibar")
diff --git a/config/awesome/ui/bar/taglist.lua b/config/awesome/ui/bar/taglist.lua
new file mode 100644
index 0000000..fd724da
--- /dev/null
+++ b/config/awesome/ui/bar/taglist.lua
@@ -0,0 +1,288 @@
+local wibox = require("wibox")
+local awful = require("awful")
+local gears = require("gears")
+local beautiful = require("beautiful")
+local dpi = beautiful.xresources.apply_dpi
+
+-- Papirus Taglist from https://github.com/crylia
+local icon_cache = {}
+
+function Get_icon(theme, client, program_string, class_string, is_steam)
+ client = client or nil
+ program_string = program_string or nil
+ class_string = class_string or nil
+ is_steam = is_steam or nil
+
+ if theme and (client or program_string or class_string) then
+ local clientName
+ if is_steam then
+ clientName = "steam_icon_" .. tostring(client) .. ".svg"
+ elseif client then
+ if client.class then
+ clientName = string.lower(client.class:gsub(" ", "")) .. ".svg"
+ elseif client.name then
+ clientName = string.lower(client.name:gsub(" ", "")) .. ".svg"
+ else
+ if client.icon then
+ return client.icon
+ else
+ return "/usr/share/icons/Papirus-Dark/128x128/apps/application-default-icon.svg"
+ end
+ end
+ else
+ if program_string then
+ clientName = program_string .. ".svg"
+ else
+ clientName = class_string .. ".svg"
+ end
+ end
+
+ for index, icon in ipairs(icon_cache) do
+ if icon:match(clientName) then
+ return icon
+ end
+ end
+
+ local resolutions = { "128x128", "96x96", "64x64", "48x48", "42x42", "32x32", "24x24", "16x16" }
+ for i, res in ipairs(resolutions) do
+ local iconDir = "/usr/share/icons/" .. theme .. "/" .. res .. "/apps/"
+ local ioStream = io.open(iconDir .. clientName, "r")
+ if ioStream ~= nil then
+ icon_cache[#icon_cache + 1] = iconDir .. clientName
+ return iconDir .. clientName
+ else
+ clientName = clientName:gsub("^%l", string.upper)
+ iconDir = "/usr/share/icons/" .. theme .. "/" .. res .. "/apps/"
+ ioStream = io.open(iconDir .. clientName, "r")
+ if ioStream ~= nil then
+ icon_cache[#icon_cache + 1] = iconDir .. clientName
+ return iconDir .. clientName
+ elseif not class_string then
+ return "/usr/share/icons/Papirus-Dark/128x128/apps/application-default-icon.svg"
+ else
+ clientName = class_string .. ".svg"
+ iconDir = "/usr/share/icons/" .. theme .. "/" .. res .. "/apps/"
+ ioStream = io.open(iconDir .. clientName, "r")
+ if ioStream ~= nil then
+ icon_cache[#icon_cache + 1] = iconDir .. clientName
+ return iconDir .. clientName
+ else
+ return "/usr/share/icons/Papirus-Dark/128x128/apps/application-default-icon.svg"
+ end
+ end
+ end
+ end
+ if client then
+ return "/usr/share/icons/Papirus-Dark/128x128/apps/application-default-icon.svg"
+ end
+ end
+end
+
+local list_update = function(widget, buttons, label, data, objects)
+ widget:reset()
+
+ for i, object in ipairs(objects) do
+ local tag_icon = wibox.widget({
+ nil,
+ {
+ id = "icon",
+ resize = true,
+ widget = wibox.widget.imagebox,
+ },
+ nil,
+ layout = wibox.layout.align.horizontal,
+ })
+
+ local tag_icon_margin = wibox.widget({
+ tag_icon,
+ forced_width = dpi(33),
+ margins = dpi(3),
+ widget = wibox.container.margin,
+ })
+
+ local tag_label = wibox.widget({
+ text = "",
+ align = "center",
+ valign = "center",
+ visible = true,
+ font = beautiful.font_name .. "Bold 12",
+ forced_width = dpi(25),
+ widget = wibox.widget.textbox,
+ })
+
+ local tag_label_margin = wibox.widget({
+ tag_label,
+ left = dpi(5),
+ right = dpi(5),
+ widget = wibox.container.margin,
+ })
+
+ local tag_widget = wibox.widget({
+
+ id = "widget_margin",
+ {
+ id = "container",
+ tag_label_margin,
+ layout = wibox.layout.fixed.horizontal,
+ },
+
+ fg = beautiful.xforeground,
+ shape = function(cr, width, height)
+ gears.shape.rounded_rect(cr, width, height, 5)
+ end,
+ widget = wibox.container.background,
+ })
+
+ local function create_buttons(buttons, object)
+ if buttons then
+ local btns = {}
+ for _, b in ipairs(buttons) do
+ local btn = awful.button({
+ modifiers = b.modifiers,
+ button = b.button,
+ on_press = function()
+ b:emit_signal("press", object)
+ end,
+ on_release = function()
+ b:emit_signal("release", object)
+ end,
+ })
+ btns[#btns + 1] = btn
+ end
+ return btns
+ end
+ end
+
+ tag_widget:buttons(create_buttons(buttons, object))
+
+ local text, bg_color, bg_image, icon, args = label(object, tag_label)
+ tag_label:set_text(object.index)
+ if object.urgent == true then
+ tag_widget:set_bg(beautiful.xcolor1)
+ tag_widget:set_fg(beautiful.xforeground)
+ elseif object == awful.screen.focused().selected_tag then
+ tag_widget:set_bg(beautiful.lighter_bg)
+ tag_widget:set_fg(beautiful.xforeground)
+ else
+ tag_widget:set_bg(beautiful.lighter_bg .. 55)
+ end
+
+ -- Set the icon for each client
+ for _, client in ipairs(object:clients()) do
+ tag_label_margin:set_right(0)
+ local icon = wibox.widget({
+ {
+ id = "icon_container",
+ {
+ id = "icon",
+ resize = true,
+ widget = wibox.widget.imagebox,
+ },
+ widget = wibox.container.place,
+ },
+ tag_icon_margin,
+ forced_width = dpi(33),
+ margins = dpi(6),
+ widget = wibox.container.margin,
+ })
+ icon.icon_container.icon:set_image(Get_icon("Papirus-Dark", client))
+ tag_widget.container:setup({
+ icon,
+ strategy = "exact",
+ layout = wibox.container.constraint,
+ })
+ end
+
+ local old_wibox, old_cursor, old_bg
+ tag_widget:connect_signal("mouse::enter", function()
+ old_bg = tag_widget.bg
+ if object == awful.screen.focused().selected_tag then
+ tag_widget.bg = beautiful.accent .. 55
+ else
+ tag_widget.bg = beautiful.accent .. 55
+ end
+ local w = mouse.current_wibox
+ if w then
+ old_cursor, old_wibox = w.cursor, w
+ w.cursor = "hand1"
+ end
+ end)
+
+ tag_widget:connect_signal("button::press", function()
+ if object == awful.screen.focused().selected_tag then
+ tag_widget.bg = beautiful.accent .. 55
+ else
+ tag_widget.bg = beautiful.accent
+ end
+ end)
+
+ tag_widget:connect_signal("button::release", function()
+ if object == awful.screen.focused().selected_tag then
+ tag_widget.bg = beautiful.accent
+ else
+ tag_widget.bg = beautiful.accent .. 55
+ end
+ end)
+
+ tag_widget:connect_signal("mouse::leave", function()
+ tag_widget.bg = old_bg
+ if old_wibox then
+ old_wibox.cursor = old_cursor
+ old_wibox = nil
+ end
+ end)
+
+ -- Bling tag preview
+ tag_widget:connect_signal("mouse::enter", function()
+ if #object:clients() > 0 then
+ awesome.emit_signal("bling::tag_preview::update", object)
+ awesome.emit_signal("bling::tag_preview::visibility", awful.screen.focused(), true)
+ end
+ end)
+
+ tag_widget:connect_signal("mouse::leave", function()
+ awesome.emit_signal("bling::tag_preview::visibility", awful.screen.focused(), false)
+ end)
+
+ widget:add(tag_widget)
+ widget:set_spacing(dpi(6))
+ end
+end
+
+local tag_list = function(s)
+ return awful.widget.taglist(
+ s,
+ awful.widget.taglist.filter.noempty,
+ gears.table.join(
+ 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, function(t)
+ if client.focus then
+ client.focus:toggle_tag(t)
+ end
+ end),
+ awful.button({ modkey }, 3, function(t)
+ if client.focus then
+ client.focus:toggle_tag(t)
+ end
+ end),
+ awful.button({}, 4, function(t)
+ awful.tag.viewnext(t.screen)
+ end),
+ awful.button({}, 5, function(t)
+ awful.tag.viewprev(t.screen)
+ end)
+ ),
+ {},
+ list_update,
+ wibox.layout.fixed.horizontal()
+ )
+end
+
+return tag_list
diff --git a/config/awesome/ui/bar/topwibar.lua b/config/awesome/ui/bar/topwibar.lua
new file mode 100644
index 0000000..2f9b7af
--- /dev/null
+++ b/config/awesome/ui/bar/topwibar.lua
@@ -0,0 +1,419 @@
+local awful = require("awful")
+local gears = require("gears")
+local wibox = require("wibox")
+local beautiful = require("beautiful")
+local helpers = require("helpers")
+
+awful.screen.connect_for_each_screen(function(s)
+ local awesome_icon = wibox.widget({
+ widget = wibox.widget.imagebox,
+ image = beautiful.awesome_logo,
+ resize = true,
+ })
+
+ local launcher = wibox.widget({
+ {
+ awesome_icon,
+ top = dpi(6),
+ bottom = dpi(6),
+ left = dpi(12),
+ right = dpi(12),
+ widget = wibox.container.margin,
+ },
+ shape = function(cr, width, height)
+ gears.shape.rounded_rect(cr, width, height, dpi(5))
+ end,
+ bg = beautiful.wibar_widget_bg,
+ widget = wibox.container.background,
+ })
+
+ launcher:buttons(gears.table.join(awful.button({}, 1, function()
+ central_panel:toggle()
+ end)))
+
+ helpers.add_hover_cursor(awesome_icon, "hand2")
+
+ local search_icon = wibox.widget({
+ font = "icomoon bold 14",
+ align = "center",
+ valign = "center",
+ widget = wibox.widget.textbox(),
+ })
+
+ local reset_search_icon = function()
+ search_icon.markup = helpers.colorize_text("", beautiful.accent)
+ end
+ reset_search_icon()
+
+ local search_text = wibox.widget({
+ markup = helpers.colorize_text("Search", beautiful.xcolor8),
+ align = "center",
+ valign = "center",
+ font = beautiful.prompt_font,
+ widget = wibox.widget.textbox(),
+ })
+
+ local search = wibox.widget({
+ {
+ {
+ search_icon,
+ search_text,
+ spacing = dpi(10),
+ layout = wibox.layout.fixed.horizontal,
+ },
+ left = dpi(15),
+ widget = wibox.container.margin,
+ },
+ forced_height = dpi(35),
+ forced_width = dpi(200),
+ shape = function(cr, width, height)
+ gears.shape.rounded_rect(cr, width, height, dpi(5))
+ end,
+ bg = beautiful.wibar_widget_bg,
+ widget = wibox.container.background,
+ })
+
+ local function generate_prompt_icon(icon, color)
+ return "" .. icon .. " "
+ end
+
+ function activate_prompt(action)
+ search_icon.visible = false
+ local prompt
+ if action == "run" then
+ prompt = generate_prompt_icon("", beautiful.accent)
+ elseif action == "web_search" then
+ prompt = generate_prompt_icon("", beautiful.accent)
+ end
+ helpers.prompt(action, search_text, prompt, function()
+ search_icon.visible = true
+ end)
+ end
+
+ search:buttons(gears.table.join(
+ awful.button({}, 1, function()
+ activate_prompt("run")
+ end),
+ awful.button({}, 3, function()
+ activate_prompt("web_search")
+ end)
+ ))
+
+ helpers.add_hover_cursor(search, "hand2")
+
+ -- battery
+ local charge_icon = wibox.widget({
+ markup = helpers.colorize_text("", beautiful.wibar_bg),
+ align = "center",
+ valign = "center",
+ font = beautiful.icon_font_name .. "16",
+ widget = wibox.widget.textbox,
+ visible = false,
+ })
+
+ local batt = wibox.widget({
+ color = beautiful.xcolor2,
+ background_color = beautiful.xcolor2 .. "55",
+ bar_shape = function(cr, width, height)
+ gears.shape.rounded_rect(cr, width, height, dpi(5))
+ end,
+ shape = function(cr, width, height)
+ gears.shape.rounded_rect(cr, width, height, dpi(5))
+ end,
+ value = 50,
+ max_value = 100,
+ widget = wibox.widget.progressbar,
+ })
+
+ local batt_container = wibox.widget({
+ {
+ batt,
+ forced_height = dpi(35),
+ forced_width = dpi(100),
+ shape = function(cr, width, height)
+ gears.shape.rounded_rect(cr, width, height, dpi(5))
+ end,
+ bg = beautiful.wibar_widget_bg,
+ widget = wibox.container.background,
+ },
+ charge_icon,
+ valign = "center",
+ layout = wibox.layout.stack,
+ })
+
+ local batt_last_value = 100
+ local batt_low_value = 40
+ local batt_critical_value = 20
+ awesome.connect_signal("signal::battery", function(value)
+ batt.value = value
+ batt_last_value = value
+ local color
+
+ if charge_icon.visible then
+ color = beautiful.xcolor6
+ elseif value <= batt_critical_value then
+ color = beautiful.xcolor1
+ elseif value <= batt_low_value then
+ color = beautiful.xcolor3
+ else
+ color = beautiful.xcolor2
+ end
+
+ batt.color = color
+ batt.background_color = color .. "44"
+ end)
+
+ awesome.connect_signal("signal::charger", function(state)
+ local color
+ if state then
+ charge_icon.visible = true
+ color = beautiful.xcolor6
+ elseif batt_last_value <= batt_critical_value then
+ charge_icon.visible = false
+ color = beautiful.xcolor1
+ elseif batt_last_value <= batt_low_value then
+ charge_icon.visible = false
+ color = beautiful.xcolor3
+ else
+ charge_icon.visible = false
+ color = beautiful.xcolor2
+ end
+
+ batt.color = color
+ batt.background_color = color .. "44"
+ end)
+
+ local vertical_separator = wibox.widget({
+ orientation = "vertical",
+ color = beautiful.wibar_bg,
+ forced_height = dpi(1),
+ forced_width = dpi(1),
+ span_ratio = 0.90,
+ widget = wibox.widget.separator,
+ })
+
+ -- clock
+ local hours = wibox.widget.textclock("%H")
+ local minutes = wibox.widget.textclock("%M")
+
+ local make_little_dot = function(color)
+ return wibox.widget({
+ bg = color,
+ forced_width = dpi(2),
+ forced_height = dpi(2),
+ shape = gears.shape.circle,
+ widget = wibox.container.background,
+ })
+ end
+
+ local time = {
+ {
+ font = beautiful.font_name .. "Bold 12",
+ align = "right",
+ valign = "center",
+ widget = hours,
+ },
+ {
+ nil,
+ {
+ make_little_dot(beautiful.xforeground),
+ make_little_dot(beautiful.xforeground),
+ spacing = dpi(4),
+ widget = wibox.layout.fixed.vertical,
+ },
+ expand = "none",
+ widget = wibox.layout.align.vertical,
+ },
+ {
+ font = beautiful.font_name .. "Bold 12",
+ align = "left",
+ valign = "center",
+ widget = minutes,
+ },
+ spacing = dpi(4),
+ layout = wibox.layout.fixed.horizontal,
+ }
+
+ local layoutbox_buttons = gears.table.join(
+ -- Left click
+ awful.button({}, 1, function(c)
+ awful.layout.inc(1)
+ end),
+
+ -- Right click
+ awful.button({}, 3, function(c)
+ awful.layout.inc(-1)
+ end),
+
+ -- Scrolling
+ awful.button({}, 4, function()
+ awful.layout.inc(-1)
+ end),
+ awful.button({}, 5, function()
+ awful.layout.inc(1)
+ end)
+ )
+
+ s.mylayoutbox = awful.widget.layoutbox(s)
+ s.mylayoutbox:buttons(layoutbox_buttons)
+
+ local layoutbox = wibox.widget({
+ s.mylayoutbox,
+ left = dpi(2),
+ right = dpi(2),
+ top = dpi(3),
+ bottom = dpi(3),
+ widget = wibox.container.margin,
+ })
+
+ helpers.add_hover_cursor(layoutbox, "hand2")
+
+ local right_container = wibox.widget({
+ {
+ {
+ time,
+ vertical_separator,
+ layoutbox,
+ layout = wibox.layout.fixed.horizontal,
+ spacing = dpi(10),
+ },
+ top = dpi(4),
+ bottom = dpi(4),
+ left = dpi(8),
+ right = dpi(8),
+ widget = wibox.container.margin,
+ },
+ shape = function(cr, width, height)
+ gears.shape.rounded_rect(cr, width, height, dpi(5))
+ end,
+ bg = beautiful.wibar_widget_bg,
+ widget = wibox.container.background,
+ })
+
+ right_container:connect_signal("mouse::enter", function()
+ right_container.bg = beautiful.wibar_widget_bg .. 55
+ tooltip_toggle()
+ end)
+
+ right_container:connect_signal("mouse::leave", function()
+ right_container.bg = beautiful.wibar_widget_bg
+ tooltip_toggle()
+ end)
+
+ -- Systray
+ s.systray = wibox.widget.systray()
+ s.systray.base_size = beautiful.systray_icon_size
+ s.traybox = wibox({
+ screen = s,
+ width = dpi(100),
+ height = dpi(150),
+ bg = "#00000000",
+ visible = false,
+ ontop = true,
+ })
+ s.traybox:setup({
+ {
+ {
+ nil,
+ s.systray,
+ direction = "west",
+ widget = wibox.container.rotate,
+ },
+ margins = dpi(15),
+ widget = wibox.container.margin,
+ },
+ bg = beautiful.wibar_bg,
+ shape = helpers.rrect(beautiful.border_radius),
+ widget = wibox.container.background,
+ })
+ awful.placement.top_right(s.traybox, {
+ margins = {
+ top = beautiful.useless_gap * 16,
+ bottom = beautiful.useless_gap * 4,
+ left = beautiful.useless_gap * 4,
+ right = beautiful.useless_gap * 4,
+ },
+ })
+ s.traybox:buttons(gears.table.join(awful.button({}, 2, function()
+ s.traybox.visible = false
+ end)))
+
+ -- Create the wibox
+ s.mywibar = awful.wibar({
+ type = "dock",
+ position = "top",
+ screen = s,
+ height = dpi(50),
+ width = s.geometry.width - dpi(40),
+ bg = beautiful.transparent,
+ ontop = true,
+ visible = true,
+ })
+
+ awful.placement.top(s.mywibar, { margins = beautiful.useless_gap * 3 })
+
+ -- Remove wibar on full screen
+ local function remove_wibar(c)
+ if c.fullscreen or c.maximized then
+ c.screen.mywibar.visible = false
+ else
+ c.screen.mywibar.visible = true
+ end
+ end
+
+ -- Remove wibar on full screen
+ local function add_wibar(c)
+ if c.fullscreen or c.maximized then
+ c.screen.mywibar.visible = true
+ end
+ end
+
+ -- Hide bar when a splash widget is visible
+ awesome.connect_signal("widgets::splash::visibility", function(vis)
+ screen.primary.mywibar.visible = not vis
+ end)
+
+ client.connect_signal("property::fullscreen", remove_wibar)
+
+ client.connect_signal("request::unmanage", add_wibar)
+
+ -- Create the taglist widget
+ s.mytaglist = require("ui.bar.taglist")(s)
+
+ -- Add widgets to the wibox
+ s.mywibar:setup({
+ {
+ {
+ layout = wibox.layout.align.horizontal,
+ expand = "none",
+ {
+ launcher,
+ nil,
+ search,
+ spacing = dpi(10),
+ layout = wibox.layout.fixed.horizontal,
+ },
+ {
+ widget = s.mytaglist,
+ },
+ {
+ batt_container,
+ right_container,
+ spacing = dpi(10),
+ layout = wibox.layout.fixed.horizontal,
+ },
+ },
+ margins = dpi(10),
+ widget = wibox.container.margin,
+ },
+ bg = beautiful.wibar_bg,
+ shape = helpers.rrect(beautiful.border_radius),
+ widget = wibox.container.background,
+ })
+end)
+
+-- Systray toggle
+function systray_toggle()
+ local s = awful.screen.focused()
+ s.traybox.visible = not s.traybox.visible
+end
diff --git a/config/awesome/ui/central-panel/dashboard/date.lua b/config/awesome/ui/central-panel/dashboard/date.lua
new file mode 100644
index 0000000..e19e147
--- /dev/null
+++ b/config/awesome/ui/central-panel/dashboard/date.lua
@@ -0,0 +1,38 @@
+-- Standard awesome library
+local awful = require("awful")
+
+-- Theme handling library
+local beautiful = require("beautiful")
+
+-- Widget library
+local wibox = require("wibox")
+
+-- Helpers
+local helpers = require("helpers")
+
+-- Date
+---------
+
+local date_day = wibox.widget({
+ font = beautiful.font_name .. "medium 8",
+ format = helpers.colorize_text("%A", beautiful.xforeground .. "c6"),
+ valign = "center",
+ widget = wibox.widget.textclock,
+})
+
+local date_month = wibox.widget({
+ font = beautiful.font_name .. "medium 11",
+ format = "%d %B",
+ valign = "center",
+ widget = wibox.widget.textclock,
+})
+
+local date = wibox.widget({
+ date_day,
+ nil,
+ date_month,
+ expand = "none",
+ widget = wibox.layout.align.vertical,
+})
+
+return date
diff --git a/config/awesome/ui/central-panel/dashboard/init.lua b/config/awesome/ui/central-panel/dashboard/init.lua
new file mode 100644
index 0000000..8ccf946
--- /dev/null
+++ b/config/awesome/ui/central-panel/dashboard/init.lua
@@ -0,0 +1,109 @@
+-- Theme handling library
+local beautiful = require("beautiful")
+
+-- Widget library
+local wibox = require("wibox")
+
+-- Helpers
+local helpers = require("helpers")
+
+local function centered_widget(widget)
+ local w = wibox.widget({
+ nil,
+ {
+ nil,
+ widget,
+ expand = "none",
+ layout = wibox.layout.align.vertical,
+ },
+ expand = "none",
+ layout = wibox.layout.align.horizontal,
+ })
+
+ return w
+end
+
+local function create_boxed_widget(widget_to_be_boxed, width, height, bg_color)
+ local box_container = wibox.container.background()
+ box_container.bg = bg_color
+ box_container.forced_height = height
+ box_container.forced_width = width
+ box_container.shape = helpers.rrect(dpi(5))
+
+ local boxed_widget = wibox.widget({
+ -- Add margins
+ {
+ -- Add background color
+ {
+ -- The actual widget goes here
+ widget_to_be_boxed,
+ top = dpi(9),
+ bottom = dpi(9),
+ left = dpi(10),
+ right = dpi(10),
+ widget = wibox.container.margin,
+ },
+ widget = box_container,
+ },
+ margins = dpi(10),
+ color = "#FF000000",
+ widget = wibox.container.margin,
+ })
+
+ return boxed_widget
+end
+
+-- Aesthetic Dashboard
+-------------------------
+
+-- Widget
+
+local dashboard = function(s)
+ s.profile = require("ui.central-panel.dashboard.profile")
+ s.music = require("ui.central-panel.dashboard.music")
+ s.media = require("ui.central-panel.dashboard.mediakeys")
+ s.time = require("ui.central-panel.dashboard.time")
+ s.date = require("ui.central-panel.dashboard.date")
+ s.todo = require("ui.central-panel.dashboard.todo")
+ s.weather = require("ui.central-panel.dashboard.weather")
+ s.stats = require("ui.central-panel.dashboard.stats")
+
+ s.time_boxed = create_boxed_widget(centered_widget(s.time), dpi(260), dpi(90), beautiful.transparent)
+ s.date_boxed = create_boxed_widget(s.date, dpi(120), dpi(50), beautiful.dashboard_box_bg)
+ s.todo_boxed = create_boxed_widget(s.todo, dpi(120), dpi(120), beautiful.dashboard_box_bg)
+ s.weather_boxed = create_boxed_widget(s.weather, dpi(120), dpi(120), beautiful.dashboard_box_bg)
+ s.stats_boxed = create_boxed_widget(s.stats, dpi(120), dpi(190), beautiful.dashboard_box_bg)
+
+ -- Dashboard setup
+ return wibox.widget({
+ nil,
+ {
+ s.time_boxed,
+ {
+ {
+ s.profile,
+ s.stats_boxed,
+ layout = wibox.layout.fixed.vertical,
+ },
+ {
+ s.date_boxed,
+ s.todo_boxed,
+ s.weather_boxed,
+ layout = wibox.layout.fixed.vertical,
+ },
+ layout = wibox.layout.fixed.horizontal,
+ },
+ {
+ s.music,
+ s.media,
+ layout = wibox.layout.fixed.horizontal,
+ },
+ s.notifs_boxed,
+ layout = wibox.layout.fixed.vertical,
+ },
+ expand = "none",
+ layout = wibox.layout.align.horizontal,
+ })
+end
+
+return dashboard
diff --git a/config/awesome/ui/central-panel/dashboard/mediakeys.lua b/config/awesome/ui/central-panel/dashboard/mediakeys.lua
new file mode 100644
index 0000000..51594d0
--- /dev/null
+++ b/config/awesome/ui/central-panel/dashboard/mediakeys.lua
@@ -0,0 +1,93 @@
+-- Standard awesome library
+local gears = require("gears")
+local awful = require("awful")
+
+-- Theme handling library
+local beautiful = require("beautiful")
+
+-- Widget library
+local wibox = require("wibox")
+
+-- Helpers
+local helpers = require("helpers")
+
+-- Media Keys
+---------------
+
+--playerctl
+local playerctl = require("module.bling").signal.playerctl.lib()
+
+-- Helpers
+local create_media_button = function(symbol, color, command, playpause)
+ local icon = wibox.widget({
+ markup = helpers.colorize_text(symbol, color),
+ font = beautiful.icon_font_name .. "16",
+ align = "center",
+ valign = "center",
+ widget = wibox.widget.textbox(),
+ })
+
+ playerctl:connect_signal("playback_status", function(_, playing, __)
+ if playpause then
+ if playing then
+ icon:set_markup_silently(helpers.colorize_text("", color))
+ else
+ icon:set_markup_silently(helpers.colorize_text("", color))
+ end
+ end
+ end)
+
+ icon:buttons(gears.table.join(awful.button({}, 1, function()
+ command()
+ end)))
+
+ icon:connect_signal("mouse::enter", function()
+ icon.markup = helpers.colorize_text(icon.text, beautiful.xcolor15)
+ end)
+
+ icon:connect_signal("mouse::leave", function()
+ icon.markup = helpers.colorize_text(icon.text, color)
+ end)
+
+ return icon
+end
+
+-- Widget
+local media_play_command = function()
+ playerctl:play_pause()
+end
+local media_prev_command = function()
+ playerctl:previous()
+end
+local media_next_command = function()
+ playerctl:next()
+end
+
+local media_play = create_media_button("", beautiful.xforeground, media_play_command, true)
+local media_prev = create_media_button("", beautiful.xforeground, media_prev_command, false)
+local media_next = create_media_button("", beautiful.xforeground, media_next_command, false)
+
+local media = wibox.widget({
+ {
+ {
+ {
+ media_prev,
+ media_play,
+ media_next,
+ expand = "none",
+ layout = wibox.layout.align.vertical,
+ },
+ margins = dpi(9),
+ widget = wibox.container.margin,
+ },
+ bg = beautiful.dashboard_box_bg,
+ shape = helpers.rrect(5),
+ forced_width = dpi(40),
+ forced_height = dpi(120),
+ widget = wibox.container.background,
+ },
+ margins = dpi(10),
+ widget = wibox.container.margin,
+})
+
+return media
diff --git a/config/awesome/ui/central-panel/dashboard/music.lua b/config/awesome/ui/central-panel/dashboard/music.lua
new file mode 100644
index 0000000..dd8ae91
--- /dev/null
+++ b/config/awesome/ui/central-panel/dashboard/music.lua
@@ -0,0 +1,167 @@
+-- Standard awesome library
+local gears = require("gears")
+local awful = require("awful")
+
+-- Theme handling library
+local beautiful = require("beautiful")
+
+-- Widget library
+local wibox = require("wibox")
+
+-- Helpers
+local helpers = require("helpers")
+
+-- Music
+----------
+
+local music_text = wibox.widget({
+ font = beautiful.font_name .. "medium 8",
+ valign = "center",
+ widget = wibox.widget.textbox,
+})
+
+local music_art = wibox.widget({
+ image = gears.filesystem.get_configuration_dir() .. "theme/assets/no_music.png",
+ resize = true,
+ widget = wibox.widget.imagebox,
+})
+
+local music_art_container = wibox.widget({
+ music_art,
+ forced_height = dpi(120),
+ forced_width = dpi(120),
+ widget = wibox.container.background,
+})
+
+local filter_color = {
+ type = "linear",
+ from = { 0, 0 },
+ to = { 0, 120 },
+ stops = { { 0, beautiful.dashboard_box_bg .. "cc" }, { 1, beautiful.dashboard_box_bg } },
+}
+
+local music_art_filter = wibox.widget({
+ {
+ bg = filter_color,
+ forced_height = dpi(120),
+ forced_width = dpi(120),
+ widget = wibox.container.background,
+ },
+ direction = "east",
+ widget = wibox.container.rotate,
+})
+
+local music_title = wibox.widget({
+ font = beautiful.font_name .. "medium 9",
+ valign = "center",
+ widget = wibox.widget.textbox,
+})
+
+local music_artist = wibox.widget({
+ font = beautiful.font_name .. "medium 12",
+ valign = "center",
+ widget = wibox.widget.textbox,
+})
+
+local music_pos = wibox.widget({
+ font = beautiful.font_name .. "medium 8",
+ valign = "center",
+ widget = wibox.widget.textbox,
+})
+
+-- playerctl
+---------------
+
+local playerctl = require("module.bling").signal.playerctl.lib()
+
+playerctl:connect_signal("metadata", function(_, title, artist, album_path, __, ___, ____)
+ if title == "" then
+ title = "Nothing Playing"
+ end
+ if artist == "" then
+ artist = "Nothing Playing"
+ end
+ if album_path == "" then
+ album_path = gears.filesystem.get_configuration_dir() .. "theme/assets/no_music.png"
+ end
+
+ music_art:set_image(gears.surface.load_uncached(album_path))
+ music_title:set_markup_silently(helpers.colorize_text(title, beautiful.xforeground .. "b3"))
+ music_artist:set_markup_silently(helpers.colorize_text(artist, beautiful.xforeground .. "e6"))
+end)
+
+playerctl:connect_signal("playback_status", function(_, playing, __)
+ if playing then
+ music_text:set_markup_silently(helpers.colorize_text("Now Playing", beautiful.xforeground .. "cc"))
+ else
+ music_text:set_markup_silently(helpers.colorize_text("Music", beautiful.xforeground .. "cc"))
+ end
+end)
+
+playerctl:connect_signal("position", function(_, interval_sec, length_sec, player_name)
+ local pos_now = tostring(os.date("!%M:%S", math.floor(interval_sec)))
+ local pos_length = tostring(os.date("!%M:%S", math.floor(length_sec)))
+ local pos_markup = helpers.colorize_text(pos_now .. " / " .. pos_length, beautiful.xforeground .. "66")
+
+ music_pos:set_markup_silently(pos_markup)
+end)
+
+local music = wibox.widget({
+ {
+ {
+ {
+ music_art_container,
+ music_art_filter,
+ layout = wibox.layout.stack,
+ },
+ {
+ {
+ music_text,
+ {
+ {
+ {
+ step_function = wibox.container.scroll.step_functions.waiting_nonlinear_back_and_forth,
+ speed = 50,
+ {
+ widget = music_artist,
+ },
+ forced_width = dpi(180),
+ widget = wibox.container.scroll.horizontal,
+ },
+ {
+ step_function = wibox.container.scroll.step_functions.waiting_nonlinear_back_and_forth,
+ speed = 50,
+ {
+ widget = music_title,
+ },
+ forced_width = dpi(180),
+ widget = wibox.container.scroll.horizontal,
+ },
+ layout = wibox.layout.fixed.vertical,
+ },
+ bottom = dpi(15),
+ widget = wibox.container.margin,
+ },
+ music_pos,
+ expand = "none",
+ layout = wibox.layout.align.vertical,
+ },
+ top = dpi(9),
+ bottom = dpi(9),
+ left = dpi(10),
+ right = dpi(10),
+ widget = wibox.container.margin,
+ },
+ layout = wibox.layout.stack,
+ },
+ bg = beautiful.dashboard_box_bg,
+ shape = helpers.rrect(dpi(5)),
+ forced_width = dpi(200),
+ forced_height = dpi(120),
+ widget = wibox.container.background,
+ },
+ margins = dpi(10),
+ widget = wibox.container.margin,
+})
+
+return music
diff --git a/config/awesome/ui/central-panel/dashboard/profile.lua b/config/awesome/ui/central-panel/dashboard/profile.lua
new file mode 100644
index 0000000..afb15fc
--- /dev/null
+++ b/config/awesome/ui/central-panel/dashboard/profile.lua
@@ -0,0 +1,39 @@
+-- Standard awesome library
+local awful = require("awful")
+
+-- Theme handling library
+local beautiful = require("beautiful")
+
+-- Widget library
+local wibox = require("wibox")
+
+-- Helpers
+local helpers = require("helpers")
+
+-- Profile
+------------
+
+local profile_pic_img = wibox.widget({
+ image = beautiful.pfp,
+ halign = "center",
+ valign = "center",
+ widget = wibox.widget.imagebox,
+})
+
+local profile_pic_container = wibox.widget({
+ shape = helpers.rrect(5),
+ forced_height = dpi(120),
+ forced_width = dpi(120),
+ widget = wibox.container.background,
+})
+
+local profile = wibox.widget({
+ {
+ profile_pic_img,
+ widget = profile_pic_container,
+ },
+ margins = dpi(10),
+ widget = wibox.container.margin,
+})
+
+return profile
diff --git a/config/awesome/ui/central-panel/dashboard/stats.lua b/config/awesome/ui/central-panel/dashboard/stats.lua
new file mode 100644
index 0000000..a425f17
--- /dev/null
+++ b/config/awesome/ui/central-panel/dashboard/stats.lua
@@ -0,0 +1,187 @@
+-- Standard awesome library
+local gears = require("gears")
+local awful = require("awful")
+
+-- Theme handling library
+local beautiful = require("beautiful")
+
+-- Notification library
+local naughty = require("naughty")
+
+-- Widget library
+local wibox = require("wibox")
+
+-- rubato
+local rubato = require("module.rubato")
+
+-- Helpers
+local helpers = require("helpers")
+
+-- Stats
+----------
+
+local stats_text = wibox.widget({
+ font = beautiful.font_name .. "medium 8",
+ markup = helpers.colorize_text("Stats", beautiful.dashboard_box_fg),
+ valign = "center",
+ widget = wibox.widget.textbox,
+})
+
+-- Vars
+local vol_color = beautiful.xcolor4
+local brightness_color = beautiful.xcolor5
+local cpu_color = beautiful.xcolor6
+local ram_color = beautiful.xcolor2
+
+-- Helpers
+local function create_slider_widget(slider_color)
+ local slider_widget = wibox.widget({
+ {
+ id = "slider",
+ max_value = 100,
+ value = 20,
+ background_color = slider_color .. "44",
+ color = slider_color,
+ shape = gears.shape.rounded_rect,
+ bar_shape = gears.shape.rounded_rect,
+ widget = wibox.widget.progressbar,
+ },
+ forced_width = dpi(4),
+ forced_height = dpi(145),
+ direction = "east",
+ widget = wibox.container.rotate,
+ })
+
+ return slider_widget
+end
+
+local stats_tooltip = wibox.widget({
+ visible = false,
+ top_only = true,
+ layout = wibox.layout.stack,
+})
+
+local tooltip_counter = 0
+local function create_tooltip(w)
+ local tooltip = wibox.widget({
+ font = beautiful.font_name .. "medium 8",
+ align = "right",
+ valign = "center",
+ widget = wibox.widget.textbox,
+ })
+
+ tooltip_counter = tooltip_counter + 1
+ local index = tooltip_counter
+
+ stats_tooltip:insert(index, tooltip)
+
+ w:connect_signal("mouse::enter", function()
+ -- Raise tooltip to the top of the stack
+ stats_tooltip:set(1, tooltip)
+ stats_tooltip.visible = true
+ end)
+ w:connect_signal("mouse::leave", function()
+ stats_tooltip.visible = false
+ end)
+
+ return tooltip
+end
+
+-- Widget
+local vol = create_slider_widget(vol_color)
+local brightness = create_slider_widget(brightness_color)
+local cpu = create_slider_widget(cpu_color)
+local ram = create_slider_widget(ram_color)
+
+local vol_tooltip = create_tooltip(vol)
+local brightness_tooltip = create_tooltip(brightness)
+local cpu_tooltip = create_tooltip(cpu)
+local ram_tooltip = create_tooltip(ram)
+
+awesome.connect_signal("signal::volume", function(value, muted)
+ local fill_color
+ local vol_value = value or 0
+
+ if muted then
+ fill_color = beautiful.xcolor8
+ else
+ fill_color = vol_color
+ end
+
+ vol.slider.value = vol_value
+ vol.slider.color = fill_color
+ vol_tooltip.markup = helpers.colorize_text(vol_value .. "%", vol_color)
+end)
+
+awesome.connect_signal("signal::brightness", function(value)
+ brightness.slider.value = value
+ brightness_tooltip.markup = helpers.colorize_text(value .. "%", brightness_color)
+end)
+
+awesome.connect_signal("signal::cpu", function(value)
+ cpu.slider.value = value
+ cpu_tooltip.markup = helpers.colorize_text(value .. "%", cpu_color)
+end)
+
+awesome.connect_signal("signal::ram", function(used, total)
+ local r_average = (used / total) * 100
+ local r_used = string.format("%.1f", used / 1000) .. "G"
+
+ ram.slider.value = r_average
+ ram_tooltip.markup = helpers.colorize_text(r_used, ram_color)
+end)
+
+vol:buttons(gears.table.join(
+ awful.button({}, 1, function()
+ helpers.volume_control(0)
+ end),
+ -- Scrolling
+ awful.button({}, 4, function()
+ helpers.volume_control(5)
+ end),
+ awful.button({}, 5, function()
+ helpers.volume_control(-5)
+ end)
+))
+
+brightness:buttons(gears.table.join(
+ -- Scrolling
+ awful.button({}, 4, function()
+ awful.spawn.with_shell("brightnessctl set 5%+ -q")
+ end),
+ awful.button({}, 5, function()
+ awful.spawn.with_shell("brightnessctl set 5%- -q")
+ end)
+))
+
+local stats = wibox.widget({
+ {
+ stats_text,
+ nil,
+ stats_tooltip,
+ expand = "none",
+ layout = wibox.layout.align.horizontal,
+ },
+ {
+ nil,
+ {
+ nil,
+ {
+ vol,
+ brightness,
+ cpu,
+ ram,
+ spacing = dpi(24),
+ layout = wibox.layout.fixed.horizontal,
+ },
+ expand = "none",
+ layout = wibox.layout.fixed.vertical,
+ },
+ expand = "none",
+ layout = wibox.layout.align.horizontal,
+ },
+ spacing = dpi(10),
+ layout = wibox.layout.fixed.vertical,
+})
+
+return stats
diff --git a/config/awesome/ui/central-panel/dashboard/time.lua b/config/awesome/ui/central-panel/dashboard/time.lua
new file mode 100644
index 0000000..f137234
--- /dev/null
+++ b/config/awesome/ui/central-panel/dashboard/time.lua
@@ -0,0 +1,57 @@
+-- Standard awesome library
+local awful = require("awful")
+
+-- Theme handling library
+local beautiful = require("beautiful")
+
+-- Widget library
+local wibox = require("wibox")
+
+-- Helpers
+local helpers = require("helpers")
+
+-- Time
+---------
+local hours = wibox.widget.textclock("%H")
+local minutes = wibox.widget.textclock("%M")
+
+local make_little_dot = function(color)
+ return wibox.widget({
+ bg = color,
+ forced_width = dpi(10),
+ forced_height = dpi(10),
+ shape = helpers.rrect(dpi(2)),
+ widget = wibox.container.background,
+ })
+end
+
+local time = {
+ {
+ font = beautiful.font_name .. "bold 44",
+ align = "right",
+ valign = "top",
+ widget = hours,
+ },
+ {
+ nil,
+ {
+ make_little_dot(beautiful.xcolor1),
+ make_little_dot(beautiful.xcolor4),
+ make_little_dot(beautiful.xcolor5),
+ spacing = dpi(10),
+ widget = wibox.layout.fixed.vertical,
+ },
+ expand = "none",
+ widget = wibox.layout.align.vertical,
+ },
+ {
+ font = beautiful.font_name .. "bold 44",
+ align = "left",
+ valign = "top",
+ widget = minutes,
+ },
+ spacing = dpi(20),
+ layout = wibox.layout.fixed.horizontal,
+}
+
+return time
diff --git a/config/awesome/ui/central-panel/dashboard/todo.lua b/config/awesome/ui/central-panel/dashboard/todo.lua
new file mode 100644
index 0000000..1ba68b5
--- /dev/null
+++ b/config/awesome/ui/central-panel/dashboard/todo.lua
@@ -0,0 +1,113 @@
+-- Standard awesome library
+local awful = require("awful")
+
+-- Theme handling library
+local beautiful = require("beautiful")
+
+-- Widget library
+local wibox = require("wibox")
+
+-- Helpers
+local helpers = require("helpers")
+
+-- Todo
+---------
+
+local todo_text = wibox.widget({
+ font = beautiful.font_name .. "medium 8",
+ markup = helpers.colorize_text("Todo", beautiful.dashboard_box_fg),
+ valign = "center",
+ widget = wibox.widget.textbox,
+})
+
+local todo_badge = wibox.widget({
+ font = beautiful.font_name .. "medium 8",
+ markup = helpers.colorize_text("0", beautiful.xcolor1),
+ valign = "center",
+ widget = wibox.widget.textbox,
+})
+
+local todo_stat_color = beautiful.xcolor8
+local todo_stat = wibox.widget({
+ colors = { todo_stat_color },
+ bg = todo_stat_color .. "44",
+ value = 5,
+ min_value = 0,
+ max_value = 8,
+ thickness = dpi(8),
+ rounded_edge = true,
+ start_angle = math.pi * 3 / 2,
+ widget = wibox.container.arcchart,
+})
+
+local todo_done = wibox.widget({
+ font = beautiful.font_name .. "bold 14",
+ markup = "0",
+ valign = "bottom",
+ widget = wibox.widget.textbox,
+})
+
+local todo_total = wibox.widget({
+ font = beautiful.font_name .. "bold 8",
+ markup = helpers.colorize_text("/0", beautiful.xcolor8),
+ valign = "bottom",
+ widget = wibox.widget.textbox,
+})
+
+local todo = wibox.widget({
+ {
+ todo_text,
+ nil,
+ todo_badge,
+ expand = "none",
+ layout = wibox.layout.align.horizontal,
+ },
+ {
+ {
+ {
+ todo_stat,
+ reflection = { horizontal = true },
+ widget = wibox.container.mirror,
+ },
+ {
+ nil,
+ {
+ nil,
+ {
+ todo_done,
+ todo_total,
+ spacing = dpi(1),
+ layout = wibox.layout.fixed.horizontal,
+ },
+ expand = "none",
+ layout = wibox.layout.align.vertical,
+ },
+ expand = "none",
+ layout = wibox.layout.align.horizontal,
+ },
+ layout = wibox.layout.stack,
+ },
+ margins = dpi(10),
+ widget = wibox.container.margin,
+ },
+ layout = wibox.layout.fixed.vertical,
+})
+
+awesome.connect_signal("signal::todo", function(total, done, undone)
+ todo_badge.markup = helpers.colorize_text("-" .. undone, beautiful.xcolor1)
+
+ todo_total.markup = helpers.colorize_text("/" .. total, beautiful.xcolor8)
+
+ if total == 0 then
+ todo_badge.visible = false
+ total = 1
+ else
+ todo_badge.visible = true
+ end
+
+ todo_done.markup = done
+ todo_stat.max_value = total
+ todo_stat.value = done
+end)
+
+return todo
diff --git a/config/awesome/ui/central-panel/dashboard/weather.lua b/config/awesome/ui/central-panel/dashboard/weather.lua
new file mode 100644
index 0000000..c6bde0e
--- /dev/null
+++ b/config/awesome/ui/central-panel/dashboard/weather.lua
@@ -0,0 +1,65 @@
+-- Standard awesome library
+local gears = require("gears")
+local awful = require("awful")
+
+-- Theme handling library
+local beautiful = require("beautiful")
+
+-- Widget library
+local wibox = require("wibox")
+
+-- Helpers
+local helpers = require("helpers")
+
+-- Weather
+------------
+
+local weather_text = wibox.widget({
+ font = beautiful.font_name .. "medium 8",
+ markup = helpers.colorize_text("Weather unavailable", beautiful.dashboard_box_fg),
+ valign = "center",
+ widget = wibox.widget.textbox,
+})
+
+local weather_temp = wibox.widget({
+ font = beautiful.font_name .. "medium 11",
+ markup = "999°C",
+ valign = "center",
+ widget = wibox.widget.textbox,
+})
+
+local weather_icon = wibox.widget({
+ font = "icomoon 36",
+ markup = helpers.colorize_text("", beautiful.xcolor2),
+ align = "right",
+ valign = "bottom",
+ widget = wibox.widget.textbox,
+})
+
+local weather = wibox.widget({
+ {
+ weather_text,
+ weather_temp,
+ spacing = dpi(3),
+ layout = wibox.layout.fixed.vertical,
+ },
+ nil,
+ weather_icon,
+ expand = "none",
+ layout = wibox.layout.align.vertical,
+})
+
+awesome.connect_signal("signal::weather", function(temperature, description, icon_widget)
+ local weather_temp_symbol
+ if weather_units == "metric" then
+ weather_temp_symbol = "°C"
+ elseif weather_units == "imperial" then
+ weather_temp_symbol = "°F"
+ end
+
+ weather_icon.markup = icon_widget
+ weather_text.markup = helpers.colorize_text(description, beautiful.dashboard_box_fg)
+ weather_temp.markup = temperature .. weather_temp_symbol
+end)
+
+return weather
diff --git a/config/awesome/ui/central-panel/init.lua b/config/awesome/ui/central-panel/init.lua
new file mode 100644
index 0000000..5f9b524
--- /dev/null
+++ b/config/awesome/ui/central-panel/init.lua
@@ -0,0 +1,148 @@
+-- Standard awesome library
+local gears = require("gears")
+local awful = require("awful")
+
+-- Theme handling library
+local beautiful = require("beautiful")
+
+-- Widget library
+local wibox = require("wibox")
+
+-- rubato
+local rubato = require("module.rubato")
+
+-- Helpers
+local helpers = require("helpers")
+
+-- Aesthetic Dashboard
+-------------------------
+local panel_visible = false
+
+awful.screen.connect_for_each_screen(function(s)
+ -- Dashboard and animations init
+ local separator = wibox.widget({
+ orientation = "horizontal",
+ opacity = 0.0,
+ forced_height = 15,
+ widget = wibox.widget.separator,
+ })
+
+ central_panel = wibox({
+ type = "dock",
+ screen = s,
+ height = dpi(670),
+ width = dpi(620),
+ bg = beautiful.transparent,
+ ontop = true,
+ visible = false,
+ })
+
+ awful.placement.centered(central_panel, { honor_workarea = true, margins = beautiful.useless_gap * 5 })
+
+ -- Rubato
+ local slide = rubato.timed({
+ pos = dpi(-s.geometry.height),
+ rate = 60,
+ duration = 0.25,
+ intro = 0.125,
+ easing = rubato.quadratic,
+ awestore_compat = true,
+ subscribed = function(pos)
+ central_panel.y = pos
+ end,
+ })
+
+ local central_panel_status = false
+
+ slide.ended:subscribe(function()
+ if central_panel_status then
+ central_panel.visible = false
+ end
+ end)
+
+ -- Make toogle button
+ local central_panel_show = function()
+ central_panel.visible = true
+ slide:set(dpi(80))
+ central_panel_status = false
+
+ central_panel:emit_signal("opened")
+ end
+
+ local central_panel_hide = function()
+ slide:set(-s.geometry.height)
+ central_panel_status = true
+
+ central_panel:emit_signal("closed")
+ end
+
+ function central_panel:toggle()
+ self.opened = not self.opened
+ if self.opened then
+ central_panel_hide()
+ else
+ central_panel_show()
+ end
+ end
+
+ function central_panel:switch_pane(mode)
+ if mode == "dashboard_mode" then
+ -- Update Content
+ central_panel:get_children_by_id("settings_id")[1].visible = false
+ central_panel:get_children_by_id("dashboard_id")[1].visible = true
+ elseif mode == "settings_mode" then
+ -- Update Content
+ central_panel:get_children_by_id("dashboard_id")[1].visible = false
+ central_panel:get_children_by_id("settings_id")[1].visible = true
+ end
+ end
+
+ central_panel:setup({
+ {
+ {
+ expand = "none",
+ layout = wibox.layout.fixed.vertical,
+ {
+ layout = wibox.layout.align.horizontal,
+ expand = "none",
+ nil,
+ require("ui.widgets.central-panel-switch"),
+ nil,
+ },
+ separator,
+ {
+ layout = wibox.layout.stack,
+ {
+ id = "dashboard_id",
+ visible = true,
+ layout = wibox.layout.fixed.vertical,
+ {
+ layout = wibox.layout.flex.horizontal,
+ spacing = 10,
+ spacing_widget = wibox.widget.separator({
+ span_ratio = 0.80,
+ color = beautiful.lighter_bg,
+ }),
+ require("ui.central-panel.dashboard")(s),
+ require("ui.central-panel.notif-center")(s),
+ },
+ },
+ {
+ id = "settings_id",
+ visible = false,
+ layout = wibox.layout.fixed.vertical,
+ {
+ layout = wibox.layout.fixed.vertical,
+ require("ui.central-panel.settings")(s),
+ },
+ },
+ },
+ },
+ margins = dpi(10),
+ widget = wibox.container.margin,
+ },
+ bg = beautiful.dashboard_bg,
+ shape = helpers.rrect(beautiful.notif_center_radius),
+ widget = wibox.container.background,
+ })
+end)
diff --git a/config/awesome/ui/central-panel/notif-center/build-notifbox/empty-notifbox.lua b/config/awesome/ui/central-panel/notif-center/build-notifbox/empty-notifbox.lua
new file mode 100644
index 0000000..624ce8e
--- /dev/null
+++ b/config/awesome/ui/central-panel/notif-center/build-notifbox/empty-notifbox.lua
@@ -0,0 +1,52 @@
+local wibox = require("wibox")
+local beautiful = require("beautiful")
+local dpi = beautiful.xresources.apply_dpi
+local gears = require("gears")
+local icons = require("theme.assets.icons")
+
+local empty_notifbox = wibox.widget({
+ {
+ layout = wibox.layout.fixed.vertical,
+ spacing = dpi(20),
+ {
+ expand = "none",
+ layout = wibox.layout.align.horizontal,
+ nil,
+ {
+ image = gears.color.recolor_image(icons.notification_bell, beautiful.accent),
+ resize = true,
+ forced_height = dpi(140),
+ forced_width = dpi(140),
+ widget = wibox.widget.imagebox,
+ },
+ nil,
+ },
+ {
+ text = "No Notifications? :(",
+ font = beautiful.font_name .. "Bold 14",
+ align = "center",
+ valign = "center",
+ widget = wibox.widget.textbox,
+ },
+ },
+ margins = dpi(20),
+ widget = wibox.container.margin,
+})
+
+local separator_for_empty_msg = wibox.widget({
+ orientation = "vertical",
+ opacity = 0.0,
+ widget = wibox.widget.separator,
+})
+
+-- Make empty_notifbox center
+local centered_empty_notifbox = wibox.widget({
+ layout = wibox.layout.align.vertical,
+ forced_height = dpi(500),
+ expand = "none",
+ separator_for_empty_msg,
+ empty_notifbox,
+ separator_for_empty_msg,
+})
+
+return centered_empty_notifbox
diff --git a/config/awesome/ui/central-panel/notif-center/build-notifbox/init.lua b/config/awesome/ui/central-panel/notif-center/build-notifbox/init.lua
new file mode 100644
index 0000000..baf8f2c
--- /dev/null
+++ b/config/awesome/ui/central-panel/notif-center/build-notifbox/init.lua
@@ -0,0 +1,61 @@
+local wibox = require("wibox")
+local awful = require("awful")
+local gears = require("gears")
+local naughty = require("naughty")
+local beautiful = require("beautiful")
+local dpi = beautiful.xresources.apply_dpi
+local icons = require("theme.assets.icons")
+local empty_notifbox = require("ui.central-panel.notif-center.build-notifbox.empty-notifbox")
+local notifbox_scroller = require("ui.central-panel.notif-center.build-notifbox.notifbox-scroller")
+
+local notif_core = {}
+
+notif_core.remove_notifbox_empty = true
+
+notif_core.notifbox_layout = wibox.widget({
+ layout = wibox.layout.fixed.vertical,
+ spacing = dpi(10),
+ empty_notifbox,
+})
+
+notifbox_scroller(notif_core.notifbox_layout)
+
+notif_core.reset_notifbox_layout = function()
+ notif_core.notifbox_layout:reset()
+ notif_core.notifbox_layout:insert(1, empty_notifbox)
+ notif_core.remove_notifbox_empty = true
+end
+
+local notifbox_add = function(n, notif_icon, notifbox_color)
+ if #notif_core.notifbox_layout.children == 1 and notif_core.remove_notifbox_empty then
+ notif_core.notifbox_layout:reset(notif_core.notifbox_layout)
+ notif_core.remove_notifbox_empty = false
+ end
+
+ local notifbox_box = require("ui.central-panel.notif-center.build-notifbox.notifbox-builder")
+ notif_core.notifbox_layout:insert(1, notifbox_box(n, notif_icon, n.title, n.message, n.app_name, notifbox_color))
+end
+
+local notifbox_add_expired = function(n, notif_icon, notifbox_color)
+ n:connect_signal("destroyed", function(self, reason, keep_visble)
+ if reason == 1 then
+ notifbox_add(n, notif_icon, notifbox_color)
+ end
+ end)
+end
+
+naughty.connect_signal("request::display", function(n)
+ local notifbox_color = beautiful.notif_center_notifs_bg
+ if n.urgency == "critical" then
+ notifbox_color = n.bg .. "66"
+ end
+
+ local notif_icon = n.icon or n.app_icon
+ if not notif_icon then
+ notif_icon = gears.color.recolor_image(icons.notification, beautiful.accent)
+ end
+
+ notifbox_add_expired(n, notif_icon, notifbox_color)
+end)
+
+return notif_core
diff --git a/config/awesome/ui/central-panel/notif-center/build-notifbox/notifbox-builder.lua b/config/awesome/ui/central-panel/notif-center/build-notifbox/notifbox-builder.lua
new file mode 100644
index 0000000..987f321
--- /dev/null
+++ b/config/awesome/ui/central-panel/notif-center/build-notifbox/notifbox-builder.lua
@@ -0,0 +1,170 @@
+local wibox = require("wibox")
+local awful = require("awful")
+local gears = require("gears")
+local beautiful = require("beautiful")
+
+local dpi = beautiful.xresources.apply_dpi
+
+local builder = require("ui.central-panel.notif-center.build-notifbox.notifbox-ui-elements")
+local notifbox_core = require("ui.central-panel.notif-center.build-notifbox")
+
+local notifbox_layout = notifbox_core.notifbox_layout
+local remove_notifbox_empty = notifbox_core.remove_notifbox_empty
+local reset_notifbox_layout = notifbox_core.reset_notifbox_layout
+
+local return_date_time = function(format)
+ return os.date(format)
+end
+
+local parse_to_seconds = function(time)
+ local hourInSec = tonumber(string.sub(time, 1, 2)) * 3600
+ local minInSec = tonumber(string.sub(time, 4, 5)) * 60
+ local getSec = tonumber(string.sub(time, 7, 8))
+ return (hourInSec + minInSec + getSec)
+end
+
+notifbox_box = function(notif, icon, title, message, app, bgcolor)
+ local time_of_pop = return_date_time("%H:%M:%S")
+ local exact_time = return_date_time("%I:%M %p")
+ local exact_date_time = return_date_time("%b %d, %I:%M %p")
+
+ local notifbox_timepop = wibox.widget({
+ id = "time_pop",
+ markup = nil,
+ font = beautiful.font_name .. "Regular 10",
+ align = "left",
+ valign = "center",
+ visible = true,
+ widget = wibox.widget.textbox,
+ })
+
+ local notifbox_dismiss = builder.notifbox_dismiss()
+
+ local time_of_popup = gears.timer({
+ timeout = 60,
+ call_now = true,
+ autostart = true,
+ callback = function()
+ local time_difference = nil
+
+ time_difference = parse_to_seconds(return_date_time("%H:%M:%S")) - parse_to_seconds(time_of_pop)
+ time_difference = tonumber(time_difference)
+
+ if time_difference < 60 then
+ notifbox_timepop:set_markup("now")
+ elseif time_difference >= 60 and time_difference < 3600 then
+ local time_in_minutes = math.floor(time_difference / 60)
+ notifbox_timepop:set_markup(time_in_minutes .. "m ago")
+ elseif time_difference >= 3600 and time_difference < 86400 then
+ notifbox_timepop:set_markup(exact_time)
+ elseif time_difference >= 86400 then
+ notifbox_timepop:set_markup(exact_date_time)
+ return false
+ end
+
+ collectgarbage("collect")
+ end,
+ })
+
+ local notifbox_template = wibox.widget({
+ id = "notifbox_template",
+ expand = "none",
+ {
+ {
+ layout = wibox.layout.fixed.vertical,
+ spacing = dpi(5),
+ {
+ expand = "none",
+ layout = wibox.layout.align.horizontal,
+ {
+ layout = wibox.layout.fixed.horizontal,
+ spacing = dpi(5),
+ builder.notifbox_icon(icon),
+ builder.notifbox_appname(app),
+ },
+ nil,
+ {
+ notifbox_timepop,
+ notifbox_dismiss,
+ layout = wibox.layout.fixed.horizontal,
+ },
+ },
+ {
+ layout = wibox.layout.fixed.vertical,
+ spacing = dpi(5),
+ {
+ builder.notifbox_title(title),
+ builder.notifbox_message(message),
+ layout = wibox.layout.fixed.vertical,
+ },
+ builder.notifbox_actions(notif),
+ },
+ },
+ margins = dpi(10),
+ widget = wibox.container.margin,
+ },
+ bg = bgcolor,
+ shape = function(cr, width, height)
+ gears.shape.partially_rounded_rect(
+ cr,
+ width,
+ height,
+ true,
+ true,
+ true,
+ true,
+ beautiful.notif_center_box_radius
+ )
+ end,
+ widget = wibox.container.background,
+ })
+
+ -- Put the generated template to a container
+ local notifbox = wibox.widget({
+ notifbox_template,
+ shape = function(cr, width, height)
+ gears.shape.partially_rounded_rect(
+ cr,
+ width,
+ height,
+ true,
+ true,
+ true,
+ true,
+ beautiful.notif_center_box_radius
+ )
+ end,
+ widget = wibox.container.background,
+ })
+
+ -- Delete notification box
+ local notifbox_delete = function()
+ notifbox_layout:remove_widgets(notifbox, true)
+ end
+
+ notifbox_dismiss:buttons(awful.util.table.join(awful.button({}, 1, function()
+ if #notifbox_layout.children == 1 then
+ reset_notifbox_layout()
+ else
+ notifbox_delete()
+ end
+ collectgarbage("collect")
+ end)))
+
+ -- Add hover, and mouse leave events
+ notifbox_template:connect_signal("mouse::enter", function()
+ notifbox_timepop.visible = false
+ notifbox_dismiss.visible = true
+ end)
+
+ notifbox_template:connect_signal("mouse::leave", function()
+ notifbox_timepop.visible = true
+ notifbox_dismiss.visible = false
+ end)
+
+ collectgarbage("collect")
+
+ return notifbox
+end
+
+return notifbox_box
diff --git a/config/awesome/ui/central-panel/notif-center/build-notifbox/notifbox-geometry.lua b/config/awesome/ui/central-panel/notif-center/build-notifbox/notifbox-geometry.lua
new file mode 100644
index 0000000..ac2d424
--- /dev/null
+++ b/config/awesome/ui/central-panel/notif-center/build-notifbox/notifbox-geometry.lua
@@ -0,0 +1,30 @@
+local wibox = require("wibox")
+local awful = require("awful")
+local naughty = require("naughty")
+
+local find_widget_in_wibox = function(wb, widget)
+ local function find_widget_in_hierarchy(h, widget)
+ if h:get_widget() == widget then
+ return h
+ end
+ local result
+
+ for _, ch in ipairs(h:get_children()) do
+ result = result or find_widget_in_hierarchy(ch, widget)
+ end
+ return result
+ end
+ local h = wb._drawable._widget_hierarchy
+ return h and find_widget_in_hierarchy(h, widget)
+end
+
+local focused = awful.screen.focused()
+local h = find_widget_in_wibox(focused.top_panel, focused.music)
+local x, y, width, height = h:get_matrix_to_device():transform_rectangle(0, 0, h:get_size())
+-- local geo = focused.mywibox:geometry()
+
+-- x, y = x + geo.x, y + geo.y
+
+-- print(string.format("The widget is inside of the rectangle (%d, %d, %d, %d) on the screen", x, y, width, height)
+
+naughty.notification({ message = tostring(height) })
diff --git a/config/awesome/ui/central-panel/notif-center/build-notifbox/notifbox-scroller.lua b/config/awesome/ui/central-panel/notif-center/build-notifbox/notifbox-scroller.lua
new file mode 100644
index 0000000..e2b5a3f
--- /dev/null
+++ b/config/awesome/ui/central-panel/notif-center/build-notifbox/notifbox-scroller.lua
@@ -0,0 +1,23 @@
+local awful = require("awful")
+local gears = require("gears")
+
+local add_button_event = function(widget)
+ widget:buttons(gears.table.join(
+ awful.button({}, 4, nil, function()
+ if #widget.children == 1 then
+ return
+ end
+ widget:insert(1, widget.children[#widget.children])
+ widget:remove(#widget.children)
+ end),
+ awful.button({}, 5, nil, function()
+ if #widget.children == 1 then
+ return
+ end
+ widget:insert(#widget.children + 1, widget.children[1])
+ widget:remove(1)
+ end)
+ ))
+end
+
+return add_button_event
diff --git a/config/awesome/ui/central-panel/notif-center/build-notifbox/notifbox-ui-elements.lua b/config/awesome/ui/central-panel/notif-center/build-notifbox/notifbox-ui-elements.lua
new file mode 100644
index 0000000..8fc461d
--- /dev/null
+++ b/config/awesome/ui/central-panel/notif-center/build-notifbox/notifbox-ui-elements.lua
@@ -0,0 +1,126 @@
+local wibox = require("wibox")
+local beautiful = require("beautiful")
+local dpi = beautiful.xresources.apply_dpi
+local naughty = require("naughty")
+local gears = require("gears")
+local helpers = require("helpers")
+local clickable_container = require("ui.widgets.clickable-container")
+
+local ui_notifbox_builder = {}
+
+-- Notification icon container
+ui_notifbox_builder.notifbox_icon = function(ico_image)
+ local noti_icon = wibox.widget({
+ {
+ id = "icon",
+ resize = true,
+ forced_height = dpi(25),
+ forced_width = dpi(25),
+ widget = wibox.widget.imagebox,
+ },
+ layout = wibox.layout.fixed.horizontal,
+ })
+ noti_icon.icon:set_image(ico_image)
+ return noti_icon
+end
+
+-- Notification title container
+ui_notifbox_builder.notifbox_title = function(title)
+ return wibox.widget({
+ markup = title,
+ font = beautiful.font_name .. "Bold 12",
+ align = "left",
+ valign = "center",
+ widget = wibox.widget.textbox,
+ })
+end
+
+-- Notification message container
+ui_notifbox_builder.notifbox_message = function(msg)
+ return wibox.widget({
+ markup = msg,
+ font = beautiful.font_name .. "Regular 11",
+ align = "left",
+ valign = "center",
+ widget = wibox.widget.textbox,
+ })
+end
+
+-- Notification app name container
+ui_notifbox_builder.notifbox_appname = function(app)
+ return wibox.widget({
+ markup = app,
+ font = beautiful.font_name .. "Bold 12",
+ align = "left",
+ valign = "center",
+ widget = wibox.widget.textbox,
+ })
+end
+
+-- Notification actions container
+ui_notifbox_builder.notifbox_actions = function(n)
+ actions_template = wibox.widget({
+ notification = n,
+ base_layout = wibox.widget({
+ spacing = dpi(0),
+ layout = wibox.layout.flex.horizontal,
+ }),
+ widget_template = {
+ {
+ {
+ {
+ {
+ id = "text_role",
+ font = beautiful.font_name .. "Regular 10",
+ widget = wibox.widget.textbox,
+ },
+ widget = wibox.container.place,
+ },
+ widget = clickable_container,
+ },
+ bg = beautiful.accent,
+ shape = gears.shape.rounded_rect,
+ forced_height = 30,
+ widget = wibox.container.background,
+ },
+ margins = 4,
+ widget = wibox.container.margin,
+ },
+ style = { underline_normal = false, underline_selected = true },
+ widget = naughty.list.actions,
+ })
+
+ return actions_template
+end
+
+-- Notification dismiss button
+ui_notifbox_builder.notifbox_dismiss = function()
+ local dismiss_imagebox = wibox.widget({
+ align = "center",
+ valign = "center",
+ font = beautiful.icon_font_name .. "10",
+ markup = helpers.colorize_text("", beautiful.xcolor1),
+ widget = wibox.widget.textbox(),
+ })
+
+ local dismiss_button = wibox.widget({
+ {
+ dismiss_imagebox,
+ margins = dpi(5),
+ widget = wibox.container.margin,
+ },
+ widget = clickable_container,
+ })
+
+ local notifbox_dismiss = wibox.widget({
+ dismiss_button,
+ visible = false,
+ bg = beautiful.notif_center_notifs_accent,
+ shape = gears.shape.circle,
+ widget = wibox.container.background,
+ })
+
+ return notifbox_dismiss
+end
+
+return ui_notifbox_builder
diff --git a/config/awesome/ui/central-panel/notif-center/clear-all/init.lua b/config/awesome/ui/central-panel/notif-center/clear-all/init.lua
new file mode 100644
index 0000000..11ebeed
--- /dev/null
+++ b/config/awesome/ui/central-panel/notif-center/clear-all/init.lua
@@ -0,0 +1,49 @@
+local awful = require("awful")
+local wibox = require("wibox")
+local gears = require("gears")
+local beautiful = require("beautiful")
+local dpi = beautiful.xresources.apply_dpi
+local clickable_container = require("ui.widgets.clickable-container")
+local notifbox_core = require("ui.central-panel.notif-center.build-notifbox")
+local reset_notifbox_layout = notifbox_core.reset_notifbox_layout
+
+local clear_all_textbox = wibox.widget({
+ text = "Clear",
+ font = beautiful.font_name .. "Bold 12",
+ align = "center",
+ valign = "center",
+ widget = wibox.widget.textbox,
+})
+
+local clear_all_button = wibox.widget({
+ {
+ clear_all_textbox,
+ top = dpi(5),
+ bottom = dpi(5),
+ left = dpi(20),
+ right = dpi(20),
+ widget = wibox.container.margin,
+ },
+ widget = clickable_container,
+})
+
+clear_all_button:buttons(gears.table.join(awful.button({}, 1, nil, function()
+ reset_notifbox_layout()
+end)))
+
+local clear_all_button_wrapped = wibox.widget({
+ nil,
+ {
+ clear_all_button,
+ bg = beautiful.notif_center_notifs_bg,
+ shape = function(cr, width, height)
+ gears.shape.rounded_rect(cr, width, height, dpi(5))
+ end,
+ widget = wibox.container.background,
+ },
+ nil,
+ expand = "none",
+ layout = wibox.layout.align.vertical,
+})
+
+return clear_all_button_wrapped
diff --git a/config/awesome/ui/central-panel/notif-center/init.lua b/config/awesome/ui/central-panel/notif-center/init.lua
new file mode 100644
index 0000000..7524b7d
--- /dev/null
+++ b/config/awesome/ui/central-panel/notif-center/init.lua
@@ -0,0 +1,36 @@
+local wibox = require("wibox")
+local beautiful = require("beautiful")
+local dpi = beautiful.xresources.apply_dpi
+
+local notif_center = function(s)
+ s.clear_all = require("ui.central-panel.notif-center.clear-all")
+ s.notifbox_layout = require("ui.central-panel.notif-center.build-notifbox").notifbox_layout
+
+ return wibox.widget({
+ expand = "none",
+ layout = wibox.layout.align.vertical,
+ {
+ {
+ {
+ s.notifbox_layout,
+ spacing = dpi(10),
+ layout = wibox.layout.fixed.vertical,
+ },
+ forced_height = dpi(550),
+ widget = wibox.container.constraint,
+ },
+ margins = dpi(10),
+ widget = wibox.container.margin,
+ },
+ nil,
+ {
+ nil,
+ nil,
+ s.clear_all,
+ expand = "none",
+ layout = wibox.layout.align.horizontal,
+ },
+ })
+end
+
+return notif_center
diff --git a/config/awesome/ui/central-panel/settings/init.lua b/config/awesome/ui/central-panel/settings/init.lua
new file mode 100644
index 0000000..87fad8d
--- /dev/null
+++ b/config/awesome/ui/central-panel/settings/init.lua
@@ -0,0 +1,375 @@
+local gears = require("gears")
+local awful = require("awful")
+local beautiful = require("beautiful")
+local wibox = require("wibox")
+local helpers = require("helpers")
+local icons = require("theme.assets.icons")
+
+local format_item = function(widget)
+ return wibox.widget({
+ {
+ {
+ layout = wibox.layout.align.vertical,
+ expand = "none",
+ nil,
+ widget,
+ nil,
+ },
+ margins = dpi(10),
+ widget = wibox.container.margin,
+ },
+ forced_height = dpi(88),
+ bg = beautiful.control_center_widget_bg,
+ shape = helpers.rrect(beautiful.control_center_widget_radius),
+ widget = wibox.container.background,
+ })
+end
+
+local format_item_no_fix_height = function(widget)
+ return wibox.widget({
+ {
+ {
+ layout = wibox.layout.align.vertical,
+ expand = "none",
+ nil,
+ widget,
+ nil,
+ },
+ margins = dpi(10),
+ widget = wibox.container.margin,
+ },
+ bg = beautiful.control_center_widget_bg,
+ shape = helpers.rrect(beautiful.control_center_widget_radius),
+ widget = wibox.container.background,
+ })
+end
+
+local function format_progress_bar(bar, icon)
+ local widget_icon = wibox.widget({
+ image = gears.color.recolor_image(icon, beautiful.xforeground),
+ widget = wibox.widget.imagebox,
+ resize = true,
+ })
+ local w = wibox.widget({
+ {
+ {
+ {
+ bar,
+ reflection = { horizontal = true },
+ widget = wibox.container.mirror,
+ },
+ {
+ nil,
+ {
+ nil,
+ {
+ widget_icon,
+ margins = dpi(20),
+ widget = wibox.container.margin,
+ },
+ expand = "none",
+ layout = wibox.layout.align.vertical,
+ },
+ expand = "none",
+ layout = wibox.layout.align.horizontal,
+ },
+ layout = wibox.layout.stack,
+ },
+ margins = dpi(10),
+ widget = wibox.container.margin,
+ },
+ layout = wibox.layout.fixed.vertical,
+ })
+
+ return w
+end
+
+local function create_boxed_widget(widget_to_be_boxed, width, height, radius, bg_color)
+ local box_container = wibox.container.background()
+ box_container.bg = bg_color
+ box_container.forced_height = height
+ box_container.forced_width = width
+ box_container.shape = helpers.rrect(radius)
+
+ local boxed_widget = wibox.widget({
+ {
+ nil,
+ {
+ widget_to_be_boxed,
+ layout = wibox.layout.align.vertical,
+ expand = "none",
+ },
+ layout = wibox.layout.align.horizontal,
+ },
+ widget = box_container,
+ })
+ return boxed_widget
+end
+
+local function create_arc_container(markup, widget)
+ local text = wibox.widget({
+ font = beautiful.font_name .. "Bold 10",
+ markup = helpers.colorize_text(markup, beautiful.dashboard_box_fg),
+ valign = "center",
+ widget = wibox.widget.textbox,
+ })
+
+ local arc_container = wibox.widget({
+ {
+ {
+ text,
+ nil,
+ expand = "none",
+ layout = wibox.layout.align.horizontal,
+ },
+ widget,
+ layout = wibox.layout.fixed.vertical,
+ },
+ margins = dpi(10),
+ widget = wibox.container.margin,
+ })
+
+ return arc_container
+end
+
+local function create_buttons(icon, color)
+ local button = wibox.widget({
+ id = "icon",
+ markup = helpers.colorize_text(icon, color),
+ font = beautiful.icon_font_name .. "16",
+ align = "center",
+ valign = "center",
+ widget = wibox.widget.textbox,
+ })
+
+ local button_container = wibox.widget({
+ {
+ {
+ button,
+ margins = dpi(15),
+ forced_height = dpi(48),
+ forced_width = dpi(48),
+ widget = wibox.container.margin,
+ },
+ widget = require("ui.widgets.clickable-container"),
+ },
+ bg = beautiful.control_center_button_bg,
+ shape = gears.shape.circle,
+ widget = wibox.container.background,
+ })
+
+ return button_container
+end
+
+-- widgets
+-------------
+
+-- color indicator
+local off = beautiful.control_center_button_bg
+local on = beautiful.accent
+
+-- wifi button
+local wifi = create_buttons("", beautiful.xforeground)
+local wifi_status = false
+
+awesome.connect_signal("signal::network", function(status, ssid)
+ wifi_status = status
+ awesome.emit_signal("widget::network")
+end)
+
+awesome.connect_signal("widget::network", function()
+ local w, fill_color
+ if wifi_status == true then
+ fill_color = on
+ wifi:buttons({
+ awful.button({}, 1, function()
+ awful.spawn("nmcli radio wifi off")
+ end),
+ })
+ else
+ fill_color = off
+ wifi:buttons({
+ awful.button({}, 1, function()
+ awful.spawn("nmcli radio wifi on")
+ end),
+ })
+ end
+ wifi.bg = fill_color
+end)
+
+-- bluetooth button
+local bluetooth = create_buttons("", beautiful.xforeground)
+local bluetooth_status = true
+
+bluetooth:buttons({
+ awful.button({}, 1, function()
+ bluetooth_status = not bluetooth_status
+ if bluetooth_status then
+ bluetooth.bg = off
+ awful.spawn("bluetoothctl power off")
+ else
+ bluetooth.bg = on
+ awful.spawn("bluetoothctl power on")
+ end
+ end),
+})
+
+-- screenrec button
+local mic = require("ui.widgets.microphone")
+
+-- screenrec button
+local screenrec = require("ui.widgets.screenrec")()
+
+-- screenshot button
+local screenshot = create_buttons("", beautiful.xforeground)
+screenshot:buttons({
+ awful.button({}, 1, function()
+ central_panel:toggle()
+ awful.spawn.with_shell("screensht area")
+ end),
+})
+
+-- cpu arc
+local cpu_bar = require("ui.widgets.arc.cpu_arc")
+local cpu = format_progress_bar(cpu_bar, icons.cpu)
+local cpu_details = create_arc_container("Cpu", cpu)
+local cpu_box = create_boxed_widget(
+ cpu_details,
+ dpi(50),
+ dpi(150),
+ beautiful.control_center_widget_radius,
+ beautiful.control_center_widget_bg
+)
+
+-- ram arc
+local ram_bar = require("ui.widgets.arc.ram_arc")
+local ram = format_progress_bar(ram_bar, icons.ram)
+local ram_details = create_arc_container("Ram", ram)
+local ram_box = create_boxed_widget(
+ ram_details,
+ dpi(50),
+ dpi(150),
+ beautiful.control_center_widget_radius,
+ beautiful.control_center_widget_bg
+)
+
+-- temp arc
+local temp_bar = require("ui.widgets.arc.temp_arc")
+local temp = format_progress_bar(temp_bar, icons.temp)
+local temp_details = create_arc_container("Temp", temp)
+local temp_box = create_boxed_widget(
+ temp_details,
+ dpi(50),
+ dpi(150),
+ beautiful.control_center_widget_radius,
+ beautiful.control_center_widget_bg
+)
+
+-- disk arc
+local disk_bar = require("ui.widgets.arc.disk_arc")
+local disk = format_progress_bar(disk_bar, icons.disk)
+local disk_details = create_arc_container("Disk", disk)
+local disk_box = create_boxed_widget(
+ disk_details,
+ dpi(50),
+ dpi(150),
+ beautiful.control_center_widget_radius,
+ beautiful.control_center_widget_bg
+)
+
+-- Control Center
+--------------------
+local control_center = function(s)
+ s.control_center_row_one = wibox.widget({
+ layout = wibox.layout.align.horizontal,
+ forced_height = dpi(60),
+ nil,
+ format_item(require("ui.widgets.user-profile")()),
+ {
+ format_item({
+ layout = wibox.layout.fixed.horizontal,
+ require("ui.widgets.end-session")(),
+ }),
+ left = dpi(20),
+ widget = wibox.container.margin,
+ },
+ })
+
+ s.control_center_row_two = wibox.widget({
+ {
+ {
+ wifi,
+ bluetooth,
+ mic,
+ screenrec,
+ screenshot,
+ spacing = dpi(6),
+ layout = wibox.layout.flex.horizontal,
+ },
+ margins = dpi(12),
+ widget = wibox.container.margin,
+ },
+ shape = helpers.rrect(beautiful.control_center_widget_radius),
+ bg = beautiful.control_center_widget_bg,
+ widget = wibox.container.background,
+ })
+
+ s.control_center_row_five = wibox.widget({
+ layout = wibox.layout.flex.horizontal,
+ spacing = dpi(20),
+ ram_box,
+ cpu_box,
+ temp_box,
+ disk_box,
+ })
+
+ s.control_center_row_three = wibox.widget({
+ layout = wibox.layout.flex.horizontal,
+ spacing = dpi(20),
+ format_item_no_fix_height({
+ layout = wibox.layout.fixed.vertical,
+ spacing = dpi(5),
+ nil,
+ require("ui.widgets.dnd"),
+ require("ui.widgets.blue-light"),
+ require("ui.widgets.airplane-mode"),
+ nil,
+ }),
+ {
+ layout = wibox.layout.flex.vertical,
+ spacing = dpi(20),
+ format_item_no_fix_height({
+ layout = wibox.layout.align.vertical,
+ expand = "none",
+ nil,
+ require("ui.widgets.floating-mode"),
+ nil,
+ }),
+ {
+ layout = wibox.layout.flex.horizontal,
+ spacing = dpi(20),
+ require("ui.widgets.theme-switcher").day,
+ nil,
+ require("ui.widgets.theme-switcher").night,
+ },
+ },
+ })
+
+ s.control_center_row_four = require("ui.widgets.vol-bri-slider")
+
+ return wibox.widget({
+ {
+ s.control_center_row_one,
+ s.control_center_row_two,
+ s.control_center_row_three,
+ s.control_center_row_four,
+ s.control_center_row_five,
+ spacing = dpi(20),
+ layout = wibox.layout.fixed.vertical,
+ },
+ margins = dpi(10),
+ widget = wibox.container.margin,
+ })
+end
+
+return control_center
diff --git a/config/awesome/ui/decorations/init.lua b/config/awesome/ui/decorations/init.lua
index 3ba9820..51450e3 100644
--- a/config/awesome/ui/decorations/init.lua
+++ b/config/awesome/ui/decorations/init.lua
@@ -1,37 +1,2 @@
--- Standard awesome library
-local gears = require("gears")
-
--- Theme handling library
-local beautiful = require("beautiful")
-
--- Helpers
-local helpers = require("helpers")
-
--- Apply rounded corners to clients if needed
-if beautiful.border_radius and beautiful.border_radius > 0 then
- client.connect_signal("manage", function (c, startup)
- if not c.fullscreen and not c.maximized then
- c.shape = helpers.rrect(beautiful.border_radius)
- end
- end)
-
- -- Fullscreen and maximized clients should not have rounded corners
- local function no_round_corners (c)
- if c.fullscreen or c.maximized then
- c.shape = gears.shape.rectangle
- else
- c.shape = helpers.rrect(beautiful.border_radius)
- end
- end
-
- client.connect_signal("property::fullscreen", no_round_corners)
- client.connect_signal("property::maximized", no_round_corners)
-
- beautiful.snap_shape = helpers.rrect(beautiful.border_radius * 2)
-else
- beautiful.snap_shape = gears.shape.rectangle
-end
-
require("ui.decorations.titlebar")
require("ui.decorations.music")
-require("ui.decorations.twitch")
diff --git a/config/awesome/ui/decorations/music.lua b/config/awesome/ui/decorations/music.lua
index 61f9c90..ad0758b 100644
--- a/config/awesome/ui/decorations/music.lua
+++ b/config/awesome/ui/decorations/music.lua
@@ -14,206 +14,211 @@ local wibox = require("wibox")
-- Helpers
local helpers = require("helpers")
+-- Aesthetic Music Player
+----------------------------
-- Music icon
----------------
-local big_music_icon = wibox.widget{
- align = "center",
- font = beautiful.icon_font_name .. "Bold 16",
- markup = helpers.colorize_text("", beautiful.xcolor4),
- widget = wibox.widget.textbox()
-}
+local big_music_icon = wibox.widget({
+ align = "center",
+ font = beautiful.icon_font_name .. "15",
+ markup = helpers.colorize_text("", beautiful.accent),
+ widget = wibox.widget.textbox(),
+})
-local small_music_icon = wibox.widget{
- align = "center",
- font = beautiful.icon_font_name .. "Bold 12",
- markup = helpers.colorize_text("", beautiful.xforeground),
- widget = wibox.widget.textbox()
-}
+local small_music_icon = wibox.widget({
+ align = "center",
+ font = beautiful.icon_font_name .. "11",
+ markup = helpers.colorize_text("", beautiful.xforeground),
+ widget = wibox.widget.textbox(),
+})
-local container_music_icon = wibox.widget {
- big_music_icon,
- {
- small_music_icon,
- top = dpi(12),
- widget = wibox.container.margin
- },
- spacing = dpi(-8),
- layout = wibox.layout.fixed.horizontal
-}
+local container_music_icon = wibox.widget({
+ big_music_icon,
+ {
+ small_music_icon,
+ top = dpi(11),
+ widget = wibox.container.margin,
+ },
+ spacing = dpi(-9),
+ layout = wibox.layout.fixed.horizontal,
+})
-local music_icon = wibox.widget{
- nil,
- {
- container_music_icon,
- spacing = dpi(14),
- layout = wibox.layout.fixed.horizontal
- },
- expand = "none",
- layout = wibox.layout.align.horizontal,
- }
+local music_icon = wibox.widget({
+ nil,
+ {
+ container_music_icon,
+ spacing = dpi(14),
+ layout = wibox.layout.fixed.horizontal,
+ },
+ expand = "none",
+ layout = wibox.layout.align.horizontal,
+})
-- Helpers
-------------
local control_button_bg = "#00000000"
-local control_button_bg_hover = beautiful.xcolor0
+local control_button_bg_hover = beautiful.hover_effect
local control_button = function(c, symbol, color, font, size, on_click, on_right_click)
- local icon = wibox.widget{
- markup = helpers.colorize_text(symbol, color),
- font = font,
- align = "center",
- valign = "center",
- widget = wibox.widget.textbox()
- }
+ local icon = wibox.widget({
+ markup = helpers.colorize_text(symbol, color),
+ font = font,
+ align = "center",
+ valign = "center",
+ widget = wibox.widget.textbox(),
+ })
- local button = wibox.widget {
- icon,
- bg = control_button_bg,
- shape = helpers.rrect(dpi(5)),
- widget = wibox.container.background
- }
+ local button = wibox.widget({
+ icon,
+ bg = control_button_bg,
+ shape = helpers.rrect(dpi(5)),
+ widget = wibox.container.background,
+ })
- local container = wibox.widget {
- button,
- strategy = "min",
- width = dpi(30),
- widget = wibox.container.constraint,
- }
+ local container = wibox.widget({
+ button,
+ strategy = "min",
+ width = dpi(30),
+ widget = wibox.container.constraint,
+ })
- container:buttons(gears.table.join(
- awful.button({ }, 1, on_click),
- awful.button({ }, 3, on_right_click)
- ))
+ container:buttons(gears.table.join(awful.button({}, 1, on_click), awful.button({}, 3, on_right_click)))
- container:connect_signal("mouse::enter", function ()
- button.bg = control_button_bg_hover
- end)
- container:connect_signal("mouse::leave", function ()
- button.bg = control_button_bg
- end)
+ container:connect_signal("mouse::enter", function()
+ button.bg = control_button_bg_hover
+ end)
+ container:connect_signal("mouse::leave", function()
+ button.bg = control_button_bg
+ end)
- return container
+ return container
end
-local music_play_pause = control_button(c, "", beautiful.xforeground, beautiful.icon_font_name .. "Round 22", dpi(30), function()
- awful.spawn.with_shell("mpc -q toggle")
-end)
+-- Play Pause button
+local music_play_pause = control_button(
+ c,
+ "",
+ beautiful.xforeground,
+ beautiful.icon_font_name .. "22",
+ dpi(30),
+ function()
+ awful.spawn.with_shell("mpc -q toggle")
+ end
+)
-- Loop button
-local loop = control_button(c, "", beautiful.xforeground, beautiful.icon_font_name .. "Round 12", dpi(30), function()
- awful.spawn.with_shell("mpc repeat")
+local loop = control_button(c, "", beautiful.xforeground, beautiful.icon_font_name .. "12", dpi(30), function()
+ awful.spawn.with_shell("mpc repeat")
end)
--- Shuffle playlist
-local shuffle = control_button(c, "", beautiful.xforeground, beautiful.icon_font_name .. "Round 12", dpi(30), function()
- awful.spawn.with_shell("mpc random")
+-- Shuffle playlist button
+local shuffle = control_button(c, "", beautiful.xforeground, beautiful.icon_font_name .. "12", dpi(30), function()
+ awful.spawn.with_shell("mpc random")
end)
local function create_slider_widget(slider_color)
- local slider_widget = wibox.widget {
- {
- id = "slider",
- max_value = 100,
- value = 20,
- margins = {
- top = dpi(7),
- bottom = dpi(7),
- left = dpi(6),
- right = dpi(6),
- },
- forced_width = dpi(60),
- shape = gears.shape.rounded_bar,
- bar_shape = gears.shape.rounded_bar,
- color = slider_color,
- background_color = beautiful.xcolor0,
- widget = wibox.widget.progressbar
- },
- expand = "none",
- forced_width = 60,
- layout = wibox.layout.align.horizontal
- }
+ local slider_widget = wibox.widget({
+ {
+ id = "slider",
+ max_value = 100,
+ value = 20,
+ margins = {
+ top = dpi(7),
+ bottom = dpi(7),
+ left = dpi(6),
+ right = dpi(6),
+ },
+ forced_width = dpi(60),
+ shape = gears.shape.rounded_bar,
+ bar_shape = gears.shape.rounded_bar,
+ color = slider_color,
+ background_color = slider_color .. "44",
+ widget = wibox.widget.progressbar,
+ },
+ expand = "none",
+ forced_width = 60,
+ layout = wibox.layout.align.horizontal,
+ })
- return slider_widget
+ return slider_widget
end
-local stats_tooltip = wibox.widget {
- visible = false,
- top_only = true,
- layout = wibox.layout.stack
-}
+local stats_tooltip = wibox.widget({
+ visible = false,
+ top_only = true,
+ layout = wibox.layout.stack,
+})
local tooltip_counter = 0
local function create_tooltip(w)
- local tooltip = wibox.widget {
- font = beautiful.font_name .. "bold 10",
- align = "right",
- valign = "center",
- widget = wibox.widget.textbox
- }
+ local tooltip = wibox.widget({
+ font = beautiful.font_name .. "bold 10",
+ align = "right",
+ valign = "center",
+ widget = wibox.widget.textbox,
+ })
- tooltip_counter = tooltip_counter + 1
- local index = tooltip_counter
+ tooltip_counter = tooltip_counter + 1
+ local index = tooltip_counter
- stats_tooltip:insert(index, tooltip)
+ stats_tooltip:insert(index, tooltip)
- w:connect_signal("mouse::enter", function()
- -- Raise tooltip to the top of the stack
- stats_tooltip:set(1, tooltip)
- stats_tooltip.visible = true
- end)
- w:connect_signal("mouse::leave", function ()
- stats_tooltip.visible = false
- end)
+ w:connect_signal("mouse::enter", function()
+ -- Raise tooltip to the top of the stack
+ stats_tooltip:set(1, tooltip)
+ stats_tooltip.visible = true
+ end)
+ w:connect_signal("mouse::leave", function()
+ stats_tooltip.visible = false
+ end)
- return tooltip
+ return tooltip
end
-
-- Decorations
-----------------
+-----------------
-local music_art = wibox.widget {
- image = gears.filesystem.get_configuration_dir() .. "theme/assets/no_music.png",
- resize = true,
- widget = wibox.widget.imagebox
-}
-local music_art_container = wibox.widget{
- music_art,
- shape = helpers.rrect(dpi(5)),
- widget = wibox.container.background
-}
-local music_now = wibox.widget{
- font = beautiful.font_name .. "bold 10",
- valign = "center",
- widget = wibox.widget.textbox
-}
-local music_pos = wibox.widget{
- font = beautiful.font_name .. "bold 10",
- valign = "center",
- widget = wibox.widget.textbox
-}
-local music_bar = wibox.widget {
- max_value = 100,
- value = 0,
- background_color = beautiful.xcolor0,
- color = beautiful.xcolor4,
- forced_height = dpi(3),
- widget = wibox.widget.progressbar
-}
+
+
+
+
+
+
+
+
+local music_now = wibox.widget({
+ font = beautiful.font_name .. "bold 10",
+ valign = "center",
+ widget = wibox.widget.textbox,
+})
+
+local music_pos = wibox.widget({
+ font = beautiful.font_name .. "bold 10",
+ valign = "center",
+ widget = wibox.widget.textbox,
+})
+
+local music_bar = wibox.widget({
+ max_value = 100,
+ value = 0,
+ background_color = beautiful.accent .. "44",
+ color = beautiful.accent,
+ forced_height = dpi(3),
+ widget = wibox.widget.progressbar,
+})
music_bar:connect_signal("button::press", function(_, lx, __, button, ___, w)
- if button == 1 then
- awful.spawn.with_shell("mpc seek " .. math.ceil(lx * 100 / w.width) .. "%")
- end
+ if button == 1 then
+ awful.spawn.with_shell("mpc seek " .. math.ceil(lx * 100 / w.width) .. "%")
+ end
end)
-
local music_play_pause_textbox = music_play_pause:get_all_children()[1]:get_all_children()[1]
local loop_textbox = loop:get_all_children()[1]:get_all_children()[1]
local shuffle_textbox = shuffle:get_all_children()[1]:get_all_children()[1]
@@ -221,63 +226,69 @@ local shuffle_textbox = shuffle:get_all_children()[1]:get_all_children()[1]
-- Volume
--------
-local vol_color = beautiful.xcolor4
+local vol_color = beautiful.accent
local vol_slider = create_slider_widget(vol_color)
local vol_tooltip = create_tooltip(vol_slider)
-local vol_icon = wibox.widget{
- align = "center",
- font = "icomoon 16",
- markup = "",
- widget = wibox.widget.textbox
-}
+local vol_icon = wibox.widget({
+ align = "center",
+ font = beautiful.icon_font_name .. "16",
+ markup = helpers.colorize_text("", beautiful.accent),
+ widget = wibox.widget.textbox,
+})
-local vol_button = wibox.widget{
- vol_icon,
- bg = control_button_bg,
- shape = helpers.rrect(dpi(5)),
- widget = wibox.container.background
-}
+local vol_button = wibox.widget({
+ vol_icon,
+ bg = control_button_bg,
+ shape = helpers.rrect(dpi(5)),
+ widget = wibox.container.background,
+})
-local vol = wibox.widget {
- vol_button,
- strategy = "min",
- width = dpi(30),
- widget = wibox.container.constraint,
-}
+local vol = wibox.widget({
+ vol_button,
+ strategy = "min",
+ width = dpi(30),
+ widget = wibox.container.constraint,
+})
-vol:connect_signal("mouse::enter", function ()
- vol_button.bg = control_button_bg_hover
+vol:connect_signal("mouse::enter", function()
+ vol_button.bg = control_button_bg_hover
end)
-vol:connect_signal("mouse::leave", function ()
- vol_button.bg = control_button_bg
+vol:connect_signal("mouse::leave", function()
+ vol_button.bg = control_button_bg
end)
-vol:buttons(gears.table.join(
- awful.button({}, 1, function() helpers.volume_control(0) end)
-))
+vol:buttons(gears.table.join(awful.button({}, 1, function()
+ helpers.volume_control(0)
+end)))
awesome.connect_signal("signal::volume", function(value, muted)
- local fill_color
- local vol_value = value or 0
+ local fill_color
+ local vol_value = value or 0
- if muted then
- vol_icon.markup = helpers.colorize_text("", beautiful.xcolor8)
- fill_color = beautiful.xcolor8
- else
- vol_icon.markup = helpers.colorize_text("", beautiful.xforeground)
- fill_color = vol_color
- end
+ if muted then
+ vol_icon.markup = helpers.colorize_text("", beautiful.xcolor8)
+ fill_color = beautiful.xcolor8
+ else
+ vol_icon.markup = helpers.colorize_text("", beautiful.accent)
+ fill_color = vol_color
+ end
- vol_slider.slider.value = vol_value
- vol_slider.slider.color = fill_color
- vol_tooltip.markup = helpers.colorize_text(vol_value .. "%", vol_color)
+ vol_slider.slider.value = vol_value
+ vol_slider.slider.color = fill_color
+ vol_tooltip.markup = helpers.colorize_text(vol_value .. "%", vol_color)
end)
vol_slider:buttons(gears.table.join(
- awful.button({}, 1, function() helpers.volume_control(0) end),
- -- Scrolling
- awful.button({}, 4, function() helpers.volume_control(5) end),
- awful.button({}, 5, function() helpers.volume_control(-5) end)
+ awful.button({}, 1, function()
+ helpers.volume_control(0)
+ end),
+ -- Scrolling
+ awful.button({}, 4, function()
+ helpers.volume_control(5)
+ end),
+ awful.button({}, 5, function()
+ helpers.volume_control(-5)
+ end)
))
-- Playerctl
@@ -287,182 +298,207 @@ local playerctl = require("module.bling").signal.playerctl.lib()
local music_length = 0
playerctl:connect_signal("metadata", function(_, title, artist, album_path, album, ___, player_name)
- if player_name == "mpd" then
- local m_now = artist .. " - " .. title .. "/" .. album
+ if player_name == "mpd" then
+ local m_now = artist .. " - " .. title .. "/" .. album
-
- music_now:set_markup_silently(m_now)
- end
+
+ music_now:set_markup_silently(m_now)
+ end
end)
playerctl:connect_signal("position", function(_, interval_sec, length_sec, player_name)
- if player_name == "mpd" then
- local pos_now = tostring(os.date("!%M:%S", math.floor(interval_sec)))
- local pos_length = tostring(os.date("!%M:%S", math.floor(length_sec)))
- local pos_markup = pos_now .. helpers.colorize_text(" / " .. pos_length, beautiful.xcolor8)
+ if player_name == "mpd" then
+ local pos_now = tostring(os.date("!%M:%S", math.floor(interval_sec)))
+ local pos_length = tostring(os.date("!%M:%S", math.floor(length_sec)))
+ local pos_markup = pos_now .. helpers.colorize_text(" / " .. pos_length, beautiful.xforeground)
- music_art:set_image(gears.surface.load_uncached(album_path))
- music_pos:set_markup_silently(pos_markup)
- music_bar.value = (interval_sec / length_sec) * 100
- music_length = length_sec
- end
+ music_art:set_image(gears.surface.load_uncached(album_path))
+ music_pos:set_markup_silently(pos_markup)
+ music_bar.value = (interval_sec / length_sec) * 100
+ music_length = length_sec
+ end
end)
playerctl:connect_signal("playback_status", function(_, playing, player_name)
- if player_name == "mpd" then
- if playing then
- music_play_pause_textbox:set_markup_silently(helpers.colorize_text("", beautiful.xcolor4))
- else
- music_play_pause_textbox:set_markup_silently(helpers.colorize_text("", beautiful.xcolor4))
- end
- end
+ if player_name == "mpd" then
+ if playing then
+ music_play_pause_textbox:set_markup_silently(helpers.colorize_text("", beautiful.accent))
+ else
+ music_play_pause_textbox:set_markup_silently(helpers.colorize_text("", beautiful.accent))
+ end
+ end
end)
playerctl:connect_signal("loop_status", function(_, loop_status, player_name)
- if player_name == "mpd" then
- if loop_status == "none" then
- loop_textbox:set_markup_silently("")
- else
- loop_textbox:set_markup_silently("")
- end
- end
+ if player_name == "mpd" then
+ if loop_status == "none" then
+ loop_textbox:set_markup_silently("")
+ else
+ loop_textbox:set_markup_silently(helpers.colorize_text("", beautiful.accent))
+ end
+ end
end)
playerctl:connect_signal("shuffle", function(_, shuffle, player_name)
- if player_name == "mpd" then
- if shuffle then
- shuffle_textbox:set_markup_silently("")
- else
- shuffle_textbox:set_markup_silently("")
- end
- end
+ if player_name == "mpd" then
+ if shuffle then
+ shuffle_textbox:set_markup_silently(helpers.colorize_text("", beautiful.accent))
+ else
+ shuffle_textbox:set_markup_silently("")
+ end
+ end
end)
-local music_create_decoration = function (c)
+local music_create_decoration = function(c)
+ -- Hide default titlebar
+ awful.titlebar.hide(c, beautiful.titlebar_pos)
- -- Hide default titlebar
- awful.titlebar.hide(c, beautiful.titlebar_pos)
+ -- Titlebar
+ awful.titlebar(c, { position = "top", size = dpi(45), bg = beautiful.transparent }):setup({
+ {
+ {
+ {
+ {
+ {
+ vol,
+ nil,
+ vol_slider,
+ spacing = dpi(2),
+ layout = wibox.layout.fixed.horizontal,
+ },
+ stats_tooltip,
+ layout = wibox.layout.align.horizontal,
+ },
+ top = dpi(10),
+ bottom = dpi(5),
+ right = dpi(10),
+ left = dpi(15),
+ widget = wibox.container.margin,
+ },
+ forced_width = dpi(200),
+ widget = wibox.container.background,
+ },
+ {
+ widget = music_icon,
+ },
+ layout = wibox.layout.align.horizontal,
+ },
+ bg = beautiful.music_bg,
+ shape = helpers.prrect(beautiful.border_radius, true, true, false, false),
+ widget = wibox.container.background,
+ })
- -- Titlebar
- awful.titlebar(c, { position = "top", size = beautiful.titlebar_size, bg = beautiful.xbackground }):setup {
- {
- {
- {
- {
- vol,
- nil,
- vol_slider,
- spacing = dpi(2),
- layout = wibox.layout.fixed.horizontal
- },
- stats_tooltip,
- layout = wibox.layout.align.horizontal
- },
- top = dpi(10),
- bottom = dpi(10),
- right = dpi(10),
- left = dpi(15),
- widget = wibox.container.margin
- },
- forced_width = dpi(200),
- widget = wibox.container.background
- },
- {
- widget = music_icon
- },
- layout = wibox.layout.align.horizontal
- }
+ -- Sidebar
+ awful.titlebar(c, { position = "left", size = dpi(200) }):setup({
+ {
+ nil,
+ {
+ music_art_container,
+ bottom = dpi(20),
+ left = dpi(25),
+ right = dpi(25),
+ widget = wibox.container.margin,
+ },
+ nil,
+ expand = "none",
+ layout = wibox.layout.align.vertical,
+ },
+ bg = beautiful.music_accent,
+ shape = helpers.prrect(dpi(10), false, true, false, false),
+ widget = wibox.container.background,
+ })
- -- Sidebar
- awful.titlebar(c, { position = "left", size = dpi(200), bg = beautiful.xbackground }):setup {
- {
- nil,
- {
- music_art_container,
- bottom = dpi(20),
- left = dpi(25),
- right = dpi(25),
- widget = wibox.container.margin
- },
- nil,
- expand = "none",
- layout = wibox.layout.align.vertical
- },
- bg = beautiful.bg_accent,
- shape = helpers.prrect(dpi(10), false, true, false, false),
- widget = wibox.container.background,
- }
+ -- Toolbar
+ awful.titlebar(c, { position = "bottom", size = dpi(63), bg = beautiful.transparent }):setup({
+ {
+ music_bar,
+ {
+ {
+ {
+ control_button(
+ c,
+ "",
+ beautiful.xforeground,
+ beautiful.icon_font_name .. "14",
+ dpi(30),
+ function()
+ awful.spawn.with_shell("mpc -q prev")
+ end
+ ),
+ -- Toggle play pause
+ music_play_pause,
+ control_button(
+ c,
+ "",
+ beautiful.xforeground,
+ beautiful.icon_font_name .. "14",
+ dpi(30),
+ function()
+ awful.spawn.with_shell("mpc -q next")
+ end
+ ),
+ layout = wibox.layout.flex.horizontal,
+ },
+ {
+ {
+ step_function = wibox.container.scroll.step_functions.waiting_nonlinear_back_and_forth,
+ speed = 50,
+ {
+ widget = music_now,
+ },
+ -- forced_width = dpi(110),
+ widget = wibox.container.scroll.horizontal,
+ },
+ left = dpi(15),
+ right = dpi(20),
+ widget = wibox.container.margin,
+ },
+ {
+ music_pos,
+ {
+ loop,
+ shuffle,
+ -- Go to list of playlists
+ control_button(
+ c,
+ "",
+ beautiful.xforeground,
+ beautiful.icon_font_name .. "12",
+ dpi(30),
+ function()
+ helpers.send_key(c, "1")
+ end
+ ),
+ -- Go to visualizer
+ control_button(c, "", beautiful.xforeground, "icomoon 12", dpi(30), function()
+ helpers.send_key(c, "8")
+ end),
+ layout = wibox.layout.flex.horizontal,
+ },
+ spacing = dpi(10),
+ layout = wibox.layout.fixed.horizontal,
+ },
+ layout = wibox.layout.align.horizontal,
+ },
+ margins = dpi(15),
+ widget = wibox.container.margin,
+ },
+ layout = wibox.layout.align.vertical,
+ },
+ bg = beautiful.music_bg_accent,
+ shape = helpers.prrect(beautiful.border_radius, false, false, true, true),
+ widget = wibox.container.background,
+ })
- -- Toolbar
- awful.titlebar(c, { position = "bottom", size = dpi(63), bg = beautiful.bg_secondary }):setup {
- music_bar,
- {
- {
- {
- -- Go to playlist and focus currently playing song
- control_button(c, "", beautiful.xforeground, beautiful.icon_font_name .. "Round 14", dpi(30), function()
- awful.spawn.with_shell("mpc -q prev")
- end),
- -- Toggle play pause
- music_play_pause,
- -- Go to list of playlists
- control_button(c, "", beautiful.xforeground, beautiful.icon_font_name .. "Round 14", dpi(30), function()
- awful.spawn.with_shell("mpc -q next")
- end),
- layout = wibox.layout.flex.horizontal
- },
- {
- {
- step_function = wibox.container.scroll
- .step_functions
- .waiting_nonlinear_back_and_forth,
- speed = 50,
- {
- widget = music_now,
- },
- -- forced_width = dpi(110),
- widget = wibox.container.scroll.horizontal
- },
- left = dpi(15),
- right = dpi(20),
- widget = wibox.container.margin
- },
- {
- music_pos,
- {
- loop,
- shuffle,
- -- Go to list of playlists
- control_button(c, "", beautiful.xforeground, beautiful.icon_font_name .. "Round 12", dpi(30), function()
- helpers.send_key(c, "1")
- end),
- -- Go to visualizer
- control_button(c, "", beautiful.xforeground, "icomoon 12", dpi(30), function()
- helpers.send_key(c, "8")
- end),
- layout = wibox.layout.flex.horizontal
- },
- spacing = dpi(10),
- layout = wibox.layout.fixed.horizontal
- },
- layout = wibox.layout.align.horizontal
- },
- margins = dpi(15),
- widget = wibox.container.margin
- },
- layout = wibox.layout.align.vertical
- }
-
- -- Set custom decoration flags
- c.custom_decoration = { top = true, left = true, bottom = true }
+ -- Set custom decoration flags
+ c.custom_decoration = { top = true, left = true, bottom = true }
end
-- Add the titlebar whenever a new music client is spawned
ruled.client.connect_signal("request::rules", function()
- ruled.client.append_rule {
- id = "music",
- rule = {instance = "music"},
- callback = music_create_decoration
- }
+ ruled.client.append_rule({
+ id = "music",
+ rule = { instance = "music" },
+ callback = music_create_decoration,
+ })
end)
-
diff --git a/config/awesome/ui/decorations/titlebar.lua b/config/awesome/ui/decorations/titlebar.lua
index 20dcee4..d108349 100644
--- a/config/awesome/ui/decorations/titlebar.lua
+++ b/config/awesome/ui/decorations/titlebar.lua
@@ -2,134 +2,130 @@ local awful = require("awful")
local gears = require("gears")
local wibox = require("wibox")
local beautiful = require("beautiful")
-local xresources = require("beautiful.xresources")
-local dpi = xresources.apply_dpi
-local bling = require("module.bling")
local helpers = require("helpers")
-
--- Helpers
--------------
-
local function create_title_button(c, color_focus, color_unfocus, shp)
- local tb = wibox.widget {
- forced_width = dpi(20),
- forced_height = dpi(20),
- bg = color_focus .. 90,
- shape = shp,
- border_color = beautiful.border_color,
- widget = wibox.container.background
- }
+ local ico = wibox.widget({
+ markup = "",
+ widget = wibox.widget.textbox,
+ })
+ local tb = wibox.widget({
+ ico,
+ forced_width = dpi(16),
+ forced_height = dpi(16),
+ bg = color_focus .. 80,
+ shape = shp,
+ widget = wibox.container.background,
+ })
- local function update()
- if client.focus == c then
- tb.bg = color_focus
- else
- tb.bg = color_unfocus
- end
- end
- update()
+ local function update()
+ if client.focus == c then
+ tb.bg = color_focus
+ else
+ tb.bg = color_unfocus
+ end
+ end
+ update()
- c:connect_signal("focus", update)
- c:connect_signal("unfocus", update)
+ c:connect_signal("focus", update)
+ c:connect_signal("unfocus", update)
- tb:connect_signal("mouse::enter", function() tb.bg = color_focus .. 55 end)
- tb:connect_signal("mouse::leave", function() tb.bg = color_focus end)
+ tb:connect_signal("mouse::enter", function()
+ local clr = client.focus ~= c and color_focus or color_focus .. 55
+ tb.bg = clr
+ end)
+ tb:connect_signal("mouse::leave", function()
+ local clr = client.focus == c and color_focus or color_unfocus
+ tb.bg = clr
+ end)
- tb.visible = true
- return tb
-end
-
-local wrap_widget = function(w)
- return {
- w,
- top = dpi(20),
- widget = wibox.container.margin
- }
+ tb.visible = true
+ return tb
end
-- Add a titlebar if titlebars_enabled is set to true in the rules.
client.connect_signal("request::titlebars", function(c)
+ -- buttons for the titlebar
+ 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)
+ )
+ local close = create_title_button(c, beautiful.xcolor1, beautiful.xcolor8 .. 55, gears.shape.circle)
+ close:connect_signal("button::press", function()
+ c:kill()
+ end)
- -- Buttons for the titlebar
- ------------------------------
+ local minimize = create_title_button(c, beautiful.xcolor3, beautiful.xcolor8 .. 55, gears.shape.circle)
+ minimize:connect_signal("button::press", function()
+ c.minimized = true
+ end)
- local buttons = gears.table.join(awful.button({}, 1, function()
- c:emit_signal("request::activate", "titlebar", {raise = true})
- if c.maximized == true then c.maximized = false end
- awful.mouse.client.move(c)
- end), awful.button({}, 3, function()
- c:emit_signal("request::activate", "titlebar", {raise = true})
- awful.mouse.client.resize(c)
- end))
- local borderbuttons = gears.table.join( awful.button({}, 3, function()
- c:emit_signal("request::activate", "titlebar", {raise = true})
- awful.mouse.client.resize(c)
- end), awful.button({}, 1, function()
- c:emit_signal("request::activate", "titlebar", {raise = true})
- awful.mouse.client.resize(c)
- end))
+ local maximize = create_title_button(c, beautiful.xcolor2, beautiful.xcolor8 .. 55, gears.shape.circle)
+ maximize:connect_signal("button::press", function()
+ helpers.maximize(c)
+ end)
+ -- Titlebars setup
+ --------------------
- -- Titlebars shapes
- ----------------------
+ awful.titlebar(c, { position = "top", size = dpi(45), bg = beautiful.transparent }):setup({
+ {
+ layout = wibox.layout.align.horizontal,
+ {
+ {
+ close,
+ minimize,
+ maximize,
+ layout = wibox.layout.fixed.horizontal,
+ spacing = dpi(10),
+ },
+ left = dpi(15),
+ widget = wibox.container.margin,
+ },
+ {
+ {
+ { -- Title
+ align = "center",
+ widget = awful.titlebar.widget.titlewidget(c),
+ },
+ layout = wibox.layout.flex.horizontal,
+ spacing = dpi(10),
+ },
+ left = dpi(10),
+ right = dpi(10),
+ widget = wibox.container.margin,
+ buttons = buttons,
+ },
+ {
+ {
+ layout = wibox.layout.fixed.horizontal,
+ spacing = dpi(10),
+ },
+ left = dpi(10),
+ right = dpi(10),
+ widget = wibox.container.margin,
+ buttons = buttons,
+ },
+ },
+ bg = beautiful.titlebar_bg,
+ shape = helpers.prrect(beautiful.border_radius, true, true, false, false),
+ widget = wibox.container.background,
+ })
- local ci = function(width, height)
- return function(cr) gears.shape.circle(cr, width, height) end
- end
-
-
- -- Create titlebars buttons
- ------------------------------
-
- local close = create_title_button(c, beautiful.xcolor1, beautiful.titlebar_unfocused, ci(dpi(11), dpi(11)))
- close:connect_signal("button::press", function() c:kill() end)
-
- local float = create_title_button(c, beautiful.xcolor4, beautiful.titlebar_unfocused, ci(dpi(11), dpi(11)))
- float:connect_signal("button::press", function() awful.client.floating.toggle(c) end)
-
- local max = create_title_button(c, beautiful.xcolor5, beautiful.titlebar_unfocused, ci(dpi(11), dpi(11)))
- max:connect_signal("button::press", function() c.maximized = not c.maximized end)
-
-
- -- Titlebars setup
- --------------------
-
- awful.titlebar(c, {
- position = "top",
- size = beautiful.titlebar_size
- }):setup{
- { -- left
- wrap_widget({
- close,
- left = dpi(25),
- widget = wibox.container.margin
- }),
- wrap_widget(float),
- wrap_widget(max),
- buttons = buttons,
- layout = wibox.layout.fixed.horizontal,
- },
- { -- middle
- awful.titlebar.widget.titlewidget(c),
- layout = wibox.layout.fixed.horizontal
- },
- { -- right
- layout = wibox.layout.fixed.horizontal
- },
- bg = beautiful.darker_bg,
- shape = helpers.prrect(beautiful.border_radius, true, true, false, false),
- widget = wibox.container.background
- }
-
- awful.titlebar(c, {
- position = "bottom",
- size = dpi(24)
- }):setup{
- bg = beautiful.darker_bg,
- shape = helpers.prrect(beautiful.border_radius, false, false, true, true),
- widget = wibox.container.background
- }
+ awful.titlebar(c, {
+ position = "bottom",
+ size = dpi(24),
+ bg = beautiful.transparent,
+ }):setup({
+ bg = beautiful.titlebar_bg,
+ shape = helpers.prrect(beautiful.border_radius, false, false, true, true),
+ widget = wibox.container.background,
+ })
end)
-
diff --git a/config/awesome/ui/init.lua b/config/awesome/ui/init.lua
index 7b1ed3a..b843bd2 100644
--- a/config/awesome/ui/init.lua
+++ b/config/awesome/ui/init.lua
@@ -1,7 +1,4 @@
-local lock_screen = require("ui.lockscreen")
-lock_screen.init()
-
require("ui.bar")
-require("ui.dashboard")
+require("ui.central-panel")
require("ui.decorations")
-require("ui.tooltip")
+require("ui.notifs")
diff --git a/config/awesome/ui/notifs/init.lua b/config/awesome/ui/notifs/init.lua
index 2f0cfe9..03a5533 100644
--- a/config/awesome/ui/notifs/init.lua
+++ b/config/awesome/ui/notifs/init.lua
@@ -1,25 +1,30 @@
-local naughty = require("naughty")
-local beautiful = require("beautiful")
+local awful = require("awful")
local gears = require("gears")
local wibox = require("wibox")
-local awful = require("awful")
-local dpi = beautiful.xresources.apply_dpi
+local beautiful = require("beautiful")
+local naughty = require("naughty")
local helpers = require("helpers")
local ruled = require("ruled")
-
local menubar = require("menubar")
-local button_container = require('ui.widgets.button')
+local icons = require("theme.assets.icons")
+
+-- Notifications
+------------------
naughty.connect_signal("request::icon", function(n, context, hints)
- if context ~= "app_icon" then return end
+ if context ~= "app_icon" then
+ return
+ end
- local path = menubar.utils.lookup_icon(hints.app_icon) or
- menubar.utils.lookup_icon(hints.app_icon:lower())
-
- if path then n.icon = path end
+ local path = menubar.utils.lookup_icon(hints.app_icon) or menubar.utils.lookup_icon(hints.app_icon:lower())
+ if path then
+ n.icon = path
+ end
end)
+-- Import stuff
+-- Popup notifications
require("ui.notifs.popup")
naughty.config.defaults.ontop = true
@@ -28,27 +33,26 @@ naughty.config.defaults.timeout = 3
naughty.config.defaults.title = "Notification"
naughty.config.defaults.position = "bottom_right"
--- Timeouts
naughty.config.presets.low.timeout = 3
naughty.config.presets.critical.timeout = 0
naughty.config.presets.normal = {
- font = beautiful.font_name .. "medium 10",
- fg = beautiful.fg_normal,
- bg = beautiful.bg_normal
+ font = beautiful.font,
+ fg = beautiful.fg_normal,
+ bg = beautiful.bg_normal,
}
naughty.config.presets.low = {
- font = beautiful.font_name .. "medium 10",
- fg = beautiful.fg_normal,
- bg = beautiful.bg_normal
+ font = beautiful.font,
+ fg = beautiful.fg_normal,
+ bg = beautiful.bg_normal,
}
naughty.config.presets.critical = {
- font = beautiful.font_name .. "medium 10",
- fg = beautiful.xcolor1,
- bg = beautiful.bg_normal,
- timeout = 0
+ font = beautiful.font_name .. "10",
+ fg = beautiful.xcolor1,
+ bg = beautiful.bg_normal,
+ timeout = 0,
}
naughty.config.presets.ok = naughty.config.presets.normal
@@ -56,213 +60,186 @@ naughty.config.presets.info = naughty.config.presets.normal
naughty.config.presets.warn = naughty.config.presets.critical
ruled.notification.connect_signal("request::rules", function()
- -- All notifications will match this rule.
- ruled.notification.append_rule {
- rule = {},
- properties = {screen = awful.screen.preferred, implicit_timeout = 6}
- }
+ -- All notifications will match this rule.
+ ruled.notification.append_rule({
+ rule = {},
+ properties = { screen = awful.screen.preferred, implicit_timeout = 6 },
+ })
end)
naughty.connect_signal("request::display", function(n)
+ local appicon = n.app_icon
+ if not appicon then
+ appicon = gears.color.recolor_image(icons.notification, beautiful.accent)
+ end
+ local time = os.date("%H:%M")
- local appicon = gears.color.recolor_image(beautiful.notification_icon, beautiful.xcolor4)
- local time = os.date("%H:%M")
+ local action_widget = {
+ {
+ {
+ id = "text_role",
+ align = "center",
+ valign = "center",
+ font = beautiful.font,
+ widget = wibox.widget.textbox,
+ },
+ left = dpi(6),
+ right = dpi(6),
+ widget = wibox.container.margin,
+ },
+ bg = beautiful.lighter_bg,
+ forced_height = dpi(25),
+ forced_width = dpi(20),
+ shape = helpers.rrect(beautiful.border_radius / 2),
+ widget = wibox.container.background,
+ }
- local action_widget = {
- {
- {
- id = "text_role",
- align = "center",
- valign = "center",
- font = beautiful.font_name .. "medium 10",
- widget = wibox.widget.textbox
- },
- left = dpi(6),
- right = dpi(6),
- widget = wibox.container.margin
- },
- bg = beautiful.xcolor0,
- forced_height = dpi(25),
- forced_width = dpi(20),
- shape = gears.shape.rounded_rect,
- widget = wibox.container.background
- }
+ local actions = wibox.widget({
+ notification = n,
+ base_layout = wibox.widget({
+ spacing = dpi(8),
+ layout = wibox.layout.flex.horizontal,
+ }),
+ widget_template = action_widget,
+ style = { underline_normal = false, underline_selected = true },
+ widget = naughty.list.actions,
+ })
- local actions = wibox.widget {
- notification = n,
- base_layout = wibox.widget {
- spacing = dpi(8),
- layout = wibox.layout.flex.horizontal
- },
- widget_template = {
+ helpers.add_hover_cursor(actions, "hand2")
+
+ naughty.layout.box({
+ notification = n,
+ type = "notification",
+ bg = beautiful.transparent,
+ widget_template = {
{
{
{
{
- id = 'text_role',
- font = beautiful.font_name .. 'medium 10',
- widget = wibox.widget.textbox
+ {
+ {
+ {
+ {
+ image = appicon,
+ resize = true,
+ widget = wibox.widget.imagebox,
+ },
+ strategy = "max",
+ height = dpi(20),
+ widget = wibox.container.constraint,
+ },
+ right = dpi(10),
+ widget = wibox.container.margin,
+ },
+ {
+ markup = "" .. n.app_name .. "",
+ align = "left",
+ font = beautiful.font_name .. "10",
+ widget = wibox.widget.textbox,
+ },
+ {
+ markup = "" .. time .. "",
+ align = "right",
+ font = beautiful.font,
+ widget = wibox.widget.textbox,
+ },
+ layout = wibox.layout.align.horizontal,
+ },
+ top = dpi(10),
+ left = dpi(20),
+ right = dpi(20),
+ bottom = dpi(10),
+ widget = wibox.container.margin,
},
- widget = wibox.container.place
+ bg = beautiful.darker_bg,
+ widget = wibox.container.background,
},
- widget = button_container
+ {
+ {
+ {
+ helpers.vertical_pad(10),
+ {
+ {
+ step_function = wibox.container.scroll.step_functions.waiting_nonlinear_back_and_forth,
+ speed = 50,
+ {
+ markup = "" .. n.title .. "",
+ font = beautiful.font_name .. "9",
+ align = "left",
+ widget = wibox.widget.textbox,
+ },
+ forced_width = dpi(210),
+ widget = wibox.container.scroll.horizontal,
+ },
+ {
+ step_function = wibox.container.scroll.step_functions.waiting_nonlinear_back_and_forth,
+ speed = 50,
+ {
+ markup = n.message,
+ align = "left",
+ font = beautiful.font,
+ widget = wibox.widget.textbox,
+ },
+ forced_width = dpi(210),
+ widget = wibox.container.scroll.horizontal,
+ },
+ spacing = 0,
+ layout = wibox.layout.flex.vertical,
+ },
+ helpers.vertical_pad(10),
+ layout = wibox.layout.align.vertical,
+ },
+ left = dpi(20),
+ right = dpi(20),
+ widget = wibox.container.margin,
+ },
+ {
+ {
+ nil,
+ {
+ {
+ image = n.icon,
+ resize = true,
+ clip_shape = helpers.rrect(beautiful.border_radius / 2),
+ widget = wibox.widget.imagebox,
+ },
+ strategy = "max",
+ height = dpi(40),
+ widget = wibox.container.constraint,
+ },
+ nil,
+ expand = "none",
+ layout = wibox.layout.align.vertical,
+ },
+ margins = dpi(10),
+ widget = wibox.container.margin,
+ },
+ layout = wibox.layout.fixed.horizontal,
+ },
+ {
+ { actions, layout = wibox.layout.fixed.vertical },
+ margins = dpi(10),
+ visible = n.actions and #n.actions > 0,
+ widget = wibox.container.margin,
+ },
+ layout = wibox.layout.fixed.vertical,
},
- bg = beautiful.lighter_bg,
- shape = gears.shape.rounded_rect,
- forced_height = dpi(30),
- widget = wibox.container.background
+ top = dpi(0),
+ bottom = dpi(5),
+ widget = wibox.container.margin,
},
- margins = 4,
- widget = wibox.container.margin
+ bg = beautiful.xbackground,
+ shape = helpers.rrect(beautiful.border_radius),
+ widget = wibox.container.background,
},
- style = {underline_normal = false, underline_selected = true},
- widget = naughty.list.actions
- }
+ })
- helpers.add_hover_cursor(actions, "hand2")
-
- naughty.layout.box {
- notification = n,
- type = "notification",
- bg = beautiful.xbackground .. 00,
- widget_template = {
- {
- {
- {
- {
- {
- {
- {
- {
- image = appicon,
- resize = true,
- widget = wibox.widget.imagebox
- },
- strategy = "max",
- height = dpi(20),
- widget = wibox.container.constraint
- },
- right = dpi(10),
- widget = wibox.container.margin
- },
- {
- markup = n.app_name,
- align = "left",
- font = beautiful.font_name .. "Bold 12",
- widget = wibox.widget.textbox
- },
- {
- markup = time,
- align = "right",
- font = beautiful.font_name .. "medium 10",
- widget = wibox.widget.textbox
- },
- layout = wibox.layout.align.horizontal
- },
- top = dpi(5),
- left = dpi(20),
- right = dpi(20),
- bottom = dpi(5),
- widget = wibox.container.margin
- },
- bg = beautiful.darker_bg,
- widget = wibox.container.background
- },
- {
- {
- {
- helpers.vertical_pad(10),
- {
- {
- step_function = wibox.container.scroll
- .step_functions
- .waiting_nonlinear_back_and_forth,
- speed = 50,
- {
- markup = n.title,
- font = beautiful.font_name .. "Bold 12",
- align = "left",
- widget = wibox.widget.textbox
- },
- forced_width = dpi(250),
- widget = wibox.container.scroll
- .horizontal
- },
- {
- step_function = wibox.container.scroll
- .step_functions
- .waiting_nonlinear_back_and_forth,
- speed = 50,
- {
- markup = n.message,
- align = "left",
- font = beautiful.font_name .. "medium 10",
- widget = wibox.widget.textbox
- },
- forced_width = dpi(250),
- widget = wibox.container.scroll
- .horizontal
- },
- spacing = 0,
- layout = wibox.layout.flex.vertical
- },
- helpers.vertical_pad(10),
- layout = wibox.layout.align.vertical
- },
- left = dpi(20),
- right = dpi(20),
- widget = wibox.container.margin
- },
- {
- {
- nil,
- {
- {
- image = n.icon,
- resize = true,
- clip_shape = helpers.rrect(beautiful.notification_border_radius),
- widget = wibox.widget.imagebox
- },
- strategy = "max",
- height = dpi(50),
- widget = wibox.container.constraint
- },
- nil,
- expand = "none",
- layout = wibox.layout.align.vertical
- },
- top = dpi(10),
- left = dpi(10),
- right = dpi(10),
- bottom = dpi(5),
- widget = wibox.container.margin
- },
- layout = wibox.layout.fixed.horizontal
- },
- {
- {actions, layout = wibox.layout.fixed.vertical},
- margins = dpi(10),
- visible = n.actions and #n.actions > 0,
- widget = wibox.container.margin
- },
- layout = wibox.layout.fixed.vertical
- },
- top = dpi(5),
- bottom = dpi(5),
- widget = wibox.container.margin
- },
- bg = beautiful.xbackground,
- shape = helpers.rrect(beautiful.border_radius),
- widget = wibox.container.background
- }
- }
-
- -- Destroy popups if dont_disturb mode is on
+ -- Destroy popups notifs if dont_disturb mode is on
-- Or if the notif_center is visible
- if _G.dont_disturb or
- (notif_center and notif_center.visible) then
+ if
+ _G.dont_disturb_state
+ or (central_panel and central_panel.visible and central_panel:get_children_by_id("dashboard_id")[1].visible)
+ then
naughty.destroy_all_notifications(nil, 1)
end
-
-
end)
diff --git a/config/awesome/ui/notifs/popup.lua b/config/awesome/ui/notifs/popup.lua
index a05807c..8ee03bd 100644
--- a/config/awesome/ui/notifs/popup.lua
+++ b/config/awesome/ui/notifs/popup.lua
@@ -1,219 +1,200 @@
--- Standard awesome library
local gears = require("gears")
local awful = require("awful")
-
--- Theme handling library
local beautiful = require("beautiful")
-local dpi = beautiful.xresources.apply_dpi
-
--- Widget library
local wibox = require("wibox")
-
--- Helpers
local helpers = require("helpers")
-
-- Pop Up Notification
------------
-local pop_icon = wibox.widget{
- {
- id = "icon",
- resize = true,
- widget = wibox.widget.imagebox
- },
+local pop_icon = wibox.widget({
forced_height = dpi(100),
- top = dpi(28),
- widget = wibox.container.margin
-}
-
-local pop_bar = wibox.widget {
- max_value = 100,
- value = 0,
- background_color = beautiful.pop_bar_bg,
- color = beautiful.bg_accent,
- shape = gears.shape.rounded_bar,
- bar_shape = gears.shape.rounded_bar,
- widget = wibox.widget.progressbar
-}
-
-local pop = wibox({
- type = "dock",
- screen = screen.focused,
- height = beautiful.pop_size,
- width = beautiful.pop_size,
- shape = helpers.rrect(beautiful.pop_border_radius - 1),
- bg = beautiful.transparent,
- ontop = true,
- visible = false
+ forced_width = dpi(100),
+ font = beautiful.icon_font_name .. "80",
+ align = "center",
+ valign = "center",
+ widget = wibox.widget.textbox(),
})
-pop:setup {
- {
- {
- {
- layout = wibox.layout.align.horizontal,
- expand = 'none',
- nil,
- pop_icon,
- nil
- },
- layout = wibox.layout.fixed.vertical
- },
- {
- pop_bar,
- margins = dpi(28),
- widget = wibox.container.margin
- },
- layout = wibox.layout.align.vertical
- },
- bg = beautiful.xbackground,
- shape = helpers.rrect(beautiful.pop_border_radius),
- widget = wibox.container.background
-}
-awful.placement.bottom(pop, {margins = {bottom = dpi(100)}})
+local pop_bar = wibox.widget({
+ max_value = 100,
+ value = 0,
+ background_color = beautiful.pop_bar_bg,
+ color = beautiful.bg_accent,
+ shape = gears.shape.rounded_bar,
+ bar_shape = gears.shape.rounded_bar,
+ forced_height = dpi(25),
+ widget = wibox.widget.progressbar,
+})
-local pop_timeout = gears.timer {
- timeout = 1.4,
- autostart = true,
- callback = function()
- pop.visible = false
- end
-}
+local pop = wibox({
+ type = "dock",
+ screen = screen.primary,
+ height = beautiful.pop_size,
+ width = beautiful.pop_size,
+ shape = helpers.rrect(beautiful.pop_border_radius),
+ bg = beautiful.transparent,
+ ontop = true,
+ visible = false,
+})
+
+pop:setup({
+ {
+ {
+ {
+ pop_icon,
+ layout = wibox.layout.fixed.vertical,
+ },
+ nil,
+ pop_bar,
+ layout = wibox.layout.align.vertical,
+ },
+ top = dpi(15),
+ bottom = dpi(30),
+ left = dpi(30),
+ right = dpi(30),
+ widget = wibox.container.margin,
+ },
+ bg = beautiful.xbackground,
+ shape = helpers.rrect(beautiful.pop_border_radius),
+ widget = wibox.container.background,
+})
+awful.placement.bottom(pop, { margins = { bottom = dpi(100) } })
+
+local pop_timeout = gears.timer({
+ timeout = 1.4,
+ autostart = true,
+ callback = function()
+ pop.visible = false
+ end,
+})
local function toggle_pop()
- if pop.visible then
- pop_timeout:again()
- else
- pop.visible = true
- pop_timeout:start()
- end
+ if pop.visible then
+ pop_timeout:again()
+ else
+ pop.visible = true
+ pop_timeout:start()
+ end
end
local vol_first_time = true
awesome.connect_signal("signal::volume", function(value, muted)
- local icon = beautiful.volume_icon
+ if vol_first_time then
+ vol_first_time = false
+ else
+ pop_icon.markup = helpers.colorize_text("", beautiful.accent)
+ pop_bar.value = value
- if vol_first_time then
- vol_first_time = false
- else
+ if muted then
+ pop_icon.markup = helpers.colorize_text("", beautiful.xcolor8)
+ pop_bar.color = beautiful.xcolor8
+ else
+ pop_bar.color = beautiful.accent
+ end
- if muted then
- local muted_icon = gears.color.recolor_image(beautiful.volume_muted_icon, beautiful.xcolor8)
- icon = muted_icon
- pop_bar.color = beautiful.xcolor8
- else
- local vol_icon = gears.color.recolor_image(icon, beautiful.pop_vol_color)
- icon = vol_icon
- pop_bar.color = beautiful.pop_vol_color
- end
-
- pop_bar.value = value
- pop_icon.icon.image = icon
- toggle_pop()
- end
+ toggle_pop()
+ end
end)
awesome.connect_signal("signal::brightness", function(value)
- local icon = beautiful.brightness_icon
+ pop_icon.markup = helpers.colorize_text("", beautiful.accent)
+ pop_bar.value = value
+ pop_bar.color = beautiful.accent
- if value ~= 0 then
- local bri_icon = gears.color.recolor_image(icon, beautiful.pop_brightness_color)
- icon = bri_icon
- pop_bar.color = beautiful.pop_brightness_color
- else
- local bri_icon = gears.color.recolor_image(icon, beautiful.xcolor8)
- icon = bri_icon
- end
-
-
- pop_bar.value = value
- pop_icon.icon.image = icon
- toggle_pop()
+ toggle_pop()
end)
-
-- Layout list
-----------------
-local layout_list = awful.widget.layoutlist {
- source = awful.widget.layoutlist.source.default_layouts, -- DOC_HIDE
- spacing = dpi(24),
- base_layout = wibox.widget {
- spacing = dpi(24),
- forced_num_cols = 4,
- layout = wibox.layout.grid.vertical
- },
- widget_template = {
- {
- {
- id = "icon_role",
- forced_height = dpi(68),
- forced_width = dpi(68),
- widget = wibox.widget.imagebox
- },
- margins = dpi(24),
- widget = wibox.container.margin
- },
- id = "background_role",
- forced_width = dpi(68),
- forced_height = dpi(68),
- widget = wibox.container.background
- }
-}
+local layout_list = awful.widget.layoutlist({
+ source = awful.widget.layoutlist.source.default_layouts, -- DOC_HIDE
+ spacing = dpi(24),
+ base_layout = wibox.widget({
+ spacing = dpi(24),
+ forced_num_cols = 4,
+ layout = wibox.layout.grid.vertical,
+ }),
+ widget_template = {
+ {
+ {
+ id = "icon_role",
+ forced_height = dpi(68),
+ forced_width = dpi(68),
+ widget = wibox.widget.imagebox,
+ },
+ margins = dpi(24),
+ widget = wibox.container.margin,
+ },
+ id = "background_role",
+ forced_width = dpi(68),
+ forced_height = dpi(68),
+ widget = wibox.container.background,
+ },
+})
-local layout_popup = awful.popup {
- widget = wibox.widget {
- {layout_list, margins = dpi(24), widget = wibox.container.margin},
- bg = beautiful.xbackground,
- shape = helpers.rrect(beautiful.border_radius),
- border_color = beautiful.widget_border_color,
- border_width = beautiful.widget_border_width,
- widget = wibox.container.background
- },
- placement = awful.placement.centered,
- ontop = true,
- visible = false,
- bg = beautiful.xbackground .. "00"
-}
+local layout_popup = awful.popup({
+ widget = wibox.widget({
+ { layout_list, margins = dpi(24), widget = wibox.container.margin },
+ bg = beautiful.xbackground,
+ shape = helpers.rrect(beautiful.border_radius),
+ border_color = beautiful.widget_border_color,
+ border_width = beautiful.widget_border_width,
+ widget = wibox.container.background,
+ }),
+ placement = awful.placement.centered,
+ ontop = true,
+ visible = false,
+ bg = beautiful.xbackground .. "00",
+})
function gears.table.iterate_value(t, value, step_size, filter, start_at)
- local k = gears.table.hasitem(t, value, true, start_at)
- if not k then return end
+ local k = gears.table.hasitem(t, value, true, start_at)
+ if not k then
+ return
+ end
- step_size = step_size or 1
- local new_key = gears.math.cycle(#t, k + step_size)
+ step_size = step_size or 1
+ local new_key = gears.math.cycle(#t, k + step_size)
- if filter and not filter(t[new_key]) then
- for i = 1, #t do
- local k2 = gears.math.cycle(#t, new_key + i)
- if filter(t[k2]) then return t[k2], k2 end
- end
- return
- end
+ if filter and not filter(t[new_key]) then
+ for i = 1, #t do
+ local k2 = gears.math.cycle(#t, new_key + i)
+ if filter(t[k2]) then
+ return t[k2], k2
+ end
+ end
+ return
+ end
- return t[new_key], new_key
+ return t[new_key], new_key
end
-awful.keygrabber {
- start_callback = function() layout_popup.visible = true end,
- stop_callback = function() layout_popup.visible = false end,
- export_keybindings = true,
- stop_event = "release",
- stop_key = {"Escape", "Super_L", "Super_R", "Mod4"},
- keybindings = {
- {
- {modkey, "Shift"}, " ", function()
- awful.layout.set(gears.table.iterate_value(layout_list.layouts,
- layout_list.current_layout, -1),
- nil)
- end
- }, {
- {modkey}, " ", function()
- awful.layout.set(gears.table.iterate_value(layout_list.layouts,
- layout_list.current_layout, 1),
- nil)
- end
- }
- }
-}
+awful.keygrabber({
+ start_callback = function()
+ layout_popup.visible = true
+ end,
+ stop_callback = function()
+ layout_popup.visible = false
+ end,
+ export_keybindings = true,
+ stop_event = "release",
+ stop_key = { "Escape", "Super_L", "Super_R", "Mod4" },
+ keybindings = {
+ {
+ { modkey, "Shift" },
+ " ",
+ function()
+ awful.layout.set(gears.table.iterate_value(layout_list.layouts, layout_list.current_layout, -1), nil)
+ end,
+ },
+ {
+ { modkey },
+ " ",
+ function()
+ awful.layout.set(gears.table.iterate_value(layout_list.layouts, layout_list.current_layout, 1), nil)
+ end,
+ },
+ },
+})
diff --git a/config/awesome/ui/widgets/airplane-mode/airplane_mode b/config/awesome/ui/widgets/airplane-mode/airplane_mode
new file mode 100644
index 0000000..c508d53
--- /dev/null
+++ b/config/awesome/ui/widgets/airplane-mode/airplane_mode
@@ -0,0 +1 @@
+false
diff --git a/config/awesome/ui/widgets/airplane-mode/icons/airplane-mode-off.svg b/config/awesome/ui/widgets/airplane-mode/icons/airplane-mode-off.svg
new file mode 100644
index 0000000..7a4c91c
--- /dev/null
+++ b/config/awesome/ui/widgets/airplane-mode/icons/airplane-mode-off.svg
@@ -0,0 +1,57 @@
+
+
diff --git a/config/awesome/ui/widgets/airplane-mode/icons/airplane-mode.svg b/config/awesome/ui/widgets/airplane-mode/icons/airplane-mode.svg
new file mode 100644
index 0000000..70fc89d
--- /dev/null
+++ b/config/awesome/ui/widgets/airplane-mode/icons/airplane-mode.svg
@@ -0,0 +1,62 @@
+
+
diff --git a/config/awesome/ui/widgets/airplane-mode/init.lua b/config/awesome/ui/widgets/airplane-mode/init.lua
new file mode 100755
index 0000000..23aa198
--- /dev/null
+++ b/config/awesome/ui/widgets/airplane-mode/init.lua
@@ -0,0 +1,171 @@
+local awful = require("awful")
+local wibox = require("wibox")
+local gears = require("gears")
+local beautiful = require("beautiful")
+local dpi = beautiful.xresources.apply_dpi
+local clickable_container = require("ui.widgets.clickable-container")
+local config_dir = gears.filesystem.get_configuration_dir()
+local widget_dir = config_dir .. "ui/widgets/airplane-mode/"
+local widget_icon_dir = widget_dir .. "icons/"
+local ap_state = false
+
+local action_name = wibox.widget({
+ text = "Airplane Mode",
+ font = beautiful.font_name .. "Bold 12",
+ align = "left",
+ widget = wibox.widget.textbox,
+})
+
+local action_status = wibox.widget({
+ text = "Off",
+ font = beautiful.font_name .. "11",
+ align = "left",
+ widget = wibox.widget.textbox,
+})
+
+local action_info = wibox.widget({
+ layout = wibox.layout.fixed.vertical,
+ action_name,
+ action_status,
+})
+
+local button_widget = wibox.widget({
+ {
+ id = "icon",
+ image = gears.color.recolor_image(widget_icon_dir .. "airplane-mode-off.svg", beautiful.xforeground),
+ widget = wibox.widget.imagebox,
+ resize = true,
+ },
+ layout = wibox.layout.align.horizontal,
+})
+
+local widget_button = wibox.widget({
+ {
+ {
+ button_widget,
+ margins = dpi(15),
+ forced_height = dpi(48),
+ forced_width = dpi(48),
+ widget = wibox.container.margin,
+ },
+ widget = clickable_container,
+ },
+ bg = beautiful.control_center_button_bg,
+ shape = gears.shape.circle,
+ widget = wibox.container.background,
+})
+
+local update_widget = function()
+ if ap_state then
+ action_status:set_text("On")
+ widget_button.bg = beautiful.accent
+ button_widget.icon:set_image(
+ gears.color.recolor_image(widget_icon_dir .. "airplane-mode.svg", beautiful.xforeground)
+ )
+ else
+ action_status:set_text("Off")
+ widget_button.bg = beautiful.control_center_button_bg
+ button_widget.icon:set_image(
+ gears.color.recolor_image(widget_icon_dir .. "airplane-mode-off.svg", beautiful.xforeground)
+ )
+ end
+end
+
+local check_airplane_mode_state = function()
+ local cmd = "cat " .. widget_dir .. "airplane_mode"
+
+ awful.spawn.easy_async_with_shell(cmd, function(stdout)
+ local status = stdout
+
+ if status:match("true") then
+ ap_state = true
+ elseif status:match("false") then
+ ap_state = false
+ else
+ ap_state = false
+ awful.spawn.easy_async_with_shell('echo "false" > ' .. widget_dir .. "airplane_mode", function(stdout) end)
+ end
+ update_widget()
+ end)
+end
+
+check_airplane_mode_state()
+
+local ap_off_cmd = [[
+
+ rfkill unblock wlan
+
+ # Create an AwesomeWM Notification
+ awesome-client "
+ naughty = require('naughty')
+ naughty.notification({
+ app_name = 'Network Manager',
+ title = 'Airplane mode disabled!',
+ message = 'Initializing network devices',
+ icon = ']] .. widget_icon_dir .. "airplane-mode-off" .. ".svg" .. [['
+ })
+ "
+ ]] .. "echo false > " .. widget_dir .. "airplane_mode" .. [[
+]]
+
+local ap_on_cmd = [[
+
+ rfkill block wlan
+
+ # Create an AwesomeWM Notification
+ awesome-client "
+ naughty = require('naughty')
+ naughty.notification({
+ app_name = 'Network Manager',
+ title = 'Airplane mode enabled!',
+ message = 'Disabling radio devices',
+ icon = ']] .. widget_icon_dir .. "airplane-mode" .. ".svg" .. [['
+ })
+ "
+ ]] .. "echo true > " .. widget_dir .. "airplane_mode" .. [[
+]]
+
+local toggle_action = function()
+ if ap_state then
+ awful.spawn.easy_async_with_shell(ap_off_cmd, function(stdout)
+ ap_state = false
+ update_widget()
+ end)
+ else
+ awful.spawn.easy_async_with_shell(ap_on_cmd, function(stdout)
+ ap_state = true
+ update_widget()
+ end)
+ end
+end
+
+widget_button:buttons(gears.table.join(awful.button({}, 1, nil, function()
+ toggle_action()
+end)))
+
+action_info:buttons(gears.table.join(awful.button({}, 1, nil, function()
+ toggle_action()
+end)))
+
+gears.timer({
+ timeout = 5,
+ autostart = true,
+ callback = function()
+ check_airplane_mode_state()
+ end,
+})
+
+local action_widget = wibox.widget({
+ layout = wibox.layout.fixed.horizontal,
+ spacing = dpi(10),
+ widget_button,
+ {
+ layout = wibox.layout.align.vertical,
+ expand = "none",
+ nil,
+ action_info,
+ nil,
+ },
+})
+
+return action_widget
diff --git a/config/awesome/ui/widgets/analog-clock/init.lua b/config/awesome/ui/widgets/analog-clock/init.lua
new file mode 100644
index 0000000..3c7b82b
--- /dev/null
+++ b/config/awesome/ui/widgets/analog-clock/init.lua
@@ -0,0 +1,81 @@
+-- Standard awesome library
+local gears = require("gears")
+local wibox = require("wibox")
+local math = require("math")
+
+-- Theme handling library
+local beautiful = require("beautiful")
+
+-- C libraries
+local cairo = require("lgi").cairo
+
+-- Analog clock
+------------------
+-- Stolen from No37
+
+local function create_minute_pointer(minute)
+ local img = cairo.ImageSurface(cairo.Format.ARGB32, 1000, 1000)
+ local cr = cairo.Context(img)
+ local angle = (minute / 60) * 2 * math.pi
+ cr:translate(500, 500)
+ cr:rotate(angle)
+ cr:translate(-500, -500)
+ cr:set_source(gears.color(beautiful.xforeground))
+ cr:rectangle(485, 100, 30, 420)
+ cr:fill()
+ return img
+end
+
+local function create_hour_pointer(hour)
+ local img = cairo.ImageSurface(cairo.Format.ARGB32, 1000, 1000)
+ local cr = cairo.Context(img)
+ local angle = ((hour % 12) / 12) * 2 * math.pi
+ cr:translate(500, 500)
+ cr:rotate(angle)
+ cr:translate(-500, -500)
+ cr:set_source(gears.color(beautiful.accent))
+ cr:rectangle(480, 200, 40, 320)
+ cr:fill()
+ return img
+end
+
+local minute_pointer = create_minute_pointer(37)
+local hour_pointer = create_hour_pointer(17)
+
+local minute_pointer_img = wibox.widget.imagebox()
+local hour_pointer_img = wibox.widget.imagebox()
+
+local analog_clock = wibox.widget({
+ { -- circle
+ wibox.widget.textbox(""),
+ shape = function(cr, width, height)
+ gears.shape.circle(cr, width, height, height / 2)
+ end,
+ shape_border_width = 4,
+ shape_border_color = beautiful.accent,
+ bg = "alpha",
+ widget = wibox.container.background,
+ },
+ minute_pointer_img,
+ hour_pointer_img,
+ layout = wibox.layout.stack,
+})
+
+local minute = 0
+local hour = 0
+
+gears.timer({
+ timeout = 30,
+ call_now = true,
+ autostart = true,
+ callback = function()
+ minute = os.date("%M")
+ hour = os.date("%H")
+ minute_pointer = create_minute_pointer(minute)
+ hour_pointer = create_hour_pointer(hour + (minute / 60))
+ minute_pointer_img.image = minute_pointer
+ hour_pointer_img.image = hour_pointer
+ end,
+})
+
+return analog_clock
diff --git a/config/awesome/ui/widgets/arc/cpu_arc.lua b/config/awesome/ui/widgets/arc/cpu_arc.lua
new file mode 100644
index 0000000..1fe2bd1
--- /dev/null
+++ b/config/awesome/ui/widgets/arc/cpu_arc.lua
@@ -0,0 +1,27 @@
+local awful = require("awful")
+local watch = awful.widget.watch
+local wibox = require("wibox")
+local beautiful = require("beautiful")
+local xresources = require("beautiful.xresources")
+local dpi = xresources.apply_dpi
+
+local active_color = beautiful.accent
+
+local cpu_arc = wibox.widget({
+ start_angle = 3 * math.pi / 2,
+ min_value = 0,
+ max_value = 100,
+ value = 50,
+ thickness = dpi(8),
+ rounded_edge = true,
+ bg = active_color .. "44",
+ paddings = dpi(10),
+ colors = { active_color },
+ widget = wibox.container.arcchart,
+})
+
+awesome.connect_signal("signal::cpu", function(value)
+ cpu_arc.value = value
+end)
+
+return cpu_arc
diff --git a/config/awesome/ui/widgets/arc/disk_arc.lua b/config/awesome/ui/widgets/arc/disk_arc.lua
new file mode 100644
index 0000000..55d60d7
--- /dev/null
+++ b/config/awesome/ui/widgets/arc/disk_arc.lua
@@ -0,0 +1,27 @@
+local awful = require("awful")
+local watch = awful.widget.watch
+local wibox = require("wibox")
+local beautiful = require("beautiful")
+local xresources = require("beautiful.xresources")
+local dpi = xresources.apply_dpi
+
+local active_color = beautiful.accent
+
+local disk_arc = wibox.widget({
+ start_angle = 3 * math.pi / 2,
+ min_value = 0,
+ max_value = 100,
+ value = 50,
+ thickness = dpi(8),
+ rounded_edge = true,
+ bg = active_color .. "44",
+ paddings = dpi(10),
+ colors = { active_color },
+ widget = wibox.container.arcchart,
+})
+
+awesome.connect_signal("signal::disk", function(used, total)
+ disk_arc.value = used * 100 / total
+end)
+
+return disk_arc
diff --git a/config/awesome/ui/widgets/arc/ram_arc.lua b/config/awesome/ui/widgets/arc/ram_arc.lua
new file mode 100644
index 0000000..02507dc
--- /dev/null
+++ b/config/awesome/ui/widgets/arc/ram_arc.lua
@@ -0,0 +1,31 @@
+local awful = require("awful")
+local watch = awful.widget.watch
+local wibox = require("wibox")
+local beautiful = require("beautiful")
+local xresources = require("beautiful.xresources")
+local dpi = xresources.apply_dpi
+
+local active_color = beautiful.accent
+
+local ram_arc = wibox.widget({
+ start_angle = 3 * math.pi / 2,
+ min_value = 0,
+ max_value = 100,
+ value = 50,
+ thickness = dpi(8),
+ rounded_edge = true,
+ bg = active_color .. "44",
+ paddings = dpi(10),
+ colors = { active_color },
+ widget = wibox.container.arcchart,
+})
+
+watch('bash -c "free | grep -z Mem.*Swap.*"', 10, function(_, stdout)
+ local total, used, free, shared, buff_cache, available, total_swap, used_swap, free_swap = stdout:match(
+ "(%d+)%s*(%d+)%s*(%d+)%s*(%d+)%s*(%d+)%s*(%d+)%s*Swap:%s*(%d+)%s*(%d+)%s*(%d+)"
+ )
+ ram_arc:set_value(used / total * 100)
+ collectgarbage("collect")
+end)
+
+return ram_arc
diff --git a/config/awesome/ui/widgets/arc/temp_arc.lua b/config/awesome/ui/widgets/arc/temp_arc.lua
new file mode 100644
index 0000000..e3d0997
--- /dev/null
+++ b/config/awesome/ui/widgets/arc/temp_arc.lua
@@ -0,0 +1,58 @@
+local awful = require("awful")
+local watch = awful.widget.watch
+local wibox = require("wibox")
+local beautiful = require("beautiful")
+local xresources = require("beautiful.xresources")
+local dpi = xresources.apply_dpi
+
+local active_color = beautiful.accent
+
+local temp_arc = wibox.widget({
+ start_angle = 3 * math.pi / 2,
+ min_value = 0,
+ max_value = 100,
+ value = 50,
+ thickness = dpi(8),
+ rounded_edge = true,
+ bg = active_color .. "44",
+ paddings = dpi(10),
+ colors = { active_color },
+ widget = wibox.container.arcchart,
+})
+
+local max_temp = 80
+
+awful.spawn.easy_async_with_shell(
+ [[
+ temp_path=null
+ for i in /sys/class/hwmon/hwmon*/temp*_input;
+ do
+ temp_path="$(echo "$(<$(dirname $i)/name): $(cat ${i%_*}_label 2>/dev/null ||
+ echo $(basename ${i%_*})) $(readlink -f $i)");"
+
+ label="$(echo $temp_path | awk '{print $2}')"
+
+ if [ "$label" = "Package" ];
+ then
+ echo ${temp_path} | awk '{print $5}' | tr -d ';\n'
+ exit;
+ fi
+ done
+ ]],
+ function(stdout)
+ local temp_path = stdout:gsub("%\n", "")
+ if temp_path == "" or not temp_path then
+ temp_path = "/sys/class/thermal/thermal_zone0/temp"
+ end
+
+ watch([[
+ sh -c "cat ]] .. temp_path .. [["
+ ]], 10, function(_, stdout)
+ local temp = stdout:match("(%d+)")
+ temp_arc:set_value((temp / 1000) / max_temp * 100)
+ collectgarbage("collect")
+ end)
+ end
+)
+
+return temp_arc
diff --git a/config/awesome/ui/widgets/blue-light/icons/blue-light-off.svg b/config/awesome/ui/widgets/blue-light/icons/blue-light-off.svg
new file mode 100644
index 0000000..cd6572a
--- /dev/null
+++ b/config/awesome/ui/widgets/blue-light/icons/blue-light-off.svg
@@ -0,0 +1,70 @@
+
+
diff --git a/config/awesome/ui/widgets/blue-light/icons/blue-light.svg b/config/awesome/ui/widgets/blue-light/icons/blue-light.svg
new file mode 100644
index 0000000..c0d42cc
--- /dev/null
+++ b/config/awesome/ui/widgets/blue-light/icons/blue-light.svg
@@ -0,0 +1,102 @@
+
+
diff --git a/config/awesome/ui/widgets/blue-light/init.lua b/config/awesome/ui/widgets/blue-light/init.lua
new file mode 100644
index 0000000..5073592
--- /dev/null
+++ b/config/awesome/ui/widgets/blue-light/init.lua
@@ -0,0 +1,137 @@
+local awful = require("awful")
+local wibox = require("wibox")
+local gears = require("gears")
+local beautiful = require("beautiful")
+local dpi = beautiful.xresources.apply_dpi
+local clickable_container = require("ui.widgets.clickable-container")
+local config_dir = gears.filesystem.get_configuration_dir()
+local widget_dir = config_dir .. "ui/widgets/blue-light/"
+local widget_icon_dir = widget_dir .. "icons/"
+
+local blue_light_state = false
+
+local action_name = wibox.widget({
+ text = "Blue Light",
+ font = beautiful.font_name .. "Bold 12",
+ align = "left",
+ widget = wibox.widget.textbox,
+})
+
+local action_status = wibox.widget({
+ text = "Off",
+ font = beautiful.font_name .. "11",
+ align = "left",
+ widget = wibox.widget.textbox,
+})
+
+local action_info = wibox.widget({
+ layout = wibox.layout.fixed.vertical,
+ action_name,
+ action_status,
+})
+
+local button_widget = wibox.widget({
+ {
+ id = "icon",
+ image = gears.color.recolor_image(widget_icon_dir .. "blue-light-off.svg", beautiful.xforeground),
+ widget = wibox.widget.imagebox,
+ resize = true,
+ },
+ layout = wibox.layout.align.horizontal,
+})
+
+local widget_button = wibox.widget({
+ {
+ {
+ button_widget,
+ margins = dpi(15),
+ forced_height = dpi(48),
+ forced_width = dpi(48),
+ widget = wibox.container.margin,
+ },
+ widget = clickable_container,
+ },
+ bg = beautiful.control_center_button_bg,
+ shape = gears.shape.circle,
+ widget = wibox.container.background,
+})
+
+local update_widget = function()
+ if blue_light_state then
+ action_status:set_text("On")
+ widget_button.bg = beautiful.accent
+ button_widget.icon:set_image(
+ gears.color.recolor_image(widget_icon_dir .. "blue-light.svg", beautiful.xforeground)
+ )
+ else
+ action_status:set_text("Off")
+ widget_button.bg = beautiful.control_center_button_bg
+ button_widget.icon:set_image(
+ gears.color.recolor_image(widget_icon_dir .. "blue-light-off.svg", beautiful.xforeground)
+ )
+ end
+end
+
+local kill_state = function()
+ awful.spawn.easy_async_with_shell(
+ [[
+ redshift -x
+ kill -9 $(pgrep redshift)
+ ]],
+ function(stdout)
+ stdout = tonumber(stdout)
+ if stdout then
+ blue_light_state = false
+ update_widget()
+ end
+ end
+ )
+end
+
+kill_state()
+
+local toggle_action = function()
+ awful.spawn.easy_async_with_shell(
+ [[
+ if [ ! -z $(pgrep redshift) ];
+ then
+ redshift -x && pkill redshift && killall redshift
+ echo 'OFF'
+ else
+ redshift -l 0:0 -t 4500:4500 -r &>/dev/null &
+ echo 'ON'
+ fi
+ ]],
+ function(stdout)
+ if stdout:match("ON") then
+ blue_light_state = true
+ else
+ blue_light_state = false
+ end
+ update_widget()
+ end
+ )
+end
+
+widget_button:buttons(gears.table.join(awful.button({}, 1, nil, function()
+ toggle_action()
+end)))
+
+action_info:buttons(gears.table.join(awful.button({}, 1, nil, function()
+ toggle_action()
+end)))
+
+local action_widget = wibox.widget({
+ layout = wibox.layout.fixed.horizontal,
+ spacing = dpi(10),
+ widget_button,
+ {
+ layout = wibox.layout.align.vertical,
+ expand = "none",
+ nil,
+ action_info,
+ nil,
+ },
+})
+
+return action_widget
diff --git a/config/awesome/ui/widgets/central-panel-switch/init.lua b/config/awesome/ui/widgets/central-panel-switch/init.lua
new file mode 100644
index 0000000..a0d5356
--- /dev/null
+++ b/config/awesome/ui/widgets/central-panel-switch/init.lua
@@ -0,0 +1,91 @@
+local awful = require("awful")
+local wibox = require("wibox")
+local gears = require("gears")
+local beautiful = require("beautiful")
+local dpi = beautiful.xresources.apply_dpi
+local clickable_container = require("ui.widgets.clickable-container")
+
+-- Variable used for switching panel modes
+local central_panel_mode = "dashboard_mode"
+
+local active_button = beautiful.lighter_bg
+local inactive_button = beautiful.transparent
+
+local settings_text = wibox.widget({
+ text = "Settings",
+ font = beautiful.font_name .. "Bold 11",
+ align = "center",
+ valign = "center",
+ widget = wibox.widget.textbox,
+})
+
+local settings_button = clickable_container(wibox.container.margin(settings_text, dpi(0), dpi(0), dpi(7), dpi(7)))
+
+local wrap_settings = wibox.widget({
+ settings_button,
+ forced_width = dpi(93),
+ bg = inactive_button,
+ border_width = dpi(1),
+ border_color = beautiful.lighter_bg,
+ shape = function(cr, width, height)
+ gears.shape.partially_rounded_rect(cr, width, height, false, true, true, false, dpi(6))
+ end,
+ widget = wibox.container.background,
+})
+
+local dashboard_text = wibox.widget({
+ text = "Dashboard",
+ font = beautiful.font_name .. "Bold 11",
+ align = "center",
+ valign = "center",
+ widget = wibox.widget.textbox,
+})
+
+local dashboard_button = clickable_container(wibox.container.margin(dashboard_text, dpi(0), dpi(0), dpi(7), dpi(7)))
+
+local wrap_dashboard = wibox.widget({
+ dashboard_button,
+ forced_width = dpi(93),
+ bg = active_button,
+ border_width = dpi(1),
+ border_color = beautiful.lighter_bg,
+ shape = function(cr, width, height)
+ gears.shape.partially_rounded_rect(cr, width, height, true, false, false, true, dpi(6))
+ end,
+ widget = wibox.container.background,
+})
+
+local switcher = wibox.widget({
+ expand = "none",
+ layout = wibox.layout.fixed.horizontal,
+ wrap_dashboard,
+ wrap_settings,
+})
+
+function switch_rdb_pane(central_panel_mode)
+ if central_panel_mode == "dashboard_mode" then
+ -- Update button color
+ wrap_dashboard.bg = active_button
+ wrap_settings.bg = inactive_button
+
+ -- Change panel content of floating-panel.lua
+ central_panel:switch_pane(central_panel_mode)
+ elseif central_panel_mode == "settings_mode" then
+ -- Update button color
+ wrap_dashboard.bg = inactive_button
+ wrap_settings.bg = active_button
+
+ -- Change panel content of floating-panel.lua
+ central_panel:switch_pane(central_panel_mode)
+ end
+end
+
+dashboard_button:buttons(gears.table.join(awful.button({}, 1, nil, function()
+ switch_rdb_pane("dashboard_mode")
+end)))
+
+settings_button:buttons(gears.table.join(awful.button({}, 1, nil, function()
+ switch_rdb_pane("settings_mode")
+end)))
+
+return switcher
diff --git a/config/awesome/ui/widgets/clickable-container/init.lua b/config/awesome/ui/widgets/clickable-container/init.lua
new file mode 100644
index 0000000..016bb11
--- /dev/null
+++ b/config/awesome/ui/widgets/clickable-container/init.lua
@@ -0,0 +1,40 @@
+local wibox = require("wibox")
+local beautiful = require("beautiful")
+
+local create_click_events = function(widget)
+ local container = wibox.widget({
+ widget,
+ widget = wibox.container.background,
+ })
+
+ local old_cursor, old_wibox
+
+ container:connect_signal("mouse::enter", function()
+ container.bg = beautiful.hover_effect
+ local w = mouse.current_wibox
+ if w then
+ old_cursor, old_wibox = w.cursor, w
+ w.cursor = "hand1"
+ end
+ end)
+
+ container:connect_signal("mouse::leave", function()
+ container.bg = beautiful.transparent
+ if old_wibox then
+ old_wibox.cursor = old_cursor
+ old_wibox = nil
+ end
+ end)
+
+ container:connect_signal("button::press", function()
+ container.bg = beautiful.accent
+ end)
+
+ container:connect_signal("button::release", function()
+ container.bg = beautiful.hover_effect
+ end)
+
+ return container
+end
+
+return create_click_events
diff --git a/config/awesome/ui/widgets/cute-battery-face/init.lua b/config/awesome/ui/widgets/cute-battery-face/init.lua
new file mode 100644
index 0000000..0c4cd82
--- /dev/null
+++ b/config/awesome/ui/widgets/cute-battery-face/init.lua
@@ -0,0 +1,200 @@
+local awful = require("awful")
+local gears = require("gears")
+local wibox = require("wibox")
+local beautiful = require("beautiful")
+local dpi = beautiful.xresources.apply_dpi
+local helpers = require("helpers")
+
+-- Cute battery face indicator
+------------------
+-- Stolen from Elena
+
+local stroke = beautiful.xbackground
+local happy_color = beautiful.xcolor2
+local sad_color = beautiful.xcolor1
+local ok_color = beautiful.xcolor3
+local charging_color = beautiful.xcolor6
+
+-- Not great not terrible
+local ok_threshold = 40
+
+-- Low percentage
+local battery_threshold_low = 20
+
+local battery_bar = wibox.widget({
+ max_value = 100,
+ value = 50,
+ forced_height = dpi(100),
+ forced_width = dpi(50),
+ bar_shape = gears.shape.rectangle,
+ color = happy_color,
+ background_color = happy_color .. "55",
+ widget = wibox.widget.progressbar,
+})
+
+local battery_bar_container = wibox.widget({
+ battery_bar,
+ direction = "east",
+ widget = wibox.container.rotate,
+})
+
+local charging_icon = wibox.widget({
+ font = beautiful.icon_font_name .. "18",
+ valign = "center",
+ markup = helpers.colorize_text("", stroke .. "80"),
+ widget = wibox.widget.textbox(),
+})
+
+local eye_size = dpi(5)
+local mouth_size = dpi(10)
+
+local mouth_shape = function()
+ return function(cr, width, height)
+ gears.shape.pie(cr, width, height, 0, math.pi)
+ end
+end
+
+local mouth_widget = wibox.widget({
+ forced_width = mouth_size,
+ forced_height = mouth_size,
+ shape = mouth_shape(),
+ -- shape = gears.shape.pie,
+ bg = stroke,
+ widget = wibox.container.background(),
+})
+
+local frown = wibox.widget({
+ {
+ mouth_widget,
+ direction = "south",
+ widget = wibox.container.rotate(),
+ },
+ top = dpi(8),
+ widget = wibox.container.margin(),
+})
+
+local smile = wibox.widget({
+ mouth_widget,
+ direction = "north",
+ widget = wibox.container.rotate(),
+})
+
+local ok = wibox.widget({
+ {
+ bg = stroke,
+ shape = helpers.rrect(dpi(2)),
+ widget = wibox.container.background,
+ },
+ top = dpi(5),
+ bottom = dpi(1),
+ widget = wibox.container.margin(),
+})
+
+local mouth = wibox.widget({
+ frown,
+ ok,
+ smile,
+ top_only = true,
+ widget = wibox.layout.stack(),
+})
+
+local eye = wibox.widget({
+ forced_width = eye_size,
+ forced_height = eye_size,
+ shape = gears.shape.circle,
+ bg = stroke,
+ widget = wibox.container.background(),
+})
+
+-- 2 eyes 1 semicircle (smile or frown)
+local face = wibox.widget({
+ eye,
+ mouth,
+ eye,
+ spacing = dpi(4),
+ layout = wibox.layout.fixed.horizontal,
+})
+
+local cute_battery_face = wibox.widget({
+ {
+ battery_bar_container,
+ shape = helpers.rrect(beautiful.widget_radius),
+ border_color = stroke,
+ border_width = dpi(4),
+ widget = wibox.container.background,
+ },
+ {
+ {
+ nil,
+ charging_icon,
+ nil,
+ expand = "none",
+ layout = wibox.layout.align.horizontal,
+ },
+ left = dpi(25),
+ bottom = dpi(50),
+ widget = wibox.container.margin,
+ },
+ {
+ nil,
+ {
+ nil,
+ face,
+ layout = wibox.layout.align.vertical,
+ expand = "none",
+ },
+ layout = wibox.layout.align.horizontal,
+ expand = "none",
+ },
+ top_only = false,
+ layout = wibox.layout.stack,
+})
+
+local last_value = 100
+awesome.connect_signal("signal::battery", function(value)
+ -- Update bar
+ battery_bar.value = value
+ last_value = value
+ local color
+ -- Update face
+ if charging_icon.visible then
+ color = charging_color
+ mouth:set(1, smile)
+ elseif value <= battery_threshold_low then
+ color = sad_color
+ mouth:set(1, frown)
+ elseif value <= ok_threshold then
+ color = ok_color
+ mouth:set(1, ok)
+ else
+ color = happy_color
+ mouth:set(1, smile)
+ end
+ battery_bar.color = color
+ battery_bar.background_color = color .. "44"
+end)
+
+awesome.connect_signal("signal::charger", function(plugged)
+ local color
+ if plugged then
+ charging_icon.visible = true
+ color = charging_color
+ mouth:set(1, smile)
+ elseif last_value <= battery_threshold_low then
+ charging_icon.visible = false
+ color = sad_color
+ mouth:set(1, frown)
+ elseif last_value <= ok_threshold then
+ charging_icon.visible = false
+ color = ok_color
+ mouth:set(1, ok)
+ else
+ charging_icon.visible = false
+ color = happy_color
+ mouth:set(1, smile)
+ end
+ battery_bar.color = color
+ battery_bar.background_color = color .. "44"
+end)
+
+return cute_battery_face
diff --git a/config/awesome/ui/widgets/dnd/disturb_status b/config/awesome/ui/widgets/dnd/disturb_status
new file mode 100644
index 0000000..c508d53
--- /dev/null
+++ b/config/awesome/ui/widgets/dnd/disturb_status
@@ -0,0 +1 @@
+false
diff --git a/config/awesome/ui/widgets/dnd/icons/dont-disturb.svg b/config/awesome/ui/widgets/dnd/icons/dont-disturb.svg
new file mode 100644
index 0000000..d5dc170
--- /dev/null
+++ b/config/awesome/ui/widgets/dnd/icons/dont-disturb.svg
@@ -0,0 +1,64 @@
+
+
diff --git a/config/awesome/ui/widgets/dnd/icons/notify.svg b/config/awesome/ui/widgets/dnd/icons/notify.svg
new file mode 100644
index 0000000..92b960b
--- /dev/null
+++ b/config/awesome/ui/widgets/dnd/icons/notify.svg
@@ -0,0 +1,91 @@
+
+
diff --git a/config/awesome/ui/widgets/dnd/init.lua b/config/awesome/ui/widgets/dnd/init.lua
new file mode 100644
index 0000000..7982f41
--- /dev/null
+++ b/config/awesome/ui/widgets/dnd/init.lua
@@ -0,0 +1,135 @@
+local awful = require("awful")
+local wibox = require("wibox")
+local gears = require("gears")
+local naughty = require("naughty")
+local beautiful = require("beautiful")
+local dpi = beautiful.xresources.apply_dpi
+local clickable_container = require("ui.widgets.clickable-container")
+local config_dir = gears.filesystem.get_configuration_dir()
+local widget_dir = config_dir .. "ui/widgets/dnd/"
+local widget_icon_dir = widget_dir .. "icons/"
+
+_G.dont_disturb_state = false
+
+local action_name = wibox.widget({
+ text = "Do Not Disturb",
+ font = beautiful.font_name .. "Bold 12",
+ align = "left",
+ widget = wibox.widget.textbox,
+})
+
+local action_status = wibox.widget({
+ text = "Off",
+ font = beautiful.font_name .. "11",
+ align = "left",
+ widget = wibox.widget.textbox,
+})
+
+local action_info = wibox.widget({
+ layout = wibox.layout.fixed.vertical,
+ action_name,
+ action_status,
+})
+
+local button_widget = wibox.widget({
+ {
+ id = "icon",
+ image = gears.color.recolor_image(widget_icon_dir .. "notify.svg", beautiful.xforeground),
+ widget = wibox.widget.imagebox,
+ resize = true,
+ },
+ layout = wibox.layout.align.horizontal,
+})
+
+local widget_button = wibox.widget({
+ {
+ {
+ button_widget,
+ margins = dpi(15),
+ forced_height = dpi(48),
+ forced_width = dpi(48),
+ widget = wibox.container.margin,
+ },
+ widget = clickable_container,
+ },
+ bg = beautiful.control_center_button_bg,
+ shape = gears.shape.circle,
+ widget = wibox.container.background,
+})
+
+local update_widget = function()
+ if dont_disturb_state then
+ action_status:set_text("On")
+ widget_button.bg = beautiful.accent
+ button_widget.icon:set_image(
+ gears.color.recolor_image(widget_icon_dir .. "dont-disturb.svg", beautiful.xforeground)
+ )
+ else
+ action_status:set_text("Off")
+ widget_button.bg = beautiful.control_center_button_bg
+ button_widget.icon:set_image(gears.color.recolor_image(widget_icon_dir .. "notify.svg", beautiful.xforeground))
+ end
+end
+
+local check_disturb_status = function()
+ awful.spawn.easy_async_with_shell("cat " .. widget_dir .. "disturb_status", function(stdout)
+ local status = stdout
+
+ if status:match("true") then
+ dont_disturb_state = true
+ elseif status:match("false") then
+ dont_disturb_state = false
+ else
+ dont_disturb_state = false
+ awful.spawn.with_shell("echo 'false' > " .. widget_dir .. "disturb_status")
+ end
+
+ update_widget()
+ end)
+end
+
+check_disturb_status()
+
+local toggle_action = function()
+ if dont_disturb_state then
+ dont_disturb_state = false
+ else
+ dont_disturb_state = true
+ end
+ awful.spawn.easy_async_with_shell(
+ "echo " .. tostring(dont_disturb_state) .. " > " .. widget_dir .. "disturb_status",
+ function()
+ update_widget()
+ end
+ )
+end
+
+widget_button:buttons(gears.table.join(awful.button({}, 1, nil, function()
+ toggle_action()
+end)))
+
+action_info:buttons(gears.table.join(awful.button({}, 1, nil, function()
+ toggle_action()
+end)))
+
+local action_widget = wibox.widget({
+ layout = wibox.layout.fixed.horizontal,
+ spacing = dpi(10),
+ widget_button,
+ {
+ layout = wibox.layout.align.vertical,
+ expand = "none",
+ nil,
+ action_info,
+ nil,
+ },
+})
+
+-- Create a notification sound
+naughty.connect_signal("request::display", function(n)
+ if not dont_disturb_state then
+ awful.spawn.with_shell("canberra-gtk-play -i message")
+ end
+end)
+
+return action_widget
diff --git a/config/awesome/ui/widgets/end-session/init.lua b/config/awesome/ui/widgets/end-session/init.lua
new file mode 100644
index 0000000..98dc666
--- /dev/null
+++ b/config/awesome/ui/widgets/end-session/init.lua
@@ -0,0 +1,43 @@
+local awful = require("awful")
+local wibox = require("wibox")
+local gears = require("gears")
+local beautiful = require("beautiful")
+local dpi = beautiful.xresources.apply_dpi
+local clickable_container = require("ui.widgets.clickable-container")
+local helpers = require("helpers")
+
+local return_button = function()
+ local widget = wibox.widget({
+ {
+ align = "center",
+ valign = "center",
+ font = beautiful.icon_font_name .. "18",
+ markup = helpers.colorize_text("", beautiful.xforeground),
+ widget = wibox.widget.textbox(),
+ },
+ layout = wibox.layout.align.horizontal,
+ })
+
+ local widget_button = wibox.widget({
+ {
+ {
+ widget,
+ margins = dpi(8),
+ widget = wibox.container.margin,
+ },
+ widget = clickable_container,
+ },
+ bg = beautiful.transparent,
+ shape = helpers.rrect(beautiful.control_center_widget_radius),
+ widget = wibox.container.background,
+ })
+
+ widget_button:buttons(gears.table.join(awful.button({}, 1, nil, function()
+ awesome.emit_signal("module::exit_screen:show")
+ central_panel:toggle()
+ end)))
+
+ return widget_button
+end
+
+return return_button
diff --git a/config/awesome/ui/widgets/floating-mode/floating_mode b/config/awesome/ui/widgets/floating-mode/floating_mode
new file mode 100644
index 0000000..c508d53
--- /dev/null
+++ b/config/awesome/ui/widgets/floating-mode/floating_mode
@@ -0,0 +1 @@
+false
diff --git a/config/awesome/ui/widgets/floating-mode/icons/floating.svg b/config/awesome/ui/widgets/floating-mode/icons/floating.svg
new file mode 100644
index 0000000..bdc513d
--- /dev/null
+++ b/config/awesome/ui/widgets/floating-mode/icons/floating.svg
@@ -0,0 +1,4 @@
+
diff --git a/config/awesome/ui/widgets/floating-mode/icons/tile.svg b/config/awesome/ui/widgets/floating-mode/icons/tile.svg
new file mode 100644
index 0000000..6c3d8c3
--- /dev/null
+++ b/config/awesome/ui/widgets/floating-mode/icons/tile.svg
@@ -0,0 +1,9 @@
+
diff --git a/config/awesome/ui/widgets/floating-mode/init.lua b/config/awesome/ui/widgets/floating-mode/init.lua
new file mode 100755
index 0000000..a738585
--- /dev/null
+++ b/config/awesome/ui/widgets/floating-mode/init.lua
@@ -0,0 +1,175 @@
+local awful = require("awful")
+local wibox = require("wibox")
+local gears = require("gears")
+local beautiful = require("beautiful")
+local dpi = beautiful.xresources.apply_dpi
+local clickable_container = require("ui.widgets.clickable-container")
+local config_dir = gears.filesystem.get_configuration_dir()
+local widget_dir = config_dir .. "ui/widgets/floating-mode/"
+local widget_icon_dir = widget_dir .. "icons/"
+
+local floating_state = false
+
+local action_name = wibox.widget({
+ text = "Floating Mode",
+ font = beautiful.font_name .. "Bold 12",
+ align = "left",
+ widget = wibox.widget.textbox,
+})
+
+local action_status = wibox.widget({
+ text = "Off",
+ font = beautiful.font_name .. "11",
+ align = "left",
+ widget = wibox.widget.textbox,
+})
+
+local action_info = wibox.widget({
+ layout = wibox.layout.fixed.vertical,
+ action_name,
+ action_status,
+})
+
+local button_widget = wibox.widget({
+ {
+ id = "icon",
+ image = gears.color.recolor_image(widget_icon_dir .. "floating.svg", beautiful.xforeground),
+ widget = wibox.widget.imagebox,
+ resize = true,
+ },
+ layout = wibox.layout.align.horizontal,
+})
+
+local widget_button = wibox.widget({
+ {
+ {
+ button_widget,
+ margins = dpi(15),
+ forced_height = dpi(48),
+ forced_width = dpi(48),
+ widget = wibox.container.margin,
+ },
+ widget = clickable_container,
+ },
+ bg = beautiful.control_center_button_bg,
+ shape = gears.shape.circle,
+ widget = wibox.container.background,
+})
+
+local update_widget = function()
+ if floating_state then
+ action_status:set_text("On")
+ widget_button.bg = beautiful.accent
+ button_widget.icon:set_image(
+ gears.color.recolor_image(widget_icon_dir .. "floating.svg", beautiful.xforeground)
+ )
+ else
+ action_status:set_text("Off")
+ widget_button.bg = beautiful.control_center_button_bg
+ button_widget.icon:set_image(
+ gears.color.recolor_image(widget_icon_dir .. "floating.svg", beautiful.xforeground)
+ )
+ end
+end
+
+local check_floating_mode_state = function()
+ local cmd = "cat " .. widget_dir .. "floating_mode"
+
+ awful.spawn.easy_async_with_shell(cmd, function(stdout)
+ local status = stdout
+
+ if status:match("true") then
+ floating_state = true
+ elseif status:match("false") then
+ floating_state = false
+ else
+ floating_state = false
+ awful.spawn.easy_async_with_shell('echo "false" > ' .. widget_dir .. "floating_mode", function(stdout) end)
+ end
+ update_widget()
+ end)
+end
+
+check_floating_mode_state()
+
+local ap_off_cmd = [[
+
+ # Create an AwesomeWM Notification
+ awesome-client "
+ naughty = require('naughty')
+ naughty.notification({
+ app_name = 'Layout Manager',
+ title = 'Floating mode disabled!',
+ message = 'Set global layout to tile',
+ icon = ']] .. widget_icon_dir .. "tile" .. ".svg" .. [['
+ })
+ "
+ ]] .. "echo false > " .. widget_dir .. "floating_mode" .. [[
+]]
+
+local ap_on_cmd = [[
+
+ # Create an AwesomeWM Notification
+ awesome-client "
+ naughty = require('naughty')
+ naughty.notification({
+ app_name = 'Layout Manager',
+ title = 'Floating mode enabled!',
+ message = 'Set global layout to floating',
+ icon = ']] .. widget_icon_dir .. "floating" .. ".svg" .. [['
+ })
+ "
+ ]] .. "echo true > " .. widget_dir .. "floating_mode" .. [[
+]]
+
+local toggle_global_floating = function()
+ local tags = awful.screen.focused().tags
+ if not floating_state then
+ for _, tag in ipairs(tags) do
+ awful.layout.set(awful.layout.suit.floating, tag)
+ end
+ awful.spawn.easy_async_with_shell(ap_on_cmd, function(stdout)
+ floating_state = true
+ update_widget()
+ end)
+ else
+ for _, tag in ipairs(tags) do
+ awful.layout.set(awful.layout.suit.tile, tag)
+ end
+ awful.spawn.easy_async_with_shell(ap_off_cmd, function(stdout)
+ floating_state = false
+ update_widget()
+ end)
+ end
+end
+
+widget_button:buttons(gears.table.join(awful.button({}, 1, nil, function()
+ toggle_global_floating()
+end)))
+
+action_info:buttons(gears.table.join(awful.button({}, 1, nil, function()
+ toggle_global_floating()
+end)))
+
+gears.timer({
+ timeout = 5,
+ autostart = true,
+ callback = function()
+ check_floating_mode_state()
+ end,
+})
+
+local action_widget = wibox.widget({
+ layout = wibox.layout.fixed.horizontal,
+ spacing = dpi(10),
+ widget_button,
+ {
+ layout = wibox.layout.align.vertical,
+ expand = "none",
+ nil,
+ action_info,
+ nil,
+ },
+})
+
+return action_widget
diff --git a/config/awesome/ui/widgets/microphone/icons/mic-off.svg b/config/awesome/ui/widgets/microphone/icons/mic-off.svg
new file mode 100644
index 0000000..c2dc141
--- /dev/null
+++ b/config/awesome/ui/widgets/microphone/icons/mic-off.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/config/awesome/ui/widgets/microphone/icons/mic.svg b/config/awesome/ui/widgets/microphone/icons/mic.svg
new file mode 100644
index 0000000..8405e32
--- /dev/null
+++ b/config/awesome/ui/widgets/microphone/icons/mic.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/config/awesome/ui/widgets/microphone/init.lua b/config/awesome/ui/widgets/microphone/init.lua
new file mode 100644
index 0000000..c52c915
--- /dev/null
+++ b/config/awesome/ui/widgets/microphone/init.lua
@@ -0,0 +1,71 @@
+local awful = require("awful")
+local wibox = require("wibox")
+local gears = require("gears")
+local beautiful = require("beautiful")
+local dpi = beautiful.xresources.apply_dpi
+local clickable_container = require("ui.widgets.clickable-container")
+local helpers = require("helpers")
+
+local mic_state = false
+
+local button_widget = wibox.widget({
+ id = "icon",
+ markup = helpers.colorize_text("", beautiful.xforeground),
+ font = beautiful.icon_font_name .. "18",
+ align = "center",
+ valign = "center",
+ widget = wibox.widget.textbox,
+})
+
+local widget_button = wibox.widget({
+ {
+ {
+ button_widget,
+ margins = dpi(12),
+ forced_height = dpi(48),
+ forced_width = dpi(48),
+ widget = wibox.container.margin,
+ },
+ widget = clickable_container,
+ },
+ bg = beautiful.control_center_button_bg,
+ shape = gears.shape.circle,
+ widget = wibox.container.background,
+})
+
+local update_widget = function()
+ if mic_state then
+ widget_button.bg = beautiful.accent
+ else
+ widget_button.bg = beautiful.control_center_button_bg
+ end
+end
+
+local initial_action = function(button)
+ awful.spawn.easy_async_with_shell(
+ [[sh -c amixer | grep 'Front Left: Capture' | awk -F' ' '{print $6}' | sed -e 's/\[//' -e 's/\]//']],
+ function(stdout)
+ if stdout:match("on") then
+ mic_state = true
+ else
+ mic_state = false
+ end
+ update_widget()
+ end
+ )
+end
+
+local onclick_action = function()
+ awful.spawn.with_shell("amixer set Capture toggle")
+end
+
+widget_button:connect_signal("button::press", function(self, _, _, button)
+ if button == 1 then
+ onclick_action()
+ initial_action(self)
+ end
+end)
+
+initial_action(widget_button)
+
+return widget_button
diff --git a/config/awesome/ui/widgets/screenrec/init.lua b/config/awesome/ui/widgets/screenrec/init.lua
new file mode 100644
index 0000000..d0fef36
--- /dev/null
+++ b/config/awesome/ui/widgets/screenrec/init.lua
@@ -0,0 +1,217 @@
+local wibox = require("wibox")
+local awful = require("awful")
+local gears = require("gears")
+local naughty = require("naughty")
+local beautiful = require("beautiful")
+local dpi = beautiful.xresources.apply_dpi
+local clickable_container = require("ui.widgets.clickable-container")
+local helpers = require("helpers")
+
+-- Screenrec
+---------------
+-- Stolen from manilarome
+
+-- Status variables
+local status_recording = false
+local status_audio = true
+local ffmpeg_pid = nil
+
+-- User preferences
+local user_preferences = {
+ resolution = "1366x768",
+ offset = "0,0",
+ audio = false,
+ save_directory = "$(xdg-user-dir VIDEOS)/Recordings/",
+ mic_lvl = "20",
+ fps = "30",
+}
+
+-- Script
+local create_save_directory = function()
+ local create_dir_cmd = [[
+ dir="]] .. user_preferences.save_directory .. [["
+
+ if [ ! -d "$dir" ]; then
+ mkdir -p "$dir"
+ fi
+ ]]
+
+ awful.spawn.easy_async_with_shell(create_dir_cmd, function(stdout) end)
+end
+
+create_save_directory()
+
+local kill_existing_recording_ffmpeg = function()
+ awful.spawn.easy_async_with_shell(
+ [[
+ ps x | grep 'ffmpeg -video_size' | grep -v grep | awk '{print $1}' | xargs kill
+ ]],
+ function(stdout) end
+ )
+end
+
+kill_existing_recording_ffmpeg()
+
+local turn_on_the_mic = function()
+ awful.spawn.easy_async_with_shell([[
+ amixer set Capture cap
+ amixer set Capture ]] .. user_preferences.mic_lvl .. [[%
+ ]], function() end)
+end
+
+local ffmpeg_stop_recording = function()
+ awful.spawn.easy_async_with_shell(
+ [[
+ ps x | grep 'ffmpeg -video_size' | grep -v grep | awk '{print $1}' | xargs kill -2
+ ]],
+ function(stdout) end
+ )
+end
+
+local create_notification = function(file_dir)
+ local open_video = naughty.action({
+ name = "Open",
+ icon_only = false,
+ })
+
+ local delete_video = naughty.action({
+ name = "Delete",
+ icon_only = false,
+ })
+
+ open_video:connect_signal("invoked", function()
+ awful.spawn("xdg-open " .. file_dir, false)
+ end)
+
+ delete_video:connect_signal("invoked", function()
+ awful.spawn("gio trash " .. file_dir, false)
+ end)
+
+ naughty.notification({
+ app_name = "Screenrecorder Tool",
+ timeout = 6,
+ title = "Screenrec!",
+ message = "Recording Finished",
+ actions = { open_video, delete_video },
+ })
+end
+
+local ffmpeg_start_recording = function(audio, filename)
+ local add_audio_str = " "
+
+ if audio then
+ turn_on_the_mic()
+ add_audio_str = "-f pulse -ac 2 -i default"
+ end
+
+ ffmpeg_pid = awful.spawn.easy_async_with_shell([[
+ file_name=]] .. filename .. [[
+
+ ffmpeg -video_size ]] .. user_preferences.resolution .. [[ -framerate ]] .. user_preferences.fps .. [[ -f x11grab \
+ -i :0.0+]] .. user_preferences.offset .. " " .. add_audio_str .. [[ -c:v libx264 -crf 20 -profile:v baseline -level 3.0 -pix_fmt yuv420p $file_name
+ ]], function(stdout, stderr)
+ if stderr and stderr:match("Invalid argument") then
+ naughty.notification({
+ app_name = "Screenrecorder Tool",
+ title = "Screenrec!",
+ message = "Invalid Configuration! please, put a valid settings!",
+ timeout = 3,
+ urgency = "normal",
+ })
+ awesome.emit_signal("widget::screen_recorder")
+ return
+ end
+ create_notification(filename)
+ end)
+end
+
+local create_unique_filename = function(audio)
+ awful.spawn.easy_async_with_shell([[
+ dir="]] .. user_preferences.save_directory .. [["
+ date=$(date '+%Y-%m-%d_%H-%M-%S')
+ format=.mp4
+
+ echo "${dir}${date}${format}" | tr -d '\n'
+ ]], function(stdout)
+ local filename = stdout
+ ffmpeg_start_recording(audio, filename)
+ end)
+end
+
+local start_recording = function(audio_mode)
+ create_save_directory()
+ create_unique_filename(audio_mode)
+end
+
+local stop_recording = function()
+ ffmpeg_stop_recording()
+end
+
+-- Buttons
+local screen_rec_toggle_imgbox = wibox.widget({
+ id = "icon",
+ markup = helpers.colorize_text("", beautiful.xforeground),
+ font = beautiful.icon_font_name .. "18",
+ align = "center",
+ valign = "center",
+ widget = wibox.widget.textbox,
+})
+
+local screen_rec_toggle_button = wibox.widget({
+ {
+ {
+ screen_rec_toggle_imgbox,
+ margins = dpi(12),
+ forced_height = dpi(48),
+ forced_width = dpi(48),
+ widget = wibox.container.margin,
+ },
+ widget = clickable_container,
+ },
+ bg = beautiful.control_center_button_bg,
+ shape = gears.shape.circle,
+ widget = wibox.container.background,
+})
+
+-- Start Recording
+local sr_recording_start = function()
+ status_recording = true
+ screen_rec_toggle_button.bg = beautiful.accent
+
+ start_recording(status_audio)
+ central_panel:toggle()
+end
+
+-- Stop Recording
+local sr_recording_stop = function()
+ status_recording = false
+ status_audio = false
+ screen_rec_toggle_button.bg = beautiful.control_center_button_bg
+
+ stop_recording()
+end
+
+awesome.connect_signal("widget::screen_recorder", function()
+ sr_recording_stop()
+end)
+
+-- Main button functions and buttons
+local status_checker = function()
+ if status_recording then
+ sr_recording_stop()
+ return
+ else
+ sr_recording_start()
+ return
+ end
+end
+
+screen_rec_toggle_button:buttons(gears.table.join(awful.button({}, 1, nil, function()
+ status_checker()
+end)))
+
+local return_button = function()
+ return screen_rec_toggle_button
+end
+
+return return_button
diff --git a/config/awesome/ui/widgets/theme-switcher/init.lua b/config/awesome/ui/widgets/theme-switcher/init.lua
new file mode 100644
index 0000000..0ed92bd
--- /dev/null
+++ b/config/awesome/ui/widgets/theme-switcher/init.lua
@@ -0,0 +1,83 @@
+local awful = require("awful")
+local wibox = require("wibox")
+local gears = require("gears")
+local naughty = require("naughty")
+local beautiful = require("beautiful")
+local dpi = beautiful.xresources.apply_dpi
+local clickable_container = require("ui.widgets.clickable-container")
+local helpers = require("helpers")
+local day_night = {}
+
+local function theme_container(widget, name)
+ local container = wibox.widget({
+ {
+ {
+ {
+ layout = wibox.layout.fixed.horizontal,
+ spacing = dpi(5),
+ {
+ widget,
+ forced_height = dpi(70),
+ forced_width = dpi(70),
+ widget = wibox.container.margin,
+ },
+ {
+ text = name,
+ font = beautiful.font_name .. "Bold 10",
+ align = "center",
+ widget = wibox.widget.textbox,
+ },
+ },
+ margins = dpi(5),
+ widget = wibox.container.margin,
+ },
+ widget = clickable_container,
+ },
+ shape = helpers.rrect(beautiful.control_center_widget_radius),
+ bg = beautiful.lighter_bg,
+ widget = wibox.container.background,
+ })
+
+ return container
+end
+
+local night = wibox.widget({
+ align = "center",
+ valign = "center",
+ font = "icomoon 50",
+ markup = helpers.colorize_text("", beautiful.xforeground),
+ widget = wibox.widget.textbox(),
+})
+
+night:connect_signal("button::press", function()
+ awful.spawn.with_shell(gears.filesystem.get_configuration_dir() .. "theme/themes night")
+ awesome.restart()
+end)
+
+local day = wibox.widget({
+ align = "center",
+ valign = "center",
+ font = "icomoon 50",
+ markup = helpers.colorize_text("", beautiful.xforeground),
+ widget = wibox.widget.textbox(),
+})
+
+day:connect_signal("button::press", function()
+ awful.spawn.with_shell(gears.filesystem.get_configuration_dir() .. "theme/themes day")
+ awesome.restart()
+end)
+
+day_night.night = theme_container(night, "Night Themes")
+day_night.day = theme_container(day, "Day Themes")
+
+local update_themes = function()
+ if theme == themes[2] then
+ day_night.night.bg = beautiful.accent
+ else
+ day_night.day.bg = beautiful.accent
+ end
+end
+
+update_themes()
+
+return day_night
diff --git a/config/awesome/ui/widgets/user-profile/init.lua b/config/awesome/ui/widgets/user-profile/init.lua
new file mode 100644
index 0000000..93b58fb
--- /dev/null
+++ b/config/awesome/ui/widgets/user-profile/init.lua
@@ -0,0 +1,56 @@
+local awful = require("awful")
+local wibox = require("wibox")
+local gears = require("gears")
+local beautiful = require("beautiful")
+local dpi = beautiful.xresources.apply_dpi
+
+local create_profile = function()
+ local profile_imagebox = wibox.widget({
+ {
+ id = "icon",
+ image = beautiful.pfp,
+ widget = wibox.widget.imagebox,
+ resize = true,
+ forced_height = dpi(50),
+ clip_shape = gears.shape.circle,
+ },
+ layout = wibox.layout.fixed.horizontal,
+ })
+
+ local profile_name = wibox.widget({
+ font = beautiful.font_name .. "Bold 14",
+ markup = "User",
+ align = "left",
+ valign = "center",
+ widget = wibox.widget.textbox,
+ })
+
+ awful.spawn.easy_async_with_shell(
+ [[
+ sh -c '
+ fullname="$(getent passwd `whoami` | cut -d ':' -f 5 | cut -d ',' -f 1 | tr -d "\n")"
+ if [ -z "$fullname" ];
+ then
+ printf "$(whoami)@$(hostname)"
+ else
+ printf "$fullname"
+ fi
+ '
+ ]],
+ function(stdout)
+ local stdout = stdout:gsub("%\n", "")
+ profile_name:set_markup(stdout)
+ end
+ )
+
+ local user_profile = wibox.widget({
+ layout = wibox.layout.fixed.horizontal,
+ spacing = dpi(15),
+ profile_imagebox,
+ profile_name,
+ })
+
+ return user_profile
+end
+
+return create_profile
diff --git a/config/awesome/ui/widgets/vol-bri-slider/init.lua b/config/awesome/ui/widgets/vol-bri-slider/init.lua
new file mode 100644
index 0000000..2473d35
--- /dev/null
+++ b/config/awesome/ui/widgets/vol-bri-slider/init.lua
@@ -0,0 +1,144 @@
+local gears = require("gears")
+local awful = require("awful")
+local beautiful = require("beautiful")
+local dpi = beautiful.xresources.apply_dpi
+local wibox = require("wibox")
+local helpers = require("helpers")
+
+local bg_color = beautiful.accent
+local vol_color = bg_color
+local brightness_color = bg_color
+
+-- Helpers
+local function create_slider_widget(slider_color)
+ local slider_widget = wibox.widget({
+ {
+ id = "slider",
+ max_value = 100,
+ value = 40,
+ background_color = bg_color .. "55",
+ color = slider_color,
+ shape = gears.shape.rounded_bar,
+ bar_shape = gears.shape.rounded_bar,
+ widget = wibox.widget.progressbar,
+ },
+ forced_height = dpi(50),
+ widget = wibox.container.background,
+ })
+ return slider_widget
+end
+
+local function create_icons(icon, color)
+ local icon_widget = wibox.widget({
+ {
+ markup = helpers.colorize_text(icon, color),
+ font = beautiful.icon_font_name .. "14",
+ align = "left",
+ valign = "center",
+ widget = wibox.widget.textbox,
+ },
+ left = dpi(15),
+ widget = wibox.container.margin,
+ })
+
+ return icon_widget
+end
+
+-- Widget
+local vol = create_slider_widget(vol_color)
+local brightness = create_slider_widget(brightness_color)
+
+local vol_slider_container = wibox.widget({
+ {
+ {
+ vol,
+ create_icons("", beautiful.xforeground),
+ layout = wibox.layout.stack,
+ },
+ margins = dpi(10),
+ widget = wibox.container.margin,
+ },
+ shape = function(cr, width, height)
+ gears.shape.rounded_rect(cr, width, height, dpi(5))
+ end,
+ bg = beautiful.control_center_widget_bg,
+ widget = wibox.container.background,
+})
+
+local brightness_slider_container = wibox.widget({
+ {
+ {
+ brightness,
+ create_icons("", beautiful.xforeground),
+ layout = wibox.layout.stack,
+ },
+ margins = dpi(10),
+ widget = wibox.container.margin,
+ },
+ shape = function(cr, width, height)
+ gears.shape.rounded_rect(cr, width, height, dpi(5))
+ end,
+ bg = beautiful.control_center_widget_bg,
+ widget = wibox.container.background,
+})
+
+awesome.connect_signal("signal::volume", function(value, muted)
+ local fill_color
+ local vol_value = value or 0
+
+ if muted then
+ fill_color = beautiful.xcolor8
+ vol.slider.background_color = fill_color .. "44"
+ else
+ fill_color = vol_color
+ end
+
+ vol.slider.value = vol_value
+ vol.slider.color = fill_color
+ vol.slider.background_color = fill_color .. "44"
+end)
+
+awesome.connect_signal("signal::brightness", function(value)
+ brightness.slider.value = value
+ brightness.slider.background_color = brightness_color .. "44"
+end)
+
+vol:buttons(gears.table.join(
+ awful.button({}, 1, function()
+ helpers.volume_control(0)
+ end),
+ -- Scrolling
+ awful.button({}, 4, function()
+ helpers.volume_control(5)
+ end),
+ awful.button({}, 5, function()
+ helpers.volume_control(-5)
+ end)
+))
+
+brightness:buttons(gears.table.join(
+ -- Scrolling
+ awful.button({}, 4, function()
+ awful.spawn.with_shell("brightnessctl set 5%+ -q")
+ end),
+ awful.button({}, 5, function()
+ awful.spawn.with_shell("brightnessctl set 5%- -q")
+ end)
+))
+
+local stats = wibox.widget({
+ {
+ {
+ brightness_slider_container,
+ vol_slider_container,
+ spacing = dpi(20),
+ layout = wibox.layout.flex.horizontal,
+ },
+ expand = "none",
+ layout = wibox.layout.fixed.vertical,
+ },
+ expand = "none",
+ layout = wibox.layout.align.horizontal,
+})
+
+return stats