1
0
Fork 0
mirror of https://github.com/aclist/dztui.git synced 2024-12-28 21:32:36 +01:00

fix: detect APU variants

This commit is contained in:
aclist 2024-08-28 06:52:01 +09:00
parent 24a916c11c
commit 4bd7f684c2
11 changed files with 45 additions and 15 deletions

View file

@ -13,7 +13,7 @@ sd_res="--width=1280 --height=800"
steamsafe_zenity="/usr/bin/zenity" steamsafe_zenity="/usr/bin/zenity"
zenity_flags=("--width=500" "--title=DZGUI") zenity_flags=("--width=500" "--title=DZGUI")
declare -A deps declare -A deps
deps=([awk]="5.1.1" [curl]="7.80.0" [jq]="1.6" [tr]="9.0" [$steamsafe_zenity]="3.42.1") deps=([awk]="5.1.1" [curl]="7.80.0" [jq]="1.6" [tr]="9.0" [$steamsafe_zenity]="3.44.1")
#CONFIG #CONFIG
config_path="$HOME/.config/dztui" config_path="$HOME/.config/dztui"
@ -65,6 +65,7 @@ km_helper_url="$releases_url/latlon"
geo_file_url="$releases_url/ips.csv.gz" geo_file_url="$releases_url/ips.csv.gz"
set_im_module(){ set_im_module(){
#TODO: drop pending SteamOS changes
pgrep -a gamescope | grep -q "generate-drm-mode" pgrep -a gamescope | grep -q "generate-drm-mode"
if [[ $? -eq 0 ]]; then if [[ $? -eq 0 ]]; then
GTK_IM_MODULE="" GTK_IM_MODULE=""
@ -377,18 +378,20 @@ test_display_mode(){
fi fi
} }
check_architecture(){ check_architecture(){
local cpu=$(< /proc/cpuinfo grep "AMD Custom APU 0405") local cpu=$(< /proc/cpuinfo awk -F": " '/AMD Custom APU [0-9]{4}$/ {print $2; exit}')
if [[ -n "$cpu" ]]; then read -a APU_MODEL <<< "$cpu"
if [[ ${APU_MODEL[3]} != "0932" ]] || [[ ${APU_MODEL[3]} != "0405" ]]; then
is_steam_deck=0
logger INFO "Setting architecture to 'desktop'"
return
fi
if [[ $(test_display_mode) == "gm" ]]; then if [[ $(test_display_mode) == "gm" ]]; then
is_steam_deck=2 is_steam_deck=2
else else
is_steam_deck=1 is_steam_deck=1
fi fi
logger INFO "Setting architecture to 'Steam Deck'" logger INFO "Setting architecture to 'Steam Deck'"
else
is_steam_deck=0
logger INFO "Setting architecture to 'desktop'"
fi
} }
check_map_count(){ check_map_count(){
[[ $is_steam_deck -gt 0 ]] && return 0 [[ $is_steam_deck -gt 0 ]] && return 0
@ -531,14 +534,38 @@ fetch_dzq(){
curl -Ls "$url" > "$file" curl -Ls "$url" > "$file"
logger INFO "Updated DZQ to sha '$sha'" logger INFO "Updated DZQ to sha '$sha'"
} }
fetch_icons(){
res=(
"16"
"24"
"32"
"48"
"64"
"96"
"128"
"256"
)
url="$stable_url/images/icons"
for i in "${res[@]}"; do
size="${i}x${i}"
dir="$HOME/.local/share/icons/hicolor/$size/apps"
icon="$dir/$app_name.png"
[[ -f $icon ]] && return
if [[ ! -d $dir ]]; then
mkdir -p "$dir"
fi
logger INFO "Updating $size Freedesktop icon"
curl -Ls "${url}/${i}.png" > "$icon"
done
}
fetch_helpers_by_sum(){ fetch_helpers_by_sum(){
[[ -f "$config_file" ]] && source "$config_file" [[ -f "$config_file" ]] && source "$config_file"
declare -A sums declare -A sums
sums=( sums=(
["ui.py"]="c62e84ddd1457b71a85ad21da662b9af" ["ui.py"]="b5e27858e4aaf966067d452f7e44b9eb"
["query_v2.py"]="55d339ba02512ac69de288eb3be41067" ["query_v2.py"]="55d339ba02512ac69de288eb3be41067"
["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397" ["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397"
["funcs"]="5ebf7c9694c9ec8df00f0b30871eeb38" ["funcs"]="44eca80b207057423c2d298cc7cf1e29"
["lan"]="c62e84ddd1457b71a85ad21da662b9af" ["lan"]="c62e84ddd1457b71a85ad21da662b9af"
) )
local author="aclist" local author="aclist"
@ -602,6 +629,8 @@ fetch_helpers(){
fetch_geo_file fetch_geo_file
fetch_helpers_by_sum fetch_helpers_by_sum
[[ ! -f $share_path/icon.png ]] && freedesktop_dirs [[ ! -f $share_path/icon.png ]] && freedesktop_dirs
#TODO: integration test
#fetch_icons
} }
raise_error_and_quit(){ raise_error_and_quit(){
local msg="$1" local msg="$1"
@ -896,7 +925,7 @@ uninstall(){
} }
main(){ main(){
local zenv=$(zenity --version 2>/dev/null) local zenv=$(zenity --version 2>/dev/null)
[[ -z $zenv ]] && { echo "Requires zenity <= 3.44.1"; exit 1; } [[ -z $zenv ]] && { echo "Requires zenity >= ${deps[$steamsafe_zenity]}"; exit 1; }
if [[ $1 == "--uninstall" ]] || [[ $1 == "-u" ]]; then if [[ $1 == "--uninstall" ]] || [[ $1 == "-u" ]]; then
uninstall && uninstall &&
exit 0 exit 0

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -o pipefail set -o pipefail
version=5.2.3 version=5.3.3
#CONSTANTS #CONSTANTS
aid=221100 aid=221100
@ -978,6 +978,7 @@ generate_log(){
cat <<-DOC > $system_log cat <<-DOC > $system_log
Distro: $(< /etc/os-release grep -w NAME | awk -F\" '{print $2}') Distro: $(< /etc/os-release grep -w NAME | awk -F\" '{print $2}')
Kernel: $(uname -mrs) Kernel: $(uname -mrs)
CPU: $(< /proc/cpuinfo awk -F": " '/model name/ {print $2; exit}')
Version: $version Version: $version
Branch: $branch Branch: $branch
Mode: $(if [[ -z $debug ]]; then echo normal; else echo debug; fi) Mode: $(if [[ -z $debug ]]; then echo normal; else echo debug; fi)

View file

@ -19,7 +19,7 @@ gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, GLib, Gdk, GObject, Pango from gi.repository import Gtk, GLib, Gdk, GObject, Pango
from enum import Enum from enum import Enum
# 5.2.3 # 5.3.3
app_name = "DZGUI" app_name = "DZGUI"
start_time = 0 start_time = 0

BIN
images/icons/128.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
images/icons/16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

BIN
images/icons/24.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
images/icons/256.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

BIN
images/icons/32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
images/icons/48.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

BIN
images/icons/64.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

BIN
images/icons/96.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB