scwrypts v4 compatibility
This commit is contained in:
parent
fab3d7c54e
commit
a7590c1b84
@ -1,17 +1,13 @@
|
||||
#!/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
|
||||
MAIN() {
|
||||
local UTIL
|
||||
for UTIL in enlighten gmux_backlight xbacklight
|
||||
do
|
||||
command -v $UTIL >/dev/null 2>&1 && break
|
||||
done
|
||||
|
||||
[[ $UTIL =~ ^enlighten$ ]] && {
|
||||
CURRENT_PERCENT=$(enlighten | sed 's/.*(//;s/%.*//')
|
||||
@ -71,3 +67,4 @@ case $1 in
|
||||
|
||||
* ) NOTIFY_FAIL 1 "operation '$1' not supported" ;;
|
||||
esac
|
||||
}
|
||||
|
@ -1,16 +1,7 @@
|
||||
#!/bin/zsh
|
||||
DEPENDENCIES+=()
|
||||
REQUIRED_ENV+=()
|
||||
|
||||
use desktop/colorscheme --group dotwryn
|
||||
|
||||
CHECK_ENVIRONMENT
|
||||
#####################################################################
|
||||
|
||||
MAIN() {
|
||||
unset USAGE
|
||||
GET_COLORSCHEME_HEX $@
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
MAIN $@
|
||||
|
@ -1,16 +1,7 @@
|
||||
#!/bin/zsh
|
||||
DEPENDENCIES+=()
|
||||
REQUIRED_ENV+=()
|
||||
|
||||
use desktop/colorscheme --group dotwryn
|
||||
|
||||
CHECK_ENVIRONMENT
|
||||
#####################################################################
|
||||
|
||||
MAIN() {
|
||||
unset USAGE
|
||||
SET_THEME $@
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
MAIN $@
|
||||
|
@ -1,29 +1,16 @@
|
||||
#!/bin/zsh
|
||||
DEPENDENCIES+=(
|
||||
diff
|
||||
)
|
||||
REQUIRED_ENV+=(
|
||||
I3__MODEL_CONFIG
|
||||
)
|
||||
|
||||
CHECK_ENVIRONMENT
|
||||
DEPENDENCIES+=(diff)
|
||||
REQUIRED_ENV+=(I3__MODEL_CONFIG)
|
||||
#####################################################################
|
||||
|
||||
REGEX_FONT='^\(font [^0-9]*\)\(.*\)'
|
||||
REGEX_DMENU="^\\(.*dmenu_run .*-fn '[^0-9]*\\)\\([0-9]*\\)'"
|
||||
REGEX_BORDER='^\(for_window.*border pixel \)\(.*\)'
|
||||
|
||||
INSTALL() {
|
||||
local USAGE="
|
||||
USAGE="
|
||||
usage: [...options...]
|
||||
|
||||
options
|
||||
options:
|
||||
-f, --force force replacement of existing i3config
|
||||
-n, --no-link if output config and template are the same, don't create link
|
||||
|
||||
-h, --help print this message and exit
|
||||
|
||||
environment
|
||||
environment:
|
||||
I3__MODEL_CONFIG fully-qualified path to sourced i3config
|
||||
I3__GLOBAL_FONT_SIZE global font size
|
||||
I3__DMENU_FONT_SIZE (optional) font size for 'dmenu' command
|
||||
@ -35,6 +22,14 @@ INSTALL() {
|
||||
font size, I run this command to update those variables on a local
|
||||
copy of my sourced config
|
||||
"
|
||||
|
||||
#####################################################################
|
||||
|
||||
REGEX_FONT='^\(font [^0-9]*\)\(.*\)'
|
||||
REGEX_DMENU="^\\(.*dmenu_run .*-fn '[^0-9]*\\)\\([0-9]*\\)'"
|
||||
REGEX_BORDER='^\(for_window.*border pixel \)\(.*\)'
|
||||
|
||||
MAIN() {
|
||||
local FORCE=0
|
||||
local AUTOLINK=1
|
||||
while [[ $# -gt 0 ]]
|
||||
@ -84,19 +79,16 @@ INSTALL() {
|
||||
[ -f "$CONFIG_FILE.bak" ] \
|
||||
&& diff "$CONFIG_FILE" "$CONFIG_FILE.bak" -q >/dev/null \
|
||||
&& mv "$CONFIG_FILE.bak" "$CONFIG_FILE" \
|
||||
&& INFO "no changes were made" \
|
||||
&& DEBUG "no changes were made" \
|
||||
;
|
||||
|
||||
[[ $AUTOLINK -eq 1 ]] \
|
||||
&& diff "$CONFIG_FILE" "$I3__MODEL_CONFIG" -q >/dev/null \
|
||||
&& rm "$CONFIG_FILE" \
|
||||
&& ln -s "$I3__MODEL_CONFIG" "$CONFIG_FILE" \
|
||||
&& INFO "output is the same as model, i3config has been linked to model" \
|
||||
&& DEBUG "output is the same as model, i3config has been linked to model" \
|
||||
;
|
||||
|
||||
[[ $FORCE -eq 1 ]] && rm "$CONFIG.bak" >/dev/null 2>&1
|
||||
return 0
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
INSTALL $@
|
||||
|
@ -1,19 +1,10 @@
|
||||
#!/bin/zsh
|
||||
DEPENDENCIES+=(
|
||||
i3-msg
|
||||
xdotool
|
||||
xrandr
|
||||
)
|
||||
REQUIRED_ENV+=()
|
||||
|
||||
use system/desktop/notify
|
||||
|
||||
CHECK_ENVIRONMENT
|
||||
DEPENDENCIES+=(i3-msg xdotool xrandr)
|
||||
#####################################################################
|
||||
|
||||
LAUNCH_OR_SHOW() {
|
||||
INFO $@
|
||||
local USAGE="
|
||||
USAGE="
|
||||
usage: <path-executable> [client-class] [...options...]
|
||||
|
||||
options
|
||||
@ -40,6 +31,11 @@ LAUNCH_OR_SHOW() {
|
||||
3) (toggle) hides all visible instances
|
||||
4) (toggle) shows all scratchpad-hidden instances
|
||||
"
|
||||
|
||||
#####################################################################
|
||||
|
||||
MAIN() {
|
||||
DEBUG $@
|
||||
local APPLICATION CLIENT_CLASS
|
||||
|
||||
local XFFSET=0.0
|
||||
@ -112,7 +108,7 @@ LAUNCH_OR_SHOW() {
|
||||
| awk -v f=$SCALE -v x=$XFFSET -v y=$YFFSET \
|
||||
'{print int($1*f+x)," ",int($2*f+y);}'\
|
||||
)
|
||||
INFO "window size: $WINDOW_SIZE"
|
||||
DEBUG "window size: $WINDOW_SIZE"
|
||||
|
||||
STATUS 'moving window to scratchpad'
|
||||
i3-msg "[class=$CLIENT_CLASS] move scratchpad"
|
||||
@ -131,6 +127,3 @@ LAUNCH_OR_SHOW() {
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
LAUNCH_OR_SHOW $@
|
||||
|
@ -1,16 +1,12 @@
|
||||
#!/bin/zsh
|
||||
DEPENDENCIES+=(
|
||||
i3lock
|
||||
)
|
||||
REQUIRED_ENV+=()
|
||||
|
||||
use desktop/colorscheme --group dotwryn
|
||||
use desktop/notify --group dotwryn
|
||||
|
||||
CHECK_ENVIRONMENT
|
||||
DEPENDENCIES+=(i3lock)
|
||||
#####################################################################
|
||||
|
||||
ARGS=(
|
||||
MAIN() {
|
||||
local ARGS=(
|
||||
--ignore-empty-password
|
||||
--force-clock
|
||||
--pass-screen-keys
|
||||
@ -32,9 +28,10 @@ ARGS=(
|
||||
--bshl-color=$(GET_COLORSCHEME_HEX 13)
|
||||
)
|
||||
|
||||
RADIUS=$(xrandr | grep 'connected primary' | sed 's/.* \([0-9]\+\)x.*/\1/' | awk '{print int($1*0.08)}')
|
||||
local 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' \
|
||||
;
|
||||
}
|
||||
|
@ -1,16 +1,13 @@
|
||||
#!/bin/zsh
|
||||
DEPENDENCIES+=(
|
||||
i3-nagbar
|
||||
)
|
||||
REQUIRED_ENV+=()
|
||||
|
||||
use desktop/notify --group dotwryn
|
||||
|
||||
CHECK_ENVIRONMENT
|
||||
DEPENDENCIES+=(i3-nagbar)
|
||||
#####################################################################
|
||||
|
||||
MAIN() {
|
||||
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'
|
||||
|
||||
}
|
||||
|
@ -1,13 +1,8 @@
|
||||
#!/bin/zsh
|
||||
DEPENDENCIES+=()
|
||||
REQUIRED_ENV+=(
|
||||
DESKTOP__WALLPAPER_PATH
|
||||
)
|
||||
|
||||
CHECK_ENVIRONMENT
|
||||
REQUIRED_ENV+=(DESKTOP__WALLPAPER_PATH)
|
||||
#####################################################################
|
||||
|
||||
|
||||
MAIN() {
|
||||
[ ! -d $WALLPAPER_PATH ] \
|
||||
&& FAIL 1 "no such directory for DESKTOP__WALLPAPER_PATH='$DESKTOP__WALLPAPER_PATH'"
|
||||
|
||||
@ -25,3 +20,4 @@ case $SELECTION in
|
||||
feh --bg-fill $DESKTOP__WALLPAPER_PATH/$SELECTION
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
@ -1,10 +1,7 @@
|
||||
#!/bin/zsh
|
||||
DEPENDENCIES+=()
|
||||
REQUIRED_ENV+=()
|
||||
|
||||
use media/audio --group dotwryn
|
||||
|
||||
CHECK_ENVIRONMENT
|
||||
#####################################################################
|
||||
|
||||
MAIN() {
|
||||
MEDIA__PLAY_SFX $@
|
||||
}
|
||||
|
@ -1,10 +1,7 @@
|
||||
#!/bin/zsh
|
||||
DEPENDENCIES+=()
|
||||
REQUIRED_ENV+=()
|
||||
|
||||
use desktop/pulse-audio --group dotwryn
|
||||
|
||||
CHECK_ENVIRONMENT
|
||||
#####################################################################
|
||||
|
||||
MAIN() {
|
||||
PA__SET_DEFAULT_AUDIO $@
|
||||
}
|
||||
|
@ -1,17 +1,15 @@
|
||||
#!/bin/zsh
|
||||
source $HOME/.config/wryn/env.zsh
|
||||
DEPENDENCIES+=(
|
||||
pactl
|
||||
)
|
||||
REQUIRED_ENV+=()
|
||||
|
||||
use desktop/notify --group dotwryn
|
||||
use media/audio --group dotwryn
|
||||
|
||||
DEPENDENCIES+=(pactl)
|
||||
|
||||
source $HOME/.config/wryn/env.zsh
|
||||
#####################################################################
|
||||
|
||||
DEVICE="$1"
|
||||
COMMAND="$2"
|
||||
MAIN() {
|
||||
local DEVICE="$1"
|
||||
local COMMAND="$2"
|
||||
|
||||
case $DEVICE in
|
||||
sink ) AMIXER_DEVICE=Master ;;
|
||||
@ -19,7 +17,7 @@ case $DEVICE in
|
||||
* ) NOTIFY_FAIL 1 "Unsupported device '$DEVICE'" ;;
|
||||
esac
|
||||
|
||||
DEFAULT_DEVICE="@DEFAULT_$(echo $DEVICE | tr '[:lower:]' '[:upper:]')@"
|
||||
local DEFAULT_DEVICE="@DEFAULT_$(echo $DEVICE | tr '[:lower:]' '[:upper:]')@"
|
||||
case $COMMAND in
|
||||
up )
|
||||
pactl set-$DEVICE-volume $DEFAULT_DEVICE +10% \
|
||||
@ -44,3 +42,4 @@ case $COMMAND in
|
||||
|
||||
* ) NOTIFY_FAIL 1 "Unsupported command '$COMMAND'" ;;
|
||||
esac
|
||||
}
|
||||
|
@ -1,12 +1,10 @@
|
||||
#!/bin/zsh
|
||||
DEPENDENCIES+=(xset)
|
||||
REQUIRED_ENV+=()
|
||||
|
||||
use desktop/notify --group dotwryn
|
||||
|
||||
CHECK_ENVIRONMENT
|
||||
DEPENDENCIES+=(xset)
|
||||
#####################################################################
|
||||
|
||||
MAIN() {
|
||||
case $1 in
|
||||
enable | disable | query | toggle ) ACTION="$1" ;;
|
||||
* )
|
||||
@ -50,3 +48,4 @@ case $ACTION in
|
||||
NOTIFY_SUCCESS "screen blank is currently \\033[0;34m$CURRENT_STATE"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
@ -1,10 +1,7 @@
|
||||
#!/bin/zsh
|
||||
DEPENDENCIES+=()
|
||||
REQUIRED_ENV+=()
|
||||
|
||||
use desktop/xrandr --group dotwryn
|
||||
|
||||
CHECK_ENVIRONMENT
|
||||
#####################################################################
|
||||
|
||||
MAIN() {
|
||||
XRANDR__DISCONNECT_ALL_DISPLAYS $@
|
||||
}
|
||||
|
@ -1,12 +1,6 @@
|
||||
#!/bin/zsh
|
||||
DEPENDENCIES+=(
|
||||
hostnamectl
|
||||
)
|
||||
REQUIRED_ENV+=(
|
||||
WRYN__SERVER_HOSTNAMES
|
||||
)
|
||||
|
||||
CHECK_ENVIRONMENT
|
||||
DEPENDENCIES+=(hostnamectl)
|
||||
REQUIRED_ENV+=(WRYN__SERVER_HOSTNAMES)
|
||||
#####################################################################
|
||||
|
||||
SESSION='update'
|
||||
@ -60,18 +54,19 @@ CURRENT_SESSION=$(\
|
||||
|
||||
#####################################################################
|
||||
|
||||
MAIN() {
|
||||
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
|
||||
REMINDER "
|
||||
manual action is required; (in another tab) connect to tmux:
|
||||
tmux a -t $SESSION
|
||||
|
||||
to stop the update at any time, run:
|
||||
tmux kill-session -t $SESSION
|
||||
"
|
||||
|
||||
[ $CURRENT_SESSION ] && {
|
||||
SUCCESS 'currently in a tmux session; opening new window...'
|
||||
@ -90,8 +85,7 @@ UPDATE_ALL 'command -v i3-msg >/dev/null 2>&1 || exit 0; ~/.wryn/bin/scwrypts i3
|
||||
tmux kill-session -t $SESSION >/dev/null 2>&1
|
||||
CHECK_SESSION && WARNING "unable to close tmux session '$SESSION'"
|
||||
|
||||
SUCCESS
|
||||
SUCCESS 'finished system update accross all servers'
|
||||
SUCCESS
|
||||
SUCCESS " \nfinished system update accross all servers\n "
|
||||
|
||||
[[ $REBOOT -eq 1 ]] && { STATUS 'rebooting host machine'; sleep 3; reboot || sudo reboot; }
|
||||
}
|
||||
|
@ -1,13 +1,6 @@
|
||||
#!/bin/zsh
|
||||
#####################################################################
|
||||
|
||||
DEPENDENCIES+=()
|
||||
REQUIRED_ENV+=()
|
||||
|
||||
use ssh --group remote
|
||||
|
||||
CHECK_ENVIRONMENT
|
||||
|
||||
#####################################################################
|
||||
|
||||
REMOTE__LOGIN $@
|
||||
|
@ -1,13 +1,6 @@
|
||||
#!/bin/zsh
|
||||
#####################################################################
|
||||
|
||||
DEPENDENCIES+=()
|
||||
REQUIRED_ENV+=()
|
||||
|
||||
use tmux --group remote
|
||||
|
||||
CHECK_ENVIRONMENT
|
||||
|
||||
#####################################################################
|
||||
|
||||
REMOTE_CONNECT_TMUX $@
|
||||
|
@ -1,13 +1,6 @@
|
||||
#!/bin/zsh
|
||||
#####################################################################
|
||||
|
||||
DEPENDENCIES+=()
|
||||
REQUIRED_ENV+=()
|
||||
|
||||
use ssh --group remote
|
||||
|
||||
CHECK_ENVIRONMENT
|
||||
|
||||
#####################################################################
|
||||
|
||||
REMOTE_ARGS=(-Y) REMOTE__LOGIN $@
|
||||
|
@ -1,13 +1,9 @@
|
||||
#!/bin/zsh
|
||||
|
||||
#####################################################################
|
||||
|
||||
DEPENDENCIES+=(
|
||||
tmux
|
||||
hostnamectl
|
||||
scwrypts # must be on path
|
||||
)
|
||||
REQUIRED_ENV+=()
|
||||
|
||||
CHECK_ENVIRONMENT
|
||||
|
||||
|
@ -1,12 +1,5 @@
|
||||
#!/bin/zsh
|
||||
|
||||
#####################################################################
|
||||
|
||||
DEPENDENCIES+=()
|
||||
REQUIRED_ENV+=()
|
||||
|
||||
CHECK_ENVIRONMENT
|
||||
|
||||
#####################################################################
|
||||
|
||||
[[ $TERM =~ tmux ]] && FAIL 69 "\n Cannot run tmux-omni within a tmux session!\n "
|
||||
|
Loading…
Reference in New Issue
Block a user