From 027552a3dbdf439522c60b64dcf24b180322d01e Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Thu, 27 Aug 2026 11:47:21 -0400 Subject: [PATCH] hyprland setup --- .pre-commit-config.yaml | 2 +- configs/fwbook/hypr/.luarc.json | 6 + configs/fwbook/hypr/.zed/settings.json | 13 + configs/fwbook/hypr/conf/animations.lua | 29 +- configs/fwbook/hypr/conf/env.lua | 4 + configs/fwbook/hypr/conf/general.lua | 12 + configs/fwbook/hypr/conf/hyprgrass.lua | 75 ++--- configs/fwbook/hypr/conf/keybindings.lua | 54 ++-- configs/fwbook/hypr/conf/monitors.lua | 44 ++- configs/fwbook/hypr/stylua.toml | 6 + configs/fwbook/hypr/types/hl.lua | 395 +++++++++++++++++++++++ flake.nix | 2 + 12 files changed, 556 insertions(+), 86 deletions(-) create mode 100644 configs/fwbook/hypr/.luarc.json create mode 100644 configs/fwbook/hypr/.zed/settings.json create mode 100644 configs/fwbook/hypr/stylua.toml create mode 100644 configs/fwbook/hypr/types/hl.lua diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0379012..10f2e35 120000 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1 +1 @@ -/nix/store/i9wwy5p3qn5258yi6qw4v10m8i0w8cyb-pre-commit-config.json \ No newline at end of file +/nix/store/1y2prhr11kqqf6ky1z8kmhbv4djcy499-pre-commit-config.json \ No newline at end of file diff --git a/configs/fwbook/hypr/.luarc.json b/configs/fwbook/hypr/.luarc.json new file mode 100644 index 0000000..8dcaa05 --- /dev/null +++ b/configs/fwbook/hypr/.luarc.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json", + "workspace.library": ["types"], + "diagnostics.globals": ["hl"], + "runtime.version": "Lua 5.4" +} diff --git a/configs/fwbook/hypr/.zed/settings.json b/configs/fwbook/hypr/.zed/settings.json new file mode 100644 index 0000000..3a5b7bd --- /dev/null +++ b/configs/fwbook/hypr/.zed/settings.json @@ -0,0 +1,13 @@ +{ + "languages": { + "Lua": { + "formatter": { + "external": { + "command": "stylua", + "arguments": ["--config-path", ".config/hypr/stylua.toml", "-"] + } + }, + "format_on_save": "on" + } + } +} diff --git a/configs/fwbook/hypr/conf/animations.lua b/configs/fwbook/hypr/conf/animations.lua index b98ad06..b84801c 100644 --- a/configs/fwbook/hypr/conf/animations.lua +++ b/configs/fwbook/hypr/conf/animations.lua @@ -1,19 +1,8 @@ -- ========================= -- Animations -- ========================= --- niri stacks workspaces vertically (Mod+Up/Down, 3-finger vertical swipe), so --- switch the workspace transition to a vertical slide instead of Hyprland's --- default horizontal `slide`. Only the `workspaces` leaf is overridden; --- workspacesIn/Out inherit it and every other animation stays on defaults. - --- hl.animation requires an explicit bezier/spring (there is no built-in --- "default" curve name in the Lua API), so define one first. -hl.curve("wsslide", { - type = "bezier", - points = { { 0.05, 0.9 }, { 0.1, 1.0 } }, -}) - +-- Animation to Mimic Niri's up/down slide for workspaces hl.animation({ leaf = "workspaces", enabled = true, @@ -21,3 +10,19 @@ hl.animation({ bezier = "wsslide", style = "slidevert", }) + +hl.animation({ + leaf = "windows", + enabled = true, + speed = 5, + bezier = "default", + style = "slidefade 60%", +}) + +hl.animation({ + leaf = "windowsMove", + enabled = true, + speed = 5, + bezier = "default", + style = "slidefade 80%", +}) diff --git a/configs/fwbook/hypr/conf/env.lua b/configs/fwbook/hypr/conf/env.lua index 285297f..507b87f 100644 --- a/configs/fwbook/hypr/conf/env.lua +++ b/configs/fwbook/hypr/conf/env.lua @@ -4,7 +4,11 @@ -- Mirrors the environment block in configs/niri/shared/general.kdl. hl.env("XCURSOR_SIZE", "24") +hl.env("XCURSOR_THEME", "Adwaita") hl.env("HYPRCURSOR_SIZE", "24") +hl.env("HYPRCURSOR_THEME", "") +-- No HYPRCURSOR_THEME set: no hyprcursor themes are installed, so Hyprland +-- falls back to XCursor (XCURSOR_THEME) rather than showing its built-in default. hl.env("NIXOS_OZONE_WL", "1") hl.env("QT_QPA_PLATFORM", "wayland") hl.env("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1") diff --git a/configs/fwbook/hypr/conf/general.lua b/configs/fwbook/hypr/conf/general.lua index 75a2910..364bc5f 100644 --- a/configs/fwbook/hypr/conf/general.lua +++ b/configs/fwbook/hypr/conf/general.lua @@ -16,6 +16,8 @@ hl.config({ decoration = { rounding = 12, + active_opacity = 1.0, + inactive_opacity = 0.9, }, -- https://wiki.hypr.land/Configuring/Layouts/Scrolling-Layout/ @@ -30,6 +32,16 @@ hl.config({ explicit_column_widths = "0.333, 0.5, 0.667, 1.0", }, + -- Cursor: use the GTK (gsettings) cursor theme instead of Hyprcursor. + -- sync_gsettings_theme makes Hyprland follow org.gnome.desktop.interface + -- cursor-theme; enable_hyprcursor = false skips the hyprcursor backend + -- entirely (no hyprcursor themes are installed) so the XCursor fallback + -- with XCURSOR_THEME from conf/env.lua is used. + cursor = { + sync_gsettings_theme = true, + enable_hyprcursor = false, + }, + -- Disable Hyprland's logo wallpaper (niri: hot-corners off has no analog). misc = { disable_hyprland_logo = true, diff --git a/configs/fwbook/hypr/conf/hyprgrass.lua b/configs/fwbook/hypr/conf/hyprgrass.lua index 4e8c8ce..6029857 100644 --- a/configs/fwbook/hypr/conf/hyprgrass.lua +++ b/configs/fwbook/hypr/conf/hyprgrass.lua @@ -13,54 +13,41 @@ -- both of which only exist once the plugin is loaded. hl.plugin.load(os.getenv("HYPRGRASS_SO")) --- hl.config({ --- plugin = { --- hyprgrass = { --- -- The default sensitivity is probably too low on tablet screens, --- -- I recommend turning it up to 4.0 --- sensitivity = 4.0, +hl.config({ + plugin = { + hyprgrass = { + -- The default sensitivity is probably too low on tablet screens, + -- I recommend turning it up to 4.0 + sensitivity = 4.0, --- -- in milliseconds --- long_press_delay = 400, + -- in milliseconds + long_press_delay = 400, --- -- resize windows by long-pressing on window borders and gaps. --- resize_on_border_long_press = true, + -- resize windows by long-pressing on window borders and gaps. + resize_on_border_long_press = true, --- -- in pixels, the distance from the edge that is considered an edge --- edge_margin = 10, --- } --- } --- }) + -- in pixels, the distance from the edge that is considered an edge + edge_margin = 10, + }, + }, +}) --- -- -- ========================= --- -- -- Custom gesture bindings --- -- -- ========================= +-- ========================= +-- Custom gesture bindings +-- ========================= -- -- -- 4-finger swipes to switch workspaces --- hl.plugin.hyprgrass.gesture { --- pattern = { kind = "swipe", fingers = 4, direction = "left" }, --- action = "workspace", --- } --- hl.plugin.hyprgrass.gesture { --- pattern = { kind = "swipe", fingers = 4, direction = "right" }, --- action = "workspace", --- } +hl.plugin.hyprgrass.gesture({ + pattern = { kind = "swipe", fingers = 4, direction = "left" }, + action = "workspace", +}) +hl.plugin.hyprgrass.gesture({ + pattern = { kind = "swipe", fingers = 4, direction = "right" }, + action = "workspace", +}) --- -- 3-finger swipe down to close the focused window --- hl.plugin.hyprgrass.gesture { --- pattern = { kind = "swipe", fingers = 3, direction = "down" }, --- action = "close", --- } - --- -- 3-finger tap to toggle floating --- hl.plugin.hyprgrass.bind { --- pattern = { kind = "tap", fingers = 3 }, --- action = hl.dsp.window.float(), --- } - --- -- Long-press with 3 fingers to drag the focused window --- hl.plugin.hyprgrass.bind { --- pattern = { kind = "longpress", fingers = 3 }, --- action = hl.dsp.window.drag(), --- mouse = true, --- } +-- 3-finger tap to toggle floating +hl.plugin.hyprgrass.bind({ + pattern = { kind = "tap", fingers = 3 }, + action = hl.dsp.window.float(), +}) diff --git a/configs/fwbook/hypr/conf/keybindings.lua b/configs/fwbook/hypr/conf/keybindings.lua index 90bfb37..5068ee5 100644 --- a/configs/fwbook/hypr/conf/keybindings.lua +++ b/configs/fwbook/hypr/conf/keybindings.lua @@ -19,10 +19,10 @@ hl.bind(mod .. " + Q", hl.dsp.window.close()) -- ========================= -- Navigation -- ========================= -hl.bind(mod .. " + left", hl.dsp.focus({ direction = "left" })) +hl.bind(mod .. " + left", hl.dsp.focus({ direction = "left" })) hl.bind(mod .. " + right", hl.dsp.focus({ direction = "right" })) -- niri workspaces are vertical stacks; map Up/Down to workspace switching. -hl.bind(mod .. " + up", hl.dsp.focus({ workspace = "e-1" })) +hl.bind(mod .. " + up", hl.dsp.focus({ workspace = "e-1" })) hl.bind(mod .. " + down", hl.dsp.focus({ workspace = "e+1" })) -- niri: toggle-overview — no native overview / no buildable plugin; cycle windows. @@ -33,17 +33,24 @@ hl.bind(mod .. " + SHIFT + Tab", hl.dsp.focus({ monitor = "+1" })) -- ========================= -- Window Management -- ========================= --- niri swap-window-left/right -> scrolling swapcol +-- niri swap-window-left/right -> swap focused window with neighbour in direction +-- hl.bind(mod .. " + CTRL + right", function() +-- hl.dispatch(hl.dsp.resize({x = 1, relative = true})) +-- hl.dispatch(hl.dsp.layout("swapcol r")) +-- end) hl.bind(mod .. " + CTRL + right", hl.dsp.layout("swapcol r")) -hl.bind(mod .. " + CTRL + left", hl.dsp.layout("swapcol l")) --- niri move-window-to-workspace-up/down (follow the window) -hl.bind(mod .. " + CTRL + up", hl.dsp.window.move({ workspace = "e-1", follow = true })) -hl.bind(mod .. " + CTRL + down", hl.dsp.window.move({ workspace = "e+1", follow = true })) +hl.bind(mod .. " + CTRL + left", hl.dsp.layout("swapcol l")) +-- hl.bind(mod .. " + CTRL + right", hl.dsp.window.move({ direction = "right" })) +-- hl.bind(mod .. " + CTRL + left", hl.dsp.window.move({ direction = "left" })) +-- niri move-window-to-workspace-up/down (same monitor, follow the window) +hl.bind(mod .. " + CTRL + up", hl.dsp.window.move({ workspace = "r-1", follow = true })) +hl.bind(mod .. " + CTRL + down", hl.dsp.window.move({ workspace = "r+1", follow = true })) -- niri: toggle-column-tabbed-display (closest: group/tab windows together) hl.bind(mod .. " + W", hl.dsp.group.toggle()) --- niri: maximize-column (fill screen, keep bar/margins) +-- niri: maximize-column -> cycle through preset column widths (colresize +conf)` hl.bind(mod .. " + F", hl.dsp.window.fullscreen({ mode = "maximized", action = "toggle" })) +-- hl.bind(mod .. " + F", hl.dsp.layout("colresize +conf")) -- niri: fullscreen-window (true fullscreen) hl.bind(mod .. " + SHIFT + F", hl.dsp.window.fullscreen({ mode = "fullscreen", action = "toggle" })) -- niri: reset-window-height (scrolling has no per-window height; refit column) @@ -66,7 +73,7 @@ hl.bind(mod .. " + SHIFT + equal", hl.dsp.window.resize({ x = 0, y = 50, relativ -- ========================= -- Screenshots & Recording -- ========================= -hl.bind("Print", hl.dsp.exec_cmd('grim -g "$(slurp)" - | satty -f -')) +hl.bind("Print", hl.dsp.exec_cmd('grim -g "$(slurp)" - | satty -f -')) hl.bind(mod .. " + P", hl.dsp.exec_cmd('grim -g "$(slurp)" - | satty -f -')) hl.bind(mod .. " + R", hl.dsp.exec_cmd("~/.config/hypr/screen-record.sh")) @@ -81,10 +88,10 @@ hl.bind("CTRL + ALT + Delete", hl.dsp.exec_cmd("uwsm stop")) -- Monitor Movement -- ========================= -- niri move-column-to-monitor-{down,left,right,up} -hl.bind(mod .. " + ALT + down", hl.dsp.window.move({ monitor = "d" })) -hl.bind(mod .. " + ALT + left", hl.dsp.window.move({ monitor = "l" })) +hl.bind(mod .. " + ALT + down", hl.dsp.window.move({ monitor = "d" })) +hl.bind(mod .. " + ALT + left", hl.dsp.window.move({ monitor = "l" })) hl.bind(mod .. " + ALT + right", hl.dsp.window.move({ monitor = "r" })) -hl.bind(mod .. " + ALT + up", hl.dsp.window.move({ monitor = "u" })) +hl.bind(mod .. " + ALT + up", hl.dsp.window.move({ monitor = "u" })) -- niri moved workspaces between monitors via Mod + touchpad scroll. That now -- lives in conf/inputs.lua as Mod + 3-finger swipe gestures (mods = "SUPER"). @@ -92,30 +99,33 @@ hl.bind(mod .. " + ALT + up", hl.dsp.window.move({ monitor = "u" })) -- ========================= -- Mouse drag (move / resize windows) -- ========================= -hl.bind(mod .. " + mouse:272", hl.dsp.window.drag(), { mouse = true }) +hl.bind(mod .. " + mouse:272", hl.dsp.window.drag(), { mouse = true }) hl.bind(mod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true }) -- ========================= -- Noctalia shell (mirrors configs/niri/noctalia/binds.kdl) -- ========================= hl.bind(mod .. " + Space", hl.dsp.exec_cmd("noctalia msg panel-toggle launcher")) -hl.bind(mod .. " + S", hl.dsp.exec_cmd("noctalia msg panel-toggle control-center")) +hl.bind(mod .. " + S", hl.dsp.exec_cmd("noctalia msg panel-toggle control-center")) hl.bind(mod .. " + comma", hl.dsp.exec_cmd("noctalia msg settings-toggle")) -- Clipboard history -hl.bind(mod .. " + ALT + P", hl.dsp.exec_cmd('rofi -modi "clipboard:greenclip print" -show clipboard')) +hl.bind( + mod .. " + ALT + P", + hl.dsp.exec_cmd('rofi -modi "clipboard:greenclip print" -show clipboard') +) -- Dismiss all notifications hl.bind(mod .. " + ALT + L", hl.dsp.exec_cmd("noctalia msg notification-clear-active")) -- Media & brightness -hl.bind(mod .. " + SHIFT + up", hl.dsp.exec_cmd("noctalia msg volume-up")) -hl.bind(mod .. " + SHIFT + down", hl.dsp.exec_cmd("noctalia msg volume-down")) +hl.bind(mod .. " + SHIFT + up", hl.dsp.exec_cmd("noctalia msg volume-up")) +hl.bind(mod .. " + SHIFT + down", hl.dsp.exec_cmd("noctalia msg volume-down")) hl.bind(mod .. " + SHIFT + right", hl.dsp.exec_cmd("playerctl next")) -hl.bind(mod .. " + SHIFT + left", hl.dsp.exec_cmd("playerctl previous")) +hl.bind(mod .. " + SHIFT + left", hl.dsp.exec_cmd("playerctl previous")) hl.bind(mod .. " + SHIFT + Space", hl.dsp.exec_cmd("playerctl play-pause")) -hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("noctalia msg volume-up"), { locked = true }) -hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("noctalia msg volume-down"), { locked = true }) -hl.bind("XF86AudioMute", hl.dsp.exec_cmd("noctalia msg volume-mute"), { locked = true }) -hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("noctalia msg brightness-up"), { locked = true }) +hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("noctalia msg volume-up"), { locked = true }) +hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("noctalia msg volume-down"), { locked = true }) +hl.bind("XF86AudioMute", hl.dsp.exec_cmd("noctalia msg volume-mute"), { locked = true }) +hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("noctalia msg brightness-up"), { locked = true }) hl.bind("XF86MonBrightnessDown", hl.dsp.exec_cmd("noctalia msg brightness-down"), { locked = true }) diff --git a/configs/fwbook/hypr/conf/monitors.lua b/configs/fwbook/hypr/conf/monitors.lua index 2c5ccba..f2e919f 100644 --- a/configs/fwbook/hypr/conf/monitors.lua +++ b/configs/fwbook/hypr/conf/monitors.lua @@ -4,20 +4,50 @@ -- Translated from configs/niri/shared/outputs.kdl. -- Laptop internal panel -hl.monitor({ output = "eDP-1", mode = "2256x1504@60", position = "859x1080", scale = 1.5 }) +hl.monitor({ output = "eDP-1", mode = "2256x1504@60", position = "859x1080", scale = 1.57 }) -- Work monitor (ASUS VE278) -hl.monitor({ output = "desc:Ancor Communications Inc ASUS VE278 E5LMTF016849", mode = "1920x1080@60", position = "1027x0", scale = 1 }) +hl.monitor({ + output = "desc:Ancor Communications Inc ASUS VE278 E5LMTF016849", + mode = "1920x1080@60", + position = "1027x0", + scale = 1, +}) -- Assorted external displays hl.monitor({ output = "DP-9", mode = "1920x1080@74.97", position = "0x0", scale = 1 }) -hl.monitor({ output = "desc:Samsung Electric Company S22R35x H4TR604392", mode = "1920x1080@60", position = "106x0", scale = 1 }) +hl.monitor({ + output = "desc:Samsung Electric Company S22R35x H4TR604392", + mode = "1920x1080@60", + position = "106x0", + scale = 1, +}) hl.monitor({ output = "DP-10", mode = "1920x1080@74.97", position = "1920x0", scale = 1 }) -hl.monitor({ output = "desc:Samsung Electric Company S22R35x H4TR503886", mode = "1920x1080@60", position = "2026x0", scale = 1 }) -hl.monitor({ output = "desc:PNP(GWD) ARZOPA", mode = "1920x1080@60", position = "2860x1080", scale = 1 }) +hl.monitor({ + output = "desc:Samsung Electric Company S22R35x H4TR503886", + mode = "1920x1080@60", + position = "2026x0", + scale = 1, +}) +hl.monitor({ + output = "desc:PNP(GWD) ARZOPA", + mode = "1920x1080@60", + position = "2860x1080", + scale = 1, +}) hl.monitor({ output = "DP-2", mode = "1920x1080@60", position = "3115x1504", scale = 1 }) -hl.monitor({ output = "desc:Dell Inc. DELL SE3223Q 1WDWKK3", mode = "preferred", position = "4780x0", scale = 2 }) -hl.monitor({ output = "desc:Dell Inc. DELL SE3223Q 1TRXKK3", mode = "preferred", position = "6700x0", scale = 2 }) +hl.monitor({ + output = "desc:Dell Inc. DELL SE3223Q 1WDWKK3", + mode = "preferred", + position = "4780x0", + scale = 2, +}) +hl.monitor({ + output = "desc:Dell Inc. DELL SE3223Q 1TRXKK3", + mode = "preferred", + position = "6700x0", + scale = 2, +}) -- Fallback for anything not explicitly configured above hl.monitor({ output = "", mode = "preferred", position = "auto", scale = "auto" }) diff --git a/configs/fwbook/hypr/stylua.toml b/configs/fwbook/hypr/stylua.toml new file mode 100644 index 0000000..d903057 --- /dev/null +++ b/configs/fwbook/hypr/stylua.toml @@ -0,0 +1,6 @@ +column_width = 100 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 4 +quote_style = "AutoPreferDouble" +call_parentheses = "Always" diff --git a/configs/fwbook/hypr/types/hl.lua b/configs/fwbook/hypr/types/hl.lua new file mode 100644 index 0000000..d084157 --- /dev/null +++ b/configs/fwbook/hypr/types/hl.lua @@ -0,0 +1,395 @@ +-- ============================================================================= +-- Hyprland Lua API — EmmyLua type stubs +-- ============================================================================= +-- This file is never executed by Hyprland. It exists solely to give +-- lua-language-server type information for the `hl` global that Hyprland +-- injects at runtime (0.55+). +-- +-- Coverage is based on the API surface used in conf/*.lua. Extend as needed +-- when new hl.* calls are added. +-- ============================================================================= + +-- --------------------------------------------------------------------------- +-- Shared primitive types +-- --------------------------------------------------------------------------- + +---@class hl.ConfigTable +---A free-form table mirroring Hyprland's hyprlang config sections. +---Top-level keys map to sections (general, decoration, input, …). +---Nested tables map to sub-sections. Values are numbers, booleans, or strings. + +---@class hl.DispatcherValue +---An opaque value returned by hl.dsp.* factory functions. +---Pass directly to hl.bind() as the `action` argument. + +-- --------------------------------------------------------------------------- +-- hl.dsp — dispatcher factories +-- --------------------------------------------------------------------------- + +---@class hl.dsp.FocusOpts +---@field direction? "left"|"right"|"up"|"down" Focus by direction +---@field workspace? string e.g. "e-1", "e+1", integer +---@field monitor? string e.g. "+1", "-1", name + +---@class hl.dsp.MoveOpts +---@field direction? "left"|"right"|"up"|"down" +---@field workspace? string e.g. "r-1", "r+1" +---@field monitor? "l"|"r"|"u"|"d"|string +---@field follow? boolean Follow the window after move + +---@class hl.dsp.FullscreenOpts +---@field mode? "fullscreen"|"maximize"|"float" +---@field action? "toggle"|"on"|"off" + +---@class hl.dsp.FloatOpts +---@field action? "toggle"|"on"|"off" + +---@class hl.dsp.ResizeOpts +---@field x number Pixel delta (horizontal) +---@field y number Pixel delta (vertical) +---@field relative boolean If true, delta is relative to current size + +---@class hl.dsp +local dsp = {} + +---Focus a window or workspace. +---@param opts hl.dsp.FocusOpts +---@return hl.DispatcherValue +function dsp.focus(opts) end + +---Execute a shell command. +---@param cmd string +---@return hl.DispatcherValue +function dsp.exec_cmd(cmd) end + +---Invoke a named scrolling-layout dispatcher (colresize, swapcol, etc.). +---@param action string e.g. "colresize +0.1", "swapcol l", "fit_into_view", "focus current" +---@return hl.DispatcherValue +function dsp.layout(action) end + +---@class hl.dsp.window +local dsp_window = {} + +---Close the focused window. +---@return hl.DispatcherValue +function dsp_window.close() end + +---Cycle focus to the next window. +---@return hl.DispatcherValue +function dsp_window.cycle_next() end + +---Swap the focused window with a neighbour. +---@param opts? { direction: "l"|"r"|"u"|"d" } +---@return hl.DispatcherValue +function dsp_window.swap(opts) end + +---Move the focused window. +---@param opts hl.dsp.MoveOpts +---@return hl.DispatcherValue +function dsp_window.move(opts) end + +---Toggle/set fullscreen on the focused window. +---@param opts? hl.dsp.FullscreenOpts +---@return hl.DispatcherValue +function dsp_window.fullscreen(opts) end + +---Toggle/set floating on the focused window. +---@param opts? hl.dsp.FloatOpts +---@return hl.DispatcherValue +function dsp_window.float(opts) end + +---Resize the focused window by a pixel delta. +---@param opts? hl.dsp.ResizeOpts +---@return hl.DispatcherValue +function dsp_window.resize(opts) end + +---Begin an interactive mouse drag (move) on the focused window. +---@return hl.DispatcherValue +function dsp_window.drag() end + +---@class hl.dsp.group +local dsp_group = {} + +---Toggle the focused window's group/tab mode. +---@return hl.DispatcherValue +function dsp_group.toggle() end + +---@class hl.dsp.workspace +local dsp_workspace = {} + +---Toggle a special (scratchpad) workspace. +---@param name string +---@return hl.DispatcherValue +function dsp_workspace.toggle_special(name) end + +---Focus a window in pseudo-tile mode. +---@return hl.DispatcherValue +function dsp_window.pseudo() end + +-- Attach sub-namespaces to dsp +dsp.window = dsp_window +dsp.group = dsp_group +dsp.workspace = dsp_workspace + +-- --------------------------------------------------------------------------- +-- hl.bind — keyboard / mouse bindings +-- --------------------------------------------------------------------------- + +---@class hl.BindOpts +---@field mouse? boolean True for mouse-button bindings (mouse:272, mouse:273 …) +---@field locked? boolean Active even on a locked screen (e.g. media keys) +---@field repeating? boolean Fire repeatedly while held (note: key is `repeating`, not `repeat`) + +---Register a keybind. Returns a handle with a `:set_enabled(bool)` method. +---@param keys string Modifier + key string, e.g. "SUPER + T" +---@param action hl.DispatcherValue Return value of an hl.dsp.* factory +---@param opts? hl.BindOpts +---@return hl.BindHandle +function hl.bind(keys, action, opts) end + +---@class hl.BindHandle +local BindHandle = {} +---Enable or disable this bind at runtime. +---@param enabled boolean +function BindHandle:set_enabled(enabled) end + +-- --------------------------------------------------------------------------- +-- hl.config — set hyprlang config values +-- --------------------------------------------------------------------------- + +---Apply a hyprlang config table. Sections that are omitted are left unchanged. +---@param cfg hl.ConfigTable +function hl.config(cfg) end + +-- --------------------------------------------------------------------------- +-- hl.env — environment variables +-- --------------------------------------------------------------------------- + +---Set a Wayland/compositor environment variable. +---@param name string +---@param value string +function hl.env(name, value) end + +-- --------------------------------------------------------------------------- +-- hl.monitor — output / display configuration +-- --------------------------------------------------------------------------- + +---@class hl.MonitorOpts +---@field output string Connector name ("eDP-1") or desc: string, or "" for fallback +---@field mode string Resolution@refresh, e.g. "1920x1080@60", or "preferred" +---@field position string "XxY" pixel offset, or "auto" +---@field scale number|string DPI scale factor, or "auto" +---@field transform? number 0–7 (90° steps + mirror variants) + +---Configure a monitor/output. +---@param opts hl.MonitorOpts +function hl.monitor(opts) end + +-- --------------------------------------------------------------------------- +-- hl.device — per-device input config +-- --------------------------------------------------------------------------- + +---@class hl.DeviceOpts +---@field name string Device name as reported by libinput +---@field sensitivity? number -1.0 to 1.0 +---@field kb_layout? string + +---Apply per-device config. +---@param opts hl.DeviceOpts +function hl.device(opts) end + +-- --------------------------------------------------------------------------- +-- hl.permission — capability permissions +-- --------------------------------------------------------------------------- + +---Grant or deny a permission to a binary (regex path). +---@param binary string Regex matched against the process path +---@param capability string e.g. "screencopy", "plugin" +---@param action "allow"|"deny" +function hl.permission(binary, capability, action) end + +-- --------------------------------------------------------------------------- +-- hl.workspace_rule — workspace rules +-- --------------------------------------------------------------------------- + +---@class hl.WorkspaceRuleOpts +---@field workspace string Workspace selector, e.g. "w[tv1]", "f[1]" +---@field gaps_in? number +---@field gaps_out? number +---@field border_size? number + +---Add a workspace rule. +---@param opts hl.WorkspaceRuleOpts +---@return hl.RuleHandle +function hl.workspace_rule(opts) end + +-- --------------------------------------------------------------------------- +-- hl.layer_rule — layer-shell rules +-- --------------------------------------------------------------------------- + +---@class hl.LayerRuleMatchOpts +---@field namespace? string Regex matched against the layer namespace + +---@class hl.LayerRuleOpts +---@field name string +---@field match hl.LayerRuleMatchOpts +---@field no_anim? boolean + +---Add a layer-shell rule. +---@param opts hl.LayerRuleOpts +---@return hl.RuleHandle +function hl.layer_rule(opts) end + +-- --------------------------------------------------------------------------- +-- hl.gesture — built-in touchpad gesture bindings +-- --------------------------------------------------------------------------- + +---@class hl.GestureOpts +---@field fingers number Number of touch points +---@field direction "horizontal"|"vertical"|"left"|"right"|"up"|"down" +---@field action string|fun() Named action or callback +---@field mods? string Modifier mask, e.g. "SUPER" + +---Register a built-in touchpad gesture. +---@param opts hl.GestureOpts +function hl.gesture(opts) end + +-- --------------------------------------------------------------------------- +-- hl.curve — animation bezier / spring curves +-- --------------------------------------------------------------------------- + +---@class hl.CurveOpts +---@field type "bezier"|"spring" +---@field points? { [1]: number, [2]: number }[] Control points for bezier (two {x,y} pairs) +---@field mass? number Spring mass +---@field stiffness? number Spring stiffness +---@field dampening? number Spring dampening + +---Define a named animation curve. +---@param name string +---@param opts hl.CurveOpts +function hl.curve(name, opts) end + +-- --------------------------------------------------------------------------- +-- hl.animation — animation configuration +-- --------------------------------------------------------------------------- + +---@class hl.AnimationOpts +---@field leaf string Animation leaf name, e.g. "workspaces", "windows", "fadeIn" +---@field enabled boolean +---@field speed number Duration multiplier +---@field bezier? string Named bezier curve defined via hl.curve() +---@field spring? string Named spring curve defined via hl.curve() +---@field style? string Optional style string, e.g. "slidevert", "slidefade 20%", "popin 87%", "fade" + +---Configure an animation leaf. +---@param opts hl.AnimationOpts +function hl.animation(opts) end + +-- --------------------------------------------------------------------------- +-- hl.window_rule — window rules +-- --------------------------------------------------------------------------- + +---@class hl.WindowRuleMatchOpts +---@field class? string Regex matched against window class (app_id) +---@field title? string Regex matched against window title +---@field float? boolean Match floating windows +---@field fullscreen? boolean Match fullscreen windows +---@field pin? boolean Match pinned windows +---@field xwayland? boolean Match XWayland windows +---@field workspace? string Match by workspace selector + +---@class hl.WindowRuleOpts +---@field name string Identifier for the rule +---@field match hl.WindowRuleMatchOpts Match criteria +---@field float? boolean Float the window +---@field tile? boolean Force-tile the window +---@field pin? boolean Pin (always-on-top) the window +---@field opacity? number Override active opacity +---@field no_focus? boolean Prevent focus +---@field border_size? number Override border size +---@field rounding? number Override corner rounding +---@field move? string Position string, e.g. "20 monitor_h-120" +---@field suppress_event? string Event name to suppress, e.g. "maximize" + +---Add a window rule. Returns a handle with a `:set_enabled(bool)` method. +---@param opts hl.WindowRuleOpts +---@return hl.RuleHandle +function hl.window_rule(opts) end + +---@class hl.RuleHandle +local RuleHandle = {} +---Enable or disable this rule at runtime. +---@param enabled boolean +function RuleHandle:set_enabled(enabled) end + +-- --------------------------------------------------------------------------- +-- hl.on — event hooks +-- --------------------------------------------------------------------------- + +---Register a callback for a Hyprland event. +---@param event string e.g. "hyprland.start", "window.open", "monitor.added" +---@param callback fun() +function hl.on(event, callback) end + +-- --------------------------------------------------------------------------- +-- hl.exec_cmd — fire-and-forget command (outside a bind) +-- --------------------------------------------------------------------------- + +---Execute a shell command immediately (not as a dispatcher). +---@param cmd string +function hl.exec_cmd(cmd) end + +-- --------------------------------------------------------------------------- +-- hl.plugin — plugin management +-- --------------------------------------------------------------------------- + +---@class hl.plugin +local plugin = {} + +---Load a Hyprland plugin from its .so path. +---@param path string Absolute path to the shared library +function plugin.load(path) end + +---@class hl.plugin.hyprgrass +local plugin_hyprgrass = {} + +---@class hl.HyprGrassPattern +---@field kind "swipe"|"tap"|"pinch" +---@field fingers number +---@field direction? "left"|"right"|"up"|"down" + +---@class hl.HyprGrassGestureOpts +---@field pattern hl.HyprGrassPattern +---@field action string|hl.DispatcherValue + +---@class hl.HyprGrassBindOpts +---@field pattern hl.HyprGrassPattern +---@field action hl.DispatcherValue + +---Register a hyprgrass gesture. +---@param opts hl.HyprGrassGestureOpts +function plugin_hyprgrass.gesture(opts) end + +---Register a hyprgrass tap/press bind. +---@param opts hl.HyprGrassBindOpts +function plugin_hyprgrass.bind(opts) end + +plugin.hyprgrass = plugin_hyprgrass + +-- --------------------------------------------------------------------------- +-- Global `hl` declaration +-- --------------------------------------------------------------------------- + +---Hyprland Lua API — injected globally by the compositor at startup. +---@class hl +---@field dsp hl.dsp Dispatcher factories (actions for binds/gestures) +---@field plugin hl.plugin Plugin loader and plugin sub-namespaces +hl = { + dsp = dsp, + plugin = plugin, +} + +-- Ensure the global is visible to LuaLS in all files. +---@type hl +hl = hl diff --git a/flake.nix b/flake.nix index 1894632..b13cd90 100644 --- a/flake.nix +++ b/flake.nix @@ -137,6 +137,7 @@ src = ./.; hooks = { nixpkgs-fmt.enable = true; + stylua.enable = true; }; }; in @@ -145,6 +146,7 @@ name = "nixos-setup"; packages = with pkgs; [ nixpkgs-fmt + stylua nixd nh agenix.packages.${system}.default