Skip to content

Commit

Permalink
feat: added hide script
Browse files Browse the repository at this point in the history
  • Loading branch information
Denifia committed May 1, 2023
1 parent 6c93070 commit ba2999f
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 18 deletions.
5 changes: 5 additions & 0 deletions .scripts/release-theme-switcher.sh
Original file line number Diff line number Diff line change
@@ -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 -
3 changes: 2 additions & 1 deletion ThemeSwitcher/Roms/APPS/Theme Switcher - Install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
25 changes: 9 additions & 16 deletions ThemeSwitcher/Roms/APPS/Theme Switcher/Skins/! Refresh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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\"
Expand Down
11 changes: 11 additions & 0 deletions ThemeSwitcher/Roms/APPS/Theme Switcher/Skins/.README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 31 additions & 0 deletions ThemeSwitcher/Roms/APPS/Theme Switcher/Theme Switcher - Hide.sh
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit ba2999f

Please sign in to comment.