🐛 fix: Awesome config baseline

This commit is contained in:
punkfairie 2024-02-19 19:41:33 -08:00
parent 3da95d6ec2
commit e7fcada03c
65 changed files with 2191 additions and 2442 deletions

View file

@ -7,17 +7,20 @@ M.keys = {
M.apps = { M.apps = {
terminal = "wezterm", terminal = "wezterm",
launcher = "rofi -no-lazy-grab -show drun -theme ~/.config/rofi/launcher.rasi",
browser = "firefox", browser = "firefox",
file_manager = "thunar",
editor = os.getenv("EDITOR") or "nvim", editor = os.getenv("EDITOR") or "nvim",
} }
M.apps.start_editor = M.apps.terminal .. "-e" .. M.apps.editor M.apps.start_editor = M.apps.terminal .. "-e" .. M.apps.editor
M.apps.music_player = M.apps.terminal .. "--class music -e ncmpcpp"
M.widget = {} M.widget = {}
M.widget.weather = { M.widget.weather = {
api_key = "", api_key = "e894c3e6c1a9d2217eee94791e845c96",
coordinates = { lat = "", lon = "" }, coordinates = { lat = "47.773140", lon = "-122.303660" },
} }
M.widget.github = { M.widget.github = {

View file

@ -3,7 +3,6 @@ local wibox = require("wibox")
local gshape = require("gears.shape") local gshape = require("gears.shape")
local gmatrix = require("gears.matrix") local gmatrix = require("gears.matrix")
local ipairs = ipairs local ipairs = ipairs
local table = table
local capi = { mouse = mouse } local capi = { mouse = mouse }
local _ui = {} local _ui = {}
@ -94,8 +93,8 @@ local function _get_widget_geometry(_hierarchy, widget)
end end
end end
function _ui.get_widget_geometry(wibox, widget) function _ui.get_widget_geometry(_wibox, widget)
return _get_widget_geometry(wibox._drawable._widget_hierarchy, widget) return _get_widget_geometry(_wibox._drawable._widget_hierarchy, widget)
end end
function _ui.screen_mask(s, bg) function _ui.screen_mask(s, bg)
@ -110,18 +109,18 @@ function _ui.screen_mask(s, bg)
return mask return mask
end end
function _ui.grouping_widget(w1,w2,dpi1) function _ui.grouping_widget(w1, w2, dpi1)
local container = wibox.widget { local container = wibox.widget({
w1, w1,
{ {
nil, nil,
w2, w2,
expand = 'none', expand = "none",
layout = wibox.layout.flex.vertical, layout = wibox.layout.flex.vertical,
}, },
spacing = dpi1, spacing = dpi1,
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
} })
return container return container
end end

View file

@ -6,7 +6,7 @@
local gobject = require("gears.object") local gobject = require("gears.object")
-- Kidna copying awesotre's stores on a surface level for added compatibility -- Kidna copying awesotre's stores on a surface level for added compatibility
local function subscribable(args) local function subscribable()
local ret = gobject({}) local ret = gobject({})
local subscribed = {} local subscribed = {}

View file

@ -41,7 +41,7 @@ local tween = {
]], ]],
} }
local pow, sin, cos, pi, sqrt, abs, asin = math.pow, math.sin, math.cos, math.pi, math.sqrt, math.abs, math.asin local sin, cos, pi, sqrt, abs, asin = math.sin, math.cos, math.pi, math.sqrt, math.abs, math.asin
-- linear -- linear
local function linear(t, b, c, d) local function linear(t, b, c, d)
@ -50,7 +50,7 @@ end
-- quad -- quad
local function inQuad(t, b, c, d) local function inQuad(t, b, c, d)
return c * pow(t / d, 2) + b return c * ((t / d) ^ 2) + b
end end
local function outQuad(t, b, c, d) local function outQuad(t, b, c, d)
t = t / d t = t / d
@ -59,7 +59,7 @@ end
local function inOutQuad(t, b, c, d) local function inOutQuad(t, b, c, d)
t = t / d * 2 t = t / d * 2
if t < 1 then if t < 1 then
return c / 2 * pow(t, 2) + b return c / 2 * (t ^ 2) + b
end end
return -c / 2 * ((t - 1) * (t - 3) - 1) + b return -c / 2 * ((t - 1) * (t - 3) - 1) + b
end end
@ -72,10 +72,10 @@ end
-- cubic -- cubic
local function inCubic(t, b, c, d) local function inCubic(t, b, c, d)
return c * pow(t / d, 3) + b return c * ((t / d) ^ 3) + b
end end
local function outCubic(t, b, c, d) local function outCubic(t, b, c, d)
return c * (pow(t / d - 1, 3) + 1) + b return c * (((t / d - 1) ^ 3) + 1) + b
end end
local function inOutCubic(t, b, c, d) local function inOutCubic(t, b, c, d)
t = t / d * 2 t = t / d * 2
@ -94,17 +94,17 @@ end
-- quart -- quart
local function inQuart(t, b, c, d) local function inQuart(t, b, c, d)
return c * pow(t / d, 4) + b return c * ((t / d) ^ 4) + b
end end
local function outQuart(t, b, c, d) local function outQuart(t, b, c, d)
return -c * (pow(t / d - 1, 4) - 1) + b return -c * (((t / d - 1) ^ 4) - 1) + b
end end
local function inOutQuart(t, b, c, d) local function inOutQuart(t, b, c, d)
t = t / d * 2 t = t / d * 2
if t < 1 then if t < 1 then
return c / 2 * pow(t, 4) + b return c / 2 * (t ^ 4) + b
end end
return -c / 2 * (pow(t - 2, 4) - 2) + b return -c / 2 * (((t - 2) ^ 4) - 2) + b
end end
local function outInQuart(t, b, c, d) local function outInQuart(t, b, c, d)
if t < d / 2 then if t < d / 2 then
@ -115,17 +115,17 @@ end
-- quint -- quint
local function inQuint(t, b, c, d) local function inQuint(t, b, c, d)
return c * pow(t / d, 5) + b return c * ((t / d) ^ 5) + b
end end
local function outQuint(t, b, c, d) local function outQuint(t, b, c, d)
return c * (pow(t / d - 1, 5) + 1) + b return c * (((t / d - 1) ^ 5) + 1) + b
end end
local function inOutQuint(t, b, c, d) local function inOutQuint(t, b, c, d)
t = t / d * 2 t = t / d * 2
if t < 1 then if t < 1 then
return c / 2 * pow(t, 5) + b return c / 2 * (t ^ 5) + b
end end
return c / 2 * (pow(t - 2, 5) + 2) + b return c / 2 * (((t - 2) ^ 5) + 2) + b
end end
local function outInQuint(t, b, c, d) local function outInQuint(t, b, c, d)
if t < d / 2 then if t < d / 2 then
@ -156,13 +156,13 @@ local function inExpo(t, b, c, d)
if t == 0 then if t == 0 then
return b return b
end end
return c * pow(2, 10 * (t / d - 1)) + b - c * 0.001 return c * (2 ^ (10 * (t / d - 1))) + b - c * 0.001
end end
local function outExpo(t, b, c, d) local function outExpo(t, b, c, d)
if t == d then if t == d then
return b + c return b + c
end end
return c * 1.001 * (-pow(2, -10 * t / d) + 1) + b return c * 1.001 * (-(2 ^ (-10 * t / d)) + 1) + b
end end
local function inOutExpo(t, b, c, d) local function inOutExpo(t, b, c, d)
if t == 0 then if t == 0 then
@ -173,9 +173,9 @@ local function inOutExpo(t, b, c, d)
end end
t = t / d * 2 t = t / d * 2
if t < 1 then if t < 1 then
return c / 2 * pow(2, 10 * (t - 1)) + b - c * 0.0005 return c / 2 * (2 ^ (10 * (t - 1))) + b - c * 0.0005
end end
return c / 2 * 1.0005 * (-pow(2, -10 * (t - 1)) + 2) + b return c / 2 * 1.0005 * (-(2 ^ (-10 * (t - 1))) + 2) + b
end end
local function outInExpo(t, b, c, d) local function outInExpo(t, b, c, d)
if t < d / 2 then if t < d / 2 then
@ -186,10 +186,10 @@ end
-- circ -- circ
local function inCirc(t, b, c, d) local function inCirc(t, b, c, d)
return (-c * (sqrt(1 - pow(t / d, 2)) - 1) + b) return (-c * (sqrt(1 - ((t / d) ^ 2)) - 1) + b)
end end
local function outCirc(t, b, c, d) local function outCirc(t, b, c, d)
return (c * sqrt(1 - pow(t / d - 1, 2)) + b) return (c * sqrt(1 - ((t / d - 1) ^ 2)) + b)
end end
local function inOutCirc(t, b, c, d) local function inOutCirc(t, b, c, d)
t = t / d * 2 t = t / d * 2
@ -225,7 +225,7 @@ local function inElastic(t, b, c, d, a, p)
end end
p, a, s = calculatePAS(p, a, c, d) p, a, s = calculatePAS(p, a, c, d)
t = t - 1 t = t - 1
return -(a * pow(2, 10 * t) * sin((t * d - s) * (2 * pi) / p)) + b return -(a * (2 ^ (10 * t)) * sin((t * d - s) * (2 * pi) / p)) + b
end end
local function outElastic(t, b, c, d, a, p) local function outElastic(t, b, c, d, a, p)
local s local s
@ -237,7 +237,7 @@ local function outElastic(t, b, c, d, a, p)
return b + c return b + c
end end
p, a, s = calculatePAS(p, a, c, d) p, a, s = calculatePAS(p, a, c, d)
return a * pow(2, -10 * t) * sin((t * d - s) * (2 * pi) / p) + c + b return a * (2 ^ (-10 * t)) * sin((t * d - s) * (2 * pi) / p) + c + b
end end
local function inOutElastic(t, b, c, d, a, p) local function inOutElastic(t, b, c, d, a, p)
local s local s
@ -251,9 +251,9 @@ local function inOutElastic(t, b, c, d, a, p)
p, a, s = calculatePAS(p, a, c, d) p, a, s = calculatePAS(p, a, c, d)
t = t - 1 t = t - 1
if t < 0 then if t < 0 then
return -0.5 * (a * pow(2, 10 * t) * sin((t * d - s) * (2 * pi) / p)) + b return -0.5 * (a * (2 ^ (10 * t)) * sin((t * d - s) * (2 * pi) / p)) + b
end end
return a * pow(2, -10 * t) * sin((t * d - s) * (2 * pi) / p) * 0.5 + c + b return a * (2 ^ (-10 * t)) * sin((t * d - s) * (2 * pi) / p) * 0.5 + c + b
end end
local function outInElastic(t, b, c, d, a, p) local function outInElastic(t, b, c, d, a, p)
if t < d / 2 then if t < d / 2 then
@ -405,7 +405,7 @@ local function checkSubjectAndTargetRecursively(subject, target, path)
end end
end end
local function checkNewParams(initial, duration, subject, target, easing) local function checkNewParams(_, _, subject, target, easing)
-- assert(type(initial) == 'number' and duration > 0, "duration must be a positive number. Was " .. tostring(duration)) -- assert(type(initial) == 'number' and duration > 0, "duration must be a positive number. Was " .. tostring(duration))
-- assert(type(duration) == 'number' and duration > 0, "duration must be a positive number. Was " .. tostring(duration)) -- assert(type(duration) == 'number' and duration > 0, "duration must be a positive number. Was " .. tostring(duration))
assert(type(easing) == "function", "easing must be a function. Was " .. tostring(easing)) assert(type(easing) == "function", "easing must be a function. Was " .. tostring(easing))

View file

