From d825277ed5660b34923d5be70b9c4fdbc399201e Mon Sep 17 00:00:00 2001 From: Thomas Date: Wed, 14 Oct 2026 17:40:01 +0200 Subject: [PATCH] move to example files for custom config --- .config/hypr/.gitignore | 2 +- .config/hypr/custom/autostart.example | 9 ++++++++ .config/hypr/custom/autostart.lua | 6 ------ .config/hypr/custom/environments.example | 7 ++++++ .config/hypr/custom/environments.lua | 1 - .config/hypr/custom/inputs.example | 8 +++++++ .config/hypr/custom/inputs.lua | 3 --- .config/hypr/custom/keybinds.example | 7 ++++++ .config/hypr/custom/keybinds.lua | 1 - .config/hypr/custom/monitors.example | 9 ++++++++ .config/hypr/custom/monitors.lua | 6 ------ .config/hypr/custom/windowrules.example | 15 +++++++++++++ .config/hypr/custom/windowrules.lua | 2 -- .config/hypr/custom/workspacerules.example | 7 ++++++ .config/hypr/custom/workspacerules.lua | 4 ---- .config/hypr/hyprland.lua | 25 ++++++++++++++++------ README.md | 18 ++++++++++++++++ 17 files changed, 99 insertions(+), 31 deletions(-) create mode 100644 .config/hypr/custom/autostart.example delete mode 100644 .config/hypr/custom/autostart.lua create mode 100644 .config/hypr/custom/environments.example delete mode 100644 .config/hypr/custom/environments.lua create mode 100644 .config/hypr/custom/inputs.example delete mode 100644 .config/hypr/custom/inputs.lua create mode 100644 .config/hypr/custom/keybinds.example delete mode 100644 .config/hypr/custom/keybinds.lua create mode 100644 .config/hypr/custom/monitors.example delete mode 100644 .config/hypr/custom/monitors.lua create mode 100644 .config/hypr/custom/windowrules.example delete mode 100644 .config/hypr/custom/windowrules.lua create mode 100644 .config/hypr/custom/workspacerules.example delete mode 100644 .config/hypr/custom/workspacerules.lua diff --git a/.config/hypr/.gitignore b/.config/hypr/.gitignore index 8b13789..7a02621 100644 --- a/.config/hypr/.gitignore +++ b/.config/hypr/.gitignore @@ -1 +1 @@ - +custom/*.lua diff --git a/.config/hypr/custom/autostart.example b/.config/hypr/custom/autostart.example new file mode 100644 index 0000000..89e2635 --- /dev/null +++ b/.config/hypr/custom/autostart.example @@ -0,0 +1,9 @@ +-- Machine-specific autostart. Loaded after hyprland/autostart.lua. +-- Usage: cp autostart.example autostart.lua (autostart.lua is ignored by git) +-- https://wiki.hypr.land/Configuring/Autostart/ + +-- hl.on("hyprland.start", function() +-- hl.exec_cmd("some-program") +-- end) + +-- vim: ft=lua diff --git a/.config/hypr/custom/autostart.lua b/.config/hypr/custom/autostart.lua deleted file mode 100644 index 6804dc9..0000000 --- a/.config/hypr/custom/autostart.lua +++ /dev/null @@ -1,6 +0,0 @@ --- User-specific autostart. Loaded after hyprland/autostart.lua. - -hl.on("hyprland.start", function() - hl.exec_cmd("dbus-update-activation-environment --systemd --all") - hl.exec_cmd("systemctl --user start hyprland-session.target") -end) \ No newline at end of file diff --git a/.config/hypr/custom/environments.example b/.config/hypr/custom/environments.example new file mode 100644 index 0000000..2e1dda3 --- /dev/null +++ b/.config/hypr/custom/environments.example @@ -0,0 +1,7 @@ +-- Machine-specific environment variables. Loaded after hyprland/environments.lua. +-- Usage: cp environments.example environments.lua (environments.lua is ignored by git) +-- https://wiki.hypr.land/Configuring/Environment-variables/ + +-- hl.env("XCURSOR_SIZE", "24") + +-- vim: ft=lua diff --git a/.config/hypr/custom/environments.lua b/.config/hypr/custom/environments.lua deleted file mode 100644 index cc262ec..0000000 --- a/.config/hypr/custom/environments.lua +++ /dev/null @@ -1 +0,0 @@ --- User-specific environment variables. Loaded after hyprland/environments.lua. diff --git a/.config/hypr/custom/inputs.example b/.config/hypr/custom/inputs.example new file mode 100644 index 0000000..c86a61b --- /dev/null +++ b/.config/hypr/custom/inputs.example @@ -0,0 +1,8 @@ +-- Machine-specific input config (kb_layout, per-device, gestures). Loaded after hyprland/inputs.lua. +-- Usage: cp inputs.example inputs.lua (inputs.lua is ignored by git) +-- List your devices with: hyprctl devices +-- https://wiki.hypr.land/Configuring/Variables/#input + +-- hl.device({ name = "my-mouse-name", sensitivity = -0.5 }) + +-- vim: ft=lua diff --git a/.config/hypr/custom/inputs.lua b/.config/hypr/custom/inputs.lua deleted file mode 100644 index b46bd45..0000000 --- a/.config/hypr/custom/inputs.lua +++ /dev/null @@ -1,3 +0,0 @@ --- User-specific input config (kb_layout, per-device, gestures). Loaded after hyprland/inputs.lua. - -hl.device({ name = "logitech-g-pro--1", sensitivity = -0.8 }) \ No newline at end of file diff --git a/.config/hypr/custom/keybinds.example b/.config/hypr/custom/keybinds.example new file mode 100644 index 0000000..244b99e --- /dev/null +++ b/.config/hypr/custom/keybinds.example @@ -0,0 +1,7 @@ +-- Machine-specific keybinds. Loaded after hyprland/keybinds.lua. +-- Usage: cp keybinds.example keybinds.lua (keybinds.lua is ignored by git) +-- https://wiki.hypr.land/Configuring/Binds/ + +-- hl.bind("SUPER + B", hl.dsp.exec_cmd("firefox")) + +-- vim: ft=lua diff --git a/.config/hypr/custom/keybinds.lua b/.config/hypr/custom/keybinds.lua deleted file mode 100644 index 8e37673..0000000 --- a/.config/hypr/custom/keybinds.lua +++ /dev/null @@ -1 +0,0 @@ --- User-specific keybinds. Loaded after hyprland/keybinds.lua. diff --git a/.config/hypr/custom/monitors.example b/.config/hypr/custom/monitors.example new file mode 100644 index 0000000..150feeb --- /dev/null +++ b/.config/hypr/custom/monitors.example @@ -0,0 +1,9 @@ +-- Machine-specific monitors. Loaded after hyprland/monitors.lua. +-- Usage: cp monitors.example monitors.lua (monitors.lua is ignored by git) +-- List your outputs with: hyprctl monitors all +-- https://wiki.hypr.land/Configuring/Monitors/ + +-- hl.monitor({ output = "eDP-1", mode = "1920x1080@60", position = "auto", scale = 1 }) +-- hl.monitor({ output = "DP-1", mode = "2560x1440@144", position = "auto", scale = 1, vrr = 1 }) + +-- vim: ft=lua diff --git a/.config/hypr/custom/monitors.lua b/.config/hypr/custom/monitors.lua deleted file mode 100644 index fb774bf..0000000 --- a/.config/hypr/custom/monitors.lua +++ /dev/null @@ -1,6 +0,0 @@ --- User-specific monitor overrides. Loaded after hyprland/monitors.lua. - -hl.monitor({ output = "eDP-1", mode = "2256x1504@60", position = "auto", scale = 1.33, bitdepth = 10, vrr = 1 }) -hl.monitor({ output = "DP-3", mode = "3440x1440@99", position = "auto", scale = 1, bitdepth = 10, vrr = 1 }) -hl.monitor({ output = "DP-4", mode = "4096x2160@120", position = "auto", scale = 1.33, bitdepth = 10, vrr = 1 }) - diff --git a/.config/hypr/custom/windowrules.example b/.config/hypr/custom/windowrules.example new file mode 100644 index 0000000..5b7c11d --- /dev/null +++ b/.config/hypr/custom/windowrules.example @@ -0,0 +1,15 @@ +-- Machine-specific window rules. +-- https://wiki.hypr.land/Configuring/Window-Rules/ + +-- Uncomment these lines to enable window rules for these apps: +-- require("custom/windowrules/godot") + +-- Rules for an app used only on this machine can go directly here: +-- hl.window_rule({ +-- name = "float-myapp", +-- match = { class = "myapp" }, +-- float = true, +-- center = true, +-- }) + +-- vim: ft=lua diff --git a/.config/hypr/custom/windowrules.lua b/.config/hypr/custom/windowrules.lua deleted file mode 100644 index 150ad09..0000000 --- a/.config/hypr/custom/windowrules.lua +++ /dev/null @@ -1,2 +0,0 @@ --- User-specific windowrules. Loaded after hyprland/windowrules.lua. -require("custom/windowrules/godot") diff --git a/.config/hypr/custom/workspacerules.example b/.config/hypr/custom/workspacerules.example new file mode 100644 index 0000000..77b968e --- /dev/null +++ b/.config/hypr/custom/workspacerules.example @@ -0,0 +1,7 @@ +-- Machine-specific workspace rules. +-- Usage: cp workspacerules.example workspacerules.lua (workspacerules.lua is ignored by git) +-- https://wiki.hypr.land/Configuring/Workspace-Rules/ + +-- hl.workspace_rule({ workspace = "1", monitor = "eDP-1", persistent = true, default_name = "web" }) + +-- vim: ft=lua diff --git a/.config/hypr/custom/workspacerules.lua b/.config/hypr/custom/workspacerules.lua deleted file mode 100644 index b79d022..0000000 --- a/.config/hypr/custom/workspacerules.lua +++ /dev/null @@ -1,4 +0,0 @@ -hl.workspace_rule({ workspace = "1", monitor = "eDP-1", persistent = true, default_name = "web" }) ---hl.workspace_rule({ workspace = "2", monitor = "eDP-1", persistent = true, default_name = "code" }) --- hl.workspace_rule({ workspace = "3", monitor = "eDP-1", persistent = true, default_name = "chat" }) --- hl.workspace_rule({ workspace = "4", monitor = "eDP-1", persistent = true, default_name = "game" }) diff --git a/.config/hypr/hyprland.lua b/.config/hypr/hyprland.lua index 0703d76..541b070 100644 --- a/.config/hypr/hyprland.lua +++ b/.config/hypr/hyprland.lua @@ -5,8 +5,19 @@ -- Do not edit files in `hyprland/` (shared defaults across all -- users). Put any changes in the matching file under `custom/`, -- which is loaded after and overrides the defaults. +-- +-- `custom/*.lua` files are machine-specific and ignored by git. +-- Create one by copying its template: cp custom/X.example custom/X.lua +-- Missing custom files are simply skipped. -- ############################################################## +-- Load a module only if its file exists (errors inside it still surface). +local function optional(module) + if package.searchpath(module, package.path) then + require(module) + end +end + -- Defaults (do not edit) -- require("hyprland/monitors") require("hyprland/environments") @@ -18,13 +29,13 @@ require("hyprland/keybinds") require("hyprland/windowrules") -- Custom -- -require("custom/autostart") -require("custom/monitors") -require("custom/environments") -require("custom/inputs") -require("custom/keybinds") -require("custom/windowrules") -require("custom/workspacerules") +optional("custom/autostart") +optional("custom/monitors") +optional("custom/environments") +optional("custom/inputs") +optional("custom/keybinds") +optional("custom/windowrules") +optional("custom/workspacerules") -- For Noctalia Color templates require("noctalia").apply_theme() diff --git a/README.md b/README.md index ba78e8a..ab1423f 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,24 @@ stow . all the files should now be simlinked to your $HOME folder +### Machine-specific Hyprland config + +`~/.config/hypr/hyprland/` holds the shared defaults, don't edit them. +To tweak a single machine (monitors, devices, keybinds…), copy the matching template in `~/.config/hypr/custom/`: + +``` +cd ~/.config/hypr/custom +cp monitors.example monitors.lua +``` + +`custom/*.lua` files are ignored by git and loaded after the defaults; missing ones are simply skipped. + +Per-app window rules are shared in `custom/windowrules/.lua`. Enable the ones you want in your `custom/windowrules.lua`: + +```lua +require("custom/windowrules/godot") +``` + ### Theme switcher user the SUPER + T shortcut to switch between light and dark theme