diff --git a/bin/get-colorscheme-hex b/bin/get-colorscheme-hex new file mode 100755 index 0000000..4fad3b2 --- /dev/null +++ b/bin/get-colorscheme-hex @@ -0,0 +1,17 @@ +#!/bin/zsh +source $HOME/.config/wryn/env.zsh +##################################################################### + +GET_COLORSCHEME_HEX() { + [ $1 ] && [[ $1 -le 15 ]] && [[ $1 -ge 0 ]] \ + || __FAIL 1 'must provide ANSI color number 0-15' + + grep "^color$1" "$DOTWRYN/colorschemes/kitty.main" \ + | awk '{print $2}' \ + | sed 's/ //g; s/#//g' \ + | tr '[:lower:]' '[:upper:]' +} + +##################################################################### +[ ! $1 ] && return 0 +GET_COLORSCHEME_HEX $@ diff --git a/bin/i3lock b/bin/i3lock index d1c3598..484c173 100755 --- a/bin/i3lock +++ b/bin/i3lock @@ -1,34 +1,38 @@ #!/bin/zsh +# note: requires i3lock-color which i3lock >/dev/null 2>&1 || { notify-send 'i3lock-color' 'could not find installation of i3lock' } -# note: requires i3lock-color +source $HOME/.config/wryn/env.zsh +source $DOTWRYN/bin/get-colorscheme-hex +##################################################################### -INSIDE_VER='001020' -RING_VER='004040' +RADIUS=$(xrandr | grep 'connected primary' | sed 's/.* \([0-9]\+\)x.*/\1/' | awk '{print int($1*0.08)}') -INSIDE_WRONG='200010' -RING_WRONG='4a0020' +ARGS=( + --ignore-empty-password + --force-clock + --pass-screen-keys + --pass-media-keys + --pass-volume-keys + --pass-power-keys + --verif-text='' + --wrong-text='' + ) -INSIDE='002010' -RING='103020' -LINE='8888ff' -KEYDOWN='44ff44' -KEYREMOVE='4444ff' +[ $NOBLUR ] && ARGS+=(--color=$(GET_COLORSCHEME_HEX 0)69) || ARGS+=(--blur=11) +[ $RADIUS ] && ARGS+=(--radius=$RADIUS) -TIME='aaaaaa' -DATE='888888' - -i3lock \ - -e \ - --pass-screen-keys --pass-media-keys --pass-volume-keys --pass-power-keys \ - -B 6 \ - --force-clock \ - --insidever-color=$INSIDE_VER --ringver-color=$RING_VER --verif-color=$INSIDE_VER \ - --insidewrong-color=$INSIDE_WRONG --ringwrong-color=$RING_WRONG --wrong-color=$INSIDE_WRONG \ - --inside-color=002010 --ring-color=103020 \ - --line-color=$LINE \ - --time-color=$TIME --date-color=$DATE \ - --keyhl-color=$KEYDOWN --bshl-color=$KEYREMOVE \ +i3lock ${ARGS[@]} \ + --insidever-color=$(GET_COLORSCHEME_HEX 6) \ + --ringver-color=$(GET_COLORSCHEME_HEX 10) \ + --insidewrong-color=$(GET_COLORSCHEME_HEX 1) \ + --ringwrong-color=$(GET_COLORSCHEME_HEX 9) \ + --inside-color=$(GET_COLORSCHEME_HEX 0) \ + --ring-color=$(GET_COLORSCHEME_HEX 2) \ + --time-color=$(GET_COLORSCHEME_HEX 7) \ + --date-color=$(GET_COLORSCHEME_HEX 15) \ + --keyhl-color=$(GET_COLORSCHEME_HEX 11) \ + --bshl-color=$(GET_COLORSCHEME_HEX 13) \ || notify-send 'i3lock-color' 'something went wrong; unable to lock' \ ; diff --git a/colorschemes/halloween.conf b/colorschemes/halloween.conf index 477f771..b0ac104 100644 --- a/colorschemes/halloween.conf +++ b/colorschemes/halloween.conf @@ -5,7 +5,7 @@ selection_foreground #200010 cursor #ff6d00 color0 #100000 -color8 #3a3a3a +color8 #424242 color1 #5fff00 color9 #71fe9a @@ -25,5 +25,5 @@ color13 #8a41d5 color6 #cc4ccc color14 #994999 -color5 #696969 -color15 #4c4c4c +color7 #999999 +color15 #696969 diff --git a/config/dotwryn.env.zsh b/config/dotwryn.env.zsh index c0bb4a4..ef7dd15 100644 --- a/config/dotwryn.env.zsh +++ b/config/dotwryn.env.zsh @@ -9,6 +9,11 @@ export WALLPAPER_PATH="$HOME/Pictures/bg" export SOURCE_PACKAGES="$HOME/.local/share/source-packages" +export DOTWRYN_UTILS="$DOTWRYN/zsh/plugins/scwrypts/zsh/utils/utils.module.zsh" + +RELOAD_ZSH_UTILS() { source $DOTWRYN_UTILS; } +[ ! $DOTWRYN_UTILS_LOADED ] && RELOAD_ZSH_UTILS && export DOTWRYN_UTILS_LOADED=1 + ##################################################################### ### Application Settings ############################################ ##################################################################### @@ -27,10 +32,6 @@ WELCOME () { { figlet 'Welcome, beautiful'; cowsay -p 'damn u sexy'; } | lolcat } -LOAD_ZSH_UTILS() { - source "$DOTWRYN/zsh/plugins/scwrypts/zsh/utils/utils.module.zsh" -} - ##################################################################### ### External Plugins / Settings ##################################### ##################################################################### diff --git a/vim/update b/vim/update index 7cfb153..2d087ea 100755 --- a/vim/update +++ b/vim/update @@ -1,5 +1,5 @@ #!/bin/zsh -source "$HOME/.config/wryn/env.zsh" && LOAD_ZSH_UTILS +source "$HOME/.config/wryn/env.zsh" ##################################################################### UPDATE() { diff --git a/zsh/alias b/zsh/alias index 3a3f6a7..f22a721 100644 --- a/zsh/alias +++ b/zsh/alias @@ -1,75 +1,22 @@ #!/bin/zsh -# --------------------------------------------------------------------- -alias restart='clear; source ~/.zshrc; echo' +##################################################################### -alias pd='pushd'; -alias qd='popd'; -alias lspd='dirs'; +alias pd='pushd' +alias qd='popd' +alias lsd='dirs' -alias bp='bpython'; +alias pdo='pwd | xclip' # [p]aste [d]irectory [o]n clipboard +alias cdo='cd $(xclip -o)' # [c]hange to [d]irectory [o]n clipboard -alias pdo='pwd | xclip'; # [p]aste current [d]irectory [o]n clipboard -alias cdo='cd $(xclip -o)'; # [cd] to directory [o]n clipboard - -alias readable-date='date +"%A %B %d, %Y"' +alias restart='clear; source ~/.zshrc' alias fix='vim $(git diff --name-only | uniq) -p' -alias i3-config-update="$DOTWRYN/bin/i3/update-local-config" +##################################################################### command -v bat >/dev/null 2>&1 && alias cat='bat --style="plain"' -# --------------------------------------------------------------------- -alias erg='EDIT_RIP_GREP_FILE_MATCHES'; -EDIT_RIP_GREP_FILE_MATCHES() { - [ $EDITOR = "vim" ] \ - && $EDITOR -p $(rg --color=never -l $1 ) \ - || $EDITOR $(rg --color=never -l $1) ; -} +##################################################################### -# --------------------------------------------------------------------- - -alias -s mp4=google-chrome-stable -alias -s pdf=google-chrome-stable - -# --------------------------------------------------------------------- - -alias gdrive="RCLONE_GOOGLE_DRIVE_MOUNT" -alias gphotos="RCLONE_GOOGLE_PHOTOS_MOUNT" - -RCLONE_GOOGLE_DRIVE_MOUNT() { - local REMOTE_NAME='google-drive'; - local MOUNT_POINT="$HOME/GoogleDrive"; - local TITLE="GOOGLE DRIVE CONNECTION"; - local MOUNT_FOLDER_EXTENSION="$1"; - - RCLONE_GOOGLE_MOUNT "$REMOTE_NAME" "$MOUNT_POINT" "$TITLE" "$MOUNT_FOLDER_EXTENSION"; - -} - -RCLONE_GOOGLE_PHOTOS_MOUNT() { - local REMOTE_NAME='google-photos'; - local MOUNT_POINT="$HOME/GooglePhotos"; - local TITLE="GOOGLE PHOTOS CONNECTION"; - - RCLONE_GOOGLE_MOUNT "$REMOTE_NAME" "$MOUNT_POINT" "$TITLE"; -} - - -RCLONE_GOOGLE_MOUNT() { - local REMOTE_NAME="$1"; - local MOUNT_POINT="$2"; - local TITLE="$3"; - local MOUNT_FOLDER_EXTENSION="$4"; - - [ -d $MOUNT_POINT ] && [[ $(ls $MOUNT_POINT | wc -l) -gt 0 ]] \ - && { echo "connection already active at '$MOUNT_POINT'"; return 1; } - - clear; - figlet -w $(tput cols) "$TITLE"| lolcat; - echo -e "\e[3m(C-c to close)\e[0m"; - - mkdir $MOUNT_POINT >/dev/null 2>&1; - rclone mount "$REMOTE_NAME:$MOUNT_FOLDER_EXTENSION" "$MOUNT_POINT" - rmdir $MOUNT_POINT >/dev/null 2>&1; -} +alias erg='EDIT_RIPGREP_FILE_MATCHES' +EDIT_RIPGREP_FILE_MATCHES() { $EDITOR $(rg --color=never -l $@); } diff --git a/zsh/config b/zsh/config index 0cf5694..8aa035a 100644 --- a/zsh/config +++ b/zsh/config @@ -1,5 +1,5 @@ #!/bin/zsh -# --------------------------------------------------------------------- +##################################################################### HISTFILE=~/.histfile HISTSIZE=1000 @@ -13,20 +13,20 @@ bindkey -v bindkey '^R' history-incremental-search-backward autoload edit-command-line -zle -N edit-command-line; -bindkey -M vicmd v edit-command-line; +zle -N edit-command-line +bindkey -M vicmd v edit-command-line -# --------------------------------------------------------------------- +##################################################################### -zmodload -i zsh/complist; +zmodload -i zsh/complist zstyle ':completion:*' completer _complete _ignored _approximate zstyle ':completion:*' max-errors 1 -zstyle ':completion:*' menu select; -bindkey -M menuselect '^M' .accept-line; # don't require 'return' to select menu item +zstyle ':completion:*' menu select +bindkey -M menuselect '^M' .accept-line autoload -Uz compinit compinit -# --------------------------------------------------------------------- +##################################################################### which kitty >/dev/null && kitty + complete setup zsh | source /dev/stdin diff --git a/zsh/rc b/zsh/rc index c6ce936..4dec8ff 100644 --- a/zsh/rc +++ b/zsh/rc @@ -1,12 +1,13 @@ #!/bin/zsh source "$HOME/.config/wryn/env.zsh" -# --------------------------------------------------------------------- +##################################################################### INTERNAL_PLUGINS=( "$DOTWRYN/zsh/config" # must load first - $(find "$DOTWRYN/zsh" -maxdepth 1 -type f \ - ! -name 'rc' \ - ! -name 'config' \ - ) + $(find "$DOTWRYN/zsh" -mindepth 1 -maxdepth 1 -type f \ + | grep -v '/rc$' \ + | grep -v '/config$' \ + | grep -v '/\.[^/]\+$' \ + ) ) SET_PREFERRED_EDITOR() { @@ -29,13 +30,13 @@ SET_PREFERRED_EDITOR() { && break done - export EDITOR="$AVAILABLE_EDITOR"; - export VISUAL="$AVAILABLE_EDITOR"; + export EDITOR="$AVAILABLE_EDITOR" + export VISUAL="$AVAILABLE_EDITOR" } -# --------------------------------------------------------------------- +##################################################################### for p in $INTERNAL_PLUGINS; do source $p; done for p in $EXTERNAL_PLUGINS; do [ -f $p ] && source $p; done SET_PREFERRED_EDITOR WELCOME -# --------------------------------------------------------------------- +##################################################################### true