133 lines
4.3 KiB
Nix
133 lines
4.3 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
|
|
|
|
if [[ ! -f /tmp/nathan/bg ]]; then
|
|
cp ${config.home.homeDirectory}/Pictures/Wallpaper/bluescape.jpg /tmp/nathan/bg
|
|
chmod 600 /tmp/nathan/bg
|
|
fi
|
|
img=''$(realpath ''${1:-/tmp/nathan/bg})
|
|
hyprctl dispatch exec ${pkgs.swww}/bin/swww img ''$img -t random
|
|
${pkgs.hyprpanel}/bin/hyprpanel sw ''$img
|
|
changeColors ''$img ''$2
|
|
'')
|
|
|
|
(pkgs.writeShellScriptBin "changeColors" ''
|
|
|
|
if [[ ! -d /tmp/nathan ]]; then
|
|
mkdir /tmp/nathan
|
|
fi
|
|
|
|
if [[ ! -f /tmp/nathan/bg ]]; then
|
|
cp ${config.home.homeDirectory}/Pictures/Wallpaper/bluescape.jpg /tmp/nathan/bg
|
|
chmod 600 /tmp/nathan/bg
|
|
fi
|
|
|
|
if [[ ! -f /tmp/nathan/bga ]]; then
|
|
echo 70 > /tmp/nathan/bga
|
|
fi
|
|
|
|
alpha=''${2:-`cat /tmp/nathan/bga`}
|
|
|
|
img=''$(realpath ''${1:-/tmp/nathan/bg})
|
|
|
|
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 > /tmp/nathan/bga
|
|
cp $img /tmp/nathan/bg
|
|
|
|
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 [[ ! -d /tmp/nathan ]]; then
|
|
mkdir /tmp/nathan
|
|
fi
|
|
|
|
if [[ ! -f /tmp/nathan/bg ]]; then
|
|
cp ${config.home.homeDirectory}/Pictures/Wallpaper/bluescape.jpg /tmp/nathan/bg
|
|
chmod 600 /tmp/nathan/bg
|
|
fi
|
|
|
|
if [[ ! -f /tmp/nathan/bga ]]; then
|
|
echo 70 > /tmp/nathan/bga
|
|
fi
|
|
|
|
if [[ -f ${config.home.homeDirectory}/.local/share/calcurse/.calcurse.pid ]]; then
|
|
rm ${config.home.homeDirectory}/.local/share/calcurse/.calcurse.pid
|
|
fi
|
|
|
|
hyprctl dispatch exec ${pkgs.swww}/bin/swww-daemon
|
|
hyprctl dispatch exec "setWallpaper /tmp/nathan/bg"
|
|
|
|
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 []);
|
|
};
|
|
}
|
|
|