Gen 315: moved function defs from zshell.nix, now defined as shell binaries in scripts/default.nix
This commit is contained in:
@@ -136,7 +136,7 @@
|
|||||||
"super, print, exec, grimblast copy area"
|
"super, print, exec, grimblast copy area"
|
||||||
"super, a, exec, firefox"
|
"super, a, exec, firefox"
|
||||||
"super, q, exec, kitty --title Kitty"
|
"super, q, exec, kitty --title Kitty"
|
||||||
"super, d, exec, /home/pagedmov/coding/scripts/switchmon.sh"
|
"super, d, exec, switchmon"
|
||||||
"super, c, killactive,"
|
"super, c, killactive,"
|
||||||
"super shift, q, exit,"
|
"super shift, q, exit,"
|
||||||
"super, m, exec, fuzzel"
|
"super, m, exec, fuzzel"
|
||||||
|
|||||||
@@ -7,6 +7,18 @@
|
|||||||
lofi = pkgs.writeScriptBin "lofi" (builtins.readFile ./scripts/lofi.sh);
|
lofi = pkgs.writeScriptBin "lofi" (builtins.readFile ./scripts/lofi.sh);
|
||||||
|
|
||||||
splash = pkgs.writeShellScriptBin "splash" (builtins.readFile ./scripts/splash.sh);
|
splash = pkgs.writeShellScriptBin "splash" (builtins.readFile ./scripts/splash.sh);
|
||||||
|
switchmon = pkgs.writeShellScriptBin "switchmon" (builtins.readFile ./scripts/switchmon.sh);
|
||||||
|
ls = pkgs.writeShellScriptBin "ls" (builtins.readFile ./scripts/ls.sh);
|
||||||
|
nixswitch = pkgs.writeShellScriptBin "nixswitch" (builtins.readFile ./scripts/nixswitch.sh);
|
||||||
|
garbage-collect = pkgs.writeShellScriptBin "garbage-collect" (builtins.readFile ./scripts/garbage-collect.sh);
|
||||||
|
scheck = pkgs.writeShellScriptBin "scheck" (builtins.readFile ./scripts/s_check.sh);
|
||||||
|
cd = pkgs.writeShellScriptBin "cd" (builtins.readFile ./scripts/cd.sh);
|
||||||
|
mcd = pkgs.writeShellScriptBin "mcd" (builtins.readFile ./scripts/mcd.sh);
|
||||||
|
crs = pkgs.writeShellScriptBin "crs" (builtins.readFile ./scripts/crs.sh);
|
||||||
|
nixcommit = pkgs.writeShellScriptBin "nixcommit" (builtins.readFile ./scripts/nixcommit.sh);
|
||||||
|
invoke = pkgs.writeShellScriptBin "invoke" (builtins.readFile ./scripts/invoke.sh);
|
||||||
|
nsp = pkgs.writeShellScriptBin "nsp" (builtins.readFile ./scripts/nsp.sh);
|
||||||
|
|
||||||
|
|
||||||
toggle_blur = pkgs.writeScriptBin "toggle_blur" (builtins.readFile ./scripts/toggle_blur.sh);
|
toggle_blur = pkgs.writeScriptBin "toggle_blur" (builtins.readFile ./scripts/toggle_blur.sh);
|
||||||
toggle_oppacity = pkgs.writeScriptBin "toggle_oppacity" (builtins.readFile ./scripts/toggle_oppacity.sh);
|
toggle_oppacity = pkgs.writeScriptBin "toggle_oppacity" (builtins.readFile ./scripts/toggle_oppacity.sh);
|
||||||
@@ -26,14 +38,26 @@
|
|||||||
|
|
||||||
record = pkgs.writeScriptBin "record" (builtins.readFile ./scripts/record.sh);
|
record = pkgs.writeScriptBin "record" (builtins.readFile ./scripts/record.sh);
|
||||||
in {
|
in {
|
||||||
home.packages = with pkgs; [
|
home.packages = [
|
||||||
|
ls
|
||||||
|
nixswitch
|
||||||
|
garbage-collect
|
||||||
|
scheck
|
||||||
|
cd
|
||||||
|
mcd
|
||||||
|
crs
|
||||||
|
nixcommit
|
||||||
|
invoke
|
||||||
|
nsp
|
||||||
wall-change
|
wall-change
|
||||||
wallpaper-picker
|
wallpaper-picker
|
||||||
|
|
||||||
runbg
|
runbg
|
||||||
music
|
music
|
||||||
lofi
|
lofi
|
||||||
|
|
||||||
splash
|
splash
|
||||||
|
switchmon
|
||||||
|
|
||||||
toggle_blur
|
toggle_blur
|
||||||
toggle_oppacity
|
toggle_oppacity
|
||||||
|
|||||||
7
glasshouse-desktop/home/scripts/scripts/cd.sh
Executable file
7
glasshouse-desktop/home/scripts/scripts/cd.sh
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/run/current-system/sw/bin/bash
|
||||||
|
|
||||||
|
export SOUNDS_ENABLED=0
|
||||||
|
eza -1 --group-directories-first --icons "$@"
|
||||||
|
builtin cd "$@" || exit
|
||||||
|
export SOUNDS_ENABLED=1
|
||||||
|
s_check && (aplay ~/sound/sys/cd.wav > /dev/null 2>&1 &)
|
||||||
4
glasshouse-desktop/home/scripts/scripts/crs.sh
Executable file
4
glasshouse-desktop/home/scripts/scripts/crs.sh
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/run/current-system/sw/bin/bash
|
||||||
|
|
||||||
|
cargo test && \
|
||||||
|
cargo run
|
||||||
20
glasshouse-desktop/home/scripts/scripts/garbage-collect.sh
Executable file
20
glasshouse-desktop/home/scripts/scripts/garbage-collect.sh
Executable file
@@ -0,0 +1,20 @@
|
|||||||
|
#!/run/current-system/sw/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
echo "This will delete all unused paths in the nix store and delete any files in the gtrash folder."
|
||||||
|
echo "\033[1;4;38;2;230;69;83mThis process is irreversible.\033[0m Are you sure?"
|
||||||
|
select yn in "Yes" "No"; do
|
||||||
|
case $yn in
|
||||||
|
Yes ) echo "Sweeping system...";break;;
|
||||||
|
No ) echo "Canceling garbage collection."; return;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
output=$(nix-collect-garbage | tee /dev/tty)
|
||||||
|
|
||||||
|
nix_freed=$(echo "$output" | grep -oP '\d+(\.\d+)? MiB freed' | cut -d' ' -f1)
|
||||||
|
rm_freed=$(du ~/.local/share/Trash/files/* ~/steamlib/.Trash-1000/files/* 2> /dev/null | awk '{sum += $1} END {print sum}')
|
||||||
|
rm_freed=$(echo "scale=2; $rm_freed / 1000" | bc)
|
||||||
|
/run/current-system/sw/bin/rm -rfv ~/.local/share/Trash/files/*
|
||||||
|
/run/current-system/sw/bin/rm -rfv ~/steamlib/.Trash-1000/files/*
|
||||||
|
total_freed=$(echo "$nix_freed + $rm_freed" | bc)
|
||||||
|
echo "System cleaning complete, freed $total_freed MiB in total"
|
||||||
3
glasshouse-desktop/home/scripts/scripts/invoke.sh
Executable file
3
glasshouse-desktop/home/scripts/scripts/invoke.sh
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/run/current-system/sw/bin/bash
|
||||||
|
|
||||||
|
nix run nixpkgs#$"@"
|
||||||
4
glasshouse-desktop/home/scripts/scripts/ls.sh
Executable file
4
glasshouse-desktop/home/scripts/scripts/ls.sh
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/run/current-system/sw/bin/bash
|
||||||
|
|
||||||
|
eza -1 --group-directories-first --icons "$@"
|
||||||
|
s_check && runbg aplay ~/sound/sys/ls.wav
|
||||||
5
glasshouse-desktop/home/scripts/scripts/mcd.sh
Executable file
5
glasshouse-desktop/home/scripts/scripts/mcd.sh
Executable file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/run/current-system/sw/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
mkdir -p "$1"
|
||||||
|
cd "$1" || exit
|
||||||
18
glasshouse-desktop/home/scripts/scripts/nixcommit.sh
Executable file
18
glasshouse-desktop/home/scripts/scripts/nixcommit.sh
Executable file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/run/current-system/sw/bin/bash
|
||||||
|
|
||||||
|
s_check && (aplay ~/sound/sys/nixswitch-start.wav > /dev/null 2>&1 &)
|
||||||
|
builtin cd "$HOME/sysflakes" || exit
|
||||||
|
nix flake update
|
||||||
|
|
||||||
|
gen=$(readlink /nix/var/nix/profiles/system | sed 's/.*system-\([0-9]*\)-link/\1/')
|
||||||
|
gen=$((gen + 1))
|
||||||
|
|
||||||
|
git diff --quiet
|
||||||
|
if mycmd; then
|
||||||
|
echo "Nothing to commit"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
git add .
|
||||||
|
git commit -m "Gen $gen: $@"
|
||||||
|
git push
|
||||||
|
builtin cd - || exit
|
||||||
13
glasshouse-desktop/home/scripts/scripts/nixswitch.sh
Executable file
13
glasshouse-desktop/home/scripts/scripts/nixswitch.sh
Executable file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/run/current-system/sw/bin/bash
|
||||||
|
|
||||||
|
s_check && (aplay ~/sound/sys/nixswitch-start.wav > /dev/null 2>&1 &)
|
||||||
|
builtin cd "$HOME/sysflakes" || exit
|
||||||
|
|
||||||
|
nix flake update
|
||||||
|
sudo nixos-rebuild switch --flake "$HOME/sysflakes#glasshouse"
|
||||||
|
if mycmd; then
|
||||||
|
s_check && (aplay ~/sound/sys/update.wav > /dev/null 2>&1 &)
|
||||||
|
else
|
||||||
|
s_check && (aplay ~/sound/sys/error.wav > /dev/null 2>&1 &)
|
||||||
|
fi
|
||||||
|
builtin cd "$OLDPWD" || exit
|
||||||
3
glasshouse-desktop/home/scripts/scripts/nsp.sh
Executable file
3
glasshouse-desktop/home/scripts/scripts/nsp.sh
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/run/current-system/sw/bin/bash
|
||||||
|
|
||||||
|
nix-shell -p "$@" --run zsh
|
||||||
3
glasshouse-desktop/home/scripts/scripts/s_check.sh
Executable file
3
glasshouse-desktop/home/scripts/scripts/s_check.sh
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/run/current-system/sw/bin/bash
|
||||||
|
|
||||||
|
[ "$SOUNDS_ENABLED" -eq 1 ]
|
||||||
@@ -1,22 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
TERMCOUNTER="/tmp/termcounter_$(whoami)"
|
|
||||||
if [[ ! -f "$TERMCOUNTER" ]]; then
|
|
||||||
echo 0 > "$TERMCOUNTER"
|
|
||||||
fi
|
|
||||||
UPDATES="/tmp/numupdates"
|
|
||||||
[ ! -e "$UPDATES" ] && UPDATES="0" # if it does not, UPDATES is equal to zero
|
|
||||||
[ -e "$UPDATES" ] && UPDATES=$(cat "$UPDATES") # if updates file exists, record number of updates
|
|
||||||
|
|
||||||
|
|
||||||
TERMINAL_COUNT=$(cat "$TERMCOUNTER")
|
|
||||||
TERMINAL_COUNT=$((TERMINAL_COUNT+1))
|
|
||||||
|
|
||||||
CMD_COUNT=$(cat "/tmp/cmdcounter_$(whoami)")
|
|
||||||
echo "$TERMINAL_COUNT" > "$TERMCOUNTER"
|
|
||||||
|
|
||||||
echo "NixOS kernel ver. $(uname -a | awk '{print $3}') x86_64 GNU/Linux"
|
echo "NixOS kernel ver. $(uname -a | awk '{print $3}') x86_64 GNU/Linux"
|
||||||
date +"%A %B %-d %Y"
|
date +"%A %B %-d %Y"
|
||||||
echo -e "\033[38;2;0;180;205m$(toilet -t -f Slant.flf glasshouse)\033[0m"
|
echo -e "\033[38;2;0;180;205m$(toilet -t -f Slant.flf glasshouse)\033[0m"
|
||||||
echo -e "\033[38;2;0;180;205mTerminals Opened This Session:\033[0m $TERMINAL_COUNT"
|
echo -e "\033[38;2;0;180;205mTerminals Opened This Session:\033[0m $TERMINAL_COUNT"
|
||||||
echo -e "\033[38;2;0;180;205mCommands Entered This Session:\033[0m $CMD_COUNT"
|
echo -e "\033[38;2;0;180;205mCommands Entered This Session:\033[0m $CMD_COUNT"
|
||||||
|
echo
|
||||||
|
|||||||
3
glasshouse-desktop/home/scripts/scripts/switchmon.sh
Executable file
3
glasshouse-desktop/home/scripts/scripts/switchmon.sh
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
hyprctl dispatch focusmonitor $(echo "$(hyprctl -j monitors)" | jq -r '.[] | select(.focused == false) | .name')
|
||||||
@@ -58,92 +58,6 @@
|
|||||||
nvimcfg = "nvim $HOME/dots/nixvim/config";
|
nvimcfg = "nvim $HOME/dots/nixvim/config";
|
||||||
zsr = "runbg kitty zsh && kitty @ close-window";
|
zsr = "runbg kitty zsh && kitty @ close-window";
|
||||||
};
|
};
|
||||||
initExtraFirst = ''
|
|
||||||
|
|
||||||
s_check() { [ $SOUNDS_ENABLED -eq 1 ] }
|
|
||||||
|
|
||||||
unalias ls
|
|
||||||
ls() {
|
|
||||||
eza -1 --group-directories-first --icons "$@"
|
|
||||||
s_check && runbg aplay ~/sound/sys/ls.wav
|
|
||||||
}
|
|
||||||
|
|
||||||
garbage-collect() {
|
|
||||||
echo "This will delete all unused paths in the nix store and delete any files in the gtrash folder."
|
|
||||||
echo "\033[1;4;38;2;230;69;83mThis process is irreversible.\033[0m Are you sure? "
|
|
||||||
select yn in "Yes" "No"; do
|
|
||||||
case $yn in
|
|
||||||
Yes ) echo "Sweeping system...";break;;
|
|
||||||
No ) echo "Canceling garbage collection."; return;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
output=$(nix-collect-garbage | tee /dev/tty)
|
|
||||||
|
|
||||||
nix_freed=$(echo "$output" | grep -oP '\d+(\.\d+)? MiB freed' | cut -d' ' -f1)
|
|
||||||
rm_freed=$(du ~/.local/share/Trash/files/* ~/steamlib/.Trash-1000/files/* 2> /dev/null | awk '{sum += $1} END {print sum}')
|
|
||||||
rm_freed=$(echo "scale=2; $rm_freed / 1000" | bc)
|
|
||||||
/run/current-system/sw/bin/rm -rfv ~/.local/share/Trash/files/*
|
|
||||||
/run/current-system/sw/bin/rm -rfv ~/steamlib/.Trash-1000/files/*
|
|
||||||
total_freed=$(echo "$nix_freed + $rm_freed" | bc)
|
|
||||||
echo "System cleaning complete, freed $total_freed MiB in total"
|
|
||||||
}
|
|
||||||
|
|
||||||
cd() {
|
|
||||||
export SOUNDS_ENABLED=0
|
|
||||||
eza -1 --group-directories-first --icons "$@"
|
|
||||||
builtin cd "$@"
|
|
||||||
export SOUNDS_ENABLED=1
|
|
||||||
s_check && (aplay ~/sound/sys/cd.wav > /dev/null 2>&1 &)
|
|
||||||
}
|
|
||||||
|
|
||||||
mcd() {
|
|
||||||
mkdir -p $1
|
|
||||||
cd $1
|
|
||||||
}
|
|
||||||
|
|
||||||
crs() {
|
|
||||||
cargo test && \
|
|
||||||
cargo run
|
|
||||||
}
|
|
||||||
|
|
||||||
nixcommit() {
|
|
||||||
s_check && (aplay ~/sound/sys/nixswitch-start.wav > /dev/null 2>&1 &)
|
|
||||||
builtin cd "$HOME/sysflakes"
|
|
||||||
nix flake update
|
|
||||||
|
|
||||||
gen=$(readlink /nix/var/nix/profiles/system | sed 's/.*system-\([0-9]*\)-link/\1/')
|
|
||||||
gen=$((gen + 1))
|
|
||||||
|
|
||||||
git diff --quiet
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
echo "Nothing to commit"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
git add .
|
|
||||||
git commit -m "Gen $gen: $@"
|
|
||||||
git push
|
|
||||||
builtin cd -
|
|
||||||
}
|
|
||||||
|
|
||||||
nixswitch() {
|
|
||||||
s_check && (aplay ~/sound/sys/nixswitch-start.wav > /dev/null 2>&1 &)
|
|
||||||
builtin cd "$HOME/sysflakes"
|
|
||||||
|
|
||||||
nix flake update
|
|
||||||
sudo nixos-rebuild switch --flake "$HOME/sysflakes#glasshouse"
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
s_check && (aplay ~/sound/sys/update.wav > /dev/null 2>&1 &)
|
|
||||||
else
|
|
||||||
s_check && (aplay ~/sound/sys/error.wav > /dev/null 2>&1 &)
|
|
||||||
fi
|
|
||||||
builtin cd $OLDPWD
|
|
||||||
}
|
|
||||||
|
|
||||||
invoke() { nix run nixpkgs#$"@" }
|
|
||||||
|
|
||||||
nsp() { nix-shell -p "$@" --run zsh }
|
|
||||||
'';
|
|
||||||
|
|
||||||
initExtra = ''
|
initExtra = ''
|
||||||
if [ ! -e $HOME/.zsh_history ]; then
|
if [ ! -e $HOME/.zsh_history ]; then
|
||||||
touch $HOME/.zsh_history
|
touch $HOME/.zsh_history
|
||||||
@@ -152,6 +66,8 @@ nsp() { nix-shell -p "$@" --run zsh }
|
|||||||
setopt APPEND_HISTORY # Append history to the history file (don't overwrite)
|
setopt APPEND_HISTORY # Append history to the history file (don't overwrite)
|
||||||
setopt INC_APPEND_HISTORY # Append to the history file incrementally
|
setopt INC_APPEND_HISTORY # Append to the history file incrementally
|
||||||
setopt SHARE_HISTORY # Share history between all zsh sessions
|
setopt SHARE_HISTORY # Share history between all zsh sessions
|
||||||
|
|
||||||
|
sessionVariables = {
|
||||||
setopt CORRECT
|
setopt CORRECT
|
||||||
setopt NO_NOMATCH
|
setopt NO_NOMATCH
|
||||||
setopt LIST_PACKED
|
setopt LIST_PACKED
|
||||||
@@ -187,7 +103,7 @@ nsp() { nix-shell -p "$@" --run zsh }
|
|||||||
unalias ls
|
unalias ls
|
||||||
clear
|
clear
|
||||||
splash
|
splash
|
||||||
s_check && (aplay ~/sound/sys/sh-source.wav > /dev/null 2>&1 &)
|
scheck && (aplay ~/sound/sys/sh-source.wav > /dev/null 2>&1 &)
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
nix-search-cli
|
nix-search-cli
|
||||||
openssl
|
openssl
|
||||||
p7zip
|
p7zip
|
||||||
|
jq
|
||||||
pamixer
|
pamixer
|
||||||
parted
|
parted
|
||||||
pass
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user