nixfiles/home-manager/modules/ezpcusr.nix
2025-10-20 16:11:30 -07:00

380 lines
12 KiB
Nix

inputs: {
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.ezpcusr;
in {
options.ezpcusr = {
enable = mkEnableOption "Enable simple PC user config";
screenshotsPath = mkOption {
description = "Path to save screenshots in";
default = "$HOME/Media/Screenshots";
type = types.str;
};
screensaver = mkOption {
description = "ezpcusr screensaver";
default = {};
type = types.submodule {
options = {
lockTime = mkOption {
type = types.int;
default = 600;
description = "Time until your screen locks";
};
offTime = mkOption {
type = types.int;
default = 900;
description = "Time until your screen turns off";
};
};
};
};
bluetooth = mkOption {
type = types.bool;
default = false;
description = "If this PC has bluetooth support";
};
};
config = lib.mkIf cfg.enable {
services.hypridle = {
enable = lib.mkDefault true;
settings = {
general = {
lock_cmd = "pidof hyprlock || hyprlock";
before_sleep_cmd = "loginctl lock-session";
after_sleep_cmd = "hyperctl dispatch dpms on";
};
listener = [
{
timeout = cfg.screensaver.lockTime;
on-timeout = "loginctl lock-session";
}
{
timeout = cfg.screensaver.offTime;
on-timeout = "hyperctl dispatch dpms off";
}
];
};
};
programs.hyprlock = {
enable = true;
settings = {
general = {
hide_cursor = true;
};
animations = {
enabled = true;
fade_in = {
duration = 300;
bezier = "easeOutQuint";
};
fade_out = {
duration = 300;
bezier = "easeOutQuint";
};
};
background = lib.mkForce [
{
path = "screenshot";
blur_passes = 3;
blur_size = 8;
}
];
};
};
wayland.windowManager.hyprland = {
enable = true;
# package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland;
# portalPackage = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland;
package = pkgs.hyprland;
portalPackage = pkgs.xdg-desktop-portal-hyprland;
plugins = with pkgs.hyprlandPlugins; [
hy3
hypr-dynamic-cursors
];
settings = {
"plugin:dynamic-cursors" = {
shake.enabled = false;
};
"plugin:hy3" = {
no_gaps_when_only = 1;
};
layerrule = [
"blur, bar-.*"
"ignorezero, bar-.*"
# "blur, notifications-window"
# "blur, indicator"
# "ignorezero, indicator"
];
ecosystem = {
no_update_news = true;
no_donation_nag = true;
};
misc = {
disable_hyprland_logo = true;
animate_manual_resizes = true;
animate_mouse_windowdragging = true;
new_window_takes_over_fullscreen = 2;
middle_click_paste = false;
};
general = {
"$mod" = "SUPER";
layout = "hy3";
gaps_in = 6;
gaps_out = 6;
resize_on_border = true;
};
gestures = {
};
bindm = [
"$mod, mouse:272, movewindow"
"$mod, mouse:273, resizewindow"
];
windowrulev2 = [
"move 0 0,class:(flameshot),title:(flameshot)"
"pin,class:(flameshot),title:(flameshot)"
"fullscreenstate,class:(flameshot),title:(flameshot)"
"float,class:(flameshot),title:(flameshot)"
];
bind =
[
"$mod, Return, exec, ${config.programs.foot.package}/bin/foot"
"$mod, Q, killactive,"
"$mod, F, fullscreen, 0"
"$mod SHIFT, F, fullscreen, 1"
"$mod, Space, togglefloating"
"$mod SHIFT, SPACE, exec, hyprctl switchxkblayout all next"
"$mod, D, exec, ${config.programs.rofi.package}/bin/rofi -show drun -show-icons"
", Print, exec, ${config.services.flameshot.package}/bin/flameshot gui -p=\"${config.services.flameshot.settings.General.savePath}/$(date '+${config.services.flameshot.settings.General.filenamePattern}')\" --raw | wl-copy -t image/png"
"$mod, c, exec, ${config.services.cliphist.package}/bin/cliphist list | rofi -dmenu | cliphist decode | wl-copy"
"$mod, minus, exec, pamixer --decrease=5"
"$mod, equal, exec, pamixer --increase=5 --unmute"
", XF86AudioLowerVolume, exec, pamixer --decrease=5"
", XF86AudioRaiseVolume, exec, pamixer --increase=5 --unmute"
", XF86AudioMute, exec, pamixer --toggle-mute"
", XF86AudioMicMute, exec, pamixer --toggle-mute --default-source"
", XF86MonBrightnessDown, exec, light -U 10"
", XF86MonBrightnessUp, exec, light -A 10"
"$mod, semicolon, exec, light -U 10"
"$mod, apostrophe, exec, light -A 10"
# Previous/next but change the shuffle/random state before action (and change back afterwards)
"$mod&SHIFT, bracketright, exec, ${pkgs.playerctl}/bin/playerctl shuffle Toggle && ${pkgs.playerctl}/bin/playerctl next && ${pkgs.playerctl}/bin/playerctl shuffle Toggle"
"$mod&SHIFT, bracketleft, exec, ${pkgs.playerctl}/bin/playerctl shuffle Toggle && ${pkgs.playerctl}/bin/playerctl previous && ${pkgs.playerctl}/bin/playerctl shuffle Toggle"
"SHIFT, XF86AudioNext, exec, ${pkgs.playerctl}/bin/playerctl shuffle Toggle && ${pkgs.playerctl}/bin/playerctl next && ${pkgs.playerctl}/bin/playerctl shuffle Toggle"
# Previous/next
"$mod, bracketright, exec, ${pkgs.playerctl}/bin/playerctl next"
"$mod, bracketleft, exec, ${pkgs.playerctl}/bin/playerctl previous"
", XF86AudioNext, exec, ${pkgs.playerctl}/bin/playerctl next"
", XF86AudioPrev, exec, ${pkgs.playerctl}/bin/playerctl previous"
# Seek forward/back
"$mod&Control_L, bracketright, exec, ${pkgs.playerctl}/bin/playerctl position 5+"
"$mod&Control_L, bracketleft, exec, ${pkgs.playerctl}/bin/playerctl position 5-"
"Control_L, XF86AudioNext, exec, ${pkgs.playerctl}/bin/playerctl position 5+"
"Control_L, XF86AudioPrev, exec, ${pkgs.playerctl}/bin/playerctl position 5-"
# Toggle play/pause
", XF86AudioPlay, exec, ${pkgs.playerctl}/bin/playerctl play-pause"
", XF86AudioPause, exec, ${pkgs.playerctl}/bin/playerctl play-pause"
"$mod, backslash, exec, ${pkgs.playerctl}/bin/playerctl play-pause"
# "$mod, p, exec, bash ${inputs.bwmenu}/bwmenu"
# "$mod, e, exec, bash ${inputs.bemoji}/bemoji -t"
"Control_L&Alt_L, l, exec, ${pkgs.systemd}/bin/loginctl lock-session"
"$mod, left, hy3:movefocus, l"
"$mod, right, hy3:movefocus, r"
"$mod, up, hy3:movefocus, u"
"$mod, down, hy3:movefocus, d"
"$mod, h, hy3:movefocus, l"
"$mod, j, hy3:movefocus, d"
"$mod, k, hy3:movefocus, u"
"$mod, l, hy3:movefocus, r"
"$mod SHIFT, left, hy3:movewindow, l"
"$mod SHIFT, right, hy3:movewindow, r"
"$mod SHIFT, up, hy3:movewindow, u"
"$mod SHIFT, down, hy3:movewindow, d"
"$mod SHIFT, h, hy3:movewindow, l"
"$mod SHIFT, j, hy3:movewindow, d"
"$mod SHIFT, k, hy3:movewindow, u"
"$mod SHIFT, l, hy3:movewindow, r"
"$mod CTRL, left, resizeactive, -80 0"
"$mod CTRL, right, resizeactive, 80 0"
"$mod CTRL, up, resizeactive, 0 -80"
"$mod CTRL, down, resizeactive, 0 80"
"$mod CTRL, h, resizeactive, -80 0"
"$mod CTRL, j, resizeactive, 0 80"
"$mod CTRL, k, resizeactive, 0 -80"
"$mod CTRL, l, resizeactive, 80 0"
"$mod, mouse_down, workspace, e-1"
"$mod, mouse_up, workspace, e+1"
]
++ (
# workspaces
# binds $mod + [shift +] {1..9} to [move to] workspace {1..9}
builtins.concatLists (builtins.genList (i:
let ws = i + 1;
in [
"$mod, code:1${toString i}, workspace, ${toString ws}"
"$mod SHIFT, code:1${toString i}, movetoworkspace, ${toString ws}"
]
)
9)
);
};
};
programs.hyprpanel = {
enable = true;
settings = {
bar.layouts = {
"*" = {
left = [
"dashboard"
"workspaces"
"windowtitle"
];
middle = [ "media" ];
right = [
"systray"
"bluetooth"
"network"
"battery"
"volume"
"clock"
"notifications"
];
};
};
bar = {
launcher.autoDetectIcon = true;
workspaces.show_numbered = true;
};
menus.clock = {
time = {
military = false;
hideSeconds = false;
};
# weather.unit = "metric";
};
menus.dashboard = {
directories.enabled = false;
shortcuts.enabled = false;
stats.enable_gpu = false;
};
theme = {
font.weight = 100;
# osd.opacity = 60;
# notification.opacity = 60;
bar = {
transparent = true;
outer_spacing = "0";
buttons = {
background_opacity = 60;
padding_x = "0.4rem";
padding_y = "0.1rem";
y_margins = "0.2em";
};
};
};
};
};
programs.librewolf.enable = true;
services.blueman-applet.enable = lib.mkDefault cfg.bluetooth;
services.mpris-proxy.enable = lib.mkDefault true;
services.playerctld.enable = lib.mkDefault true;
programs.foot.enable = true;
xdg.enable = true;
xdg.userDirs.enable = true;
xdg.configFile."mimeapps.list".force = true;
xdg.mimeApps = let
applications = {
"inode/directory" = "pcmanfm-qt.desktop";
"text/html" = "librewolf.desktop";
"x-scheme-handler/http" = "librewolf.desktop";
"x-scheme-handler/https" = "librewolf.desktop";
"x-scheme-handler/about" = "librewolf.desktop";
"application/zip" = "ark.desktop";
"application/rar" = "ark.desktop";
"application/7z" = "ark.desktop";
"application/*tar" = "ark.desktop";
};
in {
enable = true;
associations.added = applications;
defaultApplications = applications;
};
programs.mpv.enable = lib.mkDefault true;
fonts.fontconfig.enable = lib.mkDefault true;
home.packages = with pkgs; [
wl-clipboard
wtype
ydotool
keyutils
maim
slop
xorg.xhost
pamixer
];
programs.rofi = {
enable = lib.mkDefault true;
terminal = lib.mkDefault "${config.programs.foot.package}/bin/foot";
};
services.flameshot = {
enable = true;
settings.General = {
filenamePattern = "%F_%T";
savePath = "${config.home.homeDirectory}/Media/Screenshots";
saveAfterCopy = true;
useGrimAdapter = true;
};
};
services.cliphist.enable = true;
};
}