@ -12,7 +12,7 @@ local function mouse_resize_handler(m, c)
local x, y = start.x, start.y local x, y = start.x, start.y
local wa = m(c.screen.workarea) local wa = m(c.screen.workarea)
local idx = awful.client.idx(c) local idx = awful.client.idx(c)
local c_above, c_below local c_above
local idx_above, idx_below local idx_above, idx_below
local wfact_above, wfact_below local wfact_above, wfact_below
local jump_to = { x = x, y = y } local jump_to = { x = x, y = y }
@ -23,17 +23,17 @@ local function mouse_resize_handler(m, c)
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 if idx and idx.idx > 1 and y >= g.y and y <= g.y + v_border then
-- we are near the top edge of the window -- we are near the top edge of the window
c_above = awful.client.next(-1, c) c_above = awful.client.next(-1, c)
c_below = c C_BELOW = c
jump_to.y = g.y jump_to.y = g.y
idx_above = idx.idx - 1 idx_above = idx.idx - 1
idx_below = idx.idx idx_below = idx.idx
elseif idx.idx < idx.num and y >= g.y + g.height - v_border then elseif idx and idx.idx < idx.num and y >= g.y + g.height - v_border then
-- we are near the bottom edge of the window -- we are near the bottom edge of the window
c_above = c c_above = c
c_below = awful.client.next(1, c) C_BELOW = awful.client.next(1, c)
idx_above = idx.idx idx_above = idx.idx
idx_below = idx.idx + 1 idx_below = idx.idx + 1
jump_to.y = g.y + g.height jump_to.y = g.y + g.height
@ -49,7 +49,7 @@ local function mouse_resize_handler(m, c)
end end
end end
if idx_above then if idx and idx_above then
local t = c.screen.selected_tag local t = c.screen.selected_tag
local data = t.windowfact or {} local data = t.windowfact or {}
local colfact = data[idx.col] or {} local colfact = data[idx.col] or {}
@ -58,11 +58,11 @@ local function mouse_resize_handler(m, c)
end end
if idx_above and move_mwfact then if idx_above and move_mwfact then
cursor = "cross" CURSOR = "cross"
elseif idx_above then elseif idx_above then
cursor = m({ y = "sb_v_double_arrow", x = "sb_h_double_arrow" }).y CURSOR = m({ y = "sb_v_double_arrow", x = "sb_h_double_arrow" }).y
elseif move_mwfact then elseif move_mwfact then
cursor = m({ y = "sb_v_double_arrow", x = "sb_h_double_arrow" }).x CURSOR = m({ y = "sb_v_double_arrow", x = "sb_h_double_arrow" }).x
else else
return false return false
end end
@ -89,7 +89,7 @@ local function mouse_resize_handler(m, c)
c.screen.selected_tag.master_width_factor = math.min(math.max((_mouse.x - wa.x) / wa.width, 0.01), 0.99) c.screen.selected_tag.master_width_factor = math.min(math.max((_mouse.x - wa.x) / wa.width, 0.01), 0.99)
end end
if idx_above then if idx and idx_above then
local factor_delta = (_mouse.y - jump_to.y) / wa.height local factor_delta = (_mouse.y - jump_to.y) / wa.height
if factor_delta < 0 then if factor_delta < 0 then
@ -109,7 +109,7 @@ local function mouse_resize_handler(m, c)
else else
return false return false
end end
end, cursor) end, CURSOR)
return true return true
end end
@ -119,6 +119,7 @@ awful.layout.suit.tile.mouse_resize_handler = function(c)
return x return x
end, c) end, c)
end end
---@diagnostic disable-next-line: duplicate-set-field
awful.layout.suit.tile.bottom.mouse_resize_handler = function(c) awful.layout.suit.tile.bottom.mouse_resize_handler = function(c)
return mouse_resize_handler(function(q) return mouse_resize_handler(function(q)
return { x = q.y, y = q.x, width = q.height, height = q.width } return { x = q.y, y = q.x, width = q.height, height = q.width }

View file

@ -4,18 +4,16 @@ local wibox = require("wibox")
local beautiful = require("beautiful") local beautiful = require("beautiful")
local dpi = beautiful.xresources.apply_dpi local dpi = beautiful.xresources.apply_dpi
local helpers = require("helpers") local helpers = require("helpers")
--local lock_screen = require("modules.lockscreen")
--lock_screen.init()
--- Minimalist Exit Screen --- Minimalist Exit Screen
--- ~~~~~~~~~~~~~~~~~~~~~~ --- ~~~~~~~~~~~~~~~~~~~~~~
--- Icons --- Icons
local icon_font = beautiful.font_name.."bold 45" local icon_font = beautiful.font_name .. "bold 45"
local poweroff_text_icon = "" local poweroff_text_icon = ""
local reboot_text_icon = "" local reboot_text_icon = ""
local suspend_text_icon = "" local suspend_text_icon = ""
local exit_text_icon = "" local exit_text_icon = "󰗼"
local lock_text_icon = "" local lock_text_icon = ""
local button_bg = beautiful.xcolorbase local button_bg = beautiful.xcolorbase
@ -34,7 +32,6 @@ end
local suspend_command = function() local suspend_command = function()
awesome.emit_signal("module::exit_screen:hide") awesome.emit_signal("module::exit_screen:hide")
--lock_screen_show()
awful.spawn.with_shell("systemctl suspend") awful.spawn.with_shell("systemctl suspend")
end end
@ -44,10 +41,9 @@ end
local lock_command = function() local lock_command = function()
awesome.emit_signal("module::exit_screen:hide") awesome.emit_signal("module::exit_screen:hide")
--lock_screen_show()
end end
local create_button = function(symbol, hover_color, text, command) local create_button = function(symbol, hover_color, _, command)
local icon = wibox.widget({ local icon = wibox.widget({
forced_height = button_size, forced_height = button_size,
forced_width = button_size, forced_width = button_size,
@ -154,7 +150,7 @@ end)
local exit_screen_grabber = awful.keygrabber({ local exit_screen_grabber = awful.keygrabber({
auto_start = true, auto_start = true,
stop_event = "release", stop_event = "release",
keypressed_callback = function(self, mod, key, command) keypressed_callback = function(_, _, key, _)
if key == "s" then if key == "s" then
suspend_command() suspend_command()
elseif key == "e" then elseif key == "e" then

View file

@ -1,3 +1,4 @@
require (... .. ".better-resize") require(... .. ".better-resize")
require (... .. ".savefloats") require(... .. ".savefloats")
require (... .. ".exit-screen") require(... .. ".exit-screen")

View file

@ -31,111 +31,103 @@ local json = { _version = "0.1.2" }
local encode local encode
local escape_char_map = { local escape_char_map = {
[ "\\" ] = "\\", ["\\"] = "\\",
[ "\"" ] = "\"", ['"'] = '"',
[ "\b" ] = "b", ["\b"] = "b",
[ "\f" ] = "f", ["\f"] = "f",
[ "\n" ] = "n", ["\n"] = "n",
[ "\r" ] = "r", ["\r"] = "r",
[ "\t" ] = "t", ["\t"] = "t",
} }
local escape_char_map_inv = { [ "/" ] = "/" } local escape_char_map_inv = { ["/"] = "/" }
for k, v in pairs(escape_char_map) do for k, v in pairs(escape_char_map) do
escape_char_map_inv[v] = k escape_char_map_inv[v] = k
end end
local function escape_char(c) local function escape_char(c)
return "\\" .. (escape_char_map[c] or string.format("u%04x", c:byte())) return "\\" .. (escape_char_map[c] or string.format("u%04x", c:byte()))
end end
local function encode_nil(_)
local function encode_nil(val) return "null"
return "null"
end end
local function encode_table(val, stack) local function encode_table(val, stack)
local res = {} local res = {}
stack = stack or {} stack = stack or {}
-- Circular reference? -- Circular reference?
if stack[val] then error("circular reference") end if stack[val] then
error("circular reference")
end
stack[val] = true stack[val] = true
if rawget(val, 1) ~= nil or next(val) == nil then if rawget(val, 1) ~= nil or next(val) == nil then
-- Treat as array -- check keys are valid and it is not sparse -- Treat as array -- check keys are valid and it is not sparse
local n = 0 local n = 0
for k in pairs(val) do for k in pairs(val) do
if type(k) ~= "number" then if type(k) ~= "number" then
error("invalid table: mixed or invalid key types") error("invalid table: mixed or invalid key types")
end end
n = n + 1 n = n + 1
end end
if n ~= #val then if n ~= #val then
error("invalid table: sparse array") error("invalid table: sparse array")
end end
-- Encode -- Encode
for i, v in ipairs(val) do for _, v in ipairs(val) do
table.insert(res, encode(v, stack)) table.insert(res, encode(v, stack))
end end
stack[val] = nil stack[val] = nil
return "[" .. table.concat(res, ",") .. "]" return "[" .. table.concat(res, ",") .. "]"
else
else -- Treat as an object
-- Treat as an object for k, v in pairs(val) do
for k, v in pairs(val) do if type(k) ~= "string" then
if type(k) ~= "string" then error("invalid table: mixed or invalid key types")
error("invalid table: mixed or invalid key types") end
end table.insert(res, encode(k, stack) .. ":" .. encode(v, stack))
table.insert(res, encode(k, stack) .. ":" .. encode(v, stack)) end
end stack[val] = nil
stack[val] = nil return "{" .. table.concat(res, ",") .. "}"
return "{" .. table.concat(res, ",") .. "}" end
end
end end
local function encode_string(val) local function encode_string(val)
return '"' .. val:gsub('[%z\1-\31\\"]', escape_char) .. '"' return '"' .. val:gsub('[%z\1-\31\\"]', escape_char) .. '"'
end end
local function encode_number(val) local function encode_number(val)
-- Check for NaN, -inf and inf -- Check for NaN, -inf and inf
if val ~= val or val <= -math.huge or val >= math.huge then if val ~= val or val <= -math.huge or val >= math.huge then
error("unexpected number value '" .. tostring(val) .. "'") error("unexpected number value '" .. tostring(val) .. "'")
end end
return string.format("%.14g", val) return string.format("%.14g", val)
end end
local type_func_map = { local type_func_map = {
[ "nil" ] = encode_nil, ["nil"] = encode_nil,
[ "table" ] = encode_table, ["table"] = encode_table,
[ "string" ] = encode_string, ["string"] = encode_string,
[ "number" ] = encode_number, ["number"] = encode_number,
[ "boolean" ] = tostring, ["boolean"] = tostring,
} }
encode = function(val, stack) encode = function(val, stack)
local t = type(val) local t = type(val)
local f = type_func_map[t] local f = type_func_map[t]
if f then if f then
return f(val, stack) return f(val, stack)
end end
error("unexpected type '" .. t .. "'") error("unexpected type '" .. t .. "'")
end end
function json.encode(val) function json.encode(val)
return ( encode(val) ) return (encode(val))
end end
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
-- Decode -- Decode
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
@ -143,246 +135,238 @@ end
local parse local parse
local function create_set(...) local function create_set(...)
local res = {} local res = {}
for i = 1, select("#", ...) do for i = 1, select("#", ...) do
res[ select(i, ...) ] = true res[select(i, ...)] = true
end end
return res return res
end end
local space_chars = create_set(" ", "\t", "\r", "\n") local space_chars = create_set(" ", "\t", "\r", "\n")
local delim_chars = create_set(" ", "\t", "\r", "\n", "]", "}", ",") local delim_chars = create_set(" ", "\t", "\r", "\n", "]", "}", ",")
local escape_chars = create_set("\\", "/", '"', "b", "f", "n", "r", "t", "u") local escape_chars = create_set("\\", "/", '"', "b", "f", "n", "r", "t", "u")
local literals = create_set("true", "false", "null") local literals = create_set("true", "false", "null")
local literal_map = { local literal_map = {
[ "true" ] = true, ["true"] = true,
[ "false" ] = false, ["false"] = false,
[ "null" ] = nil, ["null"] = nil,
} }
local function next_char(str, idx, set, negate) local function next_char(str, idx, set, negate)
for i = idx, #str do for i = idx, #str do
if set[str:sub(i, i)] ~= negate then if set[str:sub(i, i)] ~= negate then
return i return i
end end
end end
return #str + 1 return #str + 1
end end
local function decode_error(str, idx, msg) local function decode_error(str, idx, msg)
local line_count = 1 local line_count = 1
local col_count = 1 local col_count = 1
for i = 1, idx - 1 do for i = 1, idx - 1 do
col_count = col_count + 1 col_count = col_count + 1
if str:sub(i, i) == "\n" then if str:sub(i, i) == "\n" then
line_count = line_count + 1 line_count = line_count + 1
col_count = 1 col_count = 1
end end
end end
error( string.format("%s at line %d col %d", msg, line_count, col_count) ) error(string.format("%s at line %d col %d", msg, line_count, col_count))
end end
local function codepoint_to_utf8(n) local function codepoint_to_utf8(n)
-- http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=iws-appendixa -- http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=iws-appendixa
local f = math.floor local f = math.floor
if n <= 0x7f then if n <= 0x7f then
return string.char(n) return string.char(n)
elseif n <= 0x7ff then elseif n <= 0x7ff then
return string.char(f(n / 64) + 192, n % 64 + 128) return string.char(f(n / 64) + 192, n % 64 + 128)
elseif n <= 0xffff then elseif n <= 0xffff then
return string.char(f(n / 4096) + 224, f(n % 4096 / 64) + 128, n % 64 + 128) return string.char(f(n / 4096) + 224, f(n % 4096 / 64) + 128, n % 64 + 128)
elseif n <= 0x10ffff then elseif n <= 0x10ffff then
return string.char(f(n / 262144) + 240, f(n % 262144 / 4096) + 128, return string.char(f(n / 262144) + 240, f(n % 262144 / 4096) + 128, f(n % 4096 / 64) + 128, n % 64 + 128)
f(n % 4096 / 64) + 128, n % 64 + 128) end
end error(string.format("invalid unicode codepoint '%x'", n))
error( string.format("invalid unicode codepoint '%x'", n) )
end end
local function parse_unicode_escape(s) local function parse_unicode_escape(s)
local n1 = tonumber( s:sub(1, 4), 16 ) local n1 = tonumber(s:sub(1, 4), 16)
local n2 = tonumber( s:sub(7, 10), 16 ) local n2 = tonumber(s:sub(7, 10), 16)
-- Surrogate pair? -- Surrogate pair?
if n2 then if n2 then
return codepoint_to_utf8((n1 - 0xd800) * 0x400 + (n2 - 0xdc00) + 0x10000) return codepoint_to_utf8((n1 - 0xd800) * 0x400 + (n2 - 0xdc00) + 0x10000)
else else
return codepoint_to_utf8(n1) return codepoint_to_utf8(n1)
end end
end end
local function parse_string(str, i) local function parse_string(str, i)
local res = "" local res = ""
local j = i + 1 local j = i + 1
local k = j local k = j
while j <= #str do while j <= #str do
local x = str:byte(j) local x = str:byte(j)
if x < 32 then if x < 32 then
decode_error(str, j, "control character in string") decode_error(str, j, "control character in string")
elseif x == 92 then -- `\`: Escape
res = res .. str:sub(k, j - 1)
j = j + 1
local c = str:sub(j, j)
if c == "u" then
local hex = str:match("^[dD][89aAbB]%x%x\\u%x%x%x%x", j + 1)
or str:match("^%x%x%x%x", j + 1)
or decode_error(str, j - 1, "invalid unicode escape in string")
res = res .. parse_unicode_escape(hex)
j = j + #hex
else
if not escape_chars[c] then
decode_error(str, j - 1, "invalid escape char '" .. c .. "' in string")
end
res = res .. escape_char_map_inv[c]
end
k = j + 1
elseif x == 34 then -- `"`: End of string
res = res .. str:sub(k, j - 1)
return res, j + 1
end
elseif x == 92 then -- `\`: Escape j = j + 1
res = res .. str:sub(k, j - 1) end
j = j + 1
local c = str:sub(j, j)
if c == "u" then
local hex = str:match("^[dD][89aAbB]%x%x\\u%x%x%x%x", j + 1)
or str:match("^%x%x%x%x", j + 1)
or decode_error(str, j - 1, "invalid unicode escape in string")
res = res .. parse_unicode_escape(hex)
j = j + #hex
else
if not escape_chars[c] then
decode_error(str, j - 1, "invalid escape char '" .. c .. "' in string")
end
res = res .. escape_char_map_inv[c]
end
k = j + 1
elseif x == 34 then -- `"`: End of string decode_error(str, i, "expected closing quote for string")
res = res .. str:sub(k, j - 1)
return res, j + 1
end
j = j + 1
end
decode_error(str, i, "expected closing quote for string")
end end
local function parse_number(str, i) local function parse_number(str, i)
local x = next_char(str, i, delim_chars) local x = next_char(str, i, delim_chars)
local s = str:sub(i, x - 1) local s = str:sub(i, x - 1)
local n = tonumber(s) local n = tonumber(s)
if not n then if not n then
decode_error(str, i, "invalid number '" .. s .. "'") decode_error(str, i, "invalid number '" .. s .. "'")
end end
return n, x return n, x
end end
local function parse_literal(str, i) local function parse_literal(str, i)
local x = next_char(str, i, delim_chars) local x = next_char(str, i, delim_chars)
local word = str:sub(i, x - 1) local word = str:sub(i, x - 1)
if not literals[word] then if not literals[word] then
decode_error(str, i, "invalid literal '" .. word .. "'") decode_error(str, i, "invalid literal '" .. word .. "'")
end end
return literal_map[word], x return literal_map[word], x
end end
local function parse_array(str, i) local function parse_array(str, i)
local res = {} local res = {}
local n = 1 local n = 1
i = i + 1 i = i + 1
while 1 do while 1 do
local x local x
i = next_char(str, i, space_chars, true) i = next_char(str, i, space_chars, true)
-- Empty / end of array? -- Empty / end of array?
if str:sub(i, i) == "]" then if str:sub(i, i) == "]" then
i = i + 1 i = i + 1
break break
end end
-- Read token -- Read token
x, i = parse(str, i) x, i = parse(str, i)
res[n] = x res[n] = x
n = n + 1 n = n + 1
-- Next token -- Next token
i = next_char(str, i, space_chars, true) i = next_char(str, i, space_chars, true)
local chr = str:sub(i, i) local chr = str:sub(i, i)
i = i + 1 i = i + 1
if chr == "]" then break end if chr == "]" then
if chr ~= "," then decode_error(str, i, "expected ']' or ','") end break
end end
return res, i if chr ~= "," then
decode_error(str, i, "expected ']' or ','")
end
end
return res, i
end end
local function parse_object(str, i) local function parse_object(str, i)
local res = {} local res = {}
i = i + 1 i = i + 1
while 1 do while 1 do
local key, val local key, val
i = next_char(str, i, space_chars, true) i = next_char(str, i, space_chars, true)
-- Empty / end of object? -- Empty / end of object?
if str:sub(i, i) == "}" then if str:sub(i, i) == "}" then
i = i + 1 i = i + 1
break break
end end
-- Read key -- Read key
if str:sub(i, i) ~= '"' then if str:sub(i, i) ~= '"' then
decode_error(str, i, "expected string for key") decode_error(str, i, "expected string for key")
end end
key, i = parse(str, i) key, i = parse(str, i)
-- Read ':' delimiter -- Read ':' delimiter
i = next_char(str, i, space_chars, true) i = next_char(str, i, space_chars, true)
if str:sub(i, i) ~= ":" then if str:sub(i, i) ~= ":" then
decode_error(str, i, "expected ':' after key") decode_error(str, i, "expected ':' after key")
end end
i = next_char(str, i + 1, space_chars, true) i = next_char(str, i + 1, space_chars, true)
-- Read value -- Read value
val, i = parse(str, i) val, i = parse(str, i)
-- Set -- Set
res[key] = val res[key] = val
-- Next token -- Next token
i = next_char(str, i, space_chars, true) i = next_char(str, i, space_chars, true)
local chr = str:sub(i, i) local chr = str:sub(i, i)
i = i + 1 i = i + 1
if chr == "}" then break end if chr == "}" then
if chr ~= "," then decode_error(str, i, "expected '}' or ','") end break
end end
return res, i if chr ~= "," then
decode_error(str, i, "expected '}' or ','")
end
end
return res, i
end end
local char_func_map = { local char_func_map = {
[ '"' ] = parse_string, ['"'] = parse_string,
[ "0" ] = parse_number, ["0"] = parse_number,
[ "1" ] = parse_number, ["1"] = parse_number,
[ "2" ] = parse_number, ["2"] = parse_number,
[ "3" ] = parse_number, ["3"] = parse_number,
[ "4" ] = parse_number, ["4"] = parse_number,
[ "5" ] = parse_number, ["5"] = parse_number,
[ "6" ] = parse_number, ["6"] = parse_number,
[ "7" ] = parse_number, ["7"] = parse_number,
[ "8" ] = parse_number, ["8"] = parse_number,
[ "9" ] = parse_number, ["9"] = parse_number,
[ "-" ] = parse_number, ["-"] = parse_number,
[ "t" ] = parse_literal, ["t"] = parse_literal,
[ "f" ] = parse_literal, ["f"] = parse_literal,
[ "n" ] = parse_literal, ["n"] = parse_literal,
[ "[" ] = parse_array, ["["] = parse_array,
[ "{" ] = parse_object, ["{"] = parse_object,
} }
parse = function(str, idx) parse = function(str, idx)
local chr = str:sub(idx, idx) local chr = str:sub(idx, idx)
local f = char_func_map[chr] local f = char_func_map[chr]
if f then if f then
return f(str, idx) return f(str, idx)
end end
decode_error(str, idx, "unexpected character '" .. chr .. "'") decode_error(str, idx, "unexpected character '" .. chr .. "'")
end end
function json.decode(str) function json.decode(str)
if type(str) ~= "string" then if type(str) ~= "string" then
error("expected argument of type string, got " .. type(str)) error("expected argument of type string, got " .. type(str))
end end
local res, idx = parse(str, next_char(str, 1, space_chars, true)) local res, idx = parse(str, next_char(str, 1, space_chars, true))
idx = next_char(str, idx, space_chars, true) idx = next_char(str, idx, space_chars, true)
if idx <= #str then if idx <= #str then
decode_error(str, idx, "trailing garbage") decode_error(str, idx, "trailing garbage")
end end
return res return res
end end
return json return json

View file

@ -9,13 +9,13 @@ local function rel(screen, win)
} }
end end
local function unrel(s, rel) local function unrel(s, _rel)
return rel return _rel
and { and {
x = s.x + s.width * rel.x, x = s.x + s.width * _rel.x,
y = s.y + s.height * rel.y, y = s.y + s.height * _rel.y,
width = s.width * rel.width, width = s.width * _rel.width,
height = rel.aspect * s.width * rel.width, height = _rel.aspect * s.width * _rel.width,
} }
end end
@ -27,13 +27,13 @@ end
local floating = awful.layout.suit.floating local floating = awful.layout.suit.floating
function remember(c) function Remember(c)
if floating == awful.layout.get(c.screen) or c.floating then if floating == awful.layout.get(c.screen) or c.floating then
stored[c.window] = rel(c.screen.geometry, c:geometry()) stored[c.window] = rel(c.screen.geometry, c:geometry())
end end
end end
function restore(c) function Restore(c)
local s = stored[c.window] local s = stored[c.window]
if s then if s then
c:geometry(unrel(c.screen.geometry, stored[c.window])) c:geometry(unrel(c.screen.geometry, stored[c.window]))
@ -43,8 +43,8 @@ function restore(c)
end end
end end
client.connect_signal("manage", remember) client.connect_signal("manage", Remember)
client.connect_signal("property::geometry", remember) client.connect_signal("property::geometry", Remember)
client.connect_signal("unmanage", forget) client.connect_signal("unmanage", forget)
tag.connect_signal("property::layout", function(t) tag.connect_signal("property::layout", function(t)
@ -55,4 +55,4 @@ tag.connect_signal("property::layout", function(t)
end end
end) end)
return restore return Restore

View file

@ -1,256 +1,246 @@
local awful = require "awful" local awful = require("awful")
local gears = require "gears"
local naughty = require "naughty"
local beautiful = require "beautiful"
local hotkeys_popup = require("awful.hotkeys_popup") local hotkeys_popup = require("awful.hotkeys_popup")
local menubar = require "menubar" local menubar = require("menubar")
local machi = require "lib.layout-machi" local machi = require("lib.layout-machi")
local menu = require "main.menu" local menu = require("main.menu")
local apps = require "main.apps" local config = require("config")
local promptbox = require "ui.top-panel.widgets.promptbox" local apps = config.apps
local keys = config.keys
modkey = "Mod4"
-- General awesome keybindings -- General awesome keybindings
awful.keyboard.append_global_keybindings({ awful.keyboard.append_global_keybindings({
awful.key({ modkey, "Control" }, "r", awesome.restart, awful.key({ keys.mod, "Control" }, "r", awesome.restart, { description = "reload awesome", group = "awesome" }),
{description = "reload awesome", group = "awesome"}), awful.key({ keys.mod, "Shift" }, "q", awesome.quit, { description = "quit awesome", group = "awesome" }),
awful.key({ modkey, "Shift" }, "q", awesome.quit, awful.key({}, "Nothing Set", function()
{description = "quit awesome", group = "awesome"}), awful.prompt.run({
--awful.key({ modkey }, "j", prompt = "Run Lua code: ",
awful.key({ }, "Nothing Set", textbox = awful.screen.focused().promptbox.widget,
function () exe_callback = awful.util.eval,
awful.prompt.run { history_path = awful.util.get_cache_dir() .. "/history_eval",
prompt = "Run Lua code: ", })
textbox = awful.screen.focused().promptbox.widget, end, { description = "lua execute prompt", group = "awesome" }),
exe_callback = awful.util.eval, awful.key({ keys.mod }, "Return", function()
history_path = awful.util.get_cache_dir() .. "/history_eval" awful.spawn(apps.terminal)
} end, { description = "open a terminal", group = "launcher" }),
end, awful.key({ keys.mod, "Shift" }, "c", function()
{description = "lua execute prompt", group = "awesome"}), menu.mainmenu:show()
awful.key({ modkey, }, "Return", function () awful.spawn(apps.terminal) end, end, { description = "show main menu", group = "awesome" }),
{description = "open a terminal", group = "launcher"}), awful.key({ keys.mod }, "p", function()
awful.key({ modkey, "Shift" }, "c", function() menu.mainmenu:show() end, menubar.show()
{description = "show main menu", group = "awesome"}), end, { description = "show the menubar", group = "launcher" }),
awful.key({ modkey }, "p", function() menubar.show() end,
{description = "show the menubar", group = "launcher"}),
}) })
-- Tag bindings -- Tag bindings
awful.keyboard.append_global_keybindings({ awful.keyboard.append_global_keybindings({
awful.key({ modkey, "Control" }, "s", hotkeys_popup.show_help, awful.key({ keys.mod, "Control" }, "s", hotkeys_popup.show_help, { description = "show help", group = "awesome" }),
{description = "show help", group = "awesome"}), awful.key({ keys.mod }, "Left", awful.tag.viewprev, { description = "view previous", group = "tag" }),
awful.key({ modkey, }, "Left", awful.tag.viewprev, awful.key({ keys.mod }, "Right", awful.tag.viewnext, { description = "view next", group = "tag" }),
{description = "view previous", group = "tag"}), awful.key({ keys.mod }, "Tab", awful.tag.history.restore, { description = "go back", group = "tag" }),
awful.key({ modkey, }, "Right", awful.tag.viewnext,
{description = "view next", group = "tag"}),
awful.key({ modkey, }, "Tab", awful.tag.history.restore,
{description = "go back", group = "tag"}),
}) })
awful.keyboard.append_global_keybindings({ awful.keyboard.append_global_keybindings({
awful.key { awful.key({
modifiers = { modkey }, modifiers = { keys.mod },
keygroup = "numrow", keygroup = "numrow",
description = "only view tag", description = "only view tag",
group = "tag", group = "tag",
on_press = function (index) on_press = function(index)
local screen = awful.screen.focused() local screen = awful.screen.focused()
local tag = screen.tags[index] local tag = screen.tags[index]
if tag then if tag then
tag:view_only() tag:view_only()
end end
end, end,
}, }),
awful.key { awful.key({
modifiers = { modkey, "Control" }, modifiers = { keys.mod, "Control" },
keygroup = "numrow", keygroup = "numrow",
description = "toggle tag", description = "toggle tag",
group = "tag", group = "tag",
on_press = function (index) on_press = function(index)
local screen = awful.screen.focused() local screen = awful.screen.focused()
local tag = screen.tags[index] local tag = screen.tags[index]
if tag then if tag then
awful.tag.viewtoggle(tag) awful.tag.viewtoggle(tag)
end end
end, end,
}, }),
awful.key { awful.key({
modifiers = { modkey, "Shift" }, modifiers = { keys.mod, "Shift" },
keygroup = "numrow", keygroup = "numrow",
description = "move focused client to tag", description = "move focused client to tag",
group = "tag", group = "tag",
on_press = function (index) on_press = function(index)
if client.focus then if client.focus then
local tag = client.focus.screen.tags[index] local tag = client.focus.screen.tags[index]
if tag then if tag then
client.focus:move_to_tag(tag) client.focus:move_to_tag(tag)
end end
end end
end, end,
}, }),
awful.key { awful.key({
modifiers = { modkey, "Control", "Shift" }, modifiers = { keys.mod, "Control", "Shift" },
keygroup = "numrow", keygroup = "numrow",
description = "toggle focused client on tag", description = "toggle focused client on tag",
group = "tag", group = "tag",
on_press = function (index) on_press = function(index)
if client.focus then if client.focus then
local tag = client.focus.screen.tags[index] local tag = client.focus.screen.tags[index]
if tag then if tag then
client.focus:toggle_tag(tag) client.focus:toggle_tag(tag)
end end
end end
end, end,
}, }),
awful.key { awful.key({
modifiers = { modkey }, modifiers = { keys.mod },
keygroup = "numpad", keygroup = "numpad",
description = "select layout directly", description = "select layout directly",
group = "layout", group = "layout",
on_press = function (index) on_press = function(index)
local t = awful.screen.focused().selected_tag local t = awful.screen.focused().selected_tag
if t then if t then
t.layout = t.layouts[index] or t.layout t.layout = t.layouts[index] or t.layout
end end
end, end,
} }),
}) })
-- Focus bindings -- Focus bindings
awful.keyboard.append_global_keybindings({ awful.keyboard.append_global_keybindings({
awful.key({ modkey, }, "c", awful.key({ keys.mod }, "c", function()
function () awful.client.focus.byidx(1)
awful.client.focus.byidx( 1) end, { description = "focus next by index", group = "client" }),
end, awful.key({ keys.mod }, "x", function()
{description = "focus next by index", group = "client"} awful.client.focus.byidx(-1)
), end, { description = "focus previous by index", group = "client" }),
awful.key({ modkey, }, "x", awful.key({ keys.mod }, "Escape", function()
function () awful.client.focus.history.previous()
awful.client.focus.byidx(-1) if client.focus then
end, client.focus:raise()
{description = "focus previous by index", group = "client"} end
), end, { description = "go back", group = "client" }),
awful.key({ modkey, }, "Escape", awful.key({ keys.mod, "Control" }, "j", function()
function () awful.screen.focus_relative(1)
awful.client.focus.history.previous() end, { description = "focus the next screen", group = "screen" }),
if client.focus then awful.key({ keys.mod, "Control" }, "k", function()
client.focus:raise() awful.screen.focus_relative(-1)
end end, { description = "focus the previous screen", group = "screen" }),
end, awful.key({ keys.mod, "Control" }, "n", function()
{description = "go back", group = "client"}), local c = awful.client.restore()
awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end, -- Focus restored client
{description = "focus the next screen", group = "screen"}), if c then
awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end, c:activate({ raise = true, context = "key.unminimize" })
{description = "focus the previous screen", group = "screen"}), end
awful.key({ modkey, "Control" }, "n", end, { description = "restore minimized", group = "client" }),
function ()
local c = awful.client.restore()
-- Focus restored client
if c then
c:activate { raise = true, context = "key.unminimize" }
end
end,
{description = "restore minimized", group = "client"}),
}) })
-- Layout bindings -- Layout bindings
awful.keyboard.append_global_keybindings({ awful.keyboard.append_global_keybindings({
awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end, awful.key({ keys.mod, "Shift" }, "j", function()
{description = "swap with next client by index", group = "client"}), awful.client.swap.byidx(1)
awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end, end, { description = "swap with next client by index", group = "client" }),
{description = "swap with previous client by index", group = "client"}), awful.key({ keys.mod, "Shift" }, "k", function()
awful.key({ modkey, }, "u", awful.client.urgent.jumpto, awful.client.swap.byidx(-1)
{description = "jump to urgent client", group = "client"}), end, { description = "swap with previous client by index", group = "client" }),
awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end, awful.key(
{description = "increase master width factor", group = "layout"}), { keys.mod },
awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end, "u",
{description = "decrease master width factor", group = "layout"}), awful.client.urgent.jumpto,
awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1, nil, true) end, { description = "jump to urgent client", group = "client" }
{description = "increase the number of master clients", group = "layout"}), ),
awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1, nil, true) end, awful.key({ keys.mod }, "l", function()
{description = "decrease the number of master clients", group = "layout"}), awful.tag.incmwfact(0.05)
awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1, nil, true) end, end, { description = "increase master width factor", group = "layout" }),
{description = "increase the number of columns", group = "layout"}), awful.key({ keys.mod }, "h", function()
awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1, nil, true) end, awful.tag.incmwfact(-0.05)
{description = "decrease the number of columns", group = "layout"}), end, { description = "decrease master width factor", group = "layout" }),
-- awful.key({ modkey, }, "space", function () awful.layout.inc( 1) end, awful.key({ keys.mod, "Shift" }, "h", function()
-- {description = "select next", group = "layout"}), awful.tag.incnmaster(1, nil, true)
-- awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(-1) end, end, { description = "increase the number of master clients", group = "layout" }),
-- {description = "select previous", group = "layout"}), awful.key({ keys.mod, "Shift" }, "l", function()
awful.key({ modkey, }, "-", function () machi.default_editor.start_interactive() end, awful.tag.incnmaster(-1, nil, true)
{description = "edit the current layout if it is a machi layout", group = "layout"}), end, { description = "decrease the number of master clients", group = "layout" }),
awful.key({ modkey, }, ".", function () machi.switcher.start(client.focus) end, awful.key({ keys.mod, "Control" }, "h", function()
{description = "switch between windows for a machi layout", group = "layout"}), awful.tag.incncol(1, nil, true)
end, { description = "increase the number of columns", group = "layout" }),
awful.key({ keys.mod, "Control" }, "l", function()
awful.tag.incncol(-1, nil, true)
end, { description = "decrease the number of columns", group = "layout" }),
awful.key({ keys.mod }, "-", function()
machi.default_editor.start_interactive()
end, { description = "edit the current layout if it is a machi layout", group = "layout" }),
awful.key({ keys.mod }, ".", function()
machi.switcher.start(client.focus)
end, { description = "switch between windows for a machi layout", group = "layout" }),
}) })
-- Client bindings -- Client bindings
client.connect_signal("request::default_keybindings", function() client.connect_signal("request::default_keybindings", function()
awful.keyboard.append_client_keybindings({ awful.keyboard.append_client_keybindings({
awful.key({ modkey, }, "f", awful.key({ keys.mod }, "f", function(c)
function (c) c.fullscreen = not c.fullscreen
c.fullscreen = not c.fullscreen c:raise()
c:raise() end, { description = "toggle fullscreen", group = "client" }),
end, awful.key({ keys.mod }, "w", function(c)
{description = "toggle fullscreen", group = "client"}), c:kill()
awful.key({ modkey }, "w", function (c) c:kill() end, end, { description = "close", group = "client" }),
{description = "close", group = "client"}), awful.key(
awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle , { keys.mod, "Control" },
{description = "toggle floating", group = "client"}), "space",
awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end, awful.client.floating.toggle,
{description = "move to master", group = "client"}), { description = "toggle floating", group = "client" }
awful.key({ modkey, }, "o", function (c) c:move_to_screen() end, ),
{description = "move to screen", group = "client"}), awful.key({ keys.mod, "Control" }, "Return", function(c)
awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end, c:swap(awful.client.getmaster())
{description = "toggle keep on top", group = "client"}), end, { description = "move to master", group = "client" }),
awful.key({ modkey, }, "n", awful.key({ keys.mod }, "o", function(c)
function (c) c:move_to_screen()
-- The client currently has the input focus, so it cannot be end, { description = "move to screen", group = "client" }),
-- minimized, since minimized clients can't have the focus. awful.key({ keys.mod }, "t", function(c)
c.minimized = true c.ontop = not c.ontop
end , end, { description = "toggle keep on top", group = "client" }),
{description = "minimize", group = "client"}), awful.key({ keys.mod }, "n", function(c)
awful.key({ modkey, }, "m", -- The client currently has the input focus, so it cannot be
function (c) -- minimized, since minimized clients can't have the focus.
c.maximized = not c.maximized c.minimized = true
c:raise() end, { description = "minimize", group = "client" }),
end , awful.key({ keys.mod }, "m", function(c)
{description = "(un)maximize", group = "client"}), c.maximized = not c.maximized
awful.key({ modkey, "Control" }, "m", c:raise()
function (c) end, { description = "(un)maximize", group = "client" }),
c.maximized_vertical = not c.maximized_vertical awful.key({ keys.mod, "Control" }, "m", function(c)
c:raise() c.maximized_vertical = not c.maximized_vertical
end , c:raise()
{description = "(un)maximize vertically", group = "client"}), end, { description = "(un)maximize vertically", group = "client" }),
awful.key({ modkey, "Shift" }, "m", awful.key({ keys.mod, "Shift" }, "m", function(c)
function (c) c.maximized_horizontal = not c.maximized_horizontal
c.maximized_horizontal = not c.maximized_horizontal c:raise()
c:raise() end, { description = "(un)maximize horizontally", group = "client" }),
end , })
{description = "(un)maximize horizontally", group = "client"}),
})
end) end)
-- Mouse bindings -- Mouse bindings
awful.mouse.append_global_mousebindings({ awful.mouse.append_global_mousebindings({
awful.button({ }, 3, function () menu.mainmenu:toggle() return end), awful.button({}, 3, function()
awful.button({ }, 4, awful.tag.viewprev), menu.mainmenu:toggle()
awful.button({ }, 5, awful.tag.viewnext), end),
awful.button({}, 4, awful.tag.viewprev),
awful.button({}, 5, awful.tag.viewnext),
}) })
client.connect_signal("request::default_mousebindings", function() client.connect_signal("request::default_mousebindings", function()
awful.mouse.append_client_mousebindings({ awful.mouse.append_client_mousebindings({
awful.button({ }, 1, function (c) awful.button({}, 1, function(c)
c:activate { context = "mouse_click" } c:activate({ context = "mouse_click" })
end), end),
awful.button({ modkey }, 1, function (c) awful.button({ keys.mod }, 1, function(c)
c:activate { context = "mouse_click", action = "mouse_move"} c:activate({ context = "mouse_click", action = "mouse_move" })
end), end),
awful.button({ modkey }, 3, function (c) awful.button({ keys.mod }, 3, function(c)
c:activate { context = "mouse_click", action = "mouse_resize"} c:activate({ context = "mouse_click", action = "mouse_resize" })
end), end),
}) })
end) end)

