Files
Olympus/home-manager/users/nathan/packages/scripts/default.nix
2025-08-30 15:42:34 -05:00

97 lines
3.1 KiB
Nix

{ config, lib, pkgs, ... }: {
options = {
homeconfig.scripts.enable = lib.options.mkOption {
type = lib.types.bool;
default = true;
};
};
config = lib.mkIf config.homeconfig.scripts.enable {
home.packages = [
#scripts
(pkgs.writeShellScriptBin "_systemRebuild" ''
${pkgs.nh}/bin/nh os switch --ask
echo //////Enter to close//////
read
'')
(pkgs.writeShellScriptBin "randWallpaper" ''
file=$(ls ${config.home.homeDirectory}/Pictures/Wallpaper/ | shuf -n 1)
setWallpaper ${config.home.homeDirectory}/Pictures/Wallpaper/$file
'')
(pkgs.writeShellScriptBin "setWallpaper" ''
img=''$(realpath ''${1:-~/.config/background})
chmod 600 ~/.config/background
${pkgs.hyprpanel}/bin/hyprpanel sw ''$img
changeColors ''$img ''$2
'')
(pkgs.writeShellScriptBin "changeColors" ''
if [[ $(ls ~/.config/ | grep bga) != bga ]]; then
echo 100 > ~/.config/bga
fi
alpha=''${2:-`cat ~/.config/bga`}
img=''$(realpath ''${1:-~/.config/background})
if [[ $alpha -lt 0 ]]; then
$alpha=0
fi
if [[ $alpha -gt 100 ]]; then
$alpha=100
fi
${pkgs.pywal16}/bin/wal -i $img -a $alpha --cols16 -n
echo $alpha > ~/.config/bga
sleep 0.4
${pkgs.pywalfox-native}/bin/pywalfox update &
[[ $(pidof cava) != "" ]] && pkill -USR1 cava &
for i in $(ls /run/user/1000 | grep nvim); do ${pkgs.neovim-remote}/bin/nvr -s --servername /run/user/1000/$i --remote-send '<cmd>colorscheme pywal<CR>'; done
pkill -USR1 kitty
'')
(pkgs.writeShellScriptBin "onSystemStart" ''
if [[ ! -f ${config.home.homeDirectory}/.config/background ]]; then
hyprctl dispatch exec "randWallpaper && chmod 600 ${config.home.homeDirectory}/.config/background"
fi
hyprctl dispatch exec ${pkgs.pyprland}/bin/pypr
hyprctl dispatch exec ${pkgs.netbird-ui}/bin/netbird-ui
hyprctl dispatch exec ${pkgs.hyprpolkitagent}/libexec/hyprpolkitagent
hyprctl setcursor Bibata-Modern-Classic 16
sleep 3
hyprctl reload
hyprctl dispatch exec ${pkgs.pyprland}/bin/pypr toggle calendar
#tmux new-session -s hyprland
'')
(pkgs.writeShellScriptBin "colorPrefix" ''
exec -a "$0" "$@" &
sleep 0.4 && changeColors &
'')
] ++ (if config.homeconfig.standalone.enable then [
(pkgs.writeShellScriptBin "_homeRebuild" ''
${pkgs.nh}/bin/nh home switch --ask
echo //////Enter to close//////
read
'')
] else []);
};
}