system/pkgs/wm/hyprland/hyprland.nix
2025-04-09 17:56:29 -07:00

360 lines
13 KiB
Nix

{ pkgs, config, ... }:
{
wayland.windowManager.hyprland = {
# enable = true;
# package = pkgs.hyprland;
# package = hyprland.packages.stdenv.hostPlatform.system}.hyprland;
# xwayland.enable = true;
systemd.enable = true;
systemd.variables = ["--all"];
# device {
# name = "hanvon-ugee-shortcut-remote key bindings"
# };
settings = {
"$mod" = "SUPER";
env = [
"XDG_SESSION_TYPE,wayland"
"XDG_SESSION_DESKTOP,Hyprland"
"XDG_CURRENT_DESKTOP,Hyprland"
"MOZ_ENABLE_WAYLAND,1"
# "ANKI_WAYLAND,1"
# "QT_AUTO_SCREEN_SCALE_FACTOR,1"
# "QT_WAYLAND_DISABLE_WINDOWDECORATION,1"
# "QT_QPA_PLATFORM=wayland,xcb" # removed ,xcb CGPT
# "QT_QPA_PLATFORMTHEME,qt6ct"
# "GDK_SCALE,1"
"GDK_BACKEND,wayland,x11,*"
# "GTK_THEME,FlatColor:dark"
# "GTK2_RC_FILES,/home/hadi/.local/share/themes/FlatColor/gtk-2.0/gtkrc"
# "DISABLE_QT5_COMPAT,0"
# "NIXOS_OZONE_WL,1"
# "ELECTRON_OZONE_PLATFORM_HINT,auto"
# "__GL_GSYNC_ALLOWED,0"
# "__GL_VRR_ALLOWED,0"
"__GLX_VENDOR_LIBRARY_NAME,nvidia"
# "DIRENV_LOG_FORMAT,"
# "WLR_DRM_NO_ATOMIC,1"
# "WLR_BACKEND,vulkan"
# "WLR_RENDERER,vulkan"
# "WLR_NO_HARDWARE_CURSORS,1"
# "APPIMAGELAUNCHER_DISABLE,1"
# "OZONE_PLATFORM,wayland"
# "SDL_VIDEODRIVER,wayland"
# "CLUTTER_BACKEND,wayland"
"GBM_BACKEND,nvidia-drm"
"LIBVA_DRIVER_NAME,nvidia"
# "AQ_DRM_DEVICES,/dev/dri/card2/" # CHANGEME: Related to the GPU
# THEMING
# "HYPRCURSOR_THEME,~/.icons/Nordic-cursors"
# "HYPRCURSOR_SIZE,24x"
"HYPRCURSOR_THEME,Nordzy-cursors"
"HYPRCURSOR_SIZE,24"
"XCURSOR_THEME,Nordzy-cursors"
"XCURSOR_SIZE,24"
"HYPRLAND_TRACE=1"
# "QT_STYLE_OVERRIDE=kvantum"
# "QT_QPA_PLATFORMTHEME = qt6ct" # qt5ct no display
];
input = {
kb_layout = "us";
# kb_variant =;
# kb_model =;
# kb_options = grp:alt_shift_toggle,caps:backspace;
# kb_rules =;
follow_mouse = 1;
mouse_refocus = false;
touchpad = {
natural_scroll = "no";
tap_button_map = "lmr";
};
sensitivity = 0;
};
debug = { disable_logs = false; };
xwayland = { force_zero_scaling = true; };
bindm = [
"$mod, mouse:272, movewindow"
"$mod, Control_L, movewindow"
"$mod, mouse:273, resizewindow"
"$mod, ALT_L, resizewindow"
"$mod, mouse_down, workspace, e+1" # Scroll workspaces
"$mod, mouse_up, workspace, e-1" # Scroll workspaces
",mouse:275,exec,wl-copy $(wl-paste -p)" # copy selected text
",mouse:276,exec,wtype -M ctrl -M shift v -m ctrl -m shift" # paste by Ctrl+Shift+
];
bind = [
"ALTSHIFT, H, movewindow, l"
"ALTSHIFT, L, movewindow, r"
"ALTSHIFT, K, movewindow, u"
"ALTSHIFT, J, movewindow, d"
"ALT,H,movefocus,l"
"ALT,L,movefocus,r"
"ALT,K,movefocus,u"
"ALT,J,movefocus,d"
"$mod, Q, killactive"
"ALT, T, togglefloating"
"ALT, F, fullscreen"
# Minimize window
"ALT, M, movetoworkspace, special:magic"
"ALT, M, togglespecialworkspace, magic"
"Control_R+Shift_R, B, exec, ~/bin/restore_minimized.sh Keybase"
"Control_R+Shift_R, X, exec, ~/bin/restore_minimized.sh org.kde.kwalletmanager5"
"Control_R+Shift_R, N, exec, ~/bin/restore_minimized.sh com.nextcloud.desktopclient.nextcloud"
"Control_R+Shift_R, Z, exec, ~/bin/restore_minimized.sh zen-alpha"
"Control_R+Shift_R, S, exec, ~/bin/restore_minimized.sh sublime_text"
# "$mod, R, exec, ~/bin/restore_minimized.sh org.kde.dolphin"
"$mod, F, exec, firefox"
"$mod, Z, exec, zen"
"$mod, k, exec, kitty"
"$mod, G, exec, ghostty"
# "$mod+SHIFT_R, k, exec, pypr toggle term"
"$mod+Shift_R, K, exec, konsole"
"$mod, S, exec, subl"
# "CTRLSHIFT, K&B, exec, hyprctl dispatch exec keybase-gui %u"
# ",XF86Search, exec, wofi --show drun"
",XF86Explorer, exec, doublecmd"
",XF86Search, exec, pkill rofi || rofi -show drun -modi drun,filebrowser,run,window,ssh"
",XF86Calculator, exec, qalculate-qt"
"$mod, V, exec, cliphist list | rofi --dmenu | cliphist decode | wl-copy"
"ALT, Tab, exec, hyprctl dispatch cyclenext"
"ALTSHIFT, Tab, exec, hyprctl dispatch cyclenext prev"
# "ALT, Tab, bringactivetotop"
# "CONTROL_ALT, L, exec, swaylock" # Need to config locker
", XF86AudioMute, exec, swayosd-client --output-volume mute-toggle"
", XF86AudioMicMute, exec ,swayosd-client --input-volume mute-toggle"
", XF86AudioRaiseVolume, exec, swayosd-client --output-volume 15"
", XF86AudioLowerVolume, exec, swayosd-client --output-volume -15"
"$mod, XF86AudioRaiseVolume, exec, swayosd-client --output-volume raise --max-volume 120"
"$mod, XF86AudioLowerVolume, exec, swayosd-client --output-volume lower --max-volume 120"
"$mod, --release Caps_Lock ,exec, swayosd-client --caps-lock"
"$mod, --release Caps_Lock, exec, swayosd-client --caps-lock-led input19::capslock"
"$mod, XF86MonBrightnessUp, exec, swayosd-client --brightness raise"
"$mod, XF86MonBrightnessDown, exec, swayosd-client --brightness lower"
# "$mod, XF86MonBrightnessUp exec swayosd-client --brightness +10"
# "$mod, XF86MonBrightnessDown exec swayosd-client --brightness -10"
"$mod+SHIFT, S, exec, hyprshot -m region"
"$mod, code:10, workspace, 1"
"$mod, code:11, workspace, 2"
"$mod, code:12, workspace, 3"
"$mod, code:13, workspace, 4"
"$mod, code:14, workspace, 5"
"$mod, code:15, workspace, 6"
"$mod, code:16, workspace, 7"
"$mod, code:17, workspace, 8"
"$mod, code:18, workspace, 9"
"$mod, code:19, workspace, 10"
"ALTSHIFT, code:10, movetoworkspace, 1"
"ALTSHIFT, code:11, movetoworkspace, 2"
"ALTSHIFT, code:12, movetoworkspace, 3"
"ALTSHIFT, code:13, movetoworkspace, 4"
"ALTSHIFT, code:14, movetoworkspace, 5"
"ALTSHIFT, code:15, movetoworkspace, 6"
"ALTSHIFT, code:16, movetoworkspace, 7"
"ALTSHIFT, code:17, movetoworkspace, 8"
"ALTSHIFT, code:18, movetoworkspace, 9"
"ALTSHIFT, code:19, movetoworkspace, 10"
];
# ++ (
# builtins.concatLists (builtins.genList (i:
# let ws =i +1;
# in [
# "ALT code:1${toString i}, workspace, ${toString ws}"
# "ALTSHIFT, code:1$i{toString i}, movetoworkspace, ${toString ws}"
# ]
# )
# 9)
# );
cursor = {
# no_hardware_cursors = true;
default_monitor = "DP-5";
};
dwindle = {
# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more
pseudotile = true; # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below
preserve_split = true; # you probably want this
special_scale_factor = 0.60; # Fix for floaters
};
monitor = [
"DP-3, 1920x1080, 0x616, 1"
"DP-5, 3840x2160, 1920x0, 1"
"DP-6, 1920x1080, 5760x266, 1, transform, 3" # or 3
];
workspace = [
"4,monitor:DP-3,default:true"
"5,monitor:DP-3,persistent:true"
"6,monitor:DP-3,persistent:true"
"1,monitor:DP-5,default:true,decorate:true"
"2,monitor:DP-5,persistent:true"
"3,monitor:DP-5,persistent:true"
"10,monitor:DP-5,persistent:true"
"7,monitor:DP-6,default:true,gapsin:2"
"8,monitor:DP-6,persistent:true"
"9,monitor:DP-6,persistent:true"
];
exec-once = [
"systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP"
"dbus-daemon --session --address=unix:path=$XDG_RUNTIME_DIR/bus"
"dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP"
"systemctl --user start plasma-polkit-agent"
"/nix/store/vgj704dz4i60cj70cvq988g1c6yg33l9-kwallet-pam-6.2.5/libexec/pam_kwallet_init --no-startup-id" # Find a better path, changes on garbage collection
"waybar &"
# "hyprpaper &"
"hypridle &"
"swayosd &"
"udiskie &"
"wl-paste --type text --watch cliphist store"
"wl-paste --type image --watch cliphist store"
"${config.home.homeDirectory}/.config/hypr/scripts/start-in-tray.sh &"
"${config.home.homeDirectory}/.config/hypr/scripts/start-keybase-gui.sh &"
"input-remapper-control --command autoload &"
"[workspace 4 silent] remmina -c rdp://wayne@xeon.local"
"[workspace 7 silent] sublime3"
"[workspace 9 silent] keepassxc"
"[workspace 9 silent] /home/wayne/.nix-profile/bin/nextcloud --background"
"[workspace 9 silent] /home/wayne/.nix-profile/bin/keybase-gui %u"
# "/nix/store/r3fdp5rlxcihmqhpcgy91sj918wnrmrc-pyprland-2.3.4/bin/pypr --debug ~/tmp/pypr.log"
];
general = {
border_part_of_window = true;
layout = "dwindle";
gaps_in = 5;
gaps_out = 10;
border_size = 2;
resize_on_border = true;
};
animations = {
enabled=1;
animation = [
"windows,1,4,default,slide"
"border,1,5,default"
"fadein,1,5,default"
"workspaces,1,3,default,vertslide"
];
};
decoration = {
rounding = 8;
drop_shadow = true;
shadow_range = 60;
col.shadow = "0x66000000";
blur = {
enabled = true;
size = 5;
passes = 1;
};
};
layerrule = [
"dimaround,rofi"
# "unset, rofi"
# "ignorezero, rofi"
"blurpopups, notifications"
"blur, waybar"
];
windowrule = [
# "opacity 0.9 override 0.5 override 0.8 override, ^(.*)$" # set opacity to 1.0 active, 0.5 inactive and 0.8 fullscreen for kitty
# "opacity 1 override 0.9 override 0.9 override, ^(zen-alpha)$" # set opacity to 1.0 active, 0.5 inactive and 0.8 fullscreen for kitty
# "opacity 1.0 override 0.5 override 0.8 override, ^(kitty)$" # set opacity to 1.0 active, 0.5 inactive and 0.8 fullscreen for kitty
"move -50% -50%, float, ^(org.keepassxc.KeePassXC)$"
"float, ^(Nextcloud)$"
# common modals
## "center,title:^(Open).*$"
# "center,title:^(Choose Files)$"
## "center,title:^(Save).*$"
# "center,title:^(Confirm to replace files)$"
# "center,title:^(File Operation Progress)$"
# "opacity 1.0 override 1 override 1 override, ^(REAPER)$"
];
windowrulev2 = [
"minsize 1 1, class:^(sublime_text)$"
# REAPER Rules
# Drop down menus are very wonly and require special attention
# They only work in fullscreen but if we initially set fullscreen
# Reaper floats when we select from the toolbar?!!!
# We initially tile the window then fullscreen it to make toolbar menus work
"tile, class:^(REAPER)$"
"monitor DP-5, class:^(REAPER)$"
"workspace 3, class:^(REAPER)$"
# The following 3 lines make Dropdowns work
"float, title:^(menu)$, class:^(REAPER)$" # Important
"minsize 1 1, title:^(menu)$, class:^(REAPER)$" # Important
"move onscreen cursor, title:^(menu)$, class:^(REAPER)$" # Important
# "focusonactivate, class:(REAPER)"
# "allowsinput, class:(REAPER)"
# "focusonactivate, class:(REAPER), title(menu)"
# "stayfocused, title:^(menu)$, class:^(REAPER)$" # Order is important
# "float, class:REAPER"
# "move cursor 5px 15px, class:REAPER"
# Apply stayfocused only to transient (temporary) windows in Reaper
# "stayfocused, title:^(.*)$, class:REAPER"
# "stayfocused, parent:REAPER"
# "noswallow, class:REAPER"
# "stayfocused, title:^(.*)$, class:REAPER"
# "float, title:^(Open|Choose Files|Save As|Confirm to replace files|File Operation Progress)$, class:REAPER"
# "stayfocused, title:^(Open|Choose Files|Save As|Confirm to replace files|File Operation Progress)$, class:REAPER"
# "nofocus, class:REAPER"
# "fullscreen, title:^(File|Edit|View|Options|Help)$, class:REAPER"
# "float,class:^(google-chrome)$,title:^(Open Files)$"
# "float,class:^(google-chrome)$,title:^(Open File)$"
"float,class:^(Typora)$,title:^(Open File)$"
"float,class:^(com.nextcloud.desktopclient.nextcloud)$"
"float,class:^(Keybase)$"
"float,class:^(org.kde.kwalletmanager5)$"
"float,class:^(org.keepassxc.KeePassXC)$"
"float,class:^(Typora)$"
"workspace special:magic, class:^(my-app-class)$"
];
input.numlock_by_default = true;
debug.suppress_errors = true;
};
# extraConfig = {};
# plugins = [];
};
}