scwrypts v4 compatibility
This commit is contained in:
parent
fab3d7c54e
commit
a7590c1b84
@ -1,73 +1,70 @@
|
||||
#!/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/%.*//')
|
||||
[[ $CURRENT_PERCENT -gt 60 ]] && DELTA=20
|
||||
[[ $CURRENT_PERCENT -le 60 ]] && DELTA=10
|
||||
[[ $CURRENT_PERCENT -le 40 ]] && DELTA=5
|
||||
[[ $CURRENT_PERCENT -le 10 ]] && DELTA=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
|
||||
}
|
||||
|
||||
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
|
||||
|
@ -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,40 +1,35 @@
|
||||
#!/bin/zsh
|
||||
DEPENDENCIES+=(
|
||||
diff
|
||||
)
|
||||
REQUIRED_ENV+=(
|
||||
I3__MODEL_CONFIG
|
||||
)
|
||||
DEPENDENCIES+=(diff)
|
||||
REQUIRED_ENV+=(I3__MODEL_CONFIG)
|
||||
#####################################################################
|
||||
|
||||
USAGE="
|
||||
usage: [...options...]
|
||||
|
||||
options:
|
||||
-f, --force force replacement of existing i3config
|
||||
-n, --no-link if output config and template are the same, don't create link
|
||||
|
||||
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
|
||||
I3__BORDER_PIXEL_SIZE (optional) pixel-width of window borders
|
||||
|
||||
I3 provides no way to include dynamic variables in your config.
|
||||
The main difference I want between my i3 configurations is font-size
|
||||
to match the current monitor. Since i3-msg provides no way to change
|
||||
font size, I run this command to update those variables on a local
|
||||
copy of my sourced config
|
||||
"
|
||||
|
||||
CHECK_ENVIRONMENT
|
||||
#####################################################################
|
||||
|
||||
REGEX_FONT='^\(font [^0-9]*\)\(.*\)'
|
||||
REGEX_DMENU="^\\(.*dmenu_run .*-fn '[^0-9]*\\)\\([0-9]*\\)'"
|
||||
REGEX_BORDER='^\(for_window.*border pixel \)\(.*\)'
|
||||
|
||||
INSTALL() {
|
||||
local USAGE="
|
||||
usage: [...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
|
||||
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
|
||||
I3__BORDER_PIXEL_SIZE (optional) pixel-width of window borders
|
||||
|
||||
I3 provides no way to include dynamic variables in your config.
|
||||
The main difference I want between my i3 configurations is font-size
|
||||
to match the current monitor. Since i3-msg provides no way to change
|
||||
font size, I run this command to update those variables on a local
|
||||
copy of my sourced config
|
||||
"
|
||||
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,45 +1,41 @@
|
||||
#!/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: <path-executable> [client-class] [...options...]
|
||||
USAGE="
|
||||
usage: <path-executable> [client-class] [...options...]
|
||||
|
||||
options
|
||||
-c, --client <string> if different from the executable name, xprop CLIENT_CLASS
|
||||
options
|
||||
-c, --client <string> if different from the executable name, xprop CLIENT_CLASS
|
||||
|
||||
-s, --scale <value> (default: 0.8 or 0.5 if screen width >3000px)
|
||||
-x, --x-offset <value> (default: 0.0)
|
||||
-y, --y-offset <value> (default: 0.0)
|
||||
-s, --scale <value> (default: 0.8 or 0.5 if screen width >3000px)
|
||||
-x, --x-offset <value> (default: 0.0)
|
||||
-y, --y-offset <value> (default: 0.0)
|
||||
|
||||
-a, --always-launch invoke executable even if client-class exists
|
||||
-n, --no-resize don't resize the window (ignores -sxy flags)
|
||||
-l, --no-center leave the window wherever it was last positioned
|
||||
-a, --always-launch invoke executable even if client-class exists
|
||||
-n, --no-resize don't resize the window (ignores -sxy flags)
|
||||
-l, --no-center leave the window wherever it was last positioned
|
||||
|
||||
--has-statusbar-icon (default: false) use if program has a statusbar icon
|
||||
--has-statusbar-icon (default: false) use if program has a statusbar icon
|
||||
|
||||
-h, --help print this message and exit
|
||||
-h, --help print this message and exit
|
||||
|
||||
Makes it easy to bind appications to key shortcuts without having to
|
||||
spin up redundant instances or cycle through the scratchpad queue.
|
||||
Makes it easy to bind appications to key shortcuts without having to
|
||||
spin up redundant instances or cycle through the scratchpad queue.
|
||||
|
||||
Performs a variety of tasks based on states:
|
||||
1) starts and application
|
||||
2) adds all instances of the specified application to the scratchpad
|
||||
3) (toggle) hides all visible instances
|
||||
4) (toggle) shows all scratchpad-hidden instances
|
||||
"
|
||||
Performs a variety of tasks based on states:
|
||||
1) starts and application
|
||||
2) adds all instances of the specified application to the scratchpad
|
||||
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,40 +1,37 @@
|
||||
#!/bin/zsh
|
||||
DEPENDENCIES+=(
|
||||
i3lock
|
||||
)
|
||||
REQUIRED_ENV+=()
|
||||
|
||||
use desktop/colorscheme --group dotwryn
|
||||
use desktop/notify --group dotwryn
|
||||
|
||||
CHECK_ENVIRONMENT
|
||||
DEPENDENCIES+=(i3lock)
|
||||
#####################################################################
|
||||
|
||||
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)
|
||||
)
|
||||
MAIN() {
|
||||
local 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)
|
||||
local RADIUS=$(xrandr | grep 'connected primary' | sed 's/.* \([0-9]\+\)x.*/\1/' | awk '{print int($1*0.08)}')
|
||||
[ $RADIUS ] && ARGS+=(--radius=$RADIUS)
|
||||
|
||||
i3lock ${ARGS[@]} \
|
||||
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
|
||||
|
||||
use desktop/notify --group dotwryn
|
||||
|
||||
CHECK_ENVIRONMENT
|
||||
DEPENDENCIES+=(i3-nagbar)
|
||||
#####################################################################
|
||||
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'
|
||||
|
||||
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,27 +1,23 @@
|
||||
#!/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'"
|
||||
|
||||
[ ! -d $WALLPAPER_PATH ] \
|
||||
&& FAIL 1 "no such directory for DESKTOP__WALLPAPER_PATH='$DESKTOP__WALLPAPER_PATH'"
|
||||
SELECTION="$1"
|
||||
[ ! $SELECTION ] && SELECTION=random
|
||||
|
||||
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"
|
||||
|
||||
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
|
||||
feh --bg-fill $DESKTOP__WALLPAPER_PATH/$SELECTION
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
@ -1,10 +1,7 @@
|
||||
#!/bin/zsh
|
||||
DEPENDENCIES+=()
|
||||
REQUIRED_ENV+=()
|
||||
|
||||
use media/audio --group dotwryn
|
||||
|
||||
CHECK_ENVIRONMENT
|
||||
#####################################################################
|
||||
|
||||
MEDIA__PLAY_SFX $@
|
||||
MAIN() {
|
||||
MEDIA__PLAY_SFX $@
|
||||
}
|
||||
|
@ -1,10 +1,7 @@
|
||||
#!/bin/zsh
|
||||
DEPENDENCIES+=()
|
||||
REQUIRED_ENV+=()
|
||||
|
||||
use desktop/pulse-audio --group dotwryn
|
||||
|
||||
CHECK_ENVIRONMENT
|
||||
#####################################################################
|
||||
|
||||
PA__SET_DEFAULT_AUDIO $@
|
||||
MAIN() {
|
||||
PA__SET_DEFAULT_AUDIO $@
|
||||
}
|
||||
|
@ -1,46 +1,45 @@
|
||||
#!/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 ;;
|
||||
source ) AMIXER_DEVICE=Capture ;;
|
||||
* ) NOTIFY_FAIL 1 "Unsupported device '$DEVICE'" ;;
|
||||
esac
|
||||
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"
|
||||
local 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
|
||||
;;
|
||||
MEDIA__PLAY_SFX volume
|
||||
;;
|
||||
|
||||
down )
|
||||
pactl set-$DEVICE-volume $DEFAULT_DEVICE -10% \
|
||||
|| NOTIFY_ERROR "pactl error with set-$DEVICE-volume"
|
||||
down )
|
||||
pactl set-$DEVICE-volume $DEFAULT_DEVICE -10% \
|
||||
|| NOTIFY_ERROR "pactl error with set-$DEVICE-volume"
|
||||
|
||||
MEDIA__PLAY_SFX 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
|
||||
;;
|
||||
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
|
||||
* ) NOTIFY_FAIL 1 "Unsupported command '$COMMAND'" ;;
|
||||
esac
|
||||
}
|
||||
|
@ -1,52 +1,51 @@
|
||||
#!/bin/zsh
|
||||
DEPENDENCIES+=(xset)
|
||||
REQUIRED_ENV+=()
|
||||
|
||||
use desktop/notify --group dotwryn
|
||||
|
||||
CHECK_ENVIRONMENT
|
||||
DEPENDENCIES+=(xset)
|
||||
#####################################################################
|
||||
|
||||
case $1 in
|
||||
enable | disable | query | toggle ) ACTION="$1" ;;
|
||||
* )
|
||||
[ ! $1 ] && ACTION=toggle
|
||||
echo $ACTION
|
||||
;;
|
||||
esac
|
||||
MAIN() {
|
||||
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 )
|
||||
[[ $ACTION =~ ^toggle$ ]] && {
|
||||
xset -q | grep -qi 'prefer blanking: *no' \
|
||||
&& CURRENT_STATE='disabled' || CURRENT_STATE='enabled'
|
||||
&& ACTION='enable' || ACTION='disable'
|
||||
}
|
||||
|
||||
[ ! $CURRENT_STATE ] && NOTIFY_FAIL 3 'unable to determine current setting'
|
||||
[ ! $ACTION ] && NOTIFY_FAIL 1 "unknown screen blank action '$1'"
|
||||
|
||||
NOTIFY_SUCCESS "screen blank is currently \\033[0;34m$CURRENT_STATE"
|
||||
;;
|
||||
esac
|
||||
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
|
||||
}
|
||||
|
@ -1,10 +1,7 @@
|
||||
#!/bin/zsh
|
||||
DEPENDENCIES+=()
|
||||
REQUIRED_ENV+=()
|
||||
|
||||
use desktop/xrandr --group dotwryn
|
||||
|
||||
CHECK_ENVIRONMENT
|
||||
#####################################################################
|
||||
|
||||
XRANDR__DISCONNECT_ALL_DISPLAYS $@
|
||||
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,38 +54,38 @@ CURRENT_SESSION=$(\
|
||||
|
||||
#####################################################################
|
||||
|
||||
CHECK_SESSION && FAIL 1 'update currently in progress'
|
||||
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"
|
||||
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 "
|
||||
manual action is required; (in another tab) connect to tmux:
|
||||
tmux a -t $SESSION
|
||||
|
||||
[ $CURRENT_SESSION ] && {
|
||||
SUCCESS 'currently in a tmux session; opening new window...'
|
||||
tmux new-window -t $CURRENT_SESSION "unset 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...'
|
||||
tmux new-window -t $CURRENT_SESSION "unset TMUX; tmux a -t $SESSION"
|
||||
}
|
||||
|
||||
UPDATE_ALL 'yay -Syu'
|
||||
UPDATE_ALL 'cd ~/.wryn; git pull --autostash'
|
||||
UPDATE_ALL '~/.wryn/bin/scwrypts config update'
|
||||
UPDATE_ALL '~/.wryn/bin/scwrypts media push'
|
||||
UPDATE_ALL '~/.wryn/bin/scwrypts media pull'
|
||||
UPDATE_ALL 'command -v i3-msg >/dev/null 2>&1 || exit 0; ~/.wryn/bin/scwrypts i3 font override'
|
||||
|
||||
[[ $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'"
|
||||
|
||||
SUCCESS " \nfinished system update accross all servers\n "
|
||||
|
||||
[[ $REBOOT -eq 1 ]] && { STATUS 'rebooting host machine'; sleep 3; reboot || sudo reboot; }
|
||||
}
|
||||
|
||||
UPDATE_ALL 'yay -Syu'
|
||||
UPDATE_ALL 'cd ~/.wryn; git pull --autostash'
|
||||
UPDATE_ALL '~/.wryn/bin/scwrypts config update'
|
||||
UPDATE_ALL '~/.wryn/bin/scwrypts media push'
|
||||
UPDATE_ALL '~/.wryn/bin/scwrypts media pull'
|
||||
UPDATE_ALL 'command -v i3-msg >/dev/null 2>&1 || exit 0; ~/.wryn/bin/scwrypts i3 font override'
|
||||
|
||||
[[ $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'"
|
||||
|
||||
SUCCESS
|
||||
SUCCESS 'finished system update accross all servers'
|
||||
SUCCESS
|
||||
|
||||
[[ $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