From ba2999fc4c14e163b8ea11f3d7993260145fa2ab Mon Sep 17 00:00:00 2001 From: Denifia Date: Mon, 1 May 2023 19:43:30 +0800 Subject: [PATCH] feat: added hide script --- .scripts/release-theme-switcher.sh | 5 +++ .../Roms/APPS/Theme Switcher - Install.sh | 3 +- .../.Theme Switcher - Uninstall.sh | 4 ++- .../Roms/APPS/Theme Switcher/Skins/! Refresh | 25 ++++++--------- .../Roms/APPS/Theme Switcher/Skins/.README.md | 11 +++++++ .../Theme Switcher/Theme Switcher - Hide.sh | 31 +++++++++++++++++++ 6 files changed, 61 insertions(+), 18 deletions(-) create mode 100644 .scripts/release-theme-switcher.sh create mode 100644 ThemeSwitcher/Roms/APPS/Theme Switcher/Theme Switcher - Hide.sh diff --git a/.scripts/release-theme-switcher.sh b/.scripts/release-theme-switcher.sh new file mode 100644 index 0000000..30e7546 --- /dev/null +++ b/.scripts/release-theme-switcher.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +# Run from the root of the repo! + +find ./ThemeSwitcher/Roms/APPS -printf "%P\n" | tar -czf ThemesSwitcherVnext.tar.gz --no-recursion -C ./ThemeSwitcher/Roms/APPS -T - diff --git a/ThemeSwitcher/Roms/APPS/Theme Switcher - Install.sh b/ThemeSwitcher/Roms/APPS/Theme Switcher - Install.sh index 63240f4..0ddade1 100644 --- a/ThemeSwitcher/Roms/APPS/Theme Switcher - Install.sh +++ b/ThemeSwitcher/Roms/APPS/Theme Switcher - Install.sh @@ -11,10 +11,11 @@ AppName="Theme Switcher" RomsDir="$(busybox dirname $AppsDir)" RootDir="$(busybox dirname $RomsDir)" -$AppsDir/Theme\ Switcher/Skins/.utils/printstr " Installing... " & sleep 1 +$AppsDir/Theme\ Switcher/Skins/.utils/printstr " Installing... " & sleep 1 # Rename the uninstaller so it shows up in APPS mv "$AppsDir/$AppName/.$AppName - Uninstall.sh" "$AppsDir/$AppName - Uninstall.sh" +mv "$AppsDir/$AppName/$AppName - Hide.sh" "$AppsDir/$AppName - Hide.sh" cleanup_old_versions() { # cleanup from previous versions of Theme Switcher diff --git a/ThemeSwitcher/Roms/APPS/Theme Switcher/.Theme Switcher - Uninstall.sh b/ThemeSwitcher/Roms/APPS/Theme Switcher/.Theme Switcher - Uninstall.sh index 9a98468..675d7bd 100644 --- a/ThemeSwitcher/Roms/APPS/Theme Switcher/.Theme Switcher - Uninstall.sh +++ b/ThemeSwitcher/Roms/APPS/Theme Switcher/.Theme Switcher - Uninstall.sh @@ -10,10 +10,12 @@ AppsDir=$(busybox dirname "$0") AppName="Theme Switcher" SkinsDir="$(busybox dirname $AppsDir)/Skins" -$SkinsDir/.utils/printstr " Uninstalling... " & sleep 1 +$SkinsDir/.utils/printstr " Uninstalling... " & sleep 1 # Delete this uninstaller file rm "$AppsDir/$AppName - Uninstall.sh" +rm "$AppsDir/$AppName - Hide.sh" +rm "$AppsDir/$AppName - Unhide.sh" # remove /Roms/Skins because we made it rm -r "$SkinsDir" diff --git a/ThemeSwitcher/Roms/APPS/Theme Switcher/Skins/! Refresh b/ThemeSwitcher/Roms/APPS/Theme Switcher/Skins/! Refresh index 51519de..72985dd 100644 --- a/ThemeSwitcher/Roms/APPS/Theme Switcher/Skins/! Refresh +++ b/ThemeSwitcher/Roms/APPS/Theme Switcher/Skins/! Refresh @@ -7,8 +7,7 @@ rootSystemIconsDir="$rootDir/SystemIcons" # All the output scripts go here skinsDir=$(busybox dirname "$0") - -$skinsDir/.utils/printstr " Refreshing... " & sleep 1 +$skinsDir/.utils/printstr " Refreshing... " & sleep 1 # Create the image preview folder if it doesn't exit mkdir -p "$skinsDir/Imgs" @@ -65,8 +64,7 @@ generate_themes() { # Delete skin, font and lang folders, replace with garlic os defaults echo "#!/bin/sh - - $skinsDir/.utils/printstr \" Switching theme... \" & sleep 1 + $skinsDir/.utils/printstr \" Switching theme... \" & sleep 1 for folder in skin font lang do @@ -110,9 +108,7 @@ generate_themes() { # If the folder has a boot logo, pull it out to it's own script if [ -f "$dir/misc/boot_logo.bmp.gz" ]; then echo "#!/bin/sh - - $skinsDir/.utils/printstr \" Switching boot logo... \" & sleep 1 - + $skinsDir/.utils/printstr \" Switching boot logo... \" & sleep 1 mount -o remount,rw /misc cp -r \"$rootThemesDir/$themeName/misc/boot_logo.bmp.gz\" \"/misc/boot_logo.bmp.gz\" mount -o remount,ro /misc @@ -149,9 +145,7 @@ generate_bootlogos() { # If the folder has a boot logo, pull it out to it's own script if [ -f "$dir/misc/boot_logo.bmp.gz" ]; then echo "#!/bin/sh - - $skinsDir/.utils/printstr \" Switching boot logo... \" & sleep 1 - + $skinsDir/.utils/printstr \" Switching boot logo... \" & sleep 1 mount -o remount,rw /misc cp -r \"$rootBootLogosDir/$themeName/misc/boot_logo.bmp.gz\" \"/misc/boot_logo.bmp.gz\" mount -o remount,ro /misc @@ -188,10 +182,9 @@ generate_systemicons() { # If this folder is actually an icon set, make it into it's own script if [ -d "$dir/system" ]; then echo "#!/bin/sh - - $skinsDir/.utils/printstr \" Switching system icons... \" & sleep 1 - - cp -rv \"$rootSystemIconsDir/$themeName/system\" \"/mnt/mmc/CFW/skin\" $rumble" > "$iconsSh" + $skinsDir/.utils/printstr \" Switching system icons... \" & sleep 1 + cp -rv \"$rootSystemIconsDir/$themeName/system\" \"/mnt/mmc/CFW/skin\" + $rumble" > "$iconsSh" # copy the preview if it exists if [ -f "$dir/Imgs/$themeName.png" ]; then @@ -207,7 +200,7 @@ generate_systemicons() { add_defaults() { echo "#!/bin/sh -$skinsDir/.utils/printstr \" Resetting theme & icons... \" & sleep 1 +$skinsDir/.utils/printstr \" Resetting theme & icons... \" & sleep 1 for folder in skin font lang do @@ -223,7 +216,7 @@ $rumble" > "$skinsDir/Garlic OS$themeSuffix.sh" echo "#!/bin/sh # copy in the default files from garlic os -$skinsDir/.utils/printstr \" Resetting boot logo... \" & sleep 1 +$skinsDir/.utils/printstr \" Resetting boot logo... \" & sleep 1 mount -o remount,rw /misc cp -r \"$skinsDir/.garlicos/misc/boot_logo.bmp.gz\" \"/misc/boot_logo.bmp.gz\" diff --git a/ThemeSwitcher/Roms/APPS/Theme Switcher/Skins/.README.md b/ThemeSwitcher/Roms/APPS/Theme Switcher/Skins/.README.md index 36628e2..801fb11 100644 --- a/ThemeSwitcher/Roms/APPS/Theme Switcher/Skins/.README.md +++ b/ThemeSwitcher/Roms/APPS/Theme Switcher/Skins/.README.md @@ -6,9 +6,20 @@ 4. Launch Consoles > Themes > `! Refresh` on your device 5. ✨ Pick the one you want to swap to ✨ +## APPs + +- "Theme Switcher - Install" will set most things up for you. You still need to download and copy themes/boot logos/system icons onto your sd card +- "Theme Switcher - Uninstall" will remove almost everything but leave your downloads alone +- "Theme Switcher - (Un)hide" will toggle the "Skins" console/tile on and off + +Feel free to delete "Theme Switcher - Uninstall" or prefix the file name with a "." if you don't intend on uninstalling and don't want the entry in your APPS. + ## Expected structure - Roms + - APPS + - "Theme Switcher - (Un)hide.sh" + - "Theme Switcher - Uninstall.sh" - Skins - all the needed scripts are automagically created here - Themes diff --git a/ThemeSwitcher/Roms/APPS/Theme Switcher/Theme Switcher - Hide.sh b/ThemeSwitcher/Roms/APPS/Theme Switcher/Theme Switcher - Hide.sh new file mode 100644 index 0000000..afdd604 --- /dev/null +++ b/ThemeSwitcher/Roms/APPS/Theme Switcher/Theme Switcher - Hide.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +AppsDir=$(busybox dirname "$0") +AppName="Theme Switcher" +SkinsDir="$(busybox dirname $AppsDir)/Skins" + +# Check if coremappings.json includes '"Skins": "/bin/sh",' +if [[ ! -n "$(busybox sed -n '/ "Skins": "\/bin\/sh",/p' /mnt/mmc/CFW/config/coremapping.json)" ]]; then + # it was missing so we add it + busybox sed -i '/{/ a\ "Skins": "\/bin\/sh",' /mnt/mmc/CFW/config/coremapping.json + $SkinsDir/.utils/printstr " Unhiding skins tile... " & sleep 1 + mv "$AppsDir/$AppName - Unhide.sh" "$AppsDir/$AppName - Hide.sh" +else + # it was there so we remove it + busybox sed -i '/ "Skins": "\/bin\/sh",/d' /mnt/mmc/CFW/config/coremapping.json + $SkinsDir/.utils/printstr " Hiding skins tile... " & sleep 1 + mv "$AppsDir/$AppName - Hide.sh" "$AppsDir/$AppName - Unhide.sh" +fi + +# Rumble success +echo 50 > "/sys/class/power_supply/battery/moto" +busybox sleep 0.2 +echo 0 > "/sys/class/power_supply/battery/moto" +busybox sleep 0.1 +echo 60 > "/sys/class/power_supply/battery/moto" +busybox sleep 0.2 +echo 0 > "/sys/class/power_supply/battery/moto" +busybox sleep 0.1 +echo 70 > "/sys/class/power_supply/battery/moto" +busybox sleep 0.2 +echo 0 > "/sys/class/power_supply/battery/moto" \ No newline at end of file