NixOS/environments/hyprland.nix

271 lines
7.3 KiB
Nix

{
pkgs,
config,
...
}:
let
# misc
mod = "SUPER";
# waybar
inherit (config.lib.stylix) colors;
net-icons = [
"󰣾"
"󰣴"
"󰣶"
"󰣸"
"󰣺"
];
generic-percent-icons = [
""
""
""
""
""
""
""
""
];
temp-icons = [
""
""
""
""
];
in
{
programs.hyprland.enable = true;
services.greetd = {
enable = true;
settings.default_session = {
command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd Hyprland";
user = "greeter";
};
};
xdg.portal = {
enable = true;
extraPortals = [
pkgs.xdg-desktop-portal-hyprland
];
};
users.users.jawz.packages = builtins.attrValues {
inherit (pkgs)
# Wayland utilities
wl-clipboard-rs
wf-recorder
grimblast # screenshots
mako # notification daemon
libnotify # dependency of mako
swaylock-effects # screen locker
yazi # file manager
imv # images
;
};
home-manager.users.jawz = {
programs = {
wofi = {
enable = true;
settings = {
allow_images = true;
allow_markup = true;
insensitive = true;
width = "30%";
};
};
waybar = {
enable = true;
systemd.enable = true;
settings.main-bar = {
layer = "top";
tray.spacing = 5;
clock.format = "{:%H:%M %F}";
modules-left = [
"niri/workspaces"
"custom/sep"
"niri/window"
];
modules-center = [
"mpris"
];
modules-right = [
"cpu"
"temperature"
"memory"
"backlight"
"pulseaudio"
"battery"
"custom/recorder"
"clock"
"tray"
];
"hyprland/window".icon = true;
"niri/window".icon = true;
"niri/workspaces" = {
format = "{icon}";
format-icons = {
active = "";
default = "";
};
};
cava = {
format-icons = generic-percent-icons;
bars = 14;
method = "pulse";
framerate = 20;
bar_delimiter = 0;
stereo = false;
};
network = {
format = "{icon} {ipaddr}";
format-icons = net-icons;
};
# pulseaudio = {
# format = "{icon} {volume}%";
# format-muted = "vol: muted";
# format-icons.default = audio-icons;
# on-click = "pavucontrol";
# scroll-step = 1;
# };
cpu = {
interval = 1;
format = " {icon}";
format-icons = generic-percent-icons;
tooltip-format = "usage: {usage}%\nload: {load}";
};
memory = {
interval = 1;
format = " {icon}";
format-icons = generic-percent-icons;
tooltip-format = "{used} GiB / {total} GiB \n{percentage}%";
};
temperature = {
interval = 1;
critical-threshold = 80;
format = "{temperatureC}°C";
format-icons = temp-icons;
};
mpris = {
format = "{status_icon} {dynamic}";
dynamic-len = 60;
interval = 5;
status-icons = {
paused = "";
playing = "";
};
};
};
style = ''
* {
border: none;
font-family: "${config.stylix.fonts.monospace.name}";
font-size: ${toString config.stylix.fonts.sizes.desktop}pt;
color: #${colors.base04};
}
window#waybar {
background: #${colors.base00};
}
.module {
background: #${colors.base00};
margin: 0px 5px 0px 5px;
padding: 0px 0px 0px 5px;
}
#workspaces button {
padding: 0px;
border-bottom: 0px none transparent;
}
'';
};
};
wayland.windowManager.hyprland = {
enable = true;
settings = {
general = {
gaps_in = 5;
gaps_out = 10;
border_size = 3;
layout = "dwindle";
};
dwindle = {
pseudotile = true;
preserve_split = true;
force_split = 2;
};
bind = [
"${mod}, return, exec, ghostty"
"${mod}, Q, killactive,"
"${mod} SHIFT, F, togglefloating,"
"${mod}, F, fullscreen,"
"${mod}, T, pin,"
"${mod}, G, togglegroup,"
"${mod}, bracketleft, changegroupactive, b"
"${mod}, bracketright, changegroupactive, f"
"${mod}, S, exec, wofi --show drun icons"
"${mod}, P, pin, active"
"${mod}, left, movefocus, l"
"${mod}, right, movefocus, r"
"${mod}, up, movefocus, u"
"${mod}, down, movefocus, d"
"${mod}, h, movefocus, l"
"${mod}, l, movefocus, r"
"${mod}, k, movefocus, u"
"${mod}, j, movefocus, d"
"${mod} SHIFT, left, movewindow, l"
"${mod} SHIFT, right, movewindow, r"
"${mod} SHIFT, up, movewindow, u"
"${mod} SHIFT, down, movewindow, d"
"${mod} SHIFT, h, movewindow, l"
"${mod} SHIFT, l, movewindow, r"
"${mod} SHIFT, k, movewindow, u"
"${mod} SHIFT, j, movewindow, d"
"${mod}, 1, workspace, 1"
"${mod}, 2, workspace, 2"
"${mod}, 3, workspace, 3"
"${mod}, 4, workspace, 4"
"${mod}, 5, workspace, 5"
"${mod}, 6, workspace, 6"
"${mod}, 7, workspace, 7"
"${mod}, 8, workspace, 8"
"${mod}, 9, workspace, 9"
"${mod}, 0, workspace, 10"
"${mod} SHIFT, 1, movetoworkspace, 1"
"${mod} SHIFT, 2, movetoworkspace, 2"
"${mod} SHIFT, 3, movetoworkspace, 3"
"${mod} SHIFT, 4, movetoworkspace, 4"
"${mod} SHIFT, 5, movetoworkspace, 5"
"${mod} SHIFT, 6, movetoworkspace, 6"
"${mod} SHIFT, 7, movetoworkspace, 7"
"${mod} SHIFT, 8, movetoworkspace, 8"
"${mod} SHIFT, 9, movetoworkspace, 9"
"${mod} SHIFT, 0, movetoworkspace, 10"
"${mod}, F3, exec, grimblast save area ~/Pictures/screenshots/$(date +'%Y-%m-%d_%H-%M-%S').png"
"${mod} SHIFT, F3, exec, grimblast save screen ~/Pictures/screenshots/$(date +'%Y-%m-%d_%H-%M-%S').png"
];
binde = [
"${mod} SHIFT, h, moveactive, -20 0"
"${mod} SHIFT, l, moveactive, 20 0"
"${mod} SHIFT, k, moveactive, 0 -20"
"${mod} SHIFT, j, moveactive, 0 20"
"${mod} CTRL, l, resizeactive, 30 0"
"${mod} CTRL, h, resizeactive, -30 0"
"${mod} CTRL, k, resizeactive, 0 -10"
"${mod} CTRL, j, resizeactive, 0 10"
",XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.4 @DEFAULT_AUDIO_SINK@ 5%+"
",XF86AudioLowerVolume, exec, wpctl set-volume -l 1.4 @DEFAULT_AUDIO_SINK@ 5%-"
];
bindm = [
"${mod}, mouse:272, movewindow"
"${mod}, mouse:273, resizewindow"
];
};
};
};
}