From 0004a1d71583156515d2d574c32301cb654c98c3 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Tue, 15 Jul 2025 15:32:04 -0600 Subject: [PATCH] [NixOS] Enable hyprland --- dotfiles/config/hypr/hyprland.conf | 299 +++++++++++++++++++++++++++++ nixos/desktop.nix | 3 + nixos/machines/adell.nix | 10 +- 3 files changed, 307 insertions(+), 5 deletions(-) create mode 100644 dotfiles/config/hypr/hyprland.conf diff --git a/dotfiles/config/hypr/hyprland.conf b/dotfiles/config/hypr/hyprland.conf new file mode 100644 index 00000000..2e7736cd --- /dev/null +++ b/dotfiles/config/hypr/hyprland.conf @@ -0,0 +1,299 @@ +# Hyprland Configuration +# Based on XMonad configuration from xmonad.hs + +# See https://wiki.hyprland.org/Configuring/Monitors/ +monitor=,preferred,auto,auto + +# Source a file (multi-file configs) +# source = ~/.config/hypr/myColors.conf + +# Set programs that you use +$terminal = alacritty +$fileManager = dolphin +$menu = wofi -show drun -show-icons +$runMenu = wofi -show run + +# Environment variables +env = XCURSOR_SIZE,24 +env = QT_QPA_PLATFORMTHEME,qt5ct + +# Input configuration +input { + kb_layout = us + kb_variant = + kb_model = + kb_options = + kb_rules = + + follow_mouse = 1 + + touchpad { + natural_scroll = no + } + + sensitivity = 0 # -1.0 - 1.0, 0 means no modification. +} + +# General settings +general { + gaps_in = 5 + gaps_out = 20 + border_size = 2 + col.active_border = rgba(edb443ee) rgba(33ccffee) 45deg + col.inactive_border = rgba(595959aa) + + layout = dwindle + + allow_tearing = false +} + +# Decoration +decoration { + rounding = 10 + + blur { + enabled = true + size = 3 + passes = 1 + } + + drop_shadow = yes + shadow_range = 4 + shadow_render_power = 3 + col.shadow = rgba(1a1a1aee) +} + +# Animations +animations { + enabled = yes + + bezier = myBezier, 0.05, 0.9, 0.1, 1.05 + + animation = windows, 1, 7, myBezier + animation = windowsOut, 1, 7, default, popin 80% + animation = border, 1, 10, default + animation = borderangle, 1, 8, default + animation = fade, 1, 7, default + animation = workspaces, 1, 6, default +} + +# Layout configuration +dwindle { + pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below + preserve_split = yes # you probably want this +} + +master { + new_is_master = true +} + +# Misc +misc { + force_default_wallpaper = 0 + disable_hyprland_logo = true +} + +# Window rules +# XMonad selector equivalents +windowrule = float, ^(pavucontrol)$ +windowrule = float, ^(element-desktop)$ +windowrule = float, ^(transmission-gtk)$ +windowrule = size 80% 80%, ^(element-desktop)$ +windowrule = size 80% 80%, ^(transmission-gtk)$ +windowrule = size 80% 80%, ^(pavucontrol)$ + +# Scratchpad-like windows +windowrule = float, title:^(htop)$ +windowrule = size 80% 80%, title:^(htop)$ + +# Chrome specific rules +windowrule = float, class:^(chrome)$,title:^(.*@gmail.com.*Gmail.*)$ +windowrule = float, class:^(chrome)$,title:^(Messages)$ +windowrule = size 90% 90%, class:^(chrome)$,title:^(.*@gmail.com.*Gmail.*)$ +windowrule = size 90% 90%, class:^(chrome)$,title:^(Messages)$ + +# ===== KEY BINDINGS ===== +# Based on XMonad configuration + +# Main modifier key (Super/Windows key equivalent to mod4Mask) +$mainMod = SUPER + +# Mod+Alt combination (equivalent to modalt in XMonad) +$modAlt = SUPER_ALT + +# Hyper key (equivalent to mod3Mask in XMonad) +$hyper = ALT + +# Program launching +bind = $mainMod, P, exec, $menu +bind = $mainMod SHIFT, P, exec, $runMenu +bind = $mainMod, Return, exec, $terminal +bind = $mainMod, Q, killactive, +bind = $mainMod SHIFT, Q, exit, +bind = $mainMod, E, exec, emacsclient -c +bind = $mainMod, V, exec, xclip -o | xdotool type --file - + +# Chrome/Browser launching (equivalent to bindBringAndRaise) +bind = $modAlt, C, exec, google-chrome-stable + +# Scratchpad equivalents (toggle special workspaces) +bind = $modAlt, E, togglespecialworkspace, element +bind = $modAlt, G, togglespecialworkspace, gmail +bind = $modAlt, H, togglespecialworkspace, htop +bind = $modAlt, M, togglespecialworkspace, messages +bind = $modAlt, K, togglespecialworkspace, slack +bind = $modAlt, S, togglespecialworkspace, spotify +bind = $modAlt, T, togglespecialworkspace, transmission +bind = $modAlt, V, togglespecialworkspace, volume + +# Move windows to special workspaces +bind = $modAlt SHIFT, E, movetoworkspace, special:element +bind = $modAlt SHIFT, G, movetoworkspace, special:gmail +bind = $modAlt SHIFT, H, movetoworkspace, special:htop +bind = $modAlt SHIFT, M, movetoworkspace, special:messages +bind = $modAlt SHIFT, K, movetoworkspace, special:slack +bind = $modAlt SHIFT, S, movetoworkspace, special:spotify +bind = $modAlt SHIFT, T, movetoworkspace, special:transmission +bind = $modAlt SHIFT, V, movetoworkspace, special:volume + +# Directional navigation (WASD keys as in XMonad) +bind = $mainMod, W, movefocus, u +bind = $mainMod, S, movefocus, d +bind = $mainMod, A, movefocus, l +bind = $mainMod, D, movefocus, r + +# Move windows directionally +bind = $mainMod SHIFT, W, movewindow, u +bind = $mainMod SHIFT, S, movewindow, d +bind = $mainMod SHIFT, A, movewindow, l +bind = $mainMod SHIFT, D, movewindow, r + +# Resize windows +bind = $mainMod CTRL, W, resizeactive, 0 -50 +bind = $mainMod CTRL, S, resizeactive, 0 50 +bind = $mainMod CTRL, A, resizeactive, -50 0 +bind = $mainMod CTRL, D, resizeactive, 50 0 + +# Layout control +bind = $mainMod, Space, exec, hyprctl dispatch layoutmsg cyclenext +bind = $mainMod CTRL, Space, fullscreen, 0 +bind = $mainMod, slash, exec, hyprctl dispatch layoutmsg orientationcycle left top +bind = $mainMod, F, fullscreen, 0 +bind = $mainMod SHIFT, F, fullscreen, 1 +bind = $mainMod, T, togglefloating, +bind = $mainMod, P, pseudo, # dwindle pseudotile +bind = $mainMod, J, togglesplit, # dwindle split direction + +# Focus manipulation +bind = $mainMod, Tab, exec, hyprctl dispatch focuswindow "class:$(hyprctl activewindow -j | jq -r '.class')" +bind = $mainMod, M, exec, hyprctl dispatch focuswindow "class:master" + +# Monitor/Screen control +bind = $mainMod, Z, focusmonitor, +1 +bind = $mainMod SHIFT, Z, movewindow, mon:+1 + +# Window management +bind = $mainMod, G, exec, hyprctl clients -j | jq -r '.[] | select(.workspace.id >= 0) | "\(.title) - \(.class)"' | rofi -dmenu -i -p "Go to window" | head -1 | xargs -I {} hyprctl dispatch focuswindow "title:{}" +bind = $mainMod, B, exec, hyprctl clients -j | jq -r '.[] | select(.workspace.id >= 0) | "\(.title) - \(.class)"' | rofi -dmenu -i -p "Bring window" | head -1 | xargs -I {} hyprctl dispatch movetoworkspacesilent "$(hyprctl activeworkspace -j | jq -r '.id')" && hyprctl dispatch focuswindow "title:{}" +bind = $mainMod SHIFT, B, exec, hyprctl clients -j | jq -r '.[] | select(.workspace.id >= 0) | "\(.title) - \(.class)"' | rofi -dmenu -i -p "Replace window" | head -1 | xargs -I {} hyprctl dispatch swapwindow "title:{}" +bind = $mainMod, M, exec, hyprctl dispatch togglespecialworkspace minimized +bind = $mainMod SHIFT, M, exec, hyprctl dispatch movetoworkspace special:minimized +bind = $mainMod SHIFT, H, exec, EMPTY_WS=$(hyprctl workspaces -j | jq -r 'map(select(.windows == 0)) | .[0].id // empty'); if [ -z "$EMPTY_WS" ]; then EMPTY_WS=$(hyprctl workspaces -j | jq -r 'max_by(.id).id + 1'); fi; hyprctl dispatch movetoworkspace $EMPTY_WS && hyprctl dispatch workspace $EMPTY_WS +bind = $mainMod, X, exec, hyprctl dispatch movetoworkspace special:NSP + +# Workspace switching +bind = $mainMod, 1, workspace, 1 +bind = $mainMod, 2, workspace, 2 +bind = $mainMod, 3, workspace, 3 +bind = $mainMod, 4, workspace, 4 +bind = $mainMod, 5, workspace, 5 +bind = $mainMod, 6, workspace, 6 +bind = $mainMod, 7, workspace, 7 +bind = $mainMod, 8, workspace, 8 +bind = $mainMod, 9, workspace, 9 +bind = $mainMod, 0, workspace, 10 + +# Move windows to workspaces +bind = $mainMod SHIFT, 1, movetoworkspace, 1 +bind = $mainMod SHIFT, 2, movetoworkspace, 2 +bind = $mainMod SHIFT, 3, movetoworkspace, 3 +bind = $mainMod SHIFT, 4, movetoworkspace, 4 +bind = $mainMod SHIFT, 5, movetoworkspace, 5 +bind = $mainMod SHIFT, 6, movetoworkspace, 6 +bind = $mainMod SHIFT, 7, movetoworkspace, 7 +bind = $mainMod SHIFT, 8, movetoworkspace, 8 +bind = $mainMod SHIFT, 9, movetoworkspace, 9 +bind = $mainMod SHIFT, 0, movetoworkspace, 10 + +# Move and follow to workspace +bind = $mainMod CTRL, 1, movetoworkspacesilent, 1 +bind = $mainMod CTRL, 2, movetoworkspacesilent, 2 +bind = $mainMod CTRL, 3, movetoworkspacesilent, 3 +bind = $mainMod CTRL, 4, movetoworkspacesilent, 4 +bind = $mainMod CTRL, 5, movetoworkspacesilent, 5 +bind = $mainMod CTRL, 6, movetoworkspacesilent, 6 +bind = $mainMod CTRL, 7, movetoworkspacesilent, 7 +bind = $mainMod CTRL, 8, movetoworkspacesilent, 8 +bind = $mainMod CTRL, 9, movetoworkspacesilent, 9 +bind = $mainMod CTRL, 0, movetoworkspacesilent, 10 + +# Media keys and volume control +bind = , XF86AudioRaiseVolume, exec, set_volume --unmute --change-volume +5 +bind = , XF86AudioLowerVolume, exec, set_volume --unmute --change-volume -5 +bind = , XF86AudioMute, exec, set_volume --toggle-mute +bind = $mainMod, I, exec, set_volume --unmute --change-volume +5 +bind = $mainMod, K, exec, set_volume --unmute --change-volume -5 +bind = $mainMod, U, exec, set_volume --toggle-mute + +# Media player controls +bind = $mainMod, semicolon, exec, playerctl play-pause +bind = , XF86AudioPlay, exec, playerctl play-pause +bind = , XF86AudioPause, exec, playerctl play-pause +bind = $mainMod, L, exec, playerctl next +bind = , XF86AudioNext, exec, playerctl next +bind = $mainMod, J, exec, playerctl previous +bind = , XF86AudioPrev, exec, playerctl previous + +# Brightness control +bind = , XF86MonBrightnessUp, exec, brightness.sh 5 +bind = , XF86MonBrightnessDown, exec, brightness.sh -5 + +# Utility bindings +bind = $hyper, V, exec, rofi_clipit.sh +bind = $hyper, P, exec, rofi-pass +bind = $hyper, H, exec, rofi_shutter +bind = $hyper, C, exec, shell_command.sh +bind = $hyper, X, exec, rofi_command.sh +bind = $hyper SHIFT, L, exec, dm-tool lock +bind = $hyper, K, exec, rofi_kill_process.sh +bind = $hyper SHIFT, K, exec, rofi_kill_all.sh +bind = $hyper, R, exec, rofi-systemd +bind = $hyper, 9, exec, start_synergy.sh +bind = $hyper, slash, exec, toggle_taffybar +bind = $hyper, Space, exec, skippy-xd +bind = $hyper, I, exec, rofi_select_input.hs +bind = $hyper, O, exec, rofi_paswitch +bind = $mainMod, apostrophe, exec, load_default_map +bind = $modAlt, apostrophe, exec, load_xkb_map +bind = $mainMod, E, exec, emacsclient --eval '(emacs-everywhere)' + +# Workspace cycling +bind = $mainMod, backslash, workspace, previous + +# Mouse bindings +bindm = $mainMod, mouse:272, movewindow +bindm = $mainMod, mouse:273, resizewindow + +# Scroll through existing workspaces with mainMod + scroll +bind = $mainMod, mouse_down, workspace, e+1 +bind = $mainMod, mouse_up, workspace, e-1 + +# Special workspaces for "scratchpad" applications +exec-once = [workspace special:element silent] element-desktop +exec-once = [workspace special:gmail silent] google-chrome-stable --new-window https://mail.google.com/mail/u/0/#inbox +exec-once = [workspace special:htop silent] alacritty --title htop -e htop +exec-once = [workspace special:messages silent] google-chrome-stable --new-window https://messages.google.com/web/conversations +exec-once = [workspace special:slack silent] slack +exec-once = [workspace special:spotify silent] spotify +exec-once = [workspace special:transmission silent] transmission-gtk +exec-once = [workspace special:volume silent] pavucontrol diff --git a/nixos/desktop.nix b/nixos/desktop.nix index 3ae982e9..4cd2f5dd 100644 --- a/nixos/desktop.nix +++ b/nixos/desktop.nix @@ -21,6 +21,8 @@ makeEnable config "myModules.desktop" true { }; }; + programs.hyprland.enable = true; + services.autorandr = { enable = true; }; @@ -75,6 +77,7 @@ makeEnable config "myModules.desktop" true { quassel remmina rofi + wofi rofi-pass rofi-systemd simplescreenrecorder diff --git a/nixos/machines/adell.nix b/nixos/machines/adell.nix index 4a65b65f..f474a303 100644 --- a/nixos/machines/adell.nix +++ b/nixos/machines/adell.nix @@ -6,11 +6,11 @@ inputs.nixos-hardware.nixosModules.dell-xps-17-9700-nvidia ]; - services.tts.servers.coqui = { - enable = true; - useCuda = false; - port = 11400; - }; + # services.tts.servers.coqui = { + # enable = false; + # useCuda = false; + # port = 11400; + # }; myModules.wyoming.enable = false; myModules.base.enable = true;