View file

@ -1,81 +1,53 @@
local awful = require "awful" local awful = require("awful")
local gears = require "gears" local volume = require("ui.popups.volume")
local naughty = require "naughty" local filesystem = require("gears.filesystem")
local beautiful = require "beautiful"
local apps = require "main.apps"
local volume = require "ui.popups.volume"
local filesystem = require "gears.filesystem"
local config_dir = filesystem.get_configuration_dir() local config_dir = filesystem.get_configuration_dir()
local utils_dir = config_dir .. "utilities/" local utils_dir = config_dir .. "utilities/"
modkey = "Mod4" local keys = require("config").keys
alt = "Mod1"
--local function delete_tag()
-- local t = awful.tag.find_by_name(awful.screen.focused(), "")
-- t:delete()
--end
--local function create_tag()
-- awful.tag.add("", {
-- layout = awful.layout.suit.tile,
-- selected = true,
-- })
--end
--local value = false
local screenshot_area = utils_dir .. "screensht area" local screenshot_area = utils_dir .. "screensht area"
local screenshot_full = utils_dir .. "screensht full" local screenshot_full = utils_dir .. "screensht full"
awful.keyboard.append_global_keybindings({ awful.keyboard.append_global_keybindings({
awful.key({modkey}, "r", function() awful.spawn("rofi -show drun -theme ~/.config/rofi/launcher.rasi") end, awful.key({ keys.mod }, "r", function()
{ description = "show rofi", group = "launcher" }), awful.spawn("rofi -show drun -theme ~/.config/rofi/launcher.rasi")
awful.key({modkey}, "Print", function() end, { description = "show rofi", group = "launcher" }),
awful.key({ keys.mod }, "Print", function()
awful.spawn.easy_async_with_shell(screenshot_area, function() end) awful.spawn.easy_async_with_shell(screenshot_area, function() end)
end, { description = "take a area screenshot", group = "Utils" }), end, { description = "take a area screenshot", group = "Utils" }),
awful.key({ }, "Print", function() awful.key({}, "Print", function()
awful.spawn.easy_async_with_shell(screenshot_full, function() end) awful.spawn.easy_async_with_shell(screenshot_full, function() end)
end, { description = "take a full screenshot", group = "Utils" }), end, { description = "take a full screenshot", group = "Utils" }),
awful.key({modkey}, "q", function() awesome.emit_signal("module::exit_screen:show") end, awful.key({ keys.mod }, "q", function()
{ description = "show Exit Screen", group = "Utils" }), awesome.emit_signal("module::exit_screen:show")
awful.key({modkey}, "s", function() end, { description = "show Exit Screen", group = "Utils" }),
awful.key({ keys.mod }, "s", function()
--if value == false then awesome.emit_signal("scratchpad::toggle")
-- create_tag() end, { description = "show Scratchpad", group = "Utils" }),
-- value = true awful.key({ keys.mod }, "b", function()
--else
-- delete_tag()
-- value = false
--end
awesome.emit_signal("scratchpad::toggle") end,
{ description = "show Scratchpad", group = "Utils" }),
awful.key({modkey}, "b", function()
awful.spawn.easy_async_with_shell("headsetcontrol -l 0", function() end) awful.spawn.easy_async_with_shell("headsetcontrol -l 0", function() end)
end, { description = "headsetcontrol", group = "Utils" }), end, { description = "headsetcontrol", group = "Utils" }),
-- awful.key({modkey}, "r", function() awful.spawn(apps.launcher, false) end), -- Rofi awful.key({ keys.mod }, "t", function()
-- awful.key({alt}, "c", function() awesome.emit_signal("sidebar::toggle") end), -- Sidebar awful.titlebar.toggle(client.focus)
awful.key({modkey}, "t", function() awful.titlebar.toggle(client.focus) end, end, { description = "toggle titlebar for active client", group = "Utils" }), -- Toggle titlebar
{ description = "toggle titlebar for active client", group = "Utils" }), -- Toggle titlebar
-- awful.key({alt}, "x", function() awesome.emit_signal("lockscreen::toggle") end), -- Toggle lockscreen
}) })
-- Volume -- Volume
awful.keyboard.append_global_keybindings({ awful.keyboard.append_global_keybindings({
awful.key({ }, "XF86AudioRaiseVolume", function() awful.key({}, "XF86AudioRaiseVolume", function()
volume.increase() volume.increase()
awesome.emit_signal("widget::update_vol") awesome.emit_signal("widget::update_vol")
awesome.emit_signal("module::volume_osd:show", true) awesome.emit_signal("module::volume_osd:show", true)
end), end),
awful.key({ }, "XF86AudioLowerVolume", function() awful.key({}, "XF86AudioLowerVolume", function()
volume.decrease() volume.decrease()
awesome.emit_signal("widget::update_vol") awesome.emit_signal("widget::update_vol")
awesome.emit_signal("module::volume_osd:show", true) awesome.emit_signal("module::volume_osd:show", true)
end), end),
awful.key({ }, "XF86AudioMute", function() volume.mute() awesome.emit_signal("widget::update_vol") awesome.emit_signal("module::volume_osd:show", true) end) awful.key({}, "XF86AudioMute", function()
volume.mute()
awesome.emit_signal("widget::update_vol")
awesome.emit_signal("module::volume_osd:show", true)
end),
}) })
-- Brightness
--awful.keyboard.append_global_keybindings({
-- awful.key({ }, "XF86MonBrightnessUp", function() brightness.increase() end),
-- awful.key({ }, "XF86MonBrightnessDown", function() brightness.decrease() end)
--})

View file

@ -1,26 +1,31 @@
local naughty = require "naughty" local naughty = require("naughty")
-- {{{ Error handling -- Error handling
-- Check if awesome encountered an error during startup and fell back to -- Check if awesome encountered an error during startup and fell back to
-- another config (This code will only ever execute for the fallback config) -- another config (This code will only ever execute for the fallback config)
if awesome.startup_errors then if awesome.startup_errors then
naughty.notify({ preset = naughty.config.presets.critical, naughty.notify({
title = "Oops, there were errors during startup!", preset = naughty.config.presets.critical,
text = awesome.startup_errors }) title = "Oops, there were errors during startup!",
text = awesome.startup_errors,
})
end end
-- Handle runtime errors after startup -- Handle runtime errors after startup
do do
local in_error = false local in_error = false
awesome.connect_signal("debug::error", function (err) awesome.connect_signal("debug::error", function(err)
-- Make sure we don't go into an endless error loop -- Make sure we don't go into an endless error loop
if in_error then return end if in_error then
in_error = true return
end
in_error = true
naughty.notify({ preset = naughty.config.presets.critical, naughty.notify({
title = "Oops, an error happened!", preset = naughty.config.presets.critical,
text = tostring(err) }) title = "Oops, an error happened!",
in_error = false text = tostring(err),
end) })
in_error = false
end)
end end
--- }}}

View file

@ -1,8 +1,8 @@
--require "main.error_handling" -- require("main.error_handling")
require "main.layout" require("main.layout")
require "main.menu" require("main.menu")
require "main.wallpaper" require("main.wallpaper")
require "main.bindings" require("main.bindings")
require "main.custom_bindings" require("main.custom_bindings")
require "main.rules" require("main.rules")
require "main.tags" require("main.tags")

View file

@ -1,9 +1,6 @@
local awful = require "awful" local awful = require("awful")
local gears = require "gears" local bling = require("lib.bling")
local beautiful = require "beautiful" local machi = require("lib.layout-machi")
local bling = require "lib.bling"
local machi = require "lib.layout-machi"
-- Custom Layouts -- Custom Layouts
local mstab = bling.layout.mstab local mstab = bling.layout.mstab
@ -12,46 +9,28 @@ local equal = bling.layout.equalarea
local deck = bling.layout.deck local deck = bling.layout.deck
machi.editor.nested_layouts = { machi.editor.nested_layouts = {
["0"] = deck, ["0"] = deck,
["1"] = awful.layout.suit.spiral, ["1"] = awful.layout.suit.spiral,
["2"] = awful.layout.suit.fair, ["2"] = awful.layout.suit.fair,
["3"] = awful.layout.suit.fair.horizontal, ["3"] = awful.layout.suit.fair.horizontal,
} }
-- Table of layouts to cover with awful.layout.inc, order matters. -- Table of layouts to cover with awful.layout.inc, order matters.
awful.layout.layouts = { awful.layout.layouts = {
awful.layout.suit.tile, awful.layout.suit.tile,
awful.layout.suit.spiral.dwindle, awful.layout.suit.spiral.dwindle,
awful.layout.suit.floating, awful.layout.suit.floating,
awful.layout.suit.max, awful.layout.suit.max,
centered, centered,
mstab, mstab,
equal, equal,
machi.default_layout, machi.default_layout,
-- awful.layout.suit.floating,
-- awful.layout.suit.tile,
--awful.layout.suit.tile.left,
-- awful.layout.suit.tile.bottom,
-- awful.layout.suit.tile.top,
-- awful.layout.suit.fair,
-- awful.layout.suit.fair.horizontal,
-- awful.layout.suit.spiral,
-- awful.layout.suit.spiral.dwindle,
-- awful.layout.suit.max,
--awful.layout.suit.max.fullscreen,
-- awful.layout.suit.magnifier,
-- awful.layout.suit.corner.nw,
-- awful.layout.suit.corner.ne,
-- awful.layout.suit.corner.sw,
-- awful.layout.suit.corner.se,
} }
client.connect_signal("manage", function (c) client.connect_signal("manage", function(c)
if awesome.startup if awesome.startup and not c.size_hints.user_position and not c.size_hints.program_position then
and not c.size_hints.user_position -- Prevent clients from being unreachable after screen count changes.
and not c.size_hints.program_position then awful.placement.no_offscreen(c)
-- Prevent clients from being unreachable after screen count changes. end
awful.placement.no_offscreen(c) end)
end
end)

View file

@ -1,79 +1,108 @@
---@diagnostic disable: undefined-global ---@diagnostic disable: undefined-global
local awful = require 'awful' local awful = require("awful")
local beautiful = require 'beautiful' local beautiful = require("beautiful")
local gears = require 'gears' local gears = require("gears")
local wibox = require 'wibox' local wibox = require("wibox")
local helpers = require 'helpers' local helpers = require("helpers")
local hotkeys_popup = require 'awful.hotkeys_popup' local hotkeys_popup = require("awful.hotkeys_popup")
local apps = require "main.apps"
editor = os.getenv("EDITOR") or "vim" local apps = require("config").apps
editor_cmd = apps.terminal .. " -e " .. editor
local menu = {} local menu = {}
local rofi = {} local rofi = {}
rofi.timer = gears.timer { rofi.timer = gears.timer({
autostart = false, autostart = false,
timeout = 0.1, timeout = 0.1,
single_shot = true, single_shot = true,
callback = function() callback = function()
awful.spawn("rofi -show drun -theme ~/.config/rofi/launcher.rasi") awful.spawn("rofi -show drun -theme ~/.config/rofi/launcher.rasi")
end end,
} })
menu.awesome = { menu.awesome = {
{ "Hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end }, {
"Hotkeys",
function()
hotkeys_popup.show_help(nil, awful.screen.focused())
end,
},
{ "Manual", apps.terminal .. " -e man awesome" }, { "Manual", apps.terminal .. " -e man awesome" },
{ "Edit Config", editor_cmd .. " " .. awesome.conffile }, { "Edit Config", apps.start_editor .. " " .. awesome.conffile },
{ "Restart", awesome.restart }, { "Restart", awesome.restart },
{ "Quit", function() awesome.quit() end }, {
} "Quit",
function()
menu.mainmenu = awful.menu { awesome.quit()
items = { end,
{ "Applications", function() menu.mainmenu:hide() rofi.timer:start() end }, },
{ "Terminal", apps.terminal },
{ "Web Browser", apps.browser },
{ "File Manager", apps.file_manager },
{ "Text Editor", apps.code_editor },
{ "Music Player", apps.music_player },
{ "Info Panel", function() awesome.emit_signal("sidebar::toggle") end },
{ "Notifications", function() awesome.emit_signal("action::toggle") end },
{ "Exit", function() awesome.emit_signal("module::exit_screen:show") end },
{ "AwesomeWM", menu.awesome },
}
} }
menu.mainmenu = awful.menu({
items = {
{
"Applications",
function()
menu.mainmenu:hide()
rofi.timer:start()
end,
},
{ "Terminal", apps.terminal },
{ "Web Browser", apps.browser },
{ "File Manager", apps.file_manager },
{ "Text Editor", apps.code_editor },
{ "Music Player", apps.music_player },
{
"Info Panel",
function()
awesome.emit_signal("sidebar::toggle")
end,
},
{
"Notifications",
function()
awesome.emit_signal("action::toggle")
end,
},
{
"Exit",
function()
awesome.emit_signal("module::exit_screen:show")
end,
},
{ "AwesomeWM", menu.awesome },
},
})
-- apply rounded corners to menus when picom isn't available, thanks to u/signalsourcesexy -- apply rounded corners to menus when picom isn't available, thanks to u/signalsourcesexy
-- also applies antialiasing! - By me. -- also applies antialiasing! - By me.
menu.mainmenu.wibox.shape = helpers.ui.rrect(10) menu.mainmenu.wibox.shape = helpers.ui.rrect(10)
menu.mainmenu.wibox.bg = beautiful.bg_normal .. '00' menu.mainmenu.wibox.bg = beautiful.bg_normal .. "00"
menu.mainmenu.wibox:set_widget(wibox.widget({ menu.mainmenu.wibox:set_widget(wibox.widget({
menu.mainmenu.wibox.widget, menu.mainmenu.wibox.widget,
bg = beautiful.bg_normal, bg = beautiful.bg_normal,
shape = helpers.ui.rrect(0), shape = helpers.ui.rrect(0),
widget = wibox.container.background, widget = wibox.container.background,
})) }))
-- apply rounded corners to submenus, thanks to u/signalsourcesexy -- apply rounded corners to submenus, thanks to u/signalsourcesexy
-- also applies antialiasing! - By me. -- also applies antialiasing! - By me.
awful.menu.original_new = awful.menu.new awful.menu.original_new = awful.menu.new
---@diagnostic disable-next-line: duplicate-set-field
function awful.menu.new(...) function awful.menu.new(...)
local ret = awful.menu.original_new(...) local ret = awful.menu.original_new(...)
ret.wibox.shape = helpers.ui.rrect(10) ret.wibox.shape = helpers.ui.rrect(10)
ret.wibox.bg = beautiful.bg_normal .. '00' ret.wibox.bg = beautiful.bg_normal .. "00"
ret.wibox:set_widget(wibox.widget { ret.wibox:set_widget(wibox.widget({
ret.wibox.widget, ret.wibox.widget,
widget = wibox.container.background, widget = wibox.container.background,
bg = beautiful.xcolorbase, bg = beautiful.xcolorbase,
shape = helpers.ui.rrect(0), shape = helpers.ui.rrect(0),
}) }))
return ret return ret
end end
return menu return menu

View file

@ -1,77 +1,78 @@
local awful = require "awful" local awful = require("awful")
local gears = require "gears" local ruled = require("ruled")
local ruled = require "ruled"
local dpi = require("beautiful.xresources").apply_dpi local dpi = require("beautiful.xresources").apply_dpi
local helpers = require "helpers" local helpers = require("helpers")
local apps = require "main.apps" local apps = require("main.apps")
local screen_width = awful.screen.focused().geometry.width
local screen_height = awful.screen.focused().geometry.height
ruled.client.connect_signal("request::rules", function() ruled.client.connect_signal("request::rules", function()
ruled.client.append_rule { ruled.client.append_rule({
id = "global", id = "global",
rule = {}, rule = {},
properties = { properties = {
-- shape = helpers.ui.rrect(15), -- Shape is in Titlebar -- focus = awful.client.focus.filter,
focus = awful.client.focus.filter, raise = true,
raise = true, screen = awful.screen.preferred,
screen = awful.screen.preferred, placement = awful.placement.no_overlap + awful.placement.no_offscreen,
placement = awful.placement.no_overlap+awful.placement.no_offscreen, },
}, })
}
ruled.client.append_rule { ruled.client.append_rule({
id = "titlebars", id = "titlebars",
rule_any = { rule_any = {
type = {"normal", "dialog"}, type = { "normal", "dialog" },
}, },
properties = { properties = {
titlebars_enabled = true titlebars_enabled = true,
} },
} })
ruled.client.append_rule { ruled.client.append_rule({
rule = { class = apps["launcher"] }, rule = { class = apps["launcher"] },
properties = { properties = {
titlebars_enabled = false titlebars_enabled = false,
}, },
rule = { instance = "origin.exe", }, })
properties = { floating = true, titlebars_enabled = false, border_width = dpi(0), shape = helpers.ui.rrect(0), border_width = dpi(0), },
}
ruled.client.append_rule({
rule = { instance = "origin.exe" },
properties = {
floating = true,
titlebars_enabled = false,
shape = helpers.ui.rrect(0),
border_width = dpi(0),
},
})
ruled.client.append_rule { ruled.client.append_rule({
rule = { instance = "bf1.exe" }, rule = { instance = "bf1.exe" },
properties = { shape = helpers.ui.rrect(0), fullscreen = true, tag = "", switchtotag = true, }, --ontop = true, sticky = true, }, properties = { shape = helpers.ui.rrect(0), fullscreen = true, tag = "", switchtotag = true },
} })
ruled.client.append_rule { ruled.client.append_rule({
rule = { instance = "wine" }, rule = { instance = "wine" },
properties = { shape = helpers.ui.rrect(0), titlebars_enabled = false, }, --ontop = true, sticky = true, }, properties = { shape = helpers.ui.rrect(0), titlebars_enabled = false },
} })
ruled.client.append_rule({ ruled.client.append_rule({
rule_any = { rule_any = {
floating = true, floating = true,
}, },
properties = { properties = {
placement = awful.placement.centered, placement = awful.placement.centered,
ontop = true, ontop = true,
}, },
}) })
ruled.client.append_rule({
rule_any = {
class = {
"xfce",
},
instance = {
"xfce",
},
},
properties = {
floating = true,
},
})
ruled.client.append_rule({
rule_any = {
class = {
"xfce",
},
instance = {
"xfce",
},
},
properties = {
floating = true,
},
})
end) end)

View file

@ -1,5 +1,5 @@
local awful = require "awful" local awful = require("awful")
screen.connect_signal("request::desktop_decoration", function(s) screen.connect_signal("request::desktop_decoration", function(s)
awful.tag({"", "", "", "", "", ""}, s, awful.layout.layouts[1]) awful.tag({ "", "", "", "", "", "󰍹 " }, s, awful.layout.layouts[1])
end) end)

View file

