flattened and using scwrypts in utils

This commit is contained in:
Wryn (yage) Wagner 2022-08-22 21:27:20 -06:00
parent 26571b5dfc
commit 746485e890
11 changed files with 97 additions and 177 deletions

43
bin/i3-utils Executable file
View File

@ -0,0 +1,43 @@
#!/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 ;;
volumeup ) $DOTWRYN/bin/pulseaudio sink up ;;
volumedown ) $DOTWRYN/bin/pulseaudio sink down ;;
volumemute ) $DOTWRYN/bin/pulseaudio sink mute ;;
micmute ) $DOTWRYN/bin/pulseaudio source mute ;;
backlightup ) $DOTWRYN/bin/backlight up ;;
backlightdown ) $DOTWRYN/bin/backlight down ;;
lock ) $DOTWRYN/bin/i3lock ;;
bgrandomize ) $DOTWRYN/bin/set-background random ;;
alternateterm ) $DOTWRYN/bin/kitty-alternate-theme ;;
logout ) $DOTWRYN/bin/i3-logout ;;
launch )
local PROGRAM
local ARGS=()
case $2 in
messages ) PROGRAM=android-messsages-desktop ;;
voice ) PROGRAM=google-voice-desktop ;;
ytmusic ) PROGRAM=youtubemusic-nativefier ;;
scrcpy ) PROGRAM=scrcpy ;;
discord ) PROGRAM=discord ARGS+=(-a) ;;
spotify ) PROGRAM=spotify ARGS+=(-c Spotify) ;;
pavuctrl ) PROGRAM=pavucontrol ARGS+=(-s 0.5 -c '^Pavucontrol') ;;
obs ) PROGRAM=obs ARGS+=(-c '^obs') ;;
* ) PROGRAM=$2 ;;
esac
scwrypts i3/launch-or-show --env local -- $PROGRAM ${ARGS[@]}
;;
esac

View File

@ -1,62 +0,0 @@
#!/bin/zsh
#####################################################################
USAGE="$0 APPLICATION CLIENT_CLASS"
function ERROR() {
local ERROR_CODE=$1
local MESSAGE="$2"
echo -e "$MESSAGE\n\nUSAGE : $USAGE\n" >&2
[ $MESSAGE ] && notify-send "Application Launcher" "$MESSAGE"
exit $ERROR_CODE
}
#####################################################################
APPLICATION="$1"
which $APPLICATION >/dev/null 2>&1 \
|| ERROR 2 "Application '$APPLICATION' not found"
CLIENT_CLASS="${@:2}"
[ ! $CLIENT_CLASS ] && CLIENT_CLASS="$APPLICATION"
ALWAYS_LAUNCH=0
RESIZE=1
XFFSET=0.0
YFFSET=0.0
FACTOR=0.8
xrandr | grep primary | awk '{print $4;}' | grep -q '^3840' \
&& FACTOR=0.5
case $APPLICATION in
pavucontrol ) FACTOR=0.4 YFFSET=200 ;;
discord ) ALWAYS_LAUNCH=1 ;;
android-messages-desktop ) ALWAYS_LAUNCH=1 ;;
scrcpy ) RESIZE=0 ;;
esac
LAUNCH_APP=0
xdotool search --class "$CLIENT_CLASS" || LAUNCH_APP=1
[[ $ALWAYS_LAUNCH -eq 1 ]] && LAUNCH_APP=1
[[ $LAUNCH_APP -eq 1 ]] && {
i3-msg "exec --no-startup-id $APPLICATION;"
sleep .5
}
WINDOW_SIZE=$(\
xrandr \
| grep 'connected primary' \
| sed 's/.*connected primary \([^x]*\)x\([^+]*\).*/\1 \2/' \
| awk -v f=$FACTOR -v x=$XFFSET -v y=$YFFSET \
'{print int($1*f+x)," ",int($2*f+y);}'\
)
i3-msg "[class=$CLIENT_CLASS] move scratchpad"
[[ $RESIZE -eq 1 ]] && i3-msg "[class=$CLIENT_CLASS] resize set $WINDOW_SIZE"
i3-msg "[class=$CLIENT_CLASS] scratchpad show"
i3-msg "[class=$CLIENT_CLASS] move position center"

View File

