1
0
Fork 0
mirror of https://github.com/aclist/dztui.git synced 2024-12-29 13:52:03 +01:00

Block Steam from opening (#39)

This commit is contained in:
aclist 2022-11-24 01:50:34 +09:00
parent 159a9bc900
commit 3fdb6c4d7f
2 changed files with 13 additions and 3 deletions

View file

@ -5,6 +5,11 @@
- Custom query API - Custom query API
- Standardize dialogs - Standardize dialogs
## [3.1.0-rc.13] 2022-11-24
### Fixed
- Prevent downloading mods if Steam is not running
- Suppress "force refresh mods" option if automods is disabled
## [3.1.0-rc.12] 2022-11-22 ## [3.1.0-rc.12] 2022-11-22
### Changed ### Changed
- Updated menu labels - Updated menu labels

View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
set -o pipefail set -o pipefail
version=3.1.0-rc.12 version=3.1.0-rc.13
aid=221100 aid=221100
game="dayz" game="dayz"
@ -632,6 +632,9 @@ update_history(){
fi fi
echo -e "${old}${ip}" > "$hist_file" echo -e "${old}${ip}" > "$hist_file"
} }
is_steam_running(){
xdotool search --desktop "$(xdotool get_desktop)" --name "Steam"
}
connect(){ connect(){
#TODO: sanitize/validate input #TODO: sanitize/validate input
readarray -t qport_arr <<< "$qport_list" readarray -t qport_arr <<< "$qport_list"
@ -656,6 +659,7 @@ connect(){
compare compare
[[ $auto_install -eq 2 ]] && merge_modlists [[ $auto_install -eq 2 ]] && merge_modlists
if [[ -n $diff ]]; then if [[ -n $diff ]]; then
[[ -z $(is_steam_running) ]] && { zenity --info --text "Steam must be running on the current desktop to use this feature."; return; }
if [[ $auto_install -eq 1 ]]; then if [[ $auto_install -eq 1 ]]; then
headless_mod_install "$diff" headless_mod_install "$diff"
rc=$? rc=$?
@ -1116,7 +1120,7 @@ console_dl(){
steam steam://open/console 2>/dev/null 1>&2 && steam steam://open/console 2>/dev/null 1>&2 &&
sleep 1s sleep 1s
#https://github.com/jordansissel/xdotool/issues/67 #https://github.com/jordansissel/xdotool/issues/67
local wid=$(xdotool search --sync --onlyvisible --desktop "$(xdotool get_desktop)" --name Steam) local wid=$(xdotool search --desktop "$(xdotool get_desktop)" --name Steam)
xdotool windowactivate $wid xdotool windowactivate $wid
for i in "${modids[@]}"; do for i in "${modids[@]}"; do
xdotool type --delay 15 "workshop_download_item $aid $i" xdotool type --delay 15 "workshop_download_item $aid $i"
@ -1197,10 +1201,10 @@ options_menu(){
"Toggle debug mode" "Toggle debug mode"
"Generate debug log" "Generate debug log"
"Toggle auto mod install [$auto_hr]" "Toggle auto mod install [$auto_hr]"
"Force update local mods"
# "Toggle headless mod install [$headless_hr]" # "Toggle headless mod install [$headless_hr]"
# "Set auto-mod staging directory [$staging_dir]" # "Set auto-mod staging directory [$staging_dir]"
) )
[[ $auto_install -eq 2 ]] && debug_list+=("Force update local mods")
debug_sel=$(zenity --list --width=1280 --height=800 --column="Options" --title="DZGUI" --hide-header "${debug_list[@]}" 2>/dev/null) debug_sel=$(zenity --list --width=1280 --height=800 --column="Options" --title="DZGUI" --hide-header "${debug_list[@]}" 2>/dev/null)
if [[ $debug_sel == "${debug_list[0]}" ]]; then if [[ $debug_sel == "${debug_list[0]}" ]]; then
enforce_dl=1 enforce_dl=1
@ -1220,6 +1224,7 @@ options_menu(){
force_update=1 force_update=1
force_update_mods force_update_mods
merge_modlists > >(zenity --pulsate --progress --auto-close --title=DZGUI --width=500 2>/dev/null) merge_modlists > >(zenity --pulsate --progress --auto-close --title=DZGUI --width=500 2>/dev/null)
[[ -z $(is_steam_running) ]] && { zenity --info --text "Steam must be running on the current desktop to use this feature."; return; }
auto_mod_install auto_mod_install
fi fi
} }