@ -1,9 +1,9 @@
local awful = require "awful" local awful = require("awful")
local wibox = require "wibox" local wibox = require("wibox")
local beautiful = require "beautiful" local beautiful = require("beautiful")
local function set_wall(s) local function set_wall(s)
awful.wallpaper { awful.wallpaper({
screen = s, screen = s,
widget = { widget = {
{ {
@ -16,8 +16,8 @@ local function set_wall(s)
halign = "center", halign = "center",
tiled = true, tiled = true,
widget = wibox.container.tile, widget = wibox.container.tile,
} },
} })
end end
screen.connect_signal("request::wallpaper", function(s) screen.connect_signal("request::wallpaper", function(s)

View file

@ -1,6 +1,5 @@
local awful = require "awful" local awful = require("awful")
local gears = require "gears" local gears = require("gears")
local function get_cpu() local function get_cpu()
local script = [[ local script = [[
@ -13,11 +12,12 @@ local function get_cpu()
end) end)
end end
gears.timer { gears.timer({
timeout = 1, timeout = 1,
call_now = true, call_now = true,
autostart = true, autostart = true,
callback = function() callback = function()
get_cpu() get_cpu()
end end,
} })

View file

@ -1,12 +1,12 @@
local awful = require "awful" local awful = require("awful")
local gears = require "gears" local gears = require("gears")
local user_vars = require "user_variables" local user_vars = require("user_variables")
local which_disk = user_vars.widget.disk.name local which_disk = user_vars.widget.disk.name
local function get_disk() local function get_disk()
local script = [[ local script = [[
df -kH -B 1MB ]]..which_disk..[[ | tail -1 | awk '{printf $5}' df -kH -B 1MB ]] .. which_disk .. [[ | tail -1 | awk '{printf $5}'
]] ]]
awful.spawn.easy_async_with_shell(script, function(disk_perc) awful.spawn.easy_async_with_shell(script, function(disk_perc)
@ -15,11 +15,11 @@ local function get_disk()
end) end)
end end
gears.timer { gears.timer({
timeout = 2000, timeout = 2000,
call_now = true, call_now = true,
autostart = true, autostart = true,
callback = function() callback = function()
get_disk() get_disk()
end end,
} })

View file

@ -1,4 +1,4 @@
req = { local req = {
"volume", "volume",
"mic", "mic",
"cpu", "cpu",
@ -10,5 +10,5 @@ req = {
} }
for _, x in pairs(req) do for _, x in pairs(req) do
require("signals."..x) require("signals." .. x)
end end

View file

@ -1,6 +1,5 @@
local awful = require "awful" local awful = require("awful")
local gears = require "gears" local gears = require("gears")
local function get_mem() local function get_mem()
local script = [[ local script = [[
@ -13,11 +12,12 @@ local function get_mem()
end) end)
end end
gears.timer { gears.timer({
timeout = 4, timeout = 4,
call_now = true, call_now = true,
autostart = true, autostart = true,
callback = function() callback = function()
get_mem() get_mem()
end end,
} })

View file

@ -1,17 +1,16 @@
local awful = require "awful" local awful = require("awful")
local gears = require "gears"
local wibox = require "wibox"
local beautiful = require "beautiful"
local user_vars = require "user_variables" local user_vars = require("user_variables")
local microphone = user_vars.widget.mic.name local microphone = user_vars.widget.mic.name
local vol_sc = 'pamixer --source ' ..microphone.. ' --get-volume' local vol_sc = "pamixer --source " .. microphone .. " --get-volume"
local mute_sc = 'pamixer --source ' ..microphone.. ' --get-mute' local mute_sc = "pamixer --source " .. microphone .. " --get-mute"
local function get_vol() local function get_vol()
awful.spawn.easy_async_with_shell(vol_sc, function(vol) awful.spawn.easy_async_with_shell(vol_sc, function(vol)
awful.spawn.easy_async_with_shell(mute_sc, function(mute) awful.spawn.easy_async_with_shell(mute_sc, function(mute)
local muted
if mute:match("false") then if mute:match("false") then
muted = false muted = false
else else
@ -23,16 +22,6 @@ local function get_vol()
end) end)
end end
awesome.connect_signal("widget::update_mic", function() -- Needs to be Updated if muted! For Mute in Sidebar Widget awesome.connect_signal("widget::update_mic", function() -- Needs to be Updated if muted! For Mute in Sidebar Widget
get_vol() get_vol()
end) end)
--gears.timer {
-- timeout = 10,
-- call_now = true,
-- autostart = true,
-- callback = function()
-- get_vol()
-- end
--}
get_vol() get_vol()

View file

@ -1,9 +1,8 @@
local awful = require "awful" local awful = require("awful")
local gears = require "gears"
-- Script -- Script
local title_sc = 'mpc -f %title% | head -1' local title_sc = "mpc -f %title% | head -1"
local artist_sc = 'mpc -f %artist% | head -1' local artist_sc = "mpc -f %artist% | head -1"
local length_sc = "mpc | awk '{print $3}' | awk 'NR==2'" local length_sc = "mpc | awk '{print $3}' | awk 'NR==2'"
local status_sc = "mpc | awk '{print $1}' | awk 'NR==2' | sed 's/[[]*//g' | sed 's/[]]*//g'" local status_sc = "mpc | awk '{print $1}' | awk 'NR==2' | sed 's/[[]*//g' | sed 's/[]]*//g'"
@ -27,4 +26,3 @@ awesome.connect_signal("widget::update_player", function()
get_player() get_player()
end) end)
get_player() get_player()

View file

@ -1,12 +1,11 @@
local bling = require("lib.bling") local bling = require("lib.bling")
local playerctl = {}
local instance = nil local instance = nil
local function new() local function new()
return bling.signal.playerctl.lib({ return bling.signal.playerctl.lib({
update_on_activity = true, update_on_activity = true,
player = { "mpd", "spotify", "%any", }, player = { "mopidy", "spotify", "%any" },
debounce_delay = 1, debounce_delay = 1,
}) })
end end

View file

@ -1,6 +1,4 @@
local awful = require "awful" local awful = require("awful")
local gears = require "gears"
local function get_uptime() local function get_uptime()
local script = [[ local script = [[
@ -9,7 +7,6 @@ local function get_uptime()
awful.spawn.easy_async_with_shell(script, function(uptime) awful.spawn.easy_async_with_shell(script, function(uptime)
uptime = string.gsub(uptime, "\n", "") uptime = string.gsub(uptime, "\n", "")
--uptime = uptime:match("%d+")
awesome.emit_signal("signal::uptime", uptime) awesome.emit_signal("signal::uptime", uptime)
end) end)
end end
@ -17,3 +14,4 @@ awesome.connect_signal("widget::update_uptime", function()
get_uptime() get_uptime()
end) end)
get_uptime() get_uptime()

View file

@ -1,13 +1,13 @@
local awful = require "awful" local awful = require("awful")
local gears = require "gears"
local wibox = require "wibox"
local vol_sc = 'pamixer --get-volume' local vol_sc = "pamixer --get-volume"
local mute_sc = 'pamixer --get-mute' local mute_sc = "pamixer --get-mute"
local function get_vol() local function get_vol()
awful.spawn.easy_async_with_shell(vol_sc, function(vol) awful.spawn.easy_async_with_shell(vol_sc, function(vol)
awful.spawn.easy_async_with_shell(mute_sc, function(mute) awful.spawn.easy_async_with_shell(mute_sc, function(mute)
local muted
if mute:match("false") then if mute:match("false") then
muted = false muted = false
else else
@ -18,17 +18,9 @@ local function get_vol()
end) end)
end) end)
end end
awesome.connect_signal("widget::update_vol", function() -- Needs to be Updated if muted! For Pulseaudio Widget awesome.connect_signal("widget::update_vol", function() -- Needs to be Updated if muted! For Pulseaudio Widget
get_vol() get_vol()
end) end)
--gears.timer {
-- timeout = 10,
-- call_now = true,
-- autostart = true,
-- callback = function()
-- get_vol()
-- end
--}
get_vol() get_vol()

View file

@ -1,14 +1,14 @@
--------------------------- ---------------------------
-- Default awesome theme -- -- Default awesome theme --
--------------------------- ---------------------------
local gears = require ("gears") local gears = require("gears")
local theme_assets = require("beautiful.theme_assets") local theme_assets = require("beautiful.theme_assets")
local xresources = require("beautiful.xresources") local xresources = require("beautiful.xresources")
local dpi = xresources.apply_dpi local dpi = xresources.apply_dpi
local gfs = require("gears.filesystem") local gfs = require("gears.filesystem")
local themes_path = gfs.get_configuration_dir() .. "themes/" local themes_path = gfs.get_configuration_dir() .. "themes/"
local helpers = require ("helpers") local helpers = require("helpers")
local theme = {} local theme = {}
@ -22,7 +22,6 @@ theme.xcolorcrust = "#11111b"
theme.xcolormantle = "#181825" theme.xcolormantle = "#181825"
theme.xcolorbase = "#1E1E2E" theme.xcolorbase = "#1E1E2E"
-- Surface -- -- Surface --
theme.xcolorS0 = "#313244" theme.xcolorS0 = "#313244"
theme.xcolorS1 = "#45475a" theme.xcolorS1 = "#45475a"
@ -67,31 +66,31 @@ theme.xcolor13 = "#f2cdcd"
-- Rosewater -- -- Rosewater --
theme.xcolor14 = "#f5e0dc" theme.xcolor14 = "#f5e0dc"
theme.music = themes_path.."catppuccin/assets/music.png" theme.music = themes_path .. "catppuccin/assets/music.png"
theme.volume_on = themes_path.."catppuccin/assets/volume-on.png" theme.volume_on = themes_path .. "catppuccin/assets/volume-on.png"
theme.volume_off = themes_path.."catppuccin/assets/volume-off.png" theme.volume_off = themes_path .. "catppuccin/assets/volume-off.png"
theme.pfp = themes_path.."catppuccin/assets/pfp.jpg" theme.pfp = themes_path .. "catppuccin/assets/pfp.jpg"
theme.font = "FiraCode Nerd Font 10" theme.font = "FiraCode Nerd Font Propo 10"
theme.font_name = "FiraCode Nerd Font " theme.font_name = "FiraCode Nerd Font Propo "
theme.titlebar_bg_focus = theme.xcolorbase theme.titlebar_bg_focus = theme.xcolorbase
theme.titlebar_bg = theme.xcolorbase theme.titlebar_bg = theme.xcolorbase
theme.bg_normal = theme.xcolorbase theme.bg_normal = theme.xcolorbase
theme.bg_focus = theme.xcolorS0 theme.bg_focus = theme.xcolorS0
theme.bg_urgent = "#ff0000" theme.bg_urgent = "#ff0000"
theme.bg_minimize = "#444444" theme.bg_minimize = "#444444"
theme.bg_systray = theme.bg_normal theme.bg_systray = theme.bg_normal
theme.fg_normal = theme.xcolorT2 --Text Color theme.fg_normal = theme.xcolorT2 --Text Color
theme.fg_focus = theme.xcolor5 theme.fg_focus = theme.xcolor5
theme.fg_urgent = "#ffffff" theme.fg_urgent = "#ffffff"
theme.fg_minimize = "#ffffff" theme.fg_minimize = "#ffffff"
theme.useless_gap = dpi(10) theme.useless_gap = dpi(10)
theme.border_width = dpi(3) theme.border_width = dpi(3)
theme.border_normal = theme.xcolorS0 theme.border_normal = theme.xcolorS0
theme.border_focus = theme.xcolor5 theme.border_focus = theme.xcolor5
theme.border_marked = "#91231c" theme.border_marked = "#91231c"
theme.menu_font = "FiraCode Nerd Font 12" theme.menu_font = "FiraCode Nerd Font 12"
@ -103,8 +102,7 @@ theme.menu_border_color = theme.xcolorS0
--theme.menu_submenu_icon = themes_path.."catppuccin/submenu.png" --theme.menu_submenu_icon = themes_path.."catppuccin/submenu.png"
theme.submenu = "» " theme.submenu = "» "
theme.menu_height = dpi(37) theme.menu_height = dpi(37)
theme.menu_width = dpi(194) theme.menu_width = dpi(194)
theme.tasklist_bg_focus = theme.xcolorbase theme.tasklist_bg_focus = theme.xcolorbase
theme.tasklist_fg_focus = theme.xcolor1 theme.tasklist_fg_focus = theme.xcolor1
@ -121,12 +119,8 @@ theme.taglist_fg_occupied = "#526c96"
-- Generate taglist squares: -- Generate taglist squares:
local taglist_square_size = dpi(0) local taglist_square_size = dpi(0)
theme.taglist_squares_sel = theme_assets.taglist_squares_sel( theme.taglist_squares_sel = theme_assets.taglist_squares_sel(taglist_square_size, theme.xcolor2)
taglist_square_size, theme.xcolor2 theme.taglist_squares_unsel = theme_assets.taglist_squares_unsel(taglist_square_size, theme.taglist_fg_occupied)
)
theme.taglist_squares_unsel = theme_assets.taglist_squares_unsel(
taglist_square_size, theme.taglist_fg_occupied
)
-- Edge Snap -- Edge Snap
theme.snap_bg = theme.xcolor5 theme.snap_bg = theme.xcolor5
@ -191,21 +185,21 @@ theme.notification_bg = theme.xcolorbase
--theme.bg_widget = "#cc0000" --theme.bg_widget = "#cc0000"
-- Define the image to load -- Define the image to load
theme.titlebar_close_button_normal = themes_path.."catppuccin/titlebar/unfocus.svg" theme.titlebar_close_button_normal = themes_path .. "catppuccin/titlebar/unfocus.svg"
theme.titlebar_close_button_focus = themes_path.."catppuccin/titlebar/close.svg" theme.titlebar_close_button_focus = themes_path .. "catppuccin/titlebar/close.svg"
theme.titlebar_close_button_normal_hover = themes_path.."catppuccin/titlebar/close_hover.svg" theme.titlebar_close_button_normal_hover = themes_path .. "catppuccin/titlebar/close_hover.svg"
theme.titlebar_close_button_focus_hover = themes_path.."catppuccin/titlebar/close_hover.svg" theme.titlebar_close_button_focus_hover = themes_path .. "catppuccin/titlebar/close_hover.svg"
theme.titlebar_minimize_button_normal = themes_path.."catppuccin/titlebar/unfocus.svg" theme.titlebar_minimize_button_normal = themes_path .. "catppuccin/titlebar/unfocus.svg"
theme.titlebar_minimize_button_focus = themes_path.."catppuccin/titlebar/minimize.svg" theme.titlebar_minimize_button_focus = themes_path .. "catppuccin/titlebar/minimize.svg"
theme.titlebar_minimize_button_normal_hover = themes_path.."catppuccin/titlebar/minimize_hover.svg" theme.titlebar_minimize_button_normal_hover = themes_path .. "catppuccin/titlebar/minimize_hover.svg"
theme.titlebar_minimize_button_focus_hover = themes_path.."catppuccin/titlebar/minimize_hover.svg" theme.titlebar_minimize_button_focus_hover = themes_path .. "catppuccin/titlebar/minimize_hover.svg"
theme.titlebar_ontop_button_normal_inactive = themes_path.."catppuccin/titlebar/unfocus.svg" theme.titlebar_ontop_button_normal_inactive = themes_path .. "catppuccin/titlebar/unfocus.svg"
theme.titlebar_ontop_button_focus_inactive = themes_path.."catppuccin/titlebar/ontop.svg" theme.titlebar_ontop_button_focus_inactive = themes_path .. "catppuccin/titlebar/ontop.svg"
theme.titlebar_ontop_button_normal_active = themes_path.."catppuccin/titlebar/unfocus.svg" theme.titlebar_ontop_button_normal_active = themes_path .. "catppuccin/titlebar/unfocus.svg"
theme.titlebar_ontop_button_focus_active = themes_path.."catppuccin/titlebar/ontop.svg" theme.titlebar_ontop_button_focus_active = themes_path .. "catppuccin/titlebar/ontop.svg"
-- theme.titlebar_sticky_button_normal_inactive = themes_path.."catppuccin/titlebar/sticky_normal_inactive.png" -- theme.titlebar_sticky_button_normal_inactive = themes_path.."catppuccin/titlebar/sticky_normal_inactive.png"
-- theme.titlebar_sticky_button_focus_inactive = themes_path.."catppuccin/titlebar/sticky_focus_inactive.png" -- theme.titlebar_sticky_button_focus_inactive = themes_path.."catppuccin/titlebar/sticky_focus_inactive.png"
@ -217,32 +211,30 @@ theme.titlebar_ontop_button_focus_active = themes_path.."catppuccin/titlebar/on
-- theme.titlebar_floating_button_normal_active = themes_path.."catppuccin/titlebar/floating_normal_active.png" -- theme.titlebar_floating_button_normal_active = themes_path.."catppuccin/titlebar/floating_normal_active.png"
-- theme.titlebar_floating_button_focus_active = themes_path.."catppuccin/titlebar/floating_focus_active.png" -- theme.titlebar_floating_button_focus_active = themes_path.."catppuccin/titlebar/floating_focus_active.png"
theme.titlebar_maximized_button_normal_active = themes_path.."catppuccin/titlebar/unfocus.svg" theme.titlebar_maximized_button_normal_active = themes_path .. "catppuccin/titlebar/unfocus.svg"
theme.titlebar_maximized_button_focus_active = themes_path.."catppuccin/titlebar/maximize.svg" theme.titlebar_maximized_button_focus_active = themes_path .. "catppuccin/titlebar/maximize.svg"
theme.titlebar_maximized_button_normal_active_hover = themes_path.."catppuccin/titlebar/maximize_hover.svg" theme.titlebar_maximized_button_normal_active_hover = themes_path .. "catppuccin/titlebar/maximize_hover.svg"
theme.titlebar_maximized_button_focus_active_hover = themes_path.."catppuccin/titlebar/maximize_hover.svg" theme.titlebar_maximized_button_focus_active_hover = themes_path .. "catppuccin/titlebar/maximize_hover.svg"
theme.titlebar_maximized_button_normal_inactive = themes_path.."catppuccin/titlebar/unfocus.svg" theme.titlebar_maximized_button_normal_inactive = themes_path .. "catppuccin/titlebar/unfocus.svg"
theme.titlebar_maximized_button_focus_inactive = themes_path.."catppuccin/titlebar/maximize.svg" theme.titlebar_maximized_button_focus_inactive = themes_path .. "catppuccin/titlebar/maximize.svg"
theme.titlebar_maximized_button_normal_inactive_hover = themes_path.."catppuccin/titlebar/maximize_hover.svg" theme.titlebar_maximized_button_normal_inactive_hover = themes_path .. "catppuccin/titlebar/maximize_hover.svg"
theme.titlebar_maximized_button_focus_inactive_hover = themes_path.."catppuccin/titlebar/maximize_hover.svg" theme.titlebar_maximized_button_focus_inactive_hover = themes_path .. "catppuccin/titlebar/maximize_hover.svg"
theme.wallpaper = themes_path.."catppuccin/buttons.png" theme.wallpaper = themes_path .. "catppuccin/buttons.png"
-- You can use your own layout icons like this: -- You can use your own layout icons like this:
theme.layout_floating = themes_path.."catppuccin/layouts/floating.png" theme.layout_floating = themes_path .. "catppuccin/layouts/floating.png"
theme.layout_max = themes_path.."catppuccin/layouts/max.png" theme.layout_max = themes_path .. "catppuccin/layouts/max.png"
theme.layout_tile = themes_path.."catppuccin/layouts/tile.png" theme.layout_tile = themes_path .. "catppuccin/layouts/tile.png"
theme.layout_dwindle = themes_path.."catppuccin/layouts/dwindle.png" theme.layout_dwindle = themes_path .. "catppuccin/layouts/dwindle.png"
theme.layout_centered = themes_path.."catppuccin/layouts/centered.png" theme.layout_centered = themes_path .. "catppuccin/layouts/centered.png"
theme.layout_mstab = themes_path.."catppuccin/layouts/mstab.png" theme.layout_mstab = themes_path .. "catppuccin/layouts/mstab.png"
theme.layout_equalarea = themes_path.."catppuccin/layouts/equalarea.png" theme.layout_equalarea = themes_path .. "catppuccin/layouts/equalarea.png"
theme.layout_machi = themes_path.."catppuccin/layouts/machi.png" theme.layout_machi = themes_path .. "catppuccin/layouts/machi.png"
-- Generate Awesome icon: -- Generate Awesome icon:
theme.awesome_icon = theme_assets.awesome_icon( theme.awesome_icon = theme_assets.awesome_icon(theme.menu_height, theme.bg_focus, theme.fg_focus)
theme.menu_height, theme.bg_focus, theme.fg_focus
)
-- Define the icon theme for application icons. If not set then the icons -- Define the icon theme for application icons. If not set then the icons
-- from /usr/share/icons and /usr/share/icons/hicolor will be used. -- from /usr/share/icons and /usr/share/icons/hicolor will be used.

View file

@ -1,7 +1,5 @@
local awful = require "awful" local wibox = require("wibox")
local gears = require "gears" local beautiful = require("beautiful")
local wibox = require "wibox"
local beautiful = require "beautiful"
local dpi = beautiful.xresources.apply_dpi local dpi = beautiful.xresources.apply_dpi
-- Creating Calendar -- Creating Calendar
@ -10,70 +8,73 @@ local dpi = beautiful.xresources.apply_dpi
-- copied from awesome doc and adjusted a bit -- copied from awesome doc and adjusted a bit
local styles = {} local styles = {}
styles.month = { bg_color = beautiful.xcolorS0} styles.month = { bg_color = beautiful.xcolorS0 }
styles.normal = { styles.normal = {
bg_color = beautiful.xcolorS0, bg_color = beautiful.xcolorS0,
padding = dpi(6), padding = dpi(6),
fg_color = beautiful.xcolorT2, fg_color = beautiful.xcolorT2,
} }
styles.focus = { styles.focus = {
fg_color = beautiful.xcolor7, fg_color = beautiful.xcolor7,
padding = dpi(6), padding = dpi(6),
markup = function(t) return '<b>' .. t .. '</b>' end, markup = function(t)
return "<b>" .. t .. "</b>"
end,
} }
styles.header = { styles.header = {
fg_color = beautiful.xcolor2, fg_color = beautiful.xcolor2,
markup = function(t) return '<b>' .. t .. '</b>' end, markup = function(t)
return "<b>" .. t .. "</b>"
end,
} }
styles.weekday = { styles.weekday = {
fg_color = beautiful.xcolorT2, fg_color = beautiful.xcolorT2,
markup = function(t) return '<span font_desc="FiraCode Nerd Font Medium 16">' .. t .. '</span>' end, markup = function(t)
return '<span font_desc="FiraCode Nerd Font Medium 16">' .. t .. "</span>"
end,
} }
-- The Function -- The Function
local function decorate_cell(widget, flag, date) local function decorate_cell(widget, flag)
if flag=="monthheader" and not styles.monthheader then if flag == "monthheader" and not styles.monthheader then
flag = "header" flag = "header"
end end
local props = styles[flag] or {} local props = styles[flag] or {}
if props.markup and widget.get_text and widget.set_markup then if props.markup and widget.get_text and widget.set_markup then
widget:set_markup(props.markup(widget:get_text())) widget:set_markup(props.markup(widget:get_text()))
end end
-- Change bg color for weekends -- Change bg color for weekends
local d = {year=date.year, month=(date.month or 1), day=(date.day or 1)} local ret = wibox.widget({
local weekday = tonumber(os.date("%w", os.time(d))) {
local ret = wibox.widget { widget,
{ margins = props.padding,
widget, widget = wibox.container.margin,
margins = props.padding, },
widget = wibox.container.margin fg = props.fg_color,
}, bg = props.bg_color,
fg = props.fg_color, widget = wibox.container.background,
bg = props.bg_color, })
widget = wibox.container.background
}
return ret return ret
end end
local calendar = wibox.widget { local calendar = wibox.widget({
date = os.date("*t"), date = os.date("*t"),
font = beautiful.font_name.."14", font = beautiful.font_name .. "14",
fn_embed = decorate_cell, fn_embed = decorate_cell,
widget = wibox.widget.calendar.month, widget = wibox.widget.calendar.month,
} })
return wibox.widget({
return wibox.widget {
nil, nil,
{ {
nil, nil,
calendar, calendar,
expand = 'none', expand = "none",
layout = wibox.layout.align.horizontal, layout = wibox.layout.align.horizontal,
}, },
expand = 'none', expand = "none",
layout = wibox.layout.align.vertical, layout = wibox.layout.align.vertical,
} })

View file

@ -1,11 +1,10 @@
local awful = require "awful" local awful = require("awful")
local gears = require "gears" local gears = require("gears")
local wibox = require "wibox" local wibox = require("wibox")
local beautiful = require "beautiful" local beautiful = require("beautiful")
local dpi = beautiful.xresources.apply_dpi local dpi = beautiful.xresources.apply_dpi
local rubato = require "lib.rubato" local rubato = require("lib.rubato")
local helpers = require "helpers"
-- Var -- Var
local width = dpi(410) local width = dpi(410)
@ -15,72 +14,69 @@ local height = awful.screen.focused().geometry.height - dpi(100)
----------- -----------
local function round_widget(radius) local function round_widget(radius)
return function(cr,w,h) return function(cr, w, h)
gears.shape.rounded_rect(cr,w,h,radius) gears.shape.rounded_rect(cr, w, h, radius)
end end
end end
local function center_widget(widgets) local function center_widget(widgets)
return wibox.widget { return wibox.widget({
nil, nil,
{ {
nil, nil,
widgets, widgets,
expand = 'none', expand = "none",
layout = wibox.layout.align.horizontal, layout = wibox.layout.align.horizontal,
}, },
expand = 'none', expand = "none",
layout = wibox.layout.align.vertical, layout = wibox.layout.align.vertical,
} })
end end
local function box_widget(widgets, width, height) local function box_widget(widgets, _width, _height)
--local centered_widget = center_widget(widgets) --local centered_widget = center_widget(widgets)
return wibox.widget { return wibox.widget({
{ {
{ {
widgets, widgets,
margins = dpi(16), margins = dpi(16),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
forced_width = dpi(width), forced_width = dpi(_width),
forced_height = dpi(height), forced_height = dpi(_height),
shape = round_widget(8), shape = round_widget(8),
bg = beautiful.bg_focus, --for widget Rounded and Border bg = beautiful.bg_focus, --for widget Rounded and Border
widget = wibox.container.background, widget = wibox.container.background,
}, },
margins = {left = dpi(20), right = dpi(20)}, margins = { left = dpi(20), right = dpi(20) },
widget = wibox.container.margin, widget = wibox.container.margin,
} })
end end
local aa = wibox.widget.textbox()
-- Get widgets -- Get widgets
local weather_widget = require "ui.info-panel.weather" local weather_widget = require("ui.info-panel.weather")
local profile_widget = require "ui.info-panel.profile" local profile_widget = require("ui.info-panel.profile")
--local player_widget = require "ui.info-panel.player" -- Old MPD widget --local player_widget = require "ui.info-panel.player" -- Old MPD widget
local calendar_widget = require "ui.info-panel.calendar" local calendar_widget = require("ui.info-panel.calendar")
local music_widget = require "ui.info-panel.music-player" local music_widget = require("ui.info-panel.music-player")
-- Combine some widgets -- Combine some widgets
local weather = box_widget(weather_widget, 380, 180) local weather = box_widget(weather_widget, 380, 180)
local profile = box_widget(profile_widget, 380, 210) local profile = box_widget(profile_widget, 380, 210)
--local player = box_widget(player_widget, 380, 150) -- Box MPD widget --local player = box_widget(player_widget, 380, 150) -- Box MPD widget
local calendar = box_widget(calendar_widget, 380, 340) local calendar = box_widget(calendar_widget, 380, 340)
local music = box_widget(music_widget, 380, 150)
-- Spacing -- Spacing
local space = function(height) local space = function(_height)
return wibox.widget { return wibox.widget({
forced_height = dpi(height), forced_height = dpi(_height),
layout = wibox.layout.align.horizontal layout = wibox.layout.align.horizontal,
} })
end end
-- Sidebar -- Sidebar
local sidebar = wibox { local sidebar = wibox({
visible = false, visible = false,
ontop = true, ontop = true,
width = width, width = width,
@ -89,10 +85,10 @@ local sidebar = wibox {
bg = beautiful.bg_normal, bg = beautiful.bg_normal,
border_width = dpi(3), border_width = dpi(3),
border_color = beautiful.xcolorS0, border_color = beautiful.xcolorS0,
} })
-- Sidebar widget setup -- Sidebar widget setup
sidebar : setup { sidebar:setup({
{ {
profile, profile,
--player, --player,
@ -103,29 +99,29 @@ sidebar : setup {
spacing = dpi(20), spacing = dpi(20),
layout = wibox.layout.fixed.vertical, layout = wibox.layout.fixed.vertical,
}, },
margins = { top = dpi(20), bottom = dpi(20)}, margins = { top = dpi(20), bottom = dpi(20) },
widget = wibox.container.margin, widget = wibox.container.margin,
} })
-- Slide animation -- Slide animation
local slide = rubato.timed { local slide = rubato.timed({
pos = awful.screen.focused().geometry.x - sidebar.width, pos = awful.screen.focused().geometry.x - sidebar.width,
rate = 60, rate = 60,
intro = 0.2, intro = 0.2,
duration = 0.4, duration = 0.4,
subscribed = function(pos) subscribed = function(pos)
sidebar.x = awful.screen.focused().geometry.x + pos sidebar.x = awful.screen.focused().geometry.x + pos
end end,
} })
-- Timer of sidebar's death -- Timer of sidebar's death
sidebar.timer = gears.timer { sidebar.timer = gears.timer({
timeout = 0.5, timeout = 0.5,
single_shot = true, single_shot = true,
callback = function() callback = function()
sidebar.visible = not sidebar.visible sidebar.visible = not sidebar.visible
end end,
} })
--aa.timer = gears.timer { -- Updates the Player every second --aa.timer = gears.timer { -- Updates the Player every second
-- timeout = 1, -- timeout = 1,
-- autostart = false, -- autostart = false,
@ -133,19 +129,19 @@ sidebar.timer = gears.timer {
-- awesome.emit_signal("widget::update_player") -- awesome.emit_signal("widget::update_player")
-- end -- end
--} --}
sidebar.shape = function(cr,w,h) --Rounded Corners sidebar.shape = function(cr, w, h) --Rounded Corners
gears.shape.rounded_rect(cr,w,h,14) gears.shape.rounded_rect(cr, w, h, 14)
end end
-- Toggle function -- Toggle function
sidebar.toggle = function() sidebar.toggle = function()
if sidebar.visible then if sidebar.visible then
-- aa.timer:stop() -- Stops to Update the Player Signal -- aa.timer:stop() -- Stops to Update the Player Signal
slide.target = awful.screen.focused().geometry.x - sidebar.width slide.target = awful.screen.focused().geometry.x - sidebar.width
sidebar.timer:start() sidebar.timer:start()
else else
-- awesome.emit_signal("widget::update_player") -- Updates it before the Timer so it doesn't Jump the Length -- awesome.emit_signal("widget::update_player") -- Updates it before the Timer so it doesn't Jump the Length
awesome.emit_signal("widget::update_uptime") awesome.emit_signal("widget::update_uptime")
-- aa.timer:start() -- aa.timer:start()
slide.target = awful.screen.focused().geometry.x + dpi(20) slide.target = awful.screen.focused().geometry.x + dpi(20)
sidebar.visible = not sidebar.visible sidebar.visible = not sidebar.visible
end end

View file

@ -75,7 +75,7 @@ local function volume_control()
}) })
-- Update bar -- Update bar
local function set_slider_value(self, volume) local function set_slider_value(_, volume)
volume_bar.value = volume * 100 volume_bar.value = volume * 100
end end
@ -109,27 +109,27 @@ local function volume_control()
end end
-- Player's Button -- Player's Button
local toggle = wibox.widget.textbox() local toggle = wibox.widget.textbox()
toggle.font = beautiful.font_name.."26" toggle.font = beautiful.font_name .. "26"
toggle:buttons(gears.table.join( toggle:buttons(gears.table.join(awful.button({}, 1, function()
awful.button({}, 1, function() playerctl_daemon:play_pause() end) playerctl_daemon:play_pause()
)) end)))
local next = wibox.widget.textbox() local next = wibox.widget.textbox()
next.font = beautiful.font_name.."26" next.font = beautiful.font_name .. "26"
next.markup = "" next.markup = ""
next:buttons(gears.table.join( next:buttons(gears.table.join(awful.button({}, 1, function()
awful.button({}, 1, function() playerctl_daemon:next() end) playerctl_daemon:next()
)) end)))
local back = wibox.widget.textbox() local back = wibox.widget.textbox()
back.font = beautiful.font_name.."26" back.font = beautiful.font_name .. "26"
back.markup = "" back.markup = ""
back:buttons(gears.table.join( back:buttons(gears.table.join(awful.button({}, 1, function()
awful.button({}, 1, function() playerctl_daemon:previous() end) playerctl_daemon:previous()
)) end)))
local function music() local function music()
return wibox.widget({ return wibox.widget({
@ -223,7 +223,7 @@ local music_widget = wibox.widget({
--- playerctl --- playerctl
--- ------------- --- -------------
playerctl_daemon:connect_signal("metadata", function(_, title, artist, album_path, __, ___, ____) playerctl_daemon:connect_signal("metadata", function(_, title, artist, album_path, _, _, _)
if title == "" then if title == "" then
title = "Nothing Playing" title = "Nothing Playing"
end end
@ -239,13 +239,13 @@ playerctl_daemon:connect_signal("metadata", function(_, title, artist, album_pat
music_artist:set_markup_silently(helpers.ui.colorize_text(artist, beautiful.xcolor2)) music_artist:set_markup_silently(helpers.ui.colorize_text(artist, beautiful.xcolor2))
end) end)
playerctl_daemon:connect_signal("playback_status", function(_, playing, __) playerctl_daemon:connect_signal("playback_status", function(_, playing, _)
if playing then if playing then
music_text:set_markup_silently(helpers.ui.colorize_text("Now Playing", beautiful.xcolorO0 )) --"#666c79" music_text:set_markup_silently(helpers.ui.colorize_text("Now Playing", beautiful.xcolorO0)) --"#666c79"
toggle.markup = helpers.ui.colorize_text("", beautiful.xcolor2 ) toggle.markup = helpers.ui.colorize_text("󰏤", beautiful.xcolor2)
else else
music_text:set_markup_silently(helpers.ui.colorize_text("Music", beautiful.xcolorO0 )) music_text:set_markup_silently(helpers.ui.colorize_text("Music", beautiful.xcolorO0))
toggle.markup = helpers.ui.colorize_text("", beautiful.xcolor2 ) toggle.markup = helpers.ui.colorize_text("󰐊", beautiful.xcolor2)
end end
end) end)

View file

@ -1,7 +1,7 @@
local awful = require "awful" local awful = require("awful")
local gears = require "gears" local gears = require("gears")
local wibox = require "wibox" local wibox = require("wibox")
local beautiful = require "beautiful" local beautiful = require("beautiful")
local dpi = beautiful.xresources.apply_dpi local dpi = beautiful.xresources.apply_dpi
-- Make Widgets -- Make Widgets
@ -9,59 +9,57 @@ local dpi = beautiful.xresources.apply_dpi
-- Song's Title -- Song's Title
local title = wibox.widget.textbox() local title = wibox.widget.textbox()
title.font = beautiful.font_name.."Medium 16" title.font = beautiful.font_name .. "Medium 16"
title.align = "left" title.align = "left"
title.valign = "bottom" title.valign = "bottom"
-- Song's Artist -- Song's Artist
local artist = wibox.widget.textbox() local artist = wibox.widget.textbox()
artist.font = beautiful.font_name.."Regular 16" artist.font = beautiful.font_name .. "Regular 16"
artist.align = "left" artist.align = "left"
artist.valign = "bottom" artist.valign = "bottom"
-- Song's Length -- Song's Length
local length = wibox.widget.textbox() local length = wibox.widget.textbox()
length.font = beautiful.font_name.."Regular 14" length.font = beautiful.font_name .. "Regular 14"
length.align = "center" length.align = "center"
length.valign = "center" length.valign = "center"
-- Player's Button -- Player's Button
local toggle = wibox.widget.textbox() local toggle = wibox.widget.textbox()
toggle.font = beautiful.font_name.."26" toggle.font = beautiful.font_name .. "26"
toggle:buttons(gears.table.join( toggle:buttons(gears.table.join(awful.button({}, 1, function()
awful.button({}, 1, function() awful.spawn("mpc toggle", false)
awful.spawn("mpc toggle", false) if toggle.markup:match("󰏤") then
if toggle.markup:match("") then toggle.markup = "󰐊"
toggle.markup = "" else
else toggle.markup = "󰏤"
toggle.markup = "" end
end end)))
end)
))
local next = wibox.widget.textbox() local next = wibox.widget.textbox()
next.font = beautiful.font_name.."26" next.font = beautiful.font_name .. "26"
next.markup = "" next.markup = "󰒭"
next:buttons(gears.table.join( next:buttons(gears.table.join(awful.button({}, 1, function()
awful.button({}, 1, function() awful.spawn("mpc next", false) end) awful.spawn("mpc next", false)
)) end)))
local back = wibox.widget.textbox() local back = wibox.widget.textbox()
back.font = beautiful.font_name.."26" back.font = beautiful.font_name .. "26"
back.markup = "" back.markup = "󰒮"
back:buttons(gears.table.join( back:buttons(gears.table.join(awful.button({}, 1, function()
awful.button({}, 1, function() awful.spawn("mpc prev", false) end) awful.spawn("mpc prev", false)
)) end)))
-- Get data -- Get data
awesome.connect_signal("signal::player", function(t, a, l, s) awesome.connect_signal("signal::player", function(t, a, l, s)
if not s:match("playing") then if not s:match("playing") then
toggle.markup = "" toggle.markup = "󰐊"
else else
toggle.markup = "" toggle.markup = "󰏤"
end end
title.markup = t title.markup = t
@ -72,15 +70,15 @@ end)
-- Grouping Widgets -- Grouping Widgets
--------------------- ---------------------
local buttons = wibox.widget { local buttons = wibox.widget({
back, back,
toggle, toggle,
next, next,
spacing = dpi(11), spacing = dpi(11),
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
} })
return wibox.widget { return wibox.widget({
{ {
nil, nil,
{ {
@ -89,7 +87,7 @@ return wibox.widget {
spacing = dpi(12), spacing = dpi(12),
layout = wibox.layout.fixed.vertical, layout = wibox.layout.fixed.vertical,
}, },
expand = 'none', expand = "none",
layout = wibox.layout.align.vertical, layout = wibox.layout.align.vertical,
}, },
{ {
@ -100,7 +98,7 @@ return wibox.widget {
{ {
nil, nil,
buttons, buttons,
expand = 'none', expand = "none",
layout = wibox.layout.align.horizontal, layout = wibox.layout.align.horizontal,
}, },
spacing = dpi(6), spacing = dpi(6),
@ -109,7 +107,6 @@ return wibox.widget {
top = 30, top = 30,
bottom = 0, bottom = 0,
layout = wibox.container.margin, layout = wibox.container.margin,
--layout = wibox.layout.align.vertical,
}, },
layout = wibox.layout.flex.horizontal, layout = wibox.layout.flex.horizontal,
} })

View file

@ -1,12 +1,11 @@
local awful = require "awful" local awful = require("awful")
local wibox = require "wibox" local wibox = require("wibox")
local gears = require "gears" local gears = require("gears")
local beautiful = require "beautiful" local beautiful = require("beautiful")
local helpers = require "helpers" local helpers = require("helpers")
local dpi = beautiful.xresources.apply_dpi local dpi = beautiful.xresources.apply_dpi
local user1 = os.getenv('USER') local user1 = os.getenv("USER")
-- Create Widgets -- Create Widgets
------------------- -------------------
@ -20,75 +19,73 @@ pfp.forced_height = dpi(130)
-- User -- User
local user = wibox.widget.textbox() local user = wibox.widget.textbox()
user.font = beautiful.font_name.."SemiBold 18" user.font = beautiful.font_name .. "SemiBold 18"
user.align = 'left' user.align = "left"
user.markup = "<span foreground='"..beautiful.fg_normal.."'>"..user1.."</span>" user.markup = "<span foreground='" .. beautiful.fg_normal .. "'>" .. user1 .. "</span>"
-- Hostname -- Hostname
local hostname = wibox.widget.textbox() local hostname = wibox.widget.textbox()
hostname.font = beautiful.font_name.."Regular 14" hostname.font = beautiful.font_name .. "Regular 14"
hostname.align = 'left' hostname.align = "left"
awful.spawn.easy_async_with_shell("echo $HOST", function(stdout) awful.spawn.easy_async_with_shell("echo $HOST", function(stdout)
hostname.markup = "<span foreground='"..beautiful.xcolor1.."'>".."@"..tostring(stdout).."</span>" hostname.markup = "<span foreground='" .. beautiful.xcolor1 .. "'>" .. "@" .. tostring(stdout) .. "</span>"
end) end)
-- Battery -- Battery
local uptimeosd = wibox.widget.textbox() local uptimeosd = wibox.widget.textbox()
uptimeosd.font = beautiful.font_name.."12" uptimeosd.font = beautiful.font_name .. "12"
uptimeosd.align = "center" uptimeosd.align = "center"
-- Get data 4 widgets! -- Get data 4 widgets!
awesome.connect_signal("signal::uptime", function(uptime) awesome.connect_signal("signal::uptime", function(uptime)
uptimeosd.markup = "<span foreground='"..beautiful.fg_normal.."'>".."up "..uptime.."</span>" uptimeosd.markup = "<span foreground='" .. beautiful.fg_normal .. "'>" .. "up " .. uptime .. "</span>"
end) end)
-- Spacing horizontally -- Spacing horizontally
local space = wibox.widget { local space = wibox.widget({
forced_height = dpi(6), forced_height = dpi(6),
layout = wibox.layout.align.horizontal layout = wibox.layout.align.horizontal,
} })
local shutdown = wibox.widget { local shutdown = wibox.widget({
{ {
{ {
font = beautiful.font_name.."30", font = beautiful.font_name .. "30",
markup = "<span foreground='"..beautiful.xcolor10.."'>".."".."</span>", markup = "<span foreground='" .. beautiful.xcolor10 .. "'>" .. "" .. "</span>",
align = center, align = "center",
valign = center, valign = "center",
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
}, },
top = dpi(9), top = dpi(9),
bottom = dpi(9), bottom = dpi(9),
left = dpi(11), left = dpi(11),
right = dpi(11), right = dpi(11),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
bg = beautiful.xcolorS1, bg = beautiful.xcolorS1,
shape = helpers.ui.rrect(8), shape = helpers.ui.rrect(8),
widget = wibox.container.background, widget = wibox.container.background,
} })
local reboot = wibox.widget { local reboot = wibox.widget({
{ {
{ {
font = beautiful.font_name.."30", font = beautiful.font_name .. "30",
markup = "<span foreground='"..beautiful.xcolor2.."'>".."".."</span>", markup = "<span foreground='" .. beautiful.xcolor2 .. "'>" .. "" .. "</span>",
align = center, align = "center",
valign = center, valign = "center",
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
}, },
top = dpi(9), top = dpi(9),
bottom = dpi(9), bottom = dpi(9),
left = dpi(11), left = dpi(11),
right = dpi(11), right = dpi(11),
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
bg = beautiful.xcolorS1, bg = beautiful.xcolorS1,
shape = helpers.ui.rrect(8), shape = helpers.ui.rrect(8),
widget = wibox.container.background, widget = wibox.container.background,
} })
shutdown:connect_signal("mouse::enter", function() shutdown:connect_signal("mouse::enter", function()
shutdown.bg = beautiful.xcolorS2 shutdown.bg = beautiful.xcolorS2
end) end)
@ -105,68 +102,60 @@ reboot:connect_signal("mouse::leave", function()
reboot.bg = beautiful.xcolorS1 reboot.bg = beautiful.xcolorS1
end) end)
shutdown:buttons(gears.table.join( shutdown:buttons(gears.table.join(awful.button({}, 1, function()
awful.button({ }, 1, function() awesome.emit_signal("module::exit_screen:show")
awesome.emit_signal("module::exit_screen:show") end)))
end)
))
reboot:buttons(gears.table.join( reboot:buttons(gears.table.join(awful.button({}, 1, function()
awful.button({ }, 1, function() awful.spawn.with_shell("loginctl reboot")
awful.spawn.with_shell("loginctl reboot") end)))
end)
))
-- Grouping widgets -- Grouping widgets
--------------------- ---------------------
local buttons = wibox.widget { local buttons = wibox.widget({
{ {
reboot, reboot,
shutdown, shutdown,
spacing = dpi(8), spacing = dpi(8),
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
}, },
top = 10, top = 10,
left = 57, left = 57,
widget = wibox.container.margin, widget = wibox.container.margin,
} })
local name = wibox.widget { local name = wibox.widget({
{ {
user, user,
hostname, hostname,
spacing = dpi(4), spacing = dpi(4),
layout = wibox.layout.fixed.vertical, layout = wibox.layout.fixed.vertical,
}, },
left = 0, left = 0,
widget = wibox.container.margin, widget = wibox.container.margin,
} })
local uptimebox = wibox.widget { local uptimebox = wibox.widget({
{ {
{ {
uptimeosd, uptimeosd,
spacing = dpi(2), spacing = dpi(2),
layout = wibox.layout.fixed.vertical, layout = wibox.layout.fixed.vertical,
}, },
top = 3, top = 3,
bottom = 3, bottom = 3,
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
-- bg = beautiful.xcolorS1,
bg = beautiful.xcolorS0, bg = beautiful.xcolorS0,
shape = helpers.ui.rrect(7), shape = helpers.ui.rrect(7),
widget = wibox.container.background, widget = wibox.container.background,
} })
-- The Profile Widget -- The Profile Widget
return wibox.widget { return wibox.widget({
{ {
{ {
pfp, pfp,
uptimebox, uptimebox,
--battery,
spacing = dpi(20), spacing = dpi(20),
layout = wibox.layout.fixed.vertical, layout = wibox.layout.fixed.vertical,
}, },
@ -174,13 +163,13 @@ return wibox.widget {
}, },
{ {
{ {
name, name,
buttons, buttons,
layout = wibox.layout.fixed.vertical, layout = wibox.layout.fixed.vertical,
}, },
top = 30, top = 30,
layout = wibox.container.margin, layout = wibox.container.margin,
}, },
spacing = dpi(30), spacing = dpi(30),
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
} })

View file

@ -170,7 +170,7 @@ local coordinates = user_vars.widget.weather.coordinates
local show_hourly_forecast = true local show_hourly_forecast = true
local show_daily_forecast = true local show_daily_forecast = true
local units = "metric" local units = "imperial"
local url = ( local url = (
"https://api.openweathermap.org/data/2.5/onecall" "https://api.openweathermap.org/data/2.5/onecall"

View file

@ -1,5 +1,5 @@
require "ui.popups" require("ui.popups")
require "ui.notif-panel" require("ui.notif-panel")
require "ui.info-panel" require("ui.info-panel")
require "ui.top-panel" require("ui.top-panel")
require "ui.titlebar" require("ui.titlebar")

View file

@ -7,283 +7,255 @@ local naughty = require("naughty")
local rubato = require("lib.rubato") local rubato = require("lib.rubato")
local dpi = beautiful.xresources.apply_dpi local dpi = beautiful.xresources.apply_dpi
local notifs_text = wibox.widget { local notifs_text = wibox.widget({
font = beautiful.font .. " Bold 20", font = beautiful.font .. " Bold 20",
markup = "Notifications", markup = "Notifications",
halign = "center", halign = "center",
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
} })
local notifs_clear = wibox.widget { local notifs_clear = wibox.widget({
markup = "<span foreground='" .. beautiful.xcolor10 .. "'> </span>", markup = "<span foreground='" .. beautiful.xcolor10 .. "'> </span>",
font = beautiful.font_name .. " Bold 21", font = beautiful.font_name .. " Bold 21",
align = "center", align = "center",
valign = "center", valign = "center",
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
} })
notifs_clear:buttons(gears.table.join(awful.button({}, 1, function() notifs_clear:buttons(gears.table.join(awful.button({}, 1, function()
_G.notif_center_reset_notifs_container() _G.Notif_center_reset_notifs_container()
end))) end)))
helpers.ui.add_hover_cursor(notifs_clear, "hand2") helpers.ui.add_hover_cursor(notifs_clear, "hand2")
local notifs_empty = wibox.widget { local notifs_empty = wibox.widget({
{ {
nil, nil,
{ {
nil, nil,
{ {
markup = "<span foreground='" .. beautiful.xcolorT2 .. "'>Nothing Here!</span>", markup = "<span foreground='" .. beautiful.xcolorT2 .. "'>Nothing Here!</span>",
font = beautiful.font .. " Bold 17", font = beautiful.font .. " Bold 17",
align = "center", align = "center",
valign = "center", valign = "center",
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
}, },
layout = wibox.layout.align.vertical, layout = wibox.layout.align.vertical,
}, },
layout = wibox.layout.align.horizontal, layout = wibox.layout.align.horizontal,
}, },
forced_height = 730, forced_height = 730,
widget = wibox.container.background, widget = wibox.container.background,
bg = beautiful.xcolorS0, bg = beautiful.xcolorS0,
shape = helpers.ui.rrect(8), shape = helpers.ui.rrect(8),
} })
local notifs_container = wibox.widget { local notifs_container = wibox.widget({
spacing = 10, spacing = 10,
spacing_widget = { spacing_widget = {
{ {
shape = helpers.ui.rrect(8), shape = helpers.ui.rrect(8),
widget = wibox.container.background, widget = wibox.container.background,
}, },
top = 2, top = 2,
bottom = 2, bottom = 2,
left = 6, left = 6,
right = 6, right = 6,
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
forced_width = 320, forced_width = 320,
forced_height = 730, --430, --Use it like in notifs_empty else it will look weird forced_height = 730, --Use it like in notifs_empty else it will look weird
layout = wibox.layout.fixed.vertical, layout = wibox.layout.fixed.vertical,
} })
local remove_notifs_empty = true local remove_notifs_empty = true
notif_center_reset_notifs_container = function() Notif_center_reset_notifs_container = function()
notifs_container:reset(notifs_container) notifs_container:reset(notifs_container)
notifs_container:insert(1, notifs_empty) notifs_container:insert(1, notifs_empty)
remove_notifs_empty = true remove_notifs_empty = true
end end
notif_center_remove_notif = function(box) Notif_center_remove_notif = function(box)
notifs_container:remove_widgets(box) notifs_container:remove_widgets(box)
if #notifs_container.children == 0 then if #notifs_container.children == 0 then
notifs_container:insert(1, notifs_empty) notifs_container:insert(1, notifs_empty)
remove_notifs_empty = true remove_notifs_empty = true
end end
end end
local create_notif = function(icon, n, width) local create_notif = function(icon, n)
local time = os.date "%H:%M" local time = os.date("%H:%M")
local box = {} local box = {}
box = wibox.widget { box = wibox.widget({
{ {
{ {
{ {
{ {
image = icon, image = icon,
resize = true, resize = true,
clip_shape = helpers.ui.rrect(8), clip_shape = helpers.ui.rrect(8),
halign = "center", halign = "center",
valign = "center", valign = "center",
widget = wibox.widget.imagebox, widget = wibox.widget.imagebox,
}, },
strategy = "exact", strategy = "exact",
height = 50, height = 50,
width = 50, width = 50,
widget = wibox.container.constraint, widget = wibox.container.constraint,
}, },
{ {
{ {
nil, nil,
{ {
{ {
{ {
step_function = wibox.container.scroll.step_functions.waiting_nonlinear_back_and_forth, step_function = wibox.container.scroll.step_functions.waiting_nonlinear_back_and_forth,
speed = 50, speed = 50,
{ {
markup = n.title, markup = n.title,
font = beautiful.font .. " Bold 9", font = beautiful.font .. " Bold 9",
align = "left", align = "left",
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
}, },
forced_width = 140, forced_width = 140,
widget = wibox.container.scroll.horizontal, widget = wibox.container.scroll.horizontal,
}, },
nil, nil,
{ {
markup = "<span foreground='" .. beautiful.xcolorT2 .. "'>" .. time .. "</span>", markup = "<span foreground='" .. beautiful.xcolorT2 .. "'>" .. time .. "</span>",
align = "right", align = "right",
valign = "bottom", valign = "bottom",
font = beautiful.font .. " Bold 10", font = beautiful.font .. " Bold 10",
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
}, },
expand = "none", expand = "none",
layout = wibox.layout.align.horizontal, layout = wibox.layout.align.horizontal,
}, },
{ {
step_function = wibox.container.scroll.step_functions.waiting_nonlinear_back_and_forth, step_function = wibox.container.scroll.step_functions.waiting_nonlinear_back_and_forth,
speed = 50, speed = 50,
{ {
markup = n.message, markup = n.message,
align = "left", align = "left",
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
}, },
forced_width = 165, forced_width = 165,
widget = wibox.container.scroll.horizontal, widget = wibox.container.scroll.horizontal,
}, },
spacing = 3, spacing = 3,
layout = wibox.layout.fixed.vertical, layout = wibox.layout.fixed.vertical,
}, },
expand = "none", expand = "none",
layout = wibox.layout.align.vertical, layout = wibox.layout.align.vertical,
}, },
left = 17, left = 17,
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
layout = wibox.layout.align.horizontal, layout = wibox.layout.align.horizontal,
}, },
margins = 15, margins = 15,
widget = wibox.container.margin, widget = wibox.container.margin,
}, },
forced_height = 85, forced_height = 85,
widget = wibox.container.background, widget = wibox.container.background,
bg = beautiful.xcolorS0, bg = beautiful.xcolorS0,
shape = helpers.ui.rrect(8), shape = helpers.ui.rrect(8),
} })
box:buttons(gears.table.join(awful.button({}, 1, function() box:buttons(gears.table.join(awful.button({}, 1, function()
_G.notif_center_remove_notif(box) _G.Notif_center_remove_notif(box)
end))) end)))
return box return box
end end
notifs_container:buttons(gears.table.join( notifs_container:buttons(gears.table.join(
awful.button({}, 4, nil, function() awful.button({}, 4, nil, function()
if #notifs_container.children == 1 then if #notifs_container.children == 1 then
return return
end end
notifs_container:insert(1, notifs_container.children[#notifs_container.children]) notifs_container:insert(1, notifs_container.children[#notifs_container.children])
notifs_container:remove(#notifs_container.children) notifs_container:remove(#notifs_container.children)
end), end),
awful.button({}, 5, nil, function() awful.button({}, 5, nil, function()
if #notifs_container.children == 1 then if #notifs_container.children == 1 then
return return
end end
notifs_container:insert(#notifs_container.children + 1, notifs_container.children[1]) notifs_container:insert(#notifs_container.children + 1, notifs_container.children[1])
notifs_container:remove(1) notifs_container:remove(1)
end) end)
)) ))
notifs_container:insert(1, notifs_empty) notifs_container:insert(1, notifs_empty)
naughty.connect_signal("request::display", function(n) naughty.connect_signal("request::display", function(n)
if #notifs_container.children == 1 and remove_notifs_empty then if #notifs_container.children == 1 and remove_notifs_empty then
notifs_container:reset(notifs_container) notifs_container:reset(notifs_container)
remove_notifs_empty = false remove_notifs_empty = false
end end
local appicon = n.icon or n.app_icon local appicon = n.icon or n.app_icon
if not appicon then if not appicon then
appicon = beautiful.pfp --notification_icon appicon = beautiful.pfp --notification_icon
end end
notifs_container:insert(1, create_notif(appicon, n, width)) notifs_container:insert(1, create_notif(appicon, n))
end) end)
local notifs = wibox.widget { local notifs = wibox.widget({
{ {
{ {
{ {
nil, nil,
notifs_text, notifs_text,
notifs_clear, notifs_clear,
expand = "none", expand = "none",
layout = wibox.layout.align.horizontal, layout = wibox.layout.align.horizontal,
}, },
left = 5, left = 5,
right = 5, right = 5,
top = 7, top = 7,
bottom = 7, bottom = 7,
layout = wibox.container.margin, layout = wibox.container.margin,
}, },
widget = wibox.container.background, widget = wibox.container.background,
bg = beautiful.xcolorS0, bg = beautiful.xcolorS0,
shape = helpers.ui.rrect(8), shape = helpers.ui.rrect(8),
}, },
notifs_container, notifs_container,
spacing = 20, spacing = 20,
layout = wibox.layout.fixed.vertical, layout = wibox.layout.fixed.vertical,
} })
local actions = wibox.widget { local actions = wibox.widget({
{ {
{ {
-- { {
{ widget = require("ui.notif-panel.widgets.vol_slider"),
widget = require "ui.notif-panel.widgets.vol_slider", },
}, {
{ widget = require("ui.notif-panel.widgets.mic_slider"),
widget = require "ui.notif-panel.widgets.mic_slider", },
}, layout = wibox.layout.flex.vertical,
layout = wibox.layout.flex.vertical, spacing = 1,
spacing = 1, },
-- }, widget = wibox.container.margin,
-- { top = 20,
-- { widget = require "ui.widgets.wifi" }, bottom = 20,
-- layout = wibox.layout.flex.horizontal, left = 35,
-- spacing = 15, right = 35,
-- }, },
-- layout = wibox.layout.flex.vertical, forced_height = 120,
-- spacing = 30, widget = wibox.container.background,
}, bg = beautiful.xcolorS0,
widget = wibox.container.margin, shape = helpers.ui.rrect(8),
top = 20, })
bottom = 20, --
left = 35,
right = 35,
},
forced_height = 120,
widget = wibox.container.background,
bg = beautiful.xcolorS0,
shape = helpers.ui.rrect(8),
}
--local action = awful.popup { -- Replacing it with A wibar
-- widget = {
-- widget = wibox.container.margin,
-- margins = 30,
-- forced_width = 355,
-- forced_height = 690,
-- {
-- layout = wibox.layout.fixed.vertical,
-- notifs,
-- actions,
-- },
-- },
-- placement = function(c)
-- (awful.placement.left)(c, { margins = { bottom = 250, right = 60 } })
-- end,
-- ontop = true,
-- visible = false,
-- bg = beautiful.bg_normal,
--}
-- Sidebar -- Sidebar
local action = wibox { local action = wibox({
visible = false, visible = false,
ontop = true, ontop = true,
width = dpi(410), width = dpi(410),
@ -292,53 +264,54 @@ local action = wibox {
bg = beautiful.bg_normal, bg = beautiful.bg_normal,
border_width = dpi(3), border_width = dpi(3),
border_color = beautiful.xcolorS0, border_color = beautiful.xcolorS0,
} })
-- Sidebar widget setup -- Sidebar widget setup
action : setup { action:setup({
{ {
notifs, notifs,
actions, actions,
spacing = dpi(20), spacing = dpi(20),
layout = wibox.layout.fixed.vertical, layout = wibox.layout.fixed.vertical,
}, },
margins = { top = dpi(20), bottom = dpi(20), left = dpi(20), right = dpi(20)}, margins = { top = dpi(20), bottom = dpi(20), left = dpi(20), right = dpi(20) },
widget = wibox.container.margin, widget = wibox.container.margin,
} })
-- Slide animation -- Slide animation
local slide = rubato.timed { local slide = rubato.timed({
pos = awful.screen.focused().geometry.x - awful.screen.focused().geometry.width, --dpi (1900), pos = awful.screen.focused().geometry.x - awful.screen.focused().geometry.width,
rate = 60, rate = 60,
intro = 0.2, intro = 0.2,
duration = 0.4, duration = 0.4,
subscribed = function(pos) subscribed = function(pos)
action.x = awful.screen.focused().geometry.x - pos action.x = awful.screen.focused().geometry.x - pos
end end,
} })
-- Timer of action's death -- Timer of action's death
action.timer = gears.timer { action.timer = gears.timer({
timeout = 0.5, timeout = 0.5,
single_shot = true, single_shot = true,
callback = function() callback = function()
action.visible = not action.visible action.visible = not action.visible
end end,
} })
action.shape = function(cr,w,h) --Rounded Corners action.shape = function(cr, w, h) --Rounded Corners
gears.shape.rounded_rect(cr,w,h,14) gears.shape.rounded_rect(cr, w, h, 14)
end end
-- Toggle function -- Toggle function
action.toggle = function() action.toggle = function()
if action.visible then if action.visible then
--awesome.emit_signal("widget::update_vol")
slide.target = awful.screen.focused().geometry.x - awful.screen.focused().geometry.width slide.target = awful.screen.focused().geometry.x - awful.screen.focused().geometry.width
action.timer:start() action.timer:start()
else else
awesome.emit_signal("widget::update_vol") awesome.emit_signal("widget::update_vol")
awesome.emit_signal("widget::update_mic") awesome.emit_signal("widget::update_mic")
slide.target = awful.screen.focused().geometry.x - awful.screen.focused().geometry.width + action.width + dpi(25) --dpi(1465) slide.target = awful.screen.focused().geometry.x
- awful.screen.focused().geometry.width
+ action.width
+ dpi(25)
action.visible = not action.visible action.visible = not action.visible
end end
end end
@ -349,5 +322,3 @@ awesome.connect_signal("action::toggle", function()
end) end)
return action return action

View file

@ -4,32 +4,32 @@ local wibox = require("wibox")
local beautiful = require("beautiful") local beautiful = require("beautiful")
local helpers = require("helpers") local helpers = require("helpers")
local slider = wibox.widget { local slider = wibox.widget({
bar_shape = helpers.ui.rrect(9), bar_shape = helpers.ui.rrect(9),
bar_height = 6, bar_height = 6,
bar_color = beautiful.bg_focus, bar_color = beautiful.bg_focus,
bar_active_color = beautiful.xcolor7, bar_active_color = beautiful.xcolor7,
handle_shape = gears.shape.circle, handle_shape = gears.shape.circle,
handle_color = beautiful.xcolor7, handle_color = beautiful.xcolor7,
handle_width = 12, handle_width = 12,
value = 25, value = 25,
widget = wibox.widget.slider, widget = wibox.widget.slider,
} })
helpers.ui.add_hover_cursor(slider, "hand1") helpers.ui.add_hover_cursor(slider, "hand1")
local bri_slider = wibox.widget { local bri_slider = wibox.widget({
{ {
markup = helpers.ui.colorize_text("", beautiful.xcolor7), markup = helpers.ui.colorize_text("", beautiful.xcolor7),
font = beautiful.font .. " 14", font = beautiful.font .. " 14",
align = "center", align = "center",
valign = "center", valign = "center",
widget = wibox.widget.textbox(), widget = wibox.widget.textbox(),
}, },
slider, slider,
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
spacing = 0, spacing = 0,
} })
awful.spawn.easy_async_with_shell( awful.spawn.easy_async_with_shell(
"brightnessctl | grep -i 'current' | awk '{ print $4}' | tr -d \"(%)\"", "brightnessctl | grep -i 'current' | awk '{ print $4}' | tr -d \"(%)\"",

View file

@ -5,60 +5,60 @@ local beautiful = require("beautiful")
local helpers = require("helpers") local helpers = require("helpers")
local dpi = beautiful.xresources.apply_dpi local dpi = beautiful.xresources.apply_dpi
local user_vars = require "user_variables" local user_vars = require("user_variables")
local microphone = user_vars.widget.mic.name local microphone = user_vars.widget.mic.name
local slider = wibox.widget { local slider = wibox.widget({
bar_shape = helpers.ui.rrect(9), bar_shape = helpers.ui.rrect(9),
bar_height = 6, bar_height = 6,
bar_color = beautiful.xcolorbase, bar_color = beautiful.xcolorbase,
bar_active_color = beautiful.xcolor2, bar_active_color = beautiful.xcolor2,
handle_shape = gears.shape.circle, handle_shape = gears.shape.circle,
handle_color = beautiful.xcolor2, handle_color = beautiful.xcolor2,
handle_width = 12, handle_width = 12,
value = 75, value = 75,
forced_width = dpi(239), forced_width = dpi(239),
widget = wibox.widget.slider, widget = wibox.widget.slider,
} })
local osd_value = wibox.widget { local osd_value = wibox.widget({
text = "0%", text = "0%",
font = beautiful.font_name.."10", font = beautiful.font_name .. "10",
widget = wibox.widget.textbox(), widget = wibox.widget.textbox(),
} })
local icon = wibox.widget { local icon = wibox.widget({
markup = helpers.ui.colorize_text("", beautiful.xcolor2), markup = helpers.ui.colorize_text("󰍬", beautiful.xcolor2),
font = beautiful.font_name.."14", font = beautiful.font_name .. "14",
align = "center", align = "center",
valign = "center", valign = "center",
widget = wibox.widget.textbox(), widget = wibox.widget.textbox(),
} })
local function get_val() local function get_val()
awesome.connect_signal("signal::mic", function(vol, muted) awesome.connect_signal("signal::mic", function(_, muted)
if muted then icon.markup = "<span foreground='"..beautiful.xcolor2.."'></span>" icon.font = beautiful.font_name.."14" else if muted then
--v_slider.color = beautiful.xcolor2 icon.markup = "<span foreground='" .. beautiful.xcolor2 .. "'>󰍭</span>"
icon.markup = "<span foreground='"..beautiful.xcolor2.."'></span>" icon.font = beautiful.font_name.."17" icon.font = beautiful.font_name .. "14"
else
icon.markup = "<span foreground='" .. beautiful.xcolor2 .. "'>󰍬</span>"
icon.font = beautiful.font_name .. "17"
end end
end) end)
end end
get_val() get_val()
icon:buttons(gears.table.join( icon:buttons(gears.table.join(awful.button({}, 1, function()
awful.button({ }, 1, function() local script = [[
local script = [[ pamixer --source ]] .. microphone .. [[ -t
pamixer --source ]] ..microphone.. [[ -t
]] ]]
awful.spawn(script, false) awful.spawn(script, false)
awesome.emit_signal("widget::update_mic") awesome.emit_signal("widget::update_mic")
end) end)))
))
slider:buttons(gears.table.join( slider:buttons(gears.table.join(
awful.button({}, 4, nil, function() awful.button({}, 4, nil, function()
if slider:get_value() > 100 then if slider:get_value() > 100 then
slider:set_value(100) slider:set_value(100)
return return
@ -77,58 +77,46 @@ slider:buttons(gears.table.join(
helpers.ui.add_hover_cursor(slider, "hand1") helpers.ui.add_hover_cursor(slider, "hand1")
helpers.ui.add_hover_cursor(icon, "hand2") helpers.ui.add_hover_cursor(icon, "hand2")
local mic_slider = wibox.widget { local mic_slider = wibox.widget({
{ {
{ {
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
icon, icon,
}, },
left = 0, left = 0,
right = dpi(14), right = dpi(14),
top = 5, top = 5,
bottom = 5, bottom = 5,
layout = wibox.container.margin layout = wibox.container.margin,
}, },
slider, slider,
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
{ {
{ {
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
osd_value, osd_value,
}, },
left = dpi(3), left = dpi(3),
right = 0, right = 0,
top = 0, top = 0,
bottom = 0, bottom = 0,
layout = wibox.container.margin layout = wibox.container.margin,
}, },
-- layout = wibox.layout.fixed.horizontal, })
-- spacing = 0,
}
local update_microphone = function() -- Sets the Volume Correct local update_microphone = function() -- Sets the Volume Correct
awful.spawn.easy_async_with_shell("pamixer --source " ..microphone.. " --get-volume", function(stdout) awful.spawn.easy_async_with_shell("pamixer --source " .. microphone .. " --get-volume", function(stdout)
slider.value = tonumber(stdout:match("%d+")) slider.value = tonumber(stdout:match("%d+"))
end) end)
end end
awesome.connect_signal("widget::update_mic", function() awesome.connect_signal("widget::update_mic", function()
update_microphone() update_microphone()
end) end)
--slider:connect_signal("property::value", function(_, vol)
-- awful.spawn("pamixer --set-volume ".. vol, false)
--end)
--awful.spawn.easy_async_with_shell("pamixer --get-volume", function(stdout)
-- local value = string.gsub(stdout, "^%s*(.-)%s*$", "%1")
-- vol_slider.value = tonumber(value)
--end)
slider:connect_signal("property::value", function(_, new_value) slider:connect_signal("property::value", function(_, new_value)
-- vol_slider.value = new_value awful.spawn("pamixer --source " .. microphone .. " --set-volume " .. new_value, false)
awful.spawn("pamixer --source " ..microphone.. " --set-volume " .. new_value, false) local volume_level = slider:get_value()
local volume_level = slider:get_value() osd_value.text = volume_level .. "%"
osd_value.text = volume_level .. "%"
end) end)
return mic_slider return mic_slider

View file

@ -5,57 +5,55 @@ local beautiful = require("beautiful")
local helpers = require("helpers") local helpers = require("helpers")
local dpi = beautiful.xresources.apply_dpi local dpi = beautiful.xresources.apply_dpi
local slider = wibox.widget { local slider = wibox.widget({
bar_shape = helpers.ui.rrect(9), bar_shape = helpers.ui.rrect(9),
bar_height = 6, bar_height = 6,
bar_color = beautiful.xcolorbase, bar_color = beautiful.xcolorbase,
bar_active_color = beautiful.xcolor2, bar_active_color = beautiful.xcolor2,
handle_shape = gears.shape.circle, handle_shape = gears.shape.circle,
handle_color = beautiful.xcolor2, handle_color = beautiful.xcolor2,
handle_width = 12, handle_width = 12,
value = 75, value = 75,
forced_width = dpi(239), forced_width = dpi(239),
widget = wibox.widget.slider, widget = wibox.widget.slider,
} })
local osd_value = wibox.widget { local osd_value = wibox.widget({
text = "0%", text = "0%",
font = beautiful.font_name.."10", font = beautiful.font_name .. "10",
widget = wibox.widget.textbox(), widget = wibox.widget.textbox(),
} })
local icon = wibox.widget { local icon = wibox.widget({
markup = helpers.ui.colorize_text(" ", beautiful.xcolor2), markup = helpers.ui.colorize_text("󰕾 ", beautiful.xcolor2),
font = beautiful.font_name.."14", font = beautiful.font_name .. "14",
align = "center", align = "center",
valign = "center", valign = "center",
widget = wibox.widget.textbox(), widget = wibox.widget.textbox(),
} })
local function get_val() local function get_val()
awesome.connect_signal("signal::volume", function(vol, muted) awesome.connect_signal("signal::volume", function(_, muted)
if muted then icon.markup = "<span foreground='"..beautiful.xcolor2.."'>婢</span>" else if muted then
--v_slider.color = beautiful.xcolor2 icon.markup = "<span foreground='" .. beautiful.xcolor2 .. "'>󰖁</span>"
icon.markup = "<span foreground='"..beautiful.xcolor2.."'>墳</span>" else
icon.markup = "<span foreground='" .. beautiful.xcolor2 .. "'>󰕾</span>"
end end
end) end)
end end
get_val() get_val()
icon:buttons(gears.table.join( icon:buttons(gears.table.join(awful.button({}, 1, function()
awful.button({ }, 1, function() local script = [[
local script = [[
pamixer -t pamixer -t
]] ]]
awful.spawn(script, false) awful.spawn(script, false)
awesome.emit_signal("widget::update_vol") awesome.emit_signal("widget::update_vol")
end) end)))
))
slider:buttons(gears.table.join( slider:buttons(gears.table.join(
awful.button({}, 4, nil, function() awful.button({}, 4, nil, function()
if slider:get_value() > 100 then if slider:get_value() > 100 then
slider:set_value(100) slider:set_value(100)
return return
@ -74,64 +72,51 @@ slider:buttons(gears.table.join(
helpers.ui.add_hover_cursor(slider, "hand1") helpers.ui.add_hover_cursor(slider, "hand1")
helpers.ui.add_hover_cursor(icon, "hand2") helpers.ui.add_hover_cursor(icon, "hand2")
local vol_slider = wibox.widget { local vol_slider = wibox.widget({
{ {
{ {
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
icon, icon,
}, },
left = 0, left = 0,
right = dpi(14), right = dpi(14),
top = 5, top = 5,
bottom = 5, bottom = 5,
layout = wibox.container.margin layout = wibox.container.margin,
}, },
slider, slider,
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
{ {
{ {
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
osd_value, osd_value,
}, },
left = dpi(3), left = dpi(3),
right = 0, right = 0,
top = 0, top = 0,
bottom = 0, bottom = 0,
layout = wibox.container.margin layout = wibox.container.margin,
}, },
-- layout = wibox.layout.fixed.horizontal, })
-- spacing = 0,
}
local update_volume = function() -- Sets the Volume Correct local update_volume = function() -- Sets the Volume Correct
awful.spawn.easy_async_with_shell("pamixer --get-volume", function(stdout) awful.spawn.easy_async_with_shell("pamixer --get-volume", function(stdout)
slider.value = tonumber(stdout:match("%d+")) slider.value = tonumber(stdout:match("%d+"))
end) end)
end end
awesome.connect_signal("widget::update_vol", function() awesome.connect_signal("widget::update_vol", function()
update_volume() update_volume()
end) end)
awesome.connect_signal("widget::update_vol_slider", function(volume_level) awesome.connect_signal("widget::update_vol_slider", function(volume_level)
slider:set_value(volume_level) slider:set_value(volume_level)
end) end)
--slider:connect_signal("property::value", function(_, vol)
-- awful.spawn("pamixer --set-volume ".. vol, false)
--end)
--awful.spawn.easy_async_with_shell("pamixer --get-volume", function(stdout)
-- local value = string.gsub(stdout, "^%s*(.-)%s*$", "%1")
-- vol_slider.value = tonumber(value)
--end)
slider:connect_signal("property::value", function(_, new_value) slider:connect_signal("property::value", function(_, new_value)
-- vol_slider.value = new_value
awful.spawn("pamixer --set-volume " .. new_value, false) awful.spawn("pamixer --set-volume " .. new_value, false)
awesome.emit_signal("widget::update_vol_pulse") -- update_vol_pulse doesn't Update Volume Signal awesome.emit_signal("widget::update_vol_pulse") -- update_vol_pulse doesn't Update Volume Signal
local volume_level = slider:get_value() local volume_level = slider:get_value()
osd_value.text = volume_level .. "%" osd_value.text = volume_level .. "%"
end) end)
return vol_slider return vol_slider

View file

@ -1,4 +1,4 @@
require (... .. ".layout") require(... .. ".layout")
require (... .. ".notifications") require(... .. ".notifications")
require (... .. ".scratchpad") require(... .. ".scratchpad")
require (... .. ".volume") require(... .. ".volume")

View file

@ -1,119 +1,134 @@
local awful = require "awful" local awful = require("awful")
local gears = require "gears" local gears = require("gears")
local beautiful = require "beautiful" local beautiful = require("beautiful")
local wibox = require "wibox" local wibox = require("wibox")
local hotkeys_popup = require "awful.hotkeys_popup"
local ll = awful.widget.layoutlist { local keys = require("config").keys
base_layout = wibox.widget {
spacing = 5,
forced_num_cols = 4,
layout = wibox.layout.grid.vertical,
},
widget_template = {
{
{
id = 'icon_role',
forced_height = 1,
forced_width = 1,
widget = wibox.widget.imagebox,
},
margins = 15,
widget = wibox.container.margin,
},
id = 'background_role',
forced_width = 70,
forced_height = 70,
shape = gears.shape.rounded_rect,
widget = wibox.container.background,
},
}
local layout_popup = awful.popup { local ll = awful.widget.layoutlist({
widget = wibox.widget { base_layout = wibox.widget({
ll, spacing = 5,
margins = 4, --border margins (padding) forced_num_cols = 4,
widget = wibox.container.margin, layout = wibox.layout.grid.vertical,
}, }),
border_color = beautiful.border_normal, widget_template = {
bg = beautiful.bg_normal, {
border_width = beautiful.border_width, {
placement = awful.placement.centered, id = "icon_role",
ontop = true, forced_height = 1,
visible = false, forced_width = 1,
shape = gears.shape.rounded_rect widget = wibox.widget.imagebox,
} },
function gears.table.iterate_value(t, value, step_size, filter, start_at) margins = 15,
local k = gears.table.hasitem(t, value, true, start_at) widget = wibox.container.margin,
if not k then },
return id = "background_role",
end forced_width = 70,
forced_height = 70,
shape = gears.shape.rounded_rect,
widget = wibox.container.background,
},
})
step_size = step_size or 1 local layout_popup = awful.popup({
local new_key = gears.math.cycle(#t, k + step_size) widget = wibox.widget({
ll,
margins = 4, --border margins (padding)
widget = wibox.container.margin,
}),
border_color = beautiful.border_normal,
bg = beautiful.bg_normal,
border_width = beautiful.border_width,
placement = awful.placement.centered,
ontop = true,
visible = false,
shape = gears.shape.rounded_rect,
})
function gears.table.iterate_value(t, value, step_size, filter, _)
local k = gears.table.hasitem(t, value)
if not k then
return
end
if filter and not filter(t[new_key]) then step_size = step_size or 1
for i = 1, #t do local new_key = gears.math.cycle(#t, k + step_size)
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 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
end end
-- Timer for Death of PopUp -- Timer for Death of PopUp
layout_popup.timer = gears.timer { layout_popup.timer = gears.timer({
timeout = 0.8, timeout = 0.8,
--autostart = true, --autostart = true,
single_shot = true, single_shot = true,
callback = function() callback = function()
layout_popup.visible = false layout_popup.visible = false
end end,
} })
function layout_popup.changed() function layout_popup.changed()
layout_popup.visible = true layout_popup.visible = true
if not layout_popup.visible then layout_popup.timer:start() else if not layout_popup.visible then
layout_popup.timer:start()
else
layout_popup.timer:again() layout_popup.timer:again()
end end
end end
-- Mouse Support -- Disable if not Wanted -- -- Mouse Support -- Disable if not Wanted --
layout_popup:connect_signal("mouse::enter", function() layout_popup.timer:stop() end) layout_popup:connect_signal("mouse::enter", function()
layout_popup:connect_signal("mouse::leave", function() layout_popup.timer:start() end) layout_popup.timer:stop()
end)
layout_popup:connect_signal("mouse::leave", function()
layout_popup.timer:start()
end)
-- Make sure you remove the default Mod4+Space and Mod4+Shift+Space -- Make sure you remove the default Mod4+Space and Mod4+Shift+Space
-- keybindings before adding this. -- keybindings before adding this.
awful.keygrabber { awful.keygrabber({
start_callback = function() layout_popup.visible = true end, start_callback = function()
stop_callback = function() layout_popup.visible = false end, layout_popup.visible = true
export_keybindings = true, end,
release_event = 'release', stop_callback = function()
stop_key = {'Escape', 'Super_L', 'Super_R'}, layout_popup.visible = false
keybindings = { end,
{{ modkey } , ' ' , function() export_keybindings = true,
--layout_popup.timer:again() release_event = "release",
awful.layout.set( stop_key = { "Escape", "Super_L", "Super_R" },
gears.table.iterate_value(ll.layouts, ll.current_layout, 1), keybindings = {
--layout_popup.timer:start() {
layout_popup.changed() { keys.mod },
) " ",
function()
end}, --layout_popup.timer:again()
awful.layout.set(
{{ modkey, 'Shift' } , ' ' , function() gears.table.iterate_value(ll.layouts, ll.current_layout, 1),
--layout_popup.timer:again() --layout_popup.timer:start()
awful.layout.set( layout_popup.changed()
gears.table.iterate_value(ll.layouts, ll.current_layout, -1), )
--layout_popup.timer:start() end,
layout_popup.changed() },
)
end},
}
}
{
{ keys.mod, "Shift" },
" ",
function()
--layout_popup.timer:again()
awful.layout.set(
gears.table.iterate_value(ll.layouts, ll.current_layout, -1),
--layout_popup.timer:start()
layout_popup.changed()
)
end,
},
},
})

View file

@ -55,9 +55,9 @@ naughty.connect_signal("request::display", function(n)
--- table of icons --- table of icons
local app_icons = { local app_icons = {
["firefox"] = { icon = "" }, ["firefox"] = { icon = "" },
["discord"] = { icon = "" }, ["discord"] = { icon = "󰙯" },
["music"] = { icon = "" }, ["music"] = { icon = "󰝚" },
["screenshot tool"] = { icon = "" }, ["screenshot tool"] = { icon = "󰊓" },
} }
local app_icon = nil local app_icon = nil
@ -66,7 +66,7 @@ naughty.connect_signal("request::display", function(n)
if app_icons[tolow(n.app_name)] then if app_icons[tolow(n.app_name)] then
app_icon = app_icons[tolow(n.app_name)].icon app_icon = app_icons[tolow(n.app_name)].icon
else else
app_icon = "" app_icon = "󰂚"
end end
local app_icon_n = wibox.widget({ local app_icon_n = wibox.widget({
@ -121,30 +121,27 @@ naughty.connect_signal("request::display", function(n)
layout = wibox.layout.stack, layout = wibox.layout.stack,
}) })
local app_name = wibox.widget { local app_name = wibox.widget({
font = beautiful.font_name.."Bold 12", font = beautiful.font_name .. "Bold 12",
text = n.app_name:gsub("^%l", string.upper), text = n.app_name:gsub("^%l", string.upper),
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
} })
local dismiss = wibox.widget { local dismiss = wibox.widget({
{ {
font = beautiful.font_name.."Bold 10", font = beautiful.font_name .. "Bold 10",
markup = helpers.ui.colorize_text("", beautiful.xcolor2), markup = helpers.ui.colorize_text("", beautiful.xcolor2),
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
valign = center, valign = "center",
align = center, align = "center",
}, },
margins = dpi(4), margins = dpi(4),
widget = wibox.container.margin, widget = wibox.container.margin,
} })
dismiss:buttons(gears.table.join( dismiss:buttons(gears.table.join(awful.button({}, 1, function()
awful.button({ }, 1, function()
n:destroy(naughty.notification_closed_reason.dismissed_by_user) n:destroy(naughty.notification_closed_reason.dismissed_by_user)
end) end)))
))
local timeout_arc = wibox.widget({ local timeout_arc = wibox.widget({
widget = wibox.container.arcchart, widget = wibox.container.arcchart,
@ -173,7 +170,7 @@ naughty.connect_signal("request::display", function(n)
dismiss, dismiss,
}) })
local title2 = wibox.widget.textbox() local title2 = wibox.widget.textbox()
title2.font = beautiful.font_name.."Bold 11" title2.font = beautiful.font_name .. "Bold 11"
title2.text = n.title title2.text = n.title
local title = wibox.widget({ local title = wibox.widget({
@ -185,7 +182,7 @@ naughty.connect_signal("request::display", function(n)
}) })
local message2 = wibox.widget.textbox() local message2 = wibox.widget.textbox()
message2.font = beautiful.font_name.."11" message2.font = beautiful.font_name .. "11"
message2.text = n.message message2.text = n.message
local message = wibox.widget({ local message = wibox.widget({
@ -207,7 +204,7 @@ naughty.connect_signal("request::display", function(n)
{ {
{ {
id = "text_role", id = "text_role",
font = "FiraCode Nerd Font 10", font = beautiful.font_name .. "10",
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
}, },
left = dpi(6), left = dpi(6),
@ -232,8 +229,6 @@ naughty.connect_signal("request::display", function(n)
notification = n, notification = n,
type = "notification", type = "notification",
cursor = "hand2", cursor = "hand2",
--- For antialiasing: The real shape is set in widget_template
--shape = gears.shape.rectangle,
shape = helpers.ui.rrect(12), shape = helpers.ui.rrect(12),
border_color = beautiful.xcolorS0, border_color = beautiful.xcolorS0,
border_width = dpi(3), border_width = dpi(3),
@ -299,7 +294,7 @@ naughty.connect_signal("request::display", function(n)
}) })
--- Don't destroy the notification on click --- --- Don't destroy the notification on click ---
widget.buttons = {} widget.buttons = {}
--- Disables Hand Cursor in Whole wibox --- --- Disables Hand Cursor in Whole wibox ---
helpers.ui.add_hover_cursor(widget, "left_ptr") helpers.ui.add_hover_cursor(widget, "left_ptr")
@ -307,13 +302,12 @@ naughty.connect_signal("request::display", function(n)
--- Adds Close Cursor on Close Sign --- --- Adds Close Cursor on Close Sign ---
helpers.ui.add_hover_cursor(dismiss, "hand2") helpers.ui.add_hover_cursor(dismiss, "hand2")
local anim = animation:new({ local anim = animation:new({
duration = n.timeout, duration = n.timeout,
target = 100, target = 100,
easing = animation.easing.linear, easing = animation.easing.linear,
reset_on_stop = false, reset_on_stop = false,
update = function(self, pos) update = function(_, pos)
timeout_arc.value = pos timeout_arc.value = pos
end, end,
}) })
@ -342,10 +336,10 @@ naughty.connect_signal("request::display", function(n)
anim:start() anim:start()
--- Destroy popups notifs if dont_disturb mode is on --- Destroy popups notifs if dont_disturb mode is on
---@diagnostic disable-next-line: undefined-field
if _G.dnd_state then if _G.dnd_state then
naughty.destroy_all_notifications(nil, 1) naughty.destroy_all_notifications(nil, 1)
end end
end) end)
require(... .. ".error") require(... .. ".error")
--require(... .. ".playerctl")

View file

@ -1,7 +1,8 @@
local naughty = require("naughty") local naughty = require("naughty")
local playerctl_daemon = require("signals.playerctl") local playerctl_daemon = require("signals.playerctl")
local beautiful = require("beautiful") local beautiful = require("beautiful")
playerctl_daemon:connect_signal("metadata", function(_, title, artist, album_path, album, new, player_name)
playerctl_daemon:connect_signal("metadata", function(_, title, artist, album_path, _, new, _)
if album_path == "" then -- Sets Image for Notification -- if album_path == "" then -- Sets Image for Notification --
album_path = beautiful.music album_path = beautiful.music
end end

View file

@ -3,35 +3,35 @@ local rubato = require("lib.rubato") -- Totally optional, only required if you a
-- These are example rubato tables. You can use one for just y, just x, or both. -- These are example rubato tables. You can use one for just y, just x, or both.
-- The duration and easing is up to you. Please check out the rubato docs to learn more. -- The duration and easing is up to you. Please check out the rubato docs to learn more.
local anim_y = rubato.timed { local anim_y = rubato.timed({
pos = -1000, pos = -1000,
rate = 60, rate = 60,
--easing = rubato.quadratic, --easing = rubato.quadratic,
intro = 0.2, intro = 0.2,
duration = 0.4, duration = 0.4,
awestore_compat = true -- This option must be set to true. awestore_compat = true, -- This option must be set to true.
} })
local anim_x = rubato.timed { local anim_x = rubato.timed({
pos = 1720, pos = 1720,
rate = 60, rate = 60,
easing = rubato.quadratic, easing = rubato.quadratic,
intro = 0.1, intro = 0.1,
duration = 0.3, duration = 0.3,
awestore_compat = true -- This option must be set to true. awestore_compat = true, -- This option must be set to true.
} })
local term_scratch = bling.module.scratchpad { local term_scratch = bling.module.scratchpad({
command = "alacritty --class spad", -- How to spawn the scratchpad command = "alacritty --class spad", -- How to spawn the scratchpad
rule = { instance = "spad" }, -- The rule that the scratchpad will be searched by rule = { instance = "spad" }, -- The rule that the scratchpad will be searched by
sticky = true, -- Whether the scratchpad should be sticky sticky = true, -- Whether the scratchpad should be sticky
autoclose = true, -- Whether it should hide itself when losing focus autoclose = true, -- Whether it should hide itself when losing focus
floating = true, -- Whether it should be floating (MUST BE TRUE FOR ANIMATIONS) floating = true, -- Whether it should be floating (MUST BE TRUE FOR ANIMATIONS)
geometry = {x=456, y=33, height=600, width=1000}, -- The geometry in a floating state geometry = { x = 456, y = 33, height = 600, width = 1000 }, -- The geometry in a floating state
reapply = true, -- Whether all those properties should be reapplied on every new opening of the scratchpad (MUST BE TRUE FOR ANIMATIONS) reapply = true, -- Whether all those properties should be reapplied on every new opening of the scratchpad (MUST BE TRUE FOR ANIMATIONS)
dont_focus_before_close = false, -- When set to true, the scratchpad will be closed by the toggle function regardless of whether its focused or not. When set to false, the toggle function will first bring the scratchpad into focus and only close it on a second call dont_focus_before_close = false, -- When set to true, the scratchpad will be closed by the toggle function regardless of whether its focused or not. When set to false, the toggle function will first bring the scratchpad into focus and only close it on a second call
rubato = {y = anim_y} -- Optional. This is how you can pass in the rubato tables for animations. If you don't want animations, you can ignore this option. rubato = { y = anim_y }, -- Optional. This is how you can pass in the rubato tables for animations. If you don't want animations, you can ignore this option.
} })
awesome.connect_signal("scratchpad::toggle", function() awesome.connect_signal("scratchpad::toggle", function()
term_scratch:toggle() term_scratch:toggle()
end) end)

View file

@ -4,13 +4,13 @@ local beautiful = require("beautiful")
local xresources = require("beautiful.xresources") local xresources = require("beautiful.xresources")
local dpi = xresources.apply_dpi local dpi = xresources.apply_dpi
local wibox = require("wibox") local wibox = require("wibox")
local helpers = require ("helpers") local helpers = require("helpers")
--- Volume OSD --- Volume OSD
--- ~~~~~~~~~~ --- ~~~~~~~~~~
local icon = wibox.widget({ local icon = wibox.widget({
{ {
id = 'icon2', id = "icon2",
image = beautiful.volume_on, image = beautiful.volume_on,
resize = true, resize = true,
widget = wibox.widget.imagebox, widget = wibox.widget.imagebox,
@ -61,7 +61,7 @@ local slider_osd = wibox.widget({
local vol_osd_slider = slider_osd.vol_osd_slider local vol_osd_slider = slider_osd.vol_osd_slider
vol_osd_slider:buttons(gears.table.join( vol_osd_slider:buttons(gears.table.join(
awful.button({}, 4, nil, function() awful.button({}, 4, nil, function()
if vol_osd_slider:get_value() > 100 then if vol_osd_slider:get_value() > 100 then
vol_osd_slider:set_value(100) vol_osd_slider:set_value(100)
return return
@ -79,14 +79,14 @@ vol_osd_slider:buttons(gears.table.join(
helpers.ui.add_hover_cursor(vol_osd_slider, "hand1") helpers.ui.add_hover_cursor(vol_osd_slider, "hand1")
local update_volume = function() -- Sets the Volume Correct local update_volume = function() -- Sets the Volume Correct
awful.spawn.easy_async_with_shell("pamixer --get-volume", function(stdout) awful.spawn.easy_async_with_shell("pamixer --get-volume", function(stdout)
vol_osd_slider.value = tonumber(stdout:match("%d+")) vol_osd_slider.value = tonumber(stdout:match("%d+"))
end) end)
end end
awesome.connect_signal("widget::update_vol", function() awesome.connect_signal("widget::update_vol", function()
update_volume() update_volume()
end) end)
update_volume() update_volume()
vol_osd_slider:connect_signal("property::value", function(_, new_value) vol_osd_slider:connect_signal("property::value", function(_, new_value)
@ -121,7 +121,7 @@ local volume_osd_height = dpi(250)
local volume_osd_width = dpi(250) local volume_osd_width = dpi(250)
screen.connect_signal("request::desktop_decoration", function(s) screen.connect_signal("request::desktop_decoration", function(s)
local s = s or {} s = s or {}
s.show_vol_osd = false s.show_vol_osd = false
s.volume_osd_overlay = awful.popup({ s.volume_osd_overlay = awful.popup({
@ -209,20 +209,30 @@ local placement_placer = function()
end end
-- Get Vol -- Get Vol
function get_vol() local function get_vol()
script = 'pamixer --get-volume' local script = "pamixer --get-volume"
script2 = 'pamixer --get-mute' local script2 = "pamixer --get-mute"
awful.spawn.easy_async_with_shell(script, function(vol) awful.spawn.easy_async_with_shell(script, function()
awful.spawn.easy_async_with_shell(script2, function(is_mute) awful.spawn.easy_async_with_shell(script2, function(is_mute)
if is_mute:match("true") then muted = true else local muted
muted = false
end
if muted then vol_osd_slider.bar_active_color = beautiful.xcolor10 vol_osd_slider.handle_color = beautiful.xcolor10 icon3.image = beautiful.volume_off else if is_mute:match("true") then
vol_osd_slider.bar_active_color = beautiful.xcolor2 vol_osd_slider.handle_color = beautiful.xcolor2 icon3.image = beautiful.volume_on muted = true
end else
end) muted = false
end) end
if muted then
vol_osd_slider.bar_active_color = beautiful.xcolor10
vol_osd_slider.handle_color = beautiful.xcolor10
icon3.image = beautiful.volume_off
else
vol_osd_slider.bar_active_color = beautiful.xcolor2
vol_osd_slider.handle_color = beautiful.xcolor2
icon3.image = beautiful.volume_on
end
end)
end)
end end
awesome.connect_signal("module::volume_osd:show", function(bool) awesome.connect_signal("module::volume_osd:show", function(bool)
@ -266,4 +276,3 @@ volume.mute = function()
end end
return volume return volume

View file

@ -1,82 +1,66 @@
local awful = require "awful" local awful = require("awful")
local gears = require "gears" local gears = require("gears")
local beautiful = require "beautiful" local wibox = require("wibox")
local wibox = require "wibox"
--- Rounded Corners Client Side --- --- Rounded Corners Client Side ---
-- Use Picom If you Can -- -- Use Picom If you Can --
local function shapemanager(c) local function shapemanager(c)
c.shape = function(cr, w, h) c.shape = function(cr, w, h)
if not c.fullscreen and not c.maximized then if not c.fullscreen and not c.maximized then
gears.shape.rounded_rect(cr, w, h, 15) gears.shape.rounded_rect(cr, w, h, 15)
else else
gears.shape.rounded_rect(cr, w, h, 0) gears.shape.rounded_rect(cr, w, h, 0)
end end
end end
end end
--- Places every Floating Client in Middle --- client.connect_signal("property::fullscreen", function(c)
-- if enabled lib.savefloats won't work -- shapemanager(c)
--local function floatmanager(c) end)
-- if c.floating then
-- awful.placement.centered(c)
-- end
--end
client.connect_signal("property::fullscreen", function(c) shapemanager(c) end)
--client.connect_signal("property::floating", function(c) floatmanager(c) end)
--client.connect_signal("request::geometry", function(c) shapemanager(c) end)
--client.connect_signal("request::activate", function(c) shapemanager(c) end)
-- Add a titlebar if titlebars_enabled is set to true in the rules. -- Add a titlebar if titlebars_enabled is set to true in the rules.
client.connect_signal("request::titlebars", function(c) client.connect_signal("request::titlebars", function(c)
-- buttons for the titlebar -- buttons for the titlebar
local buttons = gears.table.join( local buttons = gears.table.join(
awful.button({}, 1, function() awful.button({}, 1, function()
c:activate {context = "titlebar", action = "mouse_move"} c:activate({ context = "titlebar", action = "mouse_move" })
-- c:emit_signal("request::activate", "titlebar", {raise = true}) end),
-- awful.mouse.client.move(c) awful.button({}, 3, function()
end), c:activate({ context = "titlebar", action = "mouse_resize" })
awful.button({}, 3, function() end)
c:activate {context = "titlebar", action = "mouse_resize"} )
-- c:emit_signal("request::activate", "titlebar", {raise = true})
--awful.mouse.client.resize(c)
end)
)
local titlebar_top = awful.titlebar(c, { local titlebar_top = awful.titlebar(c, {
size = 30, size = 30,
expand = "none", expand = "none",
}) })
local left = { local left = {
buttons = buttons, buttons = buttons,
--awful.titlebar.widget.ontopbutton(c), layout = wibox.layout.fixed.horizontal(),
layout = wibox.layout.fixed.horizontal() }
} local middle = {
local middle = { buttons = buttons,
buttons = buttons, layout = wibox.layout.fixed.horizontal(),
layout = wibox.layout.fixed.horizontal() }
} local right = {
local right = { awful.titlebar.widget.maximizedbutton(c),
awful.titlebar.widget.maximizedbutton(c), awful.titlebar.widget.minimizebutton(c),
awful.titlebar.widget.minimizebutton(c), awful.titlebar.widget.closebutton(c),
awful.titlebar.widget.closebutton(c), spacing = 11.5,
spacing = 11.5, layout = wibox.layout.fixed.horizontal(),
layout = wibox.layout.fixed.horizontal() }
}
titlebar_top : setup { titlebar_top:setup({
{ {
left, left,
middle, middle,
right, right,
layout = wibox.layout.align.horizontal() layout = wibox.layout.align.horizontal(),
}, },
left = 13.5, left = 13.5,
right = 13.5, right = 13.5,
top = 7.4, top = 7.4,
bottom = 7.4, bottom = 7.4,
-- layout = wibox.layout.align.horizontal layout = wibox.container.margin,
layout = wibox.container.margin })
}
end) end)

View file

@ -1,20 +1,11 @@
-- Standard awesome library -- -- Standard awesome library --
local gears = require("gears")
local awful = require("awful") local awful = require("awful")
local wibox = require("wibox") local wibox = require("wibox")
local widgets = require("ui.top-panel.widgets")
local widgets = require ("ui.top-panel.widgets")
local bling = require ("lib.bling")
local helpers = require "helpers"
local beautiful = require("beautiful") local beautiful = require("beautiful")
local menubar = require("menubar")
local hotkeys_popup = require("awful.hotkeys_popup")
local dpi = beautiful.xresources.apply_dpi local dpi = beautiful.xresources.apply_dpi
local clock = widgets.clock local clock = widgets.clock
local date = widgets.date local date = widgets.date
local cpu = widgets.cpu local cpu = widgets.cpu
@ -23,126 +14,107 @@ local keyboard = widgets.keyboard
local mem = widgets.mem local mem = widgets.mem
local menu = widgets.menu local menu = widgets.menu
local systray = widgets.systray local systray = widgets.systray
local promptbox = widgets.promptbox
local audio = widgets.audio local audio = widgets.audio
local seperator = widgets.seperator local seperator = widgets.seperator
local taglist = widgets.taglist
local tasklist = widgets.tasklist
local layoutbox = widgets.layoutbox local layoutbox = widgets.layoutbox
local power = widgets.power
local function create_icon(i, c) --Icon Creation local function create_icon(i, c) --Icon Creation
local widget = { local widget = {
{ {
font = beautiful.font_name.."12.5", font = beautiful.font_name .. "12.5",
text = ' ' .. i, text = " " .. i,
widget = wibox.widget.textbox widget = wibox.widget.textbox,
}, },
fg = c, fg = c,
widget = wibox.container.background widget = wibox.container.background,
} }
return widget return widget
end end
-- Create Icons with Color -- -- Create Icons with Color --
local calendar_icon = create_icon('', beautiful.xcolor5) local calendar_icon = create_icon("", beautiful.xcolor5)
local clock_icon = create_icon('', beautiful.xcolor12) local clock_icon = create_icon("", beautiful.xcolor12)
local keyboard_icon = create_icon('', beautiful.xcolor4) local keyboard_icon = create_icon("", beautiful.xcolor4)
screen.connect_signal("request::desktop_decoration", function(s) screen.connect_signal("request::desktop_decoration", function(s)
-- Create Clock with Colerfull Widget -- -- Create Clock with Colerfull Widget --
local clockdate = wibox.widget { local clockdate = wibox.widget({
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
calendar_icon, calendar_icon,
date, date,
clock_icon, clock_icon,
clock, -- Middle widget clock, -- Middle widget
})
local tasklist = wibox.widget({
{
layout = wibox.layout.fixed.horizontal,
s.tasklist, -- needs to be here (under the screen.connect_signal) bc of the s
},
forced_width = 300,
layout = wibox.layout.fixed.horizontal,
})
} -- Create the wibox
s.mywibox = awful.wibar({
local tasklist = wibox.widget { position = "top",
{ screen = s,
layout = wibox.layout.fixed.horizontal,
s.tasklist, -- needs to be here (under the screen.connect_signal) bc of the s
},
forced_width = 300,
layout = wibox.layout.fixed.horizontal,
}
-- Create the wibox
s.mywibox = awful.wibar {
position = "top",
screen = s,
widget = {
layout = wibox.layout.align.horizontal,
expand = "none",
{
{-- Left widgets
layout = wibox.layout.fixed.horizontal,
menu,
--launcher,
seperator,
s.taglist,
seperator,
-- s.tasklist,
tasklist,
},
left = 5, --Padding
right = 0,
top = 2,
bottom = 2,
layout = wibox.container.margin,
},
{
{
layout = wibox.layout.align.horizontal,
clockdate,
},
left = 0,
right = 0,
top = 1,
bottom = 1,
layout = wibox.container.margin,
},
{ -- Right widgets
{
layout = wibox.layout.fixed.horizontal,
--temp.text,
systray,
seperator,
audio,
mem,
cpu,
disk,
keyboard_icon,
keyboard,
--awful.widget.systray(),
--power,
layoutbox,
--pacing = 2,
},
left = 0,
right = 2,
top = 1,
bottom = 1,
layout = wibox.container.margin
},
}
}
s.border2 = awful.wibar {
position = "top",
screen = s,
bg = "#313244",
height = dpi(2),
}
widget = {
layout = wibox.layout.align.horizontal,
expand = "none",
{
{ -- Left widgets
layout = wibox.layout.fixed.horizontal,
menu,
seperator,
s.taglist,
seperator,
tasklist,
},
left = 5, --Padding
right = 0,
top = 2,
bottom = 2,
layout = wibox.container.margin,
},
{
{
layout = wibox.layout.align.horizontal,
clockdate,
},
left = 0,
right = 0,
top = 1,
bottom = 1,
layout = wibox.container.margin,
},
{ -- Right widgets
{
layout = wibox.layout.fixed.horizontal,
systray,
seperator,
audio,
mem,
cpu,
disk,
keyboard_icon,
keyboard,
layoutbox,
},
left = 0,
right = 2,
top = 1,
bottom = 1,
layout = wibox.container.margin,
},
},
})
s.border2 = awful.wibar({
position = "top",
screen = s,
bg = beautiful.xcolorS0,
height = dpi(2),
})
end) end)

View file

@ -1,31 +1,19 @@
local awful = require "awful" local gears = require("gears")
local gears = require "gears" local wibox = require("wibox")
local wibox = require "wibox" local beautiful = require("beautiful")
local beautiful = require "beautiful" require("awful.hotkeys_popup.keys")
local naughty = require "naughty"
local menubar = require "menubar"
local hotkeys_popup = require "awful.hotkeys_popup"
require "awful.hotkeys_popup.keys"
-- Clock -- Clock
local clock = wibox.widget.textbox() local clock = wibox.widget.textbox()
clock.font = beautiful.font_name.."11" clock.font = beautiful.font_name .. "11"
gears.timer { gears.timer({
timeout = 60, timeout = 60,
autostart = true, autostart = true,
call_now = true, call_now = true,
callback = function() callback = function()
clock.markup = os.date(" %H:%M") clock.markup = os.date(" %I:%M %p")
end end,
} })
--local month_calendar = awful.widget.calendar_popup.month()
--month_calendar.position =
--month_calendar:attach( clock, "tm" )
--clock:connect_signal("button::release",
--function()
-- month_calendar.position = 'tm',
-- month_calendar:toggle()
--end)
return clock return clock

View file

@ -1,37 +1,33 @@
local awful = require "awful" local wibox = require("wibox")
local wibox = require "wibox" local beautiful = require("beautiful")
local gears = require "gears"
local beautiful = require "beautiful"
local dpi = beautiful.xresources.apply_dpi local dpi = beautiful.xresources.apply_dpi
local helpers = require "helpers"
-- Icon -- Icon
local icon = wibox.widget.textbox() local icon = wibox.widget.textbox()
icon.font = beautiful.font_name.."12.5" icon.font = beautiful.font_name .. "12.5"
icon.align = 'center' icon.align = "center"
icon.markup = "<span foreground='"..beautiful.xcolor9.."'></span>" icon.markup = "<span foreground='" .. beautiful.xcolor9 .. "'></span>"
-- Uptime -- Uptime
local cpu = wibox.widget.textbox() local cpu = wibox.widget.textbox()
cpu.font = beautiful.font_name.."10" cpu.font = beautiful.font_name .. "10"
cpu.align = 'center' cpu.align = "center"
local function get_val() local function get_val()
awesome.connect_signal("signal::cpu", function(cpu_perc) awesome.connect_signal("signal::cpu", function(cpu_perc)
cpu.markup = tonumber(cpu_perc).. "%" cpu.markup = tonumber(cpu_perc) .. "%"
end) end)
end end
get_val() get_val()
local full = wibox.widget({
local full = wibox.widget {
{ {
{ {
icon, icon,
cpu, cpu,
spacing = dpi(8), spacing = dpi(8),
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
}, },
left = 1, left = 1,
right = 0, right = 0,
@ -39,8 +35,6 @@ local full = wibox.widget {
}, },
forced_width = 73, -- Makes it fixed and not Moves Whole Bar forced_width = 73, -- Makes it fixed and not Moves Whole Bar
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
} })
return full return full

View file

@ -1,23 +1,19 @@
local awful = require "awful" local gears = require("gears")
local gears = require "gears" local wibox = require("wibox")
local wibox = require "wibox" local beautiful = require("beautiful")
local beautiful = require "beautiful" require("awful.hotkeys_popup.keys")
local naughty = require "naughty"
local menubar = require "menubar"
local hotkeys_popup = require "awful.hotkeys_popup"
require "awful.hotkeys_popup.keys"
-- Clock -- Clock
local date = wibox.widget.textbox() local date = wibox.widget.textbox()
date.font = beautiful.font_name.."11" date.font = beautiful.font_name .. "11"
gears.timer { gears.timer({
timeout = 60, timeout = 60,
autostart = true, autostart = true,
call_now = true, call_now = true,
callback = function() callback = function()
date.markup = os.date(" %a %b %d") date.markup = os.date(" %a %b %d")
end end,
} })
return date return date

View file

@ -1,43 +1,36 @@
local awful = require "awful" local wibox = require("wibox")
local wibox = require "wibox" local beautiful = require("beautiful")
local gears = require "gears"
local beautiful = require "beautiful"
local dpi = beautiful.xresources.apply_dpi local dpi = beautiful.xresources.apply_dpi
local helpers = require "helpers"
-- Icon -- Icon
local icon = wibox.widget.textbox() local icon = wibox.widget.textbox()
icon.font = beautiful.font_name.."12.5" icon.font = beautiful.font_name .. "12.5"
icon.align = 'center' icon.align = "center"
icon.markup = "<span foreground='"..beautiful.xcolor7.."'></span>" icon.markup = "<span foreground='" .. beautiful.xcolor7 .. "'></span>"
-- Uptime -- Uptime
local disk = wibox.widget.textbox() local disk = wibox.widget.textbox()
disk.font = beautiful.font_name.."10" disk.font = beautiful.font_name .. "10"
disk.align = 'center' disk.align = "center"
local function get_val() local function get_val()
awesome.connect_signal("signal::disk", function(disk_perc) awesome.connect_signal("signal::disk", function(disk_perc)
disk.markup = tonumber(disk_perc).. "%" disk.markup = tonumber(disk_perc) .. "%"
end) end)
end end
get_val() get_val()
local full = wibox.widget({
local full = wibox.widget {
{ {
icon, icon,
disk, disk,
spacing = dpi(8), spacing = dpi(8),
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
}, },
left = 1, left = 1,
right = 8, right = 8,
layout = wibox.container.margin layout = wibox.container.margin,
} })
return full return full

View file

@ -1,17 +1,17 @@
return { return {
clock = require (... .. ".clock"), clock = require(... .. ".clock"),
cpu = require (... .. ".cpu"), cpu = require(... .. ".cpu"),
date = require (... .. ".date"), date = require(... .. ".date"),
disk = require (... .. ".disk"), disk = require(... .. ".disk"),
keyboard = require (... .. ".keyboard"), keyboard = require(... .. ".keyboard"),
layoutbox = require (... .. ".layoutbox"), layoutbox = require(... .. ".layoutbox"),
mem = require (... .. ".mem"), mem = require(... .. ".mem"),
menu = require (... .. ".menu"), menu = require(... .. ".menu"),
systray = require (... .. ".systray"), systray = require(... .. ".systray"),
promptbox = require (... .. ".promptbox"), promptbox = require(... .. ".promptbox"),
audio = require (... .. ".pulseaudio"), audio = require(... .. ".pulseaudio"),
seperator = require (... .. ".seperator"), seperator = require(... .. ".seperator"),
taglist = require (... .. ".taglist"), taglist = require(... .. ".taglist"),
tasklist = require (... .. ".tasklist"), tasklist = require(... .. ".tasklist"),
power = require (... .. ".power"), power = require(... .. ".power"),
} }

View file

@ -1,9 +1,7 @@
local awful = require "awful" local awful = require("awful")
local gears = require "gears"
local wibox = require "wibox"
local beautiful = require "beautiful"
-- Keyboard map indicator and switcher -- Keyboard map indicator and switcher
local keyboardlayout = awful.widget.keyboardlayout() local keyboardlayout = awful.widget.keyboardlayout()
return keyboardlayout return keyboardlayout

View file

@ -1,7 +1,8 @@
local awful = require "awful" local awful = require("awful")
local beautiful = require "beautiful" local beautiful = require("beautiful")
local menu = require("main.menu")
local launcher = awful.widget.launcher({ image = beautiful.awesome_icon, local launcher = awful.widget.launcher({ image = beautiful.awesome_icon, menu = menu })
menu = mymainmenu })
return launcher return launcher

View file

@ -1,13 +1,20 @@
local awful = require "awful" local awful = require("awful")
local gears = require "gears"
local beautiful = require "beautiful"
local layoutbox = awful.widget.layoutbox ({ local layoutbox = awful.widget.layoutbox({
buttons = { buttons = {
awful.button({ }, 1, function () awful.layout.inc( 1) end), awful.button({}, 1, function()
awful.button({ }, 3, function () awful.layout.inc(-1) end), awful.layout.inc(1)
awful.button({ }, 4, function () awful.layout.inc(-1) end), end),
awful.button({ }, 5, function () awful.layout.inc( 1) end), awful.button({}, 3, function()
} awful.layout.inc(-1)
end),
awful.button({}, 4, function()
awful.layout.inc(-1)
end),
awful.button({}, 5, function()
awful.layout.inc(1)
end),
},
}) })
return layoutbox return layoutbox

View file

@ -1,53 +1,40 @@
local awful = require "awful" local wibox = require("wibox")
local wibox = require "wibox" local beautiful = require("beautiful")
local gears = require "gears"
local beautiful = require "beautiful"
local dpi = beautiful.xresources.apply_dpi local dpi = beautiful.xresources.apply_dpi
local helpers = require "helpers"
-- Icon -- Icon
local icon = wibox.widget.textbox() local icon = wibox.widget.textbox()
icon.font = beautiful.font_name.."12.5" icon.font = beautiful.font_name .. "12.5"
icon.align = 'center' icon.align = "center"
icon.markup = "<span foreground='"..beautiful.xcolor6.."'></span>" icon.markup = "<span foreground='" .. beautiful.xcolor6 .. "'>󰍛</span>"
-- Uptime -- Uptime
local mem = wibox.widget.textbox() local mem = wibox.widget.textbox()
mem.font = beautiful.font_name.."10" mem.font = beautiful.font_name .. "10"
mem.align = 'center' mem.align = "center"
local function get_val() local function get_val()
awesome.connect_signal("signal::mem", function(mem_perc) awesome.connect_signal("signal::mem", function(mem_perc)
mem.markup = tonumber(mem_perc).. "%" mem.markup = tonumber(mem_perc) .. "%"
end) end)
end end
get_val() get_val()
--gears.timer {
-- timeout = 2,
-- autostart = true,
-- call_now = true,
-- callback = function()
-- get_val()
-- end
--}
local full = wibox.widget { local full = wibox.widget({
{ {
{ {
icon, icon,
mem, mem,
spacing = dpi(8), spacing = dpi(8),
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
}, },
left = 1, left = 1,
right = 0, right = 0,
layout = wibox.container.margin, layout = wibox.container.margin,
}, },
forced_width = 73, forced_width = 73,
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
} })
return full return full

View file

@ -1,31 +1,24 @@
local awful = require "awful" local awful = require("awful")
local wibox = require "wibox" local wibox = require("wibox")
local gears = require "gears" local gears = require("gears")
local beautiful = require "beautiful" local beautiful = require("beautiful")
local helpers = require "helpers" local helpers = require("helpers")
local dpi = beautiful.xresources.apply_dpi
-- Menu -- Menu
--local menu = wibox.widget.textbox() local menu = wibox.widget({
--menu.font = "FiraCode Nerd Font 16"
--menu.markup = "ﰪ"
local menu = wibox.widget {
{ {
font = beautiful.font_name.."16", font = beautiful.font_name .. "16",
markup = "", markup = "󰜬",
widget = wibox.widget.textbox(), widget = wibox.widget.textbox(),
}, },
bottom = 2, bottom = 2,
widget = wibox.container.margin, widget = wibox.container.margin,
} })
helpers.ui.add_hover_cursor(menu, "hand2") helpers.ui.add_hover_cursor(menu, "hand2")
menu:buttons(gears.table.join(awful.button({}, 1, function()
menu:buttons(gears.table.join( awesome.emit_signal("sidebar::toggle")
awful.button({ }, 1, function() end)))
awesome.emit_signal("sidebar::toggle")
end)
))
return menu return menu

View file

@ -1,20 +1,15 @@
local awful = require "awful" local awful = require("awful")
local wibox = require "wibox" local wibox = require("wibox")
local gears = require "gears" local gears = require("gears")
local beautiful = require "beautiful" local beautiful = require("beautiful")
local helpers = require "helpers"
local dpi = beautiful.xresources.apply_dpi
-- Menu -- Menu
local menu = wibox.widget.textbox() local menu = wibox.widget.textbox()
menu.font = beautiful.font_name.."16" menu.font = beautiful.font_name .. "16"
menu.markup = "<span foreground='"..beautiful.xcolor10.."'></span>" menu.markup = "<span foreground='" .. beautiful.xcolor10 .. "'></span>"
menu:buttons(gears.table.join(awful.button({}, 1, function()
menu:buttons(gears.table.join( awesome.emit_signal("module::exit_screen:show")
awful.button({ }, 1, function() end)))
awesome.emit_signal("module::exit_screen:show")
end)
))
return menu return menu

View file

@ -1,4 +1,5 @@
local awful = require "awful" local awful = require("awful")
local promptbox = awful.widget.prompt() local promptbox = awful.widget.prompt()
return promptbox return promptbox

View file

@ -1,70 +1,67 @@
local awful = require "awful" local awful = require("awful")
local wibox = require "wibox" local wibox = require("wibox")
local gears = require "gears" local gears = require("gears")
local beautiful = require "beautiful" local beautiful = require("beautiful")
local dpi = beautiful.xresources.apply_dpi local dpi = beautiful.xresources.apply_dpi
local helpers = require "helpers" local helpers = require("helpers")
-- Icon -- Icon
local icon = wibox.widget.textbox() local icon = wibox.widget.textbox()
icon.font = beautiful.font_name.."12.5" icon.font = beautiful.font_name .. "12.5"
icon.align = 'center' icon.align = "center"
icon.markup = "<span foreground='"..beautiful.xcolor2.."'>墳</span>" icon.markup = "<span foreground='" .. beautiful.xcolor2 .. "'>󰕾</span>"
-- Uptime -- Uptime
local pulseaudio = wibox.widget.textbox() local pulseaudio = wibox.widget.textbox()
pulseaudio.font = beautiful.font_name.."10" pulseaudio.font = beautiful.font_name .. "10"
pulseaudio.align = 'center' pulseaudio.align = "center"
local function get_val() local function get_val()
awesome.connect_signal("signal::volume", function(vol, muted) awesome.connect_signal("signal::volume", function(vol, muted)
if muted then pulseaudio.markup = "muted" icon.markup = "<span foreground='"..beautiful.xcolor2.."'>婢</span>" else if muted then
pulseaudio.markup = tonumber(vol).. "%" pulseaudio.markup = "muted"
icon.markup = "<span foreground='"..beautiful.xcolor2.."'>墳</span>" icon.markup = "<span foreground='" .. beautiful.xcolor2 .. "'>󰖁</span>"
else
pulseaudio.markup = tonumber(vol) .. "%"
icon.markup = "<span foreground='" .. beautiful.xcolor2 .. "'>󰕾</span>"
end end
end) end)
end end
get_val() get_val()
local full = wibox.widget { local full = wibox.widget({
{ {
{ {
icon, icon,
pulseaudio, pulseaudio,
spacing = dpi(8), spacing = dpi(8),
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
}, },
left = dpi(5), left = dpi(5),
right = 8, right = 8,
layout = wibox.container.margin, layout = wibox.container.margin,
}, },
forced_width = 73, --66, forced_width = 73,
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
} })
full:buttons(gears.table.join( full:buttons(gears.table.join(awful.button({}, 1, function()
awful.button({ }, 1, function() awesome.emit_signal("action::toggle")
awesome.emit_signal("action::toggle") end)))
end)
))
-- Update Function -- Update Function
local update_volume = function() -- Sets the Volume Correct local update_volume = function() -- Sets the Volume Correct
awful.spawn.easy_async_with_shell("pamixer --get-volume", function(stdout) awful.spawn.easy_async_with_shell("pamixer --get-volume", function(stdout)
pulseaudio.markup = tonumber(stdout:match("%d+")).. "%" pulseaudio.markup = tonumber(stdout:match("%d+")) .. "%"
-- Uncomment this if you wan't dynamic Icons --
-- if tonumber(stdout:match("%d+")) < 10 then
-- icon.markup = "<span foreground='"..beautiful.xcolor2.."'>奄</span>"
-- elseif tonumber(stdout:match("%d+")) < 50 then
-- icon.markup = "<span foreground='"..beautiful.xcolor2.."'>奔</span>"
-- elseif tonumber(stdout:match("%d+")) < 100 then
-- icon.markup = "<span foreground='"..beautiful.xcolor2.."'>墳</span>"
-- else
-- end
if tonumber(stdout:match("%d+")) < 10 then
icon.markup = "<span foreground='" .. beautiful.xcolor2 .. "'>󰕿</span>"
elseif tonumber(stdout:match("%d+")) < 50 then
icon.markup = "<span foreground='" .. beautiful.xcolor2 .. "'>󰖀</span>"
elseif tonumber(stdout:match("%d+")) < 100 then
icon.markup = "<span foreground='" .. beautiful.xcolor2 .. "'>󰕾</span>"
else
end
end) end)
end end
@ -78,4 +75,3 @@ end)
helpers.ui.add_hover_cursor(full, "hand2") helpers.ui.add_hover_cursor(full, "hand2")
return full return full

View file

@ -1,11 +1,9 @@
local gears = require "gears" local beautiful = require("beautiful")
local awful = require "awful" local wibox = require("wibox")
local beautiful = require "beautiful"
local wibox = require "wibox"
local seperator = wibox.widget.textbox() local seperator = wibox.widget.textbox()
seperator.font = beautiful.font_name.."14" seperator.font = beautiful.font_name .. "14"
--seperator.text = "|" seperator.markup = "<span foreground='" .. beautiful.xcolorT2 .. "'>|</span>"
seperator.markup = "<span foreground='"..beautiful.xcolorT2.."'>|</span>"
return seperator return seperator

View file

@ -1,83 +1,65 @@
local awful = require "awful" local awful = require("awful")
local wibox = require "wibox" local wibox = require("wibox")
local gears = require "gears" local gears = require("gears")
local beautiful = require "beautiful" local beautiful = require("beautiful")
local rubato = require "lib.rubato" local rubato = require("lib.rubato")
local dpi = beautiful.xresources.apply_dpi local dpi = beautiful.xresources.apply_dpi
local arrow = wibox.widget.textbox()
arrow.font = beautiful.font_name .. "13"
arrow.markup = "»"
local arrow = wibox.widget.textbox() local mysystray = wibox.widget.systray()
arrow.font = beautiful.font_name.."13" mysystray.visible = true
arrow.markup = "»" beautiful.systray_icon_spacing = dpi(4)
local mysystray = wibox.widget.systray() local widget = wibox.widget({
mysystray.visible = true widget = wibox.container.constraint,
beautiful.systray_icon_spacing = dpi(4) strategy = "max",
--mysystray.base_size = beautiful.systray_icon_size width = dpi(0),
{
widget = wibox.container.margin,
local widget = wibox.widget({ margins = dpi(2),
widget = wibox.container.constraint, mysystray,
strategy = "max", },
width = dpi(0), })
{ widget.visible = true
widget = wibox.container.margin,
margins = dpi(2),
mysystray,
},
})
widget.visible = true
local slide = rubato.timed {
-- rate = 60,
duration = 0.9,
--easing = rubato.easing.linear,
awestore_compat = true,
subscribed = function(pos)
widget.width = pos
end,
}
local slide = rubato.timed({
duration = 0.9,
awestore_compat = true,
subscribed = function(pos)
widget.width = pos
end,
})
local value = true local value = true
--slide.ended:subscribe(function() arrow.toggle = function()
-- if value then if value == false then
-- -- widget.visible = false arrow.markup = "»"
-- end value = true
-- end) slide:set(2)
else
arrow.markup = "«"
slide:set(500)
value = false
end
end
arrow.toggle = function() awesome.connect_signal("arrow::toggle", function()
if value == false then arrow.toggle()
arrow.markup = "»" end)
value = true
slide:set(2)
else
arrow.markup = "«"
slide:set(500)
--widget.visible = true
value = false
end
end
--end) arrow:buttons(gears.table.join(awful.button({}, 1, function()
awesome.emit_signal("arrow::toggle")
end)))
awesome.connect_signal("arrow::toggle", function() local sys = wibox.widget({
arrow.toggle() layout = wibox.layout.fixed.horizontal,
end) arrow,
widget,
spacing = dpi(2),
})
arrow:buttons(gears.table.join(
awful.button({ }, 1, function()
awesome.emit_signal("arrow::toggle")
end)
))
local sys = wibox.widget({
layout = wibox.layout.fixed.horizontal,
arrow,
widget,
spacing = dpi(2)
})
return sys return sys

View file

@ -1,102 +1,100 @@
local awful = require "awful" local awful = require("awful")
local gears = require "gears" local gears = require("gears")
local wibox = require "wibox" local wibox = require("wibox")
local beautiful = require "beautiful" local beautiful = require("beautiful")
beautiful.init(gears.filesystem.get_configuration_dir() .. "themes/catppuccin/theme.lua") beautiful.init(gears.filesystem.get_configuration_dir() .. "themes/catppuccin/theme.lua")
local bling = require "lib.bling" local bling = require("lib.bling")
local dpi = beautiful.xresources.apply_dpi
local keys = require("config").keys
awful.screen.connect_for_each_screen(function(s) awful.screen.connect_for_each_screen(function(s)
s.taglist = awful.widget.taglist { s.taglist = awful.widget.taglist({
screen = s, screen = s,
filter = awful.widget.taglist.filter.all, filter = awful.widget.taglist.filter.all,
widget_template = { widget_template = {
{ {
{ {
{ {
id = 'text_role', id = "text_role",
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
}, },
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
}, },
left = 4, left = 4,
right = 4, right = 4,
widget = wibox.container.margin widget = wibox.container.margin,
}, },
id = 'background_role', id = "background_role",
widget = wibox.container.background, widget = wibox.container.background,
-- Add support for hover colors and an index label -- Add support for hover colors and an index label
create_callback = function(self, c3, index, objects) --luacheck: no unused args create_callback = function(self, c3, index, _) --luacheck: no unused args
self:get_children_by_id('text_role')[1].markup = '<b> '..index..' </b>' self:get_children_by_id("text_role")[1].markup = "<b> " .. index .. " </b>"
self:connect_signal('mouse::enter', function() self:connect_signal("mouse::enter", function()
-- BLING: Only show widget when there are clients in the tag
if #c3:clients() > 0 then
-- BLING: Update the widget with the new tag
awesome.emit_signal("bling::tag_preview::update", c3)
-- BLING: Show the widget
awesome.emit_signal("bling::tag_preview::visibility", s, true)
end
end)
self:connect_signal("mouse::leave", function()
-- BLING: Turn the widget off
awesome.emit_signal("bling::tag_preview::visibility", s, false)
-- BLING: Only show widget when there are clients in the tag if self.has_backup then
if #c3:clients() > 0 then self.bg = self.backup
-- BLING: Update the widget with the new tag end
awesome.emit_signal("bling::tag_preview::update", c3) end)
-- BLING: Show the widget end,
awesome.emit_signal("bling::tag_preview::visibility", s, true) update_callback = function(self, _, index, _)
end self:get_children_by_id("text_role")[1].markup = "<b> " .. index .. " </b>"
end) end,
self:connect_signal('mouse::leave', function() },
buttons = {
-- BLING: Turn the widget off awful.button({}, 1, function(t)
awesome.emit_signal("bling::tag_preview::visibility", s, false) t:view_only()
end),
if self.has_backup then self.bg = self.backup end awful.button({ keys.mod }, 1, function(t)
end) if client.focus then
end, client.focus:move_to_tag(t)
update_callback = function(self, c3, index, objects) --luacheck: no unused args end
self:get_children_by_id('text_role')[1].markup = '<b> '..index..' </b>' end),
end, awful.button({}, 3, awful.tag.viewtoggle),
}, awful.button({ keys.mod }, 3, function(t)
buttons = { if client.focus then
awful.button({ }, 1, function(t) t:view_only() end), client.focus:toggle_tag(t)
awful.button({ modkey }, 1, function(t) end
if client.focus then end),
client.focus:move_to_tag(t) awful.button({}, 4, function(t)
end awful.tag.viewprev(t.screen)
end), end),
awful.button({ }, 3, awful.tag.viewtoggle), awful.button({}, 5, function(t)
awful.button({ modkey }, 3, function(t) awful.tag.viewnext(t.screen)
if client.focus then end),
client.focus:toggle_tag(t) },
end })
end),
awful.button({ }, 4, function(t) awful.tag.viewprev(t.screen) end),
awful.button({ }, 5, function(t) awful.tag.viewnext(t.screen) end),
},
}
bling.widget.tag_preview.enable {
show_client_content = true, -- Whether or not to show the client content
x = 0, -- The x-coord of the popup
y = 0, -- The y-coord of the popup
scale = 0.2, -- The scale of the previews compared to the screen
honor_padding = true, -- Honor padding when creating widget size
honor_workarea = true, -- Honor work area when creating widget size
placement_fn = function(c) -- Place the widget using awful.placement (this overrides x & y)
awful.placement.top_left(c, {
margins = {
top = 31,
left = 0,
}
})
end,
background_widget = wibox.widget { -- Set a background image (like a wallpaper) for the widget
image = beautiful.wallpaper,
horizontal_fit_policy = "fit",
vertical_fit_policy = "fit",
widget = wibox.widget.imagebox
}
}
bling.widget.tag_preview.enable({
show_client_content = true, -- Whether or not to show the client content
x = 0, -- The x-coord of the popup
y = 0, -- The y-coord of the popup
scale = 0.2, -- The scale of the previews compared to the screen
honor_padding = true, -- Honor padding when creating widget size
honor_workarea = true, -- Honor work area when creating widget size
placement_fn = function(c) -- Place the widget using awful.placement (this overrides x & y)
awful.placement.top_left(c, {
margins = {
top = 31,
left = 0,
},
})
end,
background_widget = wibox.widget({ -- Set a background image (like a wallpaper) for the widget
image = beautiful.wallpaper,
horizontal_fit_policy = "fit",
vertical_fit_policy = "fit",
widget = wibox.widget.imagebox,
}),
})
end) end)

View file

@ -1,18 +1,8 @@
local awful = require "awful" local awful = require("awful")
local beautiful = require "beautiful"
local gears = require "gears"
awful.screen.connect_for_each_screen(function(s) awful.screen.connect_for_each_screen(function(s)
s.tasklist = awful.widget.tasklist({
s.tasklist = awful.widget.tasklist { screen = s,
screen = s, filter = awful.widget.tasklist.filter.focused,
filter = awful.widget.tasklist.filter.focused, })
-- buttons = {
-- awful.button({ }, 1, function (c)
-- c:activate { context = "tasklist", action = "toggle_minimization" }
-- end),
-- awful.button({ }, 3, function() awful.menu.client_list { theme = { width = 250 } } end),
-- awful.button({ }, 4, function() awful.client.focus.byidx(-1) end),
-- awful.button({ }, 5, function() awful.client.focus.byidx( 1) end),
}
end) end)

View file

@ -26,9 +26,11 @@
order: 0; order: 0;
width: calc(100% - 146px); width: calc(100% - 146px);
} }
#PersonalToolbar {
order: 2; /* Shove bookmarks bar over for macOS titlebar buttons */
} /* #PersonalToolbar { */
/* order: 2; */
/* } */
/* Update - Hides the new Firefox home + tab dropdown. If you want to /* Update - Hides the new Firefox home + tab dropdown. If you want to
* keep/customize those buttons. remove the CSS below and adjust the widths above * keep/customize those buttons. remove the CSS below and adjust the widths above