From d418f4eb67a072bfb3d7ba6b6658a3e3a15ba530 Mon Sep 17 00:00:00 2001 From: "Thomas G. Lopes" Date: Thu, 19 Feb 2026 20:35:26 +0000 Subject: [PATCH] readme;agents.md;zellij niri and alacritty --- AGENTS.md | 41 ++ README.md | 24 + niri/config.lua | 6 + niri/files/config.kdl | 596 +++++++++++++++++++ niri/files/config.kdl.backup1768904973 | 677 ++++++++++++++++++++++ niri/files/config.kdl.dmsbackup1769252086 | 551 ++++++++++++++++++ niri/files/generate-config.sh | 78 +++ niri/files/niri-watcher.sh | 27 + zellij/config.lua | 6 + zellij/files/config.kdl | 532 +++++++++++++++++ 10 files changed, 2538 insertions(+) create mode 100644 AGENTS.md create mode 100644 README.md create mode 100644 niri/config.lua create mode 100644 niri/files/config.kdl create mode 100644 niri/files/config.kdl.backup1768904973 create mode 100644 niri/files/config.kdl.dmsbackup1769252086 create mode 100755 niri/files/generate-config.sh create mode 100755 niri/files/niri-watcher.sh create mode 100644 zellij/config.lua create mode 100644 zellij/files/config.kdl diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..86eb83a --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,41 @@ +# Sigil usage (for agents) + +This repo is managed by **Sigil**, a minimal symlink-based dotfile tool. + +## Repo layout +``` +~/.dotfiles/ + / + config.lua + files/ + ... +``` + +Each package has a `config.lua` that defines its target path per OS. + +## Common commands +- `sigil apply` — apply symlinks (prompts for stale links) +- `sigil apply --prune` — prune stale links without prompting +- `sigil add ` — add a file/dir to the repo and symlink it +- `sigil status` — show stale links +- `sigil unlink ` — restore file(s) to target and remove from repo +- `sigil remove ` — same as unlink, plus remove package/subpath from repo + +## Spec formats +`unlink/remove` accept these: +- `package` (entire package) +- `package:relative/path` +- repo path: `~/.dotfiles//files/...` +- target path: e.g. `~/.config//...` + +Examples: +``` +sigil unlink wezterm +sigil unlink wezterm:lua +sigil unlink ~/.dotfiles/wezterm/files/wezterm.lua +sigil unlink ~/.config/wezterm/wezterm.lua +``` + +## Notes +- If a repo file is missing, stale links should be pruned. +- Prefer `sigil add` over manual moves into `files/`. diff --git a/README.md b/README.md new file mode 100644 index 0000000..12dc053 --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +# Dotfiles + +This is my personal dotfiles repository, managed by **Sigil**. + +## Layout +``` +~/.dotfiles/ + / + config.lua + files/ + ... +``` + +Each package has a `config.lua` that defines the target path per OS. + +## Usage (Sigil) +- `sigil apply` — apply symlinks +- `sigil apply --prune` — prune stale links +- `sigil add ` — add a file or folder into the repo +- `sigil status` — show stale links +- `sigil unlink ` — restore files and remove from repo +- `sigil remove ` — same as unlink, plus delete package/subpath + +See `AGENTS.md` for agent-specific guidance. diff --git a/niri/config.lua b/niri/config.lua new file mode 100644 index 0000000..c54f455 --- /dev/null +++ b/niri/config.lua @@ -0,0 +1,6 @@ +return { + target = { + linux = "~/.config/niri", + default = "~/.config/niri", + }, +} diff --git a/niri/files/config.kdl b/niri/files/config.kdl new file mode 100644 index 0000000..10f59f8 --- /dev/null +++ b/niri/files/config.kdl @@ -0,0 +1,596 @@ +// This config is in the KDL format: https://kdl.dev +// "/-" comments out the following node. +// Check the wiki for a full description of the configuration: +// https://github.com/YaLTeR/niri/wiki/Configuration:-Introduction + +include "./dms/colors.kdl" +include "./dms/cursor.kdl" +include "./dms/wpblur.kdl" + +// https://github.com/YaLTeR/niri/wiki/Configuration:-Input +input { + keyboard { + xkb { + // For more information, see xkeyboard-config(7). + layout "us,us_intl" + variant ",qwerty" + options "grp:alt_space_toggle,compose:ralt" + } + + + // Enable numlock on startup, omitting this setting disables it. + numlock + } + + // Next sections include libinput settings. + // Omitting settings disables them, or leaves them at their default values. + touchpad { + // off + tap + // dwt + // dwtp + // drag false + // drag-lock + natural-scroll + // accel-speed 0.2 + // accel-profile "flat" + // scroll-method "two-finger" + // disabled-on-external-mouse + } + + mouse { + // off + // natural-scroll + // accel-speed 0.2 + // accel-profile "flat" + // scroll-method "no-scroll" + } + + trackpoint { + // off + // natural-scroll + // accel-speed 0.2 + // accel-profile "flat" + // scroll-method "on-button-down" + // scroll-button 273 + // middle-emulation + } + + // Uncomment this to make the mouse warp to the center of newly focused windows. + // warp-mouse-to-focus + + // Focus windows and outputs automatically when moving the mouse into them. + // Setting max-scroll-amount="0%" makes it work only on windows already fully on screen. + focus-follows-mouse max-scroll-amount="0%" +} + +// You can configure outputs by their name, which you can find +// by running `niri msg outputs` while inside a niri instance. +// https://github.com/YaLTeR/niri/wiki/Configuration:-Outputs +output "DP-1" { + // Uncomment this line to disable this output. + // off + + // If the refresh rate is omitted, niri will pick the highest refresh rate + // for the resolution. + // If the mode is omitted altogether or is invalid, niri will pick one automatically. + mode "3840x2160@240" + // mode "3840x2160@119.880" + + // You can use integer or fractional scale, for example use 1.5 for 150% scale. + scale 2 + + // Transform allows to rotate the output counter-clockwise, valid values are: + // normal, 90, 180, 270, flipped, flipped-90, flipped-180 and flipped-270. + transform "normal" + + // Position of the output in the global coordinate space. + // This affects directional monitor actions like "focus-monitor-left", and cursor movement. + // The cursor can only move between directly adjacent outputs. + // Output scale and rotation has to be taken into account for positioning: + // outputs are sized in logical, or scaled, pixels. + // For example, a 3840×2160 output with scale 2.0 will have a logical size of 1920×1080, + // so to put another output directly adjacent to it on the right, set its x to 1920. + // If the position is unset or results in an overlap, the output is instead placed + // automatically. + // position x=2400 y=0 +} + +// Settings that influence how windows are positioned and sized. +// Find more information on the wiki: +// https://github.com/YaLTeR/niri/wiki/Configuration:-Layout +layout { + gaps 16 + center-focused-column "on-overflow" + + preset-column-widths { + proportion 0.5 + proportion 0.66667 + proportion 0.75 + proportion 0.95 + + // Fixed sets the width in logical pixels exactly. + // fixed 1920 + } + + // You can also customize the heights that "switch-preset-window-height" (Mod+Shift+R) toggles between. + // preset-window-heights { } + + // You can change the default width of the new windows. + default-column-width { proportion 0.66667; } + // If you leave the brackets empty, the windows themselves will decide their initial width. + // default-column-width {} + + // You can change how the focus ring looks. + focus-ring { + // Uncomment this line to disable the focus ring. + // off + + // How many logical pixels the ring extends out from the windows. + width 2 + } + + // You can also add a border. It's similar to the focus ring, but always visible. + border { + // The settings are the same as for the focus ring. + // If you enable the border, you probably want to disable the focus ring. + // off + + width 2 + } + + // You can enable drop shadows for windows. + shadow { + // Uncomment the next line to enable shadows. + on + + // Softness controls the shadow blur radius. + softness 30 + + // Spread expands the shadow. + spread 7 + + // Offset moves the shadow relative to the window. + offset x=0 y=6 + } +} + +spawn-at-startup "xwayland-satellite" + +prefer-no-csd + +screenshot-path "~/Pictures/Screenshots/Screenshot from %Y-%m-%d %H-%M-%S.png" + +// Animation settings. +// The wiki explains how to configure individual animations: +// https://github.com/YaLTeR/niri/wiki/Configuration:-Animations +animations { + // Uncomment to turn off all animations. + // off + + // Slow down all animations by this factor. Values below 1 speed them up instead. + slowdown 0.5 +} + +// Window rules let you adjust behavior for individual windows. +// Find more information on the wiki: +// https://github.com/YaLTeR/niri/wiki/Configuration:-Window-Rules + +// Work around WezTerm's initial configure bug +// by setting an empty default-column-width. +window-rule { + // This regular expression is intentionally made as specific as possible, + // since this is the default config, and we want no false positives. + // You can get away with just app-id="wezterm" if you want. + match app-id=r#"^org\.wezfurlong\.wezterm$"# + default-column-width {} +} + +// Open the Firefox picture-in-picture player as floating by default. +window-rule { + // This app-id regular expression will work for both: + // - host Firefox (app-id is "firefox") + // - Flatpak Firefox (app-id is "org.mozilla.firefox") + match app-id=r#"firefox$"# title="^Picture-in-Picture$" + open-floating true +} + +// Do the same for Zen Browser. +window-rule { + match app-id=r#"zen$"# title="^Picture-in-Picture$" + open-floating true +} + +// Block out sensitive components from screen capture. +window-rule { + match app-id=r#"legcord$"# + match app-id=r#"Slack$"# + + block-out-from "screen-capture" +} + +// Block out sensitive components from screencasts +layer-rule { + match namespace="^dms:clipboard$" + match namespace="^dms:notification$" + + block-out-from "screencast" +} + +window-rule { + match app-id="steam" title=r#"^notificationtoasts_\d+_desktop$"# + default-floating-position x=10 y=10 relative-to="bottom-right" +} + +// Example: enable rounded corners for all windows. +// (This example rule is commented out with a "/-" in front.) +window-rule { + geometry-corner-radius 8 + clip-to-geometry true +} + +hotkey-overlay { + skip-at-startup +} + +binds { + Mod+Shift+Slash { show-hotkey-overlay; } + + // APPLICATIONS + Mod+T hotkey-overlay-title="Open main Terminal" { spawn "alacritty"; } + Super+E hotkey-overlay-title="Open Nautilus" { spawn "nautilus"; } + + // SCRIPTS + Super+B { spawn "sh" "-c" "dms ipc call wallpaper set $(~/scripts/random-wallpaper.sh)"; } + Super+Shift+D hotkey-overlay-title="Restart DMS" { spawn "sh" "-c" "dms restart" ; } + // Super+A hotkey-overlay-title="Capture Screen" { spawn "sh" "-c" "grim -g \"$(slurp; sleep .1)\" - | swappy -f -"; } + Super+M hotkey-overlay-title="Media Output Select" { spawn "sh" "-c" "~/scripts/rofi-media.sh"; } + Super+Semicolon hotkey-overlay-title="Emoji picker" { spawn "sh" "-c" "rofimoji"; } + Ctrl+Alt+Space { spawn "sh" "-c" "pkill -USR2 -n handy"; } + + + XF86AudioPlay allow-when-locked=true { spawn "playerctl" "play-pause"; } + XF86AudioNext allow-when-locked=true { spawn "playerctl" "next"; } + XF86AudioPrev allow-when-locked=true { spawn "playerctl" "previous"; } + + Mod+O repeat=false { toggle-overview; } + + Mod+Q { close-window; } + + Mod+Left { focus-column-left; } + Mod+Down { focus-window-or-workspace-down; } + Mod+Up { focus-window-or-workspace-up; } + Mod+Right { focus-column-right; } + // Mod+H { focus-column-left; } + // Mod+J { focus-window-down; } + // Mod+K { focus-window-up; } + // Mod+L { focus-column-right; } + + Mod+Shift+Left { move-column-left; } + Mod+Shift+Down { move-window-down; } + Mod+Shift+Up { move-window-up; } + Mod+Shift+Right { move-column-right; } + Mod+Shift+H { move-column-left; } + Mod+Shift+J { move-window-down; } + Mod+Shift+K { move-window-up; } + Mod+Shift+L { move-column-right; } + + // Alternative commands that move across workspaces when reaching + // the first or last window in a column. + // Mod+J { focus-window-or-workspace-down; } + // Mod+K { focus-window-or-workspace-up; } + // Mod+Shift+J { move-window-down-or-to-workspace-down; } + // Mod+Shift+K { move-window-up-or-to-workspace-up; } + + Mod+Home { focus-column-first; } + Mod+End { focus-column-last; } + Mod+Shift+Home { move-column-to-first; } + Mod+Shift+End { move-column-to-last; } + + // Mod+Shift+Left { focus-monitor-left; } + // Mod+Shift+Down { focus-monitor-down; } + // Mod+Shift+Up { focus-monitor-up; } + // Mod+Shift+Right { focus-monitor-right; } + // Mod+Shift+H { focus-monitor-left; } + // Mod+Shift+J { focus-monitor-down; } + // Mod+Shift+K { focus-monitor-up; } + // Mod+Shift+L { focus-monitor-right; } + // + // Mod+Shift+Ctrl+Left { move-column-to-monitor-left; } + // Mod+Shift+Ctrl+Down { move-column-to-monitor-down; } + // Mod+Shift+Ctrl+Up { move-column-to-monitor-up; } + // Mod+Shift+Ctrl+Right { move-column-to-monitor-right; } + // Mod+Shift+Ctrl+H { move-column-to-monitor-left; } + // Mod+Shift+Ctrl+J { move-column-to-monitor-down; } + // Mod+Shift+Ctrl+K { move-column-to-monitor-up; } + // Mod+Shift+Ctrl+L { move-column-to-monitor-right; } + + // Alternatively, there are commands to move just a single window: + // Mod+Shift+Ctrl+Left { move-window-to-monitor-left; } + // ... + + // And you can also move a whole workspace to another monitor: + // Mod+Shift+Ctrl+Left { move-workspace-to-monitor-left; } + // ... + + Mod+Page_Down { focus-workspace-down; } + Alt+Ctrl+Page_Down { focus-workspace-down; } + Mod+Page_Up { focus-workspace-up; } + Alt+Ctrl+Page_Up { focus-workspace-up; } + Mod+U { focus-workspace-down; } + Alt+Ctrl+U { focus-workspace-down; } + Mod+I { focus-workspace-up; } + Alt+Ctrl+I { focus-workspace-up; } + Mod+Shift+Page_Down { move-column-to-workspace-down; } + Alt+Ctrl+Shift+Page_Down { move-column-to-workspace-down; } + Mod+Shift+Page_Up { move-column-to-workspace-up; } + Alt+Ctrl+Shift+Page_Up { move-column-to-workspace-up; } + Mod+Shift+U { move-column-to-workspace-down; } + Alt+Ctrl+Shift+U { move-column-to-workspace-down; } + Mod+Shift+I { move-column-to-workspace-up; } + Alt+Ctrl+Shift+I { move-column-to-workspace-up; } + + // Alternatively, there are commands to move just a single window: + // Mod+Ctrl+Page_Down { move-window-to-workspace-down; } + // ... + + Mod+Ctrl+Page_Down { move-workspace-down; } + Mod+Ctrl+Page_Up { move-workspace-up; } + Mod+Ctrl+U { move-workspace-down; } + Mod+Ctrl+I { move-workspace-up; } + + // You can bind mouse wheel scroll ticks using the following syntax. + // These binds will change direction based on the natural-scroll setting. + // + // To avoid scrolling through workspaces really fast, you can use + // the cooldown-ms property. The bind will be rate-limited to this value. + // You can set a cooldown on any bind, but it's most useful for the wheel. + Mod+WheelScrollDown cooldown-ms=150 { focus-workspace-down; } + Mod+WheelScrollUp cooldown-ms=150 { focus-workspace-up; } + Mod+Ctrl+WheelScrollDown cooldown-ms=150 { move-column-to-workspace-down; } + Mod+Ctrl+WheelScrollUp cooldown-ms=150 { move-column-to-workspace-up; } + + Mod+WheelScrollRight { focus-column-right; } + Mod+WheelScrollLeft { focus-column-left; } + Mod+Ctrl+WheelScrollRight { move-column-right; } + Mod+Ctrl+WheelScrollLeft { move-column-left; } + + // Usually scrolling up and down with Shift in applications results in + // horizontal scrolling; these binds replicate that. + Mod+Shift+WheelScrollDown { focus-column-right; } + Mod+Shift+WheelScrollUp { focus-column-left; } + Mod+Ctrl+Shift+WheelScrollDown { move-column-right; } + Mod+Ctrl+Shift+WheelScrollUp { move-column-left; } + + // Similarly, you can bind touchpad scroll "ticks". + // Touchpad scrolling is continuous, so for these binds it is split into + // discrete intervals. + // These binds are also affected by touchpad's natural-scroll, so these + // example binds are "inverted", since we have natural-scroll enabled for + // touchpads by default. + // Mod+TouchpadScrollDown { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.02+"; } + // Mod+TouchpadScrollUp { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.02-"; } + + // You can refer to workspaces by index. However, keep in mind that + // niri is a dynamic workspace system, so these commands are kind of + // "best effort". Trying to refer to a workspace index bigger than + // the current workspace count will instead refer to the bottommost + // (empty) workspace. + // + // For example, with 2 workspaces + 1 empty, indices 3, 4, 5 and so on + // will all refer to the 3rd workspace. + Mod+1 { focus-workspace 1; } + Mod+2 { focus-workspace 2; } + Mod+3 { focus-workspace 3; } + Mod+4 { focus-workspace 4; } + Mod+5 { focus-workspace 5; } + Mod+6 { focus-workspace 6; } + Mod+7 { focus-workspace 7; } + Mod+8 { focus-workspace 8; } + Mod+9 { focus-workspace 9; } + Alt+Ctrl+1 { focus-workspace 1; } + Alt+Ctrl+2 { focus-workspace 2; } + Alt+Ctrl+3 { focus-workspace 3; } + Alt+Ctrl+4 { focus-workspace 4; } + Alt+Ctrl+5 { focus-workspace 5; } + Alt+Ctrl+6 { focus-workspace 6; } + Alt+Ctrl+7 { focus-workspace 7; } + Alt+Ctrl+8 { focus-workspace 8; } + Alt+Ctrl+9 { focus-workspace 9; } + + Mod+Shift+1 { move-column-to-workspace 1; } + Alt+Ctrl+Shift+1 { move-column-to-workspace 1; } + Mod+Shift+2 { move-column-to-workspace 2; } + Alt+Ctrl+Shift+2 { move-column-to-workspace 2; } + Mod+Shift+3 { move-column-to-workspace 3; } + Alt+Ctrl+Shift+3 { move-column-to-workspace 3; } + Mod+Shift+4 { move-column-to-workspace 4; } + Alt+Ctrl+Shift+4 { move-column-to-workspace 4; } + Mod+Shift+5 { move-column-to-workspace 5; } + Alt+Ctrl+Shift+5 { move-column-to-workspace 5; } + Mod+Shift+6 { move-column-to-workspace 6; } + Alt+Ctrl+Shift+6 { move-column-to-workspace 6; } + Mod+Shift+7 { move-column-to-workspace 7; } + Alt+Ctrl+Shift+7 { move-column-to-workspace 7; } + Mod+Shift+8 { move-column-to-workspace 8; } + Alt+Ctrl+Shift+8 { move-column-to-workspace 8; } + Mod+Shift+9 { move-column-to-workspace 9; } + Alt+Ctrl+Shift+9 { move-column-to-workspace 9; } + + // Alternatively, there are commands to move just a single window: + // Mod+Ctrl+1 { move-window-to-workspace 1; } + + // Switches focus between the current and the previous workspace. + // Mod+Tab { focus-workspace-previous; } + + // The following binds move the focused window in and out of a column. + // If the window is alone, they will consume it into the nearby column to the side. + // If the window is already in a column, they will expel it out. + Mod+BracketLeft { consume-or-expel-window-left; } + Alt+Ctrl+BracketLeft { consume-or-expel-window-left; } + Mod+BracketRight { consume-or-expel-window-right; } + Alt+Ctrl+BracketRight { consume-or-expel-window-right; } + + // Consume one window from the right to the bottom of the focused column. + Mod+Comma { consume-window-into-column; } + // Expel the bottom window from the focused column to the right. + Mod+Period { expel-window-from-column; } + + Mod+R { switch-preset-column-width; } + Mod+Shift+R { switch-preset-window-height; } + Mod+Ctrl+R { reset-window-height; } + Mod+F { maximize-column; } + Mod+Shift+F { fullscreen-window; } + + // Expand the focused column to space not taken up by other fully visible columns. + // Makes the column "fill the rest of the space". + Mod+Ctrl+F { expand-column-to-available-width; } + + Mod+C { center-column; } + + // Center all fully visible columns on screen. + Mod+Ctrl+C { center-visible-columns; } + + // Finer width adjustments. + // This command can also: + // * set width in pixels: "1000" + // * adjust width in pixels: "-5" or "+5" + // * set width as a percentage of screen width: "25%" + // * adjust width as a percentage of screen width: "-10%" or "+10%" + // Pixel sizes use logical, or scaled, pixels. I.e. on an output with scale 2.0, + // set-column-width "100" will make the column occupy 200 physical screen pixels. + Mod+Minus { set-column-width "-10%"; } + Alt+Ctrl+Minus { set-column-width "-10%"; } + Mod+Equal { set-column-width "+10%"; } + Alt+Ctrl+Equal { set-column-width "+10%"; } + + // Finer height adjustments when in column with other windows. + Mod+Shift+Minus { set-window-height "-10%"; } + Alt+Ctrl+Shift+Minus { set-window-height "-10%"; } + Mod+Shift+Equal { set-window-height "+10%"; } + Alt+Ctrl+Shift+Equal { set-window-height "+10%"; } + + // Move the focused window between the floating and the tiling layout. + Mod+V { toggle-window-floating; } + Alt+Ctrl+V { toggle-window-floating; } + Mod+Shift+V { switch-focus-between-floating-and-tiling; } + Alt+Ctrl+Shift+V { switch-focus-between-floating-and-tiling; } + + // Toggle tabbed column display mode. + // Windows in this column will appear as vertical tabs, + // rather than stacked on top of each other. + Mod+W { toggle-column-tabbed-display; } + + // Actions to switch layouts. + // Note: if you uncomment these, make sure you do NOT have + // a matching layout switch hotkey configured in xkb options above. + // Having both at once on the same hotkey will break the switching, + // since it will switch twice upon pressing the hotkey (once by xkb, once by niri). + // Mod+Space { switch-layout "next"; } + // Mod+Shift+Space { switch-layout "prev"; } + + Mod+P { screenshot; } + Mod+Ctrl+P { screenshot-screen; } + Mod+Alt+P { screenshot-window; } + + // Applications such as remote-desktop clients and software KVM switches may + // request that niri stops processing the keyboard shortcuts defined here + // so they may, for example, forward the key presses as-is to a remote machine. + // It's a good idea to bind an escape hatch to toggle the inhibitor, + // so a buggy application can't hold your session hostage. + // + // The allow-inhibiting=false property can be applied to other binds as well, + // which ensures niri always processes them, even when an inhibitor is active. + Mod+Escape allow-inhibiting=false { toggle-keyboard-shortcuts-inhibit; } + + // The quit action will show a confirmation dialog to avoid accidental exits. + Mod+Shift+E { quit; } + + // Powers off the monitors. To turn them back on, do any input like + // moving the mouse or pressing any other key. + Mod+Shift+P { power-off-monitors; } + + // DMS + Mod+Space hotkey-overlay-title="Application Launcher" { + spawn "dms" "ipc" "call" "spotlight" "toggle"; + } + Mod+Ctrl+V hotkey-overlay-title="Clipboard Manager" { + spawn "dms" "ipc" "call" "clipboard" "toggle"; + } + Alt+Ctrl+C hotkey-overlay-title="Clipboard Manager" { + spawn "dms" "ipc" "call" "clipboard" "toggle"; + } + Mod+Shift+M hotkey-overlay-title="Task Manager" { + spawn "dms" "ipc" "call" "processlist" "toggle"; + } + Ctrl+Alt+Delete hotkey-overlay-title="Task Manager" { + spawn "dms" "ipc" "call" "processlist" "toggle"; + } + Mod+N hotkey-overlay-title="Notification Center" { + spawn "dms" "ipc" "call" "notifications" "toggle"; + } + Mod+Shift+Comma hotkey-overlay-title="Settings" { + spawn "dms" "ipc" "call" "settings" "toggle"; + } + Mod+Y hotkey-overlay-title="Browse Wallpapers" { + spawn "dms" "ipc" "call" "dankdash" "wallpaper"; + } + // Mod+Shift+N hotkey-overlay-title="Notepad" { + // spawn "dms" "ipc" "call" "notepad" "toggle"; + // } + Super+L hotkey-overlay-title="Lock Screen" { + spawn "dms" "ipc" "call" "lock" "lock"; + } + Mod+X hotkey-overlay-title="Power Menu" { + spawn "dms" "ipc" "call" "powermenu" "toggle"; + } + XF86AudioRaiseVolume allow-when-locked=true { + spawn "dms" "ipc" "call" "audio" "increment" "3"; + } + XF86AudioLowerVolume allow-when-locked=true { + spawn "dms" "ipc" "call" "audio" "decrement" "3"; + } + XF86AudioMute allow-when-locked=true { + spawn "dms" "ipc" "call" "audio" "mute"; + } + XF86AudioMicMute allow-when-locked=true { + spawn "dms" "ipc" "call" "audio" "micmute"; + } + XF86MonBrightnessUp allow-when-locked=true { + spawn "dms" "ipc" "call" "brightness" "increment" "5" ""; + } + // You can override the default device for e.g. keyboards by adding the device name to the last param + XF86MonBrightnessDown allow-when-locked=true { + spawn "dms" "ipc" "call" "brightness" "decrement" "5" ""; + } + // Night mode toggle + Mod+Shift+N allow-when-locked=true { + spawn "dms" "ipc" "call" "night" "toggle"; + } +} + +environment { + ELECTRON_OZONE_PLATFORM_HINT "auto" + DISPLAY ":0" + GTK_IM_MODULE "ibus" + QT_IM_MODULE "ibus" + XMODIFIERS "@im=ibus" +} + +cursor { + hide-when-typing + // hide-after-inactive-ms 1000 +} + +// Required for clipboard history integration +spawn-at-startup "bash" "-c" "wl-paste --watch cliphist store &" + +// Recommended (must install polkit-mate before hand) for elevation prompts +spawn-at-startup "/usr/lib/mate-polkit/polkit-mate-authentication-agent-1" +// This may be a different path on different distributions, the above is for the arch linux mate-polkit package + +// If using niri newer than 271534e115e5915231c99df287bbfe396185924d (~aug 17 2025) +// you can add this to disable built in config load errors since dank shell provides this +config-notification { + disable-failed +} diff --git a/niri/files/config.kdl.backup1768904973 b/niri/files/config.kdl.backup1768904973 new file mode 100644 index 0000000..6fefed4 --- /dev/null +++ b/niri/files/config.kdl.backup1768904973 @@ -0,0 +1,677 @@ +// This config is in the KDL format: https://kdl.dev +// "/-" comments out the following node. +// Check the wiki for a full description of the configuration: +// https://github.com/YaLTeR/niri/wiki/Configuration:-Introduction + +include "colors.kdl" + +// Input device configuration. +// Find the full list of options on the wiki: +// https://github.com/YaLTeR/niri/wiki/Configuration:-Input +input { + keyboard { + xkb { + // You can set rules, model, layout, variant and options. + // For more information, see xkeyboard-config(7). + layout "us,us_intl" + variant ",qwerty" + options "grp:alt_space_toggle,compose:ralt" + } + + // Enable numlock on startup, omitting this setting disables it. + numlock + } + + // Next sections include libinput settings. + // Omitting settings disables them, or leaves them at their default values. + touchpad { + // off + tap + // dwt + // dwtp + // drag false + // drag-lock + natural-scroll + // accel-speed 0.2 + // accel-profile "flat" + // scroll-method "two-finger" + // disabled-on-external-mouse + } + + mouse { + // off + // natural-scroll + // accel-speed 0.2 + // accel-profile "flat" + // scroll-method "no-scroll" + } + + trackpoint { + // off + // natural-scroll + // accel-speed 0.2 + // accel-profile "flat" + // scroll-method "on-button-down" + // scroll-button 273 + // middle-emulation + } + + // Uncomment this to make the mouse warp to the center of newly focused windows. + // warp-mouse-to-focus + + // Focus windows and outputs automatically when moving the mouse into them. + // Setting max-scroll-amount="0%" makes it work only on windows already fully on screen. + focus-follows-mouse max-scroll-amount="0%" +} + +// You can configure outputs by their name, which you can find +// by running `niri msg outputs` while inside a niri instance. +// The built-in laptop monitor is usually called "eDP-1". +// Find more information on the wiki: +// https://github.com/YaLTeR/niri/wiki/Configuration:-Outputs +// Remember to uncomment the node by removing "/-"! +output "DP-1" { + // Uncomment this line to disable this output. + // off + + // Resolution and, optionally, refresh rate of the output. + // The format is "x" or "x@". + // If the refresh rate is omitted, niri will pick the highest refresh rate + // for the resolution. + // If the mode is omitted altogether or is invalid, niri will pick one automatically. + // Run `niri msg outputs` while inside a niri instance to list all outputs and their modes. + mode "3840x2160@240" + // mode "3840x2160@119.880" + + // You can use integer or fractional scale, for example use 1.5 for 150% scale. + scale 2 + + // Transform allows to rotate the output counter-clockwise, valid values are: + // normal, 90, 180, 270, flipped, flipped-90, flipped-180 and flipped-270. + transform "normal" + + // Position of the output in the global coordinate space. + // This affects directional monitor actions like "focus-monitor-left", and cursor movement. + // The cursor can only move between directly adjacent outputs. + // Output scale and rotation has to be taken into account for positioning: + // outputs are sized in logical, or scaled, pixels. + // For example, a 3840×2160 output with scale 2.0 will have a logical size of 1920×1080, + // so to put another output directly adjacent to it on the right, set its x to 1920. + // If the position is unset or results in an overlap, the output is instead placed + // automatically. + position x=2400 y=0 +} + +// Settings that influence how windows are positioned and sized. +// Find more information on the wiki: +// https://github.com/YaLTeR/niri/wiki/Configuration:-Layout +layout { + // Set gaps around windows in logical pixels. + gaps 16 + + // When to center a column when changing focus, options are: + // - "never", default behavior, focusing an off-screen column will keep at the left + // or right edge of the screen. + // - "always", the focused column will always be centered. + // - "on-overflow", focusing a column will center it if it doesn't fit + // together with the previously focused column. + center-focused-column "on-overflow" + + // You can customize the widths that "switch-preset-column-width" (Mod+R) toggles between. + preset-column-widths { + // Proportion sets the width as a fraction of the output width, taking gaps into account. + // For example, you can perfectly fit four windows sized "proportion 0.25" on an output. + // The default preset widths are 1/3, 1/2 and 2/3 of the output. + proportion 0.5 + proportion 0.66667 + proportion 0.75 + proportion 0.95 + + // Fixed sets the width in logical pixels exactly. + // fixed 1920 + } + + // You can also customize the heights that "switch-preset-window-height" (Mod+Shift+R) toggles between. + // preset-window-heights { } + + // You can change the default width of the new windows. + default-column-width { proportion 0.66667; } + // If you leave the brackets empty, the windows themselves will decide their initial width. + // default-column-width {} + + // By default focus ring and border are rendered as a solid background rectangle + // behind windows. That is, they will show up through semitransparent windows. + // This is because windows using client-side decorations can have an arbitrary shape. + // + // If you don't like that, you should uncomment `prefer-no-csd` below. + // Niri will draw focus ring and border *around* windows that agree to omit their + // client-side decorations. + // + // Alternatively, you can override it with a window rule called + // `draw-border-with-background`. + + // You can change how the focus ring looks. + focus-ring { + // Uncomment this line to disable the focus ring. + // off + + // How many logical pixels the ring extends out from the windows. + width 4 + + // Colors can be set in a variety of ways: + // - CSS named colors: "red" + // - RGB hex: "#rgb", "#rgba", "#rrggbb", "#rrggbbaa" + // - CSS-like notation: "rgb(255, 127, 0)", rgba(), hsl() and a few others. + + // You can also use gradients. They take precedence over solid colors. + // Gradients are rendered the same as CSS linear-gradient(angle, from, to). + // The angle is the same as in linear-gradient, and is optional, + // defaulting to 180 (top-to-bottom gradient). + // You can use any CSS linear-gradient tool on the web to set these up. + // Changing the color space is also supported, check the wiki for more info. + // + // active-gradient from="#80c8ff" to="#bbddff" angle=45 + + // You can also color the gradient relative to the entire view + // of the workspace, rather than relative to just the window itself. + // To do that, set relative-to="workspace-view". + // + // inactive-gradient from="#505050" to="#808080" angle=45 relative-to="workspace-view" + } + + // You can also add a border. It's similar to the focus ring, but always visible. + border { + // The settings are the same as for the focus ring. + // If you enable the border, you probably want to disable the focus ring. + off + + width 4 + } + + // You can enable drop shadows for windows. + shadow { + // Uncomment the next line to enable shadows. + // on + + // By default, the shadow draws only around its window, and not behind it. + // Uncomment this setting to make the shadow draw behind its window. + // + // Note that niri has no way of knowing about the CSD window corner + // radius. It has to assume that windows have square corners, leading to + // shadow artifacts inside the CSD rounded corners. This setting fixes + // those artifacts. + // + // However, instead you may want to set prefer-no-csd and/or + // geometry-corner-radius. Then, niri will know the corner radius and + // draw the shadow correctly, without having to draw it behind the + // window. These will also remove client-side shadows if the window + // draws any. + // + // draw-behind-window true + + // You can change how shadows look. The values below are in logical + // pixels and match the CSS box-shadow properties. + + // Softness controls the shadow blur radius. + softness 30 + + // Spread expands the shadow. + spread 5 + + // Offset moves the shadow relative to the window. + offset x=0 y=5 + } + + // Struts shrink the area occupied by windows, similarly to layer-shell panels. + // You can think of them as a kind of outer gaps. They are set in logical pixels. + // Left and right struts will cause the next window to the side to always be visible. + // Top and bottom struts will simply add outer gaps in addition to the area occupied by + // layer-shell panels and regular gaps. + struts { + // left 64 + // right 64 + // top 64 + // bottom 64 + } +} + +// Add lines like this to spawn processes at startup. +// Note that running niri as a session supports xdg-desktop-autostart, +// which may be more convenient to use. +// See the binds section below for more spawn examples. + +// This line starts waybar, a commonly used bar for Wayland compositors. +spawn-at-startup "xwayland-satellite" +spawn-at-startup "sh" "-c" "~/.config/niri/niri-watcher.sh" +spawn-at-startup "sh" "-c" "niri-update-status" + +// Uncomment this line to ask the clients to omit their client-side decorations if possible. +// If the client will specifically ask for CSD, the request will be honored. +// Additionally, clients will be informed that they are tiled, removing some client-side rounded corners. +// This option will also fix border/focus ring drawing behind some semitransparent windows. +// After enabling or disabling this, you need to restart the apps for this to take effect. +prefer-no-csd + +// You can change the path where screenshots are saved. +// A ~ at the front will be expanded to the home directory. +// The path is formatted with strftime(3) to give you the screenshot date and time. +screenshot-path "~/Pictures/Screenshots/Screenshot from %Y-%m-%d %H-%M-%S.png" + +// You can also set this to null to disable saving screenshots to disk. +// screenshot-path null + +// Animation settings. +// The wiki explains how to configure individual animations: +// https://github.com/YaLTeR/niri/wiki/Configuration:-Animations +animations { + // Uncomment to turn off all animations. + // off + + // Slow down all animations by this factor. Values below 1 speed them up instead. + slowdown 0.75 +} + +// Window rules let you adjust behavior for individual windows. +// Find more information on the wiki: +// https://github.com/YaLTeR/niri/wiki/Configuration:-Window-Rules + +// Work around WezTerm's initial configure bug +// by setting an empty default-column-width. +window-rule { + // This regular expression is intentionally made as specific as possible, + // since this is the default config, and we want no false positives. + // You can get away with just app-id="wezterm" if you want. + match app-id=r#"^org\.wezfurlong\.wezterm$"# + default-column-width {} +} + +// Open the Firefox picture-in-picture player as floating by default. +window-rule { + // This app-id regular expression will work for both: + // - host Firefox (app-id is "firefox") + // - Flatpak Firefox (app-id is "org.mozilla.firefox") + match app-id=r#"firefox$"# title="^Picture-in-Picture$" + open-floating true +} + +// Do the same for Zen Browser. +window-rule { + match app-id=r#"zen$"# title="^Picture-in-Picture$" + open-floating true +} + +// Block out slack from screen capture. +window-rule { + match app-id=r#"Slack$"# + // block-out-from "screencast" + block-out-from "screen-capture" +} + + +window-rule { + match app-id=r#"legcord$"# + // block-out-from "screencast" + block-out-from "screen-capture" +} + +window-rule { + match app-id="steam" title=r#"^notificationtoasts_\d+_desktop$"# + default-floating-position x=10 y=10 relative-to="bottom-right" +} + +// Example: block out two password managers from screen capture. +// (This example rule is commented out with a "/-" in front.) +/-window-rule { + match app-id=r#"^org\.keepassxc\.KeePassXC$"# + match app-id=r#"^org\.gnome\.World\.Secrets$"# + + block-out-from "screen-capture" + + // Use this instead if you want them visible on third-party screenshot tools. + // block-out-from "screencast" +} + +// Example: enable rounded corners for all windows. +// (This example rule is commented out with a "/-" in front.) +window-rule { + geometry-corner-radius 12 + clip-to-geometry true +} + +binds { + // Keys consist of modifiers separated by + signs, followed by an XKB key name + // in the end. To find an XKB name for a particular key, you may use a program + // like wev. + // + // "Mod" is a special modifier equal to Super when running on a TTY, and to Alt + // when running as a winit window. + // + // Most actions that you can bind here can also be invoked programmatically with + // `niri msg action do-something`. + + // Mod-Shift-/, which is usually the same as Mod-?, + // shows a list of important hotkeys. + Mod+Shift+Slash { show-hotkey-overlay; } + + // APPLICATIONS + Mod+T hotkey-overlay-title="Open a Terminal: Ghostty" { spawn "ghostty"; } + Super+E hotkey-overlay-title="Open Nautilus" { spawn "nautilus"; } + + // SCRIPTS + Super+B { spawn "sh" "-c" "matugen image $(~/scripts/random-wallpaper.sh)"; } + Super+Shift+W hotkey-overlay-title="Restart Waybar" { spawn "sh" "-c" "killall waybar ; sleep 0.1 ; waybar & disown +" ; } + // Super+A hotkey-overlay-title="Capture Screen" { spawn "sh" "-c" "grim -g \"$(slurp; sleep .1)\" - | swappy -f -"; } + Super+M hotkey-overlay-title="Media Output Select" { spawn "sh" "-c" "~/scripts/rofi-media.sh"; } + Super+Semicolon hotkey-overlay-title="Emoji picker" { spawn "sh" "-c" "rofimoji"; } + + + XF86AudioPlay allow-when-locked=true { spawn "playerctl" "play-pause"; } + XF86AudioNext allow-when-locked=true { spawn "playerctl" "next"; } + XF86AudioPrev allow-when-locked=true { spawn "playerctl" "previous"; } + // Open/close the Overview: a zoomed-out view of workspaces and windows. + // You can also move the mouse into the top-left hot corner, + // or do a four-finger swipe up on a touchpad. + Mod+O repeat=false { toggle-overview; } + + Mod+Q { close-window; } + + Mod+Left { focus-column-left; } + Mod+Down { focus-window-down; } + Mod+Up { focus-window-up; } + Mod+Right { focus-column-right; } + // Mod+H { focus-column-left; } + // Mod+J { focus-window-down; } + // Mod+K { focus-window-up; } + // Mod+L { focus-column-right; } + + Mod+Shift+Left { move-column-left; } + Mod+Shift+Down { move-window-down; } + Mod+Shift+Up { move-window-up; } + Mod+Shift+Right { move-column-right; } + Mod+Shift+H { move-column-left; } + Mod+Shift+J { move-window-down; } + Mod+Shift+K { move-window-up; } + Mod+Shift+L { move-column-right; } + + // Alternative commands that move across workspaces when reaching + // the first or last window in a column. + // Mod+J { focus-window-or-workspace-down; } + // Mod+K { focus-window-or-workspace-up; } + // Mod+Shift+J { move-window-down-or-to-workspace-down; } + // Mod+Shift+K { move-window-up-or-to-workspace-up; } + + Mod+Home { focus-column-first; } + Mod+End { focus-column-last; } + Mod+Shift+Home { move-column-to-first; } + Mod+Shift+End { move-column-to-last; } + + // Mod+Shift+Left { focus-monitor-left; } + // Mod+Shift+Down { focus-monitor-down; } + // Mod+Shift+Up { focus-monitor-up; } + // Mod+Shift+Right { focus-monitor-right; } + // Mod+Shift+H { focus-monitor-left; } + // Mod+Shift+J { focus-monitor-down; } + // Mod+Shift+K { focus-monitor-up; } + // Mod+Shift+L { focus-monitor-right; } + // + // Mod+Shift+Ctrl+Left { move-column-to-monitor-left; } + // Mod+Shift+Ctrl+Down { move-column-to-monitor-down; } + // Mod+Shift+Ctrl+Up { move-column-to-monitor-up; } + // Mod+Shift+Ctrl+Right { move-column-to-monitor-right; } + // Mod+Shift+Ctrl+H { move-column-to-monitor-left; } + // Mod+Shift+Ctrl+J { move-column-to-monitor-down; } + // Mod+Shift+Ctrl+K { move-column-to-monitor-up; } + // Mod+Shift+Ctrl+L { move-column-to-monitor-right; } + + // Alternatively, there are commands to move just a single window: + // Mod+Shift+Ctrl+Left { move-window-to-monitor-left; } + // ... + + // And you can also move a whole workspace to another monitor: + // Mod+Shift+Ctrl+Left { move-workspace-to-monitor-left; } + // ... + + Mod+Page_Down { focus-workspace-down; } + Mod+Page_Up { focus-workspace-up; } + Mod+U { focus-workspace-down; } + Mod+I { focus-workspace-up; } + Mod+Shift+Page_Down { move-column-to-workspace-down; } + Mod+Shift+Page_Up { move-column-to-workspace-up; } + Mod+Shift+U { move-column-to-workspace-down; } + Mod+Shift+I { move-column-to-workspace-up; } + + // Alternatively, there are commands to move just a single window: + // Mod+Ctrl+Page_Down { move-window-to-workspace-down; } + // ... + + Mod+Ctrl+Page_Down { move-workspace-down; } + Mod+Ctrl+Page_Up { move-workspace-up; } + Mod+Ctrl+U { move-workspace-down; } + Mod+Ctrl+I { move-workspace-up; } + + // You can bind mouse wheel scroll ticks using the following syntax. + // These binds will change direction based on the natural-scroll setting. + // + // To avoid scrolling through workspaces really fast, you can use + // the cooldown-ms property. The bind will be rate-limited to this value. + // You can set a cooldown on any bind, but it's most useful for the wheel. + Mod+WheelScrollDown cooldown-ms=150 { focus-workspace-down; } + Mod+WheelScrollUp cooldown-ms=150 { focus-workspace-up; } + Mod+Ctrl+WheelScrollDown cooldown-ms=150 { move-column-to-workspace-down; } + Mod+Ctrl+WheelScrollUp cooldown-ms=150 { move-column-to-workspace-up; } + + Mod+WheelScrollRight { focus-column-right; } + Mod+WheelScrollLeft { focus-column-left; } + Mod+Ctrl+WheelScrollRight { move-column-right; } + Mod+Ctrl+WheelScrollLeft { move-column-left; } + + // Usually scrolling up and down with Shift in applications results in + // horizontal scrolling; these binds replicate that. + Mod+Shift+WheelScrollDown { focus-column-right; } + Mod+Shift+WheelScrollUp { focus-column-left; } + Mod+Ctrl+Shift+WheelScrollDown { move-column-right; } + Mod+Ctrl+Shift+WheelScrollUp { move-column-left; } + + // Similarly, you can bind touchpad scroll "ticks". + // Touchpad scrolling is continuous, so for these binds it is split into + // discrete intervals. + // These binds are also affected by touchpad's natural-scroll, so these + // example binds are "inverted", since we have natural-scroll enabled for + // touchpads by default. + // Mod+TouchpadScrollDown { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.02+"; } + // Mod+TouchpadScrollUp { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.02-"; } + + // You can refer to workspaces by index. However, keep in mind that + // niri is a dynamic workspace system, so these commands are kind of + // "best effort". Trying to refer to a workspace index bigger than + // the current workspace count will instead refer to the bottommost + // (empty) workspace. + // + // For example, with 2 workspaces + 1 empty, indices 3, 4, 5 and so on + // will all refer to the 3rd workspace. + Mod+1 { focus-workspace 1; } + Mod+2 { focus-workspace 2; } + Mod+3 { focus-workspace 3; } + Mod+4 { focus-workspace 4; } + Mod+5 { focus-workspace 5; } + Mod+6 { focus-workspace 6; } + Mod+7 { focus-workspace 7; } + Mod+8 { focus-workspace 8; } + Mod+9 { focus-workspace 9; } + Mod+Shift+1 { move-column-to-workspace 1; } + Mod+Shift+2 { move-column-to-workspace 2; } + Mod+Shift+3 { move-column-to-workspace 3; } + Mod+Shift+4 { move-column-to-workspace 4; } + Mod+Shift+5 { move-column-to-workspace 5; } + Mod+Shift+6 { move-column-to-workspace 6; } + Mod+Shift+7 { move-column-to-workspace 7; } + Mod+Shift+8 { move-column-to-workspace 8; } + Mod+Shift+9 { move-column-to-workspace 9; } + + // Alternatively, there are commands to move just a single window: + // Mod+Ctrl+1 { move-window-to-workspace 1; } + + // Switches focus between the current and the previous workspace. + // Mod+Tab { focus-workspace-previous; } + + // The following binds move the focused window in and out of a column. + // If the window is alone, they will consume it into the nearby column to the side. + // If the window is already in a column, they will expel it out. + Mod+BracketLeft { consume-or-expel-window-left; } + Mod+BracketRight { consume-or-expel-window-right; } + + // Consume one window from the right to the bottom of the focused column. + Mod+Comma { consume-window-into-column; } + // Expel the bottom window from the focused column to the right. + Mod+Period { expel-window-from-column; } + + Mod+R { switch-preset-column-width; } + Mod+Shift+R { switch-preset-window-height; } + Mod+Ctrl+R { reset-window-height; } + Mod+F { maximize-column; } + Mod+Shift+F { fullscreen-window; } + + // Expand the focused column to space not taken up by other fully visible columns. + // Makes the column "fill the rest of the space". + Mod+Ctrl+F { expand-column-to-available-width; } + + Mod+C { center-column; } + + // Center all fully visible columns on screen. + Mod+Ctrl+C { center-visible-columns; } + + // Finer width adjustments. + // This command can also: + // * set width in pixels: "1000" + // * adjust width in pixels: "-5" or "+5" + // * set width as a percentage of screen width: "25%" + // * adjust width as a percentage of screen width: "-10%" or "+10%" + // Pixel sizes use logical, or scaled, pixels. I.e. on an output with scale 2.0, + // set-column-width "100" will make the column occupy 200 physical screen pixels. + Mod+Minus { set-column-width "-10%"; } + Mod+Equal { set-column-width "+10%"; } + + // Finer height adjustments when in column with other windows. + Mod+Shift+Minus { set-window-height "-10%"; } + Mod+Shift+Equal { set-window-height "+10%"; } + + // Move the focused window between the floating and the tiling layout. + Mod+V { toggle-window-floating; } + Mod+Shift+V { switch-focus-between-floating-and-tiling; } + + // Toggle tabbed column display mode. + // Windows in this column will appear as vertical tabs, + // rather than stacked on top of each other. + Mod+W { toggle-column-tabbed-display; } + + // Actions to switch layouts. + // Note: if you uncomment these, make sure you do NOT have + // a matching layout switch hotkey configured in xkb options above. + // Having both at once on the same hotkey will break the switching, + // since it will switch twice upon pressing the hotkey (once by xkb, once by niri). + // Mod+Space { switch-layout "next"; } + // Mod+Shift+Space { switch-layout "prev"; } + + Mod+P { screenshot; } + Mod+Ctrl+P { screenshot-screen; } + Mod+Alt+P { screenshot-window; } + + // Applications such as remote-desktop clients and software KVM switches may + // request that niri stops processing the keyboard shortcuts defined here + // so they may, for example, forward the key presses as-is to a remote machine. + // It's a good idea to bind an escape hatch to toggle the inhibitor, + // so a buggy application can't hold your session hostage. + // + // The allow-inhibiting=false property can be applied to other binds as well, + // which ensures niri always processes them, even when an inhibitor is active. + Mod+Escape allow-inhibiting=false { toggle-keyboard-shortcuts-inhibit; } + + // The quit action will show a confirmation dialog to avoid accidental exits. + Mod+Shift+E { quit; } + Ctrl+Alt+Delete { quit; } + + // Powers off the monitors. To turn them back on, do any input like + // moving the mouse or pressing any other key. + Mod+Shift+P { power-off-monitors; } + + Mod+Space hotkey-overlay-title="Application Launcher" { + spawn "dms" "ipc" "call" "spotlight" "toggle"; + } + Mod+Ctrl+V hotkey-overlay-title="Clipboard Manager" { + spawn "dms" "ipc" "call" "clipboard" "toggle"; + } + Mod+Shift+M hotkey-overlay-title="Task Manager" { + spawn "dms" "ipc" "call" "processlist" "toggle"; + } + Mod+N hotkey-overlay-title="Notification Center" { + spawn "dms" "ipc" "call" "notifications" "toggle"; + } + Mod+Shift+Comma hotkey-overlay-title="Settings" { + spawn "dms" "ipc" "call" "settings" "toggle"; + } + // Mod+P hotkey-overlay-title="Notepad" { + // spawn "dms" "ipc" "call" "notepad" "toggle"; + // } + Super+L hotkey-overlay-title="Lock Screen" { + spawn "dms" "ipc" "call" "lock" "lock"; + } + Mod+X hotkey-overlay-title="Power Menu" { + spawn "dms" "ipc" "call" "powermenu" "toggle"; + } + XF86AudioRaiseVolume allow-when-locked=true { + spawn "dms" "ipc" "call" "audio" "increment" "3"; + } + XF86AudioLowerVolume allow-when-locked=true { + spawn "dms" "ipc" "call" "audio" "decrement" "3"; + } + XF86AudioMute allow-when-locked=true { + spawn "dms" "ipc" "call" "audio" "mute"; + } + XF86AudioMicMute allow-when-locked=true { + spawn "dms" "ipc" "call" "audio" "micmute"; + } + XF86MonBrightnessUp allow-when-locked=true { + spawn "dms" "ipc" "call" "brightness" "increment" "5" ""; + } + // You can override the default device for e.g. keyboards by adding the device name to the last param + XF86MonBrightnessDown allow-when-locked=true { + spawn "dms" "ipc" "call" "brightness" "decrement" "5" ""; + } + // Night mode toggle + Mod+Shift+N allow-when-locked=true { + spawn "dms" "ipc" "call" "night" "toggle"; + } +} + +environment { + ELECTRON_OZONE_PLATFORM_HINT "auto" + DISPLAY ":0" + GTK_IM_MODULE "ibus" + QT_IM_MODULE "ibus" + XMODIFIERS "@im=ibus" +} + +cursor { + xcursor-theme "Adwaita" + xcursor-size 28 + + // hide-when-typing + // hide-after-inactive-ms 1000 +} + +// Required for clipboard history integration +spawn-at-startup "bash" "-c" "wl-paste --watch cliphist store &" + +// Recommended (must install polkit-mate before hand) for elevation prompts +spawn-at-startup "/usr/lib/mate-polkit/polkit-mate-authentication-agent-1" +// This may be a different path on different distributions, the above is for the arch linux mate-polkit package + +// Starts DankShell +// spawn-at-startup "dms" "run" + +// If using niri newer than 271534e115e5915231c99df287bbfe396185924d (~aug 17 2025) +// you can add this to disable built in config load errors since dank shell provides this +config-notification { + disable-failed +} diff --git a/niri/files/config.kdl.dmsbackup1769252086 b/niri/files/config.kdl.dmsbackup1769252086 new file mode 100644 index 0000000..6f2809c --- /dev/null +++ b/niri/files/config.kdl.dmsbackup1769252086 @@ -0,0 +1,551 @@ +// This config is in the KDL format: https://kdl.dev +// "/-" comments out the following node. +// Check the wiki for a full description of the configuration: +// https://github.com/YaLTeR/niri/wiki/Configuration:-Introduction + +include "colors.kdl" + +// https://github.com/YaLTeR/niri/wiki/Configuration:-Input +input { + keyboard { + xkb { + // For more information, see xkeyboard-config(7). + layout "us,us_intl" + variant ",qwerty" + options "grp:alt_space_toggle,compose:ralt" + } + + // Enable numlock on startup, omitting this setting disables it. + numlock + } + + // Next sections include libinput settings. + // Omitting settings disables them, or leaves them at their default values. + touchpad { + // off + tap + // dwt + // dwtp + // drag false + // drag-lock + natural-scroll + // accel-speed 0.2 + // accel-profile "flat" + // scroll-method "two-finger" + // disabled-on-external-mouse + } + + mouse { + // off + // natural-scroll + // accel-speed 0.2 + // accel-profile "flat" + // scroll-method "no-scroll" + } + + trackpoint { + // off + // natural-scroll + // accel-speed 0.2 + // accel-profile "flat" + // scroll-method "on-button-down" + // scroll-button 273 + // middle-emulation + } + + // Uncomment this to make the mouse warp to the center of newly focused windows. + // warp-mouse-to-focus + + // Focus windows and outputs automatically when moving the mouse into them. + // Setting max-scroll-amount="0%" makes it work only on windows already fully on screen. + focus-follows-mouse max-scroll-amount="0%" +} + +// You can configure outputs by their name, which you can find +// by running `niri msg outputs` while inside a niri instance. +// https://github.com/YaLTeR/niri/wiki/Configuration:-Outputs +output "DP-1" { + // Uncomment this line to disable this output. + // off + + // If the refresh rate is omitted, niri will pick the highest refresh rate + // for the resolution. + // If the mode is omitted altogether or is invalid, niri will pick one automatically. + mode "3840x2160@240" + // mode "3840x2160@119.880" + + // You can use integer or fractional scale, for example use 1.5 for 150% scale. + scale 2 + + // Transform allows to rotate the output counter-clockwise, valid values are: + // normal, 90, 180, 270, flipped, flipped-90, flipped-180 and flipped-270. + transform "normal" + + // Position of the output in the global coordinate space. + // This affects directional monitor actions like "focus-monitor-left", and cursor movement. + // The cursor can only move between directly adjacent outputs. + // Output scale and rotation has to be taken into account for positioning: + // outputs are sized in logical, or scaled, pixels. + // For example, a 3840×2160 output with scale 2.0 will have a logical size of 1920×1080, + // so to put another output directly adjacent to it on the right, set its x to 1920. + // If the position is unset or results in an overlap, the output is instead placed + // automatically. + // position x=2400 y=0 +} + +// Settings that influence how windows are positioned and sized. +// Find more information on the wiki: +// https://github.com/YaLTeR/niri/wiki/Configuration:-Layout +layout { + gaps 16 + center-focused-column "on-overflow" + + preset-column-widths { + proportion 0.5 + proportion 0.66667 + proportion 0.75 + proportion 0.95 + + // Fixed sets the width in logical pixels exactly. + // fixed 1920 + } + + // You can also customize the heights that "switch-preset-window-height" (Mod+Shift+R) toggles between. + // preset-window-heights { } + + // You can change the default width of the new windows. + default-column-width { proportion 0.66667; } + // If you leave the brackets empty, the windows themselves will decide their initial width. + // default-column-width {} + + // You can change how the focus ring looks. + focus-ring { + // Uncomment this line to disable the focus ring. + // off + + // How many logical pixels the ring extends out from the windows. + width 4 + } + + // You can also add a border. It's similar to the focus ring, but always visible. + border { + // The settings are the same as for the focus ring. + // If you enable the border, you probably want to disable the focus ring. + off + + width 4 + } + + // You can enable drop shadows for windows. + shadow { + // Uncomment the next line to enable shadows. + // on + + // Softness controls the shadow blur radius. + softness 30 + + // Spread expands the shadow. + spread 5 + + // Offset moves the shadow relative to the window. + offset x=0 y=5 + } +} + +spawn-at-startup "xwayland-satellite" + +prefer-no-csd + +screenshot-path "~/Pictures/Screenshots/Screenshot from %Y-%m-%d %H-%M-%S.png" + +// Animation settings. +// The wiki explains how to configure individual animations: +// https://github.com/YaLTeR/niri/wiki/Configuration:-Animations +animations { + // Uncomment to turn off all animations. + // off + + // Slow down all animations by this factor. Values below 1 speed them up instead. + slowdown 0.75 +} + +// Window rules let you adjust behavior for individual windows. +// Find more information on the wiki: +// https://github.com/YaLTeR/niri/wiki/Configuration:-Window-Rules + +// Work around WezTerm's initial configure bug +// by setting an empty default-column-width. +window-rule { + // This regular expression is intentionally made as specific as possible, + // since this is the default config, and we want no false positives. + // You can get away with just app-id="wezterm" if you want. + match app-id=r#"^org\.wezfurlong\.wezterm$"# + default-column-width {} +} + +// Open the Firefox picture-in-picture player as floating by default. +window-rule { + // This app-id regular expression will work for both: + // - host Firefox (app-id is "firefox") + // - Flatpak Firefox (app-id is "org.mozilla.firefox") + match app-id=r#"firefox$"# title="^Picture-in-Picture$" + open-floating true +} + +// Do the same for Zen Browser. +window-rule { + match app-id=r#"zen$"# title="^Picture-in-Picture$" + open-floating true +} + +// Block out slack from screen capture. +window-rule { + match app-id=r#"Slack$"# + // block-out-from "screencast" + block-out-from "screen-capture" +} + +// Block out legcord from screen capture. +window-rule { + match app-id=r#"legcord$"# + // block-out-from "screencast" + block-out-from "screen-capture" +} + +window-rule { + match app-id="steam" title=r#"^notificationtoasts_\d+_desktop$"# + default-floating-position x=10 y=10 relative-to="bottom-right" +} + +// Example: enable rounded corners for all windows. +// (This example rule is commented out with a "/-" in front.) +window-rule { + geometry-corner-radius 12 + clip-to-geometry true +} + +hotkey-overlay { + skip-at-startup +} + +binds { + Mod+Shift+Slash { show-hotkey-overlay; } + + // APPLICATIONS + Mod+T hotkey-overlay-title="Open a Terminal: Ghostty" { spawn "ghostty"; } + Super+E hotkey-overlay-title="Open Nautilus" { spawn "nautilus"; } + + // SCRIPTS + Super+B { spawn "sh" "-c" "dms ipc call wallpaper set $(~/scripts/random-wallpaper.sh)"; } + Super+Shift+D hotkey-overlay-title="Restart DMS" { spawn "sh" "-c" "dms restart" ; } + // Super+A hotkey-overlay-title="Capture Screen" { spawn "sh" "-c" "grim -g \"$(slurp; sleep .1)\" - | swappy -f -"; } + Super+M hotkey-overlay-title="Media Output Select" { spawn "sh" "-c" "~/scripts/rofi-media.sh"; } + Super+Semicolon hotkey-overlay-title="Emoji picker" { spawn "sh" "-c" "rofimoji"; } + + + XF86AudioPlay allow-when-locked=true { spawn "playerctl" "play-pause"; } + XF86AudioNext allow-when-locked=true { spawn "playerctl" "next"; } + XF86AudioPrev allow-when-locked=true { spawn "playerctl" "previous"; } + // Open/close the Overview: a zoomed-out view of workspaces and windows. + // You can also move the mouse into the top-left hot corner, + // or do a four-finger swipe up on a touchpad. + Mod+O repeat=false { toggle-overview; } + + Mod+Q { close-window; } + + Mod+Left { focus-column-left; } + Mod+Down { focus-window-down; } + Mod+Up { focus-window-up; } + Mod+Right { focus-column-right; } + // Mod+H { focus-column-left; } + // Mod+J { focus-window-down; } + // Mod+K { focus-window-up; } + // Mod+L { focus-column-right; } + + Mod+Shift+Left { move-column-left; } + Mod+Shift+Down { move-window-down; } + Mod+Shift+Up { move-window-up; } + Mod+Shift+Right { move-column-right; } + Mod+Shift+H { move-column-left; } + Mod+Shift+J { move-window-down; } + Mod+Shift+K { move-window-up; } + Mod+Shift+L { move-column-right; } + + // Alternative commands that move across workspaces when reaching + // the first or last window in a column. + // Mod+J { focus-window-or-workspace-down; } + // Mod+K { focus-window-or-workspace-up; } + // Mod+Shift+J { move-window-down-or-to-workspace-down; } + // Mod+Shift+K { move-window-up-or-to-workspace-up; } + + Mod+Home { focus-column-first; } + Mod+End { focus-column-last; } + Mod+Shift+Home { move-column-to-first; } + Mod+Shift+End { move-column-to-last; } + + // Mod+Shift+Left { focus-monitor-left; } + // Mod+Shift+Down { focus-monitor-down; } + // Mod+Shift+Up { focus-monitor-up; } + // Mod+Shift+Right { focus-monitor-right; } + // Mod+Shift+H { focus-monitor-left; } + // Mod+Shift+J { focus-monitor-down; } + // Mod+Shift+K { focus-monitor-up; } + // Mod+Shift+L { focus-monitor-right; } + // + // Mod+Shift+Ctrl+Left { move-column-to-monitor-left; } + // Mod+Shift+Ctrl+Down { move-column-to-monitor-down; } + // Mod+Shift+Ctrl+Up { move-column-to-monitor-up; } + // Mod+Shift+Ctrl+Right { move-column-to-monitor-right; } + // Mod+Shift+Ctrl+H { move-column-to-monitor-left; } + // Mod+Shift+Ctrl+J { move-column-to-monitor-down; } + // Mod+Shift+Ctrl+K { move-column-to-monitor-up; } + // Mod+Shift+Ctrl+L { move-column-to-monitor-right; } + + // Alternatively, there are commands to move just a single window: + // Mod+Shift+Ctrl+Left { move-window-to-monitor-left; } + // ... + + // And you can also move a whole workspace to another monitor: + // Mod+Shift+Ctrl+Left { move-workspace-to-monitor-left; } + // ... + + Mod+Page_Down { focus-workspace-down; } + Mod+Page_Up { focus-workspace-up; } + Mod+U { focus-workspace-down; } + Mod+I { focus-workspace-up; } + Mod+Shift+Page_Down { move-column-to-workspace-down; } + Mod+Shift+Page_Up { move-column-to-workspace-up; } + Mod+Shift+U { move-column-to-workspace-down; } + Mod+Shift+I { move-column-to-workspace-up; } + + // Alternatively, there are commands to move just a single window: + // Mod+Ctrl+Page_Down { move-window-to-workspace-down; } + // ... + + Mod+Ctrl+Page_Down { move-workspace-down; } + Mod+Ctrl+Page_Up { move-workspace-up; } + Mod+Ctrl+U { move-workspace-down; } + Mod+Ctrl+I { move-workspace-up; } + + // You can bind mouse wheel scroll ticks using the following syntax. + // These binds will change direction based on the natural-scroll setting. + // + // To avoid scrolling through workspaces really fast, you can use + // the cooldown-ms property. The bind will be rate-limited to this value. + // You can set a cooldown on any bind, but it's most useful for the wheel. + Mod+WheelScrollDown cooldown-ms=150 { focus-workspace-down; } + Mod+WheelScrollUp cooldown-ms=150 { focus-workspace-up; } + Mod+Ctrl+WheelScrollDown cooldown-ms=150 { move-column-to-workspace-down; } + Mod+Ctrl+WheelScrollUp cooldown-ms=150 { move-column-to-workspace-up; } + + Mod+WheelScrollRight { focus-column-right; } + Mod+WheelScrollLeft { focus-column-left; } + Mod+Ctrl+WheelScrollRight { move-column-right; } + Mod+Ctrl+WheelScrollLeft { move-column-left; } + + // Usually scrolling up and down with Shift in applications results in + // horizontal scrolling; these binds replicate that. + Mod+Shift+WheelScrollDown { focus-column-right; } + Mod+Shift+WheelScrollUp { focus-column-left; } + Mod+Ctrl+Shift+WheelScrollDown { move-column-right; } + Mod+Ctrl+Shift+WheelScrollUp { move-column-left; } + + // Similarly, you can bind touchpad scroll "ticks". + // Touchpad scrolling is continuous, so for these binds it is split into + // discrete intervals. + // These binds are also affected by touchpad's natural-scroll, so these + // example binds are "inverted", since we have natural-scroll enabled for + // touchpads by default. + // Mod+TouchpadScrollDown { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.02+"; } + // Mod+TouchpadScrollUp { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.02-"; } + + // You can refer to workspaces by index. However, keep in mind that + // niri is a dynamic workspace system, so these commands are kind of + // "best effort". Trying to refer to a workspace index bigger than + // the current workspace count will instead refer to the bottommost + // (empty) workspace. + // + // For example, with 2 workspaces + 1 empty, indices 3, 4, 5 and so on + // will all refer to the 3rd workspace. + Mod+1 { focus-workspace 1; } + Mod+2 { focus-workspace 2; } + Mod+3 { focus-workspace 3; } + Mod+4 { focus-workspace 4; } + Mod+5 { focus-workspace 5; } + Mod+6 { focus-workspace 6; } + Mod+7 { focus-workspace 7; } + Mod+8 { focus-workspace 8; } + Mod+9 { focus-workspace 9; } + Mod+Shift+1 { move-column-to-workspace 1; } + Mod+Shift+2 { move-column-to-workspace 2; } + Mod+Shift+3 { move-column-to-workspace 3; } + Mod+Shift+4 { move-column-to-workspace 4; } + Mod+Shift+5 { move-column-to-workspace 5; } + Mod+Shift+6 { move-column-to-workspace 6; } + Mod+Shift+7 { move-column-to-workspace 7; } + Mod+Shift+8 { move-column-to-workspace 8; } + Mod+Shift+9 { move-column-to-workspace 9; } + + // Alternatively, there are commands to move just a single window: + // Mod+Ctrl+1 { move-window-to-workspace 1; } + + // Switches focus between the current and the previous workspace. + // Mod+Tab { focus-workspace-previous; } + + // The following binds move the focused window in and out of a column. + // If the window is alone, they will consume it into the nearby column to the side. + // If the window is already in a column, they will expel it out. + Mod+BracketLeft { consume-or-expel-window-left; } + Mod+BracketRight { consume-or-expel-window-right; } + + // Consume one window from the right to the bottom of the focused column. + Mod+Comma { consume-window-into-column; } + // Expel the bottom window from the focused column to the right. + Mod+Period { expel-window-from-column; } + + Mod+R { switch-preset-column-width; } + Mod+Shift+R { switch-preset-window-height; } + Mod+Ctrl+R { reset-window-height; } + Mod+F { maximize-column; } + Mod+Shift+F { fullscreen-window; } + + // Expand the focused column to space not taken up by other fully visible columns. + // Makes the column "fill the rest of the space". + Mod+Ctrl+F { expand-column-to-available-width; } + + Mod+C { center-column; } + + // Center all fully visible columns on screen. + Mod+Ctrl+C { center-visible-columns; } + + // Finer width adjustments. + // This command can also: + // * set width in pixels: "1000" + // * adjust width in pixels: "-5" or "+5" + // * set width as a percentage of screen width: "25%" + // * adjust width as a percentage of screen width: "-10%" or "+10%" + // Pixel sizes use logical, or scaled, pixels. I.e. on an output with scale 2.0, + // set-column-width "100" will make the column occupy 200 physical screen pixels. + Mod+Minus { set-column-width "-10%"; } + Mod+Equal { set-column-width "+10%"; } + + // Finer height adjustments when in column with other windows. + Mod+Shift+Minus { set-window-height "-10%"; } + Mod+Shift+Equal { set-window-height "+10%"; } + + // Move the focused window between the floating and the tiling layout. + Mod+V { toggle-window-floating; } + Mod+Shift+V { switch-focus-between-floating-and-tiling; } + + // Toggle tabbed column display mode. + // Windows in this column will appear as vertical tabs, + // rather than stacked on top of each other. + Mod+W { toggle-column-tabbed-display; } + + // Actions to switch layouts. + // Note: if you uncomment these, make sure you do NOT have + // a matching layout switch hotkey configured in xkb options above. + // Having both at once on the same hotkey will break the switching, + // since it will switch twice upon pressing the hotkey (once by xkb, once by niri). + // Mod+Space { switch-layout "next"; } + // Mod+Shift+Space { switch-layout "prev"; } + + Mod+P { screenshot; } + Mod+Ctrl+P { screenshot-screen; } + Mod+Alt+P { screenshot-window; } + + // Applications such as remote-desktop clients and software KVM switches may + // request that niri stops processing the keyboard shortcuts defined here + // so they may, for example, forward the key presses as-is to a remote machine. + // It's a good idea to bind an escape hatch to toggle the inhibitor, + // so a buggy application can't hold your session hostage. + // + // The allow-inhibiting=false property can be applied to other binds as well, + // which ensures niri always processes them, even when an inhibitor is active. + Mod+Escape allow-inhibiting=false { toggle-keyboard-shortcuts-inhibit; } + + // The quit action will show a confirmation dialog to avoid accidental exits. + Mod+Shift+E { quit; } + Ctrl+Alt+Delete { quit; } + + // Powers off the monitors. To turn them back on, do any input like + // moving the mouse or pressing any other key. + Mod+Shift+P { power-off-monitors; } + + Mod+Space hotkey-overlay-title="Application Launcher" { + spawn "dms" "ipc" "call" "spotlight" "toggle"; + } + Mod+Ctrl+V hotkey-overlay-title="Clipboard Manager" { + spawn "dms" "ipc" "call" "clipboard" "toggle"; + } + Mod+Shift+M hotkey-overlay-title="Task Manager" { + spawn "dms" "ipc" "call" "processlist" "toggle"; + } + Mod+N hotkey-overlay-title="Notification Center" { + spawn "dms" "ipc" "call" "notifications" "toggle"; + } + Mod+Shift+Comma hotkey-overlay-title="Settings" { + spawn "dms" "ipc" "call" "settings" "toggle"; + } + // Mod+P hotkey-overlay-title="Notepad" { + // spawn "dms" "ipc" "call" "notepad" "toggle"; + // } + Super+L hotkey-overlay-title="Lock Screen" { + spawn "dms" "ipc" "call" "lock" "lock"; + } + Mod+X hotkey-overlay-title="Power Menu" { + spawn "dms" "ipc" "call" "powermenu" "toggle"; + } + XF86AudioRaiseVolume allow-when-locked=true { + spawn "dms" "ipc" "call" "audio" "increment" "3"; + } + XF86AudioLowerVolume allow-when-locked=true { + spawn "dms" "ipc" "call" "audio" "decrement" "3"; + } + XF86AudioMute allow-when-locked=true { + spawn "dms" "ipc" "call" "audio" "mute"; + } + XF86AudioMicMute allow-when-locked=true { + spawn "dms" "ipc" "call" "audio" "micmute"; + } + XF86MonBrightnessUp allow-when-locked=true { + spawn "dms" "ipc" "call" "brightness" "increment" "5" ""; + } + // You can override the default device for e.g. keyboards by adding the device name to the last param + XF86MonBrightnessDown allow-when-locked=true { + spawn "dms" "ipc" "call" "brightness" "decrement" "5" ""; + } + // Night mode toggle + Mod+Shift+N allow-when-locked=true { + spawn "dms" "ipc" "call" "night" "toggle"; + } +} + +environment { + ELECTRON_OZONE_PLATFORM_HINT "auto" + DISPLAY ":0" + GTK_IM_MODULE "ibus" + QT_IM_MODULE "ibus" + XMODIFIERS "@im=ibus" +} + +cursor { + xcursor-theme "Adwaita" + xcursor-size 28 + + // hide-when-typing + // hide-after-inactive-ms 1000 +} + +// Required for clipboard history integration +spawn-at-startup "bash" "-c" "wl-paste --watch cliphist store &" + +// Recommended (must install polkit-mate before hand) for elevation prompts +spawn-at-startup "/usr/lib/mate-polkit/polkit-mate-authentication-agent-1" +// This may be a different path on different distributions, the above is for the arch linux mate-polkit package + +// If using niri newer than 271534e115e5915231c99df287bbfe396185924d (~aug 17 2025) +// you can add this to disable built in config load errors since dank shell provides this +config-notification { + disable-failed +} diff --git a/niri/files/generate-config.sh b/niri/files/generate-config.sh new file mode 100755 index 0000000..02a8b98 --- /dev/null +++ b/niri/files/generate-config.sh @@ -0,0 +1,78 @@ +#!/usr/bin/env bash + +# Paths +TEMPLATE_FILE="$HOME/.config/niri/config.tmpl.kdl" +COLORS_FILE="$HOME/.config/niri/colors.conf" +OUTPUT_FILE="$HOME/.config/niri/config.kdl" + +# Function to generate config +generate_config() { + echo "Regenerating niri config..." + + # Check if colors file exists + if [[ ! -f "$COLORS_FILE" ]]; then + echo "Colors file not found: $COLORS_FILE" + return 1 + fi + + # Check if template file exists + if [[ ! -f "$TEMPLATE_FILE" ]]; then + echo "Template file not found: $TEMPLATE_FILE" + return 1 + fi + + # Check if template file is not empty + if [[ ! -s "$TEMPLATE_FILE" ]]; then + echo "Template file is empty: $TEMPLATE_FILE" + return 1 + fi + + # Read colors and create temporary variables + declare -A colors + while IFS='=' read -r key value; do + if [[ $key =~ ^@([a-zA-Z_][a-zA-Z0-9_]*) ]]; then + color_name="${BASH_REMATCH[1]}" + color_value=$(echo "$value" | tr -d ' ') + colors["$color_name"]="$color_value" + fi + done < "$COLORS_FILE" + + # Create temporary file for atomic write + TEMP_FILE="${OUTPUT_FILE}.tmp" + + # Copy template to temporary file + if ! cp "$TEMPLATE_FILE" "$TEMP_FILE"; then + echo "Failed to copy template file" + rm -f "$TEMP_FILE" + return 1 + fi + + # Replace @color_name with actual color values + for color_name in "${!colors[@]}"; do + if ! sed -i "s/@${color_name}/${colors[$color_name]}/g" "$TEMP_FILE"; then + echo "Failed to substitute colors" + rm -f "$TEMP_FILE" + return 1 + fi + done + + # Verify the temporary file is not empty + if [[ ! -s "$TEMP_FILE" ]]; then + echo "Generated config is empty, not overwriting existing config" + rm -f "$TEMP_FILE" + return 1 + fi + + # Atomically move temp file to final location + if mv "$TEMP_FILE" "$OUTPUT_FILE"; then + echo "Config regenerated successfully!" + return 0 + else + echo "Failed to move config to final location" + rm -f "$TEMP_FILE" + return 1 + fi +} + +# Generate config once on startup +generate_config diff --git a/niri/files/niri-watcher.sh b/niri/files/niri-watcher.sh new file mode 100755 index 0000000..820beb5 --- /dev/null +++ b/niri/files/niri-watcher.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +# Paths +TEMPLATE_FILE="$HOME/.config/niri/config.tmpl.kdl" +COLORS_FILE="$HOME/.config/niri/colors.conf" +OUTPUT_FILE="$HOME/.config/niri/config.kdl" + + +# Call ./generate-config.sh +generate_config() { + "$HOME/.config/niri/generate-config.sh" +} + +generate_config + +# Watch for changes +echo "Watching for changes in $TEMPLATE_FILE and $COLORS_FILE..." +inotifywait -m -e modify,create,delete,move,close_write \ + "$(dirname "$TEMPLATE_FILE")" \ + "$(dirname "$COLORS_FILE")" | +while read -r path events filename; do + if [[ "$path$filename" == "$TEMPLATE_FILE" || "$path$filename" == "$COLORS_FILE" ]]; then + echo "Detected change: $events in $path$filename" + sleep 0.2 + generate_config + fi +done diff --git a/zellij/config.lua b/zellij/config.lua new file mode 100644 index 0000000..faff0c9 --- /dev/null +++ b/zellij/config.lua @@ -0,0 +1,6 @@ +return { + target = { + linux = "~/.config/zellij", + default = "~/.config/zellij", + }, +} diff --git a/zellij/files/config.kdl b/zellij/files/config.kdl new file mode 100644 index 0000000..7c8baf8 --- /dev/null +++ b/zellij/files/config.kdl @@ -0,0 +1,532 @@ +keybinds clear-defaults=true { + locked { + bind "Ctrl g" { SwitchToMode "normal"; } + } + pane { + bind "left" { MoveFocus "left"; } + bind "down" { MoveFocus "down"; } + bind "up" { MoveFocus "up"; } + bind "right" { MoveFocus "right"; } + bind "c" { SwitchToMode "renamepane"; PaneNameInput 0; } + bind "d" { NewPane "down"; SwitchToMode "normal"; } + bind "e" { TogglePaneEmbedOrFloating; SwitchToMode "normal"; } + bind "f" { ToggleFocusFullscreen; SwitchToMode "normal"; } + bind "h" { MoveFocus "left"; } + bind "i" { TogglePanePinned; SwitchToMode "normal"; } + bind "j" { MoveFocus "down"; } + bind "k" { MoveFocus "up"; } + bind "l" { MoveFocus "right"; } + bind "n" { NewPane; SwitchToMode "normal"; } + bind "p" { SwitchFocus; } + bind "Ctrl p" { SwitchToMode "normal"; } + bind "r" { NewPane "right"; SwitchToMode "normal"; } + bind "s" { NewPane "stacked"; SwitchToMode "normal"; } + bind "w" { ToggleFloatingPanes; SwitchToMode "normal"; } + bind "z" { TogglePaneFrames; SwitchToMode "normal"; } + } + tab { + bind "left" { GoToPreviousTab; } + bind "down" { GoToNextTab; } + bind "up" { GoToPreviousTab; } + bind "right" { GoToNextTab; } + bind "1" { GoToTab 1; SwitchToMode "normal"; } + bind "2" { GoToTab 2; SwitchToMode "normal"; } + bind "3" { GoToTab 3; SwitchToMode "normal"; } + bind "4" { GoToTab 4; SwitchToMode "normal"; } + bind "5" { GoToTab 5; SwitchToMode "normal"; } + bind "6" { GoToTab 6; SwitchToMode "normal"; } + bind "7" { GoToTab 7; SwitchToMode "normal"; } + bind "8" { GoToTab 8; SwitchToMode "normal"; } + bind "9" { GoToTab 9; SwitchToMode "normal"; } + bind "[" { BreakPaneLeft; SwitchToMode "normal"; } + bind "]" { BreakPaneRight; SwitchToMode "normal"; } + bind "b" { BreakPane; SwitchToMode "normal"; } + bind "h" { GoToPreviousTab; } + bind "j" { GoToNextTab; } + bind "k" { GoToPreviousTab; } + bind "l" { GoToNextTab; } + bind "n" { NewTab; SwitchToMode "normal"; } + bind "r" { SwitchToMode "renametab"; TabNameInput 0; } + bind "s" { ToggleActiveSyncTab; SwitchToMode "normal"; } + bind "Ctrl t" { SwitchToMode "normal"; } + bind "x" { CloseTab; SwitchToMode "normal"; } + bind "tab" { ToggleTab; } + } + resize { + bind "left" { Resize "Increase left"; } + bind "down" { Resize "Increase down"; } + bind "up" { Resize "Increase up"; } + bind "right" { Resize "Increase right"; } + bind "+" { Resize "Increase"; } + bind "-" { Resize "Decrease"; } + bind "=" { Resize "Increase"; } + bind "H" { Resize "Decrease left"; } + bind "J" { Resize "Decrease down"; } + bind "K" { Resize "Decrease up"; } + bind "L" { Resize "Decrease right"; } + bind "h" { Resize "Increase left"; } + bind "j" { Resize "Increase down"; } + bind "k" { Resize "Increase up"; } + bind "l" { Resize "Increase right"; } + bind "Ctrl n" { SwitchToMode "normal"; } + } + move { + bind "left" { MovePane "left"; } + bind "down" { MovePane "down"; } + bind "up" { MovePane "up"; } + bind "right" { MovePane "right"; } + bind "h" { MovePane "left"; } + bind "Ctrl h" { SwitchToMode "normal"; } + bind "j" { MovePane "down"; } + bind "k" { MovePane "up"; } + bind "l" { MovePane "right"; } + bind "n" { MovePane; } + bind "p" { MovePaneBackwards; } + bind "tab" { MovePane; } + } + scroll { + bind "e" { EditScrollback; SwitchToMode "normal"; } + bind "s" { SwitchToMode "entersearch"; SearchInput 0; } + } + search { + bind "c" { SearchToggleOption "CaseSensitivity"; } + bind "n" { Search "down"; } + bind "o" { SearchToggleOption "WholeWord"; } + bind "p" { Search "up"; } + bind "w" { SearchToggleOption "Wrap"; } + } + session { + bind "a" { + LaunchOrFocusPlugin "zellij:about" { + floating true + move_to_focused_tab true + } + SwitchToMode "normal" + } + bind "c" { + LaunchOrFocusPlugin "configuration" { + floating true + move_to_focused_tab true + } + SwitchToMode "normal" + } + bind "Ctrl o" { SwitchToMode "normal"; } + bind "p" { + LaunchOrFocusPlugin "plugin-manager" { + floating true + move_to_focused_tab true + } + SwitchToMode "normal" + } + bind "s" { + LaunchOrFocusPlugin "zellij:share" { + floating true + move_to_focused_tab true + } + SwitchToMode "normal" + } + bind "w" { + LaunchOrFocusPlugin "session-manager" { + floating true + move_to_focused_tab true + } + SwitchToMode "normal" + } + } + shared_except "locked" { + bind "Alt left" { MoveFocusOrTab "left"; } + bind "Alt down" { MoveFocus "down"; } + bind "Alt up" { MoveFocus "up"; } + bind "Alt right" { MoveFocusOrTab "right"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt [" { PreviousSwapLayout; } + bind "Alt ]" { NextSwapLayout; } + bind "Alt f" { ToggleFloatingPanes; } + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Alt h" { MoveFocusOrTab "left"; } + bind "Alt i" { MoveTab "left"; } + bind "Alt j" { MoveFocus "down"; } + bind "Alt k" { MoveFocus "up"; } + bind "Alt l" { MoveFocusOrTab "right"; } + bind "Alt n" { NewPane; } + bind "Alt o" { MoveTab "right"; } + bind "Alt p" { TogglePaneInGroup; } + bind "Alt Shift p" { ToggleGroupMarking; } + bind "Ctrl q" { Quit; } + } + shared_except "locked" "move" { + bind "Ctrl h" { SwitchToMode "move"; } + } + shared_except "locked" "session" { + bind "Ctrl o" { SwitchToMode "session"; } + } + shared_except "locked" "scroll" "search" "tmux" { + bind "Ctrl b" { SwitchToMode "tmux"; } + } + shared_except "locked" "scroll" "search" { + bind "Ctrl s" { SwitchToMode "scroll"; } + } + shared_except "locked" "tab" { + bind "Ctrl t" { SwitchToMode "tab"; } + } + shared_except "locked" "pane" { + bind "Ctrl p" { SwitchToMode "pane"; } + } + shared_except "locked" "resize" { + bind "Ctrl n" { SwitchToMode "resize"; } + } + shared_except "normal" "locked" "entersearch" { + bind "enter" { SwitchToMode "normal"; } + } + shared_except "normal" "locked" "entersearch" "renametab" "renamepane" { + bind "esc" { SwitchToMode "normal"; } + } + shared_among "pane" "tmux" { + bind "x" { CloseFocus; SwitchToMode "normal"; } + } + shared_among "scroll" "search" { + bind "PageDown" { PageScrollDown; } + bind "PageUp" { PageScrollUp; } + bind "left" { PageScrollUp; } + bind "down" { ScrollDown; } + bind "up" { ScrollUp; } + bind "right" { PageScrollDown; } + bind "Ctrl b" { PageScrollUp; } + bind "Ctrl c" { ScrollToBottom; SwitchToMode "normal"; } + bind "d" { HalfPageScrollDown; } + bind "Ctrl f" { PageScrollDown; } + bind "h" { PageScrollUp; } + bind "j" { ScrollDown; } + bind "k" { ScrollUp; } + bind "l" { PageScrollDown; } + bind "Ctrl s" { SwitchToMode "normal"; } + bind "u" { HalfPageScrollUp; } + } + entersearch { + bind "Ctrl c" { SwitchToMode "scroll"; } + bind "esc" { SwitchToMode "scroll"; } + bind "enter" { SwitchToMode "search"; } + } + renametab { + bind "esc" { UndoRenameTab; SwitchToMode "tab"; } + } + shared_among "renametab" "renamepane" { + bind "Ctrl c" { SwitchToMode "normal"; } + } + renamepane { + bind "esc" { UndoRenamePane; SwitchToMode "pane"; } + } + shared_among "session" "tmux" { + bind "d" { Detach; } + } + tmux { + bind "left" { MoveFocus "left"; SwitchToMode "normal"; } + bind "down" { MoveFocus "down"; SwitchToMode "normal"; } + bind "up" { MoveFocus "up"; SwitchToMode "normal"; } + bind "right" { MoveFocus "right"; SwitchToMode "normal"; } + bind "space" { NextSwapLayout; } + bind "\"" { NewPane "down"; SwitchToMode "normal"; } + bind "%" { NewPane "right"; SwitchToMode "normal"; } + bind "," { SwitchToMode "renametab"; } + bind "[" { SwitchToMode "scroll"; } + bind "Ctrl b" { Write 2; SwitchToMode "normal"; } + bind "c" { NewTab; SwitchToMode "normal"; } + bind "h" { MoveFocus "left"; SwitchToMode "normal"; } + bind "j" { MoveFocus "down"; SwitchToMode "normal"; } + bind "k" { MoveFocus "up"; SwitchToMode "normal"; } + bind "l" { MoveFocus "right"; SwitchToMode "normal"; } + bind "n" { GoToNextTab; SwitchToMode "normal"; } + bind "o" { FocusNextPane; } + bind "p" { GoToPreviousTab; SwitchToMode "normal"; } + bind "z" { ToggleFocusFullscreen; SwitchToMode "normal"; } + } +} + +// Plugin aliases - can be used to change the implementation of Zellij +// changing these requires a restart to take effect +plugins { + about location="zellij:about" + compact-bar location="zellij:compact-bar" + configuration location="zellij:configuration" + filepicker location="zellij:strider" { + cwd "/" + } + plugin-manager location="zellij:plugin-manager" + session-manager location="zellij:session-manager" + status-bar location="zellij:status-bar" + strider location="zellij:strider" + tab-bar location="zellij:tab-bar" + welcome-screen location="zellij:session-manager" { + welcome_screen true + } +} + +// Plugins to load in the background when a new session starts +// eg. "file:/path/to/my-plugin.wasm" +// eg. "https://example.com/my-plugin.wasm" +load_plugins { +} +web_client { + font "monospace" +} + +// Use a simplified UI without special fonts (arrow glyphs) +// Options: +// - true +// - false (Default) +// +// simplified_ui true + +// Choose the theme that is specified in the themes section. +// Default: default +// +// theme "dracula" + +// Choose the base input mode of zellij. +// Default: normal +// +// default_mode "locked" + +// Choose the path to the default shell that zellij will use for opening new panes +// Default: $SHELL +// +// default_shell "fish" + +// Choose the path to override cwd that zellij will use for opening new panes +// +// default_cwd "/tmp" + +// The name of the default layout to load on startup +// Default: "default" +// +// default_layout "compact" + +// The folder in which Zellij will look for layouts +// (Requires restart) +// +// layout_dir "/tmp" + +// The folder in which Zellij will look for themes +// (Requires restart) +// +// theme_dir "/tmp" + +// Toggle enabling the mouse mode. +// On certain configurations, or terminals this could +// potentially interfere with copying text. +// Options: +// - true (default) +// - false +// +// mouse_mode false + +// Toggle having pane frames around the panes +// Options: +// - true (default, enabled) +// - false +// +// pane_frames false + +// When attaching to an existing session with other users, +// should the session be mirrored (true) +// or should each user have their own cursor (false) +// (Requires restart) +// Default: false +// +// mirror_session true + +// Choose what to do when zellij receives SIGTERM, SIGINT, SIGQUIT or SIGHUP +// eg. when terminal window with an active zellij session is closed +// (Requires restart) +// Options: +// - detach (Default) +// - quit +// +// on_force_close "quit" + +// Configure the scroll back buffer size +// This is the number of lines zellij stores for each pane in the scroll back +// buffer. Excess number of lines are discarded in a FIFO fashion. +// (Requires restart) +// Valid values: positive integers +// Default value: 10000 +// +// scroll_buffer_size 10000 + +// Provide a command to execute when copying text. The text will be piped to +// the stdin of the program to perform the copy. This can be used with +// terminal emulators which do not support the OSC 52 ANSI control sequence +// that will be used by default if this option is not set. +// Examples: +// +// copy_command "xclip -selection clipboard" // x11 +// copy_command "wl-copy" // wayland +// copy_command "pbcopy" // osx +// +// copy_command "pbcopy" + +// Choose the destination for copied text +// Allows using the primary selection buffer (on x11/wayland) instead of the system clipboard. +// Does not apply when using copy_command. +// Options: +// - system (default) +// - primary +// +// copy_clipboard "primary" + +// Enable automatic copying (and clearing) of selection when releasing mouse +// Default: true +// +// copy_on_select true + +// Path to the default editor to use to edit pane scrollbuffer +// Default: $EDITOR or $VISUAL +// scrollback_editor "/usr/bin/vim" + +// A fixed name to always give the Zellij session. +// Consider also setting `attach_to_session true,` +// otherwise this will error if such a session exists. +// Default: +// +// session_name "My singleton session" + +// When `session_name` is provided, attaches to that session +// if it is already running or creates it otherwise. +// Default: false +// +// attach_to_session true + +// Toggle between having Zellij lay out panes according to a predefined set of layouts whenever possible +// Options: +// - true (default) +// - false +// +// auto_layout false + +// Whether sessions should be serialized to the cache folder (including their tabs/panes, cwds and running commands) so that they can later be resurrected +// Options: +// - true (default) +// - false +// +// session_serialization false + +// Whether pane viewports are serialized along with the session, default is false +// Options: +// - true +// - false (default) +// +// serialize_pane_viewport false + +// Scrollback lines to serialize along with the pane viewport when serializing sessions, 0 +// defaults to the scrollback size. If this number is higher than the scrollback size, it will +// also default to the scrollback size. This does nothing if `serialize_pane_viewport` is not true. +// +// scrollback_lines_to_serialize 10000 + +// Enable or disable the rendering of styled and colored underlines (undercurl). +// May need to be disabled for certain unsupported terminals +// (Requires restart) +// Default: true +// +// styled_underlines false + +// How often in seconds sessions are serialized +// +// serialization_interval 10000 + +// Enable or disable writing of session metadata to disk (if disabled, other sessions might not know +// metadata info on this session) +// (Requires restart) +// Default: false +// +// disable_session_metadata false + +// Enable or disable support for the enhanced Kitty Keyboard Protocol (the host terminal must also support it) +// (Requires restart) +// Default: true (if the host terminal supports it) +// +// support_kitty_keyboard_protocol false +// Whether to make sure a local web server is running when a new Zellij session starts. +// This web server will allow creating new sessions and attaching to existing ones that have +// opted in to being shared in the browser. +// When enabled, navigate to http://127.0.0.1:8082 +// (Requires restart) +// +// Note: a local web server can still be manually started from within a Zellij session or from the CLI. +// If this is not desired, one can use a version of Zellij compiled without +// `web_server_capability` +// +// Possible values: +// - true +// - false +// Default: false +// +// web_server false +// Whether to allow sessions started in the terminal to be shared through a local web server, assuming one is +// running (see the `web_server` option for more details). +// (Requires restart) +// +// Note: This is an administrative separation and not intended as a security measure. +// +// Possible values: +// - "on" (allow web sharing through the local web server if it +// is online) +// - "off" (do not allow web sharing unless sessions explicitly opt-in to it) +// - "disabled" (do not allow web sharing and do not permit sessions started in the terminal to opt-in to it) +// Default: "off" +// +// web_sharing "off" +// A path to a certificate file to be used when setting up the web client to serve the +// connection over HTTPs +// +// web_server_cert "/path/to/cert.pem" +// A path to a key file to be used when setting up the web client to serve the +// connection over HTTPs +// +// web_server_key "/path/to/key.pem" +/// Whether to enforce https connections to the web server when it is bound to localhost +/// (127.0.0.0/8) +/// +/// Note: https is ALWAYS enforced when bound to non-local interfaces +/// +/// Default: false +// +// enforce_https_for_localhost false + +// Whether to stack panes when resizing beyond a certain size +// Default: true +// +// stacked_resize false + +// Whether to show tips on startup +// Default: true +// +// show_startup_tips false + +// Whether to show release notes on first version run +// Default: true +// +// show_release_notes false + +// Whether to enable mouse hover effects and pane grouping functionality +// default is true +// advanced_mouse_actions false + +// The ip address the web server should listen on when it starts +// Default: "127.0.0.1" +// (Requires restart) +// web_server_ip "127.0.0.1" + +// The port the web server should listen on when it starts +// Default: 8082 +// (Requires restart) +// web_server_port 8082 + +// A command to run (will be wrapped with sh -c and provided the RESURRECT_COMMAND env variable) +// after Zellij attempts to discover a command inside a pane when resurrecting sessions, the STDOUT +// of this command will be used instead of the discovered RESURRECT_COMMAND +// can be useful for removing wrappers around commands +// Note: be sure to escape backslashes and similar characters properly +// post_command_discovery_hook "echo $RESURRECT_COMMAND | sed "