From b67de77acae24fc7b5989cc74f084186ed216152 Mon Sep 17 00:00:00 2001 From: "Paul W." Date: Tue, 4 Aug 2026 18:05:14 -0400 Subject: [PATCH] Add niri; other minor changes --- emacs/init.el | 18 ++-- i3/config | 36 +------ niri/config.kdl | 270 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 286 insertions(+), 38 deletions(-) create mode 100644 niri/config.kdl diff --git a/emacs/init.el b/emacs/init.el index 92afff2..505d2ea 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1,6 +1,7 @@ -;;"GNU Emacs 30.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.50, cairo version 1.18.4)" (setq-local uconf-font-name "Iosevka") -(setq custom-file (file-name-concat (file-name-directory user-init-file) "custom.el")) +(setq custom-file + (file-name-concat + (file-name-directory user-init-file) "custom.el")) (setq inhibit-startup-screen t) (setq display-line-numbers-type 'relative) @@ -14,17 +15,17 @@ (column-number-mode 1) (whitespace-mode 1) +(split-window-right) + (keymap-global-set "C-." 'other-window) (keymap-global-set "C-c c" 'compile) -(keymap-global-set "C-c C-c" 'recompile) - -(split-window-right) +(keymap-global-set "C-c x" 'recompile) (require 'compile) (add-to-list 'compilation-error-regexp-alist-alist '(paren-style - "^\\([^(\n]+\\)(\\([0-9]+\\),\\([0-9]+\\)):" + "^\\([^(\n]+\\)(\\([0-9]+\\)[,:]\\([0-9]+\\))" 1 2 3)) (add-to-list 'compilation-error-regexp-alist 'paren-style) @@ -73,6 +74,11 @@ (set-face-attribute 'default nil :font uconf-font-name)) +(require 'eglot) +(add-to-list 'eglot-server-programs '((c++-mode c-mode) "clangd")) +(add-hook 'c-mode-hook 'eglot-ensure) +(add-hook 'c++-mode-hook 'eglot-ensure) + (use-package magit :ensure t :bind (("C-x g" . magit-status))) diff --git a/i3/config b/i3/config index 0d0198f..08997a4 100644 --- a/i3/config +++ b/i3/config @@ -2,55 +2,37 @@ set $mod Mod4 font pango:Noto Sans 12 -# Start XDG autostart .desktop files using dex. See also -# https://wiki.archlinux.org/index.php/XDG_Autostart exec --no-startup-id dex --autostart --environment i3 - exec --no-startup-id xsettingsd exec --no-startup-id xfce4-clipman -# The combination of xss-lock, nm-applet and pactl is a popular choice, so -# they are included here as an example. Modify as you see fit. - -# xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the -# screen before suspend. Use loginctl lock-session to lock your screen. exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork - -# NetworkManager is the most popular way to manage wireless networks on Linux, -# and nm-applet is a desktop environment-independent system tray GUI for it. exec --no-startup-id nm-applet -# Use pactl to adjust volume in PulseAudio. +# Audio controls set $refresh_i3status killall -SIGUSR1 i3status bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status -# move tiling windows via drag & drop by left-clicking into the title bar, -# or left-clicking anywhere into the window while holding the floating modifier. tiling_drag modifier titlebar bindsym $mod+Return exec alacritty - bindsym $mod+q kill - -bindsym $mod+b exec brave +bindsym $mod+b exec brave-origin bindsym $mod+space exec --no-startup-id "rofi -modi drun,run -show drun" bindsym $mod+Tab exec --no-startup-id "rofi -modi window -show window" -# bindcode $mod+40 exec "rofi -modi drun,run -show drun" -# change focus bindsym $mod+h focus left bindsym $mod+j focus down bindsym $mod+k focus up bindsym $mod+l focus right -# move focused window + bindsym $mod+Shift+h move left bindsym $mod+Shift+j move down bindsym $mod+Shift+k move up bindsym $mod+Shift+l move right -# alternatively, you can use the cursor keys: bindsym $mod+Left focus left bindsym $mod+Down focus down bindsym $mod+Up focus up @@ -60,30 +42,22 @@ bindsym $mod+Shift+Down move down bindsym $mod+Shift+Up move up bindsym $mod+Shift+Right move right -# split in horizontal orientation bindsym $mod+m split h -# split in vertical orientation bindsym $mod+n split v -# enter fullscreen mode for the focused container bindsym $mod+f fullscreen toggle -# change container layout (stacked, tabbed, toggle split) bindsym $mod+s layout stacking bindsym $mod+w layout tabbed bindsym $mod+e layout toggle split -# toggle tiling / floating bindsym $mod+t floating toggle -# change focus between tiling / floating windows bindsym $mod+g focus mode_toggle +bindsym $mod+a focus parent floating_modifier $mod -# focus the parent container -bindsym $mod+a focus parent - set $ws1 "1" set $ws2 "2" set $ws3 "3" @@ -106,7 +80,6 @@ bindsym $mod+8 workspace number $ws8 bindsym $mod+9 workspace number $ws9 bindsym $mod+0 workspace number $ws10 -# move focused container to workspace bindsym $mod+Shift+1 move container to workspace number $ws1 bindsym $mod+Shift+2 move container to workspace number $ws2 bindsym $mod+Shift+3 move container to workspace number $ws3 @@ -123,7 +96,6 @@ bindsym $mod+Shift+c restart bindsym $mod+Escape exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'" mode "resize" { - # These bindings trigger as soon as you enter the resize mode bindsym j resize shrink width 10 px or 10 ppt bindsym k resize grow height 10 px or 10 ppt bindsym l resize shrink height 10 px or 10 ppt diff --git a/niri/config.kdl b/niri/config.kdl new file mode 100644 index 0000000..0ea7828 --- /dev/null +++ b/niri/config.kdl @@ -0,0 +1,270 @@ +// https://niri-wm.github.io/niri/Configuration:-Input +input { + keyboard { + repeat-delay 300 + repeat-rate 50 + xkb { + } + numlock + } + + mouse { + // accel-speed 0.2 + // accel-profile "flat" + // scroll-method "no-scroll" + } +} + +// https://niri-wm.github.io/niri/Configuration:-Layout +layout { + gaps 4 + center-focused-column "never" + + preset-column-widths { + proportion 0.33333 + proportion 0.5 + proportion 0.66667 + } + + default-column-width { proportion 0.5; } + + // 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`. + + focus-ring { + width 1 + active-color "#7fc8ff" + inactive-color "#505050" + } + + border { + off + } + + // 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 + } +} + +prefer-no-csd + +// 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. + +spawn-at-startup "noctalia" + +// spawn-sh-at-startup "qs -c ~/source/qs/MyAwesomeShell" + +hotkey-overlay { + skip-at-startup +} + + +// 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" + +// https://niri-wm.github.io/niri/Configuration:-Animations +animations {} + +// https://niri-wm.github.io/niri/Configuration:-Window-Rules +window-rule { + open-maximized true +} + +window-rule { + match app-id="imv" + open-floating true +} + +window-rule { + match title="Picture in picture" // this doesn't have an id :shrug: at least w/ brave + open-floating true +} + +window-rule { + match app-id=r#"^brave.*"# title="Bitwarden" + open-floating true + block-out-from "screen-capture" +} + +binds { + Mod+Shift+Slash { show-hotkey-overlay; } + + Mod+B repeat=false hotkey-overlay-title="Open a Browser: brave-origin" { spawn "brave-origin"; } + Mod+E repeat=false hotkey-overlay-title="Open a File Manager: nautilus" {spawn "nautilus"; } + Mod+Return repeat=false hotkey-overlay-title="Open a Terminal: alacritty" { spawn "alacritty"; } + Mod+Space hotkey-overlay-title="Run an Application" { spawn-sh "noctalia msg panel-toggle launcher"; } + Super+Alt+L hotkey-overlay-title="Lock the Screen" { spawn "noctalia" "msg" "session" "lock-and-suspend"; } + + XF86AudioRaiseVolume allow-when-locked=true { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1+ -l 1.0"; } + XF86AudioLowerVolume allow-when-locked=true { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1-"; } + XF86AudioMute allow-when-locked=true { spawn-sh "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; } + XF86AudioMicMute allow-when-locked=true { spawn-sh "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"; } + + XF86AudioPlay allow-when-locked=true { spawn-sh "playerctl play-pause"; } + XF86AudioStop allow-when-locked=true { spawn-sh "playerctl stop"; } + XF86AudioPrev allow-when-locked=true { spawn-sh "playerctl previous"; } + XF86AudioNext allow-when-locked=true { spawn-sh "playerctl next"; } + + XF86MonBrightnessUp allow-when-locked=true { spawn "brightnessctl" "--class=backlight" "set" "+10%"; } + XF86MonBrightnessDown allow-when-locked=true { spawn "brightnessctl" "--class=backlight" "set" "10%-"; } + + Mod+O repeat=false { toggle-overview; } + Mod+Q repeat=false { 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+Ctrl+Left { move-column-left; } + Mod+Ctrl+Down { move-window-down; } + Mod+Ctrl+Up { move-window-up; } + Mod+Ctrl+Right { move-column-right; } + Mod+Ctrl+H { move-column-left; } + Mod+Ctrl+J { move-window-down; } + Mod+Ctrl+K { move-window-up; } + Mod+Ctrl+L { move-column-right; } + + Mod+Home { focus-column-first; } + Mod+End { focus-column-last; } + Mod+Ctrl+Home { move-column-to-first; } + Mod+Ctrl+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; } + + Mod+Page_Down { focus-workspace-down; } + Mod+Page_Up { focus-workspace-up; } + Mod+U { focus-workspace-down; } + Mod+I { focus-workspace-up; } + Mod+Ctrl+Page_Down { move-column-to-workspace-down; } + Mod+Ctrl+Page_Up { move-column-to-workspace-up; } + Mod+Ctrl+U { move-column-to-workspace-down; } + Mod+Ctrl+I { move-column-to-workspace-up; } + + Mod+Shift+Page_Down { move-workspace-down; } + Mod+Shift+Page_Up { move-workspace-up; } + Mod+Shift+U { move-workspace-down; } + Mod+Shift+I { move-workspace-up; } + + 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; } + + 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; } + + 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+Ctrl+1 { move-column-to-workspace 1; } + Mod+Ctrl+2 { move-column-to-workspace 2; } + Mod+Ctrl+3 { move-column-to-workspace 3; } + Mod+Ctrl+4 { move-column-to-workspace 4; } + Mod+Ctrl+5 { move-column-to-workspace 5; } + Mod+Ctrl+6 { move-column-to-workspace 6; } + Mod+Ctrl+7 { move-column-to-workspace 7; } + Mod+Ctrl+8 { move-column-to-workspace 8; } + Mod+Ctrl+9 { move-column-to-workspace 9; } + + Mod+BracketLeft { consume-or-expel-window-left; } + Mod+BracketRight { consume-or-expel-window-right; } + + Mod+Comma { consume-window-into-column; } + Mod+Period { expel-window-from-column; } + + Mod+R { switch-preset-column-width; } + Mod+Shift+R { switch-preset-column-width-back; } + + Mod+Ctrl+Shift+R { switch-preset-window-height; } + Mod+Ctrl+R { reset-window-height; } + + Mod+F { maximize-column; } + Mod+Shift+F { fullscreen-window; } + + Mod+M { maximize-window-to-edges; } + + Mod+Ctrl+F { expand-column-to-available-width; } + + Mod+C { center-column; } + + Mod+Ctrl+C { center-visible-columns; } + + Mod+Minus { set-column-width "-10%"; } + Mod+Equal { set-column-width "+10%"; } + + Mod+Shift+Minus { set-window-height "-10%"; } + Mod+Shift+Equal { set-window-height "+10%"; } + + Mod+V { toggle-window-floating; } + Mod+Shift+V { switch-focus-between-floating-and-tiling; } + + Mod+W { toggle-column-tabbed-display; } + + Print { screenshot; } + Ctrl+Print { screenshot-screen; } + Alt+Print { screenshot-window; } + + Mod+Escape allow-inhibiting=false { toggle-keyboard-shortcuts-inhibit; } + + Mod+Shift+Escape { quit; } + Mod+Shift+E { quit; } + Ctrl+Alt+Delete { quit; } + + Mod+Shift+P { power-off-monitors; } +} +