237 lines
6.3 KiB
Nix

{
pkgs,
lib,
config,
...
}: let
inherit (lib) mkEnableOption mkIf;
cfg = config.my.hyprland;
in {
options.my.hyprland = {
enable = mkEnableOption "hyprland";
};
config = mkIf cfg.enable {
my.ags.enable = true;
programs.fuzzel.enable = true;
home.packages = with pkgs; [
pavucontrol
swaybg
];
wayland.windowManager.hyprland = {
enable = true;
settings = let
# No gaps or border when only one window
no_gaps_when_only = 1;
in {
"$mod" = "SUPER";
general = {
gaps_in = 5;
gaps_out = 10;
};
input = {
follow_mouse = 2;
sensitivity = -0.2;
};
dwindle = {
inherit no_gaps_when_only;
};
master = {
inherit no_gaps_when_only;
};
exec-once = [
"hyprctl setcursor Adwaita 24"
"ags"
"swaybg -i /home/michael/Photos/wallpaper.jpg"
"hypridle"
];
bind =
[
# Program launcher
"$mod, SPACE, exec, fuzzel"
# Program shortcuts
"$mod, F, exec, firefox"
"$mod, Q, killactive"
"$mod, T, exec, foot"
", Print, exec, grimblast copy area"
# Windows
"$mod, H, movefocus, l"
"$mod, J, movefocus, d"
"$mod, K, movefocus, u"
"$mod, L, movefocus, r"
# Moving windows
"$mod SHIFT, H, movewindow, l"
"$mod SHIFT, J, movewindow, d"
"$mod SHIFT, K, movewindow, u"
"$mod SHIFT, L, movewindow, r"
]
++ (
# workspaces
# binds $mod + [shift +] {1..10} to [move to] workspace {1..10}
builtins.concatLists (builtins.genList (
x: let
ws = let
c = (x + 1) / 10;
in
builtins.toString (x + 1 - (c * 10));
in [
"$mod, ${ws}, workspace, ${toString (x + 1)}"
"$mod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}"
]
)
10)
);
};
extraConfig = ''
# will switch to a submap called resize
bind=$mod,R,submap,resize
# media controls
bindel=, XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+
bindel=, XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
bindl=, XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
# will start a submap called "resize"
submap=resize
# sets repeatable binds for resizing the active window
binde=,h,resizeactive,-10 0
binde=,j,resizeactive,0 10
binde=,k,resizeactive,0 -10
binde=,l,resizeactive,10 0
# use reset to go back to the global submap
bind=,escape,submap,reset
# will reset the submap, meaning end the current one and return to the global one
submap=reset
# mouse bindings
bindm=ALT,mouse:272,movewindow
bindm=ALT,mouse:273,resizewindow
'';
};
gtk = {
enable = true;
font.name = "Inter 11";
theme = {
name = "adw-gtk3-dark";
package = pkgs.adw-gtk3;
};
iconTheme = {
name = "Papirus";
package = pkgs.papirus-icon-theme;
};
};
home.pointerCursor = {
gtk.enable = true;
name = "Adwaita";
package = pkgs.gnome.adwaita-icon-theme;
size = 24;
};
programs.hyprlock = {
enable = true;
settings = {
general = {
no_fade_in = false;
grace = 0;
disable_loading_bar = true;
};
background = {
monitor = "";
path = "~/Photos/wallpaper.jpg";
blur_passes = 3;
contrast = 0.8916;
brightness = 0.8172;
vibrancy = 0.1696;
vibrancy_darkness = 0.0;
};
input-field = {
monitor = "";
size = "250, 60";
outline_thickness = 2;
dots_size = 0.2; # Scale of input-field height, 0.2 - 0.8
dots_spacing = 0.2; # Scale of dots' absolute size, 0.0 - 1.0
dots_center = true;
outer_color = "rgba(0, 0, 0, 0)";
inner_color = "rgba(0, 0, 0, 0.5)";
font_color = "rgb(200, 200, 200)";
fade_on_empty = false;
font_family = "Inter";
placeholder_text = "Enter Password";
hide_input = false;
position = "0, 375";
halign = "center";
valign = "bottom";
};
label = [
# Time
{
monitor = "";
text = "cmd[update:1000] echo \"$(date +\"%-I:%M %P\")\"";
color = "rgba(255, 255, 255, 0.6)";
font_size = 120;
font_family = "Inter ExtraBold";
position = "0, -300";
halign = "center";
valign = "top";
}
# User
{
monitor = "";
text = config.my.name;
color = "rgba(255, 255, 255, 0.6)";
font_size = 24;
font_family = "Inter Semibold";
position = "0, 450";
halign = "center";
valign = "bottom";
}
];
};
};
services.hypridle = {
enable = true;
settings = {
general = {
lock_cmd = "pidof hyprlock || hyprlock";
before_sleep_cmd = "loginctl lock-session";
after_sleep_cmd = "hyprctl dispatch dpms on";
};
listener = [
# Dim screen
{
timeout = 150; # 2.5 min
on-timeout = "brightnessctl -s set 10"; # set monitor backlight to minimum, avoid 0 on OLED monitor.
on-resume = "brightnessctl -r"; # monitor backlight restore.
}
# Lock
{
timeout = 300; # 5 min
on-timeout = "loginctl lock-session";
}
# Turn off screen
{
timeout = 330; # 5.5 min
on-timeout = "hyprctl dispatch dpms off";
on-resume = "hyprctl dispatch dpms on";
}
# Suspend
{
timeout = 1800; # 30 min
on-timeout = "systemctl suspend";
}
];
};
};
};
}