Files
Olympus/home-manager/users/nathan/packages/scripts/default.nix
2025-09-16 08:50:27 -05:00

124 lines
4.6 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" ''
if [[ ! -d /tmp/nathan ]]; then
mkdir /tmp/nathan
fi
img=''$(realpath ''${''$1:-${config.home.homeDirectory}/Pictures/Wallpaper/''$(${pkgs.eza}/bin/eza ${config.home.homeDirectory}/Pictures/Wallpaper -X | rofi -dmenu)})
ext="''${''$(basename ''$img)''\#''\#*.}"
if [[ ''$ext == "gif" || ''$ext == "mp4" ]]; then
${pkgs.ffmpeg}/bin/ffmpeg -i ''$img -vframes 1 /tmp/nathan/tmp.jpg
${pkgs.swww}/bin/swww img /tmp/nathan/tmp.jpg -t wipe
sleep 0.3
hyprctl dispatch exec "${pkgs.mpvpaper}/bin/mpvpaper ALL ''$img -o loop"
else
hyprctl dispatch exec ${pkgs.swww}/bin/swww img ''$img -t wipe
fi
${pkgs.hyprpanel}/bin/hyprpanel sw ''$img
changeColors ''$img
'')
(pkgs.writeShellScriptBin "changeColors" ''
if [[ ! -d /tmp/nathan ]]; then
mkdir /tmp/nathan
fi
if [[ -f /tmp/nathan/colorscheme && -z ''$1 ]]; then
${pkgs.pywal16}/bin/wal -f /tmp/nathan/colorscheme
else
img=''$(realpath ''$1)
alpha=''${2:-70}
if [[ ''$alpha -lt 0 ]]; then
''$alpha=0
elif [[ ''$alpha -gt 100 ]]; then
''$alpha=100
fi
fi
if [[ -f "${config.home.homeDirectory}/.config/wal/colorschemes/''${''$(basename ''$img)}-''$alpha" ]]; then
${pkgs.pywal16}/bin/wal -f "${config.home.homeDirectory}/.config/wal/colorschemes/''${''$(basename ''$img)}-''$alpha"
else
${pkgs.pywal16}/bin/wal -i ''$img -a ''$alpha --cols16 -n -p "''${''$(basename ''$img)}-''$alpha"
fi
cp "${config.home.homeDirectory}/.config/wal/colorschemes/''${''$(basename ''$img)}-''$alpha" /tmp/nathan/colorscheme
colorPrefix
'')
(pkgs.writeShellScriptBin "colorPrefix" ''
exec -a "$0" "$@" &
sleep 0.4
${pkgs.pywalfox-native}/bin/pywalfox update &
pkill -USR1 kitty
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
'')
(pkgs.writeShellScriptBin "onSystemStart" ''
if [[ ! -d /tmp/nathan ]]; then
mkdir /tmp/nathan
fi
if [[ -f ${config.home.homeDirectory}/.local/share/calcurse/.calcurse.pid ]]; then
rm ${config.home.homeDirectory}/.local/share/calcurse/.calcurse.pid
fi
hyprctl --batch "\
dispatch exec ${pkgs.swww}/bin/swww-daemon ;\
dispatch exec setWallpaper ${config.home.homeDirectory}/Pictures/Wallpaper/bluescape.jpg ;\
dispatch exec ${pkgs.pyprland}/bin/pypr ;\
dispatch exec ${pkgs.netbird-ui}/bin/netbird-ui ;\
dispatch exec ${pkgs.hyprpolkitagent}/libexec/hyprpolkitagent ;\
setcursor Bibata-Modern-Classic 16"
sleep 3
hyprctl reload
hyprctl dispatch exec ${pkgs.pyprland}/bin/pypr toggle calendar
#tmux new-session -s hyprland
'')
] ++ (if config.homeconfig.standalone.enable then [
(pkgs.writeShellScriptBin "_homeRebuild" ''
${pkgs.nh}/bin/nh home switch --ask
echo //////Enter to close//////
read
'')
] else []);
};
}