From a6dda9ff0b8a69c80664a2d6f52616f10f88b5f8 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Tue, 10 Feb 2026 21:17:31 -0500 Subject: [PATCH] refactor some configs --- config/hypr/hyprland.conf | 159 ++++++++++++++++++++++ config/hypr/nvidia.conf | 11 ++ config/nvim/lua/plugins/guard.lua | 4 + home/modules/editor.nix | 74 +++++----- home/modules/packages.nix | 2 +- home/modules/shell.nix | 6 +- home/modules/ui.nix | 217 ++++-------------------------- 7 files changed, 244 insertions(+), 229 deletions(-) create mode 100644 config/hypr/hyprland.conf create mode 100644 config/hypr/nvidia.conf diff --git a/config/hypr/hyprland.conf b/config/hypr/hyprland.conf new file mode 100644 index 0000000..7d19212 --- /dev/null +++ b/config/hypr/hyprland.conf @@ -0,0 +1,159 @@ +exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=Hyprland THEME +exec-once = systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=Hyprland THEME + +monitor=,preferred,auto,1 + +env = XDG_CURRENT_DESKTOP,Hyprland +env = XDG_SESSION_TYPE,wayland +env = ELECTRON_OZONE_PLATFORM_HINT,wayland +env = GTK_USE_PORTAL,1 +env = OZONE_PLATFORM,wayland +env = QT_QPA_PLATFORM,wayland +env = GDK_BACKEND,wayland,x11 +env = SDL_VIDEODRIVER,wayland + +env = XCURSOR_SIZE,24 +env = HYPRCURSOR_SIZE,24 + +input { + kb_layout = us,us + kb_variant = ,colemak + follow_mouse = 1 + sensitivity = 0 + touchpad { + tap-to-click = false + } + repeat_delay = 300 + repeat_rate = 50 +} + +master { + new_status = slave + new_on_top = false + mfact = 0.50 +} + +decoration { + rounding = 0 + active_opacity = 1.0 + inactive_opacity = 1.0 + blur { + enabled = false + } +} + +animations { + enabled = false +} + +misc { + force_default_wallpaper = 0 + disable_hyprland_logo = true +} + +exec-once = dunst +exec-once = wl-paste --watch cliphist store +exec-once = hyprpaper +exec-once = hypridle +exec-once = hypr spawnfocus --ws 1 $TERMINAL -e mux +exec-once = hypr spawnfocus --ws 2 $BROWSER + +bindul = , XF86AudioRaiseVolume, exec, hypr volume up +bindul = , XF86AudioLowerVolume, exec, hypr volume down +bindul = , XF86AudioMute, exec, hypr volume toggle + +bindul = , XF86MonBrightnessUp, exec, hypr brightness up +bindul = , XF86MonBrightnessDown, exec, hypr brightness down + +bindu = ALT, SPACE, exec, rofi -show run +bindu = ALT, TAB, workspace, previous +bindu = ALT, A, cyclenext +bindu = ALT, B, exec, pkill -USR1 waybar || waybar +bindu = ALT, D, layoutmsg, swapprev +bindu = ALT, F, cyclenext, prev +bindu = ALT, H, resizeactive, -15 0 +bindu = ALT, J, resizeactive, 0 15 +bindu = ALT, K, resizeactive, 0 -15 +bindu = ALT, L, resizeactive, 15 0 +bindu = ALT, Q, killactive, +bindu = ALT, U, layoutmsg, swapnext + +bindu = ALT CTRL, B, exec, hypr pull bitwarden-desktop +bindu = ALT CTRL, C, exec, hypr pull $BROWSER +bindu = ALT CTRL, D, exec, hypr pull discord +bindu = ALT CTRL, S, exec, hypr pull signal-desktop +bindu = ALT CTRL, T, exec, hypr pull Telegram +bindu = ALT CTRL, V, exec, hypr pull vesktop +bindu = ALT CTRL, Y, exec, hypr pull sioyek + +bindu = ALT SHIFT, RETURN, exec, hypr spawnfocus --ws 1 $TERMINAL +bindu = ALT SHIFT, B, exec, hypr spawnfocus --ws 9 bitwarden-desktop +bindu = ALT SHIFT, C, exec, hypr spawnfocus --ws 2 $BROWSER --ozone-platform=wayland +bindu = ALT SHIFT, D, exec, hypr spawnfocus --ws 5 discord +bindu = ALT SHIFT, F, togglefloating +bindu = ALT SHIFT, G, exec, hypr pull $TERMINAL +bindu = ALT SHIFT, Q, exec, hypr exit +bindu = ALT SHIFT, R, exec, hyprctl reload && notify-send -u low 'hyprland reloaded' +bindu = ALT SHIFT, S, exec, hypr spawnfocus --ws 6 signal-desktop +bindu = ALT SHIFT, T, exec, hypr spawnfocus --ws 6 Telegram +bindu = ALT SHIFT, V, exec, hypr spawnfocus --ws 5 vesktop +bindu = ALT SHIFT, Y, exec, hypr spawnfocus --ws 3 sioyek + +bind = , XF86Tools, submap, scripts +submap = scripts + +bind = , A, exec, ctl audio out +bind = , C, exec, bash -lc 'cliphist list | rofi -dmenu -p "copy to clipboard" --lines 15 | cliphist decode | wl-copy' +bind = , F, exec, [float; fullscreen] ghostty -e lf +bind = , K, exec, ctl keyboard toggle +bind = , O, exec, ctl ocr +bind = , P, exec, hypr pull +bind = , S, exec, ctl screenshot +bind = , T, exec, theme + +bind = , catchall, submap, reset +submap = reset + +bindu = ALT, 1, workspace, 1 +bindu = ALT, 2, workspace, 2 +bindu = ALT, 3, workspace, 3 +bindu = ALT, 4, workspace, 4 +bindu = ALT, 5, workspace, 5 +bindu = ALT, 6, workspace, 6 +bindu = ALT, 7, workspace, 7 +bindu = ALT, 8, workspace, 8 +bindu = ALT, 9, workspace, 9 + +bindu = ALT SHIFT, 1, movetoworkspace, 1 +bindu = ALT SHIFT, 2, movetoworkspace, 2 +bindu = ALT SHIFT, 3, movetoworkspace, 3 +bindu = ALT SHIFT, 4, movetoworkspace, 4 +bindu = ALT SHIFT, 5, movetoworkspace, 5 +bindu = ALT SHIFT, 6, movetoworkspace, 6 +bindu = ALT SHIFT, 7, movetoworkspace, 7 +bindu = ALT SHIFT, 8, movetoworkspace, 8 +bindu = ALT SHIFT, 9, movetoworkspace, 9 + +bindu = ALT CTRL, 1, movetoworkspacesilent, 1 +bindu = ALT CTRL, 2, movetoworkspacesilent, 2 +bindu = ALT CTRL, 3, movetoworkspacesilent, 3 +bindu = ALT CTRL, 4, movetoworkspacesilent, 4 +bindu = ALT CTRL, 5, movetoworkspacesilent, 5 +bindu = ALT CTRL, 6, movetoworkspacesilent, 6 +bindu = ALT CTRL, 7, movetoworkspacesilent, 7 +bindu = ALT CTRL, 8, movetoworkspacesilent, 8 +bindu = ALT CTRL, 9, movetoworkspacesilent, 9 + +workspace = w[tv1], gapsout:0, gapsin:0 +workspace = f[1], gapsout:0, gapsin:0 +windowrule = match:float 0, match:workspace w[tv1], border_size 0 +windowrule = match:float 0, match:workspace w[tv1], rounding 0 +windowrule = match:float 0, match:workspace f[1], border_size 0 +windowrule = match:float 0, match:workspace f[1], rounding 0 + +windowrule = match:class ^(xdg-desktop-portal-gtk)$, float on +windowrule = match:class ^(xdg-desktop-portal-gtk)$, size monitor_w * 0.5 monitor_h * 0.6 +windowrule = match:class ^(xdg-desktop-portal-kde)$, float on +windowrule = match:class ^(xdg-desktop-portal-kde)$, size monitor_w * 0.5 monitor_h * 0.6 +windowrule = match:class ^(xdg-desktop-portal-hyprland)$, float on +windowrule = match:class ^(xdg-desktop-portal-hyprland)$, size monitor_w * 0.5 monitor_h * 0.6 diff --git a/config/hypr/nvidia.conf b/config/hypr/nvidia.conf new file mode 100644 index 0000000..497fd6d --- /dev/null +++ b/config/hypr/nvidia.conf @@ -0,0 +1,11 @@ +env = LIBVA_DRIVER_NAME,nvidia +env = __GLX_VENDOR_LIBRARY_NAME,nvidia +env = NVD_BACKEND,direct +env = GBM_BACKEND,nvidia-drm +env = GSK_RENDERER,ngl +env = __NV_PRIME_RENDER_OFFLOAD,1 +env = __VK_LAYER_NV_optimus,NVIDIA_only + +cursor { + no_hardware_cursors = true +} diff --git a/config/nvim/lua/plugins/guard.lua b/config/nvim/lua/plugins/guard.lua index 0ca27a6..e9c9b8e 100644 --- a/config/nvim/lua/plugins/guard.lua +++ b/config/nvim/lua/plugins/guard.lua @@ -38,5 +38,9 @@ return { ft('make'):lint('checkmake') ft('cpp'):lint('cpplint') ft('markdown'):fmt('cbfmt'):append('prettierd') + ft('nix'):fmt({ + cmd = 'nixfmt', + stdin = true, + }) end, } diff --git a/home/modules/editor.nix b/home/modules/editor.nix index 558056a..af1b6e1 100644 --- a/home/modules/editor.nix +++ b/home/modules/editor.nix @@ -6,47 +6,49 @@ MANPAGER = "nvim +Man!"; }; + home.packages = with pkgs; [ + # lsp + bash-language-server + basedpyright + clang-tools + emmet-language-server + lua-language-server + ruff + tinymist + vscode-langservers-extracted + + # formatters + black + buf + cbfmt + cmake-format + isort + prettierd + shfmt + stylua + + # linters + checkmake + cpplint + eslint_d + hadolint + mypy + selene + + # runtime/tools + nodejs + websocat + luarocks + tree-sitter + nixfmt-tree + (texlive.combine { inherit (texlive) scheme-small latexindent; }) + ]; + programs.neovim = { enable = true; defaultEditor = true; viAlias = true; vimAlias = true; - extraPackages = with pkgs; [ - # lsp - bash-language-server - basedpyright - clang-tools - emmet-language-server - lua-language-server - ruff - tinymist - vscode-langservers-extracted - - # formatters - black - buf - cbfmt - cmake-format - isort - prettierd - shfmt - stylua - - # linters - checkmake - cpplint - eslint_d - hadolint - mypy - selene - - # runtime/tools - nodejs - websocat - luarocks - tree-sitter - (texlive.combine { inherit (texlive) scheme-small latexindent; }) - ]; }; xdg.configFile."nvim".source = diff --git a/home/modules/packages.nix b/home/modules/packages.nix index fac6901..bf2405d 100644 --- a/home/modules/packages.nix +++ b/home/modules/packages.nix @@ -112,7 +112,7 @@ in } // lib.optionalAttrs enableSioyek { "application/pdf" = "sioyek.desktop"; - "application/epub" = "sioyek.desktop"; + "application/epub+zip" = "sioyek.desktop"; } // lib.optionalAttrs enableVesktop { "x-scheme-handler/discord" = "vesktop.desktop"; diff --git a/home/modules/shell.nix b/home/modules/shell.nix index dcd6f86..5e74dda 100644 --- a/home/modules/shell.nix +++ b/home/modules/shell.nix @@ -309,7 +309,7 @@ in if [[ ! -d .venv ]]; then uv venv fi - source .venv/bin/activate + . .venv/bin/activate } ''; }; @@ -495,8 +495,8 @@ in commands = { open = '' $${{ - setsid -f xdg-open "$f" 2>/dev/null 2>&1 & - }}''; + setsid -f xdg-open "$f" 2>/dev/null 2>&1 & + }}''; sopen = '' $${{ for f in $fx; do diff --git a/home/modules/ui.nix b/home/modules/ui.nix index 94486f5..091a955 100644 --- a/home/modules/ui.nix +++ b/home/modules/ui.nix @@ -43,201 +43,40 @@ in (python3.withPackages (ps: [ ps.pillow ])) ]; + xdg.configFile."hypr/hyprland.conf".source = + config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.config/nix/config/hypr/hyprland.conf"; + + xdg.configFile."hypr/nvidia.conf".source = + config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.config/nix/config/hypr/nvidia.conf"; + + xdg.configFile."hypr/theme.conf".text = '' + general { + gaps_in = 0 + gaps_out = 0 + border_size = 5 + col.active_border = rgb(${builtins.substring 1 6 c.fg}) + col.inactive_border = rgb(${builtins.substring 1 6 c.bg}) + layout = master + resize_on_border = true + } + ''; + wayland.windowManager.hyprland = { enable = true; package = lib.mkIf (!isNixOS) null; portalPackage = lib.mkIf (!isNixOS) null; systemd.enable = isNixOS; - extraConfig = '' - exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=Hyprland THEME - exec-once = systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=Hyprland THEME - - monitor=,preferred,auto,1 - - env = XDG_CURRENT_DESKTOP,Hyprland - env = XDG_SESSION_TYPE,wayland - env = ELECTRON_OZONE_PLATFORM_HINT,wayland - env = GTK_USE_PORTAL,1 - env = OZONE_PLATFORM,wayland - env = QT_QPA_PLATFORM,wayland - env = GDK_BACKEND,wayland,x11 - env = SDL_VIDEODRIVER,wayland - '' - + lib.optionalString nvidia '' - env = LIBVA_DRIVER_NAME,nvidia - env = __GLX_VENDOR_LIBRARY_NAME,nvidia - env = NVD_BACKEND,direct - env = GBM_BACKEND,nvidia-drm - env = GSK_RENDERER,ngl - env = __NV_PRIME_RENDER_OFFLOAD,1 - env = __VK_LAYER_NV_optimus,NVIDIA_only - '' - + '' - - env = XCURSOR_SIZE,24 - env = HYPRCURSOR_SIZE,24 - '' - + lib.optionalString nvidia '' - cursor { - no_hardware_cursors = true - } - '' - + '' - - general { - gaps_in = 0 - gaps_out = 0 - border_size = 5 - col.active_border = rgb(${builtins.substring 1 6 c.fg}) - col.inactive_border = rgb(${builtins.substring 1 6 c.bg}) - layout = master - resize_on_border = true - } - - master { - new_status = slave - new_on_top = false - mfact = 0.50 - } - - decoration { - rounding = 0 - active_opacity = 1.0 - inactive_opacity = 1.0 - blur { - enabled = false - } - } - - animations { - enabled = false - } - - input { - kb_layout = us,us - kb_variant = ,colemak - follow_mouse = 1 - sensitivity = 0 - touchpad { - tap-to-click = false - } - repeat_delay = 300 - repeat_rate = 50 - } - - exec-once = dunst - exec-once = wl-paste --watch cliphist store - exec-once = hyprpaper - exec-once = hypridle - exec-once = hypr spawnfocus --ws 1 $TERMINAL -e mux - exec-once = hypr spawnfocus --ws 2 $BROWSER - - bindul = , XF86AudioRaiseVolume, exec, hypr volume up - bindul = , XF86AudioLowerVolume, exec, hypr volume down - bindul = , XF86AudioMute, exec, hypr volume toggle - - bindul = , XF86MonBrightnessUp, exec, hypr brightness up - bindul = , XF86MonBrightnessDown, exec, hypr brightness down - - bindu = ALT, SPACE, exec, rofi -show run - bindu = ALT, TAB, workspace, previous - bindu = ALT, A, cyclenext - bindu = ALT, B, exec, pkill -USR1 waybar || waybar - bindu = ALT, D, layoutmsg, swapprev - bindu = ALT, F, cyclenext, prev - bindu = ALT, H, resizeactive, -15 0 - bindu = ALT, J, resizeactive, 0 15 - bindu = ALT, K, resizeactive, 0 -15 - bindu = ALT, L, resizeactive, 15 0 - bindu = ALT, Q, killactive, - bindu = ALT, U, layoutmsg, swapnext - - bindu = ALT CTRL, B, exec, hypr pull bitwarden-desktop - bindu = ALT CTRL, C, exec, hypr pull $BROWSER - bindu = ALT CTRL, D, exec, hypr pull discord - bindu = ALT CTRL, S, exec, hypr pull signal-desktop - bindu = ALT CTRL, T, exec, hypr pull Telegram - bindu = ALT CTRL, V, exec, hypr pull vesktop - bindu = ALT CTRL, Y, exec, hypr pull sioyek - - bindu = ALT SHIFT, RETURN, exec, hypr spawnfocus --ws 1 $TERMINAL - bindu = ALT SHIFT, B, exec, hypr spawnfocus --ws 9 bitwarden-desktop - bindu = ALT SHIFT, C, exec, hypr spawnfocus --ws 2 $BROWSER --ozone-platform=wayland - bindu = ALT SHIFT, D, exec, hypr spawnfocus --ws 5 discord - bindu = ALT SHIFT, F, togglefloating - bindu = ALT SHIFT, G, exec, hypr pull $TERMINAL - bindu = ALT SHIFT, Q, exec, hypr exit - bindu = ALT SHIFT, R, exec, hyprctl reload && notify-send -u low 'hyprland reloaded' - bindu = ALT SHIFT, S, exec, hypr spawnfocus --ws 6 signal-desktop - bindu = ALT SHIFT, T, exec, hypr spawnfocus --ws 6 Telegram - bindu = ALT SHIFT, V, exec, hypr spawnfocus --ws 5 vesktop - bindu = ALT SHIFT, Y, exec, hypr spawnfocus --ws 3 sioyek - - bind = , XF86Tools, submap, scripts - submap = scripts - - bind = , A, exec, ctl audio out - bind = , C, exec, bash -lc 'cliphist list | rofi -dmenu -p "copy to clipboard" --lines 15 | cliphist decode | wl-copy' - bind = , F, exec, [float; fullscreen] ghostty -e lf - bind = , K, exec, ctl keyboard toggle - bind = , O, exec, ctl ocr - bind = , P, exec, hypr pull - bind = , S, exec, ctl screenshot - bind = , T, exec, theme - - bind = , catchall, submap, reset - submap = reset - - misc { - force_default_wallpaper = 0 - disable_hyprland_logo = true - } - - bindu = ALT, 1, workspace, 1 - bindu = ALT, 2, workspace, 2 - bindu = ALT, 3, workspace, 3 - bindu = ALT, 4, workspace, 4 - bindu = ALT, 5, workspace, 5 - bindu = ALT, 6, workspace, 6 - bindu = ALT, 7, workspace, 7 - bindu = ALT, 8, workspace, 8 - bindu = ALT, 9, workspace, 9 - - bindu = ALT SHIFT, 1, movetoworkspace, 1 - bindu = ALT SHIFT, 2, movetoworkspace, 2 - bindu = ALT SHIFT, 3, movetoworkspace, 3 - bindu = ALT SHIFT, 4, movetoworkspace, 4 - bindu = ALT SHIFT, 5, movetoworkspace, 5 - bindu = ALT SHIFT, 6, movetoworkspace, 6 - bindu = ALT SHIFT, 7, movetoworkspace, 7 - bindu = ALT SHIFT, 8, movetoworkspace, 8 - bindu = ALT SHIFT, 9, movetoworkspace, 9 - - bindu = ALT CTRL, 1, movetoworkspacesilent, 1 - bindu = ALT CTRL, 2, movetoworkspacesilent, 2 - bindu = ALT CTRL, 3, movetoworkspacesilent, 3 - bindu = ALT CTRL, 4, movetoworkspacesilent, 4 - bindu = ALT CTRL, 5, movetoworkspacesilent, 5 - bindu = ALT CTRL, 6, movetoworkspacesilent, 6 - bindu = ALT CTRL, 7, movetoworkspacesilent, 7 - bindu = ALT CTRL, 8, movetoworkspacesilent, 8 - bindu = ALT CTRL, 9, movetoworkspacesilent, 9 - - workspace = w[tv1], gapsout:0, gapsin:0 - workspace = f[1], gapsout:0, gapsin:0 - windowrule = match:float 0, match:workspace w[tv1], border_size 0 - windowrule = match:float 0, match:workspace w[tv1], rounding 0 - windowrule = match:float 0, match:workspace f[1], border_size 0 - windowrule = match:float 0, match:workspace f[1], rounding 0 - - windowrule = match:class ^(xdg-desktop-portal-gtk)$, float on - windowrule = match:class ^(xdg-desktop-portal-gtk)$, size monitor_w * 0.5 monitor_h * 0.6 - windowrule = match:class ^(xdg-desktop-portal-kde)$, float on - windowrule = match:class ^(xdg-desktop-portal-kde)$, size monitor_w * 0.5 monitor_h * 0.6 - windowrule = match:class ^(xdg-desktop-portal-hyprland)$, float on - windowrule = match:class ^(xdg-desktop-portal-hyprland)$, size monitor_w * 0.5 monitor_h * 0.6 - ''; + extraConfig = + '' + source = ~/.config/hypr/theme.conf + '' + + lib.optionalString nvidia '' + source = ~/.config/hypr/nvidia.conf + '' + + '' + source = ~/.config/hypr/hyprland.conf + ''; }; services.hypridle = {