@ -1,59 +0,0 @@
#!/bin/zsh
source "$HOME/.config/wryn/env.zsh"
source $ZSH_COLOR_UTIL
#####################################################################
GLOBAL_FONT_SIZE="$1"
DMENU_FONT_SIZE="$2"
BORDER_PIXEL_SIZE="$3"
[ ! $GLOBAL_FONT_SIZE ] && GLOBAL_FONT_SIZE=$I3__GLOBAL_FONT_SIZE
[ ! $DMENU_FONT_SIZE ] && DMENU_FONT_SIZE=$I3__DMENU_FONT_SIZE
[ ! $BORDER_PIXEL_SIZE ] && BORDER_PIXEL_SIZE=$I3__BORDER_PIXEL_SIZE
LOCAL_CONFIG="$HOME/.config/i3/config"
MODEL_CONFIG="$DOTWRYN/config/i3.conf"
REGEX_FONT='^\(font [^0-9]*\)\(.*\)'
REGEX_DMENU="^\\(.*dmenu_run .*-fn '[^0-9]*\\)\\([0-9]*\\)'"
REGEX_BORDER='^\(for_window.*border pixel \)\(.*\)'
DEFAULT_GLOBAL_FONT_SIZE=$(sed -n "s/$REGEX_FONT/\\2/p" $MODEL_CONFIG)
DEFAULT_DMENU_FONT_SIZE=$(sed -n "s/$REGEX_DMENU/\\2/p" $MODEL_CONFIG)
DEFAULT_BORDER_PIXEL_SIZE=$(sed -n "s/$REGEX_BORDER/\\2/p" $MODEL_CONFIG)
#####################################################################
RESET_CONFIG_TO_DEFAULT() {
STATUS 'relinking default config'
ln -s $MODEL_CONFIG $LOCAL_CONFIG
}
UPDATE_CONFIG() {
[ ! $GLOBAL_FONT_SIZE ] && GLOBAL_FONT_SIZE=$DEFAULT_GLOBAL_FONT_SIZE
[ ! $DMENU_FONT_SIZE ] && DMENU_FONT_SIZE=$DEFAULT_DMENU_FONT_SIZE
[ ! $BORDER_PIXEL_SIZE ] && BORDER_PIXEL_SIZE=$DEFAULT_BORDER_PIXEL_SIZE
STATUS 'updating config with the following settings:'
MENU "GLOBAL_FONT_SIZE : $GLOBAL_FONT_SIZE"
MENU "DMENU_FONT_SIZE : $DMENU_FONT_SIZE"
MENU "BORDER_PIXEL_SIZE : $BORDER_PIXEL_SIZE"
sed "\
s/$REGEX_FONT/\\1$GLOBAL_FONT_SIZE/;\
s/$REGEX_DMENU/\\1$DMENU_FONT_SIZE'/;\
s/$REGEX_BORDER/\\1$BORDER_PIXEL_SIZE/;\
" $MODEL_CONFIG > $LOCAL_CONFIG
}
#####################################################################
[ -f $LOCAL_CONFIG ] && rm $LOCAL_CONFIG
[ ! $GLOBAL_FONT_SIZE ] && [ ! $DMENU_FONT_SIZE ] && [ ! $BORDER_PIXEL_SIZE ] \
&& RESET_CONFIG_TO_DEFAULT 2>/dev/null \
|| UPDATE_CONFIG 2>/dev/null \
;
return 0

View File

@ -1,27 +0,0 @@
#!/bin/zsh
source "$HOME/.config/wryn/env.zsh"
COMMAND=$1
case $COMMAND in
next ) $DOTWRYN/bin/youtube-music next ;;
prev ) $DOTWRYN/bin/youtube-music prev ;;
play ) $DOTWRYN/bin/youtube-music 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 ;;
backlightup ) $DOTWRYN/bin/backlight up ;;
backlightdown ) $DOTWRYN/bin/backlight down ;;
lock ) $DOTWRYN/bin/i3lock ;;
bgrandomize ) $DOTWRYN/bin/set-background random ;;
alternateterm ) $DOTWRYN/bin/kitty/alternate-theme ;;
logout ) $DOTWRYN/bin/i3/logout ;;
launch ) $DOTWRYN/bin/i3/launch-or-show ${@:2} ;;
esac

View File

