nixos-config/home-manager/modules/hyprland/default.nix

163 lines
5.4 KiB
Nix

{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.eboskma.programs.hyprland;
terminal = "${pkgs.foot}/bin/footclient";
dmenu = "${pkgs.rofi}/bin/rofi -show drun -no-lazy-grab";
menu = "${pkgs.rofi}/bin/rofi -show run -no-lazy-grab";
rofiPower = pkgs.writeShellScriptBin "rofi-power" (builtins.readFile ../sway/powermenu.sh);
powerMenu = "${rofiPower}/bin/rofi-power";
wallpapers = {
hd = ../sway/wallpapers/river-1920.png;
qhd = ../sway/wallpapers/river-2560.png;
uhd = ../sway/wallpapers/river-3840.png;
};
swaylockcmd = "${pkgs.swaylock-effects}/bin/swaylock --ignore-empty-password --daemonize --show-failed-attempts --indicator-caps-lock --clock --image ${wallpapers.qhd} --fade-in 0.5 --scaling fill";
in
{
options.eboskma.programs.hyprland = { enable = mkEnableOption "Hyprland"; };
config = mkIf cfg.enable {
wayland.windowManager.hyprland = {
enable = true;
extraConfig = ''
monitor = DP-2,2560x1440@165,0x0,1
general {
gaps_out = 10
}
decoration {
rounding = 5
inactive_opacity = 0.9
dim_inactive = true
dim_strength = 0.5
}
animations {
animation = workspaces,1,3,default
animation = windows,1,3,default
animation = windowsOut,1,3,default
}
input {
kb_layout = us
kb_options = lv3:ralt_switch,eurosign:5
natural_scroll = true
}
misc {
no_vfr = false
focus_on_activate = false
}
binds {
workspace_back_and_forth = true
}
$mod = SUPER
bind = $mod,Return,exec,${terminal}
bind = $mod_SHIFT,Q,killactive
bind = $mod,S,exec,${dmenu}
bind = $mod_SHIFT,S,exec,${menu}
bind = $mod,N,movefocus,l
bind = $mod,E,movefocus,d
bind = $mod,I,movefocus,u
bind = $mod,O,movefocus,r
bind = $mod_SHIFT,N,movewindow,l
bind = $mod_SHIFT,E,movewindow,d
bind = $mod_SHIFT,O,movewindow,r
bind = $mod_SHIFT,I,movewindow,u
bind = $mod_SHIFT,Space,togglefloating,active
bind = $mod,T,fullscreen,0
bind = $mod_SHIFT,T,fullscreen,1
bind = $mod,1,workspace,1
bind = $mod,2,workspace,2
bind = $mod,3,workspace,3
bind = $mod,4,workspace,4
bind = $mod,5,workspace,5
bind = $mod,6,workspace,6
bind = $mod,7,workspace,7
bind = $mod,8,workspace,8
bind = $mod,9,workspace,9
bind = $mod,0,workspace,10
bind = $mod_SHIFT,1,movetoworkspacesilent,1
bind = $mod_SHIFT,2,movetoworkspacesilent,2
bind = $mod_SHIFT,3,movetoworkspacesilent,3
bind = $mod_SHIFT,4,movetoworkspacesilent,4
bind = $mod_SHIFT,5,movetoworkspacesilent,5
bind = $mod_SHIFT,6,movetoworkspacesilent,6
bind = $mod_SHIFT,7,movetoworkspacesilent,7
bind = $mod_SHIFT,8,movetoworkspacesilent,8
bind = $mod_SHIFT,9,movetoworkspacesilent,9
bind = $mod_SHIFT,0,movetoworkspacesilent,10
bind = $mod_SHIFT,Minus,movetoworkspacesilent,special
bind = $mod,Minus,togglespecialworkspace
bind = $mod_SHIFT,C,exec,${config.wayland.windowManager.hyprland.package}/bin/hyprctl reload
bind = $mod_SHIFT,F,exec,${powerMenu}
bind = $mod,L,exec,${swaylockcmd}
bind = $mod_SHIFT,K,pin
bind = $mod,Print,exec,${pkgs.grim}/bin/grim
bind = $mod_SHIFT,Print,exec,${pkgs.grim}/bin/grim | ${pkgs.wl-clipboard}/bin/wl-copy -t image/png -f
bind = ,XF86AudioRaiseVolume,exec,${pkgs.pamedia}/bin/pamedia up
bind = ,XF86AudioLowerVolume,exec,${pkgs.pamedia}/bin/pamedia down
bind = ,XF86AudioMute,exec,${pkgs.pamedia}/bin/pamedia mute
bind = ,XF86Calculator,exec,${pkgs.gnome.gnome-calculator}/bin/gnome-calculator
bind = $mod,D,exec,${pkgs.swaynotificationcenter}/bin/swaync-client -t -sw
bind = $mod,W,togglegroup
bind = $mod,N,changegroupactive,b
bind = $mod,O,changegroupactive,f
bindm = $mod,mouse:272,movewindow
bindm = $mod,mouse:273,resizewindow
windowrulev2 = workspace 1,class:^(firefox)$
windowrulev2 = workspace 2,class:^(foot)$
windowrulev2 = workspace 3,class:^(emacs)$
exec = ${pkgs.networkmanagerapplet}/bin/nm-applet --indicator
exec-once = ${pkgs.swaybg}/bin/swaybg -i ${wallpapers.qhd} -m fill
exec-once = ${config.wayland.windowManager.hyprland.package}/bin/hyprctl setcursor Nordzy-cursors 24
exec-once = ${pkgs.systemd}/bin/systemctl --user start swaync
exec-once = ${pkgs.systemd}/bin/systemctl --user start fcitx5-daemon
'' +
(lib.optionalString config.eboskma.programs.emacs.enable "bind = $mod,C,exec,${config.eboskma.programs.emacs.package}/bin/emacsclient -c");
};
systemd.user.services.hypridle = {
Unit = {
Description = "Idle manager for Wayland (Hyprland)";
Documentation = "man:swayidle(1)";
PartOf = "graphical-session.target";
};
Service = {
ExecStart = "${pkgs.swayidle}/bin/swayidle -w timeout 900 '${swaylockcmd}' timeout 1200 '${config.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms off' resume '${config.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms on'";
};
Install = {
WantedBy = [ "hyprland-session.target" ];
};
};
};
}