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