mirror of
https://github.com/aclist/dztui.git
synced 2025-01-01 15:12:05 +01:00
chore: backports from stable
This commit is contained in:
parent
ad55ee6406
commit
7eee02236b
1 changed files with 20 additions and 28 deletions
44
dzgui.sh
44
dzgui.sh
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
version=3.4.0-rc.9
|
version=3.4.0-rc.10
|
||||||
|
|
||||||
aid=221100
|
aid=221100
|
||||||
game="dayz"
|
game="dayz"
|
||||||
|
@ -93,9 +93,11 @@ depcheck(){
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
watcher_deps(){
|
watcher_deps(){
|
||||||
|
logger INFO "${FUNCNAME[0]}"
|
||||||
if [[ ! $(command -v wmctrl) ]] && [[ ! $(command -v xdotool) ]]; then
|
if [[ ! $(command -v wmctrl) ]] && [[ ! $(command -v xdotool) ]]; then
|
||||||
echo "100"
|
echo "100"
|
||||||
warn "Missing dependency: requires 'wmctrl' and 'xdotool'.\nInstall from your system's package manager."
|
warn "Missing dependency: requires 'wmctrl' or 'xdotool'.\nInstall from your system's package manager."
|
||||||
|
logger ERROR "Missing watcher dependencies"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -120,8 +122,8 @@ items=(
|
||||||
" Help file ⧉"
|
" Help file ⧉"
|
||||||
" Report bug ⧉"
|
" Report bug ⧉"
|
||||||
" Forum ⧉"
|
" Forum ⧉"
|
||||||
" NEW: Sponsor ⧉"
|
" Sponsor ⧉"
|
||||||
" NEW: Hall of fame ⧉"
|
" Hall of fame ⧉"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
warn(){
|
warn(){
|
||||||
|
@ -496,7 +498,6 @@ passed_mod_check(){
|
||||||
|
|
||||||
}
|
}
|
||||||
auto_mod_install(){
|
auto_mod_install(){
|
||||||
#[[ -z $(is_steam_running) ]] && { $steamsafe_zenity --info --text "Steam must be running to use this feature."; return; }
|
|
||||||
popup 300
|
popup 300
|
||||||
rc=$?
|
rc=$?
|
||||||
if [[ $rc -eq 0 ]]; then
|
if [[ $rc -eq 0 ]]; then
|
||||||
|
@ -680,7 +681,6 @@ prepare_ip_list(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
history_table(){
|
history_table(){
|
||||||
[[ ! -f $hist_file ]] && { pop 1000; return; }
|
|
||||||
[[ -f /tmp/dz.hist ]] && rm /tmp/dz.hist
|
[[ -f /tmp/dz.hist ]] && rm /tmp/dz.hist
|
||||||
for i in $(cat $hist_file); do
|
for i in $(cat $hist_file); do
|
||||||
echo "# Getting metadata for $i"
|
echo "# Getting metadata for $i"
|
||||||
|
@ -1062,11 +1062,14 @@ generate_log(){
|
||||||
DOC
|
DOC
|
||||||
}
|
}
|
||||||
focus_beta_client(){
|
focus_beta_client(){
|
||||||
|
steam steam://open/library &&
|
||||||
steam steam://open/console 2>/dev/null 1>&2 &&
|
steam steam://open/console 2>/dev/null 1>&2 &&
|
||||||
sleep 1s
|
sleep 1s
|
||||||
wid(){
|
wid(){
|
||||||
#wmctrl -ilx | awk 'tolower($3) == "steam.steam"' | grep 'Steam$' | awk '{print $1}'
|
wmctrl -ilx |\
|
||||||
wmctrl -ilx | awk '$3 == "steamwebhelper.steam" {print $1}'
|
awk 'tolower($3) == "steamwebhelper.steam"' |\
|
||||||
|
grep "Steam Games List" |\
|
||||||
|
awk '{print $1}'
|
||||||
}
|
}
|
||||||
until [[ -n $(wid) ]]; do
|
until [[ -n $(wid) ]]; do
|
||||||
:
|
:
|
||||||
|
@ -1074,7 +1077,6 @@ focus_beta_client(){
|
||||||
wmctrl -ia $(wid)
|
wmctrl -ia $(wid)
|
||||||
sleep 0.1s
|
sleep 0.1s
|
||||||
wid=$(xdotool getactivewindow)
|
wid=$(xdotool getactivewindow)
|
||||||
echo wid is $wid
|
|
||||||
local geo=$(xdotool getwindowgeometry $wid)
|
local geo=$(xdotool getwindowgeometry $wid)
|
||||||
local pos=$(<<< "$geo" awk 'NR==2 {print $2}' | sed 's/,/ /')
|
local pos=$(<<< "$geo" awk 'NR==2 {print $2}' | sed 's/,/ /')
|
||||||
local dim=$(<<< "$geo" awk 'NR==3 {print $2}' | sed 's/x/ /')
|
local dim=$(<<< "$geo" awk 'NR==3 {print $2}' | sed 's/x/ /')
|
||||||
|
@ -1084,21 +1086,11 @@ focus_beta_client(){
|
||||||
local dim2=$(<<< "$dim" awk '{print $2}')
|
local dim2=$(<<< "$dim" awk '{print $2}')
|
||||||
local dim1=$(((dim1/2)+pos1))
|
local dim1=$(((dim1/2)+pos1))
|
||||||
local dim2=$(((dim2/2)+pos2))
|
local dim2=$(((dim2/2)+pos2))
|
||||||
echo moving mouse
|
|
||||||
xdotool mousemove $dim1 $dim2
|
xdotool mousemove $dim1 $dim2
|
||||||
xdotool click 1
|
xdotool click 1
|
||||||
sleep 0.5s
|
sleep 0.5s
|
||||||
xdotool key Tab
|
xdotool key Tab
|
||||||
}
|
}
|
||||||
is_beta(){
|
|
||||||
#TODO: refactor legacy handling methods
|
|
||||||
local dir="$default_steam_path/package"
|
|
||||||
if [[ -f $dir/beta ]]; then
|
|
||||||
echo 0
|
|
||||||
else
|
|
||||||
echo 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
console_dl(){
|
console_dl(){
|
||||||
readarray -t modids <<< "$@"
|
readarray -t modids <<< "$@"
|
||||||
focus_beta_client
|
focus_beta_client
|
||||||
|
@ -1184,7 +1176,6 @@ toggle_console_dl(){
|
||||||
fi
|
fi
|
||||||
local flip_state="auto_install=\"$auto_install\""
|
local flip_state="auto_install=\"$auto_install\""
|
||||||
awk -v "var=$flip_state" -v "nr=$nr" 'NR==nr {$0=var}{print}' ${config_path}dztuirc.old > $config_file
|
awk -v "var=$flip_state" -v "nr=$nr" 'NR==nr {$0=var}{print}' ${config_path}dztuirc.old > $config_file
|
||||||
printf "[DZGUI] Set mod install to '$auto_install'\n"
|
|
||||||
source $config_file
|
source $config_file
|
||||||
}
|
}
|
||||||
force_update_mods(){
|
force_update_mods(){
|
||||||
|
@ -1214,7 +1205,7 @@ options_menu(){
|
||||||
debug_list=(
|
debug_list=(
|
||||||
"Toggle branch"
|
"Toggle branch"
|
||||||
"Toggle debug mode"
|
"Toggle debug mode"
|
||||||
"Generate debug log"
|
"Output system info"
|
||||||
"Toggle auto mod install [$auto_hr]"
|
"Toggle auto mod install [$auto_hr]"
|
||||||
)
|
)
|
||||||
#TODO: tech debt: drop old flags
|
#TODO: tech debt: drop old flags
|
||||||
|
@ -1233,11 +1224,12 @@ options_menu(){
|
||||||
check_version
|
check_version
|
||||||
;;
|
;;
|
||||||
"Toggle debug mode") toggle_debug ;;
|
"Toggle debug mode") toggle_debug ;;
|
||||||
"Generate debug log")
|
"Output system info")
|
||||||
source_script=$(realpath "$0")
|
source_script=$(realpath "$0")
|
||||||
source_dir=$(dirname "$source_script")
|
source_dir=$(dirname "$source_script")
|
||||||
printf "[DZGUI] Wrote log file to %s/log\n" "$source_dir"
|
generate_log > "$source_dir/DZGUI.log"
|
||||||
$steamsafe_zenity --info --width=500 --title="DZGUI" --text="Wrote log file to \n$source_dir/log" 2>/dev/null
|
$steamsafe_zenity --info --width=500 --title="DZGUI" --text="Wrote log file to \n$source_dir/log" 2>/dev/null
|
||||||
|
printf "[DZGUI] Wrote log file to %s/log\n" "$source_dir"
|
||||||
;;
|
;;
|
||||||
Toggle[[:space:]]auto*) toggle_console_dl ;;
|
Toggle[[:space:]]auto*) toggle_console_dl ;;
|
||||||
"Force update local mods")
|
"Force update local mods")
|
||||||
|
@ -1393,7 +1385,7 @@ get_dist(){
|
||||||
echo "$dist"
|
echo "$dist"
|
||||||
else
|
else
|
||||||
local dist=$($km_helper "$local_lat" "$local_lon" "$remote_lat" "$remote_lon")
|
local dist=$($km_helper "$local_lat" "$local_lon" "$remote_lat" "$remote_lon")
|
||||||
printf "%05.0f %s" "$dist" "km"
|
LC_NUMERIC=C printf "%05.0f %s" "$dist" "km"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
prepare_filters(){
|
prepare_filters(){
|
||||||
|
@ -1516,8 +1508,8 @@ server_browser(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
mods_disk_size(){
|
mods_disk_size(){
|
||||||
printf "Total size on disk: %s | " $(du -sh "$game_dir" | awk '{print $1}')
|
printf "Total size on disk: %s | " $(du -sh "$workshop_dir" | awk '{print $1}')
|
||||||
printf "%s mods | " $(ls -1 "$game_dir" | wc -l)
|
printf "%s mods | " $(ls -1 "$workshop_dir" | wc -l)
|
||||||
printf "Location: %s/steamapps/workshop/content/221100" "$steam_path"
|
printf "Location: %s/steamapps/workshop/content/221100" "$steam_path"
|
||||||
}
|
}
|
||||||
main_menu(){
|
main_menu(){
|
||||||
|
|
Loading…
Reference in a new issue