@ -3,8 +3,10 @@
##################################################################### #####################################################################
export DOTWRYN="$HOME/.wryn" export DOTWRYN="$HOME/.wryn"
export SFX_PATH="$HOME/Media/sfx" export SFX_PATH="$HOME/Media/sfx"
export WALLPAPER_PATH="$HOME/Pictures/bg" export WALLPAPER_PATH="$HOME/Pictures/bg"
export SOURCE_PACKAGES="$HOME/.local/share/source-packages" export SOURCE_PACKAGES="$HOME/.local/share/source-packages"
##################################################################### #####################################################################
@ -13,17 +15,8 @@ export SOURCE_PACKAGES="$HOME/.local/share/source-packages"
export PREFERRED_EDITOR=(vim vi) export PREFERRED_EDITOR=(vim vi)
# should play an audio file argument
MEDIA_ENGINE='canberra-gtk-play -f'
PLAY_SFX () { $DOTWRYN/bin/play-sound $@ >/dev/null 2>&1; }
RIPGREP_CONFIG_PATH="$HOME/.config/ripgrep/config" RIPGREP_CONFIG_PATH="$HOME/.config/ripgrep/config"
TMUX_DEFAULT_SESSION_NAME='wryn' TMUX_DEFAULT_SESSION_NAME='wryn'
WEBBROWSER='google-chrome-stable'
#I3__GLOBAL_FONT_SIZE=
#I3__DMENU_FONT_SIZE=
#I3__BORDER_PIXEL_SIZE=
PS1_BRANCH_SYMBOL='' PS1_BRANCH_SYMBOL=''
PS1_INDICATOR_SYMBOL='☕' PS1_INDICATOR_SYMBOL='☕'
@ -34,27 +27,57 @@ WELCOME () {
{ figlet 'Welcome, beautiful'; cowsay -p 'damn u sexy'; } | lolcat { 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 ##################################### ### External Plugins / Settings #####################################
##################################################################### #####################################################################
EXTERNAL_PLUGINS=( # fzf
EXTERNAL_PLUGINS+=(
'/usr/share/fzf/key-bindings.zsh' '/usr/share/fzf/key-bindings.zsh'
'/usr/share/fzf/completion.zsh' '/usr/share/fzf/completion.zsh'
"$DOTWRYN/zsh/plugins/z/z.sh" )
"$DOTWRYN/zsh/plugins/fzf-tab/fzf-tab.plugin.zsh"
"$DOTWRYN/zsh/plugins/code-activator/activator.plugin.zsh"
"$DOTWRYN/zsh/plugins/scwrypts/scwrypts.plugin.zsh"
"$DOTWRYN/zsh/plugins/ssh/ssh.plugin.zsh"
)
export SCWRYPTS_ENV='local'
FZF_DEFAULT_OPTS='--reverse' FZF_DEFAULT_OPTS='--reverse'
FZF_DEFAULT_COMMAND='rg --files' FZF_DEFAULT_COMMAND='rg --files'
# fzf-tab
EXTERNAL_PLUGINS+=("$DOTWRYN/zsh/plugins/fzf-tab/fzf-tab.plugin.zsh")
zstyle ':fzf-tab:*' accept-line enter zstyle ':fzf-tab:*' accept-line enter
zstyle ':fzf-tab:*' fzf-bindings 'space:accept' ';:toggle' zstyle ':fzf-tab:*' fzf-bindings 'space:accept' ';:toggle'
zstyle ':fzf-tab:*' continuous-trigger '/' zstyle ':fzf-tab:*' continuous-trigger '/'
LOAD_ZSH_UTILS() { source "$DOTWRYN/zsh/plugins/scwrypts/zsh/utils/utils.module.zsh"; }
# scwrypts
EXTERNAL_PLUGINS+=("$DOTWRYN/zsh/plugins/scwrypts/scwrypts.plugin.zsh")
export SCWRYPTS_ENV="local.$(hostnamectl --static)"
[ ! -f $HOME/.config/scwrypts/env/$SCWRYPTS_ENV ] && export SCWRYPTS_ENV='local'
export S3_SYNC_MEDIA=(
#'.local/share/dolphin-emu'
#'Documents'
#'Games/roms'
#'Games/wrynscape'
'.porn'
'Documents'
'Media'
'Pictures'
)
# z
EXTERNAL_PLUGINS+=("$DOTWRYN/zsh/plugins/z/z.sh")
# code-activator
EXTERNAL_PLUGINS+=("$DOTWRYN/zsh/plugins/code-activator/activator.plugin.zsh")
# ssh
EXTERNAL_PLUGINS+=("$DOTWRYN/zsh/plugins/ssh/ssh.plugin.zsh")

View File

@ -28,13 +28,14 @@ bindsym XF86MonBrightnessUp exec --no-startup-id $UTILS backlightup
bindsym XF86MonBrightnessDown exec --no-startup-id $UTILS backlightdown bindsym XF86MonBrightnessDown exec --no-startup-id $UTILS backlightdown
# Quick applications # Quick applications
bindsym $mod+Shift+m exec --no-startup-id $UTILS launch android-messages-desktop bindsym $mod+Shift+m exec --no-startup-id $UTILS launch messages
bindsym $mod+Shift+d exec --no-startup-id $UTILS launch discord bindsym $mod+Shift+d exec --no-startup-id $UTILS launch discord
bindsym $mod+c exec --no-startup-id $UTILS launch google-voice-desktop bindsym $mod+c exec --no-startup-id $UTILS launch voice
bindsym $mod+m exec --no-startup-id $UTILS launch youtubemusic-nativefier bindsym $mod+m exec --no-startup-id $UTILS launch ytmusic
bindsym $mod+a exec --no-startup-id $UTILS launch pavucontrol ^Pavucontrol bindsym $mod+Shift+s exec --no-startup-id $UTILS launch spotify
bindsym $mod+a exec --no-startup-id $UTILS launch pavuctrl
bindsym $mod+Shift+p exec --no-startup-id $UTILS launch scrcpy bindsym $mod+Shift+p exec --no-startup-id $UTILS launch scrcpy
bindsym $mod+Shift+o exec --no-startup-id $UTILS launch obs ^obs bindsym $mod+Shift+o exec --no-startup-id $UTILS launch obs
# Terminal # Terminal
bindsym $mod+Return exec i3-sensible-terminal bindsym $mod+Return exec i3-sensible-terminal

View File

@ -36,4 +36,5 @@ $DOTWRYN/config/xconfig.conf X11/xconfig
$DOTWRYN/config/xinitrc X11/xinitrc $DOTWRYN/config/xinitrc X11/xinitrc
$DOTWRYN/bin/scwrypts ../.local/bin/scwrypts $DOTWRYN/bin/scwrypts ../.local/bin/scwrypts
$DOTWRYN/bin/vim ../.local/bin/vim $DOTWRYN/bin/vim ../.local/bin/vim
$DOTWRYN/bin/$(hostnamectl --static) ../.$(hostnamectl --static)
" "

View File

@ -13,9 +13,9 @@ export AWS__S3__MEDIA_BUCKET=yage # inherited from local
export AWS__S3__MEDIA_TARGETS=($S3_SYNC_MEDIA) # inherited from local export AWS__S3__MEDIA_TARGETS=($S3_SYNC_MEDIA) # inherited from local
# custom i3 configuration settings # custom i3 configuration settings
export I3__BORDER_PIXEL_SIZE= export I3__BORDER_PIXEL_SIZE=7
export I3__DMENU_FONT_SIZE= export I3__DMENU_FONT_SIZE=20
export I3__GLOBAL_FONT_SIZE= export I3__GLOBAL_FONT_SIZE=1
export I3__MODEL_CONFIG=$DOTWRYN/config/i3.conf # inherited from local export I3__MODEL_CONFIG=$DOTWRYN/config/i3.conf # inherited from local
# redis connection credentials # redis connection credentials

View File

@ -1,7 +1,7 @@
#!/bin/zsh #!/bin/zsh
source "$HOME/.config/wryn/env.zsh" source "$HOME/.config/wryn/env.zsh"
export PATH="$DOTWRYN/bin/xorg/$(hostnamectl --static):$PATH" export PATH="$DOTWRYN/bin/$(hostnamectl --static):$PATH"
for SCRIPT in $(find /etc/x11/xinit/xinitrc.d); do source $SCRIPT; done for SCRIPT in $(find /etc/x11/xinit/xinitrc.d); do source $SCRIPT; done
command -v dex && dex -a command -v dex && dex -a

@ -1 +1 @@
Subproject commit 710d42e2481e653c4cbfb07e90724e0410488f97 Subproject commit 244c188deb9efaab154cfd3c29a35e21f2b149d4