style: re-format

This commit is contained in:
2026-06-12 17:12:25 -04:00
parent a0b22453eb
commit e298b55cb7
36 changed files with 832 additions and 832 deletions
+16 -16
View File
@@ -1,22 +1,22 @@
local M = {} local M = {}
M.curves = { M.curves = {
{ {
name = "easeInOutExpo", name = "easeInOutExpo",
curve = { curve = {
type = "bezier", type = "bezier",
points = { { 0.87, 0 }, { 0.13, 1 } }, points = { { 0.87, 0 }, { 0.13, 1 } },
}, },
}, },
{ {
name = "rubber", name = "rubber",
curve = { curve = {
type = "spring", type = "spring",
mass = 1, mass = 1,
stiffness = 50, stiffness = 50,
dampening = 8, dampening = 8,
}, },
}, },
} }
return M return M
+19 -19
View File
@@ -2,29 +2,29 @@ local curves = require("lua.animations.curves")
local M = {} local M = {}
M.animations = { M.animations = {
{ {
leaf = "windows", leaf = "windows",
enabled = true, enabled = true,
speed = 1, speed = 1,
spring = "rubber", spring = "rubber",
style = "slide", style = "slide",
}, },
{ {
leaf = "workspaces", leaf = "workspaces",
enabled = true, enabled = true,
speed = 8, speed = 8,
spring = "rubber", spring = "rubber",
}, },
} }
function M.load() function M.load()
for _, curve_item in pairs(curves.curves) do for _, curve_item in pairs(curves.curves) do
hl.curve(curve_item.name, curve_item.curve) hl.curve(curve_item.name, curve_item.curve)
end end
for _, animation in pairs(M.animations) do for _, animation in pairs(M.animations) do
hl.animation(animation) hl.animation(animation)
end end
end end
return M return M
+15 -15
View File
@@ -3,21 +3,21 @@ local settings = require("lua.lib.settings")
local bind = require("lua.lib.bind") local bind = require("lua.lib.bind")
M.binds = { M.binds = {
{ {
keys = bind.with_leader("Return"), keys = bind.with_leader("Return"),
desc = "Open terminal", desc = "Open terminal",
dispatcher = hl.dsp.exec_cmd(settings.apps.terminal), dispatcher = hl.dsp.exec_cmd(settings.apps.terminal),
}, },
{ {
keys = bind.with_leader("B"), keys = bind.with_leader("B"),
desc = "Open web browser", desc = "Open web browser",
dispatcher = hl.dsp.exec_cmd(settings.apps.browser), dispatcher = hl.dsp.exec_cmd(settings.apps.browser),
}, },
{ {
keys = bind.with_leader("E"), keys = bind.with_leader("E"),
desc = "Open file manager", desc = "Open file manager",
dispatcher = hl.dsp.exec_cmd(settings.apps.file_manager), dispatcher = hl.dsp.exec_cmd(settings.apps.file_manager),
}, },
} }
return M return M
+19 -19
View File
@@ -3,34 +3,34 @@ local bind = require("lua.lib.bind")
local utils = require("lua.lib.utils") local utils = require("lua.lib.utils")
local pieces = { local pieces = {
"apps", "apps",
"window", "window",
"workspace", "workspace",
"passthrough", "passthrough",
} }
M.binds = {} M.binds = {}
M.submaps = {} M.submaps = {}
for _, piece in pairs(pieces) do for _, piece in pairs(pieces) do
local p = require("lua.binds." .. piece) local p = require("lua.binds." .. piece)
local bind_piece = p.binds local bind_piece = p.binds
for _, bind_item in pairs(bind_piece) do for _, bind_item in pairs(bind_piece) do
table.insert(M.binds, bind_item) table.insert(M.binds, bind_item)
end end
local submap = p.submaps local submap = p.submaps
if submap then if submap then
M.submaps = utils.tbl_recursive_merge(M.submaps, submap) M.submaps = utils.tbl_recursive_merge(M.submaps, submap)
end end
end end
function M.load() function M.load()
bind.map(M.binds) bind.map(M.binds)
for name, binds in pairs(M.submaps) do for name, binds in pairs(M.submaps) do
hl.define_submap(name, function() hl.define_submap(name, function()
bind.map(binds) bind.map(binds)
end) end)
end end
end end
return M return M
+11 -11
View File
@@ -2,20 +2,20 @@ local bind = require("lua.lib.bind")
local M = {} local M = {}
M.binds = { M.binds = {
{ {
keys = bind.with_leader("P"), keys = bind.with_leader("P"),
dispatcher = hl.dsp.submap("pass_through"), dispatcher = hl.dsp.submap("pass_through"),
desc = "Pass through submap", desc = "Pass through submap",
}, },
} }
M.submaps = { M.submaps = {
pass_through = { pass_through = {
{ {
keys = bind.with_leader("escape"), keys = bind.with_leader("escape"),
dispatcher = hl.dsp.submap("reset"), dispatcher = hl.dsp.submap("reset"),
}, },
}, },
} }
return M return M
+113 -113
View File
@@ -4,135 +4,135 @@ local utils = require("lua.lib.utils")
local M = {} local M = {}
local function maximize_active_window() local function maximize_active_window()
local actions = { local actions = {
scrolling = hl.dsp.layout("colresize 1.0"), scrolling = hl.dsp.layout("colresize 1.0"),
} }
local fallback = hl.dsp.window.fullscreen({ mode = "maximized" }) local fallback = hl.dsp.window.fullscreen({ mode = "maximized" })
return bind.layout_dispatcher(actions, fallback) return bind.layout_dispatcher(actions, fallback)
end end
M.binds = { M.binds = {
{ {
keys = bind.with_leader("Q"), keys = bind.with_leader("Q"),
dispatcher = hl.dsp.window.close(), dispatcher = hl.dsp.window.close(),
desc = "Close the window", desc = "Close the window",
}, },
{ {
keys = bind.with_leader("SHIFT + Q"), keys = bind.with_leader("SHIFT + Q"),
dispatcher = hl.dsp.window.kill(), dispatcher = hl.dsp.window.kill(),
desc = "Kill the window", desc = "Kill the window",
}, },
{ {
keys = bind.with_leader("F"), keys = bind.with_leader("F"),
dispatcher = hl.dsp.window.fullscreen({}), dispatcher = hl.dsp.window.fullscreen({}),
desc = "Toggle fullscreen the window", desc = "Toggle fullscreen the window",
}, },
{ {
keys = bind.with_leader("SHIFT + F"), keys = bind.with_leader("SHIFT + F"),
dispatcher = maximize_active_window(), dispatcher = maximize_active_window(),
desc = "Toggle maximize the window", desc = "Toggle maximize the window",
}, },
{ {
keys = bind.with_leader("CTRL + SHIFT + F"), keys = bind.with_leader("CTRL + SHIFT + F"),
dispatcher = hl.dsp.window.fullscreen_state({ internal = 0, client = 2, action = "toggle" }), dispatcher = hl.dsp.window.fullscreen_state({ internal = 0, client = 2, action = "toggle" }),
desc = "Toggle fake the window it's fullscreened", desc = "Toggle fake the window it's fullscreened",
}, },
{ {
keys = bind.with_leader("T"), keys = bind.with_leader("T"),
dispatcher = hl.dsp.window.float(), dispatcher = hl.dsp.window.float(),
desc = "Toggle float the window", desc = "Toggle float the window",
}, },
{ {
keys = bind.with_leader("R"), keys = bind.with_leader("R"),
dispatcher = bind.layout_dispatcher({ dispatcher = bind.layout_dispatcher({
dwindle = hl.dsp.layout("rotatesplit"), dwindle = hl.dsp.layout("rotatesplit"),
}, hl.dsp.no_op()), }, hl.dsp.no_op()),
desc = "Toggle split", desc = "Toggle split",
}, },
{ {
keys = bind.with_leader("CTRL + R"), keys = bind.with_leader("CTRL + R"),
dispatcher = bind.layout_dispatcher({ dispatcher = bind.layout_dispatcher({
dwindle = hl.dsp.layout("swapsplit"), dwindle = hl.dsp.layout("swapsplit"),
master = hl.dsp.layout("swapnext"), master = hl.dsp.layout("swapnext"),
}, hl.dsp.no_op()), }, hl.dsp.no_op()),
}, },
} }
for key, dir in pairs({ for key, dir in pairs({
H = "left", H = "left",
L = "right", L = "right",
K = "up", K = "up",
J = "down", J = "down",
}) do }) do
table.insert(M.binds, { table.insert(M.binds, {
keys = bind.with_leader("SHIFT+" .. key), keys = bind.with_leader("SHIFT+" .. key),
dispatcher = hl.dsp.window.move({ direction = string.sub(dir, 1, 1) }), dispatcher = hl.dsp.window.move({ direction = string.sub(dir, 1, 1) }),
desc = "Move window " .. dir, desc = "Move window " .. dir,
}) })
table.insert(M.binds, { table.insert(M.binds, {
keys = bind.with_leader(key), keys = bind.with_leader(key),
dispatcher = hl.dsp.focus({ direction = string.sub(dir, 1, 1) }), dispatcher = hl.dsp.focus({ direction = string.sub(dir, 1, 1) }),
desc = "Move window " .. dir, desc = "Move window " .. dir,
}) })
table.insert(M.binds, { table.insert(M.binds, {
keys = bind.with_leader("CTRL + " .. key), keys = bind.with_leader("CTRL + " .. key),
dispatcher = hl.dsp.window.move({ direction = string.sub(dir, 1, 1), group_aware = true }), dispatcher = hl.dsp.window.move({ direction = string.sub(dir, 1, 1), group_aware = true }),
desc = "Move window " .. dir .. " with group_aware", desc = "Move window " .. dir .. " with group_aware",
}) })
end end
M.binds = utils.list_extend(M.binds, { M.binds = utils.list_extend(M.binds, {
{ {
keys = bind.with_leader("SHIFT + left"), keys = bind.with_leader("SHIFT + left"),
dispatcher = hl.dsp.window.resize({ x = -100, y = 0, relative = true }), dispatcher = hl.dsp.window.resize({ x = -100, y = 0, relative = true }),
desc = "Resize window x-100", desc = "Resize window x-100",
}, },
{ {
keys = bind.with_leader("SHIFT + right"), keys = bind.with_leader("SHIFT + right"),
dispatcher = hl.dsp.window.resize({ x = 100, y = 0, relative = true }), dispatcher = hl.dsp.window.resize({ x = 100, y = 0, relative = true }),
desc = "Resize window x+100", desc = "Resize window x+100",
}, },
{ {
keys = bind.with_leader("SHIFT + up"), keys = bind.with_leader("SHIFT + up"),
dispatcher = hl.dsp.window.resize({ x = 0, y = -100, relative = true }), dispatcher = hl.dsp.window.resize({ x = 0, y = -100, relative = true }),
desc = "Resize window y-100", desc = "Resize window y-100",
}, },
{ {
keys = bind.with_leader("SHIFT + down"), keys = bind.with_leader("SHIFT + down"),
dispatcher = hl.dsp.window.resize({ x = 0, y = 100, relative = true }), dispatcher = hl.dsp.window.resize({ x = 0, y = 100, relative = true }),
desc = "Resize window y+100", desc = "Resize window y+100",
}, },
}) })
M.binds = utils.list_extend(M.binds, { M.binds = utils.list_extend(M.binds, {
{ {
keys = bind.with_leader("mouse:272"), keys = bind.with_leader("mouse:272"),
dispatcher = hl.dsp.window.drag(), dispatcher = hl.dsp.window.drag(),
desc = "Drag window", desc = "Drag window",
}, },
{ {
keys = bind.with_leader("mouse:273"), keys = bind.with_leader("mouse:273"),
dispatcher = hl.dsp.window.resize(), dispatcher = hl.dsp.window.resize(),
desc = "Resize window", desc = "Resize window",
}, },
}) })
M.binds = utils.list_extend(M.binds, { M.binds = utils.list_extend(M.binds, {
{ {
keys = bind.with_leader("G"), keys = bind.with_leader("G"),
dispatcher = hl.dsp.group.toggle(), dispatcher = hl.dsp.group.toggle(),
desc = "Toggle a group", desc = "Toggle a group",
}, },
{ {
keys = bind.with_leader("CTRL + Tab"), keys = bind.with_leader("CTRL + Tab"),
dispatcher = hl.dsp.group.next(), dispatcher = hl.dsp.group.next(),
desc = "Switch to next window in group", desc = "Switch to next window in group",
}, },
{ {
keys = bind.with_leader("CTRL + SHIFT + Tab"), keys = bind.with_leader("CTRL + SHIFT + Tab"),
dispatcher = hl.dsp.group.prev(), dispatcher = hl.dsp.group.prev(),
desc = "Switch to previous window in group", desc = "Switch to previous window in group",
}, },
}) })
return M return M
+44 -44
View File
@@ -6,53 +6,53 @@ local M = {}
M.binds = {} M.binds = {}
for i = 1, 10 do for i = 1, 10 do
local n = tostring(i) local n = tostring(i)
if n == "10" then if n == "10" then
n = "0" n = "0"
end end
table.insert(M.binds, { table.insert(M.binds, {
keys = bind.with_leader(n), keys = bind.with_leader(n),
dispatcher = hl.dsp.focus({ workspace = i }), dispatcher = hl.dsp.focus({ workspace = i }),
desc = "Focus workspace " .. tostring(i), desc = "Focus workspace " .. tostring(i),
}) })
table.insert(M.binds, { table.insert(M.binds, {
keys = bind.with_leader("SHIFT + " .. n), keys = bind.with_leader("SHIFT + " .. n),
dispatcher = hl.dsp.window.move({ workspace = i, follow = true }), dispatcher = hl.dsp.window.move({ workspace = i, follow = true }),
desc = "Move window to workspace " .. tostring(i), desc = "Move window to workspace " .. tostring(i),
}) })
table.insert(M.binds, { table.insert(M.binds, {
keys = bind.with_leader("CTRL + SHIFT + " .. n), keys = bind.with_leader("CTRL + SHIFT + " .. n),
dispatcher = hl.dsp.window.move({ workspace = i, follow = false }), dispatcher = hl.dsp.window.move({ workspace = i, follow = false }),
desc = "Move window to workspace " .. tostring(i) .. " silently", desc = "Move window to workspace " .. tostring(i) .. " silently",
}) })
end end
M.binds = utils.list_extend(M.binds, { M.binds = utils.list_extend(M.binds, {
{ {
keys = bind.with_leader("mouse_up"), keys = bind.with_leader("mouse_up"),
dispatcher = hl.dsp.focus({ workspace = "m-1" }), dispatcher = hl.dsp.focus({ workspace = "m-1" }),
desc = "Focus to prev workspace on current monitor", desc = "Focus to prev workspace on current monitor",
}, },
{ {
keys = bind.with_leader("mouse_down"), keys = bind.with_leader("mouse_down"),
dispatcher = hl.dsp.focus({ workspace = "m+1" }), dispatcher = hl.dsp.focus({ workspace = "m+1" }),
desc = "Focus to next workspace on current monitor", desc = "Focus to next workspace on current monitor",
}, },
{ {
keys = bind.with_leader("CTRL + down"), keys = bind.with_leader("CTRL + down"),
dispatcher = hl.dsp.focus({ workspace = "emptynm" }), dispatcher = hl.dsp.focus({ workspace = "emptynm" }),
desc = "Focus to next empty workspace", desc = "Focus to next empty workspace",
}, },
{ {
keys = bind.with_leader("CTRL + left"), keys = bind.with_leader("CTRL + left"),
dispatcher = hl.dsp.focus({ workspace = "m-1" }), dispatcher = hl.dsp.focus({ workspace = "m-1" }),
desc = "Focus to prev workspace on current monitor", desc = "Focus to prev workspace on current monitor",
}, },
{ {
keys = bind.with_leader("CTRL + right"), keys = bind.with_leader("CTRL + right"),
dispatcher = hl.dsp.focus({ workspace = "m+1" }), dispatcher = hl.dsp.focus({ workspace = "m+1" }),
desc = "Focus to next workspace on current monitor", desc = "Focus to next workspace on current monitor",
}, },
}) })
return M return M
+30 -30
View File
@@ -3,36 +3,36 @@ local colorscheme = {}
-- currently, only catppuccin is considerd -- currently, only catppuccin is considerd
if settings["colorscheme"] == "catppuccin" or settings["colorscheme"] == "catppuccin-mocha" or true then if settings["colorscheme"] == "catppuccin" or settings["colorscheme"] == "catppuccin-mocha" or true then
colorscheme.rosewater = "#f5e0dc" colorscheme.rosewater = "#f5e0dc"
colorscheme.flamingo = "#f2cdcd" colorscheme.flamingo = "#f2cdcd"
colorscheme.pink = "#f5c2e7" colorscheme.pink = "#f5c2e7"
colorscheme.mauve = "#cba6f7" colorscheme.mauve = "#cba6f7"
colorscheme.red = "#f38ba8" colorscheme.red = "#f38ba8"
colorscheme.maroon = "#eba0ac" colorscheme.maroon = "#eba0ac"
colorscheme.peach = "#fab387" colorscheme.peach = "#fab387"
colorscheme.yellow = "#f9e2af" colorscheme.yellow = "#f9e2af"
colorscheme.green = "#a6e3a1" colorscheme.green = "#a6e3a1"
colorscheme.teal = "#94e2d5" colorscheme.teal = "#94e2d5"
colorscheme.sky = "#89dceb" colorscheme.sky = "#89dceb"
colorscheme.sapphire = "#74c7ec" colorscheme.sapphire = "#74c7ec"
colorscheme.blue = "#89b4fa" colorscheme.blue = "#89b4fa"
colorscheme.lavender = "#b4befe" colorscheme.lavender = "#b4befe"
colorscheme.text = "#cdd6f4" colorscheme.text = "#cdd6f4"
colorscheme.subtext1 = "#bac2de" colorscheme.subtext1 = "#bac2de"
colorscheme.subtext0 = "#a6adc8" colorscheme.subtext0 = "#a6adc8"
colorscheme.overlay2 = "#9399b2" colorscheme.overlay2 = "#9399b2"
colorscheme.overlay1 = "#7f849c" colorscheme.overlay1 = "#7f849c"
colorscheme.overlay0 = "#6c7086" colorscheme.overlay0 = "#6c7086"
colorscheme.surface2 = "#585b70" colorscheme.surface2 = "#585b70"
colorscheme.surface1 = "#45475a" colorscheme.surface1 = "#45475a"
colorscheme.surface0 = "#313244" colorscheme.surface0 = "#313244"
colorscheme.base = "#1e1e2e" colorscheme.base = "#1e1e2e"
colorscheme.mantle = "#181825" colorscheme.mantle = "#181825"
colorscheme.crust = "#11111b" colorscheme.crust = "#11111b"
colorscheme.foreground = colorscheme.text colorscheme.foreground = colorscheme.text
colorscheme.background = colorscheme.base colorscheme.background = colorscheme.base
colorscheme.accent = colorscheme.blue colorscheme.accent = colorscheme.blue
colorscheme.second = colorscheme.sky colorscheme.second = colorscheme.sky
end end
return colorscheme return colorscheme
+10 -10
View File
@@ -6,19 +6,19 @@ M.cursor = "Vimix-Hyprcursor"
M.size = 32 M.size = 32
function M.fetch_Vimix_hyprcursor() function M.fetch_Vimix_hyprcursor()
if M.cursor == "Vimix-Hyprcursor" then if M.cursor == "Vimix-Hyprcursor" then
if not utils.is_file_exists(DATA_HOME .. "/icons/Vimix-Hyprcursor") then if not utils.is_file_exists(DATA_HOME .. "/icons/Vimix-Hyprcursor") then
local tmppath = "/tmp/Vimix-Hyprcursor" local tmppath = "/tmp/Vimix-Hyprcursor"
os.execute("git clone https://gitea.phy-yingjie.wang/wyj/Vimix-Hyprcursor.git " .. tmppath) os.execute("git clone https://gitea.phy-yingjie.wang/wyj/Vimix-Hyprcursor.git " .. tmppath)
os.execute("cp " .. tmppath .. "/theme_Vimix-Hyprcursor " .. DATA_HOME .. "/icons/Vimix-Hyprcursor") os.execute("cp " .. tmppath .. "/theme_Vimix-Hyprcursor " .. DATA_HOME .. "/icons/Vimix-Hyprcursor")
end end
end end
end end
function M.load() function M.load()
M.fetch_Vimix_hyprcursor() M.fetch_Vimix_hyprcursor()
hl.env("HYPRCURSOR_THEME", M.cursor) hl.env("HYPRCURSOR_THEME", M.cursor)
hl.env("HYPRCURSOR_SIZE", tostring(M.size)) hl.env("HYPRCURSOR_SIZE", tostring(M.size))
end end
return M return M
+42 -42
View File
@@ -3,51 +3,51 @@ local colorscheme = require("lua.conf.colorscheme")
--local settings = require("lua.lib.settings") --local settings = require("lua.lib.settings")
M.confs = { M.confs = {
general = { general = {
gaps_in = 10, gaps_in = 10,
gaps_out = 14, gaps_out = 14,
border_size = 2, border_size = 2,
col = { active_border = colorscheme.accent, inactive_border = colorscheme.foreground .. "a0" }, col = { active_border = colorscheme.accent, inactive_border = colorscheme.foreground .. "a0" },
}, },
group = { group = {
col = { border_active = colorscheme.second, border_inactive = colorscheme.foreground .. "a0" }, col = { border_active = colorscheme.second, border_inactive = colorscheme.foreground .. "a0" },
groupbar = { groupbar = {
font_size = 12, font_size = 12,
text_color = colorscheme.foreground, text_color = colorscheme.foreground,
height = 16, height = 16,
gradients = false, gradients = false,
col = { active = colorscheme.teal, inactive = colorscheme.accent }, col = { active = colorscheme.teal, inactive = colorscheme.accent },
}, },
}, },
decoration = { decoration = {
rounding = 12, rounding = 12,
rounding_power = 3.0, rounding_power = 3.0,
blur = { blur = {
enabled = true, enabled = true,
size = 12, size = 12,
passes = 3, passes = 3,
noise = 0.06, noise = 0.06,
new_optimizations = true, new_optimizations = true,
ignore_opacity = true, ignore_opacity = true,
xray = false, xray = false,
popups = true, popups = true,
popups_ignorealpha = 0.3, popups_ignorealpha = 0.3,
}, },
active_opacity = 1.0, active_opacity = 1.0,
inactive_opacity = 0.8, inactive_opacity = 0.8,
fullscreen_opacity = 1.0, fullscreen_opacity = 1.0,
shadow = { shadow = {
enabled = true, enabled = true,
range = 15, range = 15,
render_power = 2, render_power = 2,
color = 0xbb000000, color = 0xbb000000,
offset = { 1, 1 }, offset = { 1, 1 },
}, },
}, },
} }
function M.load() function M.load()
hl.config(M.confs) hl.config(M.confs)
end end
return M return M
+7 -7
View File
@@ -4,19 +4,19 @@ local M = {}
---@type table<string, string> ---@type table<string, string>
M.envs = { M.envs = {
XDG_SESSION_TYPE = "wayland", XDG_SESSION_TYPE = "wayland",
XDG_SESSION_DESKTOP = "Hyprland", XDG_SESSION_DESKTOP = "Hyprland",
QT_AUTO_SCREEN_SCALE_FACTOR = "1", QT_AUTO_SCREEN_SCALE_FACTOR = "1",
} }
if settings["locale"] and settings["locale"] ~= "" then if settings["locale"] and settings["locale"] ~= "" then
M.envs["LANG"] = settings["locale"] M.envs["LANG"] = settings["locale"]
end end
function M.load() function M.load()
for name, value in pairs(M.envs) do for name, value in pairs(M.envs) do
hl.env(name, value) hl.env(name, value)
end end
end end
return M return M
+9 -9
View File
@@ -19,13 +19,13 @@ require("lua.plugins").load()
require("lua.animations").load() require("lua.animations").load()
if string.sub(settings["hostname"], 1, 4) == "ATRI" then if string.sub(settings["hostname"], 1, 4) == "ATRI" then
hl.on("hyprland.start", function() hl.on("hyprland.start", function()
hl.exec_cmd("kitty", { hl.exec_cmd("kitty", {
workspace = "1 silent", workspace = "1 silent",
}) })
hl.exec_cmd("kitty -o font_size=10 btop", { hl.exec_cmd("kitty -o font_size=10 btop", {
workspace = "2 silent", workspace = "2 silent",
}) })
hl.exec_cmd("sleep 1 && pw-play ~/.local/share/startupsounds/start-computeraif-14572.mp3") hl.exec_cmd("sleep 1 && pw-play ~/.local/share/startupsounds/start-computeraif-14572.mp3")
end) end)
end end
+22 -22
View File
@@ -3,41 +3,41 @@ local settings = require("lua.lib.settings")
local utils = require("lua.lib.utils") local utils = require("lua.lib.utils")
M.confs = { M.confs = {
input = { touchpad = {} }, input = { touchpad = {} },
gestures = {}, gestures = {},
} }
if settings["profile"] == "desktop" then if settings["profile"] == "desktop" then
M.confs.input = table.insert(M.confs.input, { numlock_by_default = true }) M.confs.input = table.insert(M.confs.input, { numlock_by_default = true })
elseif settings["profile"] == "laptop" then elseif settings["profile"] == "laptop" then
M.confs.gestures = table.insert(M.confs.gestures, { workspace_swipe_touch = true }) M.confs.gestures = table.insert(M.confs.gestures, { workspace_swipe_touch = true })
M.gestures = { M.gestures = {
{ {
fingers = 3, fingers = 3,
direction = "horizontal", direction = "horizontal",
action = "workspace", action = "workspace",
}, },
} }
end end
--M.confs.input.touchpad.natural_scroll = settings["touchpad_natural_scroll"] --M.confs.input.touchpad.natural_scroll = settings["touchpad_natural_scroll"]
M.confs = utils.tbl_recursive_merge(M.confs, { M.confs = utils.tbl_recursive_merge(M.confs, {
input = { input = {
touchpad = { touchpad = {
natural_scroll = settings["touchpad_natural_scroll"], natural_scroll = settings["touchpad_natural_scroll"],
}, },
}, },
}) })
M.confs.input.kb_layout = settings["kb_layout"] M.confs.input.kb_layout = settings["kb_layout"]
function M.load() function M.load()
hl.config(M.confs) hl.config(M.confs)
if M.gestures then if M.gestures then
for _, gesture in pairs(M.gestures) do for _, gesture in pairs(M.gestures) do
hl.gesture(gesture) hl.gesture(gesture)
end end
end end
end end
return M return M
+43 -43
View File
@@ -1,56 +1,56 @@
local M = {} local M = {}
M.layer_rules = { M.layer_rules = {
{ {
name = "blur-basic-layers", name = "blur-basic-layers",
match = { match = {
namespace = "^(gtk-layer-shell|logout_dialog|nwg-drawer)$", namespace = "^(gtk-layer-shell|logout_dialog|nwg-drawer)$",
}, },
blur = true, blur = true,
}, },
{ {
name = "waybar-translucent-popups", name = "waybar-translucent-popups",
match = { match = {
namespace = "^(waybar)$", namespace = "^(waybar)$",
}, },
blur_popups = true, blur_popups = true,
ignore_alpha = 0.10, ignore_alpha = 0.10,
}, },
{ {
name = "rofi-blurred-xray", name = "rofi-blurred-xray",
match = { match = {
namespace = "^(rofi)$", namespace = "^(rofi)$",
}, },
blur = true, blur = true,
xray = true, xray = true,
ignore_alpha = 0, ignore_alpha = 0,
}, },
{ {
name = "swaync-control-center-blur", name = "swaync-control-center-blur",
match = { match = {
namespace = "^(swaync-control-center)$", namespace = "^(swaync-control-center)$",
}, },
blur = true, blur = true,
ignore_alpha = 0.5, ignore_alpha = 0.5,
}, },
{ {
name = "swayosd-blur", name = "swayosd-blur",
match = { match = {
namespace = "^(swayosd)$", namespace = "^(swayosd)$",
}, },
blur = true, blur = true,
ignore_alpha = 0.3, ignore_alpha = 0.3,
}, },
} }
function M.load() function M.load()
for _, rule in ipairs(M.layer_rules) do for _, rule in ipairs(M.layer_rules) do
hl.layer_rule(rule) hl.layer_rule(rule)
end end
end end
return M return M
+10 -10
View File
@@ -2,19 +2,19 @@ local M = {}
local settings = require("lua.lib.settings") local settings = require("lua.lib.settings")
M.confs = { M.confs = {
general = { general = {
layout = settings["default_layout"], layout = settings["default_layout"],
}, },
dwindle = { dwindle = {
preserve_split = true, preserve_split = true,
}, },
master = {}, master = {},
scrolling = {}, scrolling = {},
monocle = {}, monocle = {},
} }
function M.load() function M.load()
hl.config(M.confs) hl.config(M.confs)
end end
return M return M
+10 -10
View File
@@ -3,19 +3,19 @@ local colorscheme = require("lua.conf.colorscheme")
local settings = require("lua.lib.settings") local settings = require("lua.lib.settings")
M.confs = { M.confs = {
misc = { misc = {
disable_hyprland_logo = true, disable_hyprland_logo = true,
disable_splash_rendering = true, disable_splash_rendering = true,
vrr = 3, vrr = 3,
enable_swallow = true, enable_swallow = true,
swallow_regex = "^(kitty|Alacritty)$", swallow_regex = "^(kitty|Alacritty)$",
background_color = colorscheme.background, background_color = colorscheme.background,
font_family = settings["font_family"], font_family = settings["font_family"],
}, },
} }
function M.load() function M.load()
hl.config(M.confs) hl.config(M.confs)
end end
return M return M
+8 -8
View File
@@ -6,17 +6,17 @@ local M = {}
M.monitors = {} M.monitors = {}
if settings["host"] == "laptop" then if settings["host"] == "laptop" then
M.monitors = table.insert({ { M.monitors = table.insert({ {
output = "eDP-1", output = "eDP-1",
mode = "highres", mode = "highres",
scale = "auto", scale = "auto",
} }) } })
end end
function M:load() function M:load()
for _, monitor in ipairs(self.monitors) do for _, monitor in ipairs(self.monitors) do
hl.monitor(monitor) hl.monitor(monitor)
end end
end end
return utils.extend_config(M, "lua.user.conf.monitor") return utils.extend_config(M, "lua.user.conf.monitor")
+4 -4
View File
@@ -2,13 +2,13 @@ local M = {}
local events = require("lua.lib.events") local events = require("lua.lib.events")
M.autostart = { M.autostart = {
function() function()
hl.exec_cmd("~/dotfiles/hypr/scripts/init-wallpaper-engine.sh") hl.exec_cmd("~/dotfiles/hypr/scripts/init-wallpaper-engine.sh")
end, end,
} }
function M.load() function M.load()
events.map("hyprland.start", M.autostart) events.map("hyprland.start", M.autostart)
end end
return M return M
+38 -38
View File
@@ -1,47 +1,47 @@
local M = {} local M = {}
M.window_rules = { M.window_rules = {
{ {
name = "floating-utils", name = "floating-utils",
match = { match = {
class = "^(pavucontrol|blueman-manager|nm-connection-editor|qalculate-gtk|xdg-desktop-portal-gtk)$", class = "^(pavucontrol|blueman-manager|nm-connection-editor|qalculate-gtk|xdg-desktop-portal-gtk)$",
}, },
float = true, float = true,
}, },
{ {
name = "floating-mathematica", name = "floating-mathematica",
match = { match = {
title = "^(Mathematica|WolframNB)$", title = "^(Mathematica|WolframNB)$",
}, },
float = true, float = true,
}, },
{ {
name = "transparent-vscode", name = "transparent-vscode",
match = { match = {
class = "^(code|code-url-handler)$", class = "^(code|code-url-handler)$",
}, },
opacity = "0.8", opacity = "0.8",
}, },
{ {
name = "floating-social-apps", name = "floating-social-apps",
match = { match = {
class = "^(QQ|wechat)$", class = "^(QQ|wechat)$",
}, },
float = true, float = true,
}, },
{ {
name = "floating-download-manager", name = "floating-download-manager",
match = { match = {
class = "^(fdm)$", class = "^(fdm)$",
}, },
float = true, float = true,
}, },
} }
function M.load() function M.load()
for _, rule in ipairs(M.window_rules) do for _, rule in ipairs(M.window_rules) do
hl.window_rule(rule) hl.window_rule(rule)
end end
end end
return M return M
+42 -42
View File
@@ -3,69 +3,69 @@ local bind = {}
bind.leader = "SUPER" bind.leader = "SUPER"
local function merge(...) local function merge(...)
local out = {} local out = {}
for _, t in ipairs({ ... }) do for _, t in ipairs({ ... }) do
if t ~= nil then if t ~= nil then
for k, v in pairs(t) do for k, v in pairs(t) do
out[k] = v out[k] = v
end end
end end
end end
return out return out
end end
function bind.with_leader(keys) function bind.with_leader(keys)
if keys == nil or keys == "" then if keys == nil or keys == "" then
return bind.leader return bind.leader
end end
return bind.leader .. " + " .. keys return bind.leader .. " + " .. keys
end end
function bind.key(keys, dispatcher, desc, opts) function bind.key(keys, dispatcher, desc, opts)
local flags = merge(opts) local flags = merge(opts)
if desc ~= nil then if desc ~= nil then
flags.description = desc flags.description = desc
end end
return hl.bind(keys, dispatcher, flags) return hl.bind(keys, dispatcher, flags)
end end
function bind.set(table) function bind.set(table)
local keys = table.keys local keys = table.keys
local dispatcher = table.dispatcher local dispatcher = table.dispatcher
local desc = "" local desc = ""
local opts = {} local opts = {}
if table.desc ~= nil and table.desc ~= "" then if table.desc ~= nil and table.desc ~= "" then
desc = table.desc desc = table.desc
end end
if table.opts ~= nil then if table.opts ~= nil then
opts = table.opts opts = table.opts
end end
bind.key(keys, dispatcher, desc, opts) bind.key(keys, dispatcher, desc, opts)
end end
function bind.map(table) function bind.map(table)
for _, item in pairs(table) do for _, item in pairs(table) do
bind.set(item) bind.set(item)
end end
end end
function bind.layout_dispatcher(actions, fallback) function bind.layout_dispatcher(actions, fallback)
return function() return function()
local ws = hl.get_active_special_workspace() or hl.get_active_workspace() local ws = hl.get_active_special_workspace() or hl.get_active_workspace()
if not ws then if not ws then
return return
end end
local action = actions[ws.tiled_layout] or fallback local action = actions[ws.tiled_layout] or fallback
if action then if action then
hl.dispatch(action) hl.dispatch(action)
end end
end end
end end
return bind return bind
+3 -3
View File
@@ -1,9 +1,9 @@
local M = {} local M = {}
function M.map(event, func_list) function M.map(event, func_list)
for _, func in pairs(func_list) do for _, func in pairs(func_list) do
hl.on(event, func) hl.on(event, func)
end end
end end
return M return M
+2 -2
View File
@@ -1,12 +1,12 @@
HOME = os.getenv("HOME") HOME = os.getenv("HOME")
CONFIG_HOME = os.getenv("XDG_CONFIG_HOME") CONFIG_HOME = os.getenv("XDG_CONFIG_HOME")
if not CONFIG_HOME then if not CONFIG_HOME then
CONFIG_HOME = HOME .. "/.config" CONFIG_HOME = HOME .. "/.config"
end end
HYPR = CONFIG_HOME .. "/hypr" HYPR = CONFIG_HOME .. "/hypr"
USER_CONFIG = HYPR .. "/lua/user" USER_CONFIG = HYPR .. "/lua/user"
DATA_HOME = os.getenv("XDG_DATA_HOME") DATA_HOME = os.getenv("XDG_DATA_HOME")
if not DATA_HOME then if not DATA_HOME then
DATA_HOME = HOME .. "/.local/share" DATA_HOME = HOME .. "/.local/share"
end end
+12 -12
View File
@@ -23,9 +23,9 @@ settings["font_family"] = "FiraCode Nerd Font"
---@type table<string, string> ---@type table<string, string>
settings["apps"] = { settings["apps"] = {
terminal = "kitty", terminal = "kitty",
file_manager = "thunar", file_manager = "thunar",
browser = "chromium", browser = "chromium",
} }
---@type "catppuccin"|"catppuccin-mocha" ---@type "catppuccin"|"catppuccin-mocha"
@@ -36,19 +36,19 @@ settings["systemd"] = false
---@type table<string, boolean> ---@type table<string, boolean>
settings["modules"] = { settings["modules"] = {
hypridle = true, hypridle = true,
waybar = true, waybar = true,
swaync = true, swaync = true,
swayosd = true, swayosd = true,
cliphist = true, cliphist = true,
pypr = true, pypr = true,
fcitx5 = false, fcitx5 = false,
rofi = true, rofi = true,
} }
---@type table<string, boolean> ---@type table<string, boolean>
settings["plugins"] = { settings["plugins"] = {
hyprexpo = false, hyprexpo = false,
} }
return require("lua.lib.utils").extend_config(settings, "lua.user.settings") return require("lua.lib.utils").extend_config(settings, "lua.user.settings")
+13 -13
View File
@@ -2,30 +2,30 @@ local utils = require("lua.lib.utils")
local M = {} local M = {}
function M.is_user_unit_exists(unit) function M.is_user_unit_exists(unit)
return utils.command_success("systemctl --user cat " .. utils.shell_quote(unit) .. " >/dev/null 2>&1") return utils.command_success("systemctl --user cat " .. utils.shell_quote(unit) .. " >/dev/null 2>&1")
end end
M.user_unit_dir = CONFIG_HOME .. "/systemd/user" M.user_unit_dir = CONFIG_HOME .. "/systemd/user"
function M.ensure_user_unit(unit, source) function M.ensure_user_unit(unit, source)
if M.is_user_unit_exists(unit) then if M.is_user_unit_exists(unit) then
return true return true
end end
local target_dir = M.user_unit_dir local target_dir = M.user_unit_dir
local target = target_dir .. "/" .. unit local target = target_dir .. "/" .. unit
local cmd = table.concat({ local cmd = table.concat({
"mkdir -p " .. utils.shell_quote(target_dir), "mkdir -p " .. utils.shell_quote(target_dir),
"ln -s " .. utils.shell_quote(source) .. " " .. utils.shell_quote(target), "ln -s " .. utils.shell_quote(source) .. " " .. utils.shell_quote(target),
"systemctl --user daemon-reload", "systemctl --user daemon-reload",
}, " && ") }, " && ")
return utils.command_success(cmd) return utils.command_success(cmd)
end end
function M.start_user_unit(unit) function M.start_user_unit(unit)
return utils.command_success("systemctl --user start " .. utils.shell_quote(unit) .. " >/dev/null 2>&1") return utils.command_success("systemctl --user start " .. utils.shell_quote(unit) .. " >/dev/null 2>&1")
end end
return M return M
+82 -82
View File
@@ -3,134 +3,134 @@ require("lua.lib.globals")
local M = {} local M = {}
local function is_table(x) local function is_table(x)
return type(x) == "table" return type(x) == "table"
end end
local function is_list(t) local function is_list(t)
if type(t) ~= "table" then if type(t) ~= "table" then
return false return false
end end
local n = 0 local n = 0
for k, _ in pairs(t) do for k, _ in pairs(t) do
if type(k) ~= "number" then if type(k) ~= "number" then
return false return false
end end
if k > n then if k > n then
n = k n = k
end end
end end
for i = 1, n do for i = 1, n do
if t[i] == nil then if t[i] == nil then
return false return false
end end
end end
return true return true
end end
function M.list_extend(dst, src) function M.list_extend(dst, src)
for _, value in ipairs(src) do for _, value in ipairs(src) do
table.insert(dst, value) table.insert(dst, value)
end end
return dst return dst
end end
local function deepcopy(value, seen) local function deepcopy(value, seen)
if type(value) ~= "table" then if type(value) ~= "table" then
return value return value
end end
seen = seen or {} seen = seen or {}
if seen[value] then if seen[value] then
return seen[value] return seen[value]
end end
local result = {} local result = {}
seen[value] = result seen[value] = result
for k, v in pairs(value) do for k, v in pairs(value) do
result[deepcopy(k, seen)] = deepcopy(v, seen) result[deepcopy(k, seen)] = deepcopy(v, seen)
end end
return result return result
end end
function M.tbl_recursive_merge(defaults, overrides) function M.tbl_recursive_merge(defaults, overrides)
local result = deepcopy(defaults) local result = deepcopy(defaults)
if not is_table(overrides) then if not is_table(overrides) then
return result return result
end end
for key, value in pairs(overrides) do for key, value in pairs(overrides) do
if is_table(value) and is_table(result[key]) then if is_table(value) and is_table(result[key]) then
result[key] = M.tbl_recursive_merge(result[key], value) result[key] = M.tbl_recursive_merge(result[key], value)
else else
result[key] = deepcopy(value) result[key] = deepcopy(value)
end end
end end
return result return result
end end
function M.extend_config(defaults, user_module) function M.extend_config(defaults, user_module)
local file = HYPR .. "/" .. string.gsub(user_module, "%.", "/") .. ".lua" local file = HYPR .. "/" .. string.gsub(user_module, "%.", "/") .. ".lua"
if not M.is_file_exists(file) then if not M.is_file_exists(file) then
print(file .. " not found.") print(file .. " not found.")
return deepcopy(defaults) return deepcopy(defaults)
end end
local ok, overrides = pcall(require, user_module) local ok, overrides = pcall(require, user_module)
if not ok then if not ok then
return deepcopy(defaults) return deepcopy(defaults)
end end
if type(overrides) ~= "table" then if type(overrides) ~= "table" then
return deepcopy(defaults) return deepcopy(defaults)
end end
return M.tbl_recursive_merge(defaults, overrides) return M.tbl_recursive_merge(defaults, overrides)
end end
function M.is_file_exists(name) function M.is_file_exists(name)
local f = io.open(name, "r") local f = io.open(name, "r")
if f ~= nil then if f ~= nil then
io.close(f) io.close(f)
return true return true
else else
return false return false
end end
end end
function M.exec_if_file_extes(file) function M.exec_if_file_extes(file)
if M.is_file_exists(file) then if M.is_file_exists(file) then
hl.exec_cmd(file) hl.exec_cmd(file)
else else
hl.notification.create({ file .. " doesn't extist", 5000, 0 }) hl.notification.create({ file .. " doesn't extist", 5000, 0 })
end end
end end
function M.create_if_not_exists(path) function M.create_if_not_exists(path)
if not M.is_file_exists(path) then if not M.is_file_exists(path) then
os.execute('mkdir -pv "$(dirname "' .. path .. '")"') os.execute('mkdir -pv "$(dirname "' .. path .. '")"')
os.execute("touch " .. path) os.execute("touch " .. path)
return true return true
end end
return false return false
end end
function M.shell_quote(s) function M.shell_quote(s)
return "'" .. tostring(s):gsub("'", "'\\''") .. "'" return "'" .. tostring(s):gsub("'", "'\\''") .. "'"
end end
function M.command_success(cmd) function M.command_success(cmd)
local ok = os.execute(cmd) local ok = os.execute(cmd)
return ok == true or ok == 0 return ok == true or ok == 0
end end
return M return M
+2 -2
View File
@@ -1,11 +1,11 @@
local M = {} local M = {}
local function start_wl_clipboard() local function start_wl_clipboard()
hl.exec_cmd("wl-paste --watch cliphist store") hl.exec_cmd("wl-paste --watch cliphist store")
end end
M.autostart = { M.autostart = {
start_wl_clipboard, start_wl_clipboard,
} }
return M return M
+10 -10
View File
@@ -3,22 +3,22 @@ local bind = require("lua.lib.bind")
local M = {} local M = {}
M.binds = { M.binds = {
{ {
keys = bind.with_leader("CTRL + E"), keys = bind.with_leader("CTRL + E"),
dispatcher = hl.dsp.exec_cmd("pkill fcitx5 -9;sleep 1;fcitx5 -d"), dispatcher = hl.dsp.exec_cmd("pkill fcitx5 -9;sleep 1;fcitx5 -d"),
desc = "restart fcitx5", desc = "restart fcitx5",
}, },
} }
M.autostart = { M.autostart = {
function() function()
hl.exec_cmd("fcitx5 -d") hl.exec_cmd("fcitx5 -d")
end, end,
} }
M.envs = { M.envs = {
QT_IM_MODULE = "fcitx", QT_IM_MODULE = "fcitx",
XMODIFIERS = "@im=fcitx", XMODIFIERS = "@im=fcitx",
} }
return M return M
+2 -2
View File
@@ -1,11 +1,11 @@
local M = {} local M = {}
local function start_hypridle() local function start_hypridle()
hl.exec_cmd("hypridle") hl.exec_cmd("hypridle")
end end
M.autostart = { M.autostart = {
start_hypridle, start_hypridle,
} }
return M return M
+30 -30
View File
@@ -8,30 +8,30 @@ local M = {}
local modules = {} local modules = {}
local function is_module_exists(name) local function is_module_exists(name)
return utils.is_file_exists(HYPR .. "/lua/modules/" .. name .. ".lua") return utils.is_file_exists(HYPR .. "/lua/modules/" .. name .. ".lua")
end end
local function load_module(name) local function load_module(name)
if not is_module_exists(name) then if not is_module_exists(name) then
return {} return {}
end end
local default_mod = require("lua.modules." .. name) local default_mod = require("lua.modules." .. name)
local user_modname = "lua.user.modules." .. name local user_modname = "lua.user.modules." .. name
local mod = utils.extend_config(default_mod, user_modname) local mod = utils.extend_config(default_mod, user_modname)
return mod return mod
end end
for name, enabled in pairs(settings.modules) do for name, enabled in pairs(settings.modules) do
if enabled then if enabled then
local mod = load_module(name) local mod = load_module(name)
print("module " .. name .. " loaded.") print("module " .. name .. " loaded.")
table.insert(modules, { table.insert(modules, {
name = name, name = name,
config = mod, config = mod,
}) })
end end
end end
M.autostart = {} M.autostart = {}
@@ -40,27 +40,27 @@ M.binds = {}
M.envs = {} M.envs = {}
local function collect_modules_prop(module, prop) local function collect_modules_prop(module, prop)
if module[prop] then if module[prop] then
M[prop] = utils.list_extend(M[prop], module[prop]) M[prop] = utils.list_extend(M[prop], module[prop])
end end
end end
for _, item in ipairs(modules) do for _, item in ipairs(modules) do
local module = item.config local module = item.config
collect_modules_prop(module, "autostart") collect_modules_prop(module, "autostart")
collect_modules_prop(module, "autostop") collect_modules_prop(module, "autostop")
collect_modules_prop(module, "binds") collect_modules_prop(module, "binds")
collect_modules_prop(module, "envs") collect_modules_prop(module, "envs")
end end
function M.load() function M.load()
events.map("hyprland.start", M.autostart) events.map("hyprland.start", M.autostart)
events.map("hyprland.shutdown", M.autostop) events.map("hyprland.shutdown", M.autostop)
bind.map(M.binds) bind.map(M.binds)
for name, value in pairs(M.envs) do for name, value in pairs(M.envs) do
hl.env(name, value) hl.env(name, value)
end end
end end
return M return M
+7 -7
View File
@@ -2,19 +2,19 @@ local bind = require("lua.lib.bind")
local M = {} local M = {}
local function start_pypr() local function start_pypr()
hl.exec_cmd("pypr") hl.exec_cmd("pypr")
end end
M.autostart = { M.autostart = {
start_pypr, start_pypr,
} }
M.binds = { M.binds = {
{ {
keys = bind.with_leader("SHIFT + Return"), keys = bind.with_leader("SHIFT + Return"),
dispatcher = hl.dsp.exec_cmd("pypr toggle term"), dispatcher = hl.dsp.exec_cmd("pypr toggle term"),
desc = "Pyprland: toggle drop terminal", desc = "Pyprland: toggle drop terminal",
}, },
} }
return M return M
+20 -20
View File
@@ -3,26 +3,26 @@ local bind = require("lua.lib.bind")
local M = {} local M = {}
M.binds = { M.binds = {
{ {
keys = bind.with_leader("Space"), keys = bind.with_leader("Space"),
dispatcher = hl.dsp.exec_cmd("rofi -show drun -replace -i"), dispatcher = hl.dsp.exec_cmd("rofi -show drun -replace -i"),
desc = "Rofi launcher", desc = "Rofi launcher",
}, },
{ {
keys = bind.with_leader("CTRL + W"), keys = bind.with_leader("CTRL + W"),
dispatcher = hl.dsp.exec_cmd("~/dotfiles/hypr/scripts/wallpaper.sh select"), dispatcher = hl.dsp.exec_cmd("~/dotfiles/hypr/scripts/wallpaper.sh select"),
desc = "Rofi wallpaper selector", desc = "Rofi wallpaper selector",
}, },
{ {
keys = bind.with_leader("Print"), keys = bind.with_leader("Print"),
dispatcher = hl.dsp.exec_cmd("~/dotfiles/hypr/scripts/screenshot.sh"), dispatcher = hl.dsp.exec_cmd("~/dotfiles/hypr/scripts/screenshot.sh"),
desc = "Rofi screenshot dialog", desc = "Rofi screenshot dialog",
}, },
{ {
keys = bind.with_leader("V"), keys = bind.with_leader("V"),
dispatcher = hl.dsp.exec_cmd("~/dotfiles/scripts/cliphist.sh"), dispatcher = hl.dsp.exec_cmd("~/dotfiles/scripts/cliphist.sh"),
desc = "Rofi cliphist clipboard manager", desc = "Rofi cliphist clipboard manager",
}, },
} }
return M return M
+16 -16
View File
@@ -5,32 +5,32 @@ require("lua.lib.globals")
local M = {} local M = {}
local function start_swaync() local function start_swaync()
if settings["systemd"] then if settings["systemd"] then
local unit = "swaync.service" local unit = "swaync.service"
local source = HYPR .. "/systemd/" .. unit local source = HYPR .. "/systemd/" .. unit
if systemd.ensure_user_unit(unit, source) then if systemd.ensure_user_unit(unit, source) then
hl.exec_cmd("systemctl --user start swaync") hl.exec_cmd("systemctl --user start swaync")
else else
hl.exec_cmd("swaync") hl.exec_cmd("swaync")
end end
else else
hl.exec_cmd("swaync") hl.exec_cmd("swaync")
end end
end end
local function stop_swaync() local function stop_swaync()
if settings["systemd"] and utils.command_success("systemctl --user status swaync") then if settings["systemd"] and utils.command_success("systemctl --user status swaync") then
hl.exec_cmd("systemctl --user stop swaync") hl.exec_cmd("systemctl --user stop swaync")
end end
end end
M.autostart = { M.autostart = {
start_swaync, start_swaync,
} }
M.autostop = { M.autostop = {
stop_swaync, stop_swaync,
} }
return M return M
+79 -79
View File
@@ -6,101 +6,101 @@ require("lua.lib.globals")
local M = {} local M = {}
local function start_swayosd() local function start_swayosd()
if settings["systemd"] then if settings["systemd"] then
local unit = "swayosd.service" local unit = "swayosd.service"
local source = HYPR .. "/systemd/" .. unit local source = HYPR .. "/systemd/" .. unit
if systemd.ensure_user_unit(unit, source) then if systemd.ensure_user_unit(unit, source) then
hl.exec_cmd("systemctl --user start swayosd") hl.exec_cmd("systemctl --user start swayosd")
else else
hl.exec_cmd("swayosd-server") hl.exec_cmd("swayosd-server")
end end
else else
hl.exec_cmd("swayosd-server") hl.exec_cmd("swayosd-server")
end end
end end
local function stop_swayosd() local function stop_swayosd()
if settings["systemd"] and utils.command_success("systemctl --user status swayosd") then if settings["systemd"] and utils.command_success("systemctl --user status swayosd") then
hl.exec_cmd("systemctl --user stop swayosd") hl.exec_cmd("systemctl --user stop swayosd")
else else
hl.exec_cmd("pkill -9 swayosd-server") hl.exec_cmd("pkill -9 swayosd-server")
end end
end end
M.autostart = { M.autostart = {
start_swayosd, start_swayosd,
} }
M.autostop = { M.autostop = {
stop_swayosd, stop_swayosd,
} }
local function swayosd_client_cmd(args) local function swayosd_client_cmd(args)
return hl.dsp.exec_cmd("swayosd-client " .. args) return hl.dsp.exec_cmd("swayosd-client " .. args)
end end
M.binds = { M.binds = {
{ {
keys = "XF86MonBrightnessUp", keys = "XF86MonBrightnessUp",
dispatcher = swayosd_client_cmd("--brightness raise"), dispatcher = swayosd_client_cmd("--brightness raise"),
dosc = "Increase brightness ", dosc = "Increase brightness ",
opts = { repeating = true, locked = true }, opts = { repeating = true, locked = true },
}, },
{ {
keys = "XF86MonBrightnessDown", keys = "XF86MonBrightnessDown",
dispatcher = swayosd_client_cmd("--brightness lower"), dispatcher = swayosd_client_cmd("--brightness lower"),
desc = "Decrease brightness ", desc = "Decrease brightness ",
opts = { repeating = true, locked = true }, opts = { repeating = true, locked = true },
}, },
{ {
keys = "XF86AudioRaiseVolume", keys = "XF86AudioRaiseVolume",
dispatcher = swayosd_client_cmd("--output-volume raise"), dispatcher = swayosd_client_cmd("--output-volume raise"),
desc = "Increase brightness ", desc = "Increase brightness ",
opts = { repeating = true, locked = true }, opts = { repeating = true, locked = true },
}, },
{ {
keys = "XF86AudioLowerVolume", keys = "XF86AudioLowerVolume",
dispatcher = swayosd_client_cmd("--output-volume lower"), dispatcher = swayosd_client_cmd("--output-volume lower"),
desc = "Decrease brightness ", desc = "Decrease brightness ",
opts = { repeating = true, locked = true }, opts = { repeating = true, locked = true },
}, },
{ {
keys = "XF86AudioMute", keys = "XF86AudioMute",
dispatcher = swayosd_client_cmd("--output-volume mute-toggle"), dispatcher = swayosd_client_cmd("--output-volume mute-toggle"),
desc = "Toggle output mute", desc = "Toggle output mute",
opts = { repeating = true, locked = true }, opts = { repeating = true, locked = true },
}, },
{ {
keys = "XF86AudioMicMute", keys = "XF86AudioMicMute",
dispatcher = swayosd_client_cmd("--input-volume mute-toggle"), dispatcher = swayosd_client_cmd("--input-volume mute-toggle"),
desc = "Toggle input mute", desc = "Toggle input mute",
opts = { repeating = true, locked = true }, opts = { repeating = true, locked = true },
}, },
{ {
keys = "XF86AudioPlay", keys = "XF86AudioPlay",
dispatcher = swayosd_client_cmd("--playerctl play-pause"), dispatcher = swayosd_client_cmd("--playerctl play-pause"),
desc = "Player play/pause", desc = "Player play/pause",
opts = { locked = true }, opts = { locked = true },
}, },
{ {
keys = "XF86AudioPause", keys = "XF86AudioPause",
dispatcher = swayosd_client_cmd("--playerctl pause"), dispatcher = swayosd_client_cmd("--playerctl pause"),
desc = "Player pause", desc = "Player pause",
opts = { locked = true }, opts = { locked = true },
}, },
{ {
keys = "XF86AudioNext", keys = "XF86AudioNext",
dispatcher = swayosd_client_cmd("--playerctl next"), dispatcher = swayosd_client_cmd("--playerctl next"),
desc = "Player next", desc = "Player next",
opts = { locked = true }, opts = { locked = true },
}, },
{ {
keys = "XF86AudioPrev", keys = "XF86AudioPrev",
dispatcher = swayosd_client_cmd("--playerctl prev"), dispatcher = swayosd_client_cmd("--playerctl prev"),
desc = "Player previous", desc = "Player previous",
opts = { locked = true }, opts = { locked = true },
}, },
} }
return M return M
+12 -12
View File
@@ -2,24 +2,24 @@ local M = {}
local bind = require("lua.lib.bind") local bind = require("lua.lib.bind")
local function start_waybar() local function start_waybar()
hl.exec_cmd("~/dotfiles/waybar/launch.sh") hl.exec_cmd("~/dotfiles/waybar/launch.sh")
end end
M.autostart = { M.autostart = {
start_waybar, start_waybar,
} }
M.binds = { M.binds = {
{ {
keys = bind.with_leader("SHIFT + B"), keys = bind.with_leader("SHIFT + B"),
dispatcher = hl.dsp.exec_cmd("~/dotfiles/waybar/launch.sh"), dispatcher = hl.dsp.exec_cmd("~/dotfiles/waybar/launch.sh"),
desc = "(re)launch waybar", desc = "(re)launch waybar",
}, },
{ {
keys = bind.with_leader("CTRL + B"), keys = bind.with_leader("CTRL + B"),
dispatcher = hl.dsp.exec_cmd("~/dotfiles/waybar/toggle.sh"), dispatcher = hl.dsp.exec_cmd("~/dotfiles/waybar/toggle.sh"),
desc = "toggle waybar", desc = "toggle waybar",
}, },
} }
return M return M
+3 -3
View File
@@ -4,9 +4,9 @@ local colorscheme = require("lua.conf.colorscheme")
local M = {} local M = {}
M.autostart = { M.autostart = {
function () function()
hl.exec_cmd("hyprctl plugin load /usr/lib/hyprland-plugins/hyprexpo.so") hl.exec_cmd("hyprctl plugin load /usr/lib/hyprland-plugins/hyprexpo.so")
end end,
} }
M.confs = { M.confs = {
@@ -41,7 +41,7 @@ M.binds = {
dispatcher = function() dispatcher = function()
hl.plugin.hyprexpo.expo("toggle") hl.plugin.hyprexpo.expo("toggle")
end, end,
desc = "Toggle hyprexpo" desc = "Toggle hyprexpo",
}, },
} }
+27 -27
View File
@@ -8,33 +8,33 @@ local M = {}
local plugins = {} local plugins = {}
local function is_plugin_exists(name) local function is_plugin_exists(name)
return utils.is_file_exists(HYPR .. "/lua/plugins/" .. name .. ".lua") return utils.is_file_exists(HYPR .. "/lua/plugins/" .. name .. ".lua")
end end
local function load_plugin(name) local function load_plugin(name)
if not is_plugin_exists(name) then if not is_plugin_exists(name) then
return {} return {}
end end
local default_plug = require("lua.plugins." .. name) local default_plug = require("lua.plugins." .. name)
local user_plugname = "lua.user.plugins." .. name local user_plugname = "lua.user.plugins." .. name
local plug = utils.extend_config(default_plug, user_plugname) local plug = utils.extend_config(default_plug, user_plugname)
return plug return plug
end end
print("loading plugins...") print("loading plugins...")
for name, enabled in pairs(settings.plugins) do for name, enabled in pairs(settings.plugins) do
print("plugin ".. name .." enabled is "..tostring(enabled)) print("plugin " .. name .. " enabled is " .. tostring(enabled))
if enabled then if enabled then
local plug = load_plugin(name) local plug = load_plugin(name)
print("plugin " .. name .. " loaded.") print("plugin " .. name .. " loaded.")
table.insert(plugins, { table.insert(plugins, {
name = name, name = name,
config = plug, config = plug,
}) })
end end
end end
M.autostart = {} M.autostart = {}
@@ -42,24 +42,24 @@ M.binds = {}
M.confs = {} M.confs = {}
local function collect_plugins_prop(plugin, prop) local function collect_plugins_prop(plugin, prop)
if plugin[prop] then if plugin[prop] then
M[prop] = utils.list_extend(M[prop], plugin[prop]) M[prop] = utils.list_extend(M[prop], plugin[prop])
end end
end end
for _, item in ipairs(plugins) do for _, item in ipairs(plugins) do
local plugin = item.config local plugin = item.config
collect_plugins_prop(plugin, "autostart") collect_plugins_prop(plugin, "autostart")
collect_plugins_prop(plugin, "binds") collect_plugins_prop(plugin, "binds")
collect_plugins_prop(plugin, "confs") collect_plugins_prop(plugin, "confs")
end end
function M.load() function M.load()
events.map("hyprland.start", M.autostart) events.map("hyprland.start", M.autostart)
bind.map(M.binds) bind.map(M.binds)
hl.config(M.confs) hl.config(M.confs)
end end
return M return M