@@ -22,42 +22,45 @@ function depends_esthemes() {
22
22
}
23
23
24
24
function _has_pixel_pos_esthemes() {
25
+ local pixel_pos=0
25
26
# get the version of emulationstation installed so we can check whether to show
26
- # themes that use the new pixel based positioning capabilities
27
- local supp_path=" $rootdir /supplementary"
28
- local es_path=" $supp_path /emulationstation"
29
- local esdev_path=" ${es_path} -dev"
30
- # check if emulationstation-dev is installed
31
- if [[ -d " $esdev_path " ]]; then
32
- es_path=" $esdev_path "
33
- fi
34
- # extract the version number from emulationstation --help
35
- local es_ver=" $( " $es_path /emulationstation" --help | grep -oP " Version \K[^,]+" ) "
36
- # if emulationstation is newer than 2.10 enable pixel based themes
27
+ # themes that use the new pixel based positioning - we run as $user as the
28
+ # emulationstation launch script will exit if run as root
29
+ local es_ver=" $( sudo -u $user /usr/bin/emulationstation --help | grep -oP " Version \K[^,]+" ) "
30
+ # if emulationstation is newer than 2.10, enable pixel based themes
37
31
compareVersions " $es_ver " ge " 2.10" && pixel_pos=1
38
32
echo " $pixel_pos "
39
33
}
40
34
41
35
function install_theme_esthemes() {
42
36
local theme=" $1 "
43
37
local repo=" $2 "
44
- local default_branch
38
+ local branch= " $3 "
45
39
46
40
local pixel_pos=" $( _has_pixel_pos_esthemes) "
47
41
48
42
if [[ -z " $repo " ]]; then
49
43
repo=" RetroPie"
50
44
fi
45
+
51
46
if [[ -z " $theme " ]]; then
52
47
theme=" carbon"
53
48
repo=" RetroPie"
54
49
[[ " $pixel_pos " -eq 1 ]] && theme+=" -2021"
55
50
fi
56
- # Get the name of the default branch, fallback to 'master' if not found
57
- default_branch=$( runCmd git ls-remote --symref --exit-code " https://github.com/$repo /es-theme-$theme .git" HEAD | grep -oP " .*/\K[^\t]+" )
58
- [[ -z " $default_branch " ]] && default_branch=" master"
51
+
52
+ local name=" $theme "
53
+
54
+ if [[ -z " $branch " ]]; then
55
+ # Get the name of the default branch, fallback to 'master' if not found
56
+ branch=$( runCmd git ls-remote --symref --exit-code " https://github.com/$repo /es-theme-$theme .git" HEAD | grep -oP " .*/\K[^\t]+" )
57
+ [[ -z " $branch " ]] && branch=" master"
58
+ else
59
+ name+=" -$branch "
60
+ fi
61
+
59
62
mkdir -p " /etc/emulationstation/themes"
60
- gitPullOrClone " /etc/emulationstation/themes/$theme " " https://github.com/$repo /es-theme-$theme .git" " $default_branch "
63
+ gitPullOrClone " /etc/emulationstation/themes/$name " " https://github.com/$repo /es-theme-$theme .git" " $branch "
61
64
}
62
65
63
66
function uninstall_theme_esthemes() {
@@ -75,8 +78,8 @@ function gui_esthemes() {
75
78
if [[ " $pixel_pos " -eq 1 ]]; then
76
79
themes+=(
77
80
' RetroPie carbon-2021'
78
- ' RetroPie carbon-centered- 2021'
79
- ' RetroPie carbon-nometa- 2021'
81
+ ' RetroPie carbon-2021 centered '
82
+ ' RetroPie carbon-2021 nometa '
80
83
)
81
84
fi
82
85
@@ -295,6 +298,10 @@ function gui_esthemes() {
295
298
)
296
299
while true ; do
297
300
local theme
301
+ local theme_dir
302
+ local branch
303
+ local name
304
+
298
305
local installed_themes=()
299
306
local repo
300
307
local options=()
@@ -317,13 +324,20 @@ function gui_esthemes() {
317
324
theme=($theme )
318
325
repo=" ${theme[0]} "
319
326
theme=" ${theme[1]} "
320
- if [[ -d " /etc/emulationstation/themes/$theme " ]]; then
327
+ branch=" ${theme[2]} "
328
+ name=" $repo /$theme "
329
+ theme_dir=" $theme "
330
+ if [[ -n " $branch " ]]; then
331
+ name+=" ($branch )"
332
+ theme_dir+=" -$branch "
333
+ fi
334
+ if [[ -d " /etc/emulationstation/themes/$theme_dir " ]]; then
321
335
status+=(" i" )
322
- options+=(" $i " " Update or Uninstall $repo / $theme (installed)" )
323
- installed_themes+=(" $theme $repo " )
336
+ options+=(" $i " " Update or Uninstall $name (installed)" )
337
+ installed_themes+=(" $theme $repo $branch " )
324
338
else
325
339
status+=(" n" )
326
- options+=(" $i " " Install $repo / $theme " )
340
+ options+=(" $i " " Install $name " )
327
341
fi
328
342
(( i++ ))
329
343
done
@@ -362,27 +376,34 @@ function gui_esthemes() {
362
376
U)
363
377
for theme in " ${installed_themes[@]} " ; do
364
378
theme=($theme )
365
- rp_callModule esthemes install_theme " ${theme[0]} " " ${theme[1]} "
379
+ rp_callModule esthemes install_theme " ${theme[0]} " " ${theme[1]} " " ${theme[2]} "
366
380
done
367
381
;;
368
382
* )
369
383
theme=(${themes[choice-1]} )
370
384
repo=" ${theme[0]} "
371
385
theme=" ${theme[1]} "
386
+ branch=" ${theme[2]} "
387
+ name=" $repo /$theme "
388
+ theme_dir=" $theme "
389
+ if [[ -n " $branch " ]]; then
390
+ name+=" ($branch )"
391
+ theme_dir+=" -$branch "
392
+ fi
372
393
if [[ " ${status[choice]} " == " i" ]]; then
373
- options=(1 " Update $repo / $theme " 2 " Uninstall $repo / $theme " )
374
- cmd=(dialog --backtitle " $__backtitle " --menu " Choose an option for theme" 12 40 06)
394
+ options=(1 " Update $name " 2 " Uninstall $name " )
395
+ cmd=(dialog --backtitle " $__backtitle " --menu " Choose an option for theme" 12 60 06)
375
396
local choice=$( " ${cmd[@]} " " ${options[@]} " 2>&1 > /dev/tty)
376
397
case " $choice " in
377
398
1)
378
- rp_callModule esthemes install_theme " $theme " " $repo "
399
+ rp_callModule esthemes install_theme " $theme " " $repo " " $branch "
379
400
;;
380
401
2)
381
- rp_callModule esthemes uninstall_theme " $theme "
402
+ rp_callModule esthemes uninstall_theme " $theme_dir "
382
403
;;
383
404
esac
384
405
else
385
- rp_callModule esthemes install_theme " $theme " " $repo "
406
+ rp_callModule esthemes install_theme " $theme " " $repo " " $branch "
386
407
fi
387
408
;;
388
409
esac
0 commit comments