nixfiles/home-manager/modules/ezpcusr.nix
2025-10-27 10:05:38 -07:00

396 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 = "noctalia-shell ipc call lockScreen lock";
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";
}
];
};
};
xdg.portal = {
enable = true;
xdgOpenUsePortal = true;
extraPortals = [pkgs.xdg-desktop-portal-hyprland pkgs.xdg-desktop-portal-gtk];
config = {
common.default = ["gtk"];
hyprland.default = ["gtk" "hyprland"];
};
};
wayland.windowManager.hyprland = {
enable = true;
systemd = {
enable = true;
enableXdgAutostart = 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 = {
exec-once = [
"noctalia-shell"
];
"plugin:dynamic-cursors" = {
shake.enabled = false;
};
"plugin:hy3" = {
no_gaps_when_only = 1;
};
ecosystem = {
no_update_news = true;
no_donation_nag = true;
};
animations = {
enabled = false;
};
decoration = {
shadow.enabled = false;
};
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"
];
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, noctalia-shell ipc call launcher toggle"
", Print, exec, grim - | satty -f -"
"$mod, c, exec, noctalia-shell ipc call launcher clipboard"
"$mod, minus, exec, noctalia-shell ipc call volume decrease"
"$mod, equal, exec, noctalia-shell ipc call volume increase"
", XF86AudioLowerVolume, exec, noctalia-shell ipc call volume decrease"
", XF86AudioRaiseVolume, exec, noctalia-shell ipc call volume increase"
", XF86AudioMute, exec, noctalia-shell ipc call volume mute"
", XF86AudioMicMute, exec, noctalia-shell ipc call volume muteInput"
", XF86MonBrightnessDown, exec, noctalia-shell ipc call brightness decrease"
", XF86MonBrightnessUp, exec, noctalia-shell ipc call brightness increase"
"$mod, semicolon, exec, noctalia-shell ipc call brightness decrease"
"$mod, apostrophe, exec, noctalia-shell ipc call brightness increase"
# 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, noctalia-shell ipc call media next"
"$mod, bracketleft, exec, noctalia-shell ipc call media previous"
", XF86AudioNext, exec, noctalia-shell ipc call media next"
", XF86AudioPrev, exec, noctalia-shell ipc call media previous"
# Seek forward/back
"$mod&Control_L, bracketleft, exec, noctalia-shell ipc call media seekRelative -5"
"$mod&Control_L, bracketright, exec, noctalia-shell ipc call media seekRelative 5"
"Control_L, XF86AudioPrev, exec, noctalia-shell ipc call media seekRelative -5"
"Control_L, XF86AudioNext, exec, noctalia-shell ipc call media seekRelative 5"
# Toggle play/pause
", XF86AudioPlay, exec, noctalia-shell ipc call media playPause"
", XF86AudioPause, exec, noctalia-shell ipc call media playPause"
"$mod, backslash, exec, noctalia-shell ipc call media playPause"
"Control_L&Alt_L, l, exec, noctalia-shell ipc call lockScreen lock"
"$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.noctalia-shell = {
enable = true;
settings = {
appLauncher = {
terminalCommand = "${config.programs.foot.package}/bin/foot";
enableClipboardHistory = true;
};
general = {
compactLockScreen = true;
};
location = {
weatherEnabled = false;
use12hourFormat = true;
};
colorSchemes = {
generateTemplatesForPredefined = false;
};
ui = {
fontDefault = config.stylix.fonts.sansSerif.name;
fontFixed = config.stylix.fonts.monospace.name;
};
bar = {
floating = false;
backgroundOpacity = 0;
widgets = {
left = [
{
id = "Workspace";
}
{
id = "ActiveWindow";
width = 200;
}
];
center = [
{
id = "MediaMini";
maxWidth = 400;
scrollingMode = "always";
showVisualizer = true;
}
{
id = "Clock";
}
];
right = [
{
id = "Tray";
}
{
id = "NotificationHistory";
}
{
id = "Battery";
displayMode = "alwaysShow";
warningThreshold = 20;
}
{
id = "PowerProfile";
}
{
id = "Volume";
displayMode = "alwaysShow";
}
{
id = "WiFi";
}
{
id = "Bluetooth";
}
{
id = "ControlCenter";
}
];
};
};
};
colors = with config.lib.stylix.colors; {
mError = "#${base08}";
mOnError = "#${base00}";
mOnPrimary = "#${base00}";
mOnSecondary = "#${base00}";
mOnSurface = "#${base04}";
mOnSurfaceVariant = "#${base04}";
mOnTertiary = "#${base00}";
mOutline = "#${base02}";
mPrimary = "#${base0B}";
mSecondary = "#${base0A}";
mShadow = "#${base00}";
mSurface = "#${base00}";
mSurfaceVariant = "#${base01}";
mTertiary = "#${base0D}";
};
};
programs.librewolf.enable = true;
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
sway-contrib.grimshot
grim
inputs.noctalia.packages.${pkgs.system}.default
];
programs.satty = {
enable = true;
settings.general = {
fullscreen = true;
initial-tool = "crop";
early-exit = true;
copy-command = "wl-copy";
save-after-copy = true;
actions-on-enter = ["save-to-clipboard"];
actions-on-escape = ["exit"];
output-filename = "${config.home.homeDirectory}/Media/Screenshots/satty-%F_%T.png";
};
};
services.cliphist.enable = true;
};
}