Skip to content

Commit 3ce6420

Browse files
committed
esthemes - added carbon-2021 pixel positioned themes and rework logic
EmulationStation 2.10+ supports pixel based positioning in themes. @tomaz82 who authored the code also redid the base themes to utilise this and also to use other new features such as variables. This new code will install the carbon-2021 theme by default when the version of EmulationStation is 2.10 or newer. It will also only show the new carbon-2021 pixel positioned themes to users via the gui if the installed EmulationStation supports it. Users upgrading EmulationStation once the latest changes have been merged to the stable branch will get the new theme installed, but will need to manually switch to it. However the old theme should work fine still. Some older themes may show some minor spacing issues due to fixed calculations in the ES code for lists etc.
1 parent 8a39a76 commit 3ce6420

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

scriptmodules/supplementary/esthemes.sh

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,37 @@ function depends_esthemes() {
2121
fi
2222
}
2323

24+
function _has_pixel_pos_esthemes() {
25+
# 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
37+
compareVersions "$es_ver" ge "2.10" && pixel_pos=1
38+
echo "$pixel_pos"
39+
}
40+
2441
function install_theme_esthemes() {
2542
local theme="$1"
2643
local repo="$2"
2744
local default_branch
45+
46+
local pixel_pos="$(_has_pixel_pos_esthemes)"
47+
2848
if [[ -z "$repo" ]]; then
2949
repo="RetroPie"
3050
fi
3151
if [[ -z "$theme" ]]; then
3252
theme="carbon"
3353
repo="RetroPie"
54+
[[ "$pixel_pos" -eq 1 ]] && theme+="-2021"
3455
fi
3556
# Get the name of the default branch, fallback to 'master' if not found
3657
default_branch=$(runCmd git ls-remote --symref --exit-code "https://github.com/$repo/es-theme-$theme.git" HEAD | grep -oP ".*/\K[^\t]+")
@@ -47,7 +68,19 @@ function uninstall_theme_esthemes() {
4768
}
4869

4970
function gui_esthemes() {
50-
local themes=(
71+
local themes=()
72+
73+
local pixel_pos="$(_has_pixel_pos_esthemes)"
74+
75+
if [[ "$pixel_pos" -eq 1 ]]; then
76+
themes+=(
77+
'RetroPie carbon-2021'
78+
'RetroPie carbon-centered-2021'
79+
'RetroPie carbon-nometa-2021'
80+
)
81+
fi
82+
83+
local themes+=(
5184
'RetroPie carbon'
5285
'RetroPie carbon-centered'
5386
'RetroPie carbon-nometa'

0 commit comments

Comments
 (0)