Commit for generation 250
This commit is contained in:
@@ -14,5 +14,6 @@
|
|||||||
++ [ (import ./swaync/swaync.nix)]
|
++ [ (import ./swaync/swaync.nix)]
|
||||||
++ [ (import ./userpkgs.nix) ]
|
++ [ (import ./userpkgs.nix) ]
|
||||||
++ [ (import ./waybar) ]
|
++ [ (import ./waybar) ]
|
||||||
|
++ [ (import ./eza.nix) ]
|
||||||
++ [ (import ./zsh/zshell.nix) ];
|
++ [ (import ./zsh/zshell.nix) ];
|
||||||
}
|
}
|
||||||
|
|||||||
9
glasshouse-desktop/home/eza.nix
Normal file
9
glasshouse-desktop/home/eza.nix
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{ ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
programs.eza = {
|
||||||
|
enable = true;
|
||||||
|
enableZshIntegration = true;
|
||||||
|
get = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
general = {
|
general = {
|
||||||
"$mainMod" = "super";
|
"$mainMod" = "super";
|
||||||
layout = "dwindle";
|
layout = "dwindle";
|
||||||
gaps_in = 8;
|
gaps_in = 4;
|
||||||
gaps_out = 8;
|
gaps_out = 8;
|
||||||
border_size = 2;
|
border_size = 2;
|
||||||
"col.active_border" = "rgb(cba6f7) rgb(94e2d5) 45deg";
|
"col.active_border" = "rgb(cba6f7) rgb(94e2d5) 45deg";
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
decoration = {
|
decoration = {
|
||||||
rounding = 10;
|
rounding = 7;
|
||||||
# active_opacity = 0.90;
|
# active_opacity = 0.90;
|
||||||
# inactive_opacity = 0.90;
|
# inactive_opacity = 0.90;
|
||||||
# fullscreen_opacity = 1.0;
|
# fullscreen_opacity = 1.0;
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
music = pkgs.writeShellScriptBin "music" (builtins.readFile ./scripts/music.sh);
|
music = pkgs.writeShellScriptBin "music" (builtins.readFile ./scripts/music.sh);
|
||||||
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);
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
@@ -31,6 +33,7 @@ in {
|
|||||||
runbg
|
runbg
|
||||||
music
|
music
|
||||||
lofi
|
lofi
|
||||||
|
splash
|
||||||
|
|
||||||
toggle_blur
|
toggle_blur
|
||||||
toggle_oppacity
|
toggle_oppacity
|
||||||
|
|||||||
22
glasshouse-desktop/home/scripts/scripts/splash.sh
Executable file
22
glasshouse-desktop/home/scripts/scripts/splash.sh
Executable file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/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"
|
||||||
|
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;205mTerminals Opened This Session:\033[0m $TERMINAL_COUNT"
|
||||||
|
echo -e "\033[38;2;0;180;205mCommands Entered This Session:\033[0m $CMD_COUNT"
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
|
{ ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
programs.zoxide = {
|
programs.zoxide = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableZshIntegration = true;
|
enableZshIntegration = true;
|
||||||
};
|
};
|
||||||
programs.zsh = {
|
programs.zsh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@@ -13,13 +15,8 @@
|
|||||||
VISUAL = "/nixbin/nvim";
|
VISUAL = "/nixbin/nvim";
|
||||||
LANG = "en_US.UTF-8";
|
LANG = "en_US.UTF-8";
|
||||||
BROWSER = "/nixbin/firefox";
|
BROWSER = "/nixbin/firefox";
|
||||||
STARSHIP_CONFIG = /home/pagedmov/.config/starship/starship.toml;
|
|
||||||
FZF_DEFAULT_COMMAND = "find $HOME \( -path \"$HOME/.steam\" -o -path \"$HOME/.mozilla\" -o -path \"$HOME/go\" \) -prune -o -type f -print";
|
|
||||||
GIT_TOKEN = "$(cat supersecret/git-token)";
|
|
||||||
PROMPT_COMMAND = "if [[ $? != 0 ]]; then s_check && (aplay ~/sound/sys/error.wav 2> /dev/null &); fi";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
oh-my-zsh = {
|
oh-my-zsh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
plugins = [ "git" "fzf" ];
|
plugins = [ "git" "fzf" ];
|
||||||
@@ -32,129 +29,41 @@
|
|||||||
size = 10000;
|
size = 10000;
|
||||||
share = true;
|
share = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
autosuggestion = {
|
autosuggestion = {
|
||||||
enable = true;
|
enable = true;
|
||||||
highlight = "fg=#4C566A,underline";
|
highlight = "fg=#4C566A,underline";
|
||||||
};
|
};
|
||||||
|
|
||||||
shellAliases = {
|
shellAliases = {
|
||||||
enterwifi = "nmtui-connect";
|
|
||||||
grep = "grep --color=auto";
|
grep = "grep --color=auto";
|
||||||
v = "nvim";
|
|
||||||
mv = "mv -v";
|
mv = "mv -v";
|
||||||
cp = "cp -vr";
|
cp = "cp -vr";
|
||||||
rm = "safe_rm";
|
gt = "gtrash";
|
||||||
grub-update = "sudo grub-mkconfig -o /boot/grub/grub.cfg";
|
grub-update = "sudo grub-mkconfig -o /boot/grub/grub.cfg";
|
||||||
mtar = "tar -zcvf"; # mtar <archive_compress>;
|
|
||||||
utar = "tar -zxvf"; # utar <archive_decompress> <file_list>;
|
|
||||||
z = "zip -r"; # z <archive_compress> <file_list>;
|
|
||||||
uz = "unzip"; # uz <archive_decompress> -d <dir>;
|
|
||||||
sr = "source ~/.zshrc";
|
sr = "source ~/.zshrc";
|
||||||
".." = "cd ..";
|
".." = "cd ..";
|
||||||
psg = "ps aux | grep -v grep | grep -i -e VSZ -e" ;
|
psg = "ps aux | grep -v grep | grep -i -e VSZ -e" ;
|
||||||
mkdir = "mkdir -p";
|
mkdir = "mkdir -p";
|
||||||
fm = "ranger";
|
|
||||||
killjob = "kill -9 \$(jobs -l | awk '{print \$3}')";
|
|
||||||
rmf = "fzf -m | xargs -ro rm";
|
|
||||||
nwt = "ping google.com";
|
|
||||||
wiki = "vimwiki";
|
|
||||||
uwiki = "wiki_update";
|
|
||||||
beep = "paplay $BEEP";
|
|
||||||
pk = "pkill -9 -f";
|
pk = "pkill -9 -f";
|
||||||
zrc = "nvim $HOME/sysflakes/glasshouse-desktop/modules/zshell.nix";
|
zrc = "nvim $HOME/dots/zsh/zshell.nix";
|
||||||
vfind = "nvim_find";
|
svcu = "systemctl --user";
|
||||||
theme = "change_kitty_theme";
|
svc = "sudo systemctl";
|
||||||
navhelp = "navhelp | less";
|
hyprconf = "nvim $HOME/dots/hyprland/config.nix";
|
||||||
svc = "systemctl --user";
|
nixconf = "nvim $HOME/sysflakes/glasshouse-desktop/sys";
|
||||||
hmswitch = "home-manager switch";
|
hmconf = "nvim $HOME/sysflakes/glasshouse-desktop/home";
|
||||||
hyprconf = "nvim $HOME/sysflakes/glasshouse-desktop/dotfiles/packages/hyprland/hyprland.conf";
|
|
||||||
hmconf = "nvim $HOME/sysflakes/glasshouse-desktop/home.nix";
|
|
||||||
nixconf = "nvim $HOME/sysflakes/glasshouse-desktop/configuration.nix";
|
|
||||||
viflake = "nvim flake.nix";
|
viflake = "nvim flake.nix";
|
||||||
nvimcfg = "ranger $HOME/sysflakes/glasshouse-desktop/dotfiles/packages/nixvim/";
|
nvimcfg = "nvim $HOME/dots/nixvim/config";
|
||||||
};
|
};
|
||||||
|
|
||||||
initExtraFirst = ''
|
initExtraFirst = ''
|
||||||
export PATH="$HOME/.local/bin:$HOME/.cargo/bin:$PATH"
|
|
||||||
export PATH="$HOME/.nix-profile/bin:$PATH"
|
|
||||||
export UPDATE_ZSH_DAYS=7
|
|
||||||
unalias ls
|
|
||||||
|
|
||||||
# Uncomment the following line to enable command auto-correction.
|
|
||||||
ENABLE_CORRECTION="true"
|
|
||||||
|
|
||||||
if [[ $- != *i* ]]; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
typeset -g comppath="$HOME/.cache"
|
|
||||||
typeset -g compfile="$comppath/.zcompdump"
|
|
||||||
|
|
||||||
if [[ -d "$comppath" ]]; then
|
|
||||||
[[ -w "$compfile" ]] || rm -rf "$compfile" >/dev/null 2>&1
|
|
||||||
else
|
|
||||||
mkdir -p "$comppath"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
preexec() {
|
|
||||||
cmdcounter="/tmp/cmdcounter_$(whoami)"
|
|
||||||
|
|
||||||
if [[ ! -f "$cmdcounter" ]]; then
|
|
||||||
echo 0 > "$cmdcounter"
|
|
||||||
fi
|
|
||||||
|
|
||||||
cmd_count="$(cat "$cmdcounter")"
|
|
||||||
|
|
||||||
cmd_count=$((cmd_count + 1))
|
|
||||||
|
|
||||||
echo "$cmd_count" > "$cmdcounter"
|
|
||||||
}
|
|
||||||
|
|
||||||
s_check() { [ $SOUNDS_ENABLED -eq 1 ] }
|
s_check() { [ $SOUNDS_ENABLED -eq 1 ] }
|
||||||
|
|
||||||
snd_restart() {
|
|
||||||
echo -n "Restarting wireplumber service... "
|
|
||||||
systemctl --user restart wireplumber; code1=$? && echo "SUCCESS" || echo "FAILED"
|
|
||||||
[ $code1 -ne 0 ] && exit 1
|
|
||||||
echo -n "Restarting pipewire service... "
|
|
||||||
systemctl --user restart pipewire; code2=$? && echo "SUCCESS" || echo "FAILED"
|
|
||||||
[ $code2 -ne 0 ] && exit 1
|
|
||||||
echo "Audio services successfully restarted"
|
|
||||||
}
|
|
||||||
|
|
||||||
vid_restart() {
|
|
||||||
echo -n "Restarting wireplumber service... "
|
|
||||||
systemctl --user restart wireplumber; code1=$? && echo "SUCCESS" || echo "FAILED"
|
|
||||||
[ $code1 -ne 0 ] && exit 1
|
|
||||||
echo -n "Restarting pipewire service... "
|
|
||||||
systemctl --user restart pipewire; code2=$? && echo "SUCCESS" || echo "FAILED"
|
|
||||||
[ $code2 -ne 0 ] && exit 1
|
|
||||||
echo -n "Restarting xdg-desktop-portal service... "
|
|
||||||
systemctl --user restart xdg-desktop-portal; code3=$? && echo "SUCCESS" || echo "FAILED"
|
|
||||||
[ $code3 -ne 0 ] && exit 1
|
|
||||||
echo -n "Restarting xdg-desktop-portal-hyprland service... "
|
|
||||||
systemctl --user restart xdg-desktop-portal-hyprland; code4=$? && echo "SUCCESS" || echo "FAILED"
|
|
||||||
[ $code4 -ne 0 ] && exit 1
|
|
||||||
echo "Video services successfully restarted"
|
|
||||||
}
|
|
||||||
|
|
||||||
wiki_update() {
|
|
||||||
old_pwd=$(pwd)
|
|
||||||
cd ~/vimwiki > /dev/null
|
|
||||||
git pull
|
|
||||||
cd $old_pwd > /dev/null
|
|
||||||
}
|
|
||||||
|
|
||||||
# Functions
|
|
||||||
ls() {
|
ls() {
|
||||||
command ls --group-directories-first --color=always -F1 "$@" | sort -f -k1
|
command ls --group-directories-first --color=always -F1 "$@" | sort -f -k1
|
||||||
s_check && (aplay ~/sound/sys/ls.wav > /dev/null 2>&1 &)
|
s_check && (aplay ~/sound/sys/ls.wav > /dev/null 2>&1 &)
|
||||||
}
|
}
|
||||||
|
|
||||||
# cd and ls after
|
|
||||||
cd() {
|
cd() {
|
||||||
export SOUNDS_ENABLED=0
|
export SOUNDS_ENABLED=0
|
||||||
ls "$@"
|
ls "$@"
|
||||||
@@ -162,73 +71,18 @@ cd() {
|
|||||||
export SOUNDS_ENABLED=1
|
export SOUNDS_ENABLED=1
|
||||||
s_check && (aplay ~/sound/sys/cd.wav > /dev/null 2>&1 &)
|
s_check && (aplay ~/sound/sys/cd.wav > /dev/null 2>&1 &)
|
||||||
}
|
}
|
||||||
src() {
|
|
||||||
autoload -U zrecompile
|
mcd() {
|
||||||
rm -rf "$compfile"*
|
mkdir -p $1
|
||||||
compinit -u -d "$compfile"
|
cd $1
|
||||||
zrecompile -p "$compfile"
|
|
||||||
exec zsh
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mcd () {
|
crs() {
|
||||||
mkdir -p $1
|
cargo test && \
|
||||||
cd $1
|
cargo run
|
||||||
}
|
}
|
||||||
|
|
||||||
rc(){
|
nixcommit() {
|
||||||
g++ "$1" -o run
|
|
||||||
./run
|
|
||||||
}
|
|
||||||
|
|
||||||
safe_rm() {
|
|
||||||
played_sound=false
|
|
||||||
for dir in "$@"; do
|
|
||||||
# Check if it's a file or directory
|
|
||||||
if [ -d "$dir" ] || [ -f "$dir" ]; then
|
|
||||||
# Get size of the directory or file
|
|
||||||
size=$(du -s "$dir" 2>/dev/null | awk '{print $1/1024}' | awk '{printf("%d\n", $1 + 0.5)}')
|
|
||||||
|
|
||||||
# Count files (recursively if it's a directory)
|
|
||||||
files=$(find "$dir" | wc -l)
|
|
||||||
|
|
||||||
check=false
|
|
||||||
is_file_or_dir=$([ -f "$dir" ] && echo 'file' || echo 'directory')
|
|
||||||
|
|
||||||
# If there are many files, or the size is big, warn the user
|
|
||||||
if [ "$files" -gt 20 ]; then
|
|
||||||
echo "There's a lot of stuff in '$dir' ($files files) ."
|
|
||||||
check=true
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$size" -gt 1024 ]; then
|
|
||||||
size_in_gb=$(echo "scale=2; $size / 1024" | bc -l)
|
|
||||||
echo "This $is_file_or_dir ('$dir') is kind of big ($size_in_gb GB)."
|
|
||||||
check=true
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Ask for confirmation only if necessary
|
|
||||||
if [ "$check" = true ]; then
|
|
||||||
echo "Are you sure you want to remove this $is_file_or_dir '$dir'? (y/n)"
|
|
||||||
read -r confirm
|
|
||||||
[ "$confirm" = "y" ] && (aplay ~/sound/sys/rm.wav > /dev/null 2>&1 &)
|
|
||||||
[ "$confirm" != "y" ] && (aplay ~/sound/sys/cd.wav > /dev/null 2>&1 &)
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Perform the removal if no checks or confirmation is "y"
|
|
||||||
if [ "$check" = false ] || [ "$confirm" = "y" ]; then
|
|
||||||
/run/current-system/sw/bin/rm -rfv "$dir"
|
|
||||||
[[ "$played_sound" -eq "0" ]] && (aplay ~/sound/sys/rm.wav > /dev/null 2>&1 &)
|
|
||||||
played_sound=1
|
|
||||||
else
|
|
||||||
echo "Operation cancelled for '$dir'."
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "'$dir' does not exist or is not accessible."
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
nixswitch() {
|
|
||||||
s_check && (aplay ~/sound/sys/nixswitch-start.wav > /dev/null 2>&1 &)
|
s_check && (aplay ~/sound/sys/nixswitch-start.wav > /dev/null 2>&1 &)
|
||||||
builtin cd "$HOME/sysflakes"
|
builtin cd "$HOME/sysflakes"
|
||||||
nix flake update
|
nix flake update
|
||||||
@@ -250,71 +104,69 @@ nixswitch() {
|
|||||||
fi
|
fi
|
||||||
builtin cd $OLDPWD
|
builtin cd $OLDPWD
|
||||||
}
|
}
|
||||||
journal() {
|
|
||||||
# journal for keeping track of stuff I do that isn't declared in my nix config
|
nixswitch() {
|
||||||
[ ! -f "$HOME/loose_ends" ] && touch "$HOME/loose_ends"
|
s_check && (aplay ~/sound/sys/nixswitch-start.wav > /dev/null 2>&1 &)
|
||||||
echo "$(date) - $1" >> "$HOME/loose_ends"
|
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#"$@" }
|
|
||||||
|
|
||||||
|
invoke() { nix run nixpkgs#$"@" }
|
||||||
|
|
||||||
|
nsp() { nix-shell -p "$@" --run zsh }
|
||||||
'';
|
'';
|
||||||
|
|
||||||
initExtraBeforeCompInit = ''
|
initExtra = ''
|
||||||
source ~/sysflakes/glasshouse-desktop/home/zsh/zsh-style
|
if [ ! -e $HOME/.zsh_history ]; then
|
||||||
'';
|
touch $HOME/.zsh_history
|
||||||
initExtra = ''
|
chmod 600 $HOME/.zsh_history
|
||||||
if [ ! -e $HOME/.zsh_history ]; then
|
fi
|
||||||
touch $HOME/.zsh_history
|
setopt APPEND_HISTORY # Append history to the history file (don't overwrite)
|
||||||
chmod 600 $HOME/.zsh_history
|
setopt INC_APPEND_HISTORY # Append to the history file incrementally
|
||||||
fi
|
setopt SHARE_HISTORY # Share history between all zsh sessions
|
||||||
HISTFILE=~/.zsh_history # The file where your history will be saved
|
setopt CORRECT
|
||||||
HISTSIZE=10000 # The number of lines kept in memory
|
setopt NO_NOMATCH
|
||||||
SAVEHIST=10000 # The number of lines kept in the history file
|
setopt LIST_PACKED
|
||||||
setopt APPEND_HISTORY # Append history to the history file (don't overwrite)
|
setopt ALWAYS_TO_END
|
||||||
setopt INC_APPEND_HISTORY # Append to the history file incrementally
|
setopt GLOB_COMPLETE
|
||||||
setopt SHARE_HISTORY # Share history between all zsh sessions
|
setopt COMPLETE_ALIASES
|
||||||
setopt CORRECT
|
setopt COMPLETE_IN_WORD
|
||||||
setopt NO_NOMATCH
|
setopt AUTO_CD
|
||||||
setopt LIST_PACKED
|
setopt AUTO_CONTINUE
|
||||||
setopt ALWAYS_TO_END
|
setopt LONG_LIST_JOBS
|
||||||
setopt GLOB_COMPLETE
|
setopt HIST_VERIFY
|
||||||
setopt COMPLETE_ALIASES
|
setopt SHARE_HISTORY
|
||||||
setopt COMPLETE_IN_WORD
|
setopt HIST_IGNORE_SPACE
|
||||||
setopt AUTO_CD
|
setopt HIST_SAVE_NO_DUPS
|
||||||
setopt AUTO_CONTINUE
|
setopt HIST_IGNORE_ALL_DUPS
|
||||||
setopt LONG_LIST_JOBS
|
setopt EXTENDED_GLOB
|
||||||
setopt HIST_VERIFY
|
setopt TRANSIENT_RPROMPT
|
||||||
setopt SHARE_HISTORY
|
setopt INTERACTIVE_COMMENTS
|
||||||
setopt HIST_IGNORE_SPACE
|
|
||||||
setopt HIST_SAVE_NO_DUPS
|
|
||||||
setopt HIST_IGNORE_ALL_DUPS
|
|
||||||
setopt EXTENDED_GLOB
|
|
||||||
setopt TRANSIENT_RPROMPT
|
|
||||||
setopt INTERACTIVE_COMMENTS
|
|
||||||
|
|
||||||
autoload -U compinit # completion
|
autoload -U compinit # completion
|
||||||
autoload -U terminfo # terminfo keys
|
autoload -U terminfo # terminfo keys
|
||||||
zmodload -i zsh/complist # menu completion
|
zmodload -i zsh/complist # menu completion
|
||||||
autoload -U promptinit # prompt
|
autoload -U promptinit # prompt
|
||||||
|
|
||||||
autoload -U up-line-or-beginning-search; zle -N up-line-or-beginning-search
|
autoload -U up-line-or-beginning-search; zle -N up-line-or-beginning-search
|
||||||
autoload -U down-line-or-beginning-search; zle -N down-line-or-beginning-search
|
autoload -U down-line-or-beginning-search; zle -N down-line-or-beginning-search
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if [ "$TERM" = "linux" ] ; then
|
|
||||||
echo -en "\e]P0232323"
|
|
||||||
fi
|
|
||||||
|
|
||||||
clear
|
|
||||||
source ~/sysflakes/glasshouse-desktop/home/zsh/zkbd
|
|
||||||
~/coding/scripts/splash.sh
|
|
||||||
eval "$(starship init zsh)" 2>/dev/null
|
|
||||||
s_check && (aplay ~/sound/sys/sh-source.wav > /dev/null 2>&1 &)
|
|
||||||
'';
|
|
||||||
|
|
||||||
# Options
|
|
||||||
|
|
||||||
|
bindkey -v
|
||||||
|
|
||||||
|
clear
|
||||||
|
splash
|
||||||
|
eval "$(starship init zsh)" 2>/dev/null
|
||||||
|
s_check && (aplay ~/sound/sys/sh-source.wav > /dev/null 2>&1 &)
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
320
glasshouse-desktop/home/zsh/zshellold.nix
Normal file
320
glasshouse-desktop/home/zsh/zshellold.nix
Normal file
@@ -0,0 +1,320 @@
|
|||||||
|
{
|
||||||
|
programs.zoxide = {
|
||||||
|
enable = true;
|
||||||
|
enableZshIntegration = true;
|
||||||
|
};
|
||||||
|
programs.zsh = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
sessionVariables = {
|
||||||
|
SOUNDS_ENABLED = "1";
|
||||||
|
EDITOR = "/nixbin/nvim";
|
||||||
|
SUDO_EDITOR = "/nixbin/nvim";
|
||||||
|
VISUAL = "/nixbin/nvim";
|
||||||
|
LANG = "en_US.UTF-8";
|
||||||
|
BROWSER = "/nixbin/firefox";
|
||||||
|
STARSHIP_CONFIG = /home/pagedmov/.config/starship/starship.toml;
|
||||||
|
FZF_DEFAULT_COMMAND = "find $HOME \( -path \"$HOME/.steam\" -o -path \"$HOME/.mozilla\" -o -path \"$HOME/go\" \) -prune -o -type f -print";
|
||||||
|
GIT_TOKEN = "$(cat supersecret/git-token)";
|
||||||
|
PROMPT_COMMAND = "if [[ $? != 0 ]]; then s_check && (aplay ~/sound/sys/error.wav 2> /dev/null &); fi";
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
oh-my-zsh = {
|
||||||
|
enable = true;
|
||||||
|
plugins = [ "git" "fzf" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
enableCompletion = true;
|
||||||
|
history = {
|
||||||
|
path = ".zsh_history";
|
||||||
|
save = 10000;
|
||||||
|
size = 10000;
|
||||||
|
share = true;
|
||||||
|
};
|
||||||
|
autosuggestion = {
|
||||||
|
enable = true;
|
||||||
|
highlight = "fg=#4C566A,underline";
|
||||||
|
};
|
||||||
|
|
||||||
|
shellAliases = {
|
||||||
|
enterwifi = "nmtui-connect";
|
||||||
|
grep = "grep --color=auto";
|
||||||
|
v = "nvim";
|
||||||
|
mv = "mv -v";
|
||||||
|
cp = "cp -vr";
|
||||||
|
rm = "safe_rm";
|
||||||
|
grub-update = "sudo grub-mkconfig -o /boot/grub/grub.cfg";
|
||||||
|
mtar = "tar -zcvf"; # mtar <archive_compress>;
|
||||||
|
utar = "tar -zxvf"; # utar <archive_decompress> <file_list>;
|
||||||
|
z = "zip -r"; # z <archive_compress> <file_list>;
|
||||||
|
uz = "unzip"; # uz <archive_decompress> -d <dir>;
|
||||||
|
sr = "source ~/.zshrc";
|
||||||
|
".." = "cd ..";
|
||||||
|
psg = "ps aux | grep -v grep | grep -i -e VSZ -e" ;
|
||||||
|
mkdir = "mkdir -p";
|
||||||
|
fm = "ranger";
|
||||||
|
killjob = "kill -9 \$(jobs -l | awk '{print \$3}')";
|
||||||
|
rmf = "fzf -m | xargs -ro rm";
|
||||||
|
nwt = "ping google.com";
|
||||||
|
wiki = "vimwiki";
|
||||||
|
uwiki = "wiki_update";
|
||||||
|
beep = "paplay $BEEP";
|
||||||
|
pk = "pkill -9 -f";
|
||||||
|
zrc = "nvim $HOME/sysflakes/glasshouse-desktop/modules/zshell.nix";
|
||||||
|
vfind = "nvim_find";
|
||||||
|
theme = "change_kitty_theme";
|
||||||
|
navhelp = "navhelp | less";
|
||||||
|
svc = "systemctl --user";
|
||||||
|
hmswitch = "home-manager switch";
|
||||||
|
hyprconf = "nvim $HOME/sysflakes/glasshouse-desktop/dotfiles/packages/hyprland/hyprland.conf";
|
||||||
|
hmconf = "nvim $HOME/sysflakes/glasshouse-desktop/home.nix";
|
||||||
|
nixconf = "nvim $HOME/sysflakes/glasshouse-desktop/configuration.nix";
|
||||||
|
viflake = "nvim flake.nix";
|
||||||
|
nvimcfg = "ranger $HOME/sysflakes/glasshouse-desktop/dotfiles/packages/nixvim/";
|
||||||
|
};
|
||||||
|
|
||||||
|
initExtraFirst = ''
|
||||||
|
export PATH="$HOME/.local/bin:$HOME/.cargo/bin:$PATH"
|
||||||
|
export PATH="$HOME/.nix-profile/bin:$PATH"
|
||||||
|
export UPDATE_ZSH_DAYS=7
|
||||||
|
unalias ls
|
||||||
|
|
||||||
|
# Uncomment the following line to enable command auto-correction.
|
||||||
|
ENABLE_CORRECTION="true"
|
||||||
|
|
||||||
|
if [[ $- != *i* ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
typeset -g comppath="$HOME/.cache"
|
||||||
|
typeset -g compfile="$comppath/.zcompdump"
|
||||||
|
|
||||||
|
if [[ -d "$comppath" ]]; then
|
||||||
|
[[ -w "$compfile" ]] || rm -rf "$compfile" >/dev/null 2>&1
|
||||||
|
else
|
||||||
|
mkdir -p "$comppath"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
preexec() {
|
||||||
|
cmdcounter="/tmp/cmdcounter_$(whoami)"
|
||||||
|
|
||||||
|
if [[ ! -f "$cmdcounter" ]]; then
|
||||||
|
echo 0 > "$cmdcounter"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cmd_count="$(cat "$cmdcounter")"
|
||||||
|
|
||||||
|
cmd_count=$((cmd_count + 1))
|
||||||
|
|
||||||
|
echo "$cmd_count" > "$cmdcounter"
|
||||||
|
}
|
||||||
|
|
||||||
|
s_check() { [ $SOUNDS_ENABLED -eq 1 ] }
|
||||||
|
|
||||||
|
snd_restart() {
|
||||||
|
echo -n "Restarting wireplumber service... "
|
||||||
|
systemctl --user restart wireplumber; code1=$? && echo "SUCCESS" || echo "FAILED"
|
||||||
|
[ $code1 -ne 0 ] && exit 1
|
||||||
|
echo -n "Restarting pipewire service... "
|
||||||
|
systemctl --user restart pipewire; code2=$? && echo "SUCCESS" || echo "FAILED"
|
||||||
|
[ $code2 -ne 0 ] && exit 1
|
||||||
|
echo "Audio services successfully restarted"
|
||||||
|
}
|
||||||
|
|
||||||
|
vid_restart() {
|
||||||
|
echo -n "Restarting wireplumber service... "
|
||||||
|
systemctl --user restart wireplumber; code1=$? && echo "SUCCESS" || echo "FAILED"
|
||||||
|
[ $code1 -ne 0 ] && exit 1
|
||||||
|
echo -n "Restarting pipewire service... "
|
||||||
|
systemctl --user restart pipewire; code2=$? && echo "SUCCESS" || echo "FAILED"
|
||||||
|
[ $code2 -ne 0 ] && exit 1
|
||||||
|
echo -n "Restarting xdg-desktop-portal service... "
|
||||||
|
systemctl --user restart xdg-desktop-portal; code3=$? && echo "SUCCESS" || echo "FAILED"
|
||||||
|
[ $code3 -ne 0 ] && exit 1
|
||||||
|
echo -n "Restarting xdg-desktop-portal-hyprland service... "
|
||||||
|
systemctl --user restart xdg-desktop-portal-hyprland; code4=$? && echo "SUCCESS" || echo "FAILED"
|
||||||
|
[ $code4 -ne 0 ] && exit 1
|
||||||
|
echo "Video services successfully restarted"
|
||||||
|
}
|
||||||
|
|
||||||
|
wiki_update() {
|
||||||
|
old_pwd=$(pwd)
|
||||||
|
cd ~/vimwiki > /dev/null
|
||||||
|
git pull
|
||||||
|
cd $old_pwd > /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
# Functions
|
||||||
|
ls() {
|
||||||
|
command ls --group-directories-first --color=always -F1 "$@" | sort -f -k1
|
||||||
|
s_check && (aplay ~/sound/sys/ls.wav > /dev/null 2>&1 &)
|
||||||
|
}
|
||||||
|
|
||||||
|
# cd and ls after
|
||||||
|
cd() {
|
||||||
|
export SOUNDS_ENABLED=0
|
||||||
|
ls "$@"
|
||||||
|
builtin cd "$@"
|
||||||
|
export SOUNDS_ENABLED=1
|
||||||
|
s_check && (aplay ~/sound/sys/cd.wav > /dev/null 2>&1 &)
|
||||||
|
}
|
||||||
|
src() {
|
||||||
|
autoload -U zrecompile
|
||||||
|
rm -rf "$compfile"*
|
||||||
|
compinit -u -d "$compfile"
|
||||||
|
zrecompile -p "$compfile"
|
||||||
|
exec zsh
|
||||||
|
}
|
||||||
|
|
||||||
|
mcd () {
|
||||||
|
mkdir -p $1
|
||||||
|
cd $1
|
||||||
|
}
|
||||||
|
|
||||||
|
rc(){
|
||||||
|
g++ "$1" -o run
|
||||||
|
./run
|
||||||
|
}
|
||||||
|
|
||||||
|
safe_rm() {
|
||||||
|
played_sound=false
|
||||||
|
for dir in "$@"; do
|
||||||
|
# Check if it's a file or directory
|
||||||
|
if [ -d "$dir" ] || [ -f "$dir" ]; then
|
||||||
|
# Get size of the directory or file
|
||||||
|
size=$(du -s "$dir" 2>/dev/null | awk '{print $1/1024}' | awk '{printf("%d\n", $1 + 0.5)}')
|
||||||
|
|
||||||
|
# Count files (recursively if it's a directory)
|
||||||
|
files=$(find "$dir" | wc -l)
|
||||||
|
|
||||||
|
check=false
|
||||||
|
is_file_or_dir=$([ -f "$dir" ] && echo 'file' || echo 'directory')
|
||||||
|
|
||||||
|
# If there are many files, or the size is big, warn the user
|
||||||
|
if [ "$files" -gt 20 ]; then
|
||||||
|
echo "There's a lot of stuff in '$dir' ($files files) ."
|
||||||
|
check=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$size" -gt 1024 ]; then
|
||||||
|
size_in_gb=$(echo "scale=2; $size / 1024" | bc -l)
|
||||||
|
echo "This $is_file_or_dir ('$dir') is kind of big ($size_in_gb GB)."
|
||||||
|
check=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Ask for confirmation only if necessary
|
||||||
|
if [ "$check" = true ]; then
|
||||||
|
echo "Are you sure you want to remove this $is_file_or_dir '$dir'? (y/n)"
|
||||||
|
read -r confirm
|
||||||
|
[ "$confirm" = "y" ] && (aplay ~/sound/sys/rm.wav > /dev/null 2>&1 &)
|
||||||
|
[ "$confirm" != "y" ] && (aplay ~/sound/sys/cd.wav > /dev/null 2>&1 &)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Perform the removal if no checks or confirmation is "y"
|
||||||
|
if [ "$check" = false ] || [ "$confirm" = "y" ]; then
|
||||||
|
/run/current-system/sw/bin/rm -rfv "$dir"
|
||||||
|
[[ "$played_sound" -eq "0" ]] && (aplay ~/sound/sys/rm.wav > /dev/null 2>&1 &)
|
||||||
|
played_sound=1
|
||||||
|
else
|
||||||
|
echo "Operation cancelled for '$dir'."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "'$dir' does not exist or is not accessible."
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
nixswitch() {
|
||||||
|
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 1 ]; then
|
||||||
|
git add .
|
||||||
|
git commit -m "Commit for generation $gen"
|
||||||
|
git push
|
||||||
|
fi
|
||||||
|
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
|
||||||
|
}
|
||||||
|
journal() {
|
||||||
|
# journal for keeping track of stuff I do that isn't declared in my nix config
|
||||||
|
[ ! -f "$HOME/loose_ends" ] && touch "$HOME/loose_ends"
|
||||||
|
echo "$(date) - $1" >> "$HOME/loose_ends"
|
||||||
|
}
|
||||||
|
invoke() { nix run nixpkgs#"$@" }
|
||||||
|
|
||||||
|
'';
|
||||||
|
|
||||||
|
initExtraBeforeCompInit = ''
|
||||||
|
source ~/sysflakes/glasshouse-desktop/home/zsh/zsh-style
|
||||||
|
'';
|
||||||
|
initExtra = ''
|
||||||
|
if [ ! -e $HOME/.zsh_history ]; then
|
||||||
|
touch $HOME/.zsh_history
|
||||||
|
chmod 600 $HOME/.zsh_history
|
||||||
|
fi
|
||||||
|
HISTFILE=~/.zsh_history # The file where your history will be saved
|
||||||
|
HISTSIZE=10000 # The number of lines kept in memory
|
||||||
|
SAVEHIST=10000 # The number of lines kept in the history file
|
||||||
|
setopt APPEND_HISTORY # Append history to the history file (don't overwrite)
|
||||||
|
setopt INC_APPEND_HISTORY # Append to the history file incrementally
|
||||||
|
setopt SHARE_HISTORY # Share history between all zsh sessions
|
||||||
|
setopt CORRECT
|
||||||
|
setopt NO_NOMATCH
|
||||||
|
setopt LIST_PACKED
|
||||||
|
setopt ALWAYS_TO_END
|
||||||
|
setopt GLOB_COMPLETE
|
||||||
|
setopt COMPLETE_ALIASES
|
||||||
|
setopt COMPLETE_IN_WORD
|
||||||
|
setopt AUTO_CD
|
||||||
|
setopt AUTO_CONTINUE
|
||||||
|
setopt LONG_LIST_JOBS
|
||||||
|
setopt HIST_VERIFY
|
||||||
|
setopt SHARE_HISTORY
|
||||||
|
setopt HIST_IGNORE_SPACE
|
||||||
|
setopt HIST_SAVE_NO_DUPS
|
||||||
|
setopt HIST_IGNORE_ALL_DUPS
|
||||||
|
setopt EXTENDED_GLOB
|
||||||
|
setopt TRANSIENT_RPROMPT
|
||||||
|
setopt INTERACTIVE_COMMENTS
|
||||||
|
|
||||||
|
autoload -U compinit # completion
|
||||||
|
autoload -U terminfo # terminfo keys
|
||||||
|
zmodload -i zsh/complist # menu completion
|
||||||
|
autoload -U promptinit # prompt
|
||||||
|
|
||||||
|
autoload -U up-line-or-beginning-search; zle -N up-line-or-beginning-search
|
||||||
|
autoload -U down-line-or-beginning-search; zle -N down-line-or-beginning-search
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$TERM" = "linux" ] ; then
|
||||||
|
echo -en "\e]P0232323"
|
||||||
|
fi
|
||||||
|
|
||||||
|
clear
|
||||||
|
source ~/sysflakes/glasshouse-desktop/home/zsh/zkbd
|
||||||
|
~/coding/scripts/splash.sh
|
||||||
|
eval "$(starship init zsh)" 2>/dev/null
|
||||||
|
s_check && (aplay ~/sound/sys/sh-source.wav > /dev/null 2>&1 &)
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Options
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user