Files
nixos-config/modules/user/hyprland.nix
T

219 lines
6.4 KiB
Nix
Raw Normal View History

{ pkgs, lib, config, osConfig, inputs, username, ... }: let
optImport = path: lib.optional (builtins.pathExists path) path;
hostname = osConfig.networking.hostName;
in {
imports =
optImport ../../host/${hostname}/modules/hyprland.nix ++
optImport ../../user/${username}/modules/hyprland.nix;
2024-09-20 14:37:59 +03:00
home.packages = with pkgs; [
2025-03-27 12:53:41 +03:00
ghostty
2024-09-20 14:37:59 +03:00
pamixer
2024-09-20 14:38:07 +03:00
clipse
2025-08-21 15:43:57 +03:00
wl-clipboard
wl-clip-persist
xclip
2024-09-20 14:37:59 +03:00
];
wayland.windowManager.hyprland = let
2024-08-27 13:53:48 +03:00
colors = config.lib.stylix.colors;
2024-08-26 22:10:44 +03:00
in {
2024-04-17 05:52:14 +05:00
enable = true;
xwayland.enable = true;
2024-11-18 22:00:27 +03:00
package = inputs.hyprland.packages.${pkgs.system}.hyprland;
plugins = with inputs.hyprland-plugins.packages.${pkgs.system}; [
2025-02-08 18:38:55 +03:00
# hyprbars # Version mismatch
2024-09-23 22:02:31 +03:00
];
2024-04-17 05:52:14 +05:00
settings = {
"$mainMod" = "SUPER";
2025-03-30 22:22:46 +03:00
ecosystem = {
no_donation_nag = true;
no_update_news = true;
};
2025-02-08 18:38:55 +03:00
2024-04-17 05:52:14 +05:00
env = [
"XDG_SESSION_TYPE,wayland"
2025-02-02 14:57:36 +03:00
"QT_QPA_PLATFORM,wayland"
"XDG_CURRENT_DESKTOP,Hyprland"
2024-04-17 05:52:14 +05:00
"XDG_SESSION_DESKTOP,Hyprland"
2025-02-02 14:57:36 +03:00
2025-04-02 15:07:36 +03:00
"XCURSOR_SIZE, ${toString config.stylix.cursor.size}"
"XCURSOR_THEME, ${config.stylix.cursor.name}"
2025-02-02 14:57:36 +03:00
2024-04-17 05:52:14 +05:00
"XDG_SCREENSHOTS_DIR,~/screens"
];
2024-10-21 23:34:07 +03:00
cursor.no_hardware_cursors = true;
2024-04-17 05:52:14 +05:00
debug = {
disable_logs = false;
enable_stdout_logs = true;
};
2025-09-24 18:29:37 +03:00
misc = {
focus_on_activate = true;
};
2024-04-17 05:52:14 +05:00
input = {
kb_layout = "us,ru";
kb_options = "grp:caps_toggle";
2025-04-21 13:41:26 +03:00
numlock_by_default = true;
2024-04-17 05:52:14 +05:00
follow_mouse = 1;
touchpad = {
natural_scroll = false;
};
2025-02-08 18:38:55 +03:00
sensitivity = 0;
2024-04-17 05:52:14 +05:00
};
2025-08-24 20:02:25 +03:00
gestures = {
workspace_swipe_invert = true;
workspace_swipe_distance = 200;
workspace_swipe_forever = true;
};
gesture = [
"3, horizontal, workspace"
];
2024-04-17 05:52:14 +05:00
windowrule = [
2025-03-30 22:22:46 +03:00
"float, class:^(imv)$"
"float, class:^(feh)$"
"float, class:^(mpv)$"
2024-08-26 01:01:46 +03:00
"float, title:^(Список друзей)"
2025-12-14 18:28:47 +03:00
"move onscreen cursor -50% -50%, class:^(dragon-drop)$"
2025-03-27 12:53:41 +03:00
"float, title:(nmtui)"
2025-03-27 23:03:55 +03:00
"float, title:(pulsemixer)"
2025-03-27 12:53:41 +03:00
"float, title:(clipse)"
"size 622 652, title:(clipse)"
2024-09-20 14:38:07 +03:00
];
exec-once = lib.mkBefore [
2024-10-02 22:10:08 +03:00
"systemctl --user start plasma-polkit-agent"
2025-01-18 19:06:11 +03:00
"${lib.getExe' pkgs.swww "swww-daemon"}"
2025-08-21 15:43:57 +03:00
"wl-clip-persist --clipboard both"
2024-10-02 22:10:08 +03:00
"clipse -listen"
2025-01-21 20:52:55 +03:00
"${lib.getExe' pkgs.udiskie "udiskie"}"
2024-10-02 22:10:08 +03:00
];
2024-04-17 05:52:14 +05:00
bind = [
2025-03-27 12:53:41 +03:00
"$mainMod, V, exec, ghostty --title=clipse -e clipse"
2024-04-17 05:52:14 +05:00
2025-03-27 12:53:41 +03:00
"$mainMod, Return, exec, ghostty"
2024-04-17 05:52:14 +05:00
"$mainMod, Q, killactive,"
"$mainMod, M, exit,"
2025-03-27 12:53:41 +03:00
"$mainMod, E, exec, ghostty -e sh -c yazi"
2024-04-17 05:52:14 +05:00
"$mainMod, F, togglefloating,"
2025-12-12 19:17:43 +03:00
"$mainMod, D, exec, fuzzel"
2024-04-17 05:52:14 +05:00
"$mainMod, P, pseudo, # dwindle"
"$mainMod, J, togglesplit, # dwindle"
# Move focus with mainMod + arrow keys
"$mainMod, left, movefocus, l"
"$mainMod, right, movefocus, r"
"$mainMod, up, movefocus, u"
"$mainMod, down, movefocus, d"
# Moving windows
"$mainMod SHIFT, left, swapwindow, l"
"$mainMod SHIFT, right, swapwindow, r"
"$mainMod SHIFT, up, swapwindow, u"
"$mainMod SHIFT, down, swapwindow, d"
# Window resizing X Y
"$mainMod CTRL, left, resizeactive, -60 0"
"$mainMod CTRL, right, resizeactive, 60 0"
"$mainMod CTRL, up, resizeactive, 0 -60"
"$mainMod CTRL, down, resizeactive, 0 60"
# Switch workspaces with mainMod + [0-9]
"$mainMod, 1, workspace, 1"
"$mainMod, 2, workspace, 2"
"$mainMod, 3, workspace, 3"
"$mainMod, 4, workspace, 4"
"$mainMod, 5, workspace, 5"
"$mainMod, 6, workspace, 6"
"$mainMod, 7, workspace, 7"
"$mainMod, 8, workspace, 8"
"$mainMod, 9, workspace, 9"
"$mainMod, 0, workspace, 10"
# Move active window to a workspace with mainMod + SHIFT + [0-9]
"$mainMod SHIFT, 1, movetoworkspacesilent, 1"
"$mainMod SHIFT, 2, movetoworkspacesilent, 2"
"$mainMod SHIFT, 3, movetoworkspacesilent, 3"
"$mainMod SHIFT, 4, movetoworkspacesilent, 4"
"$mainMod SHIFT, 5, movetoworkspacesilent, 5"
"$mainMod SHIFT, 6, movetoworkspacesilent, 6"
"$mainMod SHIFT, 7, movetoworkspacesilent, 7"
"$mainMod SHIFT, 8, movetoworkspacesilent, 8"
"$mainMod SHIFT, 9, movetoworkspacesilent, 9"
"$mainMod SHIFT, 0, movetoworkspacesilent, 10"
"$mainMod SHIFT, F, fullscreen"
2024-04-17 05:52:14 +05:00
# Scroll through existing workspaces with mainMod + scroll
"$mainMod, mouse_down, workspace, e+1"
"$mainMod, mouse_up, workspace, e-1"
# Keyboard backlight
2025-03-27 17:31:56 +03:00
"$mainMod, F3, exec, ${lib.getExe pkgs.brightnessctl} -d *::kbd_backlight set +33%"
"$mainMod, F2, exec, ${lib.getExe pkgs.brightnessctl} -d *::kbd_backlight set 33%-"
2024-04-17 05:52:14 +05:00
# Volume and Media Control
", XF86AudioMute, exec, pamixer -t"
", XF86AudioMicMute, exec, pamixer --default-source -m"
2025-06-24 23:30:29 +03:00
", XF86AudioPlay, exec, ${lib.getExe pkgs.playerctl} play-pause"
2025-06-25 17:25:12 +03:00
", XF86Explorer, exec, ghostty -e sh -c yazi"
", XF86Mail, exec, thunderbird"
", XF86WWW, exec, google-chrome-stable" # TODO: Replace hard-code to some variable
2024-04-18 11:38:07 +05:00
# Brightness control
2025-03-27 17:31:56 +03:00
", XF86MonBrightnessDown, exec, ${lib.getExe pkgs.brightnessctl} set 5%- "
", XF86MonBrightnessUp, exec, ${lib.getExe pkgs.brightnessctl} set +5% "
2024-04-17 05:52:14 +05:00
];
2025-06-24 23:30:29 +03:00
binde = [
", XF86AudioRaiseVolume, exec, pamixer -i 5 "
", XF86AudioLowerVolume, exec, pamixer -d 5 "
];
bindc = [
", XF86AudioPrev, exec, ${lib.getExe pkgs.playerctl} position 5-"
", XF86AudioNext, exec, ${lib.getExe pkgs.playerctl} position 5+"
];
2025-06-24 23:30:29 +03:00
bindo = [
", XF86AudioPrev, exec, ${lib.getExe pkgs.playerctl} previous"
", XF86AudioNext, exec, ${lib.getExe pkgs.playerctl} next"
];
2024-04-17 05:52:14 +05:00
# Move/resize windows with mainMod + LMB/RMB and dragging
bindm = [
"$mainMod, mouse:272, movewindow"
"$mainMod, mouse:273, resizewindow"
];
};
};
2026-03-01 01:21:29 +03:00
xdg.portal = {
enable = true;
extraPortals = [
pkgs.xdg-desktop-portal-gtk
];
config.common = {
default = [ "hyprland" "gtk" ];
"org.freedesktop.impl.portal.FileChooser" = [ "gtk" ];
};
};
2024-04-17 05:52:14 +05:00
}