Skip to content

Commit

Permalink
Add new scripts + update check missing dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
PhosCity committed Nov 23, 2022
1 parent 5788994 commit 640128c
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 11 deletions.
52 changes: 46 additions & 6 deletions aegisub
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
# ╭──────────────────────────────────────────────────────────╮
# │ Variables │
# ╰──────────────────────────────────────────────────────────╯
DEPENDENCIES=(rofi xdotool yad notify-send xclip)
SLEEP_DURATION=0.04s

declare -a OPTIONS=(
"Line0 - AssWipe"
"Zeref - Everything Shape - Shape Clipper"
Expand All @@ -29,8 +27,14 @@ declare -a OPTIONS=(
"Unanimated - Hyperdimensional Relocator - clip2fax"
"Unanimated - Hyperdimensional Relocator - clip2frz"
"Unanimated - Script Cleanup - Remove Unused Styles"
"Unanimated - HYDRA - Create 3D shadow"
"Unanimated - HYDRA - fscx -> fscy"
"Unanimated - HYDRA - fscy -> fscx"
"Unanimated - HYDRA - Move color tag to first block"
)

MISSING_DEPS=()
DEPENDENCIES=(rofi xdotool yad notify-send xclip)
SCRIPT_DIRECTORY=${BASH_SOURCE[0]%/*}
ROFI_THEME="${SCRIPT_DIRECTORY}/rofi-themes/window.rasi"
CACHE="${XDG_CACHE_HOME:-${HOME}/.cache}/aegisub-xdotool.txt"
Expand All @@ -43,7 +47,7 @@ CACHE="${XDG_CACHE_HOME:-${HOME}/.cache}/aegisub-xdotool.txt"
dep_ch() {
for dep; do
if ! command -v "${dep}" >/dev/null; then
missing_dep="${missing_dep}\"${dep}\" "
MISSING_DEPS+=("${dep}")
fi
done
}
Expand Down Expand Up @@ -133,15 +137,23 @@ round_tags() {
xdo 620 505 # Click on Metamorphosis Button
}

# Open Unanimated - HYDRA
open_hydra() {
xdo 329 50 # Click on Automation
xdo 346 229 # Click on !unanimated
xdo 532 351 # Click on Hydra
}

# ╭──────────────────────────────────────────────────────────╮
# │ Check for dependencies │
# ╰──────────────────────────────────────────────────────────╯
for i in "${DEPENDENCIES[@]}"; do
dep_ch "${i}"
done
if [[ -n "${missing_dep}" ]]; then
notify-send "${missing_dep}not found. Please install all missing dependencies."
printf "\033[1;31m\n%s\033[0m\n" "${missing_dep}not found. Please install all missing dependencies." >&2
if [[ "${#MISSING_DEPS}" -gt 0 ]]; then
printf -v missing_deps '%s, ' "${MISSING_DEPS[@]}"
echo "${missing_deps%, } not found. Please install all missing dependencies."
notify-send "${missing_deps%, } not found. Please install all missing dependencies."
exit 1
fi

Expand Down Expand Up @@ -356,5 +368,33 @@ case "${PLUGIN_NAME}" in
xdo 387 537 # Click on 'Run Selected' Button
;;

"Unanimated - HYDRA - Create 3D shadow")
open_hydra
xdo 881 590 # Click on 'special' dropdown
xdo 745 393 # Click on create 3D shadow
xdo 717 662 # Click on Special Button
;;

"Unanimated - HYDRA - fscx -> fscy")
open_hydra
xdo 881 590 # Click on 'special' dropdown
xdo 720 171 # Click on fscx -> fscy
xdo 717 662 # Click on Special Button
;;

"Unanimated - HYDRA - fscy -> fscx")
open_hydra
xdo 881 590 # Click on 'special' dropdown
xdo 706 201 # Click on fscy -> fscx
xdo 717 662 # Click on Special Button
;;

"Unanimated - HYDRA - Move color tag to first block")
open_hydra
xdo 881 590 # Click on 'special' dropdown
xdo 756 448 # Click on move color tag to first block
xdo 717 662 # Click on Special Button
;;

*) ;;
esac
12 changes: 7 additions & 5 deletions template
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# ╭──────────────────────────────────────────────────────────╮
# │ Variables │
# ╰──────────────────────────────────────────────────────────╯
DEPENDENCIES=(rofi xdotool yad notify-send xclip)
SLEEP_DURATION=0.04s # [EDIT] Increase this value if the script executes so fast that it's missing what it should click.

# [EDIT] Write the names of the plugins here by replacing items below
Expand All @@ -14,6 +13,8 @@ declare -a OPTIONS=(
"item2"
)

MISSING_DEPS=()
DEPENDENCIES=(rofi xdotool yad notify-send xclip)
SCRIPT_DIRECTORY=${BASH_SOURCE[0]%/*}
ROFI_THEME="${SCRIPT_DIRECTORY}/rofi-themes/window.rasi"
CACHE="${XDG_CACHE_HOME:-${HOME}/.cache}/aegisub-xdotool.txt"
Expand All @@ -26,7 +27,7 @@ CACHE="${XDG_CACHE_HOME:-${HOME}/.cache}/aegisub-xdotool.txt"
dep_ch() {
for dep; do
if ! command -v "${dep}" >/dev/null; then
missing_dep="${missing_dep}\"${dep}\" "
MISSING_DEPS+=("${dep}")
fi
done
}
Expand Down Expand Up @@ -69,9 +70,10 @@ select_file() {
for i in "${DEPENDENCIES[@]}"; do
dep_ch "${i}"
done
if [[ -n "${missing_dep}" ]]; then
notify-send "${missing_dep}not found. Please install all missing dependencies."
printf "\033[1;31m\n%s\033[0m\n" "${missing_dep}not found. Please install all missing dependencies." >&2
if [[ "${#MISSING_DEPS}" -gt 0 ]]; then
printf -v missing_deps '%s, ' "${MISSING_DEPS[@]}"
echo "${missing_deps%, } not found. Please install all missing dependencies."
notify-send "${missing_deps%, } not found. Please install all missing dependencies."
exit 1
fi

Expand Down

0 comments on commit 640128c

Please sign in to comment.