From 1a64551465f5e0e97195137d88760cc1f549a399 Mon Sep 17 00:00:00 2001 From: yage Date: Tue, 27 Jun 2023 16:53:59 -0600 Subject: [PATCH] scwrypts v3 refactor --- bin/altaria/default | 1 + bin/altaria/gamedock | 16 ++-- bin/altaria/hdmi4k | 24 ------ bin/altaria/homedock | 20 +++++ bin/altaria/xorg.zsh | 1 + bin/backlight | 19 ----- bin/butterfree/default | 1 + bin/get-colorscheme-hex | 17 ----- bin/i3-logout | 5 -- bin/i3-utils | 37 +++++----- bin/i3lock | 38 ---------- bin/kitty-alternate-theme | 15 ---- bin/play-sound | 32 -------- bin/pulseaudio | 43 ----------- bin/set-background | 14 ---- bin/umbreon/default | 1 + bin/umbreon/homedock | 23 ------ bin/umbreon/runedock | 15 ++-- bin/umbreon/undock | 18 ++--- bin/umbreon/xorg.zsh | 7 ++ bin/xorg-activate-default | 11 +-- config/dotwryn.env.zsh | 5 +- config/i3.conf | 22 +++--- config/scwrypts/config.zsh | 2 + config/scwrypts/dotfiles.zsh | 19 +++-- config/scwrypts/env/test | 53 -------------- config/scwrypts/environments/dotwryn/local | 11 +++ .../environments/dotwryn/local.altaria | 11 +++ .../environments/dotwryn/local.blaziken | 11 +++ .../environments/dotwryn/local.butterfree | 11 +++ .../environments/dotwryn/local.gardevoir | 11 +++ .../environments/dotwryn/local.umbreon | 11 +++ .../{env => environments/scwrypts}/local | 18 +---- .../scwrypts}/local.altaria | 18 +---- .../scwrypts}/local.blaziken | 18 +---- .../scwrypts}/local.butterfree | 18 +---- .../scwrypts}/local.gardevoir | 18 +---- .../scwrypts}/local.umbreon | 18 +---- scwrypts/.config/env.template | 4 + scwrypts/.config/env.template.descriptions | 4 + scwrypts/desktop/backlight | 73 +++++++++++++++++++ scwrypts/desktop/get-colorscheme-hex | 10 +++ scwrypts/desktop/i3/lock | 40 ++++++++++ scwrypts/desktop/i3/logout | 16 ++++ scwrypts/desktop/i3/set-background | 27 +++++++ scwrypts/desktop/kitty-alternate-theme | 14 ++++ scwrypts/desktop/play-sound | 10 +++ scwrypts/desktop/pulseaudio | 46 ++++++++++++ scwrypts/desktop/screen-blank | 52 +++++++++++++ scwrypts/dotwryn.scwrypts.zsh | 7 ++ {bin => scwrypts/home}/update-all-servers | 56 +++++++------- scwrypts/lib/desktop/colorscheme.module.zsh | 27 +++++++ scwrypts/lib/desktop/notify.module.zsh | 19 +++++ scwrypts/lib/media/audio.module.zsh | 38 ++++++++++ vim/update | 11 ++- zsh/plugins/code-activator | 2 +- zsh/plugins/scwrypts | 2 +- 57 files changed, 590 insertions(+), 501 deletions(-) create mode 120000 bin/altaria/default delete mode 100755 bin/altaria/hdmi4k create mode 100755 bin/altaria/homedock delete mode 100755 bin/backlight create mode 120000 bin/butterfree/default delete mode 100755 bin/get-colorscheme-hex delete mode 100755 bin/i3-logout delete mode 100755 bin/i3lock delete mode 100755 bin/kitty-alternate-theme delete mode 100755 bin/play-sound delete mode 100755 bin/pulseaudio delete mode 100755 bin/set-background create mode 120000 bin/umbreon/default delete mode 100755 bin/umbreon/homedock delete mode 100644 config/scwrypts/env/test create mode 100644 config/scwrypts/environments/dotwryn/local create mode 100644 config/scwrypts/environments/dotwryn/local.altaria create mode 100644 config/scwrypts/environments/dotwryn/local.blaziken create mode 100644 config/scwrypts/environments/dotwryn/local.butterfree create mode 100644 config/scwrypts/environments/dotwryn/local.gardevoir create mode 100644 config/scwrypts/environments/dotwryn/local.umbreon rename config/scwrypts/{env => environments/scwrypts}/local (72%) rename config/scwrypts/{env => environments/scwrypts}/local.altaria (74%) rename config/scwrypts/{env => environments/scwrypts}/local.blaziken (74%) rename config/scwrypts/{env => environments/scwrypts}/local.butterfree (74%) rename config/scwrypts/{env => environments/scwrypts}/local.gardevoir (73%) rename config/scwrypts/{env => environments/scwrypts}/local.umbreon (74%) create mode 100644 scwrypts/.config/env.template create mode 100644 scwrypts/.config/env.template.descriptions create mode 100755 scwrypts/desktop/backlight create mode 100755 scwrypts/desktop/get-colorscheme-hex create mode 100755 scwrypts/desktop/i3/lock create mode 100755 scwrypts/desktop/i3/logout create mode 100755 scwrypts/desktop/i3/set-background create mode 100755 scwrypts/desktop/kitty-alternate-theme create mode 100755 scwrypts/desktop/play-sound create mode 100755 scwrypts/desktop/pulseaudio create mode 100755 scwrypts/desktop/screen-blank create mode 100644 scwrypts/dotwryn.scwrypts.zsh rename {bin => scwrypts/home}/update-all-servers (61%) create mode 100644 scwrypts/lib/desktop/colorscheme.module.zsh create mode 100644 scwrypts/lib/desktop/notify.module.zsh create mode 100644 scwrypts/lib/media/audio.module.zsh diff --git a/bin/altaria/default b/bin/altaria/default new file mode 120000 index 0000000..38364f1 --- /dev/null +++ b/bin/altaria/default @@ -0,0 +1 @@ +homedock \ No newline at end of file diff --git a/bin/altaria/gamedock b/bin/altaria/gamedock index 86ea1ca..43eac54 100755 --- a/bin/altaria/gamedock +++ b/bin/altaria/gamedock @@ -1,22 +1,18 @@ #!/bin/zsh source ${0:a:h}/xorg.zsh -xrandr --output HDMI-0 --mode 3840x2160; sleep 1 - xrandr \ --output DP-0 \ --off \ - --output DP-2 \ + --output HDMI-0 \ --primary \ --mode 3840x2160 \ --rotate normal \ + --pos 0x0 \ ; -sleep 2; -xrandr --output DP-2 --mode 3840x2160 --rate 120; +pkill compton -$DOTWRYN/bin/set-background random -$DOTWRYN/bin/play-sound login - -xset dpms 0 0 0 && xset s noblank && xset s off \ - && notify-send 'DPMS' 'disabled screen blank' +scwrypts desktop/screen-blank -- disable +scwrypts desktop/i3/set-background -- roy-art.jpg +scwrypts desktop/play-sound -- gamedock diff --git a/bin/altaria/hdmi4k b/bin/altaria/hdmi4k deleted file mode 100755 index ccbd7de..0000000 --- a/bin/altaria/hdmi4k +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/zsh -source ${0:a:h}/xorg.zsh - -xrandr --output HDMI-0 --mode 3840x2160; sleep 1 - -xrandr \ - --output DP-0 \ - --mode 3840x2160 \ - --rotate normal \ - --pos 0x0 \ - --output DP-2 \ - --primary \ - --mode 3840x2160 \ - --rotate normal \ - --left-of DP-0 \ - ; - -(pkill compton; sleep 1; compton;) & - -$DOTWRYN/bin/set-background purple.jpg -$DOTWRYN/bin/play-sound login - -xset dpms 0 0 0 && xset s noblank && xset s off \ - && notify-send 'DPMS' 'disabled screen blank' diff --git a/bin/altaria/homedock b/bin/altaria/homedock new file mode 100755 index 0000000..22a8403 --- /dev/null +++ b/bin/altaria/homedock @@ -0,0 +1,20 @@ +#!/bin/zsh +source ${0:a:h}/xorg.zsh + +xrandr \ + --output DP-0 \ + --primary \ + --mode 1920x1080 \ + --rotate normal \ + --pos 0x0 \ + --output HDMI-0 \ + --mode 1920x1080 \ + --rotate normal \ + --pos 0x0 \ + ; + +(pkill compton; sleep 1; compton;) & + +scwrypts desktop/screen-blank -- disable +scwrypts desktop/i3/set-background -- purple.jpg +scwrypts desktop/play-sound -- login diff --git a/bin/altaria/xorg.zsh b/bin/altaria/xorg.zsh index 5bc8a69..d77022f 100644 --- a/bin/altaria/xorg.zsh +++ b/bin/altaria/xorg.zsh @@ -1,2 +1,3 @@ #!/bin/zsh source $HOME/.config/wryn/env.zsh +[ ! $DISPLAY ] && export DISPLAY=:0 diff --git a/bin/backlight b/bin/backlight deleted file mode 100755 index 9bcadbc..0000000 --- a/bin/backlight +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/zsh -source $HOME/.config/wryn/env.zsh - -case $1 in - up ) - xbacklight + 10 \ - || gmux_backlight +100 - ;; - down ) - xbacklight - 10 \ - || gmux_backlight -100 - ;; - * ) - echo 'must specify "up" or "down"' - exit 1 - ;; -esac - -$DOTWRYN/bin/play-sound backlight diff --git a/bin/butterfree/default b/bin/butterfree/default new file mode 120000 index 0000000..16a82f5 --- /dev/null +++ b/bin/butterfree/default @@ -0,0 +1 @@ +undock \ No newline at end of file diff --git a/bin/get-colorscheme-hex b/bin/get-colorscheme-hex deleted file mode 100755 index 4fad3b2..0000000 --- a/bin/get-colorscheme-hex +++ /dev/null @@ -1,17 +0,0 @@ -#!/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/i3-logout b/bin/i3-logout deleted file mode 100755 index 27444d3..0000000 --- a/bin/i3-logout +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/zsh -i3-nagbar \ - -t warning \ - -m 'Do you really want to exit i3?' \ - -B 'Yes' "notify-send 'system' 'exiting i3...' -i face-tired; i3-msg exit" diff --git a/bin/i3-utils b/bin/i3-utils index f833e8a..f644fff 100755 --- a/bin/i3-utils +++ b/bin/i3-utils @@ -1,25 +1,25 @@ #!/bin/zsh source "$HOME/.config/wryn/env.zsh" case $1 in - next ) $DOTWRYN/bin/media next ;; - prev ) $DOTWRYN/bin/media prev ;; - play ) $DOTWRYN/bin/media play ;; + #next ) scwrypts desktop/media -- next ;; + #prev ) scwrypts desktop/media -- prev ;; + #play ) scwrypts desktop/media -- play ;; - volumeup ) $DOTWRYN/bin/pulseaudio sink up ;; - volumedown ) $DOTWRYN/bin/pulseaudio sink down ;; - volumemute ) $DOTWRYN/bin/pulseaudio sink mute ;; - micmute ) $DOTWRYN/bin/pulseaudio source mute ;; + volumeup ) scwrypts desktop/pulseaudio -- sink up ;; + volumedown ) scwrypts desktop/pulseaudio -- sink down ;; + volumemute ) scwrypts desktop/pulseaudio -- sink mute ;; + micmute ) scwrypts desktop/pulseaudio -- source mute ;; - backlightup ) $DOTWRYN/bin/backlight up ;; - backlightdown ) $DOTWRYN/bin/backlight down ;; + backlightup ) scwrypts desktop/backlight -- up ;; + backlightdown ) scwrypts desktop/backlight -- down ;; - lock ) $DOTWRYN/bin/i3lock ;; + lock ) scwrypts desktop/i3/lock -- ;; - bgrandomize ) $DOTWRYN/bin/set-background random ;; + bgrandomize ) scwrypts desktop/i3/set-background -- random ;; - alternateterm ) $DOTWRYN/bin/kitty-alternate-theme ;; + alternateterm ) scwrypts desktop/kitty-alternate-theme -- ;; - logout ) $DOTWRYN/bin/i3-logout ;; + logout ) scwrypts desktop/i3/logout -- ;; launch ) local PROGRAM @@ -28,15 +28,16 @@ case $1 in messages ) PROGRAM=android-messages-desktop ;; voice ) PROGRAM=google-voice-desktop ;; ytmusic ) PROGRAM=youtubemusic-nativefier ;; - scrcpy ) PROGRAM=scrcpy ;; - discord ) PROGRAM=discord ARGS+=(-a) ;; - spotify ) PROGRAM=spotify ARGS+=(-c Spotify) ;; + 1pass ) PROGRAM=1password ARGS+=(-c 1Password) ;; + discord ) PROGRAM=discord ARGS+=(-a --has-statusbar-icon) ;; + obs ) PROGRAM=obs ARGS+=(-c '^obs' -n -l --has-statusbar-icon) ;; pavuctrl ) PROGRAM=pavucontrol ARGS+=(-s 0.5 -c '^Pavucontrol') ;; - obs ) PROGRAM=obs ARGS+=(-c '^obs') ;; + scrcpy ) PROGRAM=scrcpy ARGS+=(-n -l) ;; + spotify ) PROGRAM=spotify ARGS+=(-c Spotify) ;; * ) PROGRAM=$2 ;; esac - scwrypts i3/launch-or-show --env local -- $PROGRAM ${ARGS[@]} + scwrypts i3/launch-or-show -- $PROGRAM ${ARGS[@]} ;; esac diff --git a/bin/i3lock b/bin/i3lock deleted file mode 100755 index 484c173..0000000 --- a/bin/i3lock +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/zsh -# note: requires i3lock-color -which i3lock >/dev/null 2>&1 || { - notify-send 'i3lock-color' 'could not find installation of i3lock' -} -source $HOME/.config/wryn/env.zsh -source $DOTWRYN/bin/get-colorscheme-hex -##################################################################### - -RADIUS=$(xrandr | grep 'connected primary' | sed 's/.* \([0-9]\+\)x.*/\1/' | awk '{print int($1*0.08)}') - -ARGS=( - --ignore-empty-password - --force-clock - --pass-screen-keys - --pass-media-keys - --pass-volume-keys - --pass-power-keys - --verif-text='' - --wrong-text='' - ) - -[ $NOBLUR ] && ARGS+=(--color=$(GET_COLORSCHEME_HEX 0)69) || ARGS+=(--blur=11) -[ $RADIUS ] && ARGS+=(--radius=$RADIUS) - -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/bin/kitty-alternate-theme b/bin/kitty-alternate-theme deleted file mode 100755 index b4a6e72..0000000 --- a/bin/kitty-alternate-theme +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/zsh -source "$HOME/.config/wryn/env.zsh" - -function _SET_THEME() { - local THEME="$1" - local LOCAL_THEME="$HOME/.config/kitty/theme.conf" - rm -- $LOCAL_THEME - ln -s "$DOTWRYN/colorschemes/kitty.$THEME" "$LOCAL_THEME" -} - - -_SET_THEME alternate -i3-sensible-terminal & -sleep 0.1 -_SET_THEME main diff --git a/bin/play-sound b/bin/play-sound deleted file mode 100755 index c31f052..0000000 --- a/bin/play-sound +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/zsh -source "$HOME/.config/wryn/env.zsh" - -which canberra-gtk-play >/dev/null 2>&1 || { - notify-send 'canberra-gtk-play' "unable to play '$1'; is canberra-gtk-play installed?" - exit 1 -} - -PLAY() { canberra-gtk-play -f "$SFX_PATH/$1"; } - -SFX_FILE='' -case $1 in - volume ) SFX_FILE=yaru-message.oga ;; - mute ) SFX_FILE=smooth-dialog-warning.oga ;; - backlight ) SFX_FILE=yaru-audio-volume-change.oga ;; - login ) SFX_FILE=yaru-desktop-login.oga ;; - logout ) SFX_FILE=smooth-desktop-login.oga ;; - notify ) SFX_FILE=yaru-complete.oga ;; - undock ) SFX_FILE=yaru-desktop-login.oga ;; - homedock ) SFX_FILE=homedock.oga ;; - gamedock ) SFX_FILE=gamedock.oga ;; - - * ) SFX_FILE="$1" - ;; -esac -[ ! -f "$SFX_PATH/$SFX_FILE" ] && { - notify-send 'canberra-gtk-play' "no such sfx file or alias '$1'" \ - exit 2 -} - -canberra-gtk-play -f "$SFX_PATH/$SFX_FILE" \ - || notify-send 'canberra-gtk-play' "unable to play '$1'" diff --git a/bin/pulseaudio b/bin/pulseaudio deleted file mode 100755 index 23698a3..0000000 --- a/bin/pulseaudio +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/zsh -source $HOME/.config/wryn/env.zsh -##################################################################### - -USAGE="$0 (sink|source) (up|down|mute)" - -function ERROR() { - local ERROR_CODE=$1 - local MESSAGE="$2" - - echo -e "$MESSAGE\n\nUSAGE : $USAGE\n" >&2 - - exit $ERROR_CODE -} - -##################################################################### - -DEVICE="$1" -COMMAND="$2" - -case $DEVICE in - sink ) AMIXER_DEVICE=Master ;; - source ) AMIXER_DEVICE=Capture ;; - * ) ERROR 1 "Unsupported device '$DEVICE'" ;; -esac - -DEFAULT_DEVICE="@DEFAULT_$(echo $DEVICE | tr '[:lower:]' '[:upper:]')@" -case $COMMAND in - up ) - pactl set-$DEVICE-volume $DEFAULT_DEVICE +10% - $DOTWRYN/bin/play-sound volume - ;; - down ) - pactl set-$DEVICE-volume $DEFAULT_DEVICE -10% - $DOTWRYN/bin/play-sound volume - ;; - mute ) - pactl set-$DEVICE-mute $DEFAULT_DEVICE toggle - $DOTWRYN/bin/play-sound mute - notify-send "default $DEVICE" "$(amixer sget $AMIXER_DEVICE | grep -q '\[on\]' && echo unmuted || echo muted)" - ;; - * ) ERROR "Unsupported command '$COMMAND'" ;; -esac diff --git a/bin/set-background b/bin/set-background deleted file mode 100755 index 8fcd691..0000000 --- a/bin/set-background +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/zsh -source "$HOME/.config/wryn/env.zsh" -[ ! -d $WALLPAPER_PATH ] && exit 1 - - -case $1 in - random ) - feh --recursive --randomize --bg-fill $WALLPAPER_PATH - ;; - * ) - [ ! -f $WALLPAPER_PATH/$1 ] && exit 2 - feh --bg-fill $WALLPAPER_PATH/$1 - ;; -esac diff --git a/bin/umbreon/default b/bin/umbreon/default new file mode 120000 index 0000000..16a82f5 --- /dev/null +++ b/bin/umbreon/default @@ -0,0 +1 @@ +undock \ No newline at end of file diff --git a/bin/umbreon/homedock b/bin/umbreon/homedock deleted file mode 100755 index c6a54ac..0000000 --- a/bin/umbreon/homedock +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/zsh -source ${0:a:h}/xorg.zsh - -MOBILE=1 - -ARGS=() -[[ $MOBILE -eq 1 ]] && { - ARGS+=(--output DP-3 --mode 1920x1080 --pos 0x0 --primary) - ARGS+=(--output eDP-1 --mode 1920x1200 --right-of DP-3) -} || { - ARGS+=(--output DP-3-1 --mode 1920x1080 --pos 0x0 --primary) - ARGS+=(--output eDP-1 --off) -} - -xrandr ${ARGS[@]} - -xset dpms 0 0 0 && xset s noblank && xset s off \ - && notify-send 'DPMS' 'disabled screen blank' - -(pkill compton; sleep 0.5; compton;) & - -$DOTWRYN/bin/set-background random -$DOTWRYN/bin/play-sound gamedock diff --git a/bin/umbreon/runedock b/bin/umbreon/runedock index a08c080..2a85083 100755 --- a/bin/umbreon/runedock +++ b/bin/umbreon/runedock @@ -1,20 +1,17 @@ #!/bin/zsh source ${0:a:h}/xorg.zsh +ARGS=($(ALL_OTHER_DISPLAYS_OFF eDP-1)) -xrandr \ +xrandr ${ARGS[@]} \ --output eDP-1 \ --primary \ - --auto \ --mode 960x600 \ - --rotate normal \ - --rate 60 \ --pos 0x0 \ + --rotate normal \ ; pkill compton -xset dpms 0 0 0 && xset s noblank && xset s off \ - && notify-send 'DPMS' 'disabled screen blank' - -$DOTWRYN/bin/set-background random -$DOTWRYN/bin/play-sound gamedock +scwrypts desktop/screen-blank -- disable +scwrypts desktop/i3/set-background -- link-vs-gdizz.jpg +scwrypts desktop/play-sound -- gamedock diff --git a/bin/umbreon/undock b/bin/umbreon/undock index 82c766b..e44220b 100755 --- a/bin/umbreon/undock +++ b/bin/umbreon/undock @@ -1,23 +1,17 @@ #!/bin/zsh source ${0:a:h}/xorg.zsh +ARGS=($(ALL_OTHER_DISPLAYS_OFF eDP-1)) -xrandr \ +xrandr ${ARGS[@]} \ --output eDP-1 \ --primary \ - --auto \ --mode 1920x1200 \ - --rotate normal \ --pos 0x0 \ - --output DP-3-1 \ - --off \ - --output DP-3 \ - --off \ + --rotate normal \ ; -xset +dpms && xset s blank && xset s on \ - && notify-send 'DPMS' 'enabled screen blank' - (pkill compton; sleep 0.5; compton;) & -$DOTWRYN/bin/set-background random -$DOTWRYN/bin/play-sound gamedock +scwrypts desktop/screen-blank -- enable +scwrypts desktop/i3/set-background -- random +scwrypts desktop/play-sound -- gamedock diff --git a/bin/umbreon/xorg.zsh b/bin/umbreon/xorg.zsh index d77022f..e3c48c5 100644 --- a/bin/umbreon/xorg.zsh +++ b/bin/umbreon/xorg.zsh @@ -1,3 +1,10 @@ #!/bin/zsh source $HOME/.config/wryn/env.zsh [ ! $DISPLAY ] && export DISPLAY=:0 + +ALL_OTHER_DISPLAYS_OFF() { + for OUTPUT in $(xrandr | grep connect | grep -v $1 | awk '{print $1;}') + do + echo --output $OUTPUT --off + done +} diff --git a/bin/xorg-activate-default b/bin/xorg-activate-default index 4149fc3..113e840 100755 --- a/bin/xorg-activate-default +++ b/bin/xorg-activate-default @@ -1,14 +1,5 @@ #!/bin/zsh -_HOSTNAME=$(hostnamectl --static) - -case $_HOSTNAME in - butterfree ) DEFAULT=undock ;; - altaria ) DEFAULT=hdmi4k ;; - umbreon ) DEFAULT=undock ;; -esac - -LAYOUT="$DOTWRYN/bin/$_HOSTNAME/$DEFAULT" - +LAYOUT="$DOTWRYN/bin/$(hostnamectl --static)/default" [ -f $LAYOUT ] && { until xrandr -q >/dev/null 2>&1; do sleep .1; done $LAYOUT diff --git a/config/dotwryn.env.zsh b/config/dotwryn.env.zsh index 2860c97..384fba6 100644 --- a/config/dotwryn.env.zsh +++ b/config/dotwryn.env.zsh @@ -4,9 +4,6 @@ export DOTWRYN="$HOME/.wryn" -export SFX_PATH="$HOME/Media/sfx" -export WALLPAPER_PATH="$HOME/Pictures/bg" - export SOURCE_PACKAGES="$HOME/.local/share/source-packages" export DOTWRYN_UTILS="$DOTWRYN/zsh/plugins/scwrypts/zsh/lib/utils/utils.module.zsh" @@ -61,7 +58,7 @@ for e in \ "local.$(hostnamectl --static).secret" \ "local.$(hostnamectl --static)" \ "local" -do export SCWRYPTS_ENV="$e"; [ -f "$HOME/.config/scwrypts/environments/$e" ] && break; done +do export SCWRYPTS_ENV="$e"; [ -f "$HOME/.config/scwrypts/environments/scwrypts/$e" ] && break; done # z diff --git a/config/i3.conf b/config/i3.conf index 62214ea..5ee3aef 100644 --- a/config/i3.conf +++ b/config/i3.conf @@ -4,7 +4,7 @@ set $alt Mod1 set $mod Mod4 -font pango:DejaVuSansMono Nerd Font 20 +font pango:DejaVuSansM Nerd Font 20 ################################################################################ ## Custom Utility ############################################################## @@ -78,16 +78,16 @@ bindsym $mod+Shift+f focus parent; fullscreen; focus child bindsym $mod+BackSpace open -bindsym $mod+1 workspace number "1" -bindsym $mod+2 workspace number "2" -bindsym $mod+3 workspace number "3" -bindsym $mod+4 workspace number "4" -bindsym $mod+5 workspace number "5" -bindsym $mod+6 workspace number "6" -bindsym $mod+7 workspace number "7" -bindsym $mod+8 workspace number "8" -bindsym $mod+9 workspace number "9" -bindsym $mod+0 workspace number "0" +bindsym $mod+1 workspace number "1"; bar mode dock +bindsym $mod+2 workspace number "2"; bar mode hide +bindsym $mod+3 workspace number "3"; bar mode dock +bindsym $mod+4 workspace number "4"; bar mode hide +bindsym $mod+5 workspace number "5"; bar mode dock +bindsym $mod+6 workspace number "6"; bar mode hide +bindsym $mod+7 workspace number "7"; bar mode dock +bindsym $mod+8 workspace number "8"; bar mode hide +bindsym $mod+9 workspace number "9"; bar mode dock +bindsym $mod+0 workspace number "0"; bar mode hide bindsym $mod+Shift+1 move container to workspace number "1" bindsym $mod+Shift+2 move container to workspace number "2" diff --git a/config/scwrypts/config.zsh b/config/scwrypts/config.zsh index df2433c..3faf2c2 100644 --- a/config/scwrypts/config.zsh +++ b/config/scwrypts/config.zsh @@ -5,5 +5,7 @@ SCWRYPTS_SHORTCUT='' # CTRL + W SCWRYPTS_ENV_SHORTCUT='' # CTRL + / +source "$HOME/.wryn/scwrypts/dotwryn.scwrypts.zsh" + [ -f "$HOME/.config/scwrypts/config.local.zsh" ] \ && source "$HOME/.config/scwrypts/config.local.zsh" diff --git a/config/scwrypts/dotfiles.zsh b/config/scwrypts/dotfiles.zsh index c52f64c..e9f0733 100644 --- a/config/scwrypts/dotfiles.zsh +++ b/config/scwrypts/dotfiles.zsh @@ -26,12 +26,6 @@ $DOTWRYN/config/pylint.conf pylintrc $DOTWRYN/config/ripgrep.conf ripgrep/config $DOTWRYN/config/scwrypts/config.zsh scwrypts/config.zsh $DOTWRYN/config/scwrypts/dotfiles.zsh scwrypts/dotfiles.zsh -$DOTWRYN/config/scwrypts/env/local scwrypts/environments/local -$DOTWRYN/config/scwrypts/env/local.altaria scwrypts/environments/local.altaria -$DOTWRYN/config/scwrypts/env/local.blaziken scwrypts/environments/local.blaziken -$DOTWRYN/config/scwrypts/env/local.butterfree scwrypts/environments/local.butterfree -$DOTWRYN/config/scwrypts/env/local.gardevoir scwrypts/environments/local.gardevoir -$DOTWRYN/config/scwrypts/env/local.umbreon scwrypts/environments/local.umbreon $DOTWRYN/config/scwrypts/vundle.zsh scwrypts/vundle.zsh $DOTWRYN/config/tmux.conf tmux/tmux.conf $DOTWRYN/config/xcompose.conf X11/xcompose @@ -41,4 +35,17 @@ $DOTWRYN/config/xinitrc.i3 ../.xinitrc $DOTWRYN/bin/scwrypts ../.local/bin/scwrypts $DOTWRYN/bin/vim ../.local/bin/vim $DOTWRYN/bin/$(hostnamectl --static) ../.$(hostnamectl --static) + +$DOTWRYN/config/scwrypts/environments/scwrypts/local scwrypts/environments/scwrypts/local +$DOTWRYN/config/scwrypts/environments/scwrypts/local.altaria scwrypts/environments/scwrypts/local.altaria +$DOTWRYN/config/scwrypts/environments/scwrypts/local.blaziken scwrypts/environments/scwrypts/local.blaziken +$DOTWRYN/config/scwrypts/environments/scwrypts/local.butterfree scwrypts/environments/scwrypts/local.butterfree +$DOTWRYN/config/scwrypts/environments/scwrypts/local.gardevoir scwrypts/environments/scwrypts/local.gardevoir +$DOTWRYN/config/scwrypts/environments/scwrypts/local.umbreon scwrypts/environments/scwrypts/local.umbreon +$DOTWRYN/config/scwrypts/environments/dotwryn/local scwrypts/environments/dotwryn/local +$DOTWRYN/config/scwrypts/environments/dotwryn/local.altaria scwrypts/environments/dotwryn/local.altaria +$DOTWRYN/config/scwrypts/environments/dotwryn/local.blaziken scwrypts/environments/dotwryn/local.blaziken +$DOTWRYN/config/scwrypts/environments/dotwryn/local.butterfree scwrypts/environments/dotwryn/local.butterfree +$DOTWRYN/config/scwrypts/environments/dotwryn/local.gardevoir scwrypts/environments/dotwryn/local.gardevoir +$DOTWRYN/config/scwrypts/environments/dotwryn/local.umbreon scwrypts/environments/dotwryn/local.umbreon " diff --git a/config/scwrypts/env/test b/config/scwrypts/env/test deleted file mode 100644 index 8a2067b..0000000 --- a/config/scwrypts/env/test +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/zsh -##################################################################### -### scwrypts runtime configuration ################################## -##################################################################### - -# whether or not to deploy to production (0 = dev (default), 1 = prod) -export IN_PRODUCTION= - -##################################################################### - -# standard AWS environment variables used by awscli and other tools -export AWS_ACCOUNT= -export AWS_PROFILE= -export AWS_REGION= - -# fully-qualified path to mount the EFS drive -export AWS__EFS__LOCAL_MOUNT_POINT= - -# details for a directus instance -export DIRECTUS__API_TOKEN= -export DIRECTUS__BASE_URL= - -# details for discord bot -export DISCORD__BOT_TOKEN= -export DISCORD__DEFAULT_AVATAR_URL= -export DISCORD__DEFAULT_CHANNEL_ID= - -# custom i3 configuration settings -export I3__BORDER_PIXEL_SIZE=3 -export I3__DMENU_FONT_SIZE=18 -export I3__GLOBAL_FONT_SIZE=16 -export I3__MODEL_CONFIG= - -# linear.app project management configuration -export LINEAR__API_TOKEN= - -# s3 bucket name and filesystem targets for media backups -export MEDIA_SYNC__S3_BUCKET= -export MEDIA_SYNC__TARGETS=(_____ .porn_____ Documents_____ Media_____ Pictures_____)_____ - -# redis connection credentials -export REDIS_AUTH= -export REDIS_HOST= -export REDIS_PORT= - -# twilio account / credentials -export TWILIO__ACCOUNT_SID= -export TWILIO__API_KEY= -export TWILIO__API_SECRET= -export TWILIO__DEFAULT_PHONE_FROM= -export TWILIO__DEFAULT_PHONE_TO= - -##################################################################### diff --git a/config/scwrypts/environments/dotwryn/local b/config/scwrypts/environments/dotwryn/local new file mode 100644 index 0000000..5a395b6 --- /dev/null +++ b/config/scwrypts/environments/dotwryn/local @@ -0,0 +1,11 @@ +#!/bin/zsh +##################################################################### +### scwrypts runtime configuration (group 'dotwryn') ################ +##################################################################### + +# directory containing sound effects +export DESKTOP__SFX_PATH="$HOME/Media/sfx" +export DESKTOP__WALLPAPER_PATH="$HOME/Pictures/bg" + +# home server data +export WRYN__SERVER_HOSTNAMES= diff --git a/config/scwrypts/environments/dotwryn/local.altaria b/config/scwrypts/environments/dotwryn/local.altaria new file mode 100644 index 0000000..095330e --- /dev/null +++ b/config/scwrypts/environments/dotwryn/local.altaria @@ -0,0 +1,11 @@ +#!/bin/zsh +##################################################################### +### scwrypts runtime configuration (group 'dotwryn') ################ +##################################################################### + +# directory containing sound effects +export DESKTOP__SFX_PATH="$HOME/Media/sfx" # from local +export DESKTOP__WALLPAPER_PATH="$HOME/Pictures/bg" # from local + +# home server data +export WRYN__SERVER_HOSTNAMES= diff --git a/config/scwrypts/environments/dotwryn/local.blaziken b/config/scwrypts/environments/dotwryn/local.blaziken new file mode 100644 index 0000000..095330e --- /dev/null +++ b/config/scwrypts/environments/dotwryn/local.blaziken @@ -0,0 +1,11 @@ +#!/bin/zsh +##################################################################### +### scwrypts runtime configuration (group 'dotwryn') ################ +##################################################################### + +# directory containing sound effects +export DESKTOP__SFX_PATH="$HOME/Media/sfx" # from local +export DESKTOP__WALLPAPER_PATH="$HOME/Pictures/bg" # from local + +# home server data +export WRYN__SERVER_HOSTNAMES= diff --git a/config/scwrypts/environments/dotwryn/local.butterfree b/config/scwrypts/environments/dotwryn/local.butterfree new file mode 100644 index 0000000..095330e --- /dev/null +++ b/config/scwrypts/environments/dotwryn/local.butterfree @@ -0,0 +1,11 @@ +#!/bin/zsh +##################################################################### +### scwrypts runtime configuration (group 'dotwryn') ################ +##################################################################### + +# directory containing sound effects +export DESKTOP__SFX_PATH="$HOME/Media/sfx" # from local +export DESKTOP__WALLPAPER_PATH="$HOME/Pictures/bg" # from local + +# home server data +export WRYN__SERVER_HOSTNAMES= diff --git a/config/scwrypts/environments/dotwryn/local.gardevoir b/config/scwrypts/environments/dotwryn/local.gardevoir new file mode 100644 index 0000000..095330e --- /dev/null +++ b/config/scwrypts/environments/dotwryn/local.gardevoir @@ -0,0 +1,11 @@ +#!/bin/zsh +##################################################################### +### scwrypts runtime configuration (group 'dotwryn') ################ +##################################################################### + +# directory containing sound effects +export DESKTOP__SFX_PATH="$HOME/Media/sfx" # from local +export DESKTOP__WALLPAPER_PATH="$HOME/Pictures/bg" # from local + +# home server data +export WRYN__SERVER_HOSTNAMES= diff --git a/config/scwrypts/environments/dotwryn/local.umbreon b/config/scwrypts/environments/dotwryn/local.umbreon new file mode 100644 index 0000000..095330e --- /dev/null +++ b/config/scwrypts/environments/dotwryn/local.umbreon @@ -0,0 +1,11 @@ +#!/bin/zsh +##################################################################### +### scwrypts runtime configuration (group 'dotwryn') ################ +##################################################################### + +# directory containing sound effects +export DESKTOP__SFX_PATH="$HOME/Media/sfx" # from local +export DESKTOP__WALLPAPER_PATH="$HOME/Pictures/bg" # from local + +# home server data +export WRYN__SERVER_HOSTNAMES= diff --git a/config/scwrypts/env/local b/config/scwrypts/environments/scwrypts/local similarity index 72% rename from config/scwrypts/env/local rename to config/scwrypts/environments/scwrypts/local index a94b62c..c221852 100644 --- a/config/scwrypts/env/local +++ b/config/scwrypts/environments/scwrypts/local @@ -1,20 +1,6 @@ #!/bin/zsh ##################################################################### -### scwrypts runtime configuration ################################## -##################################################################### - -# whether or not to deploy to production (0 = dev (default), 1 = prod) -export IN_PRODUCTION= - -##################################################################### - -# directory containing sound effects -export DESKTOP__SFX_PATH="$HOME/Media/sfx" -export DESKTOP__WALLPAPER_PATH="$HOME/Pictures/bg" - -# home server data -export WRYN__SERVER_HOSTNAMES= - +### scwrypts runtime configuration (group 'scwrypts') ############### ##################################################################### # standard AWS environment variables used by awscli and other tools @@ -62,5 +48,3 @@ export TWILIO__API_KEY= export TWILIO__API_SECRET= export TWILIO__DEFAULT_PHONE_FROM= export TWILIO__DEFAULT_PHONE_TO= - -##################################################################### diff --git a/config/scwrypts/env/local.altaria b/config/scwrypts/environments/scwrypts/local.altaria similarity index 74% rename from config/scwrypts/env/local.altaria rename to config/scwrypts/environments/scwrypts/local.altaria index 6c614a1..12d9b43 100644 --- a/config/scwrypts/env/local.altaria +++ b/config/scwrypts/environments/scwrypts/local.altaria @@ -1,20 +1,6 @@ #!/bin/zsh ##################################################################### -### scwrypts runtime configuration ################################## -##################################################################### - -# whether or not to deploy to production (0 = dev (default), 1 = prod) -export IN_PRODUCTION= - -##################################################################### - -# directory containing sound effects -export DESKTOP__SFX_PATH="$HOME/Media/sfx" # from local -export DESKTOP__WALLPAPER_PATH="$HOME/Pictures/bg" # from local - -# home server data -export WRYN__SERVER_HOSTNAMES= - +### scwrypts runtime configuration (group 'scwrypts') ############### ##################################################################### # standard AWS environment variables used by awscli and other tools @@ -71,5 +57,3 @@ export TWILIO__API_KEY= export TWILIO__API_SECRET= export TWILIO__DEFAULT_PHONE_FROM= export TWILIO__DEFAULT_PHONE_TO= - -##################################################################### diff --git a/config/scwrypts/env/local.blaziken b/config/scwrypts/environments/scwrypts/local.blaziken similarity index 74% rename from config/scwrypts/env/local.blaziken rename to config/scwrypts/environments/scwrypts/local.blaziken index ff86122..793bc3e 100644 --- a/config/scwrypts/env/local.blaziken +++ b/config/scwrypts/environments/scwrypts/local.blaziken @@ -1,20 +1,6 @@ #!/bin/zsh ##################################################################### -### scwrypts runtime configuration ################################## -##################################################################### - -# whether or not to deploy to production (0 = dev (default), 1 = prod) -export IN_PRODUCTION= - -##################################################################### - -# directory containing sound effects -export DESKTOP__SFX_PATH="$HOME/Media/sfx" # from local -export DESKTOP__WALLPAPER_PATH="$HOME/Pictures/bg" # from local - -# home server data -export WRYN__SERVER_HOSTNAMES= - +### scwrypts runtime configuration (group 'scwrypts') ############### ##################################################################### # standard AWS environment variables used by awscli and other tools @@ -68,5 +54,3 @@ export TWILIO__API_KEY= export TWILIO__API_SECRET= export TWILIO__DEFAULT_PHONE_FROM= export TWILIO__DEFAULT_PHONE_TO= - -##################################################################### diff --git a/config/scwrypts/env/local.butterfree b/config/scwrypts/environments/scwrypts/local.butterfree similarity index 74% rename from config/scwrypts/env/local.butterfree rename to config/scwrypts/environments/scwrypts/local.butterfree index 6556217..5eda5a9 100644 --- a/config/scwrypts/env/local.butterfree +++ b/config/scwrypts/environments/scwrypts/local.butterfree @@ -1,20 +1,6 @@ #!/bin/zsh ##################################################################### -### scwrypts runtime configuration ################################## -##################################################################### - -# whether or not to deploy to production (0 = dev (default), 1 = prod) -export IN_PRODUCTION= - -##################################################################### - -# directory containing sound effects -export DESKTOP__SFX_PATH="$HOME/Media/sfx" # from local -export DESKTOP__WALLPAPER_PATH="$HOME/Pictures/bg" # from local - -# home server data -export WRYN__SERVER_HOSTNAMES= - +### scwrypts runtime configuration (group 'scwrypts') ############### ##################################################################### # standard AWS environment variables used by awscli and other tools @@ -69,5 +55,3 @@ export TWILIO__API_KEY= export TWILIO__API_SECRET= export TWILIO__DEFAULT_PHONE_FROM= export TWILIO__DEFAULT_PHONE_TO= - -##################################################################### diff --git a/config/scwrypts/env/local.gardevoir b/config/scwrypts/environments/scwrypts/local.gardevoir similarity index 73% rename from config/scwrypts/env/local.gardevoir rename to config/scwrypts/environments/scwrypts/local.gardevoir index 5a8013b..9a85c70 100644 --- a/config/scwrypts/env/local.gardevoir +++ b/config/scwrypts/environments/scwrypts/local.gardevoir @@ -1,20 +1,6 @@ #!/bin/zsh ##################################################################### -### scwrypts runtime configuration ################################## -##################################################################### - -# whether or not to deploy to production (0 = dev (default), 1 = prod) -export IN_PRODUCTION= - -##################################################################### - -# directory containing sound effects -export DESKTOP__SFX_PATH="$HOME/Media/sfx" # from local -export DESKTOP__WALLPAPER_PATH="$HOME/Pictures/bg" # from local - -# home server data -export WRYN__SERVER_HOSTNAMES= - +### scwrypts runtime configuration (group 'scwrypts') ############### ##################################################################### # standard AWS environment variables used by awscli and other tools @@ -66,5 +52,3 @@ export TWILIO__API_KEY= export TWILIO__API_SECRET= export TWILIO__DEFAULT_PHONE_FROM= export TWILIO__DEFAULT_PHONE_TO= - -##################################################################### diff --git a/config/scwrypts/env/local.umbreon b/config/scwrypts/environments/scwrypts/local.umbreon similarity index 74% rename from config/scwrypts/env/local.umbreon rename to config/scwrypts/environments/scwrypts/local.umbreon index 3554325..cbfb8a0 100644 --- a/config/scwrypts/env/local.umbreon +++ b/config/scwrypts/environments/scwrypts/local.umbreon @@ -1,20 +1,6 @@ #!/bin/zsh ##################################################################### -### scwrypts runtime configuration ################################## -##################################################################### - -# whether or not to deploy to production (0 = dev (default), 1 = prod) -export IN_PRODUCTION= - -##################################################################### - -# directory containing sound effects -export DESKTOP__SFX_PATH="$HOME/Media/sfx" # from local -export DESKTOP__WALLPAPER_PATH="$HOME/Pictures/bg" # from local - -# home server data -export WRYN__SERVER_HOSTNAMES= - +### scwrypts runtime configuration (group 'scwrypts') ############### ##################################################################### # standard AWS environment variables used by awscli and other tools @@ -67,5 +53,3 @@ export TWILIO__API_KEY= export TWILIO__API_SECRET= export TWILIO__DEFAULT_PHONE_FROM= export TWILIO__DEFAULT_PHONE_TO= - -##################################################################### diff --git a/scwrypts/.config/env.template b/scwrypts/.config/env.template new file mode 100644 index 0000000..2a29e7f --- /dev/null +++ b/scwrypts/.config/env.template @@ -0,0 +1,4 @@ +#!/bin/zsh +export DESKTOP__SFX_PATH= +export DESKTOP__WALLPAPER_PATH= +export WRYN__SERVER_HOSTNAMES= diff --git a/scwrypts/.config/env.template.descriptions b/scwrypts/.config/env.template.descriptions new file mode 100644 index 0000000..bac40cc --- /dev/null +++ b/scwrypts/.config/env.template.descriptions @@ -0,0 +1,4 @@ +DESKTOP__SFX_PATH | directory containing sound effects +DESKTOP__DESKTOP_PATH | directory containing desktop background images + +WRYN__SERVER_HOSTNAMES | home server data diff --git a/scwrypts/desktop/backlight b/scwrypts/desktop/backlight new file mode 100755 index 0000000..94731b4 --- /dev/null +++ b/scwrypts/desktop/backlight @@ -0,0 +1,73 @@ +#!/bin/zsh +DEPENDENCIES+=() +REQUIRED_ENV+=() + +use desktop/notify --group dotwryn + +CHECK_ENVIRONMENT +##################################################################### + +{ +command -v xbacklight && UTIL=xbacklight +command -v gmux_backlight && UTIL=gmux_backlight +command -v enlighten && UTIL=enlighten +} >/dev/null 2>&1 + +[[ $UTIL =~ ^enlighten$ ]] && { + CURRENT_PERCENT=$(enlighten | sed 's/.*(//;s/%.*//') + [[ $CURRENT_PERCENT -gt 60 ]] && DELTA=20 + [[ $CURRENT_PERCENT -le 60 ]] && DELTA=10 + [[ $CURRENT_PERCENT -le 40 ]] && DELTA=5 + [[ $CURRENT_PERCENT -le 10 ]] && DELTA=1 +} + +case $1 in + up ) + case $UTIL in + xbacklight ) xbacklight + 10 ;; + gmux_backlight ) gmux_backlight +100 ;; + + enlighten ) + [[ $CURRENT_PERCENT -ge 99 ]] && NOTIFY_SEND 'at maximum brightness' && exit 0 + enlighten +${DELTA}% + ;; + esac + ;; + down ) + case $UTIL in + xbacklight ) xbacklight - 10 ;; + gmux_backlight ) gmux_backlight -100 ;; + + enlighten ) + [[ $CURRENT_PERCENT -le 1 ]] && NOTIFY_SEND 'at minimum brightness' && exit 0 + [[ $CURRENT_PERCENT -le 2 ]] && ARGS='=1%' || ARGS="-${DELTA}%" + enlighten "$ARGS" + ;; + esac + ;; + set ) + [ ! $2 ] && FAIL 1 'no value provided to set' + case $UTIL in + xbacklight ) xbacklight -set $2 ;; + gmux_backlight ) gmux_backlight $2 ;; + enlighten ) enlighten "=$2" ;; + esac + ;; + min | minimum ) + case $UTIL in + enlighten ) enlighten '=1%' ;; + esac + ;; + max | maximum ) + case $UTIL in + enlighten ) enlighten '=100%' ;; + esac + ;; + query | '' ) + case $UTIL in + enlighten ) NOTIFY_SUCCESS "current brightness : $(enlighten)" ;; + esac + ;; + + * ) NOTIFY_FAIL 1 "operation '$1' not supported" ;; +esac diff --git a/scwrypts/desktop/get-colorscheme-hex b/scwrypts/desktop/get-colorscheme-hex new file mode 100755 index 0000000..628bd13 --- /dev/null +++ b/scwrypts/desktop/get-colorscheme-hex @@ -0,0 +1,10 @@ +#!/bin/zsh +DEPENDENCIES+=() +REQUIRED_ENV+=() + +use desktop/colorscheme --group dotwryn + +CHECK_ENVIRONMENT +##################################################################### + +GET_COLORSCHEME_HEX $@ diff --git a/scwrypts/desktop/i3/lock b/scwrypts/desktop/i3/lock new file mode 100755 index 0000000..492aa43 --- /dev/null +++ b/scwrypts/desktop/i3/lock @@ -0,0 +1,40 @@ +#!/bin/zsh +DEPENDENCIES+=( + i3lock +) +REQUIRED_ENV+=() + +use desktop/colorscheme --group dotwryn +use desktop/notify --group dotwryn + +CHECK_ENVIRONMENT +##################################################################### + +ARGS=( + --ignore-empty-password + --force-clock + --pass-screen-keys + --pass-media-keys + --pass-volume-keys + --pass-power-keys + --verif-text='' + --wrong-text='' + --blur=11 + --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) + ) + +RADIUS=$(xrandr | grep 'connected primary' | sed 's/.* \([0-9]\+\)x.*/\1/' | awk '{print int($1*0.08)}') +[ $RADIUS ] && ARGS+=(--radius=$RADIUS) + +i3lock ${ARGS[@]} \ + || NOTIFY_ERROR 'i3lock-color' 'something went wrong; unable to lock' \ + ; diff --git a/scwrypts/desktop/i3/logout b/scwrypts/desktop/i3/logout new file mode 100755 index 0000000..ac9cd25 --- /dev/null +++ b/scwrypts/desktop/i3/logout @@ -0,0 +1,16 @@ +#!/bin/zsh +DEPENDENCIES+=( + i3-nagbar +) +REQUIRED_ENV+=() + +use desktop/notify --group dotwryn + +CHECK_ENVIRONMENT +##################################################################### +i3-nagbar \ + -t warning \ + -m 'Do you really want to exit i3?' \ + -B 'Yes' "notify-send 'system' 'exiting i3...' -i face-tired; i3-msg exit" \ + || NOTIFY_ERROR 'unable to launch i3-nagbar' + diff --git a/scwrypts/desktop/i3/set-background b/scwrypts/desktop/i3/set-background new file mode 100755 index 0000000..79b9162 --- /dev/null +++ b/scwrypts/desktop/i3/set-background @@ -0,0 +1,27 @@ +#!/bin/zsh +DEPENDENCIES+=() +REQUIRED_ENV+=( + DESKTOP__WALLPAPER_PATH +) + +CHECK_ENVIRONMENT +##################################################################### + + +[ ! -d $WALLPAPER_PATH ] \ + && FAIL 1 "no such directory for DESKTOP__WALLPAPER_PATH='$DESKTOP__WALLPAPER_PATH'" + +SELECTION="$1" +[ ! $SELECTION ] && SELECTION=random + +case $SELECTION in + random ) + feh --recursive --randomize --bg-fill $WALLPAPER_PATH + ;; + * ) + [ ! -f $DESKTOP__WALLPAPER_PATH/$SELECTION ] \ + && FAIL 2 "no such wallpaper '$SELECTION' in wallpaper path" + + feh --bg-fill $DESKTOP__WALLPAPER_PATH/$SELECTION + ;; +esac diff --git a/scwrypts/desktop/kitty-alternate-theme b/scwrypts/desktop/kitty-alternate-theme new file mode 100755 index 0000000..1a804bd --- /dev/null +++ b/scwrypts/desktop/kitty-alternate-theme @@ -0,0 +1,14 @@ +#!/bin/zsh +DEPENDENCIES+=() +REQUIRED_ENV+=() + +use desktop/colorscheme --group dotwryn + +CHECK_ENVIRONMENT +##################################################################### +SET_THEME alternate +i3-sensible-terminal & +PID=$! +sleep 0.1 +SET_THEME main +wait $! diff --git a/scwrypts/desktop/play-sound b/scwrypts/desktop/play-sound new file mode 100755 index 0000000..c183759 --- /dev/null +++ b/scwrypts/desktop/play-sound @@ -0,0 +1,10 @@ +#!/bin/zsh +DEPENDENCIES+=() +REQUIRED_ENV+=() + +use media/audio --group dotwryn + +CHECK_ENVIRONMENT +##################################################################### + +MEDIA__PLAY_SFX $@ diff --git a/scwrypts/desktop/pulseaudio b/scwrypts/desktop/pulseaudio new file mode 100755 index 0000000..8072e91 --- /dev/null +++ b/scwrypts/desktop/pulseaudio @@ -0,0 +1,46 @@ +#!/bin/zsh +source $HOME/.config/wryn/env.zsh +DEPENDENCIES+=( + pactl +) +REQUIRED_ENV+=() + +use desktop/notify --group dotwryn +use media/audio --group dotwryn + +##################################################################### + +DEVICE="$1" +COMMAND="$2" + +case $DEVICE in + sink ) AMIXER_DEVICE=Master ;; + source ) AMIXER_DEVICE=Capture ;; + * ) NOTIFY_FAIL 1 "Unsupported device '$DEVICE'" ;; +esac + +DEFAULT_DEVICE="@DEFAULT_$(echo $DEVICE | tr '[:lower:]' '[:upper:]')@" +case $COMMAND in + up ) + pactl set-$DEVICE-volume $DEFAULT_DEVICE +10% \ + || NOTIFY_ERROR "pactl error with set-$DEVICE-volume" + + MEDIA__PLAY_SFX volume + ;; + + down ) + pactl set-$DEVICE-volume $DEFAULT_DEVICE -10% \ + || NOTIFY_ERROR "pactl error with set-$DEVICE-volume" + + MEDIA__PLAY_SFX volume + ;; + + mute ) + pactl set-$DEVICE-mute $DEFAULT_DEVICE toggle \ + && NOTIFY_SUCCESS "default $DEVICE" "$(amixer sget $AMIXER_DEVICE | grep -q '\[on\]' && echo unmuted || echo muted)" \ + || NOTIFY_ERROR "pactl error with set-$DEVICE-mute" + MEDIA__PLAY_SFX mute + ;; + + * ) NOTIFY_FAIL 1 "Unsupported command '$COMMAND'" ;; +esac diff --git a/scwrypts/desktop/screen-blank b/scwrypts/desktop/screen-blank new file mode 100755 index 0000000..56cf025 --- /dev/null +++ b/scwrypts/desktop/screen-blank @@ -0,0 +1,52 @@ +#!/bin/zsh +DEPENDENCIES+=(xset) +REQUIRED_ENV+=() + +use desktop/notify --group dotwryn + +CHECK_ENVIRONMENT +##################################################################### + +case $1 in + enable | disable | query | toggle ) ACTION="$1" ;; + * ) + [ ! $1 ] && ACTION=toggle + echo $ACTION + ;; +esac + +[[ $ACTION =~ ^toggle$ ]] && { + xset -q | grep -qi 'prefer blanking: *no' \ + && ACTION='enable' || ACTION='disable' +} + +[ ! $ACTION ] && NOTIFY_FAIL 1 "unknown screen blank action '$1'" + +case $ACTION in + enable ) : \ + && STATUS 'enabling screen blank' \ + && xset +dpms \ + && xset s blank \ + && xset s on \ + && NOTIFY_SUCCESS 'enabled screen blank' \ + || NOTIFY_FAIL 2 'error enabling screen blank' + ;; + + disable ) : \ + && STATUS 'disabling screen blank' \ + && xset dpms 0 0 0 \ + && xset s noblank \ + && xset s off \ + && NOTIFY_SUCCESS 'disabled screen blank' \ + || NOTIFY_FAIL 2 'error disabling screen blank' + ;; + + query ) + xset -q | grep -qi 'prefer blanking: *no' \ + && CURRENT_STATE='disabled' || CURRENT_STATE='enabled' + + [ ! $CURRENT_STATE ] && NOTIFY_FAIL 3 'unable to determine current setting' + + NOTIFY_SUCCESS "screen blank is currently \\033[0;34m$CURRENT_STATE" + ;; +esac diff --git a/scwrypts/dotwryn.scwrypts.zsh b/scwrypts/dotwryn.scwrypts.zsh new file mode 100644 index 0000000..ba899d8 --- /dev/null +++ b/scwrypts/dotwryn.scwrypts.zsh @@ -0,0 +1,7 @@ +SCWRYPTS_GROUPS+=(dotwryn) + +export SCWRYPTS_TYPE__dotwryn=zsh +export SCWRYPTS_ROOT__dotwryn="$DOTWRYN/scwrypts" +export SCWRYPTS_COLOR__dotwryn='\033[0;31m' + +[ $DOTWRYN ] || source "$HOME/.config/wryn/env.zsh" diff --git a/bin/update-all-servers b/scwrypts/home/update-all-servers similarity index 61% rename from bin/update-all-servers rename to scwrypts/home/update-all-servers index 4d6a107..f51fa48 100755 --- a/bin/update-all-servers +++ b/scwrypts/home/update-all-servers @@ -1,6 +1,12 @@ #!/bin/zsh -source "$HOME/.config/wryn/env.zsh" -RELOAD_ZSH_UTILS +DEPENDENCIES+=( + hostnamectl +) +REQUIRED_ENV+=( + WRYN__SERVER_HOSTNAMES +) + +CHECK_ENVIRONMENT ##################################################################### SESSION='update' @@ -14,11 +20,11 @@ CHECK_SESSION() { } UPDATE_ALL() { - __STATUS "starting '$@'" - for SERVER in $(echo $SERVER_LIST); do UPDATE $SERVER "$@"; done + STATUS "starting '$@'" + for SERVER in ${WRYN__SERVER_HOSTNAMES[@]}; do UPDATE $SERVER "$@"; done WAIT_FOR_UPDATES \ - && __SUCCESS "'$@' finished across all servers" \ - || __FAIL 69 'user abort' \ + && SUCCESS "'$@' finished across all servers" \ + || FAIL 69 'user abort' \ ; } @@ -28,7 +34,7 @@ UPDATE() { [[ $2 =~ ^reboot ]] && [[ $SERVER_HOST =~ $LOCAL_HOST ]] && return 0 [[ $SERVER_HOST =~ $LOCAL_HOST ]] || { - COMMAND="ssh -t $SERVER_HOST.lan 'source ~/.zshrc >/dev/null 2>&1; $COMMAND'" + COMMAND="ssh -t $SERVER_HOST.local 'source ~/.zshrc >/dev/null 2>&1; $COMMAND'" } tmux new-window -t $SESSION -n $SERVER_HOST "source ~/.zshrc >/dev/null 2>&1; $COMMAND" @@ -54,30 +60,24 @@ CURRENT_SESSION=$(\ ##################################################################### -CHECK_SESSION && __FAIL 1 'update currently in progress' +CHECK_SESSION && FAIL 1 'update currently in progress' tmux new -d -s $SESSION "echo 'updating all systems'; echo '(leave this window open)'; while true; do sleep 30; done" -__yN 'after update, do you want to reboot all machines?' && REBOOT=1 || REBOOT=0 -__REMINDER -__REMINDER 'manual action is required; (in another tab) connect to tmux:' -__REMINDER "tmux a -t $SESSION" -__REMINDER -__REMINDER 'to stop the update at any time, run:' -__REMINDER "tmux kill-session -t $SESSION" -__REMINDER +yN 'after update, do you want to reboot all machines?' && REBOOT=1 || REBOOT=0 +REMINDER +REMINDER 'manual action is required; (in another tab) connect to tmux:' +REMINDER "tmux a -t $SESSION" +REMINDER +REMINDER 'to stop the update at any time, run:' +REMINDER "tmux kill-session -t $SESSION" +REMINDER [ $CURRENT_SESSION ] && { - __SUCCESS 'currently in a tmux session; opening new window...' + SUCCESS 'currently in a tmux session; opening new window...' tmux new-window -t $CURRENT_SESSION "unset TMUX; tmux a -t $SESSION" } -SERVER_LIST=$( - ls "$DOTWRYN/config/scwrypts/env/" \ - | sed 's/^local//; s/^\.//' \ - | grep . \ -) - UPDATE_ALL 'yay -Syu' UPDATE_ALL 'cd ~/.wryn; git pull --autostash' UPDATE_ALL '~/.wryn/bin/scwrypts config update' @@ -88,10 +88,10 @@ UPDATE_ALL 'command -v i3-msg >/dev/null 2>&1 || exit 0; ~/.wryn/bin/scwrypts i3 [[ $REBOOT -eq 1 ]] && UPDATE_ALL 'reboot || sudo reboot' tmux kill-session -t $SESSION >/dev/null 2>&1 -CHECK_SESSION && __WARNING "unable to close tmux session '$SESSION'" +CHECK_SESSION && WARNING "unable to close tmux session '$SESSION'" -__SUCCESS -__SUCCESS 'finished system update accross all servers' -__SUCCESS +SUCCESS +SUCCESS 'finished system update accross all servers' +SUCCESS -[[ $REBOOT -eq 1 ]] && { __STATUS 'rebooting host machine'; sleep 3; reboot || sudo reboot; } +[[ $REBOOT -eq 1 ]] && { STATUS 'rebooting host machine'; sleep 3; reboot || sudo reboot; } diff --git a/scwrypts/lib/desktop/colorscheme.module.zsh b/scwrypts/lib/desktop/colorscheme.module.zsh new file mode 100644 index 0000000..2a911e0 --- /dev/null +++ b/scwrypts/lib/desktop/colorscheme.module.zsh @@ -0,0 +1,27 @@ +##################################################################### + +DEPENDENCIES+=( + awk sed tr +) +REQUIRED_ENV+=() + +##################################################################### + +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:]' \ + ; +} + +SET_THEME() { + local THEME="$DOTWRYN/colorschemes/kitty.$1" + [ ! -f "$THEME" ] && FAIL 1 "no such theme '$1'" + local LOCAL_THEME="$HOME/.config/kitty/theme.conf" + rm -- $LOCAL_THEME + ln -s "$THEME" "$LOCAL_THEME" +} diff --git a/scwrypts/lib/desktop/notify.module.zsh b/scwrypts/lib/desktop/notify.module.zsh new file mode 100644 index 0000000..3758005 --- /dev/null +++ b/scwrypts/lib/desktop/notify.module.zsh @@ -0,0 +1,19 @@ +##################################################################### + +DEPENDENCIES+=( + notify-send +) +REQUIRED_ENV+=() + +##################################################################### + +NOTIFY_SEND() { notify-send "$SCWRYPT_GROUP : $SCWRYPT_NAME" "$1"; } + +_NOTIFY() { + NOTIFY_SEND "$1 : ${*:2}" + $1 ${@:2} +} + +NOTIFY_SUCCESS() { _NOTIFY SUCCESS $@; } +NOTIFY_ERROR() { _NOTIFY ERROR $@; } +NOTIFY_FAIL() { _NOTIFY FAIL $@; } diff --git a/scwrypts/lib/media/audio.module.zsh b/scwrypts/lib/media/audio.module.zsh new file mode 100644 index 0000000..b1ccf2f --- /dev/null +++ b/scwrypts/lib/media/audio.module.zsh @@ -0,0 +1,38 @@ +##################################################################### + +DEPENDENCIES+=( + canberra-gtk-play +) +REQUIRED_ENV+=() + +use desktop/notify --group dotwryn + +##################################################################### + +MEDIA__PLAY_SFX() { + local SFX_FILE + case $1 in + volume ) SFX_FILE=$DESKTOP__SFX_PATH/yaru-message.oga ;; + mute ) SFX_FILE=$DESKTOP__SFX_PATH/smooth-dialog-warning.oga ;; + backlight ) SFX_FILE=$DESKTOP__SFX_PATH/yaru-audio-volume-change.oga ;; + login ) SFX_FILE=$DESKTOP__SFX_PATH/yaru-desktop-login.oga ;; + logout ) SFX_FILE=$DESKTOP__SFX_PATH/smooth-desktop-login.oga ;; + notify ) SFX_FILE=$DESKTOP__SFX_PATH/yaru-complete.oga ;; + undock ) SFX_FILE=$DESKTOP__SFX_PATH/yaru-desktop-login.oga ;; + homedock ) SFX_FILE=$DESKTOP__SFX_PATH/homedock.oga ;; + gamedock ) SFX_FILE=$DESKTOP__SFX_PATH/gamedock.oga ;; + + * ) SFX_FILE="$1" + ;; + esac + + [ -f $SFX_FILE ] \ + && STATUS "detected file '$SFX_FILE'" \ + || NOTIFY_FAIL 1 "unable to locate sfx file '$1'" \ + ; + + STATUS 'starting playback' + canberra-gtk-play -f "$SFX_FILE" \ + && SUCCESS "finished output of '$SFX_FILE'" \ + || NOTIFY_FAIL 1 "something went wrong playing file '$SFX_FILE'" +} diff --git a/vim/update b/vim/update index 2d087ea..4732dd3 100755 --- a/vim/update +++ b/vim/update @@ -31,12 +31,11 @@ UPDATE() { } VIM_INSTALL() { - "$DOTWRYN/bin/scwrypts" --env local --no-log \ - zsh/git/package/install -- \ - --target-url 'https://github.com/vim/vim.git' \ - --local-name 'vim' \ - --update \ - $@ + scwrypts -n packages/install -- \ + --target-url 'https://github.com/vim/vim.git' \ + --local-name 'vim' \ + --update \ + $@ } VUNDLE_INSTALL() { diff --git a/zsh/plugins/code-activator b/zsh/plugins/code-activator index 854e69c..3b60a91 160000 --- a/zsh/plugins/code-activator +++ b/zsh/plugins/code-activator @@ -1 +1 @@ -Subproject commit 854e69c134da89f41e9149dc3263b6bd86acb947 +Subproject commit 3b60a916f035dd94ea3c779ed36489356026dddd diff --git a/zsh/plugins/scwrypts b/zsh/plugins/scwrypts index 6c546eb..4baacd9 160000 --- a/zsh/plugins/scwrypts +++ b/zsh/plugins/scwrypts @@ -1 +1 @@ -Subproject commit 6c546ebb6fac66b28e1c1d5588a88ca5f78798aa +Subproject commit 4baacd9c3244690945189d935a6f4a57db438187