114 lines
3.9 KiB
Nix
114 lines
3.9 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)
|
|
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 ''$2
|
|
'')
|
|
|
|
(pkgs.writeShellScriptBin "changeColors" ''
|
|
|
|
img=''$(realpath "''$1")
|
|
alpha=''${2:-70}
|
|
|
|
if [[ ''$alpha -lt 0 ]]; then
|
|
alpha=0
|
|
elif [[ ''$alpha -gt 100 ]]; then
|
|
alpha=100
|
|
fi
|
|
|
|
if [[ -f ~/.config/wal/colorschemes/dark/''$(basename "''$img")-''$alpha.json ]]; then
|
|
${pkgs.pywal16}/bin/wal -n -f "''$(basename "''$img")-''$alpha"
|
|
else
|
|
${pkgs.pywal16}/bin/wal -n -i "''$img" -a "''$alpha" --cols16 -p "''$(basename "''$img")-''$alpha"
|
|
fi
|
|
|
|
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 []);
|
|
};
|
|
}
|
|
|