Thread View: alt.comp.os.windows-10
27 messages
27 total messages
Started by Maria Sophia
Thu, 19 Nov 2026 20:06
Can we programmatically get package names of icons in a homescreen folder?
Author: Maria Sophia
Date: Thu, 19 Nov 2026 20:06
Date: Thu, 19 Nov 2026 20:06
29 lines
2514 bytes
2514 bytes
Can we programmatically get package names of icons in a homescreen folder? a. Windows b. Android c. Over Wi-Fi This week, the Santa Cruz mountains were blessed with an atmospheric river of about a foot of rain (or so), based on the water in my outdoor buckets. I had lowered my pool, 'cuz I knew it would rain, and I got ten thousand gallons of free distilled water (as my well water has too high of a TA). Notice, for a pool, I think in gallons (specifically thousands of gallons). So I needed an app that told me how many gallons of rain I will get that will fill a certain square footage of open area (such as an outdoor pool). But my 20 weather-related apps were in my "nature" folder, so I moved them out away from the sun/moon calendars and star charts, and topo apps. Now I have a "weather" folder with 5 rows of 4 icons per row, for 20 apps. But what's the easiest way to get the package names for each of those apps? I might do it with python, or Windows batch, or adb, but that's why I ask. Q: How can Windows get the package names of apps in an Android folder? A: ? -- Every solution is based on good ole' American ingeniuity solving a problem.
Re: Can we programmatically get package names of icons in a homescreen folder?
Author: Maria Sophia
Date: Thu, 19 Nov 2026 21:21
Date: Thu, 19 Nov 2026 21:21
43 lines
2607 bytes
2607 bytes
Maria Sophia wrote: > Q: How can Windows get the package names of apps in an Android folder? > A: ? OK. I solved it. It was NOT easy. Many dead ends. Too many to count. I couldn't do it using only Android tools as I needed Windows tools. adb apkanalyzer dexdump findstr grep PowerShell DB Browser for SQLite.exe Here's the list of weather apps in my homescreen weather folder. com.accuweather.android co.windyapp.android aerow.us.aerowind com.airvisual org.asdtm.goodweather com.macca895.sunriise com.lholman.hiweather com.neverads.just_weather org.androworks.klara uk.co.openweather org.woheller69.weather com.yoshi.rain org.breezyweather wangdaye.com.geometricweather com.alexplas.weathernew info.vazquezsoftware.weatheralarms com.la.local.weather.forecast.app com.windhub.marine.weather com.windyty.android no.nrk.yr It will take a while to write this up to the point that someone else can do it themselves, where I think it's best to write a more generic procedure. C:\> gethomescreenfolderapps.bat (or something like that) It should use Windows to list the folders on the Android homescreen and the packages that are in each of those folders.
Re: Can we programmatically get package names of icons in a homescreen folder?
Author: Maria Sophia
Date: Thu, 19 Nov 2026 21:58
Date: Thu, 19 Nov 2026 21:58
99 lines
9359 bytes
9359 bytes
Maria Sophia wrote:
> It should use Windows to list the folders on the Android
> homescreen and the packages that are in each of those folders.
This query will take as input the (unique) name of a folder on the Android
homescreen (in this case, it's "weather") and spit out the packages in it.
1. Make a homescreen backup (default name '2026-11-19_12-57.novabackup')
2. Copy that backup file from Android to Windows over Wi-Fi/USB
C:\> adb pull /storage/emulated/0/0000/bck/nova_backup/2026-11-19_12-57.novabackup
3. Extract it
C:\> copy 2026-11-19_12-57.novabackup backup.zip && powershell -NoProfile -Command "Expand-Archive -LiteralPath backup.zip -DestinationPath backup_extracted -Force" && dir /s /b backup_extracted
4. Open the sql database
C:\> "C:\app\editor\sql\db4s\App\SQLiteDatabaseBrowser64\DB Browser for SQLite.exe" C:\app\editor\android\scrcpy\nova\backup_extracted\nova.db
5. In the "Execute SQL" tab, run this query:
/*
Pulls all items stored inside the "weather" folder (container = 2921)
from Nova Launcher's favorites table and extracts each app's package name.
/*
Pulls all items stored inside the "weather" folder (container = 2921)
from Nova Launcher's favorites table and extracts each app's package name.
*/
SELECT
f._id AS item_id, -- Unique row ID of the item in favorites
f.title AS app_title, -- Display name shown on the homescreen/folder
CASE
-- Prefer explicit iconPackage if Nova populated it
WHEN f.iconPackage IS NOT NULL AND f.iconPackage != '' THEN f.iconPackage
-- Otherwise, look for "component=pkg.name/ActivityName" inside intent
WHEN INSTR(f.intent, 'component=') > 0 THEN
SUBSTR(
-- Slice from right after "component=" (10 characters long) to the end
SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10),
1,
-- Take characters up to (but not including) the first "/"
INSTR(SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10), '/') - 1
)
ELSE '' -- Fallback if neither iconPackage nor component= is found
END AS package_name,
f.intent -- Raw Android intent string for reference
FROM favorites f
WHERE f.container = 2921 -- 2921 is the _id of the "weather" folder
ORDER BY f.rank, f._id; -- Keep folder sort order, breaking ties by row ID
These are the results from which package names & nicknames can be culled.
1892 AccuWeather com.accuweather.android #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.accuweather.android/.splashscreen.ui.SplashActivity;end
1830 Windy.app co.windyapp.android #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=co.windyapp.android/.ui.mainscreen.container.MainActivity;end
2456 AeroWind aerow.us.aerowind #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=aerow.us.aerowind/.GetWeather;end
2448 AirVisual com.airvisual #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.airvisual/.ui.activity.SplashActivity;end
1878 Good Weather org.asdtm.goodweather #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=org.asdtm.goodweather/.MainActivity;end
2266 Hey Sunrise com.macca895.sunriise #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.macca895.sunriise/.main.MainActivity;end
2455 hiweather com.lholman.hiweather #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.lholman.hiweather/.MainActivity;end
2471 just weather com.neverads.just_weather #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.neverads.just_weather/com.neverads.myapp.MainActivity;end
2469 Klara org.androworks.klara #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=org.androworks.klara/.MainActivity;end
2472 OpenWeather uk.co.openweather #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=uk.co.openweather/.MainActivity;end
2509 RadarWeather org.woheller69.weather #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=org.woheller69.weather/.activities.SplashActivity;end
2460 Rain com.yoshi.rain #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.yoshi.rain/.MainActivity;end
2914 Weather org.breezyweather #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=org.breezyweather/.ui.main.MainActivity;end
2618 Weather wangdaye.com.geometricweather #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=wangdaye.com.geometricweather/.main.MainActivity;end
2473 Weather com.alexplas.weathernew #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.alexplas.weathernew/.ui.MainActivity;end
1821 Weather Alerts info.vazquezsoftware.weatheralarms #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=info.vazquezsoftware.weatheralarms/.LoadingActivity;end
2453 Weather Forecast com.la.local.weather.forecast.app #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.la.local.weather.forecast.app/.activities.SplashActivity;end
1831 WindHub com.windhub.marine.weather #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.windhub.marine.weather/wind.hub.ui.launcher.LauncherActivity;end
1824 Windy com.windyty.android #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.windyty.android/.MainActivity;end
2468 Yr no.nrk.yr #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=no.nrk.yr/.MainActivity;end
C:\> where cut
C:\Program Files\coreutils\bin\cut.exe
C:\> cut -f2,3 output.txt
AccuWeather com.accuweather.android
Windy.app co.windyapp.android
AeroWind aerow.us.aerowind
AirVisual com.airvisual
Good Weather org.asdtm.goodweather
Hey Sunrise com.macca895.sunriise
hiweather com.lholman.hiweather
just weather com.neverads.just_weather
Klara org.androworks.klara
OpenWeather uk.co.openweather
RadarWeather org.woheller69.weather
Rain com.yoshi.rain
Weather org.breezyweather
Weather wangdaye.com.geometricweather
Weather com.alexplas.weathernew
Weather Alerts info.vazquezsoftware.weatheralarms
Weather Forecast com.la.local.weather.forecast.app
WindHub com.windhub.marine.weather
Windy com.windyty.android
Yr no.nrk.yr
Voila!
We just obtained the packages in any given Android homescreen folder.
Later I will make it more generic so that it's useful to many others.
But I got what I needed (although it took, oh, an hour or so).
--
Necessity and good ole' American ingenuity is the mother of invention.
Re: Can we programmatically get package names of icons in a homescreen folder?
Author: Maria Sophia
Date: Thu, 19 Nov 2026 23:09
Date: Thu, 19 Nov 2026 23:09
157 lines
12457 bytes
12457 bytes
Maria Sophia wrote:
> But I got what I needed (although it took, oh, an hour or so).
It always takes longer to write it up so anyone else can do it
than it takes to hack out the solution, but here's the writeup.
This is so that every thread adds value to the group knowledge.
Note I tried first to do it purely on Android, but failed.
So that's why this is a Windows-only solution (over Wi-Fi).
How to extract app titles & package names from an Android homescreen folder
(over Wi-Fi/USB using Nova Launcher & Windows commands & coreutils).
Dependencies:
a. Android Debug Bridge (ADB) is installed and accessible through %PATH%.
b. GNU Coreutils are installed and accessible through %PATH%.
c. SQLite is available at the specified Android SDK platform-tools location.
I originally used the graphical user interface but found a CLI method instead:
d. DB Browser for SQLite is available for graphical use, but it is optional.
1. Create a Nova Launcher backup on Android.
NovaSettings > Backup & Restore > Backup > 2026-11-19_12-57.novabackup
2. Copy the backup file from Android to Windows.
C:\> where pwd
=> C:\Program Files\coreutils\bin\pwd.exe
C:\> pwd
=> C:\app\editor\android\scrcpy
C:\> mkdir nova
C:\> cd nova
C:\> adb pull /storage/emulated/0/0000/bck/nova_backup/2026-11-19_12-57.novabackup
=> /storage/emulated/0/0000/bck/nova_backup/2026-...
=> 0 skipped. 4.1 MB/s (6564861 bytes in 1.536s)
3. Rename the backup file to a zip file.
C:\> rename 2026-11-19_12-57.novabackup backup.zip
4. Extract the backup.zip to obtain the SQL database & supporting files.
C:\> powershell -NoProfile -Command "Expand-Archive -LiteralPath backup.zip -DestinationPath backup_extracted -Force"
5. Locate the nova.db SQLite database file.
C:\> dir backup_extracted
11/19/2026 12:58 PM 7,688,192 nova.db
11/19/2026 12:58 PM 6,455 nova.xml
11/19/2026 12:58 PM 4,818 supportDetails.txt
Steps 6 to 8 use the optional GUI called "DB Browser for SQLite" to open the
database and to run the SQL query. Those steps were used when I was honing
the steps, so at this point, the GUI is vestigial. To do everything from
the command line, skip steps 6 to 8 and go directly to step 9 which runs
the honed query using the command-line sqlite3.exe instead of the GUI.
6. OPTIONAL: Open nova.db with DB Browser for SQLite.
C:\> "C:\app\editor\sql\db4s\App\SQLiteDatabaseBrowser64\DB Browser for SQLite.exe" C:\app\editor\android\scrcpy\nova\backup_extracted\nova.db
7. OPTIONAL: Run the SQL query to retrieve contents of the weather folder.
a. Open the 'Execute SQL' tab in the DB Browswer for SQLite GUI
b. Paste the code below into that tab & press the "run" button
c. The result will be the desired output in tabular form
8. OPTIONAL: This is the code:
/*
Pulls all items stored inside the "weather" folder (container = 2921)
from Nova Launcher favorites table and extracts each app package name.
*/
SELECT
f._id AS item_id, -- Unique row id of the item in favorites
f.title AS app_title, -- Display name shown on the homescreen or folder
CASE
-- Use explicit icon package if populated
WHEN f.iconPackage IS NOT NULL AND f.iconPackage != '' THEN f.iconPackage
-- Otherwise read package name between component= and / in intent
WHEN INSTR(f.intent, 'component=') > 0 THEN
SUBSTR(
-- Slice from right after component= (10 chars) to end of string
SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10),
1,
-- Take characters up to the first /
INSTR(SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10), '/') - 1
)
ELSE '' -- Fallback when no package name is found
END AS package_name,
f.intent -- Raw Android intent string for reference
FROM favorites f
WHERE f.container = 2921 -- 2921 is the _id of the weather folder
ORDER BY f.rank, f._id; -- Keep folder item order
/* end */
9. Export SQL results to output.txt using sqlite3.exe.
C:\> where sqlite3
=> C:\app\editor\android\sdk\platform-tools\sqlite3.exe
C:\> C:\app\editor\android\sdk\platform-tools\sqlite3.exe --version
=> 3.32.2
C:\> sqlite3.exe -header -cmd ".mode tabs" "C:\app\editor\android\scrcpy\nova\backup_extracted\nova.db" "SELECT f._id AS item_id, f.title AS app_title, CASE WHEN f.iconPackage IS NOT NULL AND f.iconPackage != '' THEN f.iconPackage WHEN INSTR(f.intent, 'component=') > 0 THEN SUBSTR(SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10), 1, INSTR(SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10), '/') - 1) ELSE '' END AS package_name, f.intent FROM favorites f WHERE f.container = 2921 ORDER BY f.rank, f._id;" > output.txt
10. Check the output
C:\> type output.txt
item_id app_title package_name intent
1892 AccuWeather com.accuweather.android #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.accuweather.android/.splashscreen.ui.SplashActivity;end
1830 Windy.app co.windyapp.android #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=co.windyapp.android/.ui.mainscreen.container.MainActivity;end
2456 AeroWind aerow.us.aerowind #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=aerow.us.aerowind/.GetWeather;end
2448 AirVisual com.airvisual #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.airvisual/.ui.activity.SplashActivity;end
1878 Good Weather org.asdtm.goodweather #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=org.asdtm.goodweather/.MainActivity;end
2266 Hey Sunrise com.macca895.sunriise #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.macca895.sunriise/.main.MainActivity;end
2455 hiweather com.lholman.hiweather #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.lholman.hiweather/.MainActivity;end
2471 just weather com.neverads.just_weather #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.neverads.just_weather/com.neverads.myapp.MainActivity;end
2469 Klara org.androworks.klara #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=org.androworks.klara/.MainActivity;end
2472 OpenWeather uk.co.openweather #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=uk.co.openweather/.MainActivity;end
2509 RadarWeather org.woheller69.weather #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=org.woheller69.weather/.activities.SplashActivity;end
2460 Rain com.yoshi.rain #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.yoshi.rain/.MainActivity;end
2914 Weather org.breezyweather #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=org.breezyweather/.ui.main.MainActivity;end
2618 Weather wangdaye.com.geometricweather #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=wangdaye.com.geometricweather/.main.MainActivity;end
2473 Weather com.alexplas.weathernew #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.alexplas.weathernew/.ui.MainActivity;end
1821 Weather Alerts info.vazquezsoftware.weatheralarms #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=info.vazquezsoftware.weatheralarms/.LoadingActivity;end
2453 Weather Forecast com.la.local.weather.forecast.app #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.la.local.weather.forecast.app/.activities.SplashActivity;end
1831 WindHub com.windhub.marine.weather #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.windhub.marine.weather/wind.hub.ui.launcher.LauncherActivity;end
1824 Windy com.windyty.android #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.windyty.android/.MainActivity;end
2468 Yr no.nrk.yr #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=no.nrk.yr/.MainActivity;end
11. Filter columns with coreutils cut.
C:\> where cut
=> C:\Program Files\coreutils\bin\cut.exe
C:\> cut -f2,3 output.txt > weather_apps.txt
Note: The SQLite output uses tab delimiters, so cut -f2,3 extracts
the second and third columns (app_title and package_name).
12. Final result.
C:\> type weather_apps.txt
app_title package_name
AccuWeather com.accuweather.android
Windy.app co.windyapp.android
AeroWind aerow.us.aerowind
AirVisual com.airvisual
Good Weather org.asdtm.goodweather
Hey Sunrise com.macca895.sunriise
hiweather com.lholman.hiweather
just weather com.neverads.just_weather
Klara org.androworks.klara
OpenWeather uk.co.openweather
RadarWeather org.woheller69.weather
Rain com.yoshi.rain
Weather org.breezyweather
Weather wangdaye.com.geometricweather
Weather com.alexplas.weathernew
Weather Alerts info.vazquezsoftware.weatheralarms
Weather Forecast com.la.local.weather.forecast.app
WindHub com.windhub.marine.weather
Windy com.windyty.android
Yr no.nrk.yr
--
The greatest thing about Americans is we never give up innovating.
Re: Can we programmatically get package names of icons in a homescreen folder?
Author: Hank Rogers
Date: Thu, 19 Nov 2026 23:49
Date: Thu, 19 Nov 2026 23:49
167 lines
13420 bytes
13420 bytes
Maria Sophia wrote on 11/19/2026 5:09 PM: > Maria Sophia wrote: >> But I got what I needed (although it took, oh, an hour or so). > > It always takes longer to write it up so anyone else can do it > than it takes to hack out the solution, but here's the writeup. > > This is so that every thread adds value to the group knowledge. > > Note I tried first to do it purely on Android, but failed. > So that's why this is a Windows-only solution (over Wi-Fi). > > How to extract app titles & package names from an Android homescreen folder > (over Wi-Fi/USB using Nova Launcher & Windows commands & coreutils). > > Dependencies: > a. Android Debug Bridge (ADB) is installed and accessible through %PATH%. > b. GNU Coreutils are installed and accessible through %PATH%. > c. SQLite is available at the specified Android SDK platform-tools location. > I originally used the graphical user interface but found a CLI method instead: > d. DB Browser for SQLite is available for graphical use, but it is optional. > > 1. Create a Nova Launcher backup on Android. > NovaSettings > Backup & Restore > Backup > 2026-11-19_12-57.novabackup > > 2. Copy the backup file from Android to Windows. > C:\> where pwd > => C:\Program Files\coreutils\bin\pwd.exe > C:\> pwd > => C:\app\editor\android\scrcpy > C:\> mkdir nova > C:\> cd nova > C:\> adb pull /storage/emulated/0/0000/bck/nova_backup/2026-11-19_12-57.novabackup > => /storage/emulated/0/0000/bck/nova_backup/2026-... > => 0 skipped. 4.1 MB/s (6564861 bytes in 1.536s) > > 3. Rename the backup file to a zip file. > C:\> rename 2026-11-19_12-57.novabackup backup.zip > > 4. Extract the backup.zip to obtain the SQL database & supporting files. > C:\> powershell -NoProfile -Command "Expand-Archive -LiteralPath backup.zip -DestinationPath backup_extracted -Force" > > > 5. Locate the nova.db SQLite database file. > C:\> dir backup_extracted > 11/19/2026 12:58 PM 7,688,192 nova.db > 11/19/2026 12:58 PM 6,455 nova.xml > 11/19/2026 12:58 PM 4,818 supportDetails.txt > > Steps 6 to 8 use the optional GUI called "DB Browser for SQLite" to open the > database and to run the SQL query. Those steps were used when I was honing > the steps, so at this point, the GUI is vestigial. To do everything from > the command line, skip steps 6 to 8 and go directly to step 9 which runs > the honed query using the command-line sqlite3.exe instead of the GUI. > > 6. OPTIONAL: Open nova.db with DB Browser for SQLite. > C:\> "C:\app\editor\sql\db4s\App\SQLiteDatabaseBrowser64\DB Browser for SQLite.exe" C:\app\editor\android\scrcpy\nova\backup_extracted\nova.db > > 7. OPTIONAL: Run the SQL query to retrieve contents of the weather folder. > a. Open the 'Execute SQL' tab in the DB Browswer for SQLite GUI > b. Paste the code below into that tab & press the "run" button > c. The result will be the desired output in tabular form > > 8. OPTIONAL: This is the code: > /* > Pulls all items stored inside the "weather" folder (container = 2921) > from Nova Launcher favorites table and extracts each app package name. > */ > SELECT > f._id AS item_id, -- Unique row id of the item in favorites > f.title AS app_title, -- Display name shown on the homescreen or folder > CASE > -- Use explicit icon package if populated > WHEN f.iconPackage IS NOT NULL AND f.iconPackage != '' THEN f.iconPackage > > -- Otherwise read package name between component= and / in intent > WHEN INSTR(f.intent, 'component=') > 0 THEN > SUBSTR( > -- Slice from right after component= (10 chars) to end of string > SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10), > 1, > -- Take characters up to the first / > INSTR(SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10), '/') - 1 > ) > ELSE '' -- Fallback when no package name is found > END AS package_name, > f.intent -- Raw Android intent string for reference > FROM favorites f > WHERE f.container = 2921 -- 2921 is the _id of the weather folder > ORDER BY f.rank, f._id; -- Keep folder item order > /* end */ > > > 9. Export SQL results to output.txt using sqlite3.exe. > C:\> where sqlite3 > => C:\app\editor\android\sdk\platform-tools\sqlite3.exe > C:\> C:\app\editor\android\sdk\platform-tools\sqlite3.exe --version > => 3.32.2 > C:\> sqlite3.exe -header -cmd ".mode tabs" "C:\app\editor\android\scrcpy\nova\backup_extracted\nova.db" "SELECT f._id AS item_id, f.title AS app_title, CASE WHEN f.iconPackage IS NOT NULL AND f.iconPackage != '' THEN f.iconPackage WHEN INSTR(f.intent, 'component=') > 0 THEN SUBSTR(SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10), 1, INSTR(SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10), '/') - 1) ELSE '' END AS package_name, f.intent FROM favorites f WHERE f.container = 2921 ORDER BY f.rank, f._id;" > output.txt > > 10. Check the output > C:\> type output.txt > item_id app_title package_name intent > 1892 AccuWeather com.accuweather.android #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.accuweather.android/.splashscreen.ui.SplashActivity;end > 1830 Windy.app co.windyapp.android #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=co.windyapp.android/.ui.mainscreen.container.MainActivity;end > 2456 AeroWind aerow.us.aerowind #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=aerow.us.aerowind/.GetWeather;end > 2448 AirVisual com.airvisual #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.airvisual/.ui.activity.SplashActivity;end > 1878 Good Weather org.asdtm.goodweather #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=org.asdtm.goodweather/.MainActivity;end > 2266 Hey Sunrise com.macca895.sunriise #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.macca895.sunriise/.main.MainActivity;end > 2455 hiweather com.lholman.hiweather #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.lholman.hiweather/.MainActivity;end > 2471 just weather com.neverads.just_weather #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.neverads.just_weather/com.neverads.myapp.MainActivity;end > 2469 Klara org.androworks.klara #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=org.androworks.klara/.MainActivity;end > 2472 OpenWeather uk.co.openweather #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=uk.co.openweather/.MainActivity;end > 2509 RadarWeather org.woheller69.weather #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=org.woheller69.weather/.activities.SplashActivity;end > 2460 Rain com.yoshi.rain #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.yoshi.rain/.MainActivity;end > 2914 Weather org.breezyweather #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=org.breezyweather/.ui.main.MainActivity;end > 2618 Weather wangdaye.com.geometricweather #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=wangdaye.com.geometricweather/.main.MainActivity;end > 2473 Weather com.alexplas.weathernew #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.alexplas.weathernew/.ui.MainActivity;end > 1821 Weather Alerts info.vazquezsoftware.weatheralarms #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=info.vazquezsoftware.weatheralarms/.LoadingActivity;end > 2453 Weather Forecast com.la.local.weather.forecast.app #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.la.local.weather.forecast.app/.activities.SplashActivity;end > 1831 WindHub com.windhub.marine.weather #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.windhub.marine.weather/wind.hub.ui.launcher.LauncherActivity;end > 1824 Windy com.windyty.android #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.windyty.android/.MainActivity;end > 2468 Yr no.nrk.yr #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=no.nrk.yr/.MainActivity;end > > > 11. Filter columns with coreutils cut. > C:\> where cut > => C:\Program Files\coreutils\bin\cut.exe > C:\> cut -f2,3 output.txt > weather_apps.txt > > Note: The SQLite output uses tab delimiters, so cut -f2,3 extracts > the second and third columns (app_title and package_name). > > 12. Final result. > C:\> type weather_apps.txt > app_title package_name > AccuWeather com.accuweather.android > Windy.app co.windyapp.android > AeroWind aerow.us.aerowind > AirVisual com.airvisual > Good Weather org.asdtm.goodweather > Hey Sunrise com.macca895.sunriise > hiweather com.lholman.hiweather > just weather com.neverads.just_weather > Klara org.androworks.klara > OpenWeather uk.co.openweather > RadarWeather org.woheller69.weather > Rain com.yoshi.rain > Weather org.breezyweather > Weather wangdaye.com.geometricweather > Weather com.alexplas.weathernew > Weather Alerts info.vazquezsoftware.weatheralarms > Weather Forecast com.la.local.weather.forecast.app > WindHub com.windhub.marine.weather > Windy com.windyty.android > Yr no.nrk.yr > Now that's what I call Value, Maria! When can we expect a full blown tutorial with all details? I think this deserves at least 500 pages of documentation, because: (1) very, very important. (2) Only you could have done it. (3) Mucho value was added. (4) It should be recorded and enshrined for posterity. (5) It shows what a true genius can do. Thanks Mary! Is there a fund we can contribute to? We all want to encourage further astute research from you. You are brilliant!
Re: Can we programmatically get package names of icons in a homescreen folder?
Author: Maria Sophia
Date: Thu, 19 Nov 2026 23:53
Date: Thu, 19 Nov 2026 23:53
14 lines
2419 bytes
2419 bytes
Maria Sophia wrote: > It always takes longer to write it up so anyone else can do it > than it takes to hack out the solution, but here's the writeup. So as to leverage the effort to more Android/Windows owners, I added annotated screenshots and then I re-published it here. *[GUIDE] PSA: Extract app titles & package names from Nova Launcher home screen folders (using Windows ADB + SQLite + the last known good Nova version)* <https://xdaforums.com/t/guide-psa-extract-app-titles-package-names-from-nova-launcher-home-screen-folders-using-windows-adb-sqlite-the-last-known-good-nova-version.4809412/> Obviously, we can adapt this method to find all the apps in each & every folder on our Android home screens over Wi-Fi/USB. -- As always, it's 10X more work to document than it is to do it.
Re: Can we programmatically get package names of icons in a homescreen folder?
Author: Maria Sophia
Date: Fri, 20 Nov 2026 03:14
Date: Fri, 20 Nov 2026 03:14
316 lines
13700 bytes
13700 bytes
So that every post is well thought out to add value to the gropup,
here's a first-pass script (I just now created by re-purposing
the adbcopy.bat script) that will do what the tutorial did.
This script will be updated in the next hour so that it eventually
will list all folders on the users' Android, and they can pick one.
Then it will spit out all the apps in that chosen folder.
This is VERY useful for archival and backup/restore purposes.
But right now, it simply does what the previous walk thru did.
Since this is for others to run, I removed most of the dependencies.
C:\> adbfolder.bat
Working directory: "C:\app\editor\android\scrcpy"
Nova work directory: "C:\app\editor\android\scrcpy\nova" ---------------- Select source for Nova Launcher database: [1] Pull .novabackup from Android via ADB and extract nova.db [Default] [2] Use an existing nova.db (or .novabackup / .zip) already on Windows
Enter choice [1 or 2]: 1
--- Pull Nova Backup from Android ---
Targeting device: 192.168.1.4:5555
Listing backups in /storage/emulated/0/0000/bck/nova_backup ...
/storage/emulated/0/0000/bck/nova_backup/2026-11-19_12-57.novabackup
/storage/emulated/0/0000/bck/nova_backup/2026-08-19_21-51.novabackup
/storage/emulated/0/0000/bck/nova_backup/2026-08-19_11-31.novabackup
/storage/emulated/0/0000/bck/nova_backup/2026-08-16_11-36.novabackup
Enter backup filename [Default: 2026-11-19_12-57.novabackup]:
Pulling "/storage/emulated/0/0000/bck/nova_backup/2026-11-19_12-57.novabackup" to "C:\app\editor\android\scrcpy\nova\2026-11-19_12-57.novabackup" ...
/storage/emulated/0/0000/bck/nova_backup/2026-... 0 skipped. 3.9 MB/s (6564861 bytes in 1.618s)
Extracting backup.zip to "C:\app\editor\android\scrcpy\nova\backup_extracted" ...
Using database: "C:\app\editor\android\scrcpy\nova\backup_extracted\nova.db"
Enter folder container _id [Default: 2921]:
Querying favorites for container = 2921 ...
--- Result (C:\app\editor\android\scrcpy\nova\weather_apps.txt) ---
app_title package_name
--------- ------------
AccuWeather com.accuweather.android
Windy.app co.windyapp.android
AeroWind aerow.us.aerowind
AirVisual com.airvisual
Good Weather org.asdtm.goodweather
Hey Sunrise com.macca895.sunriise
hiweather com.lholman.hiweather
just weather com.neverads.just_weather
Klara org.androworks.klara
OpenWeather uk.co.openweather
RadarWeather org.woheller69.weather
Rain com.yoshi.rain
Weather org.breezyweather
Weather wangdaye.com.geometricweather
Weather com.alexplas.weathernew
Weather Alerts info.vazquezsoftware.weatheralarms
Weather Forecast com.la.local.weather.forecast.app
WindHub com.windhub.marine.weather
Windy com.windyty.android
Yr no.nrk.yr
Raw tab-delimited output saved to: "C:\app\editor\android\scrcpy\nova\output.txt"
Filtered app list saved to: "C:\app\editor\android\scrcpy\nova\weather_apps.txt"
Press any key to continue . . .
:: adbfolder.bat
:: -------------------------------------------------------------------------
:: Extracts items from a Nova Launcher folder (default container = 2921)
:: into a clean tab-separated list of app titles and package names.
:: Supports pulling a .novabackup via adb or using a local nova.db.
:: Avoids coreutils dependencies (uses native cmd + PowerShell).
:: -------------------------------------------------------------------------
:: v1p0 20261119 Initial version pull backup or use local nova.db, query
:: SQLite via sqlite3.exe, filter columns with PowerShell.
:: -------------------------------------------------------------------------
@echo off
setlocal enabledelayedexpansion
cd /d "%~dp0"
:: --- Configurable Paths ---
set "ADB_EXE=C:\app\editor\android\scrcpy\adb.exe"
set "SQLITE_EXE=C:\app\editor\android\sdk\platform-tools\sqlite3.exe"
set "WORK_DIR=C:\app\editor\android\scrcpy\nova"
set "ANDROID_BCK_DIR=/storage/emulated/0/0000/bck/nova_backup"
set "DEFAULT_CONTAINER=2921"
:: Verify sqlite3.exe exists before starting
if not exist "%SQLITE_EXE%" (
echo [ERROR] sqlite3.exe not found at: "%SQLITE_EXE%"
pause
exit /b 1
)
if not exist "%WORK_DIR%" mkdir "%WORK_DIR%"
echo Working directory: "%CD%"
echo Nova work directory: "%WORK_DIR%"
echo ----------------
echo.
echo Select source for Nova Launcher database:
echo [1] Pull .novabackup from Android via ADB and extract nova.db [Default]
echo [2] Use an existing nova.db (or .novabackup / .zip) already on Windows
echo.
set "SRC_CHOICE=1"
set /p "SRC_CHOICE=Enter choice [1 or 2]: "
if "%SRC_CHOICE%"=="2" goto :use_local_source
if "%SRC_CHOICE%"=="1" goto :pull_from_android
goto :pull_from_android
:: -------------------------------------------------------------------------
:: OPTION 1: PULL BACKUP FROM ANDROID VIA ADB
:: -------------------------------------------------------------------------
:pull_from_android
echo.
echo --- Pull Nova Backup from Android ---
if not exist "%ADB_EXE%" (
echo [ERROR] adb.exe not found at: "%ADB_EXE%"
pause
exit /b 1
)
set "ADB_TARGET="
for /f "skip=1 tokens=1" %%g in ('"%ADB_EXE%" devices') do (
if not "%%g"=="" (
if "!ADB_TARGET!"=="" set "ADB_TARGET=%%g"
)
)
if "!ADB_TARGET!"=="" (
echo [ERROR] No connected ADB devices found.
pause
exit /b 1
)
echo Targeting device: %ADB_TARGET%
echo Listing backups in %ANDROID_BCK_DIR% ...
echo.
"%ADB_EXE%" -s %ADB_TARGET% shell ls -1t "%ANDROID_BCK_DIR%/*.novabackup" 2>nul > "%TEMP%\nova_backups.txt"
set "LATEST_REMOTE="
for /f "usebackq delims=" %%B in ("%TEMP%\nova_backups.txt") do (
if not "%%B"=="" (
if "!LATEST_REMOTE!"=="" set "LATEST_REMOTE=%%B"
echo %%B
)
)
del "%TEMP%\nova_backups.txt" >nul 2>&1
if "!LATEST_REMOTE!"=="" (
echo [WARN] Could not auto-list .novabackup files in %ANDROID_BCK_DIR%.
set /p "BCK_NAME=Enter backup filename (e.g. 2026-11-19_12-57.novabackup): "
) else (
for %%F in ("!LATEST_REMOTE!") do set "DEFAULT_BCK=%%~nxF"
echo.
set "BCK_NAME=!DEFAULT_BCK!"
set /p "BCK_NAME=Enter backup filename [Default: !DEFAULT_BCK!]: "
)
if "!BCK_NAME!"=="" (
echo [ERROR] No backup filename provided.
pause
exit /b 1
)
:: Strip surrounding quotes if pasted
set "BCK_NAME=!BCK_NAME:"=!"
:: If user typed a full Android path, extract just the filename
for %%F in ("!BCK_NAME!") do set "BCK_FILE=%%~nxF"
set "LOCAL_BCK=%WORK_DIR%\%BCK_FILE%"
set "LOCAL_ZIP=%WORK_DIR%\backup.zip"
set "EXTRACT_DIR=%WORK_DIR%\backup_extracted"
echo.
echo Pulling "%ANDROID_BCK_DIR%/%BCK_FILE%" to "%LOCAL_BCK%" ...
"%ADB_EXE%" -s %ADB_TARGET% pull "%ANDROID_BCK_DIR%/%BCK_FILE%" "%LOCAL_BCK%"
if errorlevel 1 (
echo [ERROR] Failed to pull backup from Android.
pause
exit /b 1
)
if exist "%LOCAL_ZIP%" del /f /q "%LOCAL_ZIP%"
ren "%LOCAL_BCK%" "backup.zip"
if errorlevel 1 (
echo [ERROR] Failed to rename "%LOCAL_BCK%" to backup.zip.
pause
exit /b 1
)
if exist "%EXTRACT_DIR%" rmdir /s /q "%EXTRACT_DIR%"
echo Extracting backup.zip to "%EXTRACT_DIR%" ...
powershell -NoProfile -Command "Expand-Archive -LiteralPath '%LOCAL_ZIP%' -DestinationPath '%EXTRACT_DIR%' -Force"
if errorlevel 1 (
echo [ERROR] Failed to extract backup.zip.
pause
exit /b 1
)
set "DB_PATH=%EXTRACT_DIR%\nova.db"
goto :verify_db
:: -------------------------------------------------------------------------
:: OPTION 2: USE LOCAL NOVA.DB (OR .NOVABACKUP / .ZIP)
:: -------------------------------------------------------------------------
:use_local_source
echo.
echo --- Local Database Selection ---
echo Enter the path to nova.db (or a .novabackup / .zip file).
echo Default: "%WORK_DIR%\backup_extracted\nova.db"
echo.
:ask_local_db
set "USER_DB="
set /p "USER_DB=Path to database or backup file [Enter for default]: "
if "!USER_DB!"=="" (
set "DB_PATH=%WORK_DIR%\backup_extracted\nova.db"
) else (
set "USER_DB=!USER_DB:"=!"
for %%A in ("!USER_DB!") do set "DB_PATH=%%~fA"
)
if not exist "%DB_PATH%" (
echo [ERROR] File not found: "%DB_PATH%"
set "RETRY="
set /p "RETRY=Try again? [Y/n]: "
if /i "!RETRY!"=="n" exit /b 1
goto :ask_local_db
)
:: If user pointed to a .novabackup or .zip instead of nova.db, extract it first
for %%E in ("%DB_PATH%") do set "EXT=%%~xE"
if /i "!EXT!"==".novabackup" goto :extract_local_archive
if /i "!EXT!"==".zip" goto :extract_local_archive
goto :verify_db
:extract_local_archive
set "EXTRACT_DIR=%WORK_DIR%\backup_extracted"
if exist "%EXTRACT_DIR%" rmdir /s /q "%EXTRACT_DIR%"
echo Extracting "%DB_PATH%" to "%EXTRACT_DIR%" ...
powershell -NoProfile -Command "Expand-Archive -LiteralPath '%DB_PATH%' -DestinationPath '%EXTRACT_DIR%' -Force"
if errorlevel 1 (
echo [ERROR] Failed to extract archive.
pause
exit /b 1
)
set "DB_PATH=%EXTRACT_DIR%\nova.db"
:: -------------------------------------------------------------------------
:: VERIFY DATABASE & FOLDER CONTAINER ID
:: -------------------------------------------------------------------------
:verify_db
if not exist "%DB_PATH%" (
echo [ERROR] nova.db not found at: "%DB_PATH%"
pause
exit /b 1
)
echo.
echo Using database: "%DB_PATH%"
set "CONTAINER_ID=%DEFAULT_CONTAINER%"
set /p "CONTAINER_ID=Enter folder container _id [Default: %DEFAULT_CONTAINER%]: "
if "%CONTAINER_ID%"=="" set "CONTAINER_ID=%DEFAULT_CONTAINER%"
set "RAW_OUT=%WORK_DIR%\output.txt"
set "CLEAN_OUT=%WORK_DIR%\weather_apps.txt"
:: -------------------------------------------------------------------------
:: RUN SQLITE QUERY & FILTER COLUMNS (NO COREUTILS)
:: -------------------------------------------------------------------------
echo.
echo Querying favorites for container = %CONTAINER_ID% ...
"%SQLITE_EXE%" -header -cmd ".mode tabs" "%DB_PATH%" "SELECT f._id AS item_id, f.title AS app_title, CASE WHEN f.iconPackage IS NOT NULL AND f.iconPackage != '' THEN f.iconPackage WHEN INSTR(f.intent, 'component=') > 0 THEN SUBSTR(SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10), 1, INSTR(SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10), '/') - 1) ELSE '' END AS package_name, f.intent FROM favorites f WHERE f.container = %CONTAINER_ID% ORDER BY f.rank, f._id;" > "%RAW_OUT%"
if errorlevel 1 (
echo [ERROR] SQLite query failed.
pause
exit /b 1
)
:: Equivalent to: cut -f2,3 output.txt > weather_apps.txt
powershell -NoProfile -Command "Import-Csv -LiteralPath '%RAW_OUT%' -Delimiter \"`t\" | Select-Object app_title, package_name | Format-Table -AutoSize | Out-String -Width 4096 | ForEach-Object { $_.TrimEnd() } | Where-Object { $_ -ne '' } | Set-Content -LiteralPath '%CLEAN_OUT%' -Encoding UTF8"
if errorlevel 1 (
echo [ERROR] Failed to format output columns.
pause
exit /b 1
)
echo.
echo --- Result (%CLEAN_OUT%) ---
echo.
type "%CLEAN_OUT%"
echo.
echo Raw tab-delimited output saved to: "%RAW_OUT%"
echo Filtered app list saved to: "%CLEAN_OUT%"
echo.
pause
exit /b 0
:: -------------------------------------------------------------------------
:: end of adbfolder.bat
:: -------------------------------------------------------------------------
--
Some people care to help others while some people are simply mean spirited.
Re: Can we programmatically get package names of icons in a homescreen folder?
Author: Maria Sophia
Date: Fri, 20 Nov 2026 03:45
Date: Fri, 20 Nov 2026 03:45
655 lines
25404 bytes
25404 bytes
Maria Sophia wrote:
> This script will be updated in the next hour so that it eventually
> will list all folders on the users' Android, and they can pick one.
It's working finally!
Running powershell inside of batch gets 'fugly fast, but nonetheless,
here's the first working script that lists all the folders found
on the users' Android device and then gives them the choice of
which folder to parse to list the apps which are in that folder.
The intent is to help the user with a backup & restore strategy.
So far, I've only tested the simplest most obvious choices.
I'm sure creeping elegance will improve this, but it's working.
I'll remove the debugs (which I needed temporarily) due to
stupid syntax issues that I don't want to think about for powershell.
And I'll reverse the order of the outpuot for readability.
I'll also check for dependences (namely adb & sqlite3.exe)
even though they work fine on my system as this is for others.
But this is the first working version that asks the user what
folder they want to list the apps from, out of all the folders.
C:\app\editor\android\scrcpy> adbfolder.bat
[DEBUG] SCRIPT_DIR="C:\app\editor\android\scrcpy\"
[DEBUG] CD="C:\app\editor\android\scrcpy"
[DEBUG] ADB_EXE="C:\app\editor\android\scrcpy\adb.exe"
[DEBUG] SQLITE_EXE="C:\app\editor\android\sdk\platform-tools\sqlite3.exe"
[DEBUG] WORK_DIR="C:\app\editor\android\scrcpy\nova"
Working directory: "C:\app\editor\android\scrcpy"
Nova work directory: "C:\app\editor\android\scrcpy\nova"
----------------
Select source for Nova Launcher database:
[1] Pull .novabackup from Android via ADB and extract nova.db [Default]
[2] Use an existing nova.db (or .novabackup / .zip) already on Windows
Enter choice [1 or 2]: 1
[DEBUG] SRC_CHOICE="1"
--- Pull Nova Backup from Android ---
[DEBUG] ADB_TARGET="192.168.1.4:5555"
Targeting device: 192.168.1.4:5555
Listing backups in /storage/emulated/0/0000/bck/nova_backup ...
[DEBUG] ls exit errorlevel=0
[DEBUG] Raw C:\Users\maria\AppData\Local\Temp\nova_backups.txt contents:
/storage/emulated/0/0000/bck/nova_backup/2026-11-19_12-57.novabackup
/storage/emulated/0/0000/bck/nova_backup/2026-08-19_21-51.novabackup
/storage/emulated/0/0000/bck/nova_backup/2026-08-19_11-31.novabackup
/storage/emulated/0/0000/bck/nova_backup/2026-08-16_11-36.novabackup
[1] 2026-11-19_12-57.novabackup
[DEBUG] BCK_ITEM_1="2026-11-19_12-57.novabackup"
[2] 2026-08-19_21-51.novabackup
[DEBUG] BCK_ITEM_2="2026-08-19_21-51.novabackup"
[3] 2026-08-19_11-31.novabackup
[DEBUG] BCK_ITEM_3="2026-08-19_11-31.novabackup"
[4] 2026-08-16_11-36.novabackup
[DEBUG] BCK_ITEM_4="2026-08-16_11-36.novabackup"
Select backup number [1-4, Default: 1]: 1
[DEBUG] BCK_PICK="1"
[DEBUG] BCK_FILE="2026-11-19_12-57.novabackup"
Pulling "/storage/emulated/0/0000/bck/nova_backup/2026-11-19_12-57.novabackup" to "C:\app\editor\android\scrcpy\nova\2026-11-19_12-57.novabackup" ...
/storage/emulated/0/0000/bck/nova_backup/2026-... 0 skipped. 3.7 MB/s (6564861 bytes in 1.693s)
Extracting backup.zip to "C:\app\editor\android\scrcpy\nova\backup_extracted" ...
Using database: "C:\app\editor\android\scrcpy\nova\backup_extracted\nova.db"
Scanning Nova Launcher folders ...
[DEBUG] Folder query exit errorlevel=0
[DEBUG] Raw C:\Users\maria\AppData\Local\Temp\nova_folders.txt contents:
1895|(Untitled Folder)
2006|(Untitled Folder)
2432|(Untitled Folder)
2465|(Untitled Folder)
2677|(Untitled Folder)
2729|(Untitled Folder)
194|apk
76|audio
63|auto
2616|automate
1657|buy
1972|Clock
30|comms
2601|epub
57|files
2589|hike
2318|motion
1678|nature
1011|net
2354|obd
42|pic
1983|PlantID
1019|sensor
2071|shortcut
2005|shortcuts
2160|spoof
585|stuff
2368|SvcMode
28|sys
1045|time
38|todo
2392|todo
1947|toon
2494|track
2695|TTS
1012|vid
2921|weather
1003|web
2321|webcam
[1] (Untitled Folder)
[2] (Untitled Folder)
[3] (Untitled Folder)
[4] (Untitled Folder)
[5] (Untitled Folder)
[6] (Untitled Folder)
[7] apk
[8] audio
[9] auto
[10] automate
[11] buy
[12] Clock
[13] comms
[14] epub
[15] files
[16] hike
[17] motion
[18] nature
[19] net
[20] obd
[21] pic
[22] PlantID
[23] sensor
[24] shortcut
[25] shortcuts
[26] spoof
[27] stuff
[28] SvcMode
[29] sys
[30] time
[31] todo
[32] todo
[33] toon
[34] track
[35] TTS
[36] vid
[37] weather [Default]
[38] web
[39] webcam
Select folder number [1-39, Default: 37]: 18
[DEBUG] FLD_PICK="18"
[DEBUG] CONTAINER_ID="1678"
[DEBUG] SELECTED_FOLDER_NAME="nature"
[DEBUG] Entering :run_query
[DEBUG] Wrote "C:\Users\maria\AppData\Local\Temp\adbfolder_sanitize.ps1"
[DEBUG] Running sanitizer PowerShell script...
[DEBUG] Sanitizer exit errorlevel=0
[DEBUG] SAFE_NAME="nature"
[DEBUG] RAW_OUT="C:\app\editor\android\scrcpy\nova\output.txt"
[DEBUG] CLEAN_OUT="C:\app\editor\android\scrcpy\nova\nature_apps.txt"
Querying folder "nature" ...
[DEBUG] sqlite3 query exit errorlevel=0
[DEBUG] Raw C:\app\editor\android\scrcpy\nova\output.txt line count:
---------- C:\APP\EDITOR\ANDROID\SCRCPY\NOVA\OUTPUT.TXT: 66
[DEBUG] Running formatter PowerShell script "C:\Users\maria\AppData\Local\Temp\adbfolder_format.ps1"...
[DEBUG] PowerShell formatter exit errorlevel=0
--- Result (C:\app\editor\android\scrcpy\nova\nature_apps.txt) ---
app_title package_name
--------- ------------
OsmAnd~ net.osmand.plus
GPS to SMS ru.perm.trubnikov.gps2sms
Compass Direction com.app.compass.finddirection.digitalcompass.gpsutils.gpscompass
SatStat com.vonglasow.michael.satstat
Altimeter org.ssandon.altimeter
Azimuth Compass ro.overwrite.azimuthcompass
My Location com.mirfatif.mylocation
GPS Logger eu.basicairdata.graziano.gpslogger
OfflineMaps net.psyberia.offlinemaps
GPSLogger II com.emacberry.gpslogger
OSMTracker for AndroidΓäó net.osmtracker
OpenTracks de.dennisguse.opentracks
Trail Sense com.kylecorry.trail_sense
Compass com.keuwl.compass
Compass org.primeit.compass
Solar Compass com.agnibho.android.solarcompass
GPSTest com.android.gpstest.osmdroid
Pressure Altimeter org.efalk.altimeter
Altimeter Plus com.hoehenmesser.cjp
Avenza Maps com.Avenza
Paper Maps ca.abbro.androidmap
OuterSpatial com.trailheadlabs.outerspatial
GPS Waypoint Finder com.keuwl.gpswaypoints
Sun Board com.idle.sunboard
Magic Earth com.generalmagic.magicearth
Trekarta mobi.maptrek
Trekarta Lite mobi.maptrek.lite
Custom Maps com.custommapsapp.android
Earth com.google.earth
SunMoonTime com.gpspleinair.sunmoontime
Stellarium com.noctuasoftware.stellarium_free
Sky Map com.google.android.stardroid
Sextant Stars com.sharpitor.nightsky20
SkEye com.lavadip.skeye
Live Star Chart de.alcyone.livestarchart
Constellations com.phg.constellations
Earth Viewer mobile.application.forfree.earth
Wildfire Info com.davidgrossapps.wildfire
Wildfire Locations Now com.myuniportal.android.apps.airwildfirelocationsnow
Location Share ca.cmetcalfe.locationshare
Suntimes com.forrestguice.suntimeswidget
Suntimes Calendars com.forrestguice.suntimescalendars
Suntimes Alarms com.forrestguice.suntimeswidget
SpiritF fm.a2d.sf
Open Radio com.yuriy.openradio
FM Radio com.liveradio.fmradio.radiotuner.radiostation.amradio
Best step counter com.device_context.stepsmagic_free
BikeGPX com.bikegpx
GPX Viewer com.vecturagames.android.app.gpxviewer
RunGo com.rungo
OziExplorer OziExplorer.Main
I'm Here! com.syncitgroup.android.iamhere
SOS Alert com.main.contacts.smsmanager
Mock Locations ru.gavrikov.mocklocations
WorldMap com.sigseg.android.worldmap
TB Atlas de.topobyte.apps.bms.atlas
Fake GPS - Location Change com.momo.fakegps.locationchanger
Compass Direction com.app.compass.finddirection.digitalcompass.gpsutils.gpscompass
GPX Recorder com.iboism.gpxrecorder
basicGPS com.mschloapps.basicgps
anchor com.bundle.anchor
Sun Surveyor Lite com.ratana.sunsurveyorlite
SunCalc org de.th.suncalcorg
MoonCalc org de.th.mooncalcorg
whoBIRD org.woheller69.whobird
Raw tab-delimited output saved to: "C:\app\editor\android\scrcpy\nova\output.txt"
Filtered app list saved to: "C:\app\editor\android\scrcpy\nova\nature_apps.txt"
Press any key to continue . . .
C:\app\editor\android\scrcpy> type adbfolder.bat
:: adbfolder.bat
:: Extracts app package names and titles from a selected Android homescreen
:: folder into a readable text file to assist in backup/restore maintenance.
:: Can pull a backup from Android via adb or read an existing nova.db or
:: nova backup archive on Windows needing only adb and sql dependencies.
:: -------------------------------------------------------------------------
:: v1p4 20261119 Moved PowerShell commands into %TEMP%\*.ps1 scripts run via
:: "-File" instead of backticks so cmd never parses "<" or ">".
:: v1p3 20261119 Added DEBUG=1 instrumentation.
:: v1p2 20261119 Replaced cmd FOR sanitizer with PowerShell.
:: v1p1 20261119 Numbered selection menu for .novabackup files, lists folders
:: by name with numbered selection instead of raw container IDs
:: v1p0 20261119 Initial version to pull backup or use local nova.db, query
:: SQLite via sqlite3.exe, filter columns with PowerShell.
:: -------------------------------------------------------------------------
@echo off
setlocal enabledelayedexpansion
cd /d "%~dp0"
:: --- Debug Flag (1 = verbose [DEBUG] traces, 0 = quiet) ---
set "DEBUG=1"
:: --- Configurable Paths ---
set "ADB_EXE=C:\app\editor\android\scrcpy\adb.exe"
set "SQLITE_EXE=C:\app\editor\android\sdk\platform-tools\sqlite3.exe"
set "WORK_DIR=C:\app\editor\android\scrcpy\nova"
set "ANDROID_BCK_DIR=/storage/emulated/0/0000/bck/nova_backup"
set "DEFAULT_FOLDER_NAME=weather"
set "DEFAULT_CONTAINER=2921"
if "%DEBUG%"=="1" (
echo [DEBUG] SCRIPT_DIR="%~dp0"
echo [DEBUG] CD="%CD%"
echo [DEBUG] ADB_EXE="%ADB_EXE%"
echo [DEBUG] SQLITE_EXE="%SQLITE_EXE%"
echo [DEBUG] WORK_DIR="%WORK_DIR%"
)
:: Verify sqlite3.exe exists before starting
if not exist "%SQLITE_EXE%" (
echo [ERROR] sqlite3.exe not found at: "%SQLITE_EXE%"
pause
exit /b 1
)
if not exist "%WORK_DIR%" mkdir "%WORK_DIR%"
echo Working directory: "%CD%"
echo Nova work directory: "%WORK_DIR%"
echo ----------------
echo.
echo Select source for Nova Launcher database:
echo [1] Pull .novabackup from Android via ADB and extract nova.db [Default]
echo [2] Use an existing nova.db (or .novabackup / .zip) already on Windows
echo.
set "SRC_CHOICE=1"
set /p "SRC_CHOICE=Enter choice [1 or 2]: "
if "%DEBUG%"=="1" echo [DEBUG] SRC_CHOICE="!SRC_CHOICE!"
if "%SRC_CHOICE%"=="2" goto :use_local_source
if "%SRC_CHOICE%"=="1" goto :pull_from_android
goto :pull_from_android
:: -------------------------------------------------------------------------
:: OPTION 1: PULL BACKUP FROM ANDROID VIA ADB
:: -------------------------------------------------------------------------
:pull_from_android
echo.
echo --- Pull Nova Backup from Android ---
if not exist "%ADB_EXE%" (
echo [ERROR] adb.exe not found at: "%ADB_EXE%"
pause
exit /b 1
)
set "ADB_TARGET="
for /f "skip=1 tokens=1" %%g in ('"%ADB_EXE%" devices') do (
if not "%%g"=="" (
if "!ADB_TARGET!"=="" set "ADB_TARGET=%%g"
)
)
if "%DEBUG%"=="1" echo [DEBUG] ADB_TARGET="!ADB_TARGET!"
if "!ADB_TARGET!"=="" (
echo [ERROR] No connected ADB devices found.
pause
exit /b 1
)
echo Targeting device: %ADB_TARGET%
echo Listing backups in %ANDROID_BCK_DIR% ...
echo.
"%ADB_EXE%" -s %ADB_TARGET% shell ls -1t "%ANDROID_BCK_DIR%/*.novabackup" 2>nul > "%TEMP%\nova_backups.txt"
if "%DEBUG%"=="1" (
echo [DEBUG] ls exit errorlevel=!errorlevel!
echo [DEBUG] Raw %TEMP%\nova_backups.txt contents:
type "%TEMP%\nova_backups.txt" 2>nul
)
set "BCK_COUNT=0"
for /f "usebackq delims=" %%B in ("%TEMP%\nova_backups.txt") do (
set "LINE=%%B"
if not "!LINE!"=="" (
set "LINE=!LINE:^M=!"
for %%F in ("!LINE!") do set "FNAME=%%~nxF"
set /a BCK_COUNT+=1
set "BCK_ITEM_!BCK_COUNT!=!FNAME!"
echo [!BCK_COUNT!] !FNAME!
if "%DEBUG%"=="1" echo [DEBUG] BCK_ITEM_!BCK_COUNT!="!FNAME!"
)
)
del "%TEMP%\nova_backups.txt" >nul 2>&1
if %BCK_COUNT% EQU 0 (
echo [WARN] Could not auto-list .novabackup files in %ANDROID_BCK_DIR%.
:manual_bck
set "BCK_FILE="
set /p "BCK_FILE=Enter backup filename (e.g. 2026-11-19_12-57.novabackup): "
if "!BCK_FILE!"=="" (
echo [ERROR] No backup filename provided.
pause
exit /b 1
)
set "BCK_FILE=!BCK_FILE:"=!"
for %%F in ("!BCK_FILE!") do set "BCK_FILE=%%~nxF"
goto :pull_selected_backup
)
echo.
set "BCK_PICK=1"
set /p "BCK_PICK=Select backup number [1-%BCK_COUNT%, Default: 1]: "
if "!BCK_PICK!"=="" set "BCK_PICK=1"
if "%DEBUG%"=="1" echo [DEBUG] BCK_PICK="!BCK_PICK!"
set "BCK_FILE="
for /l %%N in (1,1,%BCK_COUNT%) do (
if "!BCK_PICK!"=="%%N" set "BCK_FILE=!BCK_ITEM_%%N!"
)
if "!BCK_FILE!"=="" (
set "CANDIDATE=!BCK_PICK:"=!"
for %%F in ("!CANDIDATE!") do set "BCK_FILE=%%~nxF"
)
if "%DEBUG%"=="1" echo [DEBUG] BCK_FILE="!BCK_FILE!"
:pull_selected_backup
set "LOCAL_BCK=%WORK_DIR%\%BCK_FILE%"
set "LOCAL_ZIP=%WORK_DIR%\backup.zip"
set "EXTRACT_DIR=%WORK_DIR%\backup_extracted"
echo.
echo Pulling "%ANDROID_BCK_DIR%/%BCK_FILE%" to "%LOCAL_BCK%" ...
"%ADB_EXE%" -s %ADB_TARGET% pull "%ANDROID_BCK_DIR%/%BCK_FILE%" "%LOCAL_BCK%"
if errorlevel 1 (
echo [ERROR] Failed to pull backup from Android.
pause
exit /b 1
)
if exist "%LOCAL_ZIP%" del /f /q "%LOCAL_ZIP%"
ren "%LOCAL_BCK%" "backup.zip"
if errorlevel 1 (
echo [ERROR] Failed to rename "%LOCAL_BCK%" to backup.zip.
pause
exit /b 1
)
if exist "%EXTRACT_DIR%" rmdir /s /q "%EXTRACT_DIR%"
echo Extracting backup.zip to "%EXTRACT_DIR%" ...
powershell -NoProfile -Command "Expand-Archive -LiteralPath '%LOCAL_ZIP%' -DestinationPath '%EXTRACT_DIR%' -Force"
if errorlevel 1 (
echo [ERROR] Failed to extract backup.zip.
pause
exit /b 1
)
set "DB_PATH=%EXTRACT_DIR%\nova.db"
goto :verify_db
:: -------------------------------------------------------------------------
:: OPTION 2: USE LOCAL NOVA.DB (OR .NOVABACKUP / .ZIP)
:: -------------------------------------------------------------------------
:use_local_source
echo.
echo --- Local Database Selection ---
echo Enter the path to nova.db (or a .novabackup / .zip file).
echo Default: "%WORK_DIR%\backup_extracted\nova.db"
echo.
:ask_local_db
set "USER_DB="
set /p "USER_DB=Path to database or backup file [Enter for default]: "
if "!USER_DB!"=="" (
set "DB_PATH=%WORK_DIR%\backup_extracted\nova.db"
) else (
set "USER_DB=!USER_DB:"=!"
for %%A in ("!USER_DB!") do set "DB_PATH=%%~fA"
)
if not exist "%DB_PATH%" (
echo [ERROR] File not found: "%DB_PATH%"
set "RETRY="
set /p "RETRY=Try again? [Y/n]: "
if /i "!RETRY!"=="n" exit /b 1
goto :ask_local_db
)
for %%E in ("%DB_PATH%") do set "EXT=%%~xE"
if /i "!EXT!"==".novabackup" goto :extract_local_archive
if /i "!EXT!"==".zip" goto :extract_local_archive
goto :verify_db
:extract_local_archive
set "EXTRACT_DIR=%WORK_DIR%\backup_extracted"
if exist "%EXTRACT_DIR%" rmdir /s /q "%EXTRACT_DIR%"
echo Extracting "%DB_PATH%" to "%EXTRACT_DIR%" ...
powershell -NoProfile -Command "Expand-Archive -LiteralPath '%DB_PATH%' -DestinationPath '%EXTRACT_DIR%' -Force"
if errorlevel 1 (
echo [ERROR] Failed to extract archive.
pause
exit /b 1
)
set "DB_PATH=%EXTRACT_DIR%\nova.db"
:: -------------------------------------------------------------------------
:: VERIFY DATABASE & LIST FOLDERS BY NAME
:: -------------------------------------------------------------------------
:verify_db
if not exist "%DB_PATH%" (
echo [ERROR] nova.db not found at: "%DB_PATH%"
pause
exit /b 1
)
echo.
echo Using database: "%DB_PATH%"
echo Scanning Nova Launcher folders ...
echo.
"%SQLITE_EXE%" -cmd ".separator |" "%DB_PATH%" "SELECT _id, CASE WHEN title IS NULL OR TRIM(title) = '' THEN '(Untitled Folder)' ELSE title END FROM favorites WHERE itemType = 2 ORDER BY LOWER(title), _id;" > "%TEMP%\nova_folders.txt" 2>nul
if "%DEBUG%"=="1" (
echo [DEBUG] Folder query exit errorlevel=!errorlevel!
echo [DEBUG] Raw %TEMP%\nova_folders.txt contents:
type "%TEMP%\nova_folders.txt" 2>nul
)
set "FLD_COUNT=0"
set "DEFAULT_FLD_IDX=1"
for /f "usebackq tokens=1* delims=|" %%A in ("%TEMP%\nova_folders.txt") do (
set "FID=%%A"
set "FNAME=%%B"
if not "!FID!"=="" (
set /a FLD_COUNT+=1
set "FLD_ID_!FLD_COUNT!=!FID!"
set "FLD_NAME_!FLD_COUNT!=!FNAME!"
if /i "!FNAME!"=="%DEFAULT_FOLDER_NAME%" set "DEFAULT_FLD_IDX=!FLD_COUNT!"
if "!FID!"=="%DEFAULT_CONTAINER%" (
if /i not "!FNAME!"=="%DEFAULT_FOLDER_NAME%" set "DEFAULT_FLD_IDX=!FLD_COUNT!"
)
)
)
del "%TEMP%\nova_folders.txt" >nul 2>&1
if %FLD_COUNT% EQU 0 (
echo [WARN] No folders found in database. Falling back to default container %DEFAULT_CONTAINER%.
set "CONTAINER_ID=%DEFAULT_CONTAINER%"
set "SELECTED_FOLDER_NAME=folder_%DEFAULT_CONTAINER%"
goto :run_query
)
for /l %%N in (1,1,%FLD_COUNT%) do (
if "%%N"=="!DEFAULT_FLD_IDX!" (
echo [%%N] !FLD_NAME_%%N! [Default]
) else (
echo [%%N] !FLD_NAME_%%N!
)
)
echo.
set "FLD_PICK=!DEFAULT_FLD_IDX!"
set /p "FLD_PICK=Select folder number [1-%FLD_COUNT%, Default: !DEFAULT_FLD_IDX!]: "
if "!FLD_PICK!"=="" set "FLD_PICK=!DEFAULT_FLD_IDX!"
if "%DEBUG%"=="1" echo [DEBUG] FLD_PICK="!FLD_PICK!"
set "CONTAINER_ID="
set "SELECTED_FOLDER_NAME="
for /l %%N in (1,1,%FLD_COUNT%) do (
if "!FLD_PICK!"=="%%N" (
set "CONTAINER_ID=!FLD_ID_%%N!"
set "SELECTED_FOLDER_NAME=!FLD_NAME_%%N!"
)
)
if "%DEBUG%"=="1" (
echo [DEBUG] CONTAINER_ID="!CONTAINER_ID!"
echo [DEBUG] SELECTED_FOLDER_NAME="!SELECTED_FOLDER_NAME!"
)
if "!CONTAINER_ID!"=="" (
echo [ERROR] Invalid folder selection: "!FLD_PICK!"
pause
exit /b 1
)
:run_query
if "%DEBUG%"=="1" echo [DEBUG] Entering :run_query
:: Write folder sanitizer .ps1 to %TEMP% so cmd never parses regex characters
set "PS_SANITIZE=%TEMP%\adbfolder_sanitize.ps1"
set "SAFE_NAME_FILE=%TEMP%\adbfolder_safename.txt"
> "%PS_SANITIZE%" echo $raw = $env:SELECTED_FOLDER_NAME
>> "%PS_SANITIZE%" echo $s = [regex]::Replace($raw, '[\\/:*?"<>|() ]+', '_')
>> "%PS_SANITIZE%" echo $s = $s.Trim('_')
>> "%PS_SANITIZE%" echo if ([string]::IsNullOrWhiteSpace($s)) { $s = "folder_$env:CONTAINER_ID" }
>> "%PS_SANITIZE%" echo [System.IO.File]::WriteAllText($env:SAFE_NAME_FILE, $s, (New-Object System.Text.UTF8Encoding($false)))
if "%DEBUG%"=="1" (
echo [DEBUG] Wrote "%PS_SANITIZE%"
echo [DEBUG] Running sanitizer PowerShell script...
)
powershell -NoProfile -ExecutionPolicy Bypass -File "%PS_SANITIZE%"
if "%DEBUG%"=="1" echo [DEBUG] Sanitizer exit errorlevel=!errorlevel!
set "SAFE_NAME="
if exist "%SAFE_NAME_FILE%" (
for /f "usebackq delims=" %%S in ("%SAFE_NAME_FILE%") do set "SAFE_NAME=%%S"
)
if "!SAFE_NAME!"=="" set "SAFE_NAME=folder_%CONTAINER_ID%"
del "%PS_SANITIZE%" >nul 2>&1
del "%SAFE_NAME_FILE%" >nul 2>&1
if "%DEBUG%"=="1" echo [DEBUG] SAFE_NAME="!SAFE_NAME!"
set "RAW_OUT=%WORK_DIR%\output.txt"
set "CLEAN_OUT=%WORK_DIR%\%SAFE_NAME%_apps.txt"
if "%DEBUG%"=="1" (
echo [DEBUG] RAW_OUT="%RAW_OUT%"
echo [DEBUG] CLEAN_OUT="%CLEAN_OUT%"
)
echo.
echo Querying folder "!SELECTED_FOLDER_NAME!" ...
"%SQLITE_EXE%" -header -cmd ".mode tabs" "%DB_PATH%" "SELECT f._id AS item_id, f.title AS app_title, CASE WHEN f.iconPackage IS NOT NULL AND f.iconPackage != '' THEN f.iconPackage WHEN INSTR(f.intent, 'component=') > 0 THEN SUBSTR(SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10), 1, INSTR(SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10), '/') - 1) ELSE '' END AS package_name, f.intent FROM favorites f WHERE f.container = %CONTAINER_ID% ORDER BY f.rank, f._id;" > "%RAW_OUT%"
if "%DEBUG%"=="1" (
echo [DEBUG] sqlite3 query exit errorlevel=!errorlevel!
echo [DEBUG] Raw %RAW_OUT% line count:
find /c /v "" "%RAW_OUT%" 2>nul
)
if errorlevel 1 (
echo [ERROR] SQLite query failed.
pause
exit /b 1
)
:: Write column formatter .ps1 to %TEMP% and execute with -File
set "PS_FORMAT=%TEMP%\adbfolder_format.ps1"
> "%PS_FORMAT%" echo $rawFile = $env:RAW_OUT
>> "%PS_FORMAT%" echo $cleanFile = $env:CLEAN_OUT
>> "%PS_FORMAT%" echo $rows = Import-Csv -LiteralPath $rawFile -Delimiter "`t"
>> "%PS_FORMAT%" echo $lines = $rows ^| Select-Object app_title, package_name ^| Format-Table -AutoSize ^| Out-String -Width 4096
>> "%PS_FORMAT%" echo $clean = ($lines -split "`r?`n" ^| ForEach-Object { $_.TrimEnd() } ^| Where-Object { $_ -ne '' }) -join "`r`n"
>> "%PS_FORMAT%" echo [System.IO.File]::WriteAllText($cleanFile, $clean + "`r`n", (New-Object System.Text.UTF8Encoding($false)))
if "%DEBUG%"=="1" echo [DEBUG] Running formatter PowerShell script "%PS_FORMAT%"...
powershell -NoProfile -ExecutionPolicy Bypass -File "%PS_FORMAT%"
if "%DEBUG%"=="1" echo [DEBUG] PowerShell formatter exit errorlevel=!errorlevel!
del "%PS_FORMAT%" >nul 2>&1
if errorlevel 1 (
echo [ERROR] Failed to format output columns.
pause
exit /b 1
)
echo.
echo --- Result (%CLEAN_OUT%) ---
echo.
type "%CLEAN_OUT%"
echo.
echo Raw tab-delimited output saved to: "%RAW_OUT%"
echo Filtered app list saved to: "%CLEAN_OUT%"
echo.
pause
exit /b 0
:: -------------------------------------------------------------------------
:: end of adbfolder.bat
:: -------------------------------------------------------------------------
--
Usenet is a team where every smart player tries to move the ball forward.
Re: Can we programmatically get package names of icons in a homescreen folder?
Author: Maria Sophia
Date: Fri, 20 Nov 2026 04:06
Date: Fri, 20 Nov 2026 04:06
572 lines
22896 bytes
22896 bytes
Maria Sophia wrote:
> I'll remove the debugs (which I needed temporarily) due to
> stupid syntax issues that I don't want to think about for powershell.
>
> And I'll reverse the order of the outpuot for readability.
>
> I'll also check for dependences (namely adb & sqlite3.exe)
> even though they work fine on my system as this is for others.
I added all the fixes I had anticipated above so here's the latest
working version, but the path is still hard coded to the database.
That works fine for me as I always put my databases in the same
location, but I'll add a search to find the nova database on
Android. If it doesn't find any nova database, then I'll add
a hint so the user can figure out how to generate the database.
But, for now, this is working with all my hard-coded paths,
but of course, I need to make it work for everyone else also.
I think I will also add the homescreen pane number too.
C:\app\editor\android\scrcpy> adbfolder.bat
Checking required tools (adb and sqlite3) ...
Working directory: "C:\app\editor\android\scrcpy" Nova work directory: "C:\app\editor\android\scrcpy\nova" ---------------- Select source for Nova Launcher database: [1] Pull .novabackup from Android via ADB and extract nova.db [Default] [2] Use an existing nova.db (or .novabackup / .zip) already on Windows
Enter choice [1 or 2]: 1
--- Pull Nova Backup from Android ---
Targeting device: 192.168.1.4:5555
Listing backups in /storage/emulated/0/0000/bck/nova_backup ...
[1] 2026-11-19_12-57.novabackup
[2] 2026-08-19_21-51.novabackup
[3] 2026-08-19_11-31.novabackup
[4] 2026-08-16_11-36.novabackup
Select backup number [1-4, Default: 1]: 3
Pulling "/storage/emulated/0/0000/bck/nova_backup/2026-08-19_11-31.novabackup" to "C:\app\editor\android\scrcpy\nova\2026-08-19_11-31.novabackup" ...
/storage/emulated/0/0000/bck/nova_backup/2026-... 0 skipped. 2.1 MB/s (6336784 bytes in 2.846s)
Extracting backup.zip to "C:\app\editor\android\scrcpy\nova\backup_extracted" ...
Using database: "C:\app\editor\android\scrcpy\nova\backup_extracted\nova.db"
Scanning Nova Launcher folders ...
[1] (Untitled Folder) [Default]
[2] (Untitled Folder)
[3] (Untitled Folder)
[4] (Untitled Folder)
[5] (Untitled Folder)
[6] (Untitled Folder)
[7] apk
[8] audio
[9] auto
[10] automate
[11] buy
[12] Clock
[13] comms
[14] epub
[15] files
[16] hike
[17] motion
[18] nature
[19] net
[20] obd
[21] pic
[22] PlantID
[23] sensor
[24] shortcut
[25] shortcuts
[26] spoof
[27] stuff
[28] SvcMode
[29] sys
[30] time
[31] todo
[32] todo
[33] toon
[34] track
[35] TTS
[36] vid
[37] web
[38] webcam
Select folder number [1-38, Default: 1]: 27
Querying folder "stuff" ...
--- Result (C:\app\editor\android\scrcpy\nova\stuff_apps.txt) ---
package_name app_title
------------ ---------
com.android.settings Settings
com.halcyonwaves.apps.energize Energize
app.batteryinfo Big Battery Indicator
in.yourstreet.permissionmanager Permission Manager
rk.android.app.privacydashboard Privacy Dashboard
audioscreenshot.awesomeapps.com.audioscreenshot Audio Screenshot
com.teslacoilsw.launcher Nova Settings
com.cunnj.activitylauncher Activities
com.oldmen.shortcutcreator X Shortcut Creator
de.szalkowski.activitylauncher Activity Launcher
rk.android.app.shortcutmaker Shortcut Maker
com.alextern.shortcuthelper Create Shortcut
com.sika524.android.quickshortcut QuickShortcutMaker
com.trianguloy.instantintent Instant Intent
krow.dev.scheme Intents
com.miyaware.batteryclock Battery Clock beta
com.darshancomputing.BatteryIndicator BatteryBot
com.larryvgs.battery2020 Battery Notifier BT Free 2020
de.kroegerama.android4batpercent Percent Enabler
com.amperemeter.wally.src Ampere Plotter
com.termux Termux
com.willme.topactivity Current Activity
com.cemique.shortcutwidgets Shortcut Widgets
Raw tab-delimited output saved to: "C:\app\editor\android\scrcpy\nova\output.txt"
Filtered app list saved to: "C:\app\editor\android\scrcpy\nova\stuff_apps.txt"
Press any key to continue . . .
:: -------------------------------------------------------------------------
:: adbfolder.bat
:: -------------------------------------------------------------------------
:: Extracts app package names and titles from an Android homescreen folder
:: into a readable text file to assist in backup/restore maintenance.
::
:: Can pull a backup from Android via adb or read an existing nova.db or
:: nova backup archive on Windows needing only adb and sql dependencies.
:: -------------------------------------------------------------------------
:: v1p6 20261119 Set DEBUG=0 by default for clean normal output while
:: keeping the toggle available for later troubleshooting.
:: v1p5 20261119 Reversed output columns to package_name first, app_title
:: second and added startup dependency check for adb and
:: sqlite3 dependency (checking configured paths and PATH).
:: v1p4 20261119 Moved PowerShell commands into %TEMP%\*.ps1 scripts run via
:: "-File" instead of backticks so cmd never parses "<" or ">".
:: v1p3 20261119 Added DEBUG=1 instrumentation.
:: v1p2 20261119 Replaced cmd FOR sanitizer with PowerShell.
:: v1p1 20261119 Numbered selection menu for .novabackup files, lists folders
:: by name with numbered selection instead of raw container IDs
:: v1p0 20261119 Initial version to pull backup or use local nova.db, query
:: SQLite via sqlite3.exe, filter columns with PowerShell.
:: -------------------------------------------------------------------------
@echo off
setlocal enabledelayedexpansion
cd /d "%~dp0"
:: --- Debug Flag (1 = verbose [DEBUG] traces, 0 = quiet) ---
set "DEBUG=0"
:: --- Configurable Paths ---
set "ADB_EXE=C:\app\editor\android\scrcpy\adb.exe"
set "SQLITE_EXE=C:\app\editor\android\sdk\platform-tools\sqlite3.exe"
set "WORK_DIR=C:\app\editor\android\scrcpy\nova"
set "ANDROID_BCK_DIR=/storage/emulated/0/0000/bck/nova_backup"
set "DEFAULT_FOLDER_NAME=weather"
set "DEFAULT_CONTAINER=2921"
if "%DEBUG%"=="1" (
echo [DEBUG] SCRIPT_DIR="%~dp0"
echo [DEBUG] CD="%CD%"
echo [DEBUG] ADB_EXE="%ADB_EXE%"
echo [DEBUG] SQLITE_EXE="%SQLITE_EXE%"
echo [DEBUG] WORK_DIR="%WORK_DIR%"
)
:: -------------------------------------------------------------------------
:: STARTUP DEPENDENCY & PATH CHECK (adb.exe and sqlite3.exe)
:: -------------------------------------------------------------------------
echo Checking required tools (adb and sqlite3) ...
set "PATH_ADB="
for /f "usebackq delims=" %%W in (`where adb 2^>nul`) do (
if "!PATH_ADB!"=="" set "PATH_ADB=%%W"
)
set "PATH_SQLITE="
for /f "usebackq delims=" %%W in (`where sqlite3 2^>nul`) do (
if "!PATH_SQLITE!"=="" set "PATH_SQLITE=%%W"
)
if "%DEBUG%"=="1" (
echo [DEBUG] PATH_ADB="!PATH_ADB!"
echo [DEBUG] PATH_SQLITE="!PATH_SQLITE!"
)
:: Prefer configured path if it exists; otherwise fall back to PATH
if not exist "%ADB_EXE%" (
if not "!PATH_ADB!"=="" (
echo [INFO] Configured ADB_EXE not found; using PATH: "!PATH_ADB!"
set "ADB_EXE=!PATH_ADB!"
) else (
echo [WARN] adb.exe not found at "%ADB_EXE%" and not in PATH.
)
) else if "!PATH_ADB!"=="" (
echo [INFO] adb.exe found at configured path, though not in PATH.
)
if not exist "%SQLITE_EXE%" (
if not "!PATH_SQLITE!"=="" (
echo [INFO] Configured SQLITE_EXE not found; using PATH: "!PATH_SQLITE!"
set "SQLITE_EXE=!PATH_SQLITE!"
) else (
echo [ERROR] sqlite3.exe not found at "%SQLITE_EXE%" and not in PATH.
pause
exit /b 1
)
) else if "!PATH_SQLITE!"=="" (
echo [INFO] sqlite3.exe found at configured path, though not in PATH.
)
if not exist "%WORK_DIR%" mkdir "%WORK_DIR%"
echo Working directory: "%CD%"
echo Nova work directory: "%WORK_DIR%"
echo ----------------
echo.
echo Select source for Nova Launcher database:
echo [1] Pull .novabackup from Android via ADB and extract nova.db [Default]
echo [2] Use an existing nova.db (or .novabackup / .zip) already on Windows
echo.
set "SRC_CHOICE=1"
set /p "SRC_CHOICE=Enter choice [1 or 2]: "
if "%DEBUG%"=="1" echo [DEBUG] SRC_CHOICE="!SRC_CHOICE!"
if "%SRC_CHOICE%"=="2" goto :use_local_source
if "%SRC_CHOICE%"=="1" goto :pull_from_android
goto :pull_from_android
:: -------------------------------------------------------------------------
:: OPTION 1: PULL BACKUP FROM ANDROID VIA ADB
:: -------------------------------------------------------------------------
:pull_from_android
echo.
echo --- Pull Nova Backup from Android ---
if not exist "%ADB_EXE%" (
echo [ERROR] adb.exe not found at: "%ADB_EXE%"
pause
exit /b 1
)
set "ADB_TARGET="
for /f "skip=1 tokens=1" %%g in ('"%ADB_EXE%" devices') do (
if not "%%g"=="" (
if "!ADB_TARGET!"=="" set "ADB_TARGET=%%g"
)
)
if "%DEBUG%"=="1" echo [DEBUG] ADB_TARGET="!ADB_TARGET!"
if "!ADB_TARGET!"=="" (
echo [ERROR] No connected ADB devices found.
pause
exit /b 1
)
echo Targeting device: %ADB_TARGET%
echo Listing backups in %ANDROID_BCK_DIR% ...
echo.
"%ADB_EXE%" -s %ADB_TARGET% shell ls -1t "%ANDROID_BCK_DIR%/*.novabackup" 2>nul > "%TEMP%\nova_backups.txt"
if "%DEBUG%"=="1" (
echo [DEBUG] ls exit errorlevel=!errorlevel!
echo [DEBUG] Raw %TEMP%\nova_backups.txt contents:
type "%TEMP%\nova_backups.txt" 2>nul
)
set "BCK_COUNT=0"
for /f "usebackq delims=" %%B in ("%TEMP%\nova_backups.txt") do (
set "LINE=%%B"
if not "!LINE!"=="" (
set "LINE=!LINE:^M=!"
for %%F in ("!LINE!") do set "FNAME=%%~nxF"
set /a BCK_COUNT+=1
set "BCK_ITEM_!BCK_COUNT!=!FNAME!"
echo [!BCK_COUNT!] !FNAME!
if "%DEBUG%"=="1" echo [DEBUG] BCK_ITEM_!BCK_COUNT!="!FNAME!"
)
)
del "%TEMP%\nova_backups.txt" >nul 2>&1
if %BCK_COUNT% EQU 0 (
echo [WARN] Could not auto-list .novabackup files in %ANDROID_BCK_DIR%.
:manual_bck
set "BCK_FILE="
set /p "BCK_FILE=Enter backup filename (e.g. 2026-11-19_12-57.novabackup): "
if "!BCK_FILE!"=="" (
echo [ERROR] No backup filename provided.
pause
exit /b 1
)
set "BCK_FILE=!BCK_FILE:"=!"
for %%F in ("!BCK_FILE!") do set "BCK_FILE=%%~nxF"
goto :pull_selected_backup
)
echo.
set "BCK_PICK=1"
set /p "BCK_PICK=Select backup number [1-%BCK_COUNT%, Default: 1]: "
if "!BCK_PICK!"=="" set "BCK_PICK=1"
if "%DEBUG%"=="1" echo [DEBUG] BCK_PICK="!BCK_PICK!"
set "BCK_FILE="
for /l %%N in (1,1,%BCK_COUNT%) do (
if "!BCK_PICK!"=="%%N" set "BCK_FILE=!BCK_ITEM_%%N!"
)
if "!BCK_FILE!"=="" (
set "CANDIDATE=!BCK_PICK:"=!"
for %%F in ("!CANDIDATE!") do set "BCK_FILE=%%~nxF"
)
if "%DEBUG%"=="1" echo [DEBUG] BCK_FILE="!BCK_FILE!"
:pull_selected_backup
set "LOCAL_BCK=%WORK_DIR%\%BCK_FILE%"
set "LOCAL_ZIP=%WORK_DIR%\backup.zip"
set "EXTRACT_DIR=%WORK_DIR%\backup_extracted"
echo.
echo Pulling "%ANDROID_BCK_DIR%/%BCK_FILE%" to "%LOCAL_BCK%" ...
"%ADB_EXE%" -s %ADB_TARGET% pull "%ANDROID_BCK_DIR%/%BCK_FILE%" "%LOCAL_BCK%"
if errorlevel 1 (
echo [ERROR] Failed to pull backup from Android.
pause
exit /b 1
)
if exist "%LOCAL_ZIP%" del /f /q "%LOCAL_ZIP%"
ren "%LOCAL_BCK%" "backup.zip"
if errorlevel 1 (
echo [ERROR] Failed to rename "%LOCAL_BCK%" to backup.zip.
pause
exit /b 1
)
if exist "%EXTRACT_DIR%" rmdir /s /q "%EXTRACT_DIR%"
echo Extracting backup.zip to "%EXTRACT_DIR%" ...
powershell -NoProfile -Command "Expand-Archive -LiteralPath '%LOCAL_ZIP%' -DestinationPath '%EXTRACT_DIR%' -Force"
if errorlevel 1 (
echo [ERROR] Failed to extract backup.zip.
pause
exit /b 1
)
set "DB_PATH=%EXTRACT_DIR%\nova.db"
goto :verify_db
:: -------------------------------------------------------------------------
:: OPTION 2: USE LOCAL NOVA.DB (OR .NOVABACKUP / .ZIP)
:: -------------------------------------------------------------------------
:use_local_source
echo.
echo --- Local Database Selection ---
echo Enter the path to nova.db (or a .novabackup / .zip file).
echo Default: "%WORK_DIR%\backup_extracted\nova.db"
echo.
:ask_local_db
set "USER_DB="
set /p "USER_DB=Path to database or backup file [Enter for default]: "
if "!USER_DB!"=="" (
set "DB_PATH=%WORK_DIR%\backup_extracted\nova.db"
) else (
set "USER_DB=!USER_DB:"=!"
for %%A in ("!USER_DB!") do set "DB_PATH=%%~fA"
)
if not exist "%DB_PATH%" (
echo [ERROR] File not found: "%DB_PATH%"
set "RETRY="
set /p "RETRY=Try again? [Y/n]: "
if /i "!RETRY!"=="n" exit /b 1
goto :ask_local_db
)
for %%E in ("%DB_PATH%") do set "EXT=%%~xE"
if /i "!EXT!"==".novabackup" goto :extract_local_archive
if /i "!EXT!"==".zip" goto :extract_local_archive
goto :verify_db
:extract_local_archive
set "EXTRACT_DIR=%WORK_DIR%\backup_extracted"
if exist "%EXTRACT_DIR%" rmdir /s /q "%EXTRACT_DIR%"
echo Extracting "%DB_PATH%" to "%EXTRACT_DIR%" ...
powershell -NoProfile -Command "Expand-Archive -LiteralPath '%DB_PATH%' -DestinationPath '%EXTRACT_DIR%' -Force"
if errorlevel 1 (
echo [ERROR] Failed to extract archive.
pause
exit /b 1
)
set "DB_PATH=%EXTRACT_DIR%\nova.db"
:: -------------------------------------------------------------------------
:: VERIFY DATABASE & LIST FOLDERS BY NAME
:: -------------------------------------------------------------------------
:verify_db
if not exist "%DB_PATH%" (
echo [ERROR] nova.db not found at: "%DB_PATH%"
pause
exit /b 1
)
echo.
echo Using database: "%DB_PATH%"
echo Scanning Nova Launcher folders ...
echo.
"%SQLITE_EXE%" -cmd ".separator |" "%DB_PATH%" "SELECT _id, CASE WHEN title IS NULL OR TRIM(title) = '' THEN '(Untitled Folder)' ELSE title END FROM favorites WHERE itemType = 2 ORDER BY LOWER(title), _id;" > "%TEMP%\nova_folders.txt" 2>nul
if "%DEBUG%"=="1" (
echo [DEBUG] Folder query exit errorlevel=!errorlevel!
echo [DEBUG] Raw %TEMP%\nova_folders.txt contents:
type "%TEMP%\nova_folders.txt" 2>nul
)
set "FLD_COUNT=0"
set "DEFAULT_FLD_IDX=1"
for /f "usebackq tokens=1* delims=|" %%A in ("%TEMP%\nova_folders.txt") do (
set "FID=%%A"
set "FNAME=%%B"
if not "!FID!"=="" (
set /a FLD_COUNT+=1
set "FLD_ID_!FLD_COUNT!=!FID!"
set "FLD_NAME_!FLD_COUNT!=!FNAME!"
if /i "!FNAME!"=="%DEFAULT_FOLDER_NAME%" set "DEFAULT_FLD_IDX=!FLD_COUNT!"
if "!FID!"=="%DEFAULT_CONTAINER%" (
if /i not "!FNAME!"=="%DEFAULT_FOLDER_NAME%" set "DEFAULT_FLD_IDX=!FLD_COUNT!"
)
)
)
del "%TEMP%\nova_folders.txt" >nul 2>&1
if %FLD_COUNT% EQU 0 (
echo [WARN] No folders found in database. Falling back to default container %DEFAULT_CONTAINER%.
set "CONTAINER_ID=%DEFAULT_CONTAINER%"
set "SELECTED_FOLDER_NAME=folder_%DEFAULT_CONTAINER%"
goto :run_query
)
for /l %%N in (1,1,%FLD_COUNT%) do (
if "%%N"=="!DEFAULT_FLD_IDX!" (
echo [%%N] !FLD_NAME_%%N! [Default]
) else (
echo [%%N] !FLD_NAME_%%N!
)
)
echo.
set "FLD_PICK=!DEFAULT_FLD_IDX!"
set /p "FLD_PICK=Select folder number [1-%FLD_COUNT%, Default: !DEFAULT_FLD_IDX!]: "
if "!FLD_PICK!"=="" set "FLD_PICK=!DEFAULT_FLD_IDX!"
if "%DEBUG%"=="1" echo [DEBUG] FLD_PICK="!FLD_PICK!"
set "CONTAINER_ID="
set "SELECTED_FOLDER_NAME="
for /l %%N in (1,1,%FLD_COUNT%) do (
if "!FLD_PICK!"=="%%N" (
set "CONTAINER_ID=!FLD_ID_%%N!"
set "SELECTED_FOLDER_NAME=!FLD_NAME_%%N!"
)
)
if "%DEBUG%"=="1" (
echo [DEBUG] CONTAINER_ID="!CONTAINER_ID!"
echo [DEBUG] SELECTED_FOLDER_NAME="!SELECTED_FOLDER_NAME!"
)
if "!CONTAINER_ID!"=="" (
echo [ERROR] Invalid folder selection: "!FLD_PICK!"
pause
exit /b 1
)
:run_query
if "%DEBUG%"=="1" echo [DEBUG] Entering :run_query
:: Write folder sanitizer .ps1 to %TEMP% so cmd never parses regex characters
set "PS_SANITIZE=%TEMP%\adbfolder_sanitize.ps1"
set "SAFE_NAME_FILE=%TEMP%\adbfolder_safename.txt"
> "%PS_SANITIZE%" echo $raw = $env:SELECTED_FOLDER_NAME
>> "%PS_SANITIZE%" echo $s = [regex]::Replace($raw, '[\\/:*?"<>|() ]+', '_')
>> "%PS_SANITIZE%" echo $s = $s.Trim('_')
>> "%PS_SANITIZE%" echo if ([string]::IsNullOrWhiteSpace($s)) { $s = "folder_$env:CONTAINER_ID" }
>> "%PS_SANITIZE%" echo [System.IO.File]::WriteAllText($env:SAFE_NAME_FILE, $s, (New-Object System.Text.UTF8Encoding($false)))
if "%DEBUG%"=="1" (
echo [DEBUG] Wrote "%PS_SANITIZE%"
echo [DEBUG] Running sanitizer PowerShell script...
)
powershell -NoProfile -ExecutionPolicy Bypass -File "%PS_SANITIZE%"
if "%DEBUG%"=="1" echo [DEBUG] Sanitizer exit errorlevel=!errorlevel!
set "SAFE_NAME="
if exist "%SAFE_NAME_FILE%" (
for /f "usebackq delims=" %%S in ("%SAFE_NAME_FILE%") do set "SAFE_NAME=%%S"
)
if "!SAFE_NAME!"=="" set "SAFE_NAME=folder_%CONTAINER_ID%"
del "%PS_SANITIZE%" >nul 2>&1
del "%SAFE_NAME_FILE%" >nul 2>&1
if "%DEBUG%"=="1" echo [DEBUG] SAFE_NAME="!SAFE_NAME!"
set "RAW_OUT=%WORK_DIR%\output.txt"
set "CLEAN_OUT=%WORK_DIR%\%SAFE_NAME%_apps.txt"
if "%DEBUG%"=="1" (
echo [DEBUG] RAW_OUT="%RAW_OUT%"
echo [DEBUG] CLEAN_OUT="%CLEAN_OUT%"
)
echo.
echo Querying folder "!SELECTED_FOLDER_NAME!" ...
"%SQLITE_EXE%" -header -cmd ".mode tabs" "%DB_PATH%" "SELECT f._id AS item_id, f.title AS app_title, CASE WHEN f.iconPackage IS NOT NULL AND f.iconPackage != '' THEN f.iconPackage WHEN INSTR(f.intent, 'component=') > 0 THEN SUBSTR(SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10), 1, INSTR(SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10), '/') - 1) ELSE '' END AS package_name, f.intent FROM favorites f WHERE f.container = %CONTAINER_ID% ORDER BY f.rank, f._id;" > "%RAW_OUT%"
if "%DEBUG%"=="1" (
echo [DEBUG] sqlite3 query exit errorlevel=!errorlevel!
echo [DEBUG] Raw %RAW_OUT% line count:
find /c /v "" "%RAW_OUT%" 2>nul
)
if errorlevel 1 (
echo [ERROR] SQLite query failed.
pause
exit /b 1
)
:: Write column formatter .ps1 to %TEMP% and execute with -File (package_name first, app_title second)
set "PS_FORMAT=%TEMP%\adbfolder_format.ps1"
> "%PS_FORMAT%" echo $rawFile = $env:RAW_OUT
>> "%PS_FORMAT%" echo $cleanFile = $env:CLEAN_OUT
>> "%PS_FORMAT%" echo $rows = Import-Csv -LiteralPath $rawFile -Delimiter "`t"
>> "%PS_FORMAT%" echo $lines = $rows ^| Select-Object package_name, app_title ^| Format-Table -AutoSize ^| Out-String -Width 4096
>> "%PS_FORMAT%" echo $clean = ($lines -split "`r?`n" ^| ForEach-Object { $_.TrimEnd() } ^| Where-Object { $_ -ne '' }) -join "`r`n"
>> "%PS_FORMAT%" echo [System.IO.File]::WriteAllText($cleanFile, $clean + "`r`n", (New-Object System.Text.UTF8Encoding($false)))
if "%DEBUG%"=="1" echo [DEBUG] Running formatter PowerShell script "%PS_FORMAT%"...
powershell -NoProfile -ExecutionPolicy Bypass -File "%PS_FORMAT%"
if "%DEBUG%"=="1" echo [DEBUG] PowerShell formatter exit errorlevel=!errorlevel!
del "%PS_FORMAT%" >nul 2>&1
if errorlevel 1 (
echo [ERROR] Failed to format output columns.
pause
exit /b 1
)
echo.
echo --- Result (%CLEAN_OUT%) ---
echo.
type "%CLEAN_OUT%"
echo.
echo Raw tab-delimited output saved to: "%RAW_OUT%"
echo Filtered app list saved to: "%CLEAN_OUT%"
echo.
pause
exit /b 0
:: -------------------------------------------------------------------------
:: end of adbfolder.bat
:: -------------------------------------------------------------------------
--
Everything we do, is for everyone to benefit from. That's how we're wired.
Re: Can we programmatically get package names of icons in a homescreen folder?
Author: Maria Sophia
Date: Fri, 20 Nov 2026 05:06
Date: Fri, 20 Nov 2026 05:06
602 lines
25315 bytes
25315 bytes
Maria Sophia wrote:
> I think I will also add the homescreen pane number too.
Big changes coming...
The adbfolder.bat v2p3 is working well, but v2p4 is going to be
a major rewrite for usability in the output format, so let's lock
down v2p3 for now, as the next version is gonna have better outpuot
organization 'cuz I'm adding the dock & panes and loose apps.
I might even list all the apps that are NOT yet on the homescreen!
Notice below my dock has a shortcuts folder with shortcuts in it,
which are DIFFERENT than the normal folders which have app icons.
In the next revision, I'll treat the dock as a de-facto folder.
C:\app\editor\android\scrcpy> adbfolder.bat
Checking required tools (adb and sqlite3) ...
Working directory: "C:\app\editor\android\scrcpy" Nova work directory: "C:\app\editor\android\scrcpy\nova" ---------------- Select source for Nova Launcher database: [1] Pull .novabackup from Android via ADB and extract nova.db [Default] [2] Use an existing nova.db or .novabackup or .zip already on Windows
Enter choice [1 or 2]: 1
--- Pull Nova Backup from Android ---
Targeting device: 192.168.1.4:5555
Listing backups in /storage/emulated/0/0000/bck/nova_backup ...
[1] 2026-11-19_12-57.novabackup
[2] 2026-08-19_21-51.novabackup
[3] 2026-08-19_11-31.novabackup
[4] 2026-08-16_11-36.novabackup
Select backup number [1-4, Default: 1]: 1
Pulling "/storage/emulated/0/0000/bck/nova_backup/2026-11-19_12-57.novabackup" to "C:\app\editor\android\scrcpy\nova\2026-11-19_12-57.novabackup" ...
/storage/emulated/0/0000/bck/nova_backup/2026-... 0 skipped. 3.3 MB/s (6564861 bytes in 1.902s)
Extracting backup.zip to "C:\app\editor\android\scrcpy\nova\backup_extracted" ...
Using database: "C:\app\editor\android\scrcpy\nova\backup_extracted\nova.db"
Scanning Nova Launcher folders by dock and pane ...
Dock
[1] shortcuts
Select folder number [1-1]: 1
Querying "Dock - shortcuts" ...
--- Result (C:\app\editor\android\scrcpy\nova\Dock_-_shortcuts_apps.txt) ---
package_name app_title
------------ ---------
com.pw.wifishortcut WiFi Shortcut
com.bundle.anchor anchor
com.apps.settings Settings App
com.netvor.settings.database.editor Settings Database Editor
com.apple.trackerdetect Tracker Detect
com.sec.android.app.myfiles Trash
io.github.muntashirakon.AppManager Interceptor
Raw tab-delimited output saved to: "C:\app\editor\android\scrcpy\nova\output.txt"
Filtered app list saved to: "C:\app\editor\android\scrcpy\nova\Dock_-_shortcuts_apps.txt"
Press any key to continue . . .
C:\app\editor\android\scrcpy>
:: -------------------------------------------------------------------------
:: adbfolder.bat
:: -------------------------------------------------------------------------
:: Extracts app package names and titles from a selected android homescreen
:: folder into a readable text file to assist in backup/restore maintenance
::
:: Can pull a backup from android via adb or read an existing nova db or
:: nova backup archive on windows needing only adb and sql dependencies
:: -------------------------------------------------------------------------
:: v2p3 20261119 List folders under dock and each pane with no default
:: and skip empty sections, e.g., when the dock has no folders
:: v2p2 20261119 Added full-layout option outputting dock and pane headers
:: with package_name and app_title lines
:: v2p1 20261119 Replaced backtick for /f calls on DOCK_TOTAL and PANE_TOTAL
:: with temp file redirects so cmd reliably captures counts
:: v2p0 20261119 Removed ampersand and parenthesis inside comment labels
:: as labels are not comments even though they act like them
:: v1p9 20261119 Removed item_type column from output and grouped folders
:: by their homescreen pane eg, "Pane 0 Folder: weather"
:: v1p8 20261119 Dynamically lists dock, eg, container = -101, and lists
:: homescreen panes by screen number, eg, container = -100,
:: and by named folders eg, itemType = 2, from nova db
:: and includes item_type in output
:: v1p7 20261119 Searches android storage for * novabackup files when none
:: are found in ANDROID_BCK_DIR, storing full remote paths so
:: backups in any folder can be pulled cleanly
:: v1p6 20261119 Set DEBUG=0 by default for clean normal output while keeping
:: the toggle available for troubleshooting
:: v1p5 20261119 Reversed output columns to package_name first, app_title
:: second and added startup dependency check for adb and
:: sqlite3 dependency checking configured paths and PATH
:: v1p4 20261119 Moved powershell commands into %TEMP%\* ps1 scripts run via
:: "-File" instead of backticks so cmd never parses "<" or ">"
:: v1p3 20261119 Added DEBUG=1 instrumentation
:: v1p2 20261119 Replaced cmd FOR sanitizer with powershell
:: v1p1 20261119 Numbered selection menu for novabackup files, lists folders
:: by name with numbered selection instead of raw container IDs
:: v1p0 20261119 Initial version to pull backup or use local nova db, query
:: sql via sqlite3 exe, filter columns with powershell
:: -------------------------------------------------------------------------
@echo off
setlocal enabledelayedexpansion
cd /d "%~dp0"
:: --- Debug flag 1 = verbose [DEBUG] traces, 0 = quiet ---
set "DEBUG=0"
:: --- Configurable paths ---
set "ADB_EXE=C:\app\editor\android\scrcpy\adb.exe"
set "SQLITE_EXE=C:\app\editor\android\sdk\platform-tools\sqlite3.exe"
set "WORK_DIR=C:\app\editor\android\scrcpy\nova"
set "ANDROID_BCK_DIR=/storage/emulated/0/0000/bck/nova_backup"
set "DEFAULT_CONTAINER=2921"
if "%DEBUG%"=="1" (
echo [DEBUG] SCRIPT_DIR="%~dp0"
echo [DEBUG] CD="%CD%"
echo [DEBUG] ADB_EXE="%ADB_EXE%"
echo [DEBUG] SQLITE_EXE="%SQLITE_EXE%"
echo [DEBUG] WORK_DIR="%WORK_DIR%"
)
:: -------------------------------------------------------------------------
:: Startup dependency and PATH check for adb exe and sqlite3 exe
:: -------------------------------------------------------------------------
echo Checking required tools (adb and sqlite3) ...
set "PATH_ADB="
for /f "usebackq delims=" %%W in (`where adb 2^>nul`) do (
if "!PATH_ADB!"=="" set "PATH_ADB=%%W"
)
set "PATH_SQLITE="
for /f "usebackq delims=" %%W in (`where sqlite3 2^>nul`) do (
if "!PATH_SQLITE!"=="" set "PATH_SQLITE=%%W"
)
if "%DEBUG%"=="1" (
echo [DEBUG] PATH_ADB="!PATH_ADB!"
echo [DEBUG] PATH_SQLITE="!PATH_SQLITE!"
)
:: Prefer configured path if it exists, otherwise fall back to PATH
if not exist "%ADB_EXE%" (
if not "!PATH_ADB!"=="" (
echo [INFO] Configured ADB_EXE not found; using PATH: "!PATH_ADB!"
set "ADB_EXE=!PATH_ADB!"
) else (
echo [WARN] adb.exe not found at "%ADB_EXE%" and not in PATH.
)
) else if "!PATH_ADB!"=="" (
echo [INFO] adb.exe found at configured path, though not in PATH.
)
if not exist "%SQLITE_EXE%" (
if not "!PATH_SQLITE!"=="" (
echo [INFO] Configured SQLITE_EXE not found; using PATH: "!PATH_SQLITE!"
set "SQLITE_EXE=!PATH_SQLITE!"
) else (
echo [ERROR] sqlite3.exe not found at "%SQLITE_EXE%" and not in PATH.
pause
exit /b 1
)
) else if "!PATH_SQLITE!"=="" (
echo [INFO] sqlite3.exe found at configured path, though not in PATH.
)
if not exist "%WORK_DIR%" mkdir "%WORK_DIR%"
echo Working directory: "%CD%"
echo Nova work directory: "%WORK_DIR%"
echo ----------------
echo.
echo Select source for Nova Launcher database:
echo [1] Pull .novabackup from Android via ADB and extract nova.db [Default]
echo [2] Use an existing nova.db or .novabackup or .zip already on Windows
echo.
set "SRC_CHOICE=1"
set /p "SRC_CHOICE=Enter choice [1 or 2]: "
if "%DEBUG%"=="1" echo [DEBUG] SRC_CHOICE="!SRC_CHOICE!"
if "%SRC_CHOICE%"=="2" goto :use_local_source
if "%SRC_CHOICE%"=="1" goto :pull_from_android
goto :pull_from_android
:: -------------------------------------------------------------------------
:: Option 1: Pull backup from android via adb
:: -------------------------------------------------------------------------
:pull_from_android
echo.
echo --- Pull Nova Backup from Android ---
if not exist "%ADB_EXE%" (
echo [ERROR] adb.exe not found at: "%ADB_EXE%"
pause
exit /b 1
)
set "ADB_TARGET="
for /f "skip=1 tokens=1" %%g in ('"%ADB_EXE%" devices') do (
if not "%%g"=="" (
if "!ADB_TARGET!"=="" set "ADB_TARGET=%%g"
)
)
if "%DEBUG%"=="1" echo [DEBUG] ADB_TARGET="!ADB_TARGET!"
if "!ADB_TARGET!"=="" (
echo [ERROR] No connected ADB devices found.
pause
exit /b 1
)
echo Targeting device: %ADB_TARGET%
echo Listing backups in %ANDROID_BCK_DIR% ...
echo.
"%ADB_EXE%" -s %ADB_TARGET% shell ls -1t "%ANDROID_BCK_DIR%/*.novabackup" 2>nul > "%TEMP%\nova_backups.txt"
if "%DEBUG%"=="1" (
echo [DEBUG] ls exit errorlevel=!errorlevel!
echo [DEBUG] Raw %TEMP%\nova_backups.txt contents:
type "%TEMP%\nova_backups.txt" 2>nul
)
set "BCK_COUNT=0"
for /f "usebackq delims=" %%B in ("%TEMP%\nova_backups.txt") do (
set "LINE=%%B"
if not "!LINE!"=="" (
set "LINE=!LINE:^M=!"
for %%F in ("!LINE!") do set "FNAME=%%~nxF"
set /a BCK_COUNT+=1
set "BCK_ITEM_!BCK_COUNT!=!FNAME!"
set "BCK_PATH_!BCK_COUNT!=!LINE!"
echo [!BCK_COUNT!] !FNAME!
if "%DEBUG%"=="1" (
echo [DEBUG] BCK_ITEM_!BCK_COUNT!="!FNAME!"
echo [DEBUG] BCK_PATH_!BCK_COUNT!="!LINE!"
)
)
)
del "%TEMP%\nova_backups.txt" >nul 2>&1
if %BCK_COUNT% EQU 0 (
echo [INFO] No .novabackup files found in %ANDROID_BCK_DIR%.
echo Searching Android storage for *.novabackup files ...
echo.
"%ADB_EXE%" -s %ADB_TARGET% shell "for d in /storage/emulated/0 /storage/*; do [ -d \"\$d\" ] && [ \"\$d\" != \"/storage/emulated\" ] && find \"\$d\" -maxdepth 5 -name '*.novabackup' 2>/dev/null; done" 2>nul > "%TEMP%\nova_backups_search.txt"
if "%DEBUG%"=="1" (
echo [DEBUG] Search exit errorlevel=!errorlevel!
echo [DEBUG] Raw %TEMP%\nova_backups_search.txt contents:
type "%TEMP%\nova_backups_search.txt" 2>nul
)
for /f "usebackq delims=" %%S in ("%TEMP%\nova_backups_search.txt") do (
set "LINE=%%S"
if not "!LINE!"=="" (
set "LINE=!LINE:^M=!"
for %%F in ("!LINE!") do set "FNAME=%%~nxF"
set /a BCK_COUNT+=1
set "BCK_ITEM_!BCK_COUNT!=!FNAME!"
set "BCK_PATH_!BCK_COUNT!=!LINE!"
echo [!BCK_COUNT!] !LINE!
if "%DEBUG%"=="1" (
echo [DEBUG] BCK_ITEM_!BCK_COUNT!="!FNAME!"
echo [DEBUG] BCK_PATH_!BCK_COUNT!="!LINE!"
)
)
)
del "%TEMP%\nova_backups_search.txt" >nul 2>&1
)
if %BCK_COUNT% EQU 0 (
echo [WARN] No .novabackup files found in %ANDROID_BCK_DIR% or Android storage.
:manual_bck
set "BCK_FILE="
set /p "BCK_FILE=Enter backup filename or full Android path (e.g. 2026-11-19_12-57.novabackup): "
if "!BCK_FILE!"=="" (
echo [ERROR] No backup filename provided.
pause
exit /b 1
)
set "BCK_FILE=!BCK_FILE:"=!"
set "REMOTE_BCK=!BCK_FILE!"
if not "!REMOTE_BCK:~0,1!"=="/" set "REMOTE_BCK=%ANDROID_BCK_DIR%/!BCK_FILE!"
for %%F in ("!REMOTE_BCK!") do set "BCK_FILE=%%~nxF"
goto :pull_selected_backup
)
echo.
set "BCK_PICK=1"
set /p "BCK_PICK=Select backup number [1-%BCK_COUNT%, Default: 1]: "
if "!BCK_PICK!"=="" set "BCK_PICK=1"
if "%DEBUG%"=="1" echo [DEBUG] BCK_PICK="!BCK_PICK!"
set "BCK_FILE="
set "REMOTE_BCK="
for /l %%N in (1,1,%BCK_COUNT%) do (
if "!BCK_PICK!"=="%%N" (
set "BCK_FILE=!BCK_ITEM_%%N!"
set "REMOTE_BCK=!BCK_PATH_%%N!"
)
)
if "!BCK_FILE!"=="" (
set "CANDIDATE=!BCK_PICK:"=!"
set "REMOTE_BCK=!CANDIDATE!"
if not "!REMOTE_BCK:~0,1!"=="/" set "REMOTE_BCK=%ANDROID_BCK_DIR%/!CANDIDATE!"
for %%F in ("!REMOTE_BCK!") do set "BCK_FILE=%%~nxF"
)
if "%DEBUG%"=="1" (
echo [DEBUG] BCK_FILE="!BCK_FILE!"
echo [DEBUG] REMOTE_BCK="!REMOTE_BCK!"
)
:pull_selected_backup
set "LOCAL_BCK=%WORK_DIR%\%BCK_FILE%"
set "LOCAL_ZIP=%WORK_DIR%\backup.zip"
set "EXTRACT_DIR=%WORK_DIR%\backup_extracted"
echo.
echo Pulling "%REMOTE_BCK%" to "%LOCAL_BCK%" ...
"%ADB_EXE%" -s %ADB_TARGET% pull "%REMOTE_BCK%" "%LOCAL_BCK%"
if errorlevel 1 (
echo [ERROR] Failed to pull backup from Android.
pause
exit /b 1
)
if exist "%LOCAL_ZIP%" del /f /q "%LOCAL_ZIP%"
ren "%LOCAL_BCK%" "backup.zip"
if errorlevel 1 (
echo [ERROR] Failed to rename "%LOCAL_BCK%" to backup.zip.
pause
exit /b 1
)
if exist "%EXTRACT_DIR%" rmdir /s /q "%EXTRACT_DIR%"
echo Extracting backup.zip to "%EXTRACT_DIR%" ...
powershell -NoProfile -Command "Expand-Archive -LiteralPath '%LOCAL_ZIP%' -DestinationPath '%EXTRACT_DIR%' -Force"
if errorlevel 1 (
echo [ERROR] Failed to extract backup.zip.
pause
exit /b 1
)
set "DB_PATH=%EXTRACT_DIR%\nova.db"
goto :verify_db
:: -------------------------------------------------------------------------
:: Option 2: Use local nova db or novabackup or zip
:: -------------------------------------------------------------------------
:use_local_source
echo.
echo --- Local Database Selection ---
echo Enter the path to nova.db (or a .novabackup / .zip file).
echo Default: "%WORK_DIR%\backup_extracted\nova.db"
echo.
:ask_local_db
set "USER_DB="
set /p "USER_DB=Path to database or backup file [Enter for default]: "
if "!USER_DB!"=="" (
set "DB_PATH=%WORK_DIR%\backup_extracted\nova.db"
) else (
set "USER_DB=!USER_DB:"=!"
for %%A in ("!USER_DB!") do set "DB_PATH=%%~fA"
)
if not exist "%DB_PATH%" (
echo [ERROR] File not found: "%DB_PATH%"
set "RETRY="
set /p "RETRY=Try again? [Y/n]: "
if /i "!RETRY!"=="n" exit /b 1
goto :ask_local_db
)
for %%E in ("%DB_PATH%") do set "EXT=%%~xE"
if /i "!EXT!"==".novabackup" goto :extract_local_archive
if /i "!EXT!"==".zip" goto :extract_local_archive
goto :verify_db
:extract_local_archive
set "EXTRACT_DIR=%WORK_DIR%\backup_extracted"
if exist "%EXTRACT_DIR%" rmdir /s /q "%EXTRACT_DIR%"
echo Extracting "%DB_PATH%" to "%EXTRACT_DIR%" ...
powershell -NoProfile -Command "Expand-Archive -LiteralPath '%DB_PATH%' -DestinationPath '%EXTRACT_DIR%' -Force"
if errorlevel 1 (
echo [ERROR] Failed to extract archive.
pause
exit /b 1
)
set "DB_PATH=%EXTRACT_DIR%\nova.db"
:: -------------------------------------------------------------------------
:: Verify database and list folders grouped by dock and homescreen panes
:: -------------------------------------------------------------------------
:verify_db
if not exist "%DB_PATH%" (
echo [ERROR] nova.db not found at: "%DB_PATH%"
pause
exit /b 1
)
echo.
echo Using database: "%DB_PATH%"
echo Scanning Nova Launcher folders by dock and pane ...
echo.
set "TGT_COUNT=0"
:: 1 Check dock folders where itemType = 2 and container = -101
"%SQLITE_EXE%" -cmd ".separator |" "%DB_PATH%" "SELECT _id, CASE WHEN title IS NULL OR TRIM(title) = '' THEN '(Untitled Folder)' ELSE title END FROM favorites WHERE itemType = 2 AND container = -101 ORDER BY LOWER(title), _id;" > "%TEMP%\nova_dock_folders.txt" 2>nul
set "DOCK_HAS_FOLDERS=0"
for /f "usebackq tokens=1* delims=|" %%A in ("%TEMP%\nova_dock_folders.txt") do (
set "FID=%%A"
set "FNAME=%%B"
set "FNAME=!FNAME:^M=!"
if not "!FID!"=="" (
if "!DOCK_HAS_FOLDERS!"=="0" (
echo Dock
set "DOCK_HAS_FOLDERS=1"
)
set /a TGT_COUNT+=1
set "TGT_LABEL_!TGT_COUNT!=Dock - !FNAME!"
set "TGT_WHERE_!TGT_COUNT!=f.container = !FID!"
set "TGT_ORDER_!TGT_COUNT!=f.rank, f._id"
echo [!TGT_COUNT!] !FNAME!
)
)
del "%TEMP%\nova_dock_folders.txt" >nul 2>&1
:: 2 Check folders on each homescreen pane where itemType = 2 and container = -100
"%SQLITE_EXE%" "%DB_PATH%" "SELECT DISTINCT screen FROM favorites WHERE itemType = 2 AND container = -100 AND screen IS NOT NULL AND TRIM(CAST(screen AS TEXT)) != '' ORDER BY CAST(screen AS INTEGER), screen;" > "%TEMP%\nova_home_screens.txt" 2>nul
for /f "usebackq delims=" %%S in ("%TEMP%\nova_home_screens.txt") do (
set "SCR=%%S"
set "SCR=!SCR:^M=!"
if not "!SCR!"=="" (
"%SQLITE_EXE%" -cmd ".separator |" "%DB_PATH%" "SELECT _id, CASE WHEN title IS NULL OR TRIM(title) = '' THEN '(Untitled Folder)' ELSE title END FROM favorites WHERE itemType = 2 AND container = -100 AND screen = !SCR! ORDER BY LOWER(title), _id;" > "%TEMP%\nova_pane_folders.txt" 2>nul
set "PANE_HAS_FOLDERS=0"
for /f "usebackq tokens=1* delims=|" %%A in ("%TEMP%\nova_pane_folders.txt") do (
set "FID=%%A"
set "FNAME=%%B"
set "FNAME=!FNAME:^M=!"
if not "!FID!"=="" (
if "!PANE_HAS_FOLDERS!"=="0" (
echo Pane !SCR!
set "PANE_HAS_FOLDERS=1"
)
set /a TGT_COUNT+=1
set "TGT_LABEL_!TGT_COUNT!=Pane !SCR! - !FNAME!"
set "TGT_WHERE_!TGT_COUNT!=f.container = !FID!"
set "TGT_ORDER_!TGT_COUNT!=f.rank, f._id"
echo [!TGT_COUNT!] !FNAME!
)
)
del "%TEMP%\nova_pane_folders.txt" >nul 2>&1
)
)
del "%TEMP%\nova_home_screens.txt" >nul 2>&1
if %TGT_COUNT% EQU 0 (
echo [WARN] No folders found. Falling back to container %DEFAULT_CONTAINER%.
set /a TGT_COUNT+=1
set "TGT_LABEL_1=Folder_%DEFAULT_CONTAINER%"
set "TGT_WHERE_1=f.container = %DEFAULT_CONTAINER%"
set "TGT_ORDER_1=f.rank, f._id"
echo [1] Folder_%DEFAULT_CONTAINER%
)
echo.
set "TGT_PICK="
set /p "TGT_PICK=Select folder number [1-%TGT_COUNT%]: "
if "%DEBUG%"=="1" echo [DEBUG] TGT_PICK="!TGT_PICK!"
set "SELECTED_LABEL="
set "SQL_WHERE="
set "SQL_ORDER="
for /l %%N in (1,1,%TGT_COUNT%) do (
if "!TGT_PICK!"=="%%N" (
set "SELECTED_LABEL=!TGT_LABEL_%%N!"
set "SQL_WHERE=!TGT_WHERE_%%N!"
set "SQL_ORDER=!TGT_ORDER_%%N!"
)
)
if "%DEBUG%"=="1" (
echo [DEBUG] SELECTED_LABEL="!SELECTED_LABEL!"
echo [DEBUG] SQL_WHERE="!SQL_WHERE!"
echo [DEBUG] SQL_ORDER="!SQL_ORDER!"
)
if "!SQL_WHERE!"=="" (
echo [ERROR] Invalid selection: "!TGT_PICK!"
pause
exit /b 1
)
:run_query
if "%DEBUG%"=="1" echo [DEBUG] Entering :run_query
:: Write label sanitizer ps1 to %TEMP% so cmd never parses regex characters
set "PS_SANITIZE=%TEMP%\adbfolder_sanitize.ps1"
set "SAFE_NAME_FILE=%TEMP%\adbfolder_safename.txt"
> "%PS_SANITIZE%" echo $raw = $env:SELECTED_LABEL
>> "%PS_SANITIZE%" echo $s = [regex]::Replace($raw, '[\\/:*?"<>|() ]+', '_')
>> "%PS_SANITIZE%" echo $s = $s.Trim('_')
>> "%PS_SANITIZE%" echo if ([string]::IsNullOrWhiteSpace($s)) { $s = "nova_target" }
>> "%PS_SANITIZE%" echo [System.IO.File]::WriteAllText($env:SAFE_NAME_FILE, $s, (New-Object System.Text.UTF8Encoding($false)))
if "%DEBUG%"=="1" (
echo [DEBUG] Wrote "%PS_SANITIZE%"
echo [DEBUG] Running sanitizer PowerShell script...
)
powershell -NoProfile -ExecutionPolicy Bypass -File "%PS_SANITIZE%"
if "%DEBUG%"=="1" echo [DEBUG] Sanitizer exit errorlevel=!errorlevel!
set "SAFE_NAME="
if exist "%SAFE_NAME_FILE%" (
for /f "usebackq delims=" %%S in ("%SAFE_NAME_FILE%") do set "SAFE_NAME=%%S"
)
if "!SAFE_NAME!"=="" set "SAFE_NAME=nova_target"
del "%PS_SANITIZE%" >nul 2>&1
del "%SAFE_NAME_FILE%" >nul 2>&1
if "%DEBUG%"=="1" echo [DEBUG] SAFE_NAME="!SAFE_NAME!"
set "RAW_OUT=%WORK_DIR%\output.txt"
set "CLEAN_OUT=%WORK_DIR%\%SAFE_NAME%_apps.txt"
if "%DEBUG%"=="1" (
echo [DEBUG] RAW_OUT="%RAW_OUT%"
echo [DEBUG] CLEAN_OUT="%CLEAN_OUT%"
)
echo.
echo Querying "!SELECTED_LABEL!" ...
"%SQLITE_EXE%" -header -cmd ".mode tabs" "%DB_PATH%" "SELECT f._id AS item_id, f.title AS app_title, CASE WHEN f.iconPackage IS NOT NULL AND f.iconPackage != '' THEN f.iconPackage WHEN INSTR(f.intent, 'component=') > 0 THEN SUBSTR(SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10), 1, INSTR(SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10), '/') - 1) ELSE '' END AS package_name, f.intent FROM favorites f WHERE %SQL_WHERE% ORDER BY %SQL_ORDER%;" > "%RAW_OUT%"
if "%DEBUG%"=="1" (
echo [DEBUG] sqlite3 query exit errorlevel=!errorlevel!
echo [DEBUG] Raw %RAW_OUT% line count:
find /c /v "" "%RAW_OUT%" 2>nul
)
if errorlevel 1 (
echo [ERROR] SQLite query failed.
pause
exit /b 1
)
:: Write column formatter ps1 to %TEMP% and execute with -File package_name first, app_title second
set "PS_FORMAT=%TEMP%\adbfolder_format.ps1"
> "%PS_FORMAT%" echo $rawFile = $env:RAW_OUT
>> "%PS_FORMAT%" echo $cleanFile = $env:CLEAN_OUT
>> "%PS_FORMAT%" echo $rows = Import-Csv -LiteralPath $rawFile -Delimiter "`t"
>> "%PS_FORMAT%" echo $lines = $rows ^| Select-Object package_name, app_title ^| Format-Table -AutoSize ^| Out-String -Width 4096
>> "%PS_FORMAT%" echo $clean = ($lines -split "`r?`n" ^| ForEach-Object { $_.TrimEnd() } ^| Where-Object { $_ -ne '' }) -join "`r`n"
>> "%PS_FORMAT%" echo [System.IO.File]::WriteAllText($cleanFile, $clean + "`r`n", (New-Object System.Text.UTF8Encoding($false)))
if "%DEBUG%"=="1" echo [DEBUG] Running formatter PowerShell script "%PS_FORMAT%"...
powershell -NoProfile -ExecutionPolicy Bypass -File "%PS_FORMAT%"
if "%DEBUG%"=="1" echo [DEBUG] PowerShell formatter exit errorlevel=!errorlevel!
del "%PS_FORMAT%" >nul 2>&1
if errorlevel 1 (
echo [ERROR] Failed to format output columns.
pause
exit /b 1
)
echo.
echo --- Result (%CLEAN_OUT%) ---
echo.
type "%CLEAN_OUT%"
echo.
echo Raw tab-delimited output saved to: "%RAW_OUT%"
echo Filtered app list saved to: "%CLEAN_OUT%"
echo.
pause
exit /b 0
:: -------------------------------------------------------------------------
:: end of adbfolder.bat
:: -------------------------------------------------------------------------
--
On Usenet, we teach what we know and learn from others what we don't.
Re: Can we programmatically get package names of icons in a homescreen folder?
Author: Maria Sophia
Date: Fri, 20 Nov 2026 05:37
Date: Fri, 20 Nov 2026 05:37
421 lines
19691 bytes
19691 bytes
Maria Sophia wrote: > The adbfolder.bat v2p3 is working well, but v2p4 is going to be > a major rewrite for usability in the output format This is a major rewrite of adbfolder.bat It loops. It organizes by pane. It handles the quirks of the dock. It handles loose icons that aren't in folders (which shouldn't exist). It doesn't yet spit out installed packages that aren't on the homescreen. C:\app\editor\android\scrcpy> adbfolder.bat Checking required tools (adb and sqlite3) ... Working directory: "C:\app\editor\android\scrcpy" Nova work directory: "C:\app\editor\android\scrcpy\nova" ---------------- Select source for Nova Launcher database: [1] Pull .novabackup from Android via ADB and extract nova.db [Default] [2] Use an existing nova.db or .novabackup or .zip already on Windows Enter choice [1 or 2]: 1 --- Pull Nova Backup from Android --- Targeting device: 192.168.1.4:5555 Listing backups in /storage/emulated/0/0000/bck/nova_backup ... [1] 2026-11-19_12-57.novabackup [2] 2026-08-19_21-51.novabackup [3] 2026-08-19_11-31.novabackup [4] 2026-08-16_11-36.novabackup Select backup number [1-4, Default: 1]: 1 Pulling "/storage/emulated/0/0000/bck/nova_backup/2026-11-19_12-57.novabackup" to "C:\app\editor\android\scrcpy\nova\2026-11-19_12-57.novabackup" ... /storage/emulated/0/0000/bck/nova_backup/2026-... 0 skipped. 3.5 MB/s (6564861 bytes in 1.773s) Extracting backup.zip to "C:\app\editor\android\scrcpy\nova\backup_extracted" ... Using database: "C:\app\editor\android\scrcpy\nova\backup_extracted\nova.db" Scanning Nova Launcher dock, panes and folders ... dock [1] dock apps [2] shortcuts pane 0 [3] toon [4] track [5] shortcut [6] spoof [7] TTS [8] todo [9] automate [10] stuff [11] (Untitled Folder) [12] (Untitled Folder) [13] Clock [14] (Untitled Folder) [15] epub [16] SvcMode [17] (Untitled Folder) [18] (Untitled Folder) [19] PlantID [20] hike [21] pane 0 loose apps pane 1 [22] time [23] comms [24] buy [25] files [26] net [27] web [28] nature [29] auto [30] pic [31] audio [32] vid [33] todo [34] sensor [35] weather [36] apk [37] sys [38] pane 1 loose apps pane 2 [39] (Untitled Folder) [40] motion [41] obd [42] webcam [43] pane 2 loose apps Select number [1-43, q to quit]: 32 Querying "pane 1 - vid" ... --- Result (C:\app\editor\android\scrcpy\nova\pane_1_-_vid_apps.txt) --- package_name app_title ------------ --------- org.schabi.newpipe NewPipe com.github.libretube LibreTube org.videolan.vlc VLC InfinityLoop1309.NewPipeEnhanced PipePipe com.junkfood.seal Seal is.xyz.mpv mpv jp.nalab.tomcam TomCam com.shallwaystudio.nodevideo NodeVideo com.mobivio.android.cutecut Cute CUT org.courville.nova Nova Video Player com.richardtozer.dashcam DashCam com.cbs.tve CBS com.cbs.app Paramount+ com.nbcnews.msnbc.mobile MSNBC com.fadcam FadCam Raw tab-delimited output saved to: "C:\app\editor\android\scrcpy\nova\output.txt" Filtered app list saved to: "C:\app\editor\android\scrcpy\nova\pane_1_-_vid_apps.txt" Export another folder or pane? [y/N]: y Using database: "C:\app\editor\android\scrcpy\nova\backup_extracted\nova.db" Scanning Nova Launcher dock, panes and folders ... dock [1] dock apps [2] shortcuts pane 0 [3] toon [4] track [5] shortcut [6] spoof [7] TTS [8] todo [9] automate [10] stuff [11] (Untitled Folder) [12] (Untitled Folder) [13] Clock [14] (Untitled Folder) [15] epub [16] SvcMode [17] (Untitled Folder) [18] (Untitled Folder) [19] PlantID [20] hike [21] pane 0 loose apps pane 1 [22] time [23] comms [24] buy [25] files [26] net [27] web [28] nature [29] auto [30] pic [31] audio [32] vid [33] todo [34] sensor [35] weather [36] apk [37] sys [38] pane 1 loose apps pane 2 [39] (Untitled Folder) [40] motion [41] obd [42] webcam [43] pane 2 loose apps Select number [1-43, q to quit]: 30 Querying "pane 1 - pic" ... --- Result (C:\app\editor\android\scrcpy\nova\pane_1_-_pic_apps.txt) --- package_name app_title ------------ --------- com.simplemobiletools.gallery.pro smtGallery ru.tech.imageresizershrinker Image Toolbox deckers.thibault.aves Aves app.grapheneos.camera Camera net.sourceforge.opencamera Open Camera com.google.android.apps.cameralite GC night com.simplemobiletools.camera smtCamera pl.waskysoft.screenshotassistant Screenshot Assistant com.motorola.camera2 Camera com.dsphotoeditor.demoapp DS Photo Editor com.simplemobiletools.draw.pro smtDraw com.niksoftware.snapseed Snapseed co.inker Inker org.catrobat.paintroid Pocket Paint net.braincake.pixl.pixl Pixl com.gmail.anubhavdas54.whatsdeleted WhatsDeleted com.google.android.GoogleCamera PGCam audioscreenshot.awesomeapps.com.audioscreenshot Audio Screenshot us.koller.cameraroll Camera Roll com.nikon.wu.wmau wmu com.jarsilio.android.scrambledeggsif Scrambled Exif com.dozingcatsoftware.vectorcamera Vector Camera org.Gallery.App Gallery com.adfree.Gallery Gallery adfree.gallery Gallery de.k3b.android.lossless_jpg_crop LLCrop (lossless) org.Gallery.Pro Gallery de.kaffeemitkoffein.imagepipe Imagepipe com.moblynx.galleryicsold Gallery ICS com.arunsoft.icon Material Icon Maker de.k3b.android.androFotoFinder A Photo Manager com.sybu.simplegallery Gallery com.alienpants.leafpicrevived LeafPic Revived la.daube.photochiotte PhotoChiotte com.donnnno.arcticons Arcticons com.perracolabs.cpd Cameringo Lite com.intermedia.hd.camera.professional ProCam X Lite com.perracolabs.cpd Cameringo Lite com.intermedia.hd.camera.professional ProCam X Lite com.google.android.GoogleCamera penguin com.google.android.apps.cameralite Camera Go com.google.android.apps.cameralite wichaya pinguin2001.penguingcam Camera net.sourceforge.opencamera Open Camera de.stoehr.loviapps.wezoom weZoom dev.leonlatsch.photok Photok com.sixcarrots.peephole Peephole com.remoteguard.phototrap PhotoTrap com.sjm.camera PRO Motion Detector Camera com.d136.smbsecuritycamera Smb Security Camera pl.waskysoft.screenshotassistant Screenshot Assistant com.momocode.shortcuts Awesome Icons com.jndapp.lux.free.iconpack LuX Free com.whicons.iconpack Whicons scadica.prcl Precision Color com.aminbeheshti.exifviewer Exif Viewer com.srjuen.exifviewer Exif Viewer com.none.tom.exiferaser ExifEraser com.photograph.editexifphoto Exif Editor com.jarsilio.android.scrambledeggsif Exif adhoc del com.airbeat.device.inspector Camera2 Probe com.sybu.imageresizer Photo/Video Compressor ru.tech.imageresizershrinker Image Toolbox com.yuanfang2345.passport Nova ID Photo com.passportphoto.visaid.photomaker Passport Size Photo com.darkgalaxy.client.app_id_photo ID Photos Maker com.sec.android.app.camera Camera Raw tab-delimited output saved to: "C:\app\editor\android\scrcpy\nova\output.txt" Filtered app list saved to: "C:\app\editor\android\scrcpy\nova\pane_1_-_pic_apps.txt" Export another folder or pane? [y/N]: y Using database: "C:\app\editor\android\scrcpy\nova\backup_extracted\nova.db" Scanning Nova Launcher dock, panes and folders ... dock [1] dock apps [2] shortcuts pane 0 [3] toon [4] track [5] shortcut [6] spoof [7] TTS [8] todo [9] automate [10] stuff [11] (Untitled Folder) [12] (Untitled Folder) [13] Clock [14] (Untitled Folder) [15] epub [16] SvcMode [17] (Untitled Folder) [18] (Untitled Folder) [19] PlantID [20] hike [21] pane 0 loose apps pane 1 [22] time [23] comms [24] buy [25] files [26] net [27] web [28] nature [29] auto [30] pic [31] audio [32] vid [33] todo [34] sensor [35] weather [36] apk [37] sys [38] pane 1 loose apps pane 2 [39] (Untitled Folder) [40] motion [41] obd [42] webcam [43] pane 2 loose apps Select number [1-43, q to quit]: 31 Querying "pane 1 - audio" ... --- Result (C:\app\editor\android\scrcpy\nova\pane_1_-_audio_apps.txt) --- package_name app_title ------------ --------- com.simplemobiletools.dialer smtDialer com.simplycomplexapps.ASTellme Tell Me com.rom1v.sndcpy sndcpy com.google.android.apps.recorder GRecorder com.github.axet.audiorecorder Audio Recorder com.simplemobiletools.voicerecorder smtVoice Recorder com.simplemobiletools.musicplayer smtMusic Player com.danielkim.soundrecorder Sound Recorder com.tmobile.vvm.application Visual Voicemail com.motorola.fmplayer FM Radio com.catalinagroup.callrecorder Cube ACR org.y20k.transistor Transistor com.einmalfel.podlisten PodListen com.nll.acr ACR com.hitrolab.audioeditor AudioLab com.hudun.androidrecorder Voice to Text de.danoeh.antennapod AntennaPod com.sayhi.android.sayhitranslate SayHi com.herman.ringpod Ringpod com.google.android.apps.recorder Recorder com.herman.ringtone Ringtone Maker com.reallybadapps.podcastguru PodcastGuru com.kabouzeid.gramophone Phonograph com.nassiansoft.minipod Mini Pod com.rannsoft.soundoff SoundOff com.dc7.SilentModeToggle Silent Mode Toggle muter.muter Mute com.iven.musicplayergo Music Player GO com.aimp.player AIMP com.sqr5.android.player_jb Maple JB com.jrtstudio.AnotherMusicPlayer Rocket Player io.github.muntashirakon.Music Metro com.github.cythara Cythara com.geecko.QuickLyric QuickLyric com.piyush.newu.texttovoice PDF To Voice com.nll.acr ACR com.sayhi.android.sayhitranslate SayHi com.github.axet.audiorecorder Audio Recorder com.dimowner.audiorecorder Audio Recorder com.hanan.android.ramkol Auto Speaker com.danielkim.soundrecorder Sound Recorder com.richardtozer.dashcam DashCam com.google.android.apps.recorder Recorder com.nll.asr ASR com.iboism.dictate Dictate Everything ai.chat.gpt.app AI Chat com.tiptop.ai.chat.gpt AI Chat com.yuriy.openradio Open Radio com.liveradio.fmradio.radiotuner.radiostation.amradio FM Radio hesoft.T2S T2S com.ktix007.talk Talk FREE ak.alizandro.smartaudiobookplayer Smart AudioBook Player de.ph1b.audiobook Voice Raw tab-delimited output saved to: "C:\app\editor\android\scrcpy\nova\output.txt" Filtered app list saved to: "C:\app\editor\android\scrcpy\nova\pane_1_-_audio_apps.txt" Export another folder or pane? [y/N]: n Press any key to continue . . . C:\app\editor\android\scrcpy> Drat. The message is too long for my nntp server... so here are just the comments, as I need to add the final finishing touches still to come... :: ------------------------------------------------------------------------- :: adbfolder.bat :: ------------------------------------------------------------------------- :: Extracts app package names and titles from a selected android homescreen :: folder or pane into a text file to assist in backup/restore maintenance :: :: Will pull a backup from android via adb or read an existing nova db or :: nova backup archive on windows needing only adb and sql dependencies :: ------------------------------------------------------------------------- :: v2p8 20261119 Added quit option at folder selection prompt and loop back :: prompt at end to export another folder or pane :: v2p7 20261119 Replaced fragile DISTINCT screen loop with explicit pane :: index pass 0 to 9 using CAST screen AS INTEGER so panes :: with folders or loose apps always appear in order :: v2p6 20261119 Fixed pane screen query so folders on pane 0, pane 1 and :: pane 2 display properly along with loose pane apps and other :: v2p5 20261119 Grouped folders by screen number across panes and kept :: unmatched folders under other at the bottom :: v2p4 20261119 Added loose apps choice at the end of each pane with :: non-folder items and kept other catch-all at the bottom :: v2p3 20261119 Listed folders under dock and each pane with no default :: and skipped empty sections :: v2p2 20261119 Added full-layout option outputting dock and pane headers :: with package_name and app_title lines :: v2p1 20261119 Replaced backtick for /f calls on DOCK_TOTAL and PANE_TOTAL :: with temp file redirects so cmd reliably captures counts :: v2p0 20261119 Removed ampersand and parenthesis inside comment labels :: as labels are not comments even though they act like them :: v1p9 20261119 Removed item_type column from output and grouped folders :: by their homescreen pane eg, "Pane 0 Folder: weather" :: v1p8 20261119 Dynamically lists dock, eg, container = -101, and lists :: homescreen panes by screen number, eg, container = -100, :: and by named folders eg, itemType = 2, from nova db :: and includes item_type in output :: v1p7 20261119 Searches android storage for * novabackup files when none :: are found in ANDROID_BCK_DIR, storing full remote paths so :: backups in any folder can be pulled cleanly :: v1p6 20261119 Set DEBUG=0 by default for clean normal output while keeping :: the toggle available for troubleshooting :: v1p5 20261119 Reversed output columns to package_name first, app_title :: second and added startup dependency check for adb and :: sqlite3 dependency checking configured paths and PATH :: v1p4 20261119 Moved powershell commands into %TEMP%\* ps1 scripts run via :: "-File" instead of backticks so cmd never parses "<" or ">" :: v1p3 20261119 Added DEBUG=1 instrumentation :: v1p2 20261119 Replaced cmd FOR sanitizer with powershell :: v1p1 20261119 Numbered selection menu for novabackup files, lists folders :: by name with numbered selection instead of raw container IDs :: v1p0 20261119 Initial version to pull backup or use local nova db, query :: sql via sqlite3 exe, filter columns with powershell :: ------------------------------------------------------------------------- -- Usenet is better when people take the time to share what they know.
Re: Can we programmatically get package names of icons in a homescreen folder?
Author: Maria Sophia
Date: Fri, 20 Nov 2026 06:53
Date: Fri, 20 Nov 2026 06:53
839 lines
38513 bytes
38513 bytes
> It doesn't yet spit out installed packages that aren't on the homescreen.
Woo hoo!
It does now!
This will spit out the dock and homescreen folders and unique package names
in those folders and it will list the app names for each packages listed.
It will allow the user to loop, one by one, through any folder they want.
In addition, it now compares all the packages we personally installed to
those packages which happen to have launch icons on our homescreen panes.
It will list the packages that we've installed that do NOT have a launch
icon on our home screen, and, if desired, it will list the names of those
packages (but that takes a while on my PC over Wi-Fi, so that's optional).
It's finally "good enough" for me to say that I can take a break tonight.
There's nothing glaringly omitted that would indicate shoddy work on my part.
Sample output will be shown in the next post as these are too long for
my nntp server to handle both the output and the actual code to get it.
Porting to macOS/Linux will have to wait as I'm tired of coding right now.
:: -------------------------------------------------------------------------
:: adbfolder.bat
:: -------------------------------------------------------------------------
:: Extracts app package names and titles from a selected android homescreen
:: folder or pane into a text file to assist in backup/restore maintenance
::
:: Will pull a backup from android via adb or read an existing nova db or
:: nova backup archive on windows needing only adb and sql dependencies
:: -------------------------------------------------------------------------
:: v3p6 20261119 Added optional prompt before resolving app titles in
:: check_missing_3p and printed periodic progress while
:: resolving labels so quick checks finish immediately
:: v3p5 20261119 Removed stray caret escaping before closing parentheses on
:: standalone PS_DIFF_3P echo lines so PowerShell parses the
:: generated script cleanly, and kept DEBUG=1 enabled
:: v3p4 20261119 Added app label lookup via adb dumpsys and optional aapt/aapt2
:: for unplaced user apps in check_missing_3p and set DEBUG=0
:: as the default flag
:: v3p3 20261119 Replaced != with LENGTH/TRIM checks in Nova package SQL
:: query so cmd delayed expansion does not strip negation
:: and handled component= values without a slash safely
:: v3p2 20261119 Wrote Nova package SQL query to a temp .sql file to avoid
:: cmd parsing syntax errors and wrote PS_DIFF_3P line-by-line
:: instead of using an outer parenthesized block
:: v3p1 20261119 Insrumented the orphan section as it was throwing errors
:: v3p0 20261119 Fixed command syntax error when generating the PowerShell
:: diff script in check_missing_3p and wrapped the Nova
:: package query in a subquery so package_name filters cleanly
:: v2p9 20261119 Added a final sanity check before quitting to compare
:: the list of packages that have icons on the homescreen
:: against all the user-installed packages on the phone
:: to create an orphan-packages file that have no icons
:: v2p8 20261119 Added quit option at folder selection prompt and loop back
:: prompt at end to export another folder or pane
:: v2p7 20261119 Replaced fragile DISTINCT screen loop with explicit pane
:: index pass 0 to 9 using CAST screen AS INTEGER so panes
:: with folders or loose apps always appear in order
:: v2p6 20261119 Fixed pane screen query so folders on pane 0, pane 1 and
:: pane 2 display properly along with loose pane apps and other
:: v2p5 20261119 Grouped folders by screen number across panes and kept
:: unmatched folders under other at the bottom
:: v2p4 20261119 Added loose apps choice at the end of each pane with
:: non-folder items and kept other catch-all at the bottom
:: v2p3 20261119 Listed folders under dock and each pane with no default
:: and skipped empty sections
:: v2p2 20261119 Added full-layout option outputting dock and pane headers
:: with package_name and app_title lines
:: v2p1 20261119 Replaced backtick for /f calls on DOCK_TOTAL and PANE_TOTAL
:: with temp file redirects so cmd reliably captures counts
:: v2p0 20261119 Removed ampersand and parenthesis inside comment labels
:: as labels are not comments even though they act like them
:: v1p9 20261119 Removed item_type column from output and grouped folders
:: by their homescreen pane eg, "Pane 0 Folder: weather"
:: v1p8 20261119 Dynamically lists dock, eg, container = -101, and lists
:: homescreen panes by screen number, eg, container = -100,
:: and by named folders eg, itemType = 2, from nova db
:: and includes item_type in output
:: v1p7 20261119 Searches android storage for * novabackup files when none
:: are found in ANDROID_BCK_DIR, storing full remote paths so
:: backups in any folder can be pulled cleanly
:: v1p6 20261119 Set DEBUG=0 by default for clean normal output while keeping
:: the toggle available for troubleshooting
:: v1p5 20261119 Reversed output columns to package_name first, app_title
:: second and added startup dependency check for adb and
:: sqlite3 dependency checking configured paths and PATH
:: v1p4 20261119 Moved powershell commands into %TEMP%\* ps1 scripts run via
:: "-File" instead of backticks so cmd never parses "<" or ">"
:: v1p3 20261119 Added DEBUG=1 instrumentation
:: v1p2 20261119 Replaced cmd FOR sanitizer with powershell
:: v1p1 20261119 Numbered selection menu for novabackup files, lists folders
:: by name with numbered selection instead of raw container IDs
:: v1p0 20261119 Initial version to pull backup or use local nova db, query
:: sql via sqlite3 exe, filter columns with powershell
:: -------------------------------------------------------------------------
@echo off
setlocal enabledelayedexpansion
cd /d "%~dp0"
:: --- Debug flag 1 = verbose [DEBUG] traces, 0 = quiet ---
:: set "DEBUG=1"
set "DEBUG=0"
:: --- Configurable paths ---
set "ADB_EXE=C:\app\editor\android\scrcpy\adb.exe"
set "SQLITE_EXE=C:\app\editor\android\sdk\platform-tools\sqlite3.exe"
set "WORK_DIR=C:\app\editor\android\scrcpy\nova"
set "ANDROID_BCK_DIR=/storage/emulated/0/0000/bck/nova_backup"
set "DEFAULT_CONTAINER=2921"
if "%DEBUG%"=="1" (
echo [DEBUG] SCRIPT_DIR="%~dp0"
echo [DEBUG] CD="%CD%"
echo [DEBUG] ADB_EXE="%ADB_EXE%"
echo [DEBUG] SQLITE_EXE="%SQLITE_EXE%"
echo [DEBUG] WORK_DIR="%WORK_DIR%"
)
:: -------------------------------------------------------------------------
:: Startup dependency and PATH check for adb exe and sqlite3 exe
:: -------------------------------------------------------------------------
echo Checking required tools (adb and sqlite3) ...
set "PATH_ADB="
for /f "usebackq delims=" %%W in (`where adb 2^>nul`) do (
if "!PATH_ADB!"=="" set "PATH_ADB=%%W"
)
set "PATH_SQLITE="
for /f "usebackq delims=" %%W in (`where sqlite3 2^>nul`) do (
if "!PATH_SQLITE!"=="" set "PATH_SQLITE=%%W"
)
if "%DEBUG%"=="1" (
echo [DEBUG] PATH_ADB="!PATH_ADB!"
echo [DEBUG] PATH_SQLITE="!PATH_SQLITE!"
)
:: Prefer configured path if it exists, otherwise fall back to PATH
if not exist "%ADB_EXE%" (
if not "!PATH_ADB!"=="" (
echo [INFO] Configured ADB_EXE not found; using PATH: "!PATH_ADB!"
set "ADB_EXE=!PATH_ADB!"
) else (
echo [WARN] adb.exe not found at "%ADB_EXE%" and not in PATH.
)
) else if "!PATH_ADB!"=="" (
echo [INFO] adb.exe found at configured path, though not in PATH.
)
if not exist "%SQLITE_EXE%" (
if not "!PATH_SQLITE!"=="" (
echo [INFO] Configured SQLITE_EXE not found; using PATH: "!PATH_SQLITE!"
set "SQLITE_EXE=!PATH_SQLITE!"
) else (
echo [ERROR] sqlite3.exe not found at "%SQLITE_EXE%" and not in PATH.
pause
exit /b 1
)
) else if "!PATH_SQLITE!"=="" (
echo [INFO] sqlite3.exe found at configured path, though not in PATH.
)
if not exist "%WORK_DIR%" mkdir "%WORK_DIR%"
echo Working directory: "%CD%"
echo Nova work directory: "%WORK_DIR%"
echo ----------------
echo.
echo Select source for Nova Launcher database:
echo [1] Pull .novabackup from Android via ADB and extract nova.db [Default]
echo [2] Use an existing nova.db or .novabackup or .zip already on Windows
echo.
set "SRC_CHOICE=1"
set /p "SRC_CHOICE=Enter choice [1 or 2]: "
if "%DEBUG%"=="1" echo [DEBUG] SRC_CHOICE="!SRC_CHOICE!"
if "%SRC_CHOICE%"=="2" goto :use_local_source
if "%SRC_CHOICE%"=="1" goto :pull_from_android
goto :pull_from_android
:: -------------------------------------------------------------------------
:: Option 1: Pull backup from android via adb
:: -------------------------------------------------------------------------
:pull_from_android
echo.
echo --- Pull Nova Backup from Android ---
if not exist "%ADB_EXE%" (
echo [ERROR] adb.exe not found at: "%ADB_EXE%"
pause
exit /b 1
)
set "ADB_TARGET="
for /f "skip=1 tokens=1" %%g in ('"%ADB_EXE%" devices') do (
if not "%%g"=="" (
if "!ADB_TARGET!"=="" set "ADB_TARGET=%%g"
)
)
if "%DEBUG%"=="1" echo [DEBUG] ADB_TARGET="!ADB_TARGET!"
if "!ADB_TARGET!"=="" (
echo [ERROR] No connected ADB devices found.
pause
exit /b 1
)
echo Targeting device: %ADB_TARGET%
echo Listing backups in %ANDROID_BCK_DIR% ...
echo.
"%ADB_EXE%" -s %ADB_TARGET% shell ls -1t "%ANDROID_BCK_DIR%/*.novabackup" 2>nul > "%TEMP%\nova_backups.txt"
if "%DEBUG%"=="1" (
echo [DEBUG] ls exit errorlevel=!errorlevel!
echo [DEBUG] Raw %TEMP%\nova_backups.txt contents:
type "%TEMP%\nova_backups.txt" 2>nul
)
set "BCK_COUNT=0"
for /f "usebackq delims=" %%B in ("%TEMP%\nova_backups.txt") do (
set "LINE=%%B"
if not "!LINE!"=="" (
set "LINE=!LINE:^M=!"
for %%F in ("!LINE!") do set "FNAME=%%~nxF"
set /a BCK_COUNT+=1
set "BCK_ITEM_!BCK_COUNT!=!FNAME!"
set "BCK_PATH_!BCK_COUNT!=!LINE!"
echo [!BCK_COUNT!] !FNAME!
if "%DEBUG%"=="1" (
echo [DEBUG] BCK_ITEM_!BCK_COUNT!="!FNAME!"
echo [DEBUG] BCK_PATH_!BCK_COUNT!="!LINE!"
)
)
)
del "%TEMP%\nova_backups.txt" >nul 2>&1
if %BCK_COUNT% EQU 0 (
echo [INFO] No .novabackup files found in %ANDROID_BCK_DIR%.
echo Searching Android storage for *.novabackup files ...
echo.
"%ADB_EXE%" -s %ADB_TARGET% shell "for d in /storage/emulated/0 /storage/*; do [ -d \"\$d\" ] && [ \"\$d\" != \"/storage/emulated\" ] && find \"\$d\" -maxdepth 5 -name '*.novabackup' 2>/dev/null; done" 2>nul > "%TEMP%\nova_backups_search.txt"
if "%DEBUG%"=="1" (
echo [DEBUG] Search exit errorlevel=!errorlevel!
echo [DEBUG] Raw %TEMP%\nova_backups_search.txt contents:
type "%TEMP%\nova_backups_search.txt" 2>nul
)
for /f "usebackq delims=" %%S in ("%TEMP%\nova_backups_search.txt") do (
set "LINE=%%S"
if not "!LINE!"=="" (
set "LINE=!LINE:^M=!"
for %%F in ("!LINE!") do set "FNAME=%%~nxF"
set /a BCK_COUNT+=1
set "BCK_ITEM_!BCK_COUNT!=!FNAME!"
set "BCK_PATH_!BCK_COUNT!=!LINE!"
echo [!BCK_COUNT!] !LINE!
if "%DEBUG%"=="1" (
echo [DEBUG] BCK_ITEM_!BCK_COUNT!="!FNAME!"
echo [DEBUG] BCK_PATH_!BCK_COUNT!="!LINE!"
)
)
)
del "%TEMP%\nova_backups_search.txt" >nul 2>&1
)
if %BCK_COUNT% EQU 0 (
echo [WARN] No .novabackup files found in %ANDROID_BCK_DIR% or Android storage.
:manual_bck
set "BCK_FILE="
set /p "BCK_FILE=Enter backup filename or full Android path (e.g. 2026-11-19_12-57.novabackup): "
if "!BCK_FILE!"=="" (
echo [ERROR] No backup filename provided.
pause
exit /b 1
)
set "BCK_FILE=!BCK_FILE:"=!"
set "REMOTE_BCK=!BCK_FILE!"
if not "!REMOTE_BCK:~0,1!"=="/" set "REMOTE_BCK=%ANDROID_BCK_DIR%/!BCK_FILE!"
for %%F in ("!REMOTE_BCK!") do set "BCK_FILE=%%~nxF"
goto :pull_selected_backup
)
echo.
set "BCK_PICK=1"
set /p "BCK_PICK=Select backup number [1-%BCK_COUNT%, Default: 1]: "
if "!BCK_PICK!"=="" set "BCK_PICK=1"
if "%DEBUG%"=="1" echo [DEBUG] BCK_PICK="!BCK_PICK!"
set "BCK_FILE="
set "REMOTE_BCK="
for /l %%N in (1,1,%BCK_COUNT%) do (
if "!BCK_PICK!"=="%%N" (
set "BCK_FILE=!BCK_ITEM_%%N!"
set "REMOTE_BCK=!BCK_PATH_%%N!"
)
)
if "!BCK_FILE!"=="" (
set "CANDIDATE=!BCK_PICK:"=!"
set "REMOTE_BCK=!CANDIDATE!"
if not "!REMOTE_BCK:~0,1!"=="/" set "REMOTE_BCK=%ANDROID_BCK_DIR%/!CANDIDATE!"
for %%F in ("!REMOTE_BCK!") do set "BCK_FILE=%%~nxF"
)
if "%DEBUG%"=="1" (
echo [DEBUG] BCK_FILE="!BCK_FILE!"
echo [DEBUG] REMOTE_BCK="!REMOTE_BCK!"
)
:pull_selected_backup
set "LOCAL_BCK=%WORK_DIR%\%BCK_FILE%"
set "LOCAL_ZIP=%WORK_DIR%\backup.zip"
set "EXTRACT_DIR=%WORK_DIR%\backup_extracted"
echo.
echo Pulling "%REMOTE_BCK%" to "%LOCAL_BCK%" ...
"%ADB_EXE%" -s %ADB_TARGET% pull "%REMOTE_BCK%" "%LOCAL_BCK%"
if errorlevel 1 (
echo [ERROR] Failed to pull backup from Android.
pause
exit /b 1
)
if exist "%LOCAL_ZIP%" del /f /q "%LOCAL_ZIP%"
ren "%LOCAL_BCK%" "backup.zip"
if errorlevel 1 (
echo [ERROR] Failed to rename "%LOCAL_BCK%" to backup.zip.
pause
exit /b 1
)
if exist "%EXTRACT_DIR%" rmdir /s /q "%EXTRACT_DIR%"
echo Extracting backup.zip to "%EXTRACT_DIR%" ...
powershell -NoProfile -Command "Expand-Archive -LiteralPath '%LOCAL_ZIP%' -DestinationPath '%EXTRACT_DIR%' -Force"
if errorlevel 1 (
echo [ERROR] Failed to extract backup.zip.
pause
exit /b 1
)
set "DB_PATH=%EXTRACT_DIR%\nova.db"
goto :verify_db
:: -------------------------------------------------------------------------
:: Option 2: Use local nova db or novabackup or zip
:: -------------------------------------------------------------------------
:use_local_source
echo.
echo --- Local Database Selection ---
echo Enter the path to nova.db or a .novabackup or .zip file.
echo Default: "%WORK_DIR%\backup_extracted\nova.db"
echo.
:ask_local_db
set "USER_DB="
set /p "USER_DB=Path to database or backup file [Enter for default]: "
if "!USER_DB!"=="" (
set "DB_PATH=%WORK_DIR%\backup_extracted\nova.db"
) else (
set "USER_DB=!USER_DB:"=!"
for %%A in ("!USER_DB!") do set "DB_PATH=%%~fA"
)
if not exist "%DB_PATH%" (
echo [ERROR] File not found: "%DB_PATH%"
set "RETRY="
set /p "RETRY=Try again? [Y/n]: "
if /i "!RETRY!"=="n" exit /b 1
goto :ask_local_db
)
for %%E in ("%DB_PATH%") do set "EXT=%%~xE"
if /i "!EXT!"==".novabackup" goto :extract_local_archive
if /i "!EXT!"==".zip" goto :extract_local_archive
goto :verify_db
:extract_local_archive
set "EXTRACT_DIR=%WORK_DIR%\backup_extracted"
if exist "%EXTRACT_DIR%" rmdir /s /q "%EXTRACT_DIR%"
echo Extracting "%DB_PATH%" to "%EXTRACT_DIR%" ...
powershell -NoProfile -Command "Expand-Archive -LiteralPath '%DB_PATH%' -DestinationPath '%EXTRACT_DIR%' -Force"
if errorlevel 1 (
echo [ERROR] Failed to extract archive.
pause
exit /b 1
)
set "DB_PATH=%EXTRACT_DIR%\nova.db"
:: -------------------------------------------------------------------------
:: Verify database and list dock, panes, folders and other
:: -------------------------------------------------------------------------
:verify_db
if not exist "%DB_PATH%" (
echo [ERROR] nova.db not found at: "%DB_PATH%"
pause
exit /b 1
)
echo.
echo Using database: "%DB_PATH%"
echo Scanning Nova Launcher dock, panes and folders ...
echo.
set "TGT_COUNT=0"
set "LISTED_FOLDER_IDS=,"
:: 1 Dock section first as [1] dock apps plus dock folders if any
echo dock
set /a TGT_COUNT+=1
set "TGT_LABEL_!TGT_COUNT!=dock apps"
set "TGT_WHERE_!TGT_COUNT!=f.container = -101"
set "TGT_ORDER_!TGT_COUNT!=f.screen, f.cellY, f.cellX, f.rank, f._id"
echo [!TGT_COUNT!] dock apps
"%SQLITE_EXE%" -cmd ".separator |" "%DB_PATH%" "SELECT _id, CASE WHEN title IS NULL OR TRIM(title) = '' THEN '(Untitled Folder)' ELSE title END FROM favorites WHERE itemType = 2 AND container = -101 ORDER BY cellY, cellX, rank, _id;" > "%TEMP%\nova_dock_folders.txt" 2>nul
for /f "usebackq tokens=1* delims=|" %%A in ("%TEMP%\nova_dock_folders.txt") do (
set "FID=%%A"
set "FNAME=%%B"
set "FNAME=!FNAME:^M=!"
if not "!FID!"=="" (
set /a TGT_COUNT+=1
set "TGT_LABEL_!TGT_COUNT!=dock - !FNAME!"
set "TGT_WHERE_!TGT_COUNT!=f.container = !FID!"
set "TGT_ORDER_!TGT_COUNT!=f.rank, f._id"
set "LISTED_FOLDER_IDS=!LISTED_FOLDER_IDS!!FID!,"
echo [!TGT_COUNT!] !FNAME!
)
)
del "%TEMP%\nova_dock_folders.txt" >nul 2>&1
:: 2 Panes 0 to 9 with folders and loose apps
for /l %%P in (0,1,9) do (
set "SCR=%%P"
"%SQLITE_EXE%" -cmd ".separator |" "%DB_PATH%" "SELECT _id, CASE WHEN title IS NULL OR TRIM(title) = '' THEN '(Untitled Folder)' ELSE title END FROM favorites WHERE itemType = 2 AND container = -100 AND CAST(screen AS INTEGER) = !SCR! ORDER BY cellY, cellX, rank, _id;" > "%TEMP%\nova_pane_folders.txt" 2>nul
set "LOOSE_CNT=0"
"%SQLITE_EXE%" "%DB_PATH%" "SELECT COUNT(*) FROM favorites WHERE container = -100 AND CAST(screen AS INTEGER) = !SCR! AND itemType != 2;" > "%TEMP%\nova_pane_loose_cnt.txt" 2>nul
for /f "usebackq delims=" %%C in ("%TEMP%\nova_pane_loose_cnt.txt") do (
if not "%%C"=="" set "LOOSE_CNT=%%C"
)
del "%TEMP%\nova_pane_loose_cnt.txt" >nul 2>&1
set "HAS_PANE_FOLDERS=0"
for /f "usebackq tokens=1* delims=|" %%A in ("%TEMP%\nova_pane_folders.txt") do (
set "FID=%%A"
if not "!FID!"=="" set "HAS_PANE_FOLDERS=1"
)
if !HAS_PANE_FOLDERS! GTR 0 (
echo pane !SCR!
for /f "usebackq tokens=1* delims=|" %%A in ("%TEMP%\nova_pane_folders.txt") do (
set "FID=%%A"
set "FNAME=%%B"
set "FNAME=!FNAME:^M=!"
if not "!FID!"=="" (
set /a TGT_COUNT+=1
set "TGT_LABEL_!TGT_COUNT!=pane !SCR! - !FNAME!"
set "TGT_WHERE_!TGT_COUNT!=f.container = !FID!"
set "TGT_ORDER_!TGT_COUNT!=f.rank, f._id"
set "LISTED_FOLDER_IDS=!LISTED_FOLDER_IDS!!FID!,"
echo [!TGT_COUNT!] !FNAME!
)
)
if !LOOSE_CNT! GTR 0 (
set /a TGT_COUNT+=1
set "TGT_LABEL_!TGT_COUNT!=pane !SCR! loose apps"
set "TGT_WHERE_!TGT_COUNT!=f.container = -100 AND CAST(f.screen AS INTEGER) = !SCR! AND f.itemType != 2"
set "TGT_ORDER_!TGT_COUNT!=f.cellY, f.cellX, f.rank, f._id"
echo [!TGT_COUNT!] pane !SCR! loose apps
)
) else if !LOOSE_CNT! GTR 0 (
echo pane !SCR!
set /a TGT_COUNT+=1
set "TGT_LABEL_!TGT_COUNT!=pane !SCR! loose apps"
set "TGT_WHERE_!TGT_COUNT!=f.container = -100 AND CAST(f.screen AS INTEGER) = !SCR! AND f.itemType != 2"
set "TGT_ORDER_!TGT_COUNT!=f.cellY, f.cellX, f.rank, f._id"
echo [!TGT_COUNT!] pane !SCR! loose apps
)
del "%TEMP%\nova_pane_folders.txt" >nul 2>&1
)
:: 3 Other folders not already listed under dock or a pane
"%SQLITE_EXE%" -cmd ".separator |" "%DB_PATH%" "SELECT _id, CASE WHEN title IS NULL OR TRIM(title) = '' THEN '(Untitled Folder)' ELSE title END FROM favorites WHERE itemType = 2 ORDER BY LOWER(title), _id;" > "%TEMP%\nova_other_folders.txt" 2>nul
set "OTHER_HAS_FOLDERS=0"
for /f "usebackq tokens=1* delims=|" %%A in ("%TEMP%\nova_other_folders.txt") do (
set "FID=%%A"
set "FNAME=%%B"
set "FNAME=!FNAME:^M=!"
if not "!FID!"=="" (
echo !LISTED_FOLDER_IDS! | findstr /c:",!FID!," >nul
if errorlevel 1 (
if "!OTHER_HAS_FOLDERS!"=="0" (
echo other
set "OTHER_HAS_FOLDERS=1"
)
set /a TGT_COUNT+=1
set "TGT_LABEL_!TGT_COUNT!=other - !FNAME!"
set "TGT_WHERE_!TGT_COUNT!=f.container = !FID!"
set "TGT_ORDER_!TGT_COUNT!=f.rank, f._id"
echo [!TGT_COUNT!] !FNAME!
)
)
)
del "%TEMP%\nova_other_folders.txt" >nul 2>&1
echo.
set "TGT_PICK="
:: Allow q or 0 to quit cleanly without running a query
set /p "TGT_PICK=Select number [1-%TGT_COUNT%, q to quit]: "
if "%DEBUG%"=="1" echo [DEBUG] TGT_PICK="!TGT_PICK!"
if /i "!TGT_PICK!"=="q" goto :check_missing_3p
if "!TGT_PICK!"=="0" goto :check_missing_3p
set "SELECTED_LABEL="
set "SQL_WHERE="
set "SQL_ORDER="
for /l %%N in (1,1,%TGT_COUNT%) do (
if "!TGT_PICK!"=="%%N" (
set "SELECTED_LABEL=!TGT_LABEL_%%N!"
set "SQL_WHERE=!TGT_WHERE_%%N!"
set "SQL_ORDER=!TGT_ORDER_%%N!"
)
)
if "%DEBUG%"=="1" (
echo [DEBUG] SELECTED_LABEL="!SELECTED_LABEL!"
echo [DEBUG] SQL_WHERE="!SQL_WHERE!"
echo [DEBUG] SQL_ORDER="!SQL_ORDER!"
)
if "!SQL_WHERE!"=="" (
echo [ERROR] Invalid selection: "!TGT_PICK!"
pause
exit /b 1
)
:run_query
if "%DEBUG%"=="1" echo [DEBUG] Entering :run_query
:: Write label sanitizer ps1 to %TEMP% so cmd never parses regex characters
set "PS_SANITIZE=%TEMP%\adbfolder_sanitize.ps1"
set "SAFE_NAME_FILE=%TEMP%\adbfolder_safename.txt"
> "%PS_SANITIZE%" echo $raw = $env:SELECTED_LABEL
>> "%PS_SANITIZE%" echo $s = [regex]::Replace($raw, '[\\/:*?"<>|() ]+', '_')
>> "%PS_SANITIZE%" echo $s = $s.Trim('_')
>> "%PS_SANITIZE%" echo if ([string]::IsNullOrWhiteSpace($s)) { $s = "nova_target" }
>> "%PS_SANITIZE%" echo [System.IO.File]::WriteAllText($env:SAFE_NAME_FILE, $s, (New-Object System.Text.UTF8Encoding($false)))
if "%DEBUG%"=="1" (
echo [DEBUG] Wrote "%PS_SANITIZE%"
echo [DEBUG] Running sanitizer PowerShell script...
)
powershell -NoProfile -ExecutionPolicy Bypass -File "%PS_SANITIZE%"
if "%DEBUG%"=="1" echo [DEBUG] Sanitizer exit errorlevel=!errorlevel!
set "SAFE_NAME="
if exist "%SAFE_NAME_FILE%" (
for /f "usebackq delims=" %%S in ("%SAFE_NAME_FILE%") do set "SAFE_NAME=%%S"
)
if "!SAFE_NAME!"=="" set "SAFE_NAME=nova_target"
del "%PS_SANITIZE%" >nul 2>&1
del "%SAFE_NAME_FILE%" >nul 2>&1
if "%DEBUG%"=="1" echo [DEBUG] SAFE_NAME="!SAFE_NAME!"
set "RAW_OUT=%WORK_DIR%\output.txt"
set "CLEAN_OUT=%WORK_DIR%\%SAFE_NAME%_apps.txt"
if "%DEBUG%"=="1" (
echo [DEBUG] RAW_OUT="%RAW_OUT%"
echo [DEBUG] CLEAN_OUT="%CLEAN_OUT%"
)
echo.
echo Querying "!SELECTED_LABEL!" ...
"%SQLITE_EXE%" -header -cmd ".mode tabs" "%DB_PATH%" "SELECT f._id AS item_id, f.title AS app_title, CASE WHEN f.iconPackage IS NOT NULL AND f.iconPackage != '' THEN f.iconPackage WHEN INSTR(f.intent, 'component=') > 0 THEN SUBSTR(SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10), 1, INSTR(SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10), '/') - 1) ELSE '' END AS package_name, f.intent FROM favorites f WHERE %SQL_WHERE% ORDER BY %SQL_ORDER%;" > "%RAW_OUT%"
if "%DEBUG%"=="1" (
echo [DEBUG] sqlite3 query exit errorlevel=!errorlevel!
echo [DEBUG] Raw %RAW_OUT% line count:
find /c /v "" "%RAW_OUT%" 2>nul
)
if errorlevel 1 (
echo [ERROR] SQLite query failed.
pause
exit /b 1
)
:: Write column formatter ps1 to %TEMP% and execute with -File package_name first, app_title second
set "PS_FORMAT=%TEMP%\adbfolder_format.ps1"
> "%PS_FORMAT%" echo $rawFile = $env:RAW_OUT
>> "%PS_FORMAT%" echo $cleanFile = $env:CLEAN_OUT
>> "%PS_FORMAT%" echo $rows = Import-Csv -LiteralPath $rawFile -Delimiter "`t"
>> "%PS_FORMAT%" echo $lines = $rows ^| Select-Object package_name, app_title ^| Format-Table -AutoSize ^| Out-String -Width 4096
>> "%PS_FORMAT%" echo $clean = ($lines -split "`r?`n" ^| ForEach-Object { $_.TrimEnd() } ^| Where-Object { $_ -ne '' }) -join "`r`n"
>> "%PS_FORMAT%" echo [System.IO.File]::WriteAllText($cleanFile, $clean + "`r`n", (New-Object System.Text.UTF8Encoding($false)))
if "%DEBUG%"=="1" echo [DEBUG] Running formatter PowerShell script "%PS_FORMAT%"...
powershell -NoProfile -ExecutionPolicy Bypass -File "%PS_FORMAT%"
if "%DEBUG%"=="1" echo [DEBUG] PowerShell formatter exit errorlevel=!errorlevel!
del "%PS_FORMAT%" >nul 2>&1
if errorlevel 1 (
echo [ERROR] Failed to format output columns.
pause
exit /b 1
)
echo.
echo --- Result (%CLEAN_OUT%) ---
echo.
type "%CLEAN_OUT%"
echo.
echo Raw tab-delimited output saved to: "%RAW_OUT%"
echo Filtered app list saved to: "%CLEAN_OUT%"
echo.
:: Loop back to menu so user can export another folder or pane
set "LOOP_MORE="
set /p "LOOP_MORE=Export another folder or pane? [y/N]: "
if /i "!LOOP_MORE!"=="y" goto :verify_db
:: -------------------------------------------------------------------------
:: End-of-run check for third-party packages (-3) missing from nova.db
:: -------------------------------------------------------------------------
:check_missing_3p
echo.
set "CHECK_3P="
set /p "CHECK_3P=Check user apps (-3) with no icon in Nova before quitting? [y/N]: "
if /i not "!CHECK_3P!"=="y" goto :quit_script
if "%DEBUG%"=="1" (
echo [DEBUG] Entering :check_missing_3p
echo [DEBUG] ADB_EXE="%ADB_EXE%"
echo [DEBUG] SQLITE_EXE="%SQLITE_EXE%"
echo [DEBUG] DB_PATH="%DB_PATH%"
echo [DEBUG] ADB_TARGET="%ADB_TARGET%"
)
if not exist "%ADB_EXE%" (
echo [INFO] adb.exe not found at "%ADB_EXE%"; skipping device package check.
goto :quit_script
)
set "RUN_ADB_TARGET=%ADB_TARGET%"
if "!RUN_ADB_TARGET!"=="" (
for /f "skip=1 tokens=1" %%g in ('"%ADB_EXE%" devices') do (
if not "%%g"=="" (
if "!RUN_ADB_TARGET!"=="" set "RUN_ADB_TARGET=%%g"
)
)
)
if "%DEBUG%"=="1" echo [DEBUG] RUN_ADB_TARGET="!RUN_ADB_TARGET!"
if "!RUN_ADB_TARGET!"=="" (
echo [INFO] No connected ADB device found; skipping device package check.
goto :quit_script
)
if not exist "%DB_PATH%" (
echo [INFO] Nova database not available at "%DB_PATH%"; skipping device package check.
goto :quit_script
)
set "RESOLVE_LABELS="
set /p "RESOLVE_LABELS=Resolve app titles via adb/aapt (slower over Wi-Fi)? [y/N]: "
set "DO_RESOLVE_LABELS=0"
if /i "!RESOLVE_LABELS!"=="y" set "DO_RESOLVE_LABELS=1"
if "%DEBUG%"=="1" echo [DEBUG] DO_RESOLVE_LABELS="!DO_RESOLVE_LABELS!"
set "PM_3P_FILE=%TEMP%\adbfolder_pm3.txt"
set "NOVA_PKGS_FILE=%TEMP%\adbfolder_nova_pkgs.txt"
set "UNPLACED_OUT=%WORK_DIR%\unplaced_user_apps.txt"
set "PS_DIFF_3P=%TEMP%\adbfolder_diff_3p.ps1"
:: v3p2: Write SQL to a temp .sql file so cmd does not parse SQL operators/quotes
set "SQL_NOVA_PKGS=%TEMP%\adbfolder_nova_pkgs.sql"
if "%DEBUG%"=="1" (
echo [DEBUG] PM_3P_FILE="!PM_3P_FILE!"
echo [DEBUG] NOVA_PKGS_FILE="!NOVA_PKGS_FILE!"
echo [DEBUG] UNPLACED_OUT="!UNPLACED_OUT!"
echo [DEBUG] PS_DIFF_3P="!PS_DIFF_3P!"
echo [DEBUG] SQL_NOVA_PKGS="!SQL_NOVA_PKGS!"
)
echo Querying third-party packages from device !RUN_ADB_TARGET! ...
if "%DEBUG%"=="1" echo [DEBUG] Running adb pm list packages -3...
"%ADB_EXE%" -s !RUN_ADB_TARGET! shell pm list packages -3 2>nul > "!PM_3P_FILE!"
if "%DEBUG%"=="1" (
echo [DEBUG] adb pm exit errorlevel=!errorlevel!
echo [DEBUG] PM_3P_FILE line count:
find /c /v "" "!PM_3P_FILE!" 2>nul
)
echo Querying packages referenced anywhere in nova.db ...
if "%DEBUG%"=="1" echo [DEBUG] Writing and running sqlite3 Nova package query from .sql file...
:: v3p3: Use LENGTH/TRIM checks instead of != so delayed expansion cannot drop negation
> "!SQL_NOVA_PKGS!" echo SELECT DISTINCT package_name
>> "!SQL_NOVA_PKGS!" echo FROM (
>> "!SQL_NOVA_PKGS!" echo SELECT CASE
>> "!SQL_NOVA_PKGS!" echo WHEN iconPackage IS NOT NULL AND LENGTH(TRIM(iconPackage^)^) ^> 0 THEN TRIM(iconPackage^)
>> "!SQL_NOVA_PKGS!" echo WHEN INSTR(intent, 'component='^) ^> 0 THEN
>> "!SQL_NOVA_PKGS!" echo CASE
>> "!SQL_NOVA_PKGS!" echo WHEN INSTR(SUBSTR(intent, INSTR(intent, 'component='^) + 10^), '/'^) ^> 0 THEN SUBSTR(
>> "!SQL_NOVA_PKGS!" echo SUBSTR(intent, INSTR(intent, 'component='^) + 10^),
>> "!SQL_NOVA_PKGS!" echo 1,
>> "!SQL_NOVA_PKGS!" echo INSTR(SUBSTR(intent, INSTR(intent, 'component='^) + 10^), '/'^) - 1
>> "!SQL_NOVA_PKGS!" echo ^)
>> "!SQL_NOVA_PKGS!" echo ELSE SUBSTR(intent, INSTR(intent, 'component='^) + 10^)
>> "!SQL_NOVA_PKGS!" echo END
>> "!SQL_NOVA_PKGS!" echo ELSE ''
>> "!SQL_NOVA_PKGS!" echo END AS package_name
>> "!SQL_NOVA_PKGS!" echo FROM favorites
>> "!SQL_NOVA_PKGS!" echo )
>> "!SQL_NOVA_PKGS!" echo WHERE LENGTH(package_name^) ^> 0;
"%SQLITE_EXE%" "%DB_PATH%" < "!SQL_NOVA_PKGS!" > "!NOVA_PKGS_FILE!"
if "%DEBUG%"=="1" (
echo [DEBUG] sqlite3 Nova pkgs exit errorlevel=!errorlevel!
echo [DEBUG] NOVA_PKGS_FILE line count:
find /c /v "" "!NOVA_PKGS_FILE!" 2>nul
echo [DEBUG] Writing PS_DIFF_3P script...
)
:: v3p2: Write PS_DIFF_3P line-by-line instead of an outer parenthesized block
:: v3p4: Resolve app labels for unplaced packages via adb dumpsys and aapt/aapt2 if available
:: v3p5: Remove stray caret escaping before ')' on standalone echo lines
:: v3p6: Prompt whether to resolve app titles and print periodic progress during lookup
if exist "!PS_DIFF_3P!" del /f /q "!PS_DIFF_3P!" >nul 2>&1
>> "!PS_DIFF_3P!" echo $adbExe = $env:ADB_EXE
>> "!PS_DIFF_3P!" echo $adbTarget = $env:RUN_ADB_TARGET
>> "!PS_DIFF_3P!" echo $resolveLabels = ($env:DO_RESOLVE_LABELS -eq '1')
>> "!PS_DIFF_3P!" echo $pm3Lines = Get-Content -LiteralPath $env:PM_3P_FILE -ErrorAction SilentlyContinue
>> "!PS_DIFF_3P!" echo $installed3 = [System.Collections.Generic.HashSet[string]]::new([System.StringComparer]::OrdinalIgnoreCase)
>> "!PS_DIFF_3P!" echo foreach ($line in $pm3Lines) {
>> "!PS_DIFF_3P!" echo $p = ($line -replace '\r', '').Trim()
>> "!PS_DIFF_3P!" echo if ($p.StartsWith('package:')) { $p = $p.Substring(8).Trim() }
>> "!PS_DIFF_3P!" echo if (-not [string]::IsNullOrWhiteSpace($p)) { [void]$installed3.Add($p) }
>> "!PS_DIFF_3P!" echo }
>> "!PS_DIFF_3P!" echo $novaLines = Get-Content -LiteralPath $env:NOVA_PKGS_FILE -ErrorAction SilentlyContinue
>> "!PS_DIFF_3P!" echo $inNova = [System.Collections.Generic.HashSet[string]]::new([System.StringComparer]::OrdinalIgnoreCase)
>> "!PS_DIFF_3P!" echo foreach ($n in $novaLines) {
>> "!PS_DIFF_3P!" echo $pkg = ($n -replace '\r', '').Trim()
>> "!PS_DIFF_3P!" echo if (-not [string]::IsNullOrWhiteSpace($pkg)) { [void]$inNova.Add($pkg) }
>> "!PS_DIFF_3P!" echo }
>> "!PS_DIFF_3P!" echo $missingList = [System.Collections.Generic.List[string]]::new()
>> "!PS_DIFF_3P!" echo foreach ($pkg in $installed3) {
>> "!PS_DIFF_3P!" echo if (-not $inNova.Contains($pkg)) { [void]$missingList.Add($pkg) }
>> "!PS_DIFF_3P!" echo }
>> "!PS_DIFF_3P!" echo $missing = @($missingList.ToArray())
>> "!PS_DIFF_3P!" echo [System.Array]::Sort($missing, [System.StringComparer]::OrdinalIgnoreCase)
>> "!PS_DIFF_3P!" echo $aaptCmd = if ($resolveLabels) { Get-Command aapt -ErrorAction SilentlyContinue } else { $null }
>> "!PS_DIFF_3P!" echo $idx = 0
>> "!PS_DIFF_3P!" echo $results = foreach ($pkg in $missing) {
>> "!PS_DIFF_3P!" echo $idx++
>> "!PS_DIFF_3P!" echo $label = ''
>> "!PS_DIFF_3P!" echo if ($resolveLabels) {
>> "!PS_DIFF_3P!" echo if (($idx %% 10) -eq 1 -or $idx -eq $missing.Count) {
>> "!PS_DIFF_3P!" echo Write-Host ("Resolving titles: {0}/{1} ({2})..." -f $idx, $missing.Count, $pkg)
>> "!PS_DIFF_3P!" echo }
>> "!PS_DIFF_3P!" echo $dumpLines = ^& $adbExe -s $adbTarget shell dumpsys package $pkg 2^>$null
>> "!PS_DIFF_3P!" echo foreach ($dl in $dumpLines) {
>> "!PS_DIFF_3P!" echo if ($dl -match 'nonLocalizedLabel="([^"]+)"') { $label = $Matches[1].Trim() }
>> "!PS_DIFF_3P!" echo }
>> "!PS_DIFF_3P!" echo if ([string]::IsNullOrWhiteSpace($label) -and $aaptCmd) {
>> "!PS_DIFF_3P!" echo $apkPathLine = (^& $adbExe -s $adbTarget shell pm path $pkg 2^>$null ^| Select-Object -First 1)
>> "!PS_DIFF_3P!" echo if ($apkPathLine -and $apkPathLine.Trim().StartsWith('package:')) {
>> "!PS_DIFF_3P!" echo $apkRemote = $apkPathLine.Trim().Substring(8).Trim()
>> "!PS_DIFF_3P!" echo $apkLocal = Join-Path $env:TEMP "adbfolder_probe.apk"
>> "!PS_DIFF_3P!" echo ^& $adbExe -s $adbTarget pull $apkRemote $apkLocal ^>$null 2^>^&1
>> "!PS_DIFF_3P!" echo if (Test-Path -LiteralPath $apkLocal) {
>> "!PS_DIFF_3P!" echo $badging = ^& $aaptCmd.Source dump badging $apkLocal 2^>$null
>> "!PS_DIFF_3P!" echo foreach ($bl in $badging) {
>> "!PS_DIFF_3P!" echo if ($bl -match "^application-label:'([^']+)'") { $label = $Matches[1].Trim(); break }
>> "!PS_DIFF_3P!" echo }
>> "!PS_DIFF_3P!" echo Remove-Item -LiteralPath $apkLocal -Force -ErrorAction SilentlyContinue
>> "!PS_DIFF_3P!" echo }
>> "!PS_DIFF_3P!" echo }
>> "!PS_DIFF_3P!" echo }
>> "!PS_DIFF_3P!" echo }
>> "!PS_DIFF_3P!" echo [PSCustomObject]@{ package_name = $pkg; app_title = $label }
>> "!PS_DIFF_3P!" echo }
>> "!PS_DIFF_3P!" echo $tableText = if (@($results).Count -gt 0) {
>> "!PS_DIFF_3P!" echo ((@($results) ^| Format-Table -AutoSize ^| Out-String -Width 4096) -split "`r?`n" ^| ForEach-Object { $_.TrimEnd() } ^| Where-Object { $_ -ne '' }) -join "`r`n" + "`r`n"
>> "!PS_DIFF_3P!" echo } else { "" }
>> "!PS_DIFF_3P!" echo [System.IO.File]::WriteAllText($env:UNPLACED_OUT, $tableText, (New-Object System.Text.UTF8Encoding($false)))
>> "!PS_DIFF_3P!" echo Write-Host ("User packages (-3): {0} | In Nova layout: {1} | No icon in Nova: {2}" -f $installed3.Count, $inNova.Count, $missing.Count)
>> "!PS_DIFF_3P!" echo if (@($results).Count -gt 0) { Write-Host ""; Write-Output $tableText.TrimEnd() }
if "%DEBUG%"=="1" (
echo [DEBUG] PS_DIFF_3P write exit errorlevel=!errorlevel!
echo [DEBUG] Generated PS_DIFF_3P contents:
type "!PS_DIFF_3P!" 2>nul
echo [DEBUG] Executing PS_DIFF_3P...
)
powershell -NoProfile -ExecutionPolicy Bypass -File "!PS_DIFF_3P!"
if "%DEBUG%"=="1" echo [DEBUG] PS_DIFF_3P execution exit errorlevel=!errorlevel!
echo Saved unplaced user app list to: "!UNPLACED_OUT!"
echo.
if not "%DEBUG%"=="1" (
del "!PM_3P_FILE!" >nul 2>&1
del "!NOVA_PKGS_FILE!" >nul 2>&1
del "!PS_DIFF_3P!" >nul 2>&1
del "!SQL_NOVA_PKGS!" >nul 2>&1
) else (
echo [DEBUG] Keeping temp files because DEBUG=1:
echo [DEBUG] "!PM_3P_FILE!"
echo [DEBUG] "!NOVA_PKGS_FILE!"
echo [DEBUG] "!PS_DIFF_3P!"
echo [DEBUG] "!SQL_NOVA_PKGS!"
)
:quit_script
pause
exit /b 0
:: -------------------------------------------------------------------------
:: end of adbfolder.bat
:: -------------------------------------------------------------------------
--
Helpful suggestions from people are why Usenet still remains invaluable.
Re: Can we programmatically get package names of icons in a homescreen folder?
Author: Maria Sophia
Date: Fri, 20 Nov 2026 09:25
Date: Fri, 20 Nov 2026 09:25
550 lines
18323 bytes
18323 bytes
Found a bug in how the script parsed the SQL for app icons outside of folders and since it's getting late, I skipped commenting some revs. This works now, even for apps that are sitting on the homescreen pane (i.e., bare app icons that are not inside a folder). dir adbfolder* 11/20/2026 05:18 AM 38,215 adbfolder.bat 11/19/2026 10:59 PM 8,392 adbfolder.bat_v1p0.txt 11/19/2026 11:17 PM 10,960 adbfolder.bat_v1p1.txt 11/19/2026 11:20 PM 11,324 adbfolder.bat_v1p2.txt 11/19/2026 11:23 PM 12,712 adbfolder.bat_v1p3.txt 11/19/2026 11:48 PM 13,732 adbfolder.bat_v1p4.txt 11/19/2026 11:52 PM 15,500 adbfolder.bat_v1p5.txt 11/19/2026 11:56 PM 15,646 adbfolder.bat_v1p6.txt 11/20/2026 12:08 AM 17,612 adbfolder.bat_v1p7.txt 11/20/2026 12:13 AM 20,506 adbfolder.bat_v1p8.txt 11/20/2026 12:24 AM 21,847 adbfolder.bat_v1p9.txt 11/20/2026 12:27 AM 21,976 adbfolder.bat_v2p0.txt 11/20/2026 12:31 AM 22,565 adbfolder.bat_v2p1.txt 11/20/2026 12:39 AM 25,095 adbfolder.bat_v2p2.txt 11/20/2026 12:49 AM 19,915 adbfolder.bat_v2p3.txt 11/20/2026 01:07 AM 22,339 adbfolder.bat_v2p4.txt 11/20/2026 01:12 AM 22,539 adbfolder.bat_v2p5.txt 11/20/2026 01:16 AM 22,615 adbfolder.bat_v2p6.txt 11/20/2026 01:25 AM 22,315 adbfolder.bat_v2p7.txt 11/20/2026 01:26 AM 22,811 adbfolder.bat_v2p8.txt 11/20/2026 01:53 AM 26,974 adbfolder.bat_v2p9.txt 11/20/2026 02:10 AM 27,537 adbfolder.bat_v3p0.txt 11/20/2026 02:13 AM 28,815 adbfolder.bat_v3p1.txt 11/20/2026 02:16 AM 30,225 adbfolder.bat_v3p2.txt 11/20/2026 02:23 AM 30,856 adbfolder.bat_v3p3.txt 11/20/2026 02:26 AM 33,435 adbfolder.bat_v3p4.txt 11/20/2026 02:29 AM 33,541 adbfolder.bat_v3p5.txt 11/20/2026 02:41 AM 34,672 adbfolder.bat_v3p6.txt 11/20/2026 03:02 AM 35,318 adbfolder.bat_v3p7.txt 11/20/2026 03:09 AM 36,169 adbfolder.bat_v3p8.txt 11/20/2026 03:13 AM 30,020 adbfolder.bat_v3p9.txt 11/20/2026 03:27 AM 35,595 adbfolder.bat_v4p0.txt 11/20/2026 03:38 AM 36,131 adbfolder.bat_v4p1.txt 11/20/2026 03:42 AM 36,028 adbfolder.bat_v4p2.txt 11/20/2026 03:55 AM 36,312 adbfolder.bat_v4p3.txt 11/20/2026 04:00 AM 36,316 adbfolder.bat_v4p4.txt 11/20/2026 04:10 AM 37,178 adbfolder.bat_v4p5.txt 11/20/2026 04:10 AM 30,190 adbfolder.bat_v4p6.txt 11/20/2026 04:39 AM 31,783 adbfolder.bat_v4p7.txt 11/20/2026 04:51 AM 31,923 adbfolder.bat_v4p8.txt 11/20/2026 04:53 AM 30,991 adbfolder.bat_v4p9.txt 11/20/2026 04:57 AM 31,593 adbfolder.bat_v5p0.txt 11/20/2026 05:00 AM 31,144 adbfolder.bat_v5p1.txt 11/20/2026 05:04 AM 31,064 adbfolder.bat_v5p2.txt 11/20/2026 05:18 AM 38,215 adbfolder.bat_v5p3.txt Don't even get me started on why there are blank lines between the output from PowerShell below, as that alone was horrific. C:\app\editor\android\scrcpy> adbfolder.bat Checking required tools (adb and sqlite3) ... Working directory: "C:\app\editor\android\scrcpy" Nova work directory: "C:\app\editor\android\scrcpy\nova" ---------------- Select source for Nova Launcher database: [1] Pull .novabackup from Android via ADB and extract nova.db [Default] [2] Use an existing nova.db or .novabackup or .zip already on Windows Enter choice [1 or 2]: 1 --- Pull Nova Backup from Android --- Targeting device: 192.168.1.4:5555 Listing backups in /storage/emulated/0/0000/bck/nova_backup ... [1] 2026-11-20_00-43.novabackup [2] 2026-11-20_00-28.novabackup [3] 2026-11-19_12-57.novabackup [4] 2026-08-19_21-51.novabackup [5] 2026-08-19_11-31.novabackup [6] 2026-08-16_11-36.novabackup Select backup number [1-6, Default: 1]: 1 Pulling "/storage/emulated/0/0000/bck/nova_backup/2026-11-20_00-43.novabackup" to "C:\app\editor\android\scrcpy\nova\2026-11-20_00-43.novabackup" ... /storage/emulated/0/0000/bck/nova_backup/2026-... 0 skipped. 3.7 MB/s (6564766 bytes in 1.670s) Extracting backup.zip to "C:\app\editor\android\scrcpy\nova\backup_extracted" ... Using database: "C:\app\editor\android\scrcpy\nova\backup_extracted\nova.db" Scanning Nova Launcher dock, panes and folders ... dock [1] dock apps [2] shortcuts pane 0 [3] toon [4] track [5] shortcut [6] spoof [7] Remote [8] TTS [9] webcam [10] todo [11] automate [12] obd [13] stuff [14] sos [15] Clock [16] backgnd [17] converter [18] privacy [19] SvcMode [20] epub [21] PlantID [22] hike [23] motion [24] (Untitled Folder) [25] pane 0 loose apps pane 1 [26] time [27] comms [28] buy [29] files [30] net [31] web [32] weather [33] nature [34] auto [35] pic [36] audio [37] vid [38] todo [39] sensor [40] apk [41] sys Select number [1-41, q to quit]: 29 Querying "pane 1 - files" ... --- Result (C:\app\editor\android\scrcpy\nova\pane_1_-_files_apps.txt) --- package_name app_title ------------ --------- com.folderv.file FV File Explorer ru.zdevs.zarchiver ZArchiver com.mixplorer MiX de.felixnuesse.extract Round Sync com.ghostsq.commander Ghost Commander com.simplemobiletools.filemanager.pro smtFile Manager pl.mkexplorer.kormateusz MK Explorer nextapp.fx FX com.amaze.filemanager Amaze com.amaze.fileutilities Amaze Utilities com.lonelycatgames.Xplore X-plore org.openintents.filemanager OI File Manager me.zhanghai.android.files Material Files com.skyjos.apps.fileexplorerfree Owlfiles com.cxinventor.file.explorer Cx File Explorer com.ghisler.android.TotalCommander Total Commander com.sec.android.app.myfiles My Files net.micode.fileexplorer File Explorer com.speedsoftware.explorer Explorer com.marc.files Files.marc com.dnielfe.manager Simple Explorer com.google.android.apps.nbu.files Files.nbu pl.solidexplorer2 Solid Explorer com.veniosg.dir Dir com.sovworks.edslite EDS Lite com.blackspruce.lpd LPD com.blackspruce.mupdf LPP keepass2android.keepass2android Keepass2Android com.owncloud.android ownCloud com.simplemobiletools.draw.pro smtDraw org.secuso.privacyfriendlysketching Sketches com.samsung.android.app.notes Samsung Notes com.microsoft.office.officehubrow Office com.nutomic.syncthingandroid Syncthing com.atr.tedit TEdit com.theolivetree.webdavserver WebDAV server org.korosoft.simplenotepad.android Notepad info.informationsea.apps.largetext Large Text com.google.android.diskusage DiskUsage ru.androidtools.texteditor Text Editor dev.leonlatsch.photok Photok com.google.android.diskusage DiskUsage me.kuder.diskinfo DiskInfo sa.storagetruth Storage Truth eu.thedarken.sdm SD Maid com.tengu.sharetoclipboard Share to Clipboard com.gsnathan.pdfviewer Pdf Viewer Plus com.artifex.mupdf.viewer.app MuPDF viewer com.gmail.anubhavdas54.whatsdeleted WhatsDeleted com.juthawong.android.mimechecker Ampare MIME Checker com.koushikdutta.backup Helium com.riteshsahu.SMSBackupRestore SMS Backup & Restore com.resilio.sync Sync com.bv.wifisync SyncMe com.genonbeta.TrebleShot TrebleShot com.tachibana.downloader Download Navi com.cgogolin.penandpdf Pen&PDF com.pspdfkit.viewer PDF Viewer com.avrapps.pdfviewer PDF Viewer Lite io.github.droidapps.pdfreader PDF Reader org.ninthfloor.copperpdf CuprumPDF swati4star.createpdf PDF Converter com.xodo.pdf.reader Xodo com.foxit.mobile.pdf.lite Foxit PDF com.kmo.pdf.converter PDF Converter com.reneph.passwordsafe Password Safe com.sec.android.easyMover Smart Switch org.mightyfrog.android.simplenotepad Simple Notepad keepass2android.keepass2android Keepass2Android com.orgzly Orgzly org.dmfs.tasks Tasks com.simplemobiletools.keyboard Keyboard com.simplemobiletools.notes.pro Notes org.coolreader Cool Reader com.isaiasmatewos.texpand Texpand com.checkboxtasksapp.android Checkbox com.runitrut.dailytodoapp Daily todo app com.ctoad.android.DoBe2 DoBeList com.Naina.Inc.getDone Get-done com.mayaal.todo My ToDo rakta.tech.todotasklist.doitnow To Do task List - Do it Now ch.martinstoeckli.silentnotes SilentNotes com.ghisler.tcplugins.LAN TotalCmd-LAN (Windows shares) com.syndoc.merlin Syndoc com.nutomic.syncthingandroid Syncthing com.legalimpurity.rsync Rsync org.amoradi.syncopoli Syncopoli com.droidvim DroidVim com.fiistudio.fiinote FiiNote net.gsantner.markor Markor sushi.hardcore.droidfs DroidFS dk.tacit.android.foldersync.lite FolderSync com.rk.xededitor Xed-Editor org.koreader.launcher KOReader Raw tab-delimited output saved to: "C:\app\editor\android\scrcpy\nova\output.txt" Formatted app list saved to: "C:\app\editor\android\scrcpy\nova\pane_1_-_files_apps.txt" Export another folder or pane? [y/N]: y Using database: "C:\app\editor\android\scrcpy\nova\backup_extracted\nova.db" Scanning Nova Launcher dock, panes and folders ... dock [1] dock apps [2] shortcuts pane 0 [3] toon [4] track [5] shortcut [6] spoof [7] Remote [8] TTS [9] webcam [10] todo [11] automate [12] obd [13] stuff [14] sos [15] Clock [16] backgnd [17] converter [18] privacy [19] SvcMode [20] epub [21] PlantID [22] hike [23] motion [24] (Untitled Folder) [25] pane 0 loose apps pane 1 [26] time [27] comms [28] buy [29] files [30] net [31] web [32] weather [33] nature [34] auto [35] pic [36] audio [37] vid [38] todo [39] sensor [40] apk [41] sys Select number [1-41, q to quit]: 32 Querying "pane 1 - weather" ... --- Result (C:\app\editor\android\scrcpy\nova\pane_1_-_weather_apps.txt) --- package_name app_title ------------ --------- com.accuweather.android AccuWeather co.windyapp.android Windy.app aerow.us.aerowind AeroWind com.airvisual AirVisual org.asdtm.goodweather Good Weather com.macca895.sunriise Hey Sunrise com.lholman.hiweather hiweather com.neverads.just_weather just weather org.androworks.klara Klara uk.co.openweather OpenWeather org.woheller69.weather RadarWeather com.yoshi.rain Rain org.breezyweather Weather wangdaye.com.geometricweather Weather com.alexplas.weathernew Weather info.vazquezsoftware.weatheralarms Weather Alerts com.la.local.weather.forecast.app Weather Forecast com.windhub.marine.weather WindHub com.windyty.android Windy no.nrk.yr Yr Raw tab-delimited output saved to: "C:\app\editor\android\scrcpy\nova\output.txt" Formatted app list saved to: "C:\app\editor\android\scrcpy\nova\pane_1_-_weather_apps.txt" Export another folder or pane? [y/N]: y Using database: "C:\app\editor\android\scrcpy\nova\backup_extracted\nova.db" Scanning Nova Launcher dock, panes and folders ... dock [1] dock apps [2] shortcuts pane 0 [3] toon [4] track [5] shortcut [6] spoof [7] Remote [8] TTS [9] webcam [10] todo [11] automate [12] obd [13] stuff [14] sos [15] Clock [16] backgnd [17] converter [18] privacy [19] SvcMode [20] epub [21] PlantID [22] hike [23] motion [24] (Untitled Folder) [25] pane 0 loose apps pane 1 [26] time [27] comms [28] buy [29] files [30] net [31] web [32] weather [33] nature [34] auto [35] pic [36] audio [37] vid [38] todo [39] sensor [40] apk [41] sys Select number [1-41, q to quit]: 25 Querying "pane 0 loose apps" ... --- Result (C:\app\editor\android\scrcpy\nova\pane_0_loose_apps_apps.txt) --- package_name app_title ------------ --------- com.android.settings Settings me.number.app.im 2nd Line krow.dev.scheme Intents com.beemdevelopment.aegis Aegis com.apkupdater APKUpdater com.discipleskies.aaafindmycar Find My Car org.kp.tpmg.preventivecare My Doctor Online Raw tab-delimited output saved to: "C:\app\editor\android\scrcpy\nova\output.txt" Formatted app list saved to: "C:\app\editor\android\scrcpy\nova\pane_0_loose_apps_apps.txt" Export another folder or pane? [y/N]: n Check user apps -3 with no icon in Nova before quitting? [y/N]: y Resolve app titles via adb/aapt slower over Wi-Fi? [y/N]: n Querying third-party packages from device 192.168.1.4:5555 ... Querying packages referenced anywhere in nova.db ... User packages (-3): 635 | In Nova layout: 856 | No icon in Nova: 65 package_name app_title ------------ --------- ai.articlereader.mobileapp app.fluffy asav.roomtemperature.us aws.apps.usbDeviceEnumerator com.alextern.shortcutexecutors com.alpaca.android.readout com.aor.droidedit com.blogspot.aeioulabs.barcode com.brunopiovan.avozdazueira com.cliffweitzman.speechify2 com.cloudedge.smarteye com.codespaceapps.listeningapp com.cybercat.acbridge com.elishaazaria.sayboard com.ghisler.tcplugins.WebDAV com.ghostsq.commander.https com.goodwy.contacts com.google.android.apps.wallpaper com.heyflutter.hello_world com.hyperionics.avar com.i45.launchdialer com.ifeanyi.read com.intsig.cspdf com.jecelyin.editor.v2 com.juanvision.eseecloud30 com.kunzisoft.keepass.libre com.maskyn.fileeditor com.microsoft.copilot com.mixplorer.beta com.mobilityware.solitaire com.netvor.settings.database.provider com.pilot51.voicenotify com.rsupport.rs.activity.rsupport.aas2 com.sand.remotesupportaddon com.sblabs.vinechart com.simpol.permissionssummary com.stcodesapp.text2speech com.teamviewer.quicksupport.addon.universal com.trianguloy.urlchecker com.wilysis.cellinfolite dev.patrickgold.florisboard fr.smarquis.applinks io.elevenlabs.readerapp io.github.samolego.canta io.simplicity.trainspotting me.easyapps.easynotes micro.repl.ma7moud3ly name.lmj001.savetodevice net.programmierecke.radiodroid2 org.aospstudio.files org.bromite.webview org.cryptomator org.fossify.calendar org.fossify.contacts org.fossify.filemanager org.fossify.gallery org.fossify.messages org.fossify.phone org.lsposed.lspatch org.openusenet.reader org.schabi.newpipe.debug org.woheller69.whisper qrcodegenerator.qrcreator.qrmaker.createqrcode rb.camere za.kilowatch.ultimatefilemanager Saved unplaced user app list to: "C:\app\editor\android\scrcpy\nova\unplaced_user_apps.txt" Press any key to continue . . . C:\app\editor\android\scrcpy>
Re: Can we programmatically get package names of icons in a homescreen folder?
Author: Maria Sophia
Date: Fri, 20 Nov 2026 09:39
Date: Fri, 20 Nov 2026 09:39
67 lines
5661 bytes
5661 bytes
The code that output the previous output, does this in sequence...
1. Environment & Configuration Setup
A. Command environment
a. Disables command echoing and enables delayed expansion.
b. Sets the working directory to the script's path.
B. Configuration variables
a. Sets default configuration paths for ADB, SQLite, and work directories.
b. Defines the DEBUG toggle flag.
2. Dependency Verification
A. Executable checks
a. Locates adb.exe (checks system PATH or configured fallback path).
b. Locates sqlite3.exe (exits with an error if missing).
B. Directory setup
a. Creates the local working directory if it does not exist.
3. Source Selection Menu
A. Choice [1]: Pull from Android via ADB
a. Detects connected ADB device target.
b. Lists .novabackup files in the remote backup directory (with fallback search).
c. Prompts user to select or enter a backup filename/path.
d. Pulls the selected .novabackup file to the Windows workspace.
e. Renames the pulled file to backup.zip and extracts it into backup_extracted to retrieve nova.db.
B. Choice [2]: Use Local Database / Archive
a. Prompts user for a custom path to nova.db, .novabackup, or .zip (with a retry loop).
b. Validates file existence.
c. Automatically extracts archives if a .novabackup or .zip file is provided.
4. Database Verification & Target Enumeration
A. Database validation
a. Verifies that nova.db exists at the target path.
B. Section 1 (Dock)
a. Scans dock apps (container = -101).
b. Scans and lists any dock folders.
C. Section 2 (Panes 0-14)
a. Iterates through home screen panes 0 to 14 via the scan_pane subroutine.
b. Queries pane folders (itemType = 2, container = -100).
c. Checks for loose non-folder apps (itemType <> 2) on the pane.
D. Section 3 (Other Folders)
a. Searches for orphaned folders not categorized under the dock or panes.
b. Lists and registers valid other folders.
5. User Selection & Query Execution (run_query)
A. Selection & Sanity
a. Prompts user to select a target number or quit (q or 0).
b. Sanitizes the selected label using a temporary PowerShell script to generate a safe filename.
B. Query Generation & Execution
a. Writes a dynamic SQLite query script to a temp file (.sql) extracting item ID, app title, package name, and raw intent.
b. Executes the query against nova.db using sqlite3.exe.
C. Output & Formatting
a. Formats output columns (package_name first, app_title second) into an auto-sized table via PowerShell.
b. Saves raw results (output.txt) and formatted results (target_apps.txt) to the work directory.
c. Prompts user to loop back to scan another folder/pane or proceed.
6. Optional Unplaced Third-Party Package Check (check_missing_3p)
A. Pre-check Validation
a. Prompts user whether to check for user-installed packages (-3) missing from the Nova layout.
b. Verifies ADB device connectivity and database availability.
c. Optionally prompts user to resolve app labels via adb dumpsys and aapt/aapt2.
B. Data Collection
a. Queries installed third-party packages from device (pm list packages -3).
b. Queries all referenced packages inside nova.db.
C. Diff Analysis & Cleanup
a. Generates and executes a PowerShell diff script to find installed packages with no home screen icon.
b. Outputs a formatted table of unplaced apps to unplaced_user_apps.txt.
c. Cleans up temporary script and text files (unless DEBUG=1) and exits cleanly.
Re: Can we programmatically get package names of icons in a homescreen folder?
Author: Maria Sophia
Date: Fri, 20 Nov 2026 09:41
Date: Fri, 20 Nov 2026 09:41
882 lines
41345 bytes
41345 bytes
I can't count the number of times I said to myself this was
gonna be the final version, but this version is what produced
the last output, which does all those neat and fancy things.
I'll post this to the XDA Developer's Forum thread for archival.
:: -------------------------------------------------------------------------
:: adbfolder.bat
:: -------------------------------------------------------------------------
:: Extracts app package names and titles from a selected android homescreen
:: folder or pane into a text file to assist in backup/restore maintenance
::
:: Will pull a backup from android via adb or read an existing nova db or
:: nova backup archive on windows needing only adb and sql dependencies
:: -------------------------------------------------------------------------
:: v5p3 20261120 Fixed too many syntax issues to count between versions
:: Moved per-pane scanning into a :scan_pane subroutine and
:: cleaned up SQL/batch parsing in the pane loop so menu
:: scanning runs without cmd.exe syntax errors
:: v4p5 20261119 Fixed loose apps package_name extraction in :run_query
:: when component= has no slash or uses package=
:: v4p4 20261119 Replaced "filter" / "filtered" in comments with what the
:: code actually does
:: v4p3 20261119 Kept loose apps with all item types except itemType != 2 and
:: removed parentheses from comment lines across the script
:: v4p2 20261119 Removed extra iconPackage/component= check on loose apps
:: so all non-folder items itemType != 2 on a pane are
:: included without dropping rows
:: v4p1 20261119 Restricted loose apps count and query to items that have a
:: non-empty iconPackage or component= in intent while keeping
:: all existing behavior, comments, and formatting intact
:: v4p0 20261119 Gave up on trying to eliminate empty lines from PowerShell
:: in the optional orphan-packages-with-no-launch icon listing
:: so v4p0 is an exact duplicate of v3p6 which has blank lines
:: v3p9 20261119 Moved menu scanning, SQLite querying, table formatting,
:: and unplaced -3 package diffing into a dedicated PowerShell
:: engine script so cmd.exe never hits block/caret/quote errors
:: and fixed looseapps condition to itemType <> 2 and set DEBUG=0
:: v3p8 20261119 Formatted unplaced user app table directly in PS_DIFF_3P
:: instead of Format-Table to remove blank lines between rows
:: v3p7 20261119 Fixed missing package_name in :run_query by replacing !=
:: with LENGTH/TRIM checks and guarding SUBSTR against missing
:: slashes and fixed pane loose apps SQL_WHERE to f.itemType <> 2
:: v3p6 20261119 Added optional prompt before resolving app titles in
:: check_missing_3p and printed periodic progress while
:: resolving labels so quick checks finish immediately
:: v3p5 20261119 Removed stray caret escaping before closing parentheses on
:: standalone PS_DIFF_3P echo lines so PowerShell parses the
:: generated script cleanly, and kept DEBUG=1 enabled
:: v3p4 20261119 Added app label lookup via adb dumpsys and optional aapt/aapt2
:: for unplaced user apps in check_missing_3p and set DEBUG=0
:: as the default flag
:: v3p3 20261119 Replaced != with LENGTH/TRIM checks in Nova package SQL
:: query so cmd delayed expansion does not strip negation
:: and handled component= values without a slash safely
:: v3p2 20261119 Wrote Nova package SQL query to a temp .sql file to avoid
:: cmd parsing syntax errors and wrote PS_DIFF_3P line-by-line
:: instead of using an outer parenthesized block
:: v3p1 20261119 Insrumented the orphan section as it was throwing errors
:: v3p0 20261119 Fixed command syntax error when generating the PowerShell
:: diff script in check_missing_3p and wrapped the Nova
:: package query in a subquery so package_name matches cleanly
:: v2p9 20261119 Added a final sanity check before quitting to compare
:: the list of packages that have icons on the homescreen
:: against all the user-installed packages on the phone
:: to create an orphan-packages file that have no icons
:: v2p8 20261119 Added quit option at folder selection prompt and loop back
:: prompt at end to export another folder or pane
:: v2p7 20261119 Replaced fragile DISTINCT screen loop with explicit pane
:: index pass 0 to 9 using CAST screen AS INTEGER so panes
:: with folders or loose apps always appear in order
:: v2p6 20261119 Fixed pane screen query so folders on pane 0, pane 1 and
:: pane 2 display properly along with loose pane apps and other
:: v2p5 20261119 Grouped folders by screen number across panes and kept
:: unmatched folders under other at the bottom
:: v2p4 20261119 Added loose apps choice at the end of each pane with
:: non-folder items and kept other catch-all at the bottom
:: v2p3 20261119 Listed folders under dock and each pane with no default
:: and skipped empty sections
:: v2p2 20261119 Added full-layout option outputting dock and pane headers
:: with package_name and app_title lines
:: v2p1 20261119 Replaced backtick for /f calls on DOCK_TOTAL and PANE_TOTAL
:: with temp file redirects so cmd reliably captures counts
:: v2p0 20261119 Removed ampersand and parenthesis inside comment labels
:: as labels are not comments even though they act like them
:: v1p9 20261119 Removed item_type column from output and grouped folders
:: by their homescreen pane eg, "Pane 0 Folder: weather"
:: v1p8 20261119 Dynamically lists dock, eg, container = -101, and lists
:: homescreen panes by screen number, eg, container = -100,
:: and by named folders eg, itemType = 2, from nova db
:: and includes item_type in output
:: v1p7 20261119 Searches android storage for * novabackup files when none
:: are found in ANDROID_BCK_DIR, storing full remote paths so
:: backups in any folder can be pulled cleanly
:: v1p6 20261119 Set DEBUG=0 by default for clean normal output while keeping
:: the toggle available for troubleshooting
:: v1p5 20261119 Reversed output columns to package_name first, app_title
:: second and added startup dependency check for adb and
:: sqlite3 dependency checking configured paths and PATH
:: v1p4 20261119 Moved powershell commands into %TEMP%\* ps1 scripts run via
:: "-File" instead of backticks so cmd never parses "<" or ">"
:: v1p3 20261119 Added DEBUG=1 instrumentation
:: v1p2 20261119 Replaced cmd FOR sanitizer with powershell
:: v1p1 20261119 Numbered selection menu for novabackup files, lists folders
:: by name with numbered selection instead of raw container IDs
:: v1p0 20261119 Initial version to pull backup or use local nova db, query
:: sql via sqlite3 exe, select columns with powershell
:: -------------------------------------------------------------------------
@echo off
setlocal enabledelayedexpansion
cd /d "%~dp0"
:: --- Debug flag 1 = verbose DEBUG traces, 0 = quiet ---
set "DEBUG=0"
:: set "DEBUG=1"
:: --- Configurable paths ---
set "ADB_EXE=C:\app\editor\android\scrcpy\adb.exe"
set "SQLITE_EXE=C:\app\editor\android\sdk\platform-tools\sqlite3.exe"
set "WORK_DIR=C:\app\editor\android\scrcpy\nova"
set "ANDROID_BCK_DIR=/storage/emulated/0/0000/bck/nova_backup"
set "DEFAULT_CONTAINER=2921"
if "%DEBUG%"=="1" (
echo [DEBUG] SCRIPT_DIR="%~dp0"
echo [DEBUG] CD="%CD%"
echo [DEBUG] ADB_EXE="%ADB_EXE%"
echo [DEBUG] SQLITE_EXE="%SQLITE_EXE%"
echo [DEBUG] WORK_DIR="%WORK_DIR%"
)
:: -------------------------------------------------------------------------
:: Startup dependency and PATH check for adb exe and sqlite3 exe
:: -------------------------------------------------------------------------
echo Checking required tools (adb and sqlite3) ...
set "PATH_ADB="
for /f "usebackq delims=" %%W in (`where adb 2^>nul`) do (
if "!PATH_ADB!"=="" set "PATH_ADB=%%W"
)
set "PATH_SQLITE="
for /f "usebackq delims=" %%W in (`where sqlite3 2^>nul`) do (
if "!PATH_SQLITE!"=="" set "PATH_SQLITE=%%W"
)
if "%DEBUG%"=="1" (
echo [DEBUG] PATH_ADB="!PATH_ADB!"
echo [DEBUG] PATH_SQLITE="!PATH_SQLITE!"
)
:: Prefer configured path if it exists, otherwise fall back to PATH
if not exist "%ADB_EXE%" (
if not "!PATH_ADB!"=="" (
echo [INFO] Configured ADB_EXE not found; using PATH: "!PATH_ADB!"
set "ADB_EXE=!PATH_ADB!"
) else (
echo [WARN] adb.exe not found at "%ADB_EXE%" and not in PATH.
)
) else if "!PATH_ADB!"=="" (
echo [INFO] adb.exe found at configured path, though not in PATH.
)
if not exist "%SQLITE_EXE%" (
if not "!PATH_SQLITE!"=="" (
echo [INFO] Configured SQLITE_EXE not found; using PATH: "!PATH_SQLITE!"
set "SQLITE_EXE=!PATH_SQLITE!"
) else (
echo [ERROR] sqlite3.exe not found at "%SQLITE_EXE%" and not in PATH.
pause
exit /b 1
)
) else if "!PATH_SQLITE!"=="" (
echo [INFO] sqlite3.exe found at configured path, though not in PATH.
)
if not exist "%WORK_DIR%" mkdir "%WORK_DIR%"
echo Working directory: "%CD%"
echo Nova work directory: "%WORK_DIR%"
echo ----------------
echo.
echo Select source for Nova Launcher database:
echo [1] Pull .novabackup from Android via ADB and extract nova.db [Default]
echo [2] Use an existing nova.db or .novabackup or .zip already on Windows
echo.
set "SRC_CHOICE=1"
set /p "SRC_CHOICE=Enter choice [1 or 2]: "
if "%DEBUG%"=="1" echo [DEBUG] SRC_CHOICE="!SRC_CHOICE!"
if "%SRC_CHOICE%"=="2" goto :use_local_source
if "%SRC_CHOICE%"=="1" goto :pull_from_android
goto :pull_from_android
:: -------------------------------------------------------------------------
:: Option 1: Pull backup from android via adb
:: -------------------------------------------------------------------------
:pull_from_android
echo.
echo --- Pull Nova Backup from Android ---
if not exist "%ADB_EXE%" (
echo [ERROR] adb.exe not found at: "%ADB_EXE%"
pause
exit /b 1
)
set "ADB_TARGET="
for /f "skip=1 tokens=1" %%g in ('"%ADB_EXE%" devices') do (
if not "%%g"=="" (
if "!ADB_TARGET!"=="" set "ADB_TARGET=%%g"
)
)
if "%DEBUG%"=="1" echo [DEBUG] ADB_TARGET="!ADB_TARGET!"
if "!ADB_TARGET!"=="" (
echo [ERROR] No connected ADB devices found.
pause
exit /b 1
)
echo Targeting device: %ADB_TARGET%
echo Listing backups in %ANDROID_BCK_DIR% ...
echo.
"%ADB_EXE%" -s %ADB_TARGET% shell ls -1t "%ANDROID_BCK_DIR%/*.novabackup" 2>nul > "%TEMP%\nova_backups.txt"
if "%DEBUG%"=="1" (
echo [DEBUG] ls exit errorlevel=!errorlevel!
echo [DEBUG] Raw %TEMP%\nova_backups.txt contents:
type "%TEMP%\nova_backups.txt" 2>nul
)
set "BCK_COUNT=0"
for /f "usebackq delims=" %%B in ("%TEMP%\nova_backups.txt") do (
set "LINE=%%B"
if not "!LINE!"=="" (
set "LINE=!LINE:^M=!"
for %%F in ("!LINE!") do set "FNAME=%%~nxF"
set /a BCK_COUNT+=1
set "BCK_ITEM_!BCK_COUNT!=!FNAME!"
set "BCK_PATH_!BCK_COUNT!=!LINE!"
echo [!BCK_COUNT!] !FNAME!
if "%DEBUG%"=="1" (
echo [DEBUG] BCK_ITEM_!BCK_COUNT!="!FNAME!"
echo [DEBUG] BCK_PATH_!BCK_COUNT!="!LINE!"
)
)
)
del "%TEMP%\nova_backups.txt" >nul 2>&1
if %BCK_COUNT% EQU 0 (
echo [INFO] No .novabackup files found in %ANDROID_BCK_DIR%.
echo Searching Android storage for *.novabackup files ...
echo.
"%ADB_EXE%" -s %ADB_TARGET% shell "for d in /storage/emulated/0 /storage/*; do [ -d \"\$d\" ] && [ \"\$d\" != \"/storage/emulated\" ] && find \"\$d\" -maxdepth 5 -name '*.novabackup' 2>/dev/null; done" 2>nul > "%TEMP%\nova_backups_search.txt"
if "%DEBUG%"=="1" (
echo [DEBUG] Search exit errorlevel=!errorlevel!
echo [DEBUG] Raw %TEMP%\nova_backups_search.txt contents:
type "%TEMP%\nova_backups_search.txt" 2>nul
)
for /f "usebackq delims=" %%S in ("%TEMP%\nova_backups_search.txt") do (
set "LINE=%%S"
if not "!LINE!"=="" (
set "LINE=!LINE:^M=!"
for %%F in ("!LINE!") do set "FNAME=%%~nxF"
set /a BCK_COUNT+=1
set "BCK_ITEM_!BCK_COUNT!=!FNAME!"
set "BCK_PATH_!BCK_COUNT!=!LINE!"
echo [!BCK_COUNT!] !LINE!
if "%DEBUG%"=="1" (
echo [DEBUG] BCK_ITEM_!BCK_COUNT!="!FNAME!"
echo [DEBUG] BCK_PATH_!BCK_COUNT!="!LINE!"
)
)
)
del "%TEMP%\nova_backups_search.txt" >nul 2>&1
)
if %BCK_COUNT% EQU 0 (
echo [WARN] No .novabackup files found in %ANDROID_BCK_DIR% or Android storage.
:manual_bck
set "BCK_FILE="
set /p "BCK_FILE=Enter backup filename or full Android path e.g. 2026-11-19_12-57.novabackup: "
if "!BCK_FILE!"=="" (
echo [ERROR] No backup filename provided.
pause
exit /b 1
)
set "BCK_FILE=!BCK_FILE:"=!"
set "REMOTE_BCK=!BCK_FILE!"
if not "!REMOTE_BCK:~0,1!"=="/" set "REMOTE_BCK=%ANDROID_BCK_DIR%/!BCK_FILE!"
for %%F in ("!REMOTE_BCK!") do set "BCK_FILE=%%~nxF"
goto :pull_selected_backup
)
echo.
set "BCK_PICK=1"
set /p "BCK_PICK=Select backup number [1-%BCK_COUNT%, Default: 1]: "
if "!BCK_PICK!"=="" set "BCK_PICK=1"
if "%DEBUG%"=="1" echo [DEBUG] BCK_PICK="!BCK_PICK!"
set "BCK_FILE="
set "REMOTE_BCK="
for /l %%N in (1,1,%BCK_COUNT%) do (
if "!BCK_PICK!"=="%%N" (
set "BCK_FILE=!BCK_ITEM_%%N!"
set "REMOTE_BCK=!BCK_PATH_%%N!"
)
)
if "!BCK_FILE!"=="" (
set "CANDIDATE=!BCK_PICK:"=!"
set "REMOTE_BCK=!CANDIDATE!"
if not "!REMOTE_BCK:~0,1!"=="/" set "REMOTE_BCK=%ANDROID_BCK_DIR%/!CANDIDATE!"
for %%F in ("!REMOTE_BCK!") do set "BCK_FILE=%%~nxF"
)
if "%DEBUG%"=="1" (
echo [DEBUG] BCK_FILE="!BCK_FILE!"
echo [DEBUG] REMOTE_BCK="!REMOTE_BCK!"
)
:pull_selected_backup
set "LOCAL_BCK=%WORK_DIR%\%BCK_FILE%"
set "LOCAL_ZIP=%WORK_DIR%\backup.zip"
set "EXTRACT_DIR=%WORK_DIR%\backup_extracted"
echo.
echo Pulling "%REMOTE_BCK%" to "%LOCAL_BCK%" ...
"%ADB_EXE%" -s %ADB_TARGET% pull "%REMOTE_BCK%" "%LOCAL_BCK%"
if errorlevel 1 (
echo [ERROR] Failed to pull backup from Android.
pause
exit /b 1
)
if exist "%LOCAL_ZIP%" del /f /q "%LOCAL_ZIP%"
ren "%LOCAL_BCK%" "backup.zip"
if errorlevel 1 (
echo [ERROR] Failed to rename "%LOCAL_BCK%" to backup.zip.
pause
exit /b 1
)
if exist "%EXTRACT_DIR%" rmdir /s /q "%EXTRACT_DIR%"
echo Extracting backup.zip to "%EXTRACT_DIR%" ...
powershell -NoProfile -Command "Expand-Archive -LiteralPath '%LOCAL_ZIP%' -DestinationPath '%EXTRACT_DIR%' -Force"
if errorlevel 1 (
echo [ERROR] Failed to extract backup.zip.
pause
exit /b 1
)
set "DB_PATH=%EXTRACT_DIR%\nova.db"
goto :verify_db
:: -------------------------------------------------------------------------
:: Option 2: Use local nova db or novabackup or zip
:: -------------------------------------------------------------------------
:use_local_source
echo.
echo --- Local Database Selection ---
echo Enter the path to nova.db or a .novabackup or .zip file.
echo Default: "%WORK_DIR%\backup_extracted\nova.db"
echo.
:ask_local_db
set "USER_DB="
set /p "USER_DB=Path to database or backup file [Enter for default]: "
if "!USER_DB!"=="" (
set "DB_PATH=%WORK_DIR%\backup_extracted\nova.db"
) else (
set "USER_DB=!USER_DB:"=!"
for %%A in ("!USER_DB!") do set "DB_PATH=%%~fA"
)
if not exist "%DB_PATH%" (
echo [ERROR] File not found: "%DB_PATH%"
set "RETRY="
set /p "RETRY=Try again? [Y/n]: "
if /i "!RETRY!"=="n" exit /b 1
goto :ask_local_db
)
for %%E in ("%DB_PATH%") do set "EXT=%%~xE"
if /i "!EXT!"==".novabackup" goto :extract_local_archive
if /i "!EXT!"==".zip" goto :extract_local_archive
goto :verify_db
:extract_local_archive
set "EXTRACT_DIR=%WORK_DIR%\backup_extracted"
if exist "%EXTRACT_DIR%" rmdir /s /q "%EXTRACT_DIR%"
echo Extracting "%DB_PATH%" to "%EXTRACT_DIR%" ...
powershell -NoProfile -Command "Expand-Archive -LiteralPath '%DB_PATH%' -DestinationPath '%EXTRACT_DIR%' -Force"
if errorlevel 1 (
echo [ERROR] Failed to extract archive.
pause
exit /b 1
)
set "DB_PATH=%EXTRACT_DIR%\nova.db"
:: -------------------------------------------------------------------------
:: Verify database and list dock, panes, folders and other
:: -------------------------------------------------------------------------
:verify_db
if not exist "%DB_PATH%" (
echo [ERROR] nova.db not found at: "%DB_PATH%"
pause
exit /b 1
)
echo.
echo Using database: "%DB_PATH%"
echo Scanning Nova Launcher dock, panes and folders ...
echo.
set "TGT_COUNT=0"
set "LISTED_FOLDER_IDS=,"
:: 1 Dock section first as [1] dock apps plus dock folders if any
echo dock
set /a TGT_COUNT+=1
set "TGT_LABEL_!TGT_COUNT!=dock apps"
set "TGT_WHERE_!TGT_COUNT!=f.container = -101"
set "TGT_ORDER_!TGT_COUNT!=f.screen, f.cellY, f.cellX, f.rank, f._id"
echo [!TGT_COUNT!] dock apps
"%SQLITE_EXE%" -cmd ".separator |" "%DB_PATH%" "SELECT _id, CASE WHEN title IS NULL OR TRIM(title) = '' THEN '(Untitled Folder)' ELSE title END FROM favorites WHERE itemType = 2 AND container = -101 ORDER BY cellY, cellX, rank, _id;" > "%TEMP%\nova_dock_folders.txt" 2>nul
for /f "usebackq tokens=1* delims=|" %%A in ("%TEMP%\nova_dock_folders.txt") do (
set "FID=%%A"
set "FNAME=%%B"
set "FNAME=!FNAME:^M=!"
if not "!FID!"=="" (
set /a TGT_COUNT+=1
set "TGT_LABEL_!TGT_COUNT!=dock - !FNAME!"
set "TGT_WHERE_!TGT_COUNT!=f.container = !FID!"
set "TGT_ORDER_!TGT_COUNT!=f.rank, f._id"
set "LISTED_FOLDER_IDS=!LISTED_FOLDER_IDS!!FID!,"
echo [!TGT_COUNT!] !FNAME!
)
)
del "%TEMP%\nova_dock_folders.txt" >nul 2>&1
:: 2 Panes 0 to 14 with folders and loose apps via :scan_pane subroutine
for /l %%P in (0,1,14) do (
call :scan_pane %%P
)
:: 3 Other folders not already listed under dock or a pane
"%SQLITE_EXE%" -cmd ".separator |" "%DB_PATH%" "SELECT _id, CASE WHEN title IS NULL OR TRIM(title) = '' THEN '(Untitled Folder)' ELSE title END FROM favorites WHERE itemType = 2 ORDER BY LOWER(title), _id;" > "%TEMP%\nova_other_folders.txt" 2>nul
set "OTHER_HAS_FOLDERS=0"
for /f "usebackq tokens=1* delims=|" %%A in ("%TEMP%\nova_other_folders.txt") do (
set "FID=%%A"
set "FNAME=%%B"
set "FNAME=!FNAME:^M=!"
if not "!FID!"=="" (
echo !LISTED_FOLDER_IDS! | findstr /c:",!FID!," >nul
if errorlevel 1 (
if "!OTHER_HAS_FOLDERS!"=="0" (
echo other
set "OTHER_HAS_FOLDERS=1"
)
set /a TGT_COUNT+=1
set "TGT_LABEL_!TGT_COUNT!=other - !FNAME!"
set "TGT_WHERE_!TGT_COUNT!=f.container = !FID!"
set "TGT_ORDER_!TGT_COUNT!=f.rank, f._id"
echo [!TGT_COUNT!] !FNAME!
)
)
)
del "%TEMP%\nova_other_folders.txt" >nul 2>&1
echo.
set "TGT_PICK="
:: Allow q or 0 to quit cleanly without running a query
set /p "TGT_PICK=Select number [1-%TGT_COUNT%, q to quit]: "
if "%DEBUG%"=="1" echo [DEBUG] TGT_PICK="!TGT_PICK!"
if /i "!TGT_PICK!"=="q" goto :check_missing_3p
if "!TGT_PICK!"=="0" goto :check_missing_3p
set "SELECTED_LABEL="
set "SQL_WHERE="
set "SQL_ORDER="
for /l %%N in (1,1,%TGT_COUNT%) do (
if "!TGT_PICK!"=="%%N" (
set "SELECTED_LABEL=!TGT_LABEL_%%N!"
set "SQL_WHERE=!TGT_WHERE_%%N!"
set "SQL_ORDER=!TGT_ORDER_%%N!"
)
)
if "%DEBUG%"=="1" (
echo [DEBUG] SELECTED_LABEL="!SELECTED_LABEL!"
echo [DEBUG] SQL_WHERE="!SQL_WHERE!"
echo [DEBUG] SQL_ORDER="!SQL_ORDER!"
)
if "!SQL_WHERE!"=="" (
echo [ERROR] Invalid selection: "!TGT_PICK!"
pause
exit /b 1
)
:run_query
if "%DEBUG%"=="1" echo [DEBUG] Entering :run_query
:: Write label character replacer ps1 to %TEMP% so cmd never parses regex characters
set "PS_SANITIZE=%TEMP%\adbfolder_sanitize.ps1"
set "SAFE_NAME_FILE=%TEMP%\adbfolder_safename.txt"
> "%PS_SANITIZE%" echo $raw = $env:SELECTED_LABEL
>> "%PS_SANITIZE%" echo $s = [regex]::Replace($raw, '[\\/:*?"<>|() ]+', '_')
>> "%PS_SANITIZE%" echo $s = $s.Trim('_')
>> "%PS_SANITIZE%" echo if ([string]::IsNullOrWhiteSpace($s)) { $s = "nova_target" }
>> "%PS_SANITIZE%" echo [System.IO.File]::WriteAllText($env:SAFE_NAME_FILE, $s, (New-Object System.Text.UTF8Encoding($false)))
if "%DEBUG%"=="1" (
echo [DEBUG] Wrote "%PS_SANITIZE%"
echo [DEBUG] Running character replacer PowerShell script...
)
powershell -NoProfile -ExecutionPolicy Bypass -File "%PS_SANITIZE%"
if "%DEBUG%"=="1" echo [DEBUG] Character replacer exit errorlevel=!errorlevel!
set "SAFE_NAME="
if exist "%SAFE_NAME_FILE%" (
for /f "usebackq delims=" %%S in ("%SAFE_NAME_FILE%") do set "SAFE_NAME=%%S"
)
if "!SAFE_NAME!"=="" set "SAFE_NAME=nova_target"
del "%PS_SANITIZE%" >nul 2>&1
del "%SAFE_NAME_FILE%" >nul 2>&1
if "%DEBUG%"=="1" echo [DEBUG] SAFE_NAME="!SAFE_NAME!"
set "RAW_OUT=%WORK_DIR%\output.txt"
set "CLEAN_OUT=%WORK_DIR%\%SAFE_NAME%_apps.txt"
set "SQL_QUERY_FILE=%TEMP%\adbfolder_query.sql"
if "%DEBUG%"=="1" (
echo [DEBUG] RAW_OUT="%RAW_OUT%"
echo [DEBUG] CLEAN_OUT="%CLEAN_OUT%"
echo [DEBUG] SQL_QUERY_FILE="%SQL_QUERY_FILE%"
)
echo.
echo Querying "!SELECTED_LABEL!" ...
> "%SQL_QUERY_FILE%" echo .header on
>> "%SQL_QUERY_FILE%" echo .mode tabs
>> "%SQL_QUERY_FILE%" echo SELECT f._id AS item_id,
>> "%SQL_QUERY_FILE%" echo f.title AS app_title,
>> "%SQL_QUERY_FILE%" echo CASE
>> "%SQL_QUERY_FILE%" echo WHEN f.iconPackage IS NOT NULL AND LENGTH(TRIM(f.iconPackage^)^) ^> 0 THEN TRIM(f.iconPackage^)
>> "%SQL_QUERY_FILE%" echo WHEN INSTR(f.intent, 'component='^) ^> 0 THEN
>> "%SQL_QUERY_FILE%" echo CASE
>> "%SQL_QUERY_FILE%" echo WHEN INSTR(SUBSTR(f.intent, INSTR(f.intent, 'component='^) + 10^), '/'^) ^> 0 THEN SUBSTR(SUBSTR(f.intent, INSTR(f.intent, 'component='^) + 10^), 1, INSTR(SUBSTR(f.intent, INSTR(f.intent, 'component='^) + 10^), '/'^) - 1^)
>> "%SQL_QUERY_FILE%" echo WHEN INSTR(SUBSTR(f.intent, INSTR(f.intent, 'component='^) + 10^), ';'^) ^> 0 THEN SUBSTR(SUBSTR(f.intent, INSTR(f.intent, 'component='^) + 10^), 1, INSTR(SUBSTR(f.intent, INSTR(f.intent, 'component='^) + 10^), ';'^) - 1^)
>> "%SQL_QUERY_FILE%" echo ELSE SUBSTR(f.intent, INSTR(f.intent, 'component='^) + 10^)
>> "%SQL_QUERY_FILE%" echo END
>> "%SQL_QUERY_FILE%" echo WHEN INSTR(f.intent, 'package='^) ^> 0 THEN
>> "%SQL_QUERY_FILE%" echo CASE
>> "%SQL_QUERY_FILE%" echo WHEN INSTR(SUBSTR(f.intent, INSTR(f.intent, 'package='^) + 8^), ';'^) ^> 0 THEN SUBSTR(SUBSTR(f.intent, INSTR(f.intent, 'package='^) + 8^), 1, INSTR(SUBSTR(f.intent, INSTR(f.intent, 'package='^) + 8^), ';'^) - 1^)
>> "%SQL_QUERY_FILE%" echo ELSE SUBSTR(f.intent, INSTR(f.intent, 'package='^) + 8^)
>> "%SQL_QUERY_FILE%" echo END
>> "%SQL_QUERY_FILE%" echo ELSE ''
>> "%SQL_QUERY_FILE%" echo END AS package_name,
>> "%SQL_QUERY_FILE%" echo f.intent
>> "%SQL_QUERY_FILE%" echo FROM favorites f
>> "%SQL_QUERY_FILE%" echo WHERE !SQL_WHERE!
>> "%SQL_QUERY_FILE%" echo ORDER BY !SQL_ORDER!;
"%SQLITE_EXE%" "%DB_PATH%" < "%SQL_QUERY_FILE%" > "%RAW_OUT%"
if "%DEBUG%"=="1" (
echo [DEBUG] sqlite3 query exit errorlevel=!errorlevel!
echo [DEBUG] Raw %RAW_OUT% line count:
find /c /v "" "%RAW_OUT%" 2>nul
)
del "%SQL_QUERY_FILE%" >nul 2>&1
if errorlevel 1 (
echo [ERROR] SQLite query failed.
pause
exit /b 1
)
:: Write column formatter ps1 to %TEMP% and execute with -File package_name first, app_title second
set "PS_FORMAT=%TEMP%\adbfolder_format.ps1"
> "%PS_FORMAT%" echo $rawFile = $env:RAW_OUT
>> "%PS_FORMAT%" echo $cleanFile = $env:CLEAN_OUT
>> "%PS_FORMAT%" echo $rows = Import-Csv -LiteralPath $rawFile -Delimiter "`t"
>> "%PS_FORMAT%" echo $lines = $rows ^| Select-Object package_name, app_title ^| Format-Table -AutoSize ^| Out-String -Width 4096
>> "%PS_FORMAT%" echo $clean = ($lines -split "`r?`n" ^| ForEach-Object { $_.TrimEnd() } ^| Where-Object { $_ -ne '' }) -join "`r`n"
>> "%PS_FORMAT%" echo [System.IO.File]::WriteAllText($cleanFile, $clean + "`r`n", (New-Object System.Text.UTF8Encoding($false)))
if "%DEBUG%"=="1" echo [DEBUG] Running formatter PowerShell script "%PS_FORMAT%"...
powershell -NoProfile -ExecutionPolicy Bypass -File "%PS_FORMAT%"
if "%DEBUG%"=="1" echo [DEBUG] PowerShell formatter exit errorlevel=!errorlevel!
del "%PS_FORMAT%" >nul 2>&1
if errorlevel 1 (
echo [ERROR] Failed to format output columns.
pause
exit /b 1
)
echo.
echo --- Result (%CLEAN_OUT%) ---
echo.
type "%CLEAN_OUT%"
echo.
echo Raw tab-delimited output saved to: "%RAW_OUT%"
echo Formatted app list saved to: "%CLEAN_OUT%"
echo.
:: Loop back to menu so user can export another folder or pane
set "LOOP_MORE="
set /p "LOOP_MORE=Export another folder or pane? [y/N]: "
if /i "!LOOP_MORE!"=="y" goto :verify_db
:: -------------------------------------------------------------------------
:: End-of-run check for third-party packages -3 missing from nova.db
:: -------------------------------------------------------------------------
:check_missing_3p
echo.
set "CHECK_3P="
set /p "CHECK_3P=Check user apps -3 with no icon in Nova before quitting? [y/N]: "
if /i not "!CHECK_3P!"=="y" goto :quit_script
if "%DEBUG%"=="1" (
echo [DEBUG] Entering :check_missing_3p
echo [DEBUG] ADB_EXE="%ADB_EXE%"
echo [DEBUG] SQLITE_EXE="%SQLITE_EXE%"
echo [DEBUG] DB_PATH="%DB_PATH%"
echo [DEBUG] ADB_TARGET="%ADB_TARGET%"
)
if not exist "%ADB_EXE%" (
echo [INFO] adb.exe not found at "%ADB_EXE%"; skipping device package check.
goto :quit_script
)
set "RUN_ADB_TARGET=%ADB_TARGET%"
if "!RUN_ADB_TARGET!"=="" (
for /f "skip=1 tokens=1" %%g in ('"%ADB_EXE%" devices') do (
if not "%%g"=="" (
if "!RUN_ADB_TARGET!"=="" set "RUN_ADB_TARGET=%%g"
)
)
)
if "%DEBUG%"=="1" echo [DEBUG] RUN_ADB_TARGET="!RUN_ADB_TARGET!"
if "!RUN_ADB_TARGET!"=="" (
echo [INFO] No connected ADB device found; skipping device package check.
goto :quit_script
)
if not exist "%DB_PATH%" (
echo [INFO] Nova database not available at "%DB_PATH%"; skipping device package check.
goto :quit_script
)
set "RESOLVE_LABELS="
set /p "RESOLVE_LABELS=Resolve app titles via adb/aapt slower over Wi-Fi? [y/N]: "
set "DO_RESOLVE_LABELS=0"
if /i "!RESOLVE_LABELS!"=="y" set "DO_RESOLVE_LABELS=1"
if "%DEBUG%"=="1" echo [DEBUG] DO_RESOLVE_LABELS="!DO_RESOLVE_LABELS!"
set "PM_3P_FILE=%TEMP%\adbfolder_pm3.txt"
set "NOVA_PKGS_FILE=%TEMP%\adbfolder_nova_pkgs.txt"
set "UNPLACED_OUT=%WORK_DIR%\unplaced_user_apps.txt"
set "PS_DIFF_3P=%TEMP%\adbfolder_diff_3p.ps1"
:: v3p2: Write SQL to a temp .sql file so cmd does not parse SQL operators/quotes
set "SQL_NOVA_PKGS=%TEMP%\adbfolder_nova_pkgs.sql"
if "%DEBUG%"=="1" (
echo [DEBUG] PM_3P_FILE="!PM_3P_FILE!"
echo [DEBUG] NOVA_PKGS_FILE="!NOVA_PKGS_FILE!"
echo [DEBUG] UNPLACED_OUT="!UNPLACED_OUT!"
echo [DEBUG] PS_DIFF_3P="!PS_DIFF_3P!"
echo [DEBUG] SQL_NOVA_PKGS="!SQL_NOVA_PKGS!"
)
echo Querying third-party packages from device !RUN_ADB_TARGET! ...
if "%DEBUG%"=="1" echo [DEBUG] Running adb pm list packages -3...
"%ADB_EXE%" -s !RUN_ADB_TARGET! shell pm list packages -3 2>nul > "!PM_3P_FILE!"
if "%DEBUG%"=="1" (
echo [DEBUG] adb pm exit errorlevel=!errorlevel!
echo [DEBUG] PM_3P_FILE line count:
find /c /v "" "!PM_3P_FILE!" 2>nul
)
echo Querying packages referenced anywhere in nova.db ...
if "%DEBUG%"=="1" echo [DEBUG] Writing and running sqlite3 Nova package query from .sql file...
:: v3p3: Use LENGTH/TRIM checks instead of != so delayed expansion cannot drop negation
> "!SQL_NOVA_PKGS!" echo SELECT DISTINCT package_name
>> "!SQL_NOVA_PKGS!" echo FROM (
>> "!SQL_NOVA_PKGS!" echo SELECT CASE
>> "!SQL_NOVA_PKGS!" echo WHEN iconPackage IS NOT NULL AND LENGTH(TRIM(iconPackage^)^) ^> 0 THEN TRIM(iconPackage^)
>> "!SQL_NOVA_PKGS!" echo WHEN INSTR(intent, 'component='^) ^> 0 THEN
>> "!SQL_NOVA_PKGS!" echo CASE
>> "!SQL_NOVA_PKGS!" echo WHEN INSTR(SUBSTR(intent, INSTR(intent, 'component='^) + 10^), '/'^) ^> 0 THEN SUBSTR(
>> "!SQL_NOVA_PKGS!" echo SUBSTR(intent, INSTR(intent, 'component='^) + 10^),
>> "!SQL_NOVA_PKGS!" echo 1,
>> "!SQL_NOVA_PKGS!" echo INSTR(SUBSTR(intent, INSTR(intent, 'component='^) + 10^), '/'^) - 1
>> "!SQL_NOVA_PKGS!" echo ^)
>> "!SQL_NOVA_PKGS!" echo ELSE SUBSTR(intent, INSTR(intent, 'component='^) + 10^)
>> "!SQL_NOVA_PKGS!" echo END
>> "!SQL_NOVA_PKGS!" echo ELSE ''
>> "!SQL_NOVA_PKGS!" echo END AS package_name
>> "!SQL_NOVA_PKGS!" echo FROM favorites
>> "!SQL_NOVA_PKGS!" echo )
>> "!SQL_NOVA_PKGS!" echo WHERE LENGTH(package_name^) ^> 0;
"%SQLITE_EXE%" "%DB_PATH%" < "!SQL_NOVA_PKGS!" > "!NOVA_PKGS_FILE!"
if "%DEBUG%"=="1" (
echo [DEBUG] sqlite3 Nova pkgs exit errorlevel=!errorlevel!
echo [DEBUG] NOVA_PKGS_FILE line count:
find /c /v "" "!NOVA_PKGS_FILE!" 2>nul
echo [DEBUG] Writing PS_DIFF_3P script...
)
:: v3p2: Write PS_DIFF_3P line-by-line instead of an outer parenthesized block
:: v3p4: Resolve app labels for unplaced packages via adb dumpsys and aapt/aapt2 if available
:: v3p5: Remove stray caret escaping before closing paren on standalone echo lines
:: v3p6: Prompt whether to resolve app titles and print periodic progress during lookup
if exist "!PS_DIFF_3P!" del /f /q "!PS_DIFF_3P!" >nul 2>&1
>> "!PS_DIFF_3P!" echo $adbExe = $env:ADB_EXE
>> "!PS_DIFF_3P!" echo $adbTarget = $env:RUN_ADB_TARGET
>> "!PS_DIFF_3P!" echo $resolveLabels = ($env:DO_RESOLVE_LABELS -eq '1')
>> "!PS_DIFF_3P!" echo $pm3Lines = Get-Content -LiteralPath $env:PM_3P_FILE -ErrorAction SilentlyContinue
>> "!PS_DIFF_3P!" echo $installed3 = [System.Collections.Generic.HashSet[string]]::new([System.StringComparer]::OrdinalIgnoreCase)
>> "!PS_DIFF_3P!" echo foreach ($line in $pm3Lines) {
>> "!PS_DIFF_3P!" echo $p = ($line -replace '\r', '').Trim()
>> "!PS_DIFF_3P!" echo if ($p.StartsWith('package:')) { $p = $p.Substring(8).Trim() }
>> "!PS_DIFF_3P!" echo if (-not [string]::IsNullOrWhiteSpace($p)) { [void]$installed3.Add($p) }
>> "!PS_DIFF_3P!" echo }
>> "!PS_DIFF_3P!" echo $novaLines = Get-Content -LiteralPath $env:NOVA_PKGS_FILE -ErrorAction SilentlyContinue
>> "!PS_DIFF_3P!" echo $inNova = [System.Collections.Generic.HashSet[string]]::new([System.StringComparer]::OrdinalIgnoreCase)
>> "!PS_DIFF_3P!" echo foreach ($n in $novaLines) {
>> "!PS_DIFF_3P!" echo $pkg = ($n -replace '\r', '').Trim()
>> "!PS_DIFF_3P!" echo if (-not [string]::IsNullOrWhiteSpace($pkg)) { [void]$inNova.Add($pkg) }
>> "!PS_DIFF_3P!" echo }
>> "!PS_DIFF_3P!" echo $missingList = [System.Collections.Generic.List[string]]::new()
>> "!PS_DIFF_3P!" echo foreach ($pkg in $installed3) {
>> "!PS_DIFF_3P!" echo if (-not $inNova.Contains($pkg)) { [void]$missingList.Add($pkg) }
>> "!PS_DIFF_3P!" echo }
>> "!PS_DIFF_3P!" echo $missing = @($missingList.ToArray())
>> "!PS_DIFF_3P!" echo [System.Array]::Sort($missing, [System.StringComparer]::OrdinalIgnoreCase)
>> "!PS_DIFF_3P!" echo $aaptCmd = if ($resolveLabels) { Get-Command aapt -ErrorAction SilentlyContinue } else { $null }
>> "!PS_DIFF_3P!" echo $idx = 0
>> "!PS_DIFF_3P!" echo $results = foreach ($pkg in $missing) {
>> "!PS_DIFF_3P!" echo $idx++
>> "!PS_DIFF_3P!" echo $label = ''
>> "!PS_DIFF_3P!" echo if ($resolveLabels) {
>> "!PS_DIFF_3P!" echo if (($idx %% 10) -eq 1 -or $idx -eq $missing.Count) {
>> "!PS_DIFF_3P!" echo Write-Host ("Resolving titles: {0}/{1} ({2})..." -f $idx, $missing.Count, $pkg)
>> "!PS_DIFF_3P!" echo }
>> "!PS_DIFF_3P!" echo $dumpLines = ^& $adbExe -s $adbTarget shell dumpsys package $pkg 2^>$null
>> "!PS_DIFF_3P!" echo foreach ($dl in $dumpLines) {
>> "!PS_DIFF_3P!" echo if ($dl -match 'nonLocalizedLabel="([^"]+)"') { $label = $Matches[1].Trim() }
>> "!PS_DIFF_3P!" echo }
>> "!PS_DIFF_3P!" echo if ([string]::IsNullOrWhiteSpace($label) -and $aaptCmd) {
>> "!PS_DIFF_3P!" echo $apkPathLine = (^& $adbExe -s $adbTarget shell pm path $pkg 2^>$null ^| Select-Object -First 1)
>> "!PS_DIFF_3P!" echo if ($apkPathLine -and $apkPathLine.Trim().StartsWith('package:')) {
>> "!PS_DIFF_3P!" echo $apkRemote = $apkPathLine.Trim().Substring(8).Trim()
>> "!PS_DIFF_3P!" echo $apkLocal = Join-Path $env:TEMP "adbfolder_probe.apk"
>> "!PS_DIFF_3P!" echo ^& $adbExe -s $adbTarget pull $apkRemote $apkLocal ^>$null 2^>^&1
>> "!PS_DIFF_3P!" echo if (Test-Path -LiteralPath $apkLocal) {
>> "!PS_DIFF_3P!" echo $badging = ^& $aaptCmd.Source dump badging $apkLocal 2^>$null
>> "!PS_DIFF_3P!" echo foreach ($bl in $badging) {
>> "!PS_DIFF_3P!" echo if ($bl -match "^application-label:'([^']+)'") { $label = $Matches[1].Trim(); break }
>> "!PS_DIFF_3P!" echo }
>> "!PS_DIFF_3P!" echo Remove-Item -LiteralPath $apkLocal -Force -ErrorAction SilentlyContinue
>> "!PS_DIFF_3P!" echo }
>> "!PS_DIFF_3P!" echo }
>> "!PS_DIFF_3P!" echo }
>> "!PS_DIFF_3P!" echo }
>> "!PS_DIFF_3P!" echo [PSCustomObject]@{ package_name = $pkg; app_title = $label }
>> "!PS_DIFF_3P!" echo }
>> "!PS_DIFF_3P!" echo $tableText = if (@($results).Count -gt 0) {
>> "!PS_DIFF_3P!" echo ((@($results) ^| Format-Table -AutoSize ^| Out-String -Width 4096) -split "`r?`n" ^| ForEach-Object { $_.TrimEnd() } ^| Where-Object { $_ -ne '' }) -join "`r`n" + "`r`n"
>> "!PS_DIFF_3P!" echo } else { "" }
>> "!PS_DIFF_3P!" echo [System.IO.File]::WriteAllText($env:UNPLACED_OUT, $tableText, (New-Object System.Text.UTF8Encoding($false)))
>> "!PS_DIFF_3P!" echo Write-Host ("User packages (-3): {0} | In Nova layout: {1} | No icon in Nova: {2}" -f $installed3.Count, $inNova.Count, $missing.Count)
>> "!PS_DIFF_3P!" echo if (@($results).Count -gt 0) { Write-Host ""; Write-Output $tableText.TrimEnd() }
if "%DEBUG%"=="1" (
echo [DEBUG] PS_DIFF_3P write exit errorlevel=!errorlevel!
echo [DEBUG] Generated PS_DIFF_3P contents:
type "!PS_DIFF_3P!" 2>nul
echo [DEBUG] Executing PS_DIFF_3P...
)
powershell -NoProfile -ExecutionPolicy Bypass -File "!PS_DIFF_3P!"
if "%DEBUG%"=="1" echo [DEBUG] PS_DIFF_3P execution exit errorlevel=!errorlevel!
echo Saved unplaced user app list to: "!UNPLACED_OUT!"
echo.
if not "%DEBUG%"=="1" (
del "!PM_3P_FILE!" >nul 2>&1
del "!NOVA_PKGS_FILE!" >nul 2>&1
del "!PS_DIFF_3P!" >nul 2>&1
del "!SQL_NOVA_PKGS!" >nul 2>&1
) else (
echo [DEBUG] Keeping temp files because DEBUG=1:
echo [DEBUG] "!PM_3P_FILE!"
echo [DEBUG] "!NOVA_PKGS_FILE!"
echo [DEBUG] "!PS_DIFF_3P!"
echo [DEBUG] "!SQL_NOVA_PKGS!"
)
:quit_script
pause
exit /b 0
:: -------------------------------------------------------------------------
:: Subroutine: scan_pane <pane_number>
:: -------------------------------------------------------------------------
:scan_pane
set "SCR=%~1"
"%SQLITE_EXE%" -cmd ".separator |" "%DB_PATH%" "SELECT _id, CASE WHEN title IS NULL OR TRIM(title) = '' THEN '(Untitled Folder)' ELSE title END FROM favorites WHERE itemType = 2 AND container = -100 AND CAST(screen AS INTEGER) = %SCR% ORDER BY cellY, cellX, rank, _id;" > "%TEMP%\nova_pane_folders.txt" 2>nul
set "LOOSE_CNT=0"
"%SQLITE_EXE%" "%DB_PATH%" "SELECT COUNT(*) FROM favorites WHERE container = -100 AND CAST(screen AS INTEGER) = %SCR% AND itemType <> 2;" > "%TEMP%\nova_pane_loose_cnt.txt" 2>nul
for /f "usebackq delims=" %%C in ("%TEMP%\nova_pane_loose_cnt.txt") do (
if not "%%C"=="" set "LOOSE_CNT=%%C"
)
del "%TEMP%\nova_pane_loose_cnt.txt" >nul 2>&1
set "HAS_PANE_FOLDERS=0"
for /f "usebackq tokens=1* delims=|" %%A in ("%TEMP%\nova_pane_folders.txt") do (
set "FID=%%A"
if not "!FID!"=="" set "HAS_PANE_FOLDERS=1"
)
set "PRINT_HEADER=0"
if !HAS_PANE_FOLDERS! GTR 0 set "PRINT_HEADER=1"
if !LOOSE_CNT! GTR 0 set "PRINT_HEADER=1"
if "!PRINT_HEADER!"=="1" echo pane %SCR%
for /f "usebackq tokens=1* delims=|" %%A in ("%TEMP%\nova_pane_folders.txt") do (
set "FID=%%A"
set "FNAME=%%B"
set "FNAME=!FNAME:^M=!"
if not "!FID!"=="" (
set /a TGT_COUNT+=1
set "TGT_LABEL_!TGT_COUNT!=pane %SCR% - !FNAME!"
set "TGT_WHERE_!TGT_COUNT!=f.container = !FID!"
set "TGT_ORDER_!TGT_COUNT!=f.rank, f._id"
set "LISTED_FOLDER_IDS=!LISTED_FOLDER_IDS!!FID!,"
echo [!TGT_COUNT!] !FNAME!
)
)
if !LOOSE_CNT! GTR 0 (
set /a TGT_COUNT+=1
set "TGT_LABEL_!TGT_COUNT!=pane %SCR% loose apps"
set "TGT_WHERE_!TGT_COUNT!=f.container = -100 AND CAST(f.screen AS INTEGER) = %SCR% AND f.itemType <> 2"
set "TGT_ORDER_!TGT_COUNT!=f.cellY, f.cellX, f.rank, f._id"
echo [!TGT_COUNT!] pane %SCR% loose apps
)
del "%TEMP%\nova_pane_folders.txt" >nul 2>&1
goto :eof
:: -------------------------------------------------------------------------
:: end of adbfolder.bat
:: -------------------------------------------------------------------------
Re: Can we programmatically get package names of icons in a homescreen folder?
Author: Maria Sophia
Date: Fri, 20 Nov 2026 10:25
Date: Fri, 20 Nov 2026 10:25
88 lines
7172 bytes
7172 bytes
The last feature I added takes about 1/2 hour to run over Wi-Fi on my slow circal 2009 Windows 10 box, but it's useful to run at least once because it gives us the packages & titles of, in my case, 65 apps which I installed, but which have no launch icon on the home screen (most likely because I never bothered with it). Athough some, like the keyboards, are headless apps that don't need a launch icon because they're integrated in some other way. What's interesting is that these apps are likely orphans in that they are likely not being used since they have no placed icon. This is a nice way to find out what apps we might want to clean out, as most of these are likely leftovers from a previous test regime. Note that obtaining the package name is almost instantaneous. But obtaining the app title is what took the 1/2 hour to gather since it was the Windows tools that were gathering this data. package_name app_title ------------ --------- ai.articlereader.mobileapp Article Reader app.fluffy Fluffy asav.roomtemperature.us Room Temperature Thermometer aws.apps.usbDeviceEnumerator USB Device Info com.alextern.shortcutexecutors ShortcutExecutors com.alpaca.android.readout Text to Speech com.aor.droidedit DroidEdit Free com.blogspot.aeioulabs.barcode Barcode Generator com.brunopiovan.avozdazueira Zueira com.cliffweitzman.speechify2 Speechify com.cloudedge.smarteye CloudEdge com.codespaceapps.listeningapp Listen AI com.cybercat.acbridge ACBridge com.elishaazaria.sayboard Sayboard com.ghisler.tcplugins.WebDAV TotalCmd-WebDAV (WEB Folders) com.ghostsq.commander.https Ghost Commander - WebDAV plugin com.goodwy.contacts Contacts com.google.android.apps.wallpaper Styles & wallpapers com.heyflutter.hello_world Hello world com.hyperionics.avar @Voice Aloud Reader com.i45.launchdialer Call com.ifeanyi.read Read com.intsig.cspdf CS PDF com.jecelyin.editor.v2 920 Text Editor com.juanvision.eseecloud30 EseeCloud com.kunzisoft.keepass.libre KeePassDX com.maskyn.fileeditor Turbo Editor com.microsoft.copilot Copilot com.mixplorer.beta MiXplorer com.mobilityware.solitaire Solitaire com.netvor.settings.database.provider Settings Database Provider com.pilot51.voicenotify Voice Notify com.rsupport.rs.activity.rsupport.aas2 Smart Tutor com.sand.remotesupportaddon AirDroid Control Add-on com.sblabs.vinechart VineChart com.simpol.permissionssummary Permissions Summary com.stcodesapp.text2speech Text To Speech com.teamviewer.quicksupport.addon.universal TeamViewer Universal Add-On com.trianguloy.urlchecker URLCheck com.wilysis.cellinfolite Network Cell Info Lite dev.patrickgold.florisboard FlorisBoard fr.smarquis.applinks AppLinks io.elevenlabs.readerapp IIReader io.github.samolego.canta Canta io.simplicity.trainspotting Mainline Module Info me.easyapps.easynotes Easy Notes micro.repl.ma7moud3ly Micro REPL name.lmj001.savetodevice Save net.programmierecke.radiodroid2 RadioDroid org.aospstudio.files Files org.bromite.webview Bromite System WebView org.cryptomator Cryptomator org.fossify.calendar Calendar org.fossify.contacts Contacts org.fossify.filemanager File Manager org.fossify.gallery Gallery org.fossify.messages Messages org.fossify.phone Phone org.lsposed.lspatch LSPatch org.openusenet.reader NeReO org.schabi.newpipe.debug NewPipe Debug org.woheller69.whisper Whisper qrcodegenerator.qrcreator.qrmaker.createqrcode QR Code Generator rb.camere AllWrite za.kilowatch.ultimatefilemanager Ultimate File Manager Pro --
Re: Can we programmatically get package names of icons in a homescreen folder?
Author: Maria Sophia
Date: Sat, 21 Nov 2026 05:36
Date: Sat, 21 Nov 2026 05:36
964 lines
63668 bytes
63668 bytes
Maria Sophia wrote:
> This is a nice way to find out what apps we might want to clean out,
> as most of these are likely leftovers from a previous test regime.
While adbfolder.bat showed there were 65 headless apps that I had
definitely manually installed myself, what's interesting is the
almost a thousand apps which are neatly organized into 16 folders.
I've been using this same folder hierarchy for a decade or so, since
what you do on a phone or PC never changes so all menus are portable.
This is the main pain hierarchy, if others want to know good apps.
None of these (AFAIK) will ever ask for money or pop up an ad.
=================================================================
folder "time"
package_name app_title
------------ ---------
com.better.alarm Alarms
ws.xsoh.etar Etar
com.keuwl.sandtimer Sand Timer
com.twiegold.atomictime Atomic Time
com.simplemobiletools.clock smtClock
com.kodarkooperativet.notificationstopwatch Stopwatch
com.bnyro.clock Clock You
com.simplemobiletools.calendar.pro smtCalendar
org.sufficientlysecure.localcalendar Offline Calendar
com.mta.countdown Timesolutely lite
com.keuwl.stopwatch Stopwatch
com.geekyouup.android.ustopwatch Ultimate Stopwatch
com.samsung.android.calendar Calendar
com.joykraft.frenchpresstimer French Press Timer
com.terarisu.limited_timer010 010 Minutes Timer
com.terarisu.limited_timer015 015 Minutes Timer
com.terarisu.limited_timer020 020 Minutes Timer
com.terarisu.limited_timer030 030 Minutes Timer
com.terarisu.limited_timer045 045 Minutes Timer
com.terarisu.limited_timer060 060 Minutes Timer
com.terarisu.limited_timer090 090 Minutes Timer
com.terarisu.limited_timer120 120 Minutes Timer
com.terarisu.limited_timer180 180 Minutes Timer
com.slydroid.watch Timer
com.deslomator.complextimer Complex Timer
com.bostbi.dev.countdown Countdown Timer
at.cwiesner.android.visualtimer Visual Timer
spinninghead.talkingstopwatchlite Ultrachron Lite
com.hg.SpeechTimer SpeechTimer
com.validconcept.Timer4TM Timer4TM
com.geekyouup.android.ustopwatch Ultimate Stopwatch
me.tsukanov.counter Counter
com.starikov.datecalc Days Counter
com.keuwl.eggtimer Egg Timer
org.sufficientlysecure.ical Calendar Import-Export
=================================================================
folder "comms"
package_name app_title
------------ ---------
com.applaudsoft.wabi.wad WA Dialer
com.whatsapp WhatsApp
com.samsung.android.dialer Phone
com.samsung.android.dialer Phone
ml.bluelinestudio.privatecontact Phonebook
com.integralblue.callerid CallerID
me.billdietrich.fake_contacts Fake Contacts
com.google.android.contacts GoogleContacts
com.samsung.android.app.contacts origContacts
opencontacts.open.com.opencontacts OpenContacts
de.ritscher.simplemobiletools.contacts.pro Contacts
com.simplemobiletools.contacts.pro smtContacts
cz.psencik.com.android.contacts Contacts
am.ed.importcontacts Import Contacts
am.ed.exportcontacts Export Contacts
de.hskl.contacts Contact Book
de.dieterthiess.contactdiary2 Contact Diary
net.stargw.contactsimport Contacts Import
hazar.studio.privatecontacts Private Contacts
ch.abwesend.privatecontacts Private Contacts
cx.vmx.sdcontacts SD Contacts
eu.stargw.contactsimport Contacts Import
com.compelson.optimizer Contacts Optimizer
com.ihubin.contactsmanager ContactsManager
com.orgware.contactsmerge Contacts Merge
com.simplemobiletools.contacts Contacts
eu.stargw.contactsimport Contacts Import
dummydomain.yetanothercallblocker Yet Another Call Blocker
com.github.tmo1.sms_ie SMS Import / Export
com.samsung.android.messaging Messages
com.fsck.k9 K-9 Mail
mobi.firedepartment PulsePoint
de.tutao.tutanota Tutanota
org.dystopia.email Email
com.ninefolders.hd3 Nine
com.deependhulla.opemail Open Mail
ch.protonmail.android Proton Mail
cz.psencik.smsforwarder.direct SMS Forwarder
com.tmobile.services.nameid Scam Shield
com.tmobile.services.nameid Scam Shield
us.zoom.videomeetings Zoom
contacteraser.mobile.mypapit.net.contacteraser Contact Eraser
com.microsoft.office.outlook Outlook
gr.alterora.apps.contacts 123 Contacts Backup And Transfer
com.linkedin.android LinkedIn
com.google.android.talk Hangouts
com.google.android.apps.hangoutsdialer Hangouts Dialer
com.google.android.apps.googlevoice Voice
com.google.android.apps.meetings Meet
com.healthappy.smsalert SMS Alert
io.github.ilisevic.SOSbasic SOS Beacon and Locator
com.simplemobiletools.smsmessenger SMS Messenger
com.google.android.apps.messaging Messages
com.gogii.textplus textPlus
com.gogii.textplus textPlus
app.fedilab.nitterizeme UntrackMe
com.chooloo.www.koler Koler
com.riteshsahu.SMSBackupRestore SMS Backup & Restore
com.offlinechatapp.android OfflineChat
com.raxis.signalapp Signal
com.glodanif.bluetoothchat Bluetooth Chat
me.bridgefy.main Bridgefy
org.disrupted.rumble Rumble
com.zegoggles.smssync SMS Backup+
com.riteshsahu.SMSBackupRestore SMS Backup & Restore
cz.psencik.smsforwarder.direct SMS Forwarder
ru.perm.trubnikov.gps2sms GPS to SMS
it.rignanese.leo.slimfacebook SlimSocial
org.thoughtcrime.securesms Signal
com.enflick.android.tn2ndLine 2ndLine
com.hanan.android.ramkol Auto Speaker
com.giga_recorderapp.callrecording Call Recorder
com.geeksville.mesh Meshtastic
ai.chat.gpt.app AI Chat
eu.faircode.email FairEmail
ch.protonmail.android Proton Mail
com.nextcloud.client Nextcloud
com.simplemobiletools.dialer smtDialer
com.messages.chat Messages
com.beeper.chat Beeper
com.nll.cb ACR Phone
com.nll.store NLL Store
com.nll.helper APH
com.applaudsoft.wabi.virtual_number Wabi
com.trianguloy.openInWhatsapp Click to chat
com.applaudsoft.wabi.virtual_number Wabi
com.trianguloy.openInWhatsapp Click to chat
com.simplemobiletools.smsmessenger SMS Messenger
org.consumerreports.permissionslip.production PermissionSlip
com.sideline.phone.number Sideline
me.number.app.im 2nd Line
kik.android Kik
mod.piaohong.newsgroup NewsGroup
de.ritscher.simplemobiletools.contacts.pro Contacts
network.loki.messenger Session
me.number.app.im 2nd Line
=================================================================
folder "buy"
package_name app_title
------------ ---------
com.simplemobiletools.calculator smtCalculator
uno.platform.calculator Uno Calc
org.solovyev.android.calculator Calculator++
com.atharok.barcodescanner Barcode Scanner
com.manateeworks.barcodescanners Barcode Scanner
com.secuso.privacyFriendlyCodeScanner QR Scanner
krow.dev.qrcode QR Code Reader
com.adrianmejia.calculator Clean Calculator
com.adrianmejia.calculator Clean Calculator
com.google.zxing.client.android Barcode Scanner
com.cardsapp.android Cards
com.srowen.bs.android Barcode Scanner+
com.scanteam.qrcodereader QR Code Scanner
barcodescanner.qrscanner QR Code Scanner - Scan Barcode
com.loves.finder Love's
=================================================================
folder "files"
package_name app_title
------------ ---------
com.folderv.file FV File Explorer
ru.zdevs.zarchiver ZArchiver
com.mixplorer MiX
de.felixnuesse.extract Round Sync
com.ghostsq.commander Ghost Commander
com.simplemobiletools.filemanager.pro smtFile Manager
pl.mkexplorer.kormateusz MK Explorer
nextapp.fx FX
com.amaze.filemanager Amaze
com.amaze.fileutilities Amaze Utilities
com.lonelycatgames.Xplore X-plore
org.openintents.filemanager OI File Manager
me.zhanghai.android.files Material Files
com.skyjos.apps.fileexplorerfree Owlfiles
com.cxinventor.file.explorer Cx File Explorer
com.ghisler.android.TotalCommander Total Commander
com.sec.android.app.myfiles My Files
net.micode.fileexplorer File Explorer
com.speedsoftware.explorer Explorer
com.marc.files Files.marc
com.dnielfe.manager Simple Explorer
com.google.android.apps.nbu.files Files.nbu
pl.solidexplorer2 Solid Explorer
com.veniosg.dir Dir
com.sovworks.edslite EDS Lite
com.blackspruce.lpd LPD
com.blackspruce.mupdf LPP
keepass2android.keepass2android Keepass2Android
com.owncloud.android ownCloud
com.simplemobiletools.draw.pro smtDraw
org.secuso.privacyfriendlysketching Sketches
com.samsung.android.app.notes Samsung Notes
com.microsoft.office.officehubrow Office
com.nutomic.syncthingandroid Syncthing
com.atr.tedit TEdit
com.theolivetree.webdavserver WebDAV server
org.korosoft.simplenotepad.android Notepad
info.informationsea.apps.largetext Large Text
com.google.android.diskusage DiskUsage
ru.androidtools.texteditor Text Editor
dev.leonlatsch.photok Photok
com.google.android.diskusage DiskUsage
me.kuder.diskinfo DiskInfo
sa.storagetruth Storage Truth
eu.thedarken.sdm SD Maid
com.tengu.sharetoclipboard Share to Clipboard
com.gsnathan.pdfviewer Pdf Viewer Plus
com.artifex.mupdf.viewer.app MuPDF viewer
com.gmail.anubhavdas54.whatsdeleted WhatsDeleted
com.juthawong.android.mimechecker Ampare MIME Checker
com.koushikdutta.backup Helium
com.riteshsahu.SMSBackupRestore SMS Backup & Restore
com.resilio.sync Sync
com.bv.wifisync SyncMe
com.genonbeta.TrebleShot TrebleShot
com.tachibana.downloader Download Navi
com.cgogolin.penandpdf Pen&PDF
com.pspdfkit.viewer PDF Viewer
com.avrapps.pdfviewer PDF Viewer Lite
io.github.droidapps.pdfreader PDF Reader
org.ninthfloor.copperpdf CuprumPDF
swati4star.createpdf PDF Converter
com.xodo.pdf.reader Xodo
com.foxit.mobile.pdf.lite Foxit PDF
com.kmo.pdf.converter PDF Converter
com.reneph.passwordsafe Password Safe
com.sec.android.easyMover Smart Switch
org.mightyfrog.android.simplenotepad Simple Notepad
keepass2android.keepass2android Keepass2Android
com.orgzly Orgzly
org.dmfs.tasks Tasks
com.simplemobiletools.keyboard Keyboard
com.simplemobiletools.notes.pro Notes
org.coolreader Cool Reader
com.isaiasmatewos.texpand Texpand
com.checkboxtasksapp.android Checkbox
com.runitrut.dailytodoapp Daily todo app
com.ctoad.android.DoBe2 DoBeList
com.Naina.Inc.getDone Get-done
com.mayaal.todo My ToDo
rakta.tech.todotasklist.doitnow To Do task List - Do it Now
ch.martinstoeckli.silentnotes SilentNotes
com.ghisler.tcplugins.LAN TotalCmd-LAN (Windows shares)
com.syndoc.merlin Syndoc
com.nutomic.syncthingandroid Syncthing
com.legalimpurity.rsync Rsync
org.amoradi.syncopoli Syncopoli
com.droidvim DroidVim
com.fiistudio.fiinote FiiNote
net.gsantner.markor Markor
sushi.hardcore.droidfs DroidFS
dk.tacit.android.foldersync.lite FolderSync
com.rk.xededitor Xed-Editor
org.koreader.launcher KOReader
com.ghisler.android.TotalCommander Total Commander
com.ghisler.tcplugins.LAN TotalCmd-LAN (Windows shares)
=================================================================
folder "net"
package_name app_title
------------ ---------
eu.faircode.netguard NetGuard
moe.shizuku.privileged.api Shizuku
be.casperverswijvelt.unifiedinternetqs Better Internet Tiles
net.openvpn.openvpn OpenVPN Connect
de.blinkt.openvpn OpenVPN for Android
com.theolivetree.webdavserver WebDAV server
com.zq.webdav.app_free BestDAV Server (Free)
com.smestorage WebDAV Xplorer
com.celzero.bravedns Rethink
com.celzero.bravedns Rethink
net.stargw.fok Karma FW
com.quad9.aegis Quad9 Connect
cz.mroczis.netmonster cell NetMonster
com.tts.imnos_mobile cell Mobile Trace
com.novvia.fispy cell Signal Spy
net.simplyadvanced.ltediscovery LTE Discovery (ads)
com.ubnt.usurvey ubnt WiFiman
make.more.r2d2.cellular_z Cellular-Z (ads)
com.vrem.wifianalyzer FOSS WiFiAnalyzer
com.manageengine.wifimonitor WiFi Analyzer and Surveyor
ru.andr7e.wifimonitor efremov Wi-Fi Monitor
com.keuwl.wifi Wifi Analyser (ads)
com.etwok.netspotapp NetSpot
com.blueline.signalchecklite SignalCheck Lite
com.tools.netgel.netx NetX
aws.apps.networkInfoIi Network Info II (ads)
de.avm.android.wlanapp WLAN
at.bitfire.davdroid DAVxâµ
de.maza.zpush ZPush
tiar.ua.slf HTTP FS
org.secuso.privacyfriendlywifimanager WiFi Manager
be.ppareit.swiftp_free FTP Server (Free)
org.primftpd primitive ftpd
net.openvpn.openvpn OpenVPN Connect
com.deependhulla.opensync OpenSync
com.nutomic.syncthingandroid Syncthing
org.zwanoo.android.speedtest Speedtest
org.bitbatzen.wlanscanner WLANScanner
com.helgekeck.wifitool WiFi Tool
nu.firetech.android.wifiwarning WiFi Warning
com.roysolberg.android.datacounter Data counter widget
com.gordienoye.cellulardatanotifier Cellular Data Notifier
com.mobidia.android.mdm My Data Manager
de.dieterthiess.ipwidget IP Widget
pan.alexander.tordnscrypt.gp InviZible Pro
com.parsed.securitywall Puffer
org.galexander.sshd SimpleSSHD
com.arachnoid.sshelper SSHelper
com.termux Termux
com.agence3pp.euroconsumers euroconsumers
org.localsend.localsend_app LocalSend
net.nitroshare.android NitroShare
com.liveradio.fmradio.radiotuner.radiostation.amradio FM Radio
fm.a2d.sf SpiritF
com.yuriy.openradio Open Radio
com.cbfs.cbfscellidtracker CBFS Cell-Id Tracker
com.syndoc.merlin Syndoc
shareit.lite SHAREit Lite
de.srlabs.snoopsnitch SnoopSnitch
com.stoutner.privacycell Cell
com.skibapps.cellspycatcher Cell Spy Catcher
com.overlook.android.fing Fing
com.fmsys.snapdrop Snapdrop
com.neure.anddrop AndDrop
com.heleron.wifiroamingfix Wifi Roaming Fix
net.nirsoft.wificollector Wifi Collector
com.beemdevelopment.aegis Aegis
=============================================================================
folder "web"
package_name app_title
------------ ---------
at.cmg.android.phonews PhoNews
org.cromite.cromite Cromite
org.bromite.bromite Bromite
org.bromite.chromium Chromium
com.duckduckgo.mobile.android DuckDuckGo
com.epic.browser Epic
org.torproject.torbrowser Tor Browser
org.mozilla.focus Firefox Focus
org.mozilla.firefox Firefox
com.ghostery.android.ghostery Ghostery
com.brave.browser Brave
com.alohamobile.browser.lite Aloha Lite
com.opera.browser Opera
info.guardianproject.orfox OrfoxRIP
org.torproject.torservices TorServices
com.duns.padiapp PADI
com.tasomaniac.openwith Open Link With
cz.lsrom.webviewtest WebView Test
com.deltacdev.websiteshortcut Website Shortcut
=============================================================================
folder "weather"
package_name app_title
------------ ---------
com.accuweather.android AccuWeather
co.windyapp.android Windy.app
aerow.us.aerowind AeroWind
com.airvisual AirVisual
org.asdtm.goodweather Good Weather
com.macca895.sunriise Hey Sunrise
com.lholman.hiweather hiweather
com.neverads.just_weather just weather
org.androworks.klara Klara
uk.co.openweather OpenWeather
org.woheller69.weather RadarWeather
com.yoshi.rain Rain
org.breezyweather Weather
wangdaye.com.geometricweather Weather
com.alexplas.weathernew Weather
info.vazquezsoftware.weatheralarms Weather Alerts
com.la.local.weather.forecast.app Weather Forecast
com.windhub.marine.weather WindHub
com.windyty.android Windy
no.nrk.yr Yr
=============================================================================
folder "nature"
package_name app_title
------------ ---------
net.osmand.plus OsmAnd~
ru.perm.trubnikov.gps2sms GPS to SMS
com.app.compass.finddirection.digitalcompass.gpsutils.gpscompass Compass Direction
com.vonglasow.michael.satstat SatStat
org.ssandon.altimeter Altimeter
ro.overwrite.azimuthcompass Azimuth Compass
com.mirfatif.mylocation My Location
eu.basicairdata.graziano.gpslogger GPS Logger
net.psyberia.offlinemaps OfflineMaps
com.emacberry.gpslogger GPSLogger II
net.osmtracker OSMTracker for Androidâ„¢
de.dennisguse.opentracks OpenTracks
com.kylecorry.trail_sense Trail Sense
com.keuwl.compass Compass
org.primeit.compass Compass
com.agnibho.android.solarcompass Solar Compass
com.android.gpstest.osmdroid GPSTest
org.efalk.altimeter Pressure Altimeter
com.hoehenmesser.cjp Altimeter Plus
com.Avenza Avenza Maps
ca.abbro.androidmap Paper Maps
com.trailheadlabs.outerspatial OuterSpatial
com.keuwl.gpswaypoints GPS Waypoint Finder
com.idle.sunboard Sun Board
com.generalmagic.magicearth Magic Earth
mobi.maptrek Trekarta
mobi.maptrek.lite Trekarta Lite
com.custommapsapp.android Custom Maps
com.google.earth Earth
com.gpspleinair.sunmoontime SunMoonTime
com.noctuasoftware.stellarium_free Stellarium
com.google.android.stardroid Sky Map
com.sharpitor.nightsky20 Sextant Stars
com.lavadip.skeye SkEye
de.alcyone.livestarchart Live Star Chart
com.phg.constellations Constellations
mobile.application.forfree.earth Earth Viewer
com.davidgrossapps.wildfire Wildfire Info
com.myuniportal.android.apps.airwildfirelocationsnow Wildfire Locations Now
ca.cmetcalfe.locationshare Location Share
com.forrestguice.suntimeswidget Suntimes
com.forrestguice.suntimescalendars Suntimes Calendars
com.forrestguice.suntimeswidget Suntimes Alarms
fm.a2d.sf SpiritF
com.yuriy.openradio Open Radio
com.liveradio.fmradio.radiotuner.radiostation.amradio FM Radio
com.device_context.stepsmagic_free Best step counter
com.bikegpx BikeGPX
com.vecturagames.android.app.gpxviewer GPX Viewer
com.rungo RunGo
OziExplorer.Main OziExplorer
com.syncitgroup.android.iamhere I'm Here!
com.main.contacts.smsmanager SOS Alert
ru.gavrikov.mocklocations Mock Locations
com.sigseg.android.worldmap WorldMap
de.topobyte.apps.bms.atlas TB Atlas
com.momo.fakegps.locationchanger Fake GPS - Location Change
com.app.compass.finddirection.digitalcompass.gpsutils.gpscompass Compass Direction
com.iboism.gpxrecorder GPX Recorder
com.mschloapps.basicgps basicGPS
com.bundle.anchor anchor
com.ratana.sunsurveyorlite Sun Surveyor Lite
de.th.suncalcorg SunCalc org
de.th.mooncalcorg MoonCalc org
org.woheller69.whobird whoBIRD
=============================================================================
folder "auto"
package_name app_title
------------ ---------
com.lexa.fakegps Fake GPS
com.mock.cartage Cartage
com.generalmagic.magicearth Magic Earth
app.vela Vela Maps
com.google.android.apps.maps Maps
com.waze Waze
com.zoffcc.applications.zanavi ZANavi
app.organicmaps Organic Maps
com.sigseg.android.worldmap WorldMap
gov.caltrans.quickmap QuickMap
org.openorienteering.mapper Mapper
com.adamsappls.carc CARR
ru.perm.trubnikov.gps2sms GPS to SMS
ca.cmetcalfe.locationshare Location Share
com.syncitgroup.android.iamhere I'm Here!
com.safetyapp.b.safe.emergencyapp SOS Alert
com.github.ruleant.getback_gps GetBack GPS
com.amtrak.rider Amtrak
com.discipleskies.aaafindmycar Find My Car
com.unagit.parkedcar Parked Car
com.mapfactor.navigator Navigator
com.gpstrip Gpstrip
crc.carsapp.sacog Sac 511
com.sgr_b2.compass Compass
gbis.gbandroid GasBuddy
com.borneq.heregpslocation Here GPS Location
com.xintimex.emiliano.worldmap WorldMap
nl.sogeti.android.gpstracker OpenGpsTracker
de.mediaz.mxapp.hpbgeodefree World atlas MxGeo
org.tengel.planisphere Planisphere
com.underwood.route_optimiser Circuit
com.wesaphzt.privatelocation Private Location
org.y20k.trackbook Trackbook
com.augmentra.viewranger.android ViewRanger
me.danielbarnett.addresstogps AddressToGPS
info.guardianproject.locationprivacy LocationPrivacy
com.ionicbyrequest.sharemylocation shitn
com.discipleskies.aaafindmycar Find My Car
=============================================================================
folder "pic"
package_name app_title
------------ ---------
com.simplemobiletools.gallery.pro smtGallery
ru.tech.imageresizershrinker Image Toolbox
deckers.thibault.aves Aves
app.grapheneos.camera Camera
net.sourceforge.opencamera Open Camera
com.google.android.apps.cameralite GC night
com.simplemobiletools.camera smtCamera
pl.waskysoft.screenshotassistant Screenshot Assistant
com.motorola.camera2 Camera
com.dsphotoeditor.demoapp DS Photo Editor
com.simplemobiletools.draw.pro smtDraw
com.niksoftware.snapseed Snapseed
co.inker Inker
org.catrobat.paintroid Pocket Paint
net.braincake.pixl.pixl Pixl
com.gmail.anubhavdas54.whatsdeleted WhatsDeleted
com.google.android.GoogleCamera PGCam
audioscreenshot.awesomeapps.com.audioscreenshot Audio Screenshot
us.koller.cameraroll Camera Roll
com.nikon.wu.wmau wmu
com.jarsilio.android.scrambledeggsif Scrambled Exif
com.dozingcatsoftware.vectorcamera Vector Camera
org.Gallery.App Gallery
com.adfree.Gallery Gallery
adfree.gallery Gallery
de.k3b.android.lossless_jpg_crop LLCrop (lossless)
org.Gallery.Pro Gallery
de.kaffeemitkoffein.imagepipe Imagepipe
com.moblynx.galleryicsold Gallery ICS
com.arunsoft.icon Material Icon Maker
de.k3b.android.androFotoFinder A Photo Manager
com.sybu.simplegallery Gallery
com.alienpants.leafpicrevived LeafPic Revived
la.daube.photochiotte PhotoChiotte
com.donnnno.arcticons Arcticons
com.perracolabs.cpd Cameringo Lite
com.intermedia.hd.camera.professional ProCam X Lite
com.perracolabs.cpd Cameringo Lite
com.intermedia.hd.camera.professional ProCam X Lite
com.google.android.GoogleCamera penguin
com.google.android.apps.cameralite Camera Go
com.google.android.apps.cameralite wichaya
pinguin2001.penguingcam Camera
net.sourceforge.opencamera Open Camera
de.stoehr.loviapps.wezoom weZoom
dev.leonlatsch.photok Photok
com.sixcarrots.peephole Peephole
com.remoteguard.phototrap PhotoTrap
com.sjm.camera PRO Motion Detector Camera
com.d136.smbsecuritycamera Smb Security Camera
pl.waskysoft.screenshotassistant Screenshot Assistant
com.momocode.shortcuts Awesome Icons
com.jndapp.lux.free.iconpack LuX Free
com.whicons.iconpack Whicons
scadica.prcl Precision Color
com.aminbeheshti.exifviewer Exif Viewer
com.srjuen.exifviewer Exif Viewer
com.none.tom.exiferaser ExifEraser
com.photograph.editexifphoto Exif Editor
com.jarsilio.android.scrambledeggsif Exif adhoc del
com.airbeat.device.inspector Camera2 Probe
com.sybu.imageresizer Photo/Video Compressor
ru.tech.imageresizershrinker Image Toolbox
com.yuanfang2345.passport Nova ID Photo
com.passportphoto.visaid.photomaker Passport Size Photo
com.darkgalaxy.client.app_id_photo ID Photos Maker
com.sec.android.app.camera Camera
=============================================================================
folder "audio"
package_name app_title
------------ ---------
com.simplemobiletools.dialer smtDialer
com.simplycomplexapps.ASTellme Tell Me
com.rom1v.sndcpy sndcpy
com.google.android.apps.recorder GRecorder
com.github.axet.audiorecorder Audio Recorder
com.simplemobiletools.voicerecorder smtVoice Recorder
com.simplemobiletools.musicplayer smtMusic Player
com.danielkim.soundrecorder Sound Recorder
com.tmobile.vvm.application Visual Voicemail
com.motorola.fmplayer FM Radio
com.catalinagroup.callrecorder Cube ACR
org.y20k.transistor Transistor
com.einmalfel.podlisten PodListen
com.nll.acr ACR
com.hitrolab.audioeditor AudioLab
com.hudun.androidrecorder Voice to Text
de.danoeh.antennapod AntennaPod
com.sayhi.android.sayhitranslate SayHi
com.herman.ringpod Ringpod
com.google.android.apps.recorder Recorder
com.herman.ringtone Ringtone Maker
com.reallybadapps.podcastguru PodcastGuru
com.kabouzeid.gramophone Phonograph
com.nassiansoft.minipod Mini Pod
com.rannsoft.soundoff SoundOff
com.dc7.SilentModeToggle Silent Mode Toggle
muter.muter Mute
com.iven.musicplayergo Music Player GO
com.aimp.player AIMP
com.sqr5.android.player_jb Maple JB
com.jrtstudio.AnotherMusicPlayer Rocket Player
io.github.muntashirakon.Music Metro
com.github.cythara Cythara
com.geecko.QuickLyric QuickLyric
com.piyush.newu.texttovoice PDF To Voice
com.nll.acr ACR
com.sayhi.android.sayhitranslate SayHi
com.github.axet.audiorecorder Audio Recorder
com.dimowner.audiorecorder Audio Recorder
com.hanan.android.ramkol Auto Speaker
com.danielkim.soundrecorder Sound Recorder
com.richardtozer.dashcam DashCam
com.google.android.apps.recorder Recorder
com.nll.asr ASR
com.iboism.dictate Dictate Everything
ai.chat.gpt.app AI Chat
com.tiptop.ai.chat.gpt AI Chat
com.yuriy.openradio Open Radio
com.liveradio.fmradio.radiotuner.radiostation.amradio FM Radio
hesoft.T2S T2S
com.ktix007.talk Talk FREE
ak.alizandro.smartaudiobookplayer Smart AudioBook Player
de.ph1b.audiobook Voice
=============================================================================
folder "vid"
package_name app_title
------------ ---------
org.schabi.newpipe NewPipe
com.github.libretube LibreTube
org.videolan.vlc VLC
InfinityLoop1309.NewPipeEnhanced PipePipe
com.junkfood.seal Seal
is.xyz.mpv mpv
jp.nalab.tomcam TomCam
com.shallwaystudio.nodevideo NodeVideo
com.mobivio.android.cutecut Cute CUT
org.courville.nova Nova Video Player
com.richardtozer.dashcam DashCam
com.cbs.tve CBS
com.cbs.app Paramount+
com.nbcnews.msnbc.mobile MSNBC
com.fadcam FadCam
=============================================================================
folder "todo"
package_name app_title
------------ ---------
org.secuso.privacyfriendlytodolist To-Do List
com.maxistar.textpad Simple Text Editor
com.sec.android.app.popupcalculator Calculator
jakiganicsystems.simplestchecklist local cklst
org.dmfs.tasks Tasks
privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist Shopping List
com.simplemobiletools.notes.pro Notes
com.flt.checklist Check List
com.github.andremiras.qrscan QRCode & Barcode scanner
com.kenzap.checklist costco
com.atr.tedit TEdit
name.obrien.dave.lister Check Off
com.samsung.android.app.notes Samsung Notes
com.checklist.android Checklist
com.secuso.privacyFriendlyCodeScanner QR Scanner
name.soulayrol.rhaa.sholi ShoLi
pallob.loop.com.notepad Notepad
org.spectralsoft.textedit Text Edit
com.lolo.io.onelist 1List
org.aplicacion.jesuspc.pruebabarra Industrial Utility
com.duy.calculator.free NCalc+
org.openintents.shopping OI Shopping List
com.woefe.shoppinglist Shopping List
kdk.android.simplydo Simply Do
org.tasks Tasks
nl.mpcjanssen.simpletask Simpletask
com.google.zxing.client.android Barcode Scanner
me.scan.android.client QR Code Reader
de.markusfisch.android.binaryeye Binary Eye
info.aario.snotepad local
org.billthefarmer.diary datedtodo
com.alaskalinuxuser.justnotes parts
click.dummer.textthing dollarstore
com.aa.mynotes webbuy
com.bijoysingh.quicknote notes
com.simplemobiletools.notes Notes
org.isoron.uhabits Habits
de.reimardoeffinger.quickdic QuickDic
com.rhmsoft.edit QuickEdit
net.cozic.joplin Joplin
org.billthefarmer.editor Editor
nextapp.fx FX
com.rhmsoft.edit QuickEdit
click.dummer.textthing Retro Text Editor
org.dmfs.tasks Tasks
ch.martinstoeckli.silentnotes SilentNotes
md.obsidian Obsidian
=============================================================================
folder "sensor"
package_name app_title
------------ ---------
com.elitecrest.orenda Orenda
maderski.chargingindicator Charging Indicator
de.rwth_aachen.phyphox phyphox
com.sonova.phonak.dsapp myPhonak
com.unitconverterpro.ucplite Unit Converter Pro
com.solarpanelcalculator.ZishanAdThandar solarCalculator
com.finalwire.aida64 AIDA64
flar2.devcheck DevCheck
com.toralabs.deviceinfo Device Info
com.ytheekshana.deviceinfo Device Info
ru.andr7e.deviceinfohw Device Info HW
tk.hack5.treblecheck Treble Info
com.evilscan.deviceinfo Device Info
com.evo.inware Inware
com.kgurgul.cpuinfo CPU Info
com.cpuid.cpu_z CPU-Z
com.pixplicity.devcheck Introspect
com.trixels.deviceinfo System & Device Info: CPU, RAM
org.uguess.android.sysinfo.pro Quick System Info PRO
org.uguess.android.sysinfo Quick System Info
com.darshancomputing.BatteryIndicatorPro BatteryBot Pro
com.darshancomputing.BatteryIndicator BatteryBot
com.gsamlabs.bbm GSam Battery Monitor
com.asksven.betterbatterystats BetterBatteryStats
org.secuso.privacyfriendlyactivitytracker Pedometer
org.secuso.privacyfriendlyfoodtracker Food Tracker
org.secuso.privacyfriendlyweather Weather
com.llamalab.automate Automate
ro.overwrite.azimuthcompass Azimuth Compass
org.aplicacion.jesuspc.pruebabarra Industrial Utility
com.keuwl.protractor Protractor
com.keuwl.ruler Ruler
com.nitish.privacyindicator Privacy Indicators
com.trelleborg.tss.avc AreaVolumeCalculator
com.krengr.wpc Water Project Calculator
com.sumeet.areavolumecalculator Area & Volume Calculator
cisterna.promo Calcolo Volume Cisterne
com.gsamlabs.bbm GSam Battery Monitor
com.keuwl.spiritlevel Spirit Level
com.keuwl.ruler Ruler
com.keuwl.protractor Protractor
com.android.settings Settings
org.asdtm.goodweather Good Weather
org.vosk.demo Vosk Demo
com.aitorguascone.myamsler My Amsler
io.github.sds100.keymapper Key Mapper
flar2.homebutton Button Mapper
com.simplemobiletools.flashlight Flashlight
com.urbandroid.inline PowerLine
no.nordicsemi.android.mcp nRF Connect
com.apple.trackerdetect Tracker Detect
de.seemoo.at_tracking_detection.release AirGuard
f.cking.software BLE Radar
de.quantumphysique.trale trale
org.woheller69.audiometry hEARtest
com.keuwl.spiritlevel Spirit Level
=============================================================================
folder "apk"
package_name app_title
------------ ---------
io.github.muntashirakon.AppManager App Manager
com.aurora.warden Warden
scadica.aq App Finder
checkapp.appinallcountries.available.showingcorrectly AppLens
com.aurora.store Aurora Store
app.accrescent.client Accrescent
org.fdroid.basic F-Droid Basic
com.looker.droidify Droid-ify
com.aurora.adroid Aurora Droid
org.fdroid.fdroid F-Droid
com.github.yeriomin.yalpstore Yalp Store
dev.imranr.obtainium Obtainium
app.pwhs.universalinstaller Universal Installer
com.aefyr.sai SAI
moe.shizuku.privileged.api Shizuku
com.noxinfinity.shell ShizuShell
com.apkupdater APKUpdater
pratham.bkm.appupdatechecker App Update Checker - Update Software
com.update.software.updateallapps App Updater (ads)
com.mirfatif.permissionmanagerx Permission Manager X
in.yourstreet.permissionmanager Permission Manager
superfreeze.tool.android SuperFreezZ
tuple.me.dtools Doodly
com.oasisfeng.island.fdroid Insular
com.oasisfeng.island.fdroid Island Settings
com.javiersantos.mlmanager ML Manager
sk.styk.martin.apkanalyzer Apk Analyzer
com.apk.editor APK Explorer & Editor
com.ubqsoft.sec01 Application Inspector
com.topjohnwu.magisk Magisk
com.csdroid.pkg Package Names
cz.seeq.prog.android.packageviewer Package Viewer
com.oF2pks.applicationsinfo apps_Packages Info
com.smartpack.packagemanager Package Manager
com.frankygoes.myapks My APKs
com.ses.app.apkexport APK Export
net.muik.myappfinder My App Finder
se.brokenbrain.drawer Organized Drawer
net.ebt.appswitch App Swap
com.google.android.diskusage DiskUsage
org.malwarebytes.antimalware Malwarebytes
mobi.infolife.appbackup App Backup & Restore
com.oF2pks.classyshark3xodus ClassyShark3xodus
com.ses.app.apkexport APK Export
com.oF2pks.classyshark3xodus ClassyShark3xodus
jp.gr.java_conf.hdak.drawer Draweroid
com.oF2pks.chairlock Chairlock
com.projectsexception.myapplist My App List
com.oF2pks.chairlock Chairlock
com.spencerstudios.applist My Apps
de.onyxbits.listmyapps List My Apps
au.radsoft.appdrawer App Drawer
bg.projectoria.appinspector App Inspector
umairayub.appmanager AppManager
com.deltacdev.websiteshortcut Website Shortcut
com.roysolberg.android.datacounter Data counter widget
com.lolem.simpleappmanager Simple App Manager
krow.dev.extractor ApkExtractor
com.easwareapps.baria BARIA
krow.dev.addetector Ad Detector
axp.tool.apkextractor Apk Extractor
mobi.usage.appbackup App Backup & Restore
com.ruet_cse_1503050.ragib.appbackup.lite App Backup Lite
com.oasisfeng.greenify Greenify
com.morrison.applocklite Perfect AppLock
io.github.subhamtyagi.privacyapplock App Lock
com.whicons.iconpack Whicons
com.dkanada.icecons Frost
com.android.settings Settings
com.elsdoerfer.android.autostarts Autostarts
com.momocode.shortcuts Awesome Icons
com.blankicon blankiconwidget
com.android.settings Settings
ussr.razar.inspector Inspector
com.atolphadev.quikshort Quikshort
com.cemique.shortcutwidgets Shortcut Widgets
rk.android.app.shortcutmaker Shortcut Maker
com.alextern.shortcuthelper Create Shortcut
jp.miotti.ShortcutToURL Shortcut To URL
com.casraq.android.apksignaturechecker APK signature checker
com.app.detail App Detail
org.codedrink.app_killer App Killer: Close Apps
me.piebridge.brevent Brevent
com.urbandroid.dontkillmyapp DontKillMyApp
com.app.detail App Detail
com.redsoft.zerocleaner Zero Cleaner
com.github.bmx666.appcachecleaner.googleplay Cache Cleaner
com.symantec.cleansweep Norton Clean
jp.miotti.AndroidViewer Resource Viewer
sarangal.packagemanager Package Manager
com.aefyr.sai SAI
net.kollnig.missioncontrol.fdroid TC
gr.nikolasspyr.integritycheck Integrity Checker
com.apkupdater APKUpdater
=============================================================================
folder "sys"
package_name app_title
------------ ---------
com.teslacoilsw.launcher Nova Settings
com.f0x1d.logfox LogFox
com.mirfatif.permissionmanagerx Permission Manager X
com.llamalab.automate Automate
ryey.easer Easer
rikka.appops App Ops
ninja.sesame.app.edge Sesame
com.draco.ladb LADB
moe.shizuku.privileged.api Shizuku
com.noxinfinity.shell ShizuShell
com.termux Termux
org.connectbot ConnectBot
by4a.setedit22 SetEdit
com.android.systemui System UI demo mode
com.jarsilio.android.autoautorotate Auto Auto-Rotate
com.sovworks.edslite EDS Lite
keepass2android.keepass2android Keepass2Android
org.androidsoft.app.permission Permission Friendly Apps
com.roysolberg.android.developertools Developer Tools
jackpal.androidterm Terminal Emulator
com.zzzmode.appopsx AppOpsX
org.microg.nlp UnifiedNlp
com.dp.logcatapp Logcat Reader
moe.zhs.caffeine Caffeine
com.motorola.moto Moto
com.cpuid.cpu_z CPU-Z
org.billthefarmer.editor android
org.jessies.dalvikexplorer Dalvik Explorer
com.aboutmycode.betteropenwith Better Open With
jp.susatthi.ManifestViewer ManifestViewer
de.jl.notificationlog NotificationLog
ru.seva.finder Finder
android.jonas.fakestandby FakeStandby
com.seven.adclear AdClear
com.tengu.sharetoclipboard Share to Clipboard
com.voicetyping.alllanguages.speechtotext.englishconverter Easy Voice Typing in All Languages
eu.faircode.netguard NetGuard
flar2.homebutton Button Mapper
com.irishin.buttonsremapper Buttons remapper
io.github.sds100.keymapper Key Mapper
you.in.spark.access.dots Access Dots
com.elsdoerfer.android.autostarts Autostarts
com.rs.autorun Autorun Manager
com.autostart Auto Start
in.blogspot.anselmbros.torchie Torchie
org.dslul.openboard.inputmethod.latin OpenBoard
com.llamalab.automate Automate
eu.faircode.netguard NetGuard
com.draco.ladb LADB
de.halfreal.clipboardactions Clipboard Actions
com.cemique.shortcutwidgets Shortcut Widgets
rk.android.app.shortcutmaker Shortcut Maker
com.alextern.shortcuthelper Create Shortcut
com.deltacdev.websiteshortcut Website Shortcut
ussr.razar.inspector Inspector
com.softwarevalencia.openboard.inputmethod.latin OpenBoard valenciÃ
com.simplemobiletools.keyboard Keyboard
com.simplemobiletools.flashlight Flashlight
tuple.me.dtools Doodly
com.illusion.checkfirm CheckFirm
com.maforn.timedshutdown Timed Shutdown
com.beemdevelopment.aegis Aegis
helium314.keyboard HeliBoard
com.teamviewer.teamviewer.market.mobile TeamViewer
org.woheller69.whisperplus Whisper+
dev.soupslurpr.transcribro Transcribro
com.menny.android.anysoftkeyboard AnySoftKeyboard
net.kollnig.missioncontrol TC
moe.shizuku.privileged.api Shizuku
com.machiav3lli.backup Neo Backup
net.typeblog.shelter Shelter
com.pluscubed.matlog MatLog
=============================================================================
folder "dock"
package_name app_title
------------ ---------
xyz.klinker.messenger Pulse
opencontacts.open.com.opencontacts.debug OpenContacts
com.whatsapp WhatsApp
com.android.settings Settings
shortcuts
com.sec.android.app.voicenote SRecorder
com.sec.android.app.camera Camera
com.teslacoilsw.launcher Apps
com.teslacoilsw.launcher Apps
com.teslacoilsw.launcher Apps
com.teslacoilsw.launcher Apps
=============================================================================
folder "shortcuts"
package_name app_title
------------ ---------
com.pw.wifishortcut WiFi Shortcut
com.bundle.anchor anchor
com.apps.settings Settings App
com.netvor.settings.database.editor Settings Database Editor
com.apple.trackerdetect Tracker Detect
com.sec.android.app.myfiles Trash
io.github.muntashirakon.AppManager Interceptor
=============================================================================
Note there was another pane for the apps that I don't use frequently,
which is not indicated in this listing (e.g., plant identification).
--
On Usenet, some people contribute to the tribal knowledge of the group.
Re: Can we programmatically get package names of icons in a homescreen folder?
Author: Maria Sophia
Date: Sat, 21 Nov 2026 17:32
Date: Sat, 21 Nov 2026 17:32
53 lines
4092 bytes
4092 bytes
Maria Sophia wrote: > Obviously, we can adapt this method to find all the apps in > each & every folder on our Android home screens over Wi-Fi/USB. Success! This is an exiting new feature for your Android/desktop! It took longer than the hour I had "thought" I would invest into this project but we can now spit out every package/name combination that we've installed or that the system installed which has an icon on the homescreen. Interestingly, given I we logically organize the icons in folders by most-used to least used, the order listed is EXACTLY the homescreen order! That was an unexpected bonus that the organization is literally from top to bottom of the folders, from left to right & the same when inside folders! For example, my "files" folder has all the file managers in exact order! folder "files" package_name app_title ------------ --------- com.folderv.file FV File Explorer ru.zdevs.zarchiver ZArchiver com.mixplorer MiX de.felixnuesse.extract Round Sync com.ghostsq.commander Ghost Commander com.simplemobiletools.filemanager.pro smtFile Manager pl.mkexplorer.kormateusz MK Explorer nextapp.fx FX com.amaze.filemanager Amaze com.amaze.fileutilities Amaze Utilities com.lonelycatgames.Xplore X-plore org.openintents.filemanager OI File Manager me.zhanghai.android.files Material Files com.skyjos.apps.fileexplorerfree Owlfiles com.cxinventor.file.explorer Cx File Explorer com.ghisler.android.TotalCommander Total Commander com.sec.android.app.myfiles My Files net.micode.fileexplorer File Explorer com.speedsoftware.explorer Explorer com.marc.files Files.marc com.dnielfe.manager Simple Explorer com.google.android.apps.nbu.files Files.nbu pl.solidexplorer2 Solid Explorer etc.... It's a nearly perfect ordered inventory. a. folders in order b. packages in order c. with a list of 65 headless apps that I personally installed The next major update will be most likely when I port it to python so that linux and macos users can benefit from this new capability.
Re: Can we programmatically get package names of icons in a homescreen folder?
Author: Maria Sophia
Date: Sat, 21 Nov 2026 18:22
Date: Sat, 21 Nov 2026 18:22
48 lines
3885 bytes
3885 bytes
Maria Sophia wrote: > It's a nearly perfect ordered inventory. > a. folders in order > b. packages in order > c. with a list of 65 headless apps that I personally installed Here's a description of the new capability before I port it to python. :: ------------------------------------------------------------------------- :: adbfolder.bat (describes the Android homescreen in an ordered text file) :: ------------------------------------------------------------------------- :: Outputs a textual inventory (with debug capability) of the Android :: homescreen, including location of all panes, folders & package names. :: :: Runs on Windows over Wi-Fi/USB, but can be ported to other platforms. :: Intended to assist in debugging, inventory, archival, backup and restore. :: :: Will pull a backup from android via adb or read an existing nova db or :: nova backup archive on windows needing only adb and sql dependencies :: :: List order is top to bottom, left to right, meaning the leftmost pane :: is 1st, the topleft folder is 1st, then the next folder to the right. :: :: Likewise, packages are listed in top to bottom order, left to right :: when inside folders (which means we have an organizational archive). :: :: Bare icons (not inside folders) are listed separately as a line item. :: :: This script not only provides a complete inventory of every package :: and title of every folder & icon on the homescreen, but it optionally :: will 'diff' against all packages installed by the user to indicate :: 'headless' apps which are installed, but which have no homescreen icon. :: ------------------------------------------------------------------------- I looked up what the porting options are, and it seems these may work? a. bash b. python c. powershell7 d. go e. node.js f. C#/.NET10 Of those, only bash & python do I know anything about. And of those, python is the only one which will work w/o changing the file. Are there any other porting options so the Linux/macOS users also benefit from this new capability of inventorying and debugging Android homescreens? -- On Usenet, we can pool our knowledge and skills so everyone learns more.
Re: Can we programmatically get package names of icons in a homescreen folder?
Author: Maria Sophia
Date: Sat, 21 Nov 2026 19:23
Date: Sat, 21 Nov 2026 19:23
67 lines
4975 bytes
4975 bytes
Maria Sophia wrote: > I looked up what the porting options are, and it seems these may work? > a. bash > b. python > c. powershell7 > d. go > e. node.js > f. C#/.NET10 Not only is there a question of how to port this for more general use, but there's also a question of which common launchers will it work with. It may be that the native Android launcher may provide a 'parsable homescreen, so I looked up which might work in addition to Nova Launcher. So far, I "think" (tentatively) these will export/import a homescreen. a. Nova (SQL, .novabackup/nova.db restore) b. Lawnchair (.lawnchairbackup/restore) c. Mink (JSON backup/restore) d. Total Launcher (zip? backup/restore) e. Niagra (nlb backup/restore) d. Others? (SQLite, JSON, XML, etc.) What's interesting is Lawnchair might read a Nova backup/restore database. <https://lawnchair.app/> <https://github.com/LawnchairLauncher/lawnchair> <https://docs.lawnchair.app/getting-started/install-and-setup> <https://play.google.com/store/apps/details?id=app.lawnchair.play> "Lawnchair is a free, open source home screen replacement based on Launcher3 from the Android open source project. The app aims to provide an experience similar to that of the Pixel Launcher, while offering more features." Note that I updated the script today because I needed to make clear that the displayed name might have been changed from the original by the user. :: ------------------------------------------------------------------------- :: adbfolder.bat :: ------------------------------------------------------------------------- :: Outputs a perfect textual inventory, with debug capability, of an Android :: homescreen, including location of all panes, folders, packages and titles. :: :: Intended to assist in debugging, inventory, archival, backup and restore. :: Runs on Windows over Wi-Fi/USB, but can be ported to other platforms. :: :: Will pull a backup from android via adb or read an existing nova db or :: nova backup archive on windows needing only adb and sql dependencies :: :: List order is top to bottom, left to right, meaning the leftmost pane :: is 1st, the topleft folder is 1st, then the next folder to the right. :: :: Likewise, packages and titles inside of folders are listed in top to :: bottom order, left to right, providing an exact textual description. :: :: Bare icons, not inside folders, are listed separately as a line item. :: :: This script not only provides a complete inventory of every package :: and title of every folder & icon on the homescreen, but it optionally :: will 'diff' against all packages installed by the user to indicate :: 'headless' apps which are installed, but which have no homescreen icon. :: :: Note the display_name is the current icon title for a given app icon, :: which can be changed by the user, so it's not always the original. :: However, for the apps installed by the user but sans homescreen icons, :: the optional lookup pulls the app's original defined Android app_label. :: ------------------------------------------------------------------------- -- On Usenet, we can pool our knowledge and skills so everyone learns more.
Re: Can we programmatically get package names of icons in a homescreen folder?
Author: Maria Sophia
Date: Sat, 21 Nov 2026 20:08
Date: Sat, 21 Nov 2026 20:08
60 lines
5145 bytes
5145 bytes
Maria Sophia wrote: > folder "time" Today I improved the output by creating a running log for archival. This is what the running log outputs now, where I also improved the output formatting to add pane and folder and display data. Unless the user wipes out the running log, this becomes an inventory of all the changes a user has made to the homescreen. ============================================================ Export: 2026-11-21 15:59:27 pane 1 folder "spoof" package_name display_name ------------ ------------ com.rasfar.mock.location Mocation com.discipleskies.mock_location_spoofer DS Fake GPS Location com.mock.cartage Cartage fake.gps.location.changer.spoof.location Fake GPS Location com.bomerapps.movablemockgps Movable Mock GPS ============================================================ Export: 2026-11-21 15:59:56 pane 0 folder "toon" package_name display_name ------------ ------------ com.lyrebirdstudio.cartoon ToonApp toontap.photoeditor.cartoon.cartoonphotoeditor ToonTap io.moonlighting.painnt Painnt com.wemagineai.voila Voila com.vicman.toonmeapp ToonMe vsin.t16_funny_photo PhotoLab com.lyrebirdstudio.toonart ToonArt com.gamebrain.cartoon Cartoon Photo gr.gamebrain.comica comica com.photoroom.app Photoroom ============================================================ Raw tab-delimited output saved to: "C:\app\editor\android\scrcpy\nova\output.txt" Formatted app list saved to: "C:\app\editor\android\scrcpy\nova\pane_1_-_sensor_apps.txt" Running export log saved to: "C:\app\editor\android\scrcpy\nova\adbfolder_log.txt" Here's a description of the latest improvements made today. :: ------------------------------------------------------------------------- :: v5p9 20261121 Reformatted folder and pane output with a descriptive :: heading and two-space indentation, and added a timestamped :: running log file that accumulates formatted exports :: v5p8 20261121 Renamed app_title output column to display_name to :: distinguish the current homescreen icon title from the :: original Android application label and reformatted output :: v5p7 20261121 Moved the restore option to the local-file-path section :: v5p6 20261121 Improved comments and explanations and user prompts :: v5p5 20261120 Added option to open Nova Launcher settings on the device :: to create a fresh homescreen backup before listing/pulling -- On Usenet, we can pool our knowledge and skills so everyone learns more.
Re: Can we programmatically get package names of icons in a homescreen folder?
Author: Maria Sophia
Date: Sat, 21 Nov 2026 20:12
Date: Sat, 21 Nov 2026 20:12
1082 lines
51613 bytes
51613 bytes
:: -------------------------------------------------------------------------
:: adbfolder.bat
:: -------------------------------------------------------------------------
:: Outputs a perfect textual inventory, with debug capability, of an Android
:: homescreen, including location of all panes, folders, packages and titles.
::
:: Intended to assist in debugging, inventory, archival, backup and restore.
:: Runs on Windows over Wi-Fi/USB, but can be ported to other platforms.
::
:: Will pull a backup from android via adb or read an existing nova db or
:: nova backup archive on windows needing only adb and sql dependencies
::
:: List order is top to bottom, left to right, meaning the leftmost pane
:: is 1st, the topleft folder is 1st, then the next folder to the right.
::
:: Likewise, packages and titles inside of folders are listed in top to
:: bottom order, left to right, providing an exact textual description.
::
:: Bare icons, not inside folders, are listed separately as a line item.
::
:: This script not only provides a complete inventory of every package
:: and title of every folder & icon on the homescreen, but it optionally
:: will 'diff' against all packages installed by the user to indicate
:: 'headless' apps which are installed, but which have no homescreen icon.
::
:: Note the display_name is the current icon title for a given app icon,
:: which can be changed by the user, so it's not always the original.
:: However, for apps installed by the user but without homescreen icons,
:: the optional lookup pulls the app's original defined Android app_label.
::
:: Output is appended to a timestamped running-log file for inventory use.
:: -------------------------------------------------------------------------
:: v5p9 20261121 Reformatted folder and pane output with a descriptive
:: heading and two-space indentation, and added a timestamped
:: running log file that accumulates formatted exports
:: v5p8 20261121 Renamed app_title output column to display_name to
:: distinguish the current homescreen icon title from the
:: original Android application label and reformatted output
:: v5p7 20261121 Moved the restore option to the local-file-path section
:: v5p6 20261121 Improved comments and explanations and user prompts
:: v5p5 20261120 Added option to open Nova Launcher settings on the device
:: to create a fresh homescreen backup before listing/pulling
:: v5p4 20261120 Appended a step-by-step flow description at the bottom
:: v5p3 20261120 Fixed too many syntax issues to count between versions
:: Moved per-pane scanning into a :scan_pane subroutine and
:: cleaned up SQL/batch parsing in the pane loop so menu
:: scanning runs without cmd.exe syntax errors
:: v4p5 20261119 Fixed loose apps package_name extraction in :run_query
:: when component= has no slash or uses package=
:: v4p4 20261119 Replaced "filter" / "filtered" in comments with what the
:: code actually does
:: v4p3 20261119 Kept loose apps with all item types except itemType != 2 and
:: removed parentheses from comment lines across the script
:: v4p2 20261119 Removed extra iconPackage/component= check on loose apps
:: so all non-folder items itemType != 2 on a pane are
:: included without dropping rows
:: v4p1 20261119 Restricted loose apps count and query to items that have a
:: non-empty iconPackage or component= in intent while keeping
:: all existing behavior, comments, and formatting intact
:: v4p0 20261119 Gave up on trying to eliminate empty lines from PowerShell
:: in the optional orphan-packages-with-no-launch icon listing
:: so v4p0 is an exact duplicate of v3p6 which has blank lines
:: v3p9 20261119 Moved menu scanning, SQLite querying, table formatting,
:: and unplaced -3 package diffing into a dedicated PowerShell
:: engine script so cmd.exe never hits block/caret/quote errors
:: and fixed looseapps condition to itemType <> 2 and set DEBUG=0
:: v3p8 20261119 Formatted unplaced user app table directly in PS_DIFF_3P
:: instead of Format-Table to remove blank lines between rows
:: v3p7 20261119 Fixed missing package_name in :run_query by replacing !=
:: with LENGTH/TRIM checks and guarding SUBSTR against missing
:: slashes and fixed pane loose apps SQL_WHERE to f.itemType <> 2
:: v3p6 20261119 Added optional prompt before resolving Nova f.title names
:: in check_missing_3p and printed periodic progress while
:: resolving labels so quick checks finish immediately
:: v3p5 20261119 Removed stray caret escaping before closing parentheses on
:: standalone PS_DIFF_3P echo lines so PowerShell parses the
:: generated script cleanly, and kept DEBUG=1 enabled
:: v3p4 20261119 Added app label lookup via adb dumpsys and optional aapt/aapt2
:: for unplaced user apps in check_missing_3p and set DEBUG=0
:: as the default flag
:: v3p3 20261119 Replaced != with LENGTH/TRIM checks in Nova package SQL
:: query so cmd delayed expansion does not strip negation
:: and handled component= values without a slash safely
:: v3p2 20261119 Wrote Nova package SQL query to a temp .sql file to avoid
:: cmd parsing syntax errors and wrote PS_DIFF_3P line-by-line
:: instead of using an outer parenthesized block
:: v3p1 20261119 Insrumented the orphan section as it was throwing errors
:: v3p0 20261119 Fixed command syntax error when generating the PowerShell
:: diff script in check_missing_3p and wrapped the Nova
:: package query in a subquery so package_name matches cleanly
:: v2p9 20261119 Added a final sanity check before quitting to compare
:: the list of packages that have icons on the homescreen
:: against all the user-installed packages on the phone
:: to create an orphan-packages file that have no icons
:: v2p8 20261119 Added quit option at folder selection prompt and loop back
:: prompt at end to export another folder or pane
:: v2p7 20261119 Replaced fragile DISTINCT screen loop with explicit pane
:: index pass 0 to 9 using CAST screen AS INTEGER so panes
:: with folders or loose apps always appear in order
:: v2p6 20261119 Fixed pane screen query so folders on pane 0, pane 1 and
:: pane 2 display properly along with loose pane apps and other
:: v2p5 20261119 Grouped folders by screen number across panes and kept
:: unmatched folders under other at the bottom
:: v2p4 20261119 Added loose apps choice at the end of each pane with
:: non-folder items and kept other catch-all at the bottom
:: v2p3 20261119 Listed folders under dock and each pane with no default
:: and skipped empty sections
:: v2p2 20261119 Added full-layout option outputting dock and pane headers
:: with package_name and app_title lines
:: v2p1 20261119 Replaced backtick for /f calls on DOCK_TOTAL and PANE_TOTAL
:: with temp file redirects so cmd reliably captures counts
:: v2p0 20261119 Removed ampersand and parenthesis inside comment labels
:: as labels are not comments even though they act like them
:: v1p9 20261119 Removed item_type column from output and grouped folders
:: by their homescreen pane eg, "Pane 0 Folder: weather"
:: v1p8 20261119 Dynamically lists dock, eg, container = -101, and lists
:: homescreen panes by screen number, eg, container = -100,
:: and by named folders eg, itemType = 2, from nova db
:: and includes item_type in output
:: v1p7 20261119 Searches android storage for * novabackup files when none
:: are found in ANDROID_BCK_DIR, storing full remote paths so
:: backups in any folder can be pulled cleanly
:: v1p6 20261119 Set DEBUG=0 by default for clean normal output while keeping
:: the toggle available for troubleshooting
:: v1p5 20261119 Reversed output columns to package_name first, app_title
:: second and added startup dependency check for adb and
:: sqlite3 dependency checking configured paths and PATH
:: v1p4 20261119 Moved powershell commands into %TEMP%\* ps1 scripts run via
:: "-File" instead of backticks so cmd never parses "<" or ">"
:: v1p3 20261119 Added DEBUG=1 instrumentation
:: v1p2 20261119 Replaced cmd FOR sanitizer with powershell
:: v1p1 20261119 Numbered selection menu for novabackup files, lists folders
:: by name with numbered selection instead of raw container IDs
:: v1p0 20261119 Initial version to pull backup or use local nova db, query
:: sql via sqlite3 exe, select columns with powershell
:: -------------------------------------------------------------------------
@echo off
setlocal enabledelayedexpansion
cd /d "%~dp0"
:: --- Debug flag 1 = verbose DEBUG traces, 0 = quiet ---
set "DEBUG=0"
:: set "DEBUG=1"
:: --- Configurable paths ---
set "ADB_EXE=C:\app\editor\android\scrcpy\adb.exe"
set "SQLITE_EXE=C:\app\editor\android\sdk\platform-tools\sqlite3.exe"
set "WORK_DIR=C:\app\editor\android\scrcpy\nova"
set "ANDROID_BCK_DIR=/storage/emulated/0/0000/bck/nova_backup"
set "DEFAULT_CONTAINER=2921"
if "%DEBUG%"=="1" (
echo [DEBUG] SCRIPT_DIR="%~dp0"
echo [DEBUG] CD="%CD%"
echo [DEBUG] ADB_EXE="%ADB_EXE%"
echo [DEBUG] SQLITE_EXE="%SQLITE_EXE%"
echo [DEBUG] WORK_DIR="%WORK_DIR%"
)
:: -------------------------------------------------------------------------
:: Startup dependency and PATH check for adb exe and sqlite3 exe
:: -------------------------------------------------------------------------
echo Checking required tools (adb and sqlite3) ...
set "PATH_ADB="
for /f "usebackq delims=" %%W in (`where adb 2^>nul`) do (
if "!PATH_ADB!"=="" set "PATH_ADB=%%W"
)
set "PATH_SQLITE="
for /f "usebackq delims=" %%W in (`where sqlite3 2^>nul`) do (
if "!PATH_SQLITE!"=="" set "PATH_SQLITE=%%W"
)
if "%DEBUG%"=="1" (
echo [DEBUG] PATH_ADB="!PATH_ADB!"
echo [DEBUG] PATH_SQLITE="!PATH_SQLITE!"
)
:: Prefer configured path if it exists, otherwise fall back to PATH
if not exist "%ADB_EXE%" (
if not "!PATH_ADB!"=="" (
echo [INFO] Configured ADB_EXE not found; using PATH: "!PATH_ADB!"
set "ADB_EXE=!PATH_ADB!"
) else (
echo [WARN] adb.exe not found at "%ADB_EXE%" and not in PATH.
)
) else if "!PATH_ADB!"=="" (
echo [INFO] adb.exe found at configured path, though not in PATH.
)
if not exist "%SQLITE_EXE%" (
if not "!PATH_SQLITE!"=="" (
echo [INFO] Configured SQLITE_EXE not found; using PATH: "!PATH_SQLITE!"
set "SQLITE_EXE=!PATH_SQLITE!"
) else (
echo [ERROR] sqlite3.exe not found at "%SQLITE_EXE%" and not in PATH.
pause
exit /b 1
)
) else if "!PATH_SQLITE!"=="" (
echo [INFO] sqlite3.exe found at configured path, though not in PATH.
)
if not exist "%WORK_DIR%" mkdir "%WORK_DIR%"
echo Working directory: "%CD%"
echo Nova work directory: "%WORK_DIR%"
echo ----------------
echo.
echo Select source for Nova Launcher database:
echo [1] Pull .novabackup from Android via ADB and extract nova.db [Default]
echo [2] Use an existing nova.db or .novabackup or .zip already on Windows
echo.
set "SRC_CHOICE=1"
set /p "SRC_CHOICE=Enter choice [1 or 2]: "
if "%DEBUG%"=="1" echo [DEBUG] SRC_CHOICE="!SRC_CHOICE!"
if "%SRC_CHOICE%"=="2" goto :use_local_source
if "%SRC_CHOICE%"=="1" goto :pull_from_android
goto :pull_from_android
:: -------------------------------------------------------------------------
:: Option 1: Pull backup from android via adb
:: -------------------------------------------------------------------------
:pull_from_android
echo.
echo --- Pull Nova Backup from Android ---
if not exist "%ADB_EXE%" (
echo [ERROR] adb.exe not found at: "%ADB_EXE%"
pause
exit /b 1
)
set "ADB_TARGET="
for /f "skip=1 tokens=1" %%g in ('"%ADB_EXE%" devices') do (
if not "%%g"=="" (
if "!ADB_TARGET!"=="" set "ADB_TARGET=%%g"
)
)
if "%DEBUG%"=="1" echo [DEBUG] ADB_TARGET="!ADB_TARGET!"
if "!ADB_TARGET!"=="" (
echo [ERROR] No connected ADB devices found.
pause
exit /b 1
)
:: beginning of changes in v5p5
echo Targeting device: %ADB_TARGET%
set "MAKE_BCK="
set /p "MAKE_BCK=Open Nova Launcher settings on device to create a new backup first? [y/N]: "
if /i "!MAKE_BCK!"=="y" (
echo Launching Nova Launcher settings on %ADB_TARGET% ...
echo "Tap Backup & restore > Backup > Save to save to your device"
"%ADB_EXE%" -s %ADB_TARGET% shell am start -n com.teslacoilsw.launcher/com.teslacoilsw.launcher.preferences.SettingsActivity
echo Create your backup in Nova Launcher on the device, then press ENTER to list backups.
pause
)
echo Listing backups in %ANDROID_BCK_DIR% ...
echo.
:: ending of changes in v5p5
"%ADB_EXE%" -s %ADB_TARGET% shell ls -1t "%ANDROID_BCK_DIR%/*.novabackup" 2>nul > "%TEMP%\nova_backups.txt"
if "%DEBUG%"=="1" (
echo [DEBUG] ls exit errorlevel=!errorlevel!
echo [DEBUG] Raw %TEMP%\nova_backups.txt contents:
type "%TEMP%\nova_backups.txt" 2>nul
)
set "BCK_COUNT=0"
for /f "usebackq delims=" %%B in ("%TEMP%\nova_backups.txt") do (
set "LINE=%%B"
if not "!LINE!"=="" (
set "LINE=!LINE:^M=!"
for %%F in ("!LINE!") do set "FNAME=%%~nxF"
set /a BCK_COUNT+=1
set "BCK_ITEM_!BCK_COUNT!=!FNAME!"
set "BCK_PATH_!BCK_COUNT!=!LINE!"
echo [!BCK_COUNT!] !FNAME!
if "%DEBUG%"=="1" (
echo [DEBUG] BCK_ITEM_!BCK_COUNT!="!FNAME!"
echo [DEBUG] BCK_PATH_!BCK_COUNT!="!LINE!"
)
)
)
del "%TEMP%\nova_backups.txt" >nul 2>&1
if %BCK_COUNT% EQU 0 (
echo [INFO] No .novabackup files found in %ANDROID_BCK_DIR%.
echo Searching Android storage for *.novabackup files ...
echo.
"%ADB_EXE%" -s %ADB_TARGET% shell "for d in /storage/emulated/0 /storage/*; do [ -d \"\$d\" ] && [ \"\$d\" != \"/storage/emulated\" ] && find \"\$d\" -maxdepth 5 -name '*.novabackup' 2>/dev/null; done" 2>nul > "%TEMP%\nova_backups_search.txt"
if "%DEBUG%"=="1" (
echo [DEBUG] Search exit errorlevel=!errorlevel!
echo [DEBUG] Raw %TEMP%\nova_backups_search.txt contents:
type "%TEMP%\nova_backups_search.txt" 2>nul
)
for /f "usebackq delims=" %%S in ("%TEMP%\nova_backups_search.txt") do (
set "LINE=%%S"
if not "!LINE!"=="" (
set "LINE=!LINE:^M=!"
for %%F in ("!LINE!") do set "FNAME=%%~nxF"
set /a BCK_COUNT+=1
set "BCK_ITEM_!BCK_COUNT!=!FNAME!"
set "BCK_PATH_!BCK_COUNT!=!LINE!"
echo [!BCK_COUNT!] !LINE!
if "%DEBUG%"=="1" (
echo [DEBUG] BCK_ITEM_!BCK_COUNT!="!FNAME!"
echo [DEBUG] BCK_PATH_!BCK_COUNT!="!LINE!"
)
)
)
del "%TEMP%\nova_backups_search.txt" >nul 2>&1
)
if %BCK_COUNT% EQU 0 (
echo [WARN] No .novabackup files found in %ANDROID_BCK_DIR% or Android storage.
:manual_bck
set "BCK_FILE="
set /p "BCK_FILE=Enter backup filename or full Android path e.g. 2026-11-19_12-57.novabackup: "
if "!BCK_FILE!"=="" (
echo [ERROR] No backup filename provided.
pause
exit /b 1
)
set "BCK_FILE=!BCK_FILE:"=!"
set "REMOTE_BCK=!BCK_FILE!"
if not "!REMOTE_BCK:~0,1!"=="/" set "REMOTE_BCK=%ANDROID_BCK_DIR%/!BCK_FILE!"
for %%F in ("!REMOTE_BCK!") do set "BCK_FILE=%%~nxF"
goto :pull_selected_backup
)
echo.
set "BCK_PICK=1"
set /p "BCK_PICK=Select backup number [1-%BCK_COUNT%, Default: 1]: "
if "!BCK_PICK!"=="" set "BCK_PICK=1"
if "%DEBUG%"=="1" echo [DEBUG] BCK_PICK="!BCK_PICK!"
set "BCK_FILE="
set "REMOTE_BCK="
for /l %%N in (1,1,%BCK_COUNT%) do (
if "!BCK_PICK!"=="%%N" (
set "BCK_FILE=!BCK_ITEM_%%N!"
set "REMOTE_BCK=!BCK_PATH_%%N!"
)
)
if "!BCK_FILE!"=="" (
set "CANDIDATE=!BCK_PICK:"=!"
set "REMOTE_BCK=!CANDIDATE!"
if not "!REMOTE_BCK:~0,1!"=="/" set "REMOTE_BCK=%ANDROID_BCK_DIR%/!CANDIDATE!"
for %%F in ("!REMOTE_BCK!") do set "BCK_FILE=%%~nxF"
)
if "%DEBUG%"=="1" (
echo [DEBUG] BCK_FILE="!BCK_FILE!"
echo [DEBUG] REMOTE_BCK="!REMOTE_BCK!"
)
:pull_selected_backup
set "LOCAL_BCK=%WORK_DIR%\%BCK_FILE%"
set "LOCAL_ZIP=%WORK_DIR%\backup.zip"
set "EXTRACT_DIR=%WORK_DIR%\backup_extracted"
echo.
echo Pulling "%REMOTE_BCK%" to "%LOCAL_BCK%" ...
"%ADB_EXE%" -s %ADB_TARGET% pull "%REMOTE_BCK%" "%LOCAL_BCK%"
if errorlevel 1 (
echo [ERROR] Failed to pull backup from Android.
pause
exit /b 1
)
if exist "%LOCAL_ZIP%" del /f /q "%LOCAL_ZIP%"
ren "%LOCAL_BCK%" "backup.zip"
if errorlevel 1 (
echo [ERROR] Failed to rename "%LOCAL_BCK%" to backup.zip.
pause
exit /b 1
)
if exist "%EXTRACT_DIR%" rmdir /s /q "%EXTRACT_DIR%"
echo Extracting backup.zip to "%EXTRACT_DIR%" ...
powershell -NoProfile -Command "Expand-Archive -LiteralPath '%LOCAL_ZIP%' -DestinationPath '%EXTRACT_DIR%' -Force"
if errorlevel 1 (
echo [ERROR] Failed to extract backup.zip.
pause
exit /b 1
)
set "DB_PATH=%EXTRACT_DIR%\nova.db"
goto :verify_db
:: -------------------------------------------------------------------------
:: Option 2: Use local nova db or novabackup or zip
:: -------------------------------------------------------------------------
:use_local_source
echo.
echo --- Local Database Selection ---
echo Enter the path to nova.db or a .novabackup or .zip file.
echo Default: "%WORK_DIR%\backup_extracted\nova.db"
echo.
:ask_local_db
set "USER_DB="
set /p "USER_DB=Path to database or backup file [Enter for default]: "
if "!USER_DB!"=="" (
set "DB_PATH=%WORK_DIR%\backup_extracted\nova.db"
) else (
set "USER_DB=!USER_DB:"=!"
for %%A in ("!USER_DB!") do set "DB_PATH=%%~fA"
)
if not exist "%DB_PATH%" (
echo [ERROR] File not found: "%DB_PATH%"
set "RETRY="
set /p "RETRY=Try again? [Y/n]: "
if /i "!RETRY!"=="n" exit /b 1
goto :ask_local_db
)
for %%E in ("%DB_PATH%") do set "EXT=%%~xE"
if /i "!EXT!"==".novabackup" goto :local_novabackup
if /i "!EXT!"==".zip" goto :extract_local_archive
goto :verify_db
:local_novabackup
echo.
set "RESTORE_LOCAL="
set /p "RESTORE_LOCAL=Restore this backup in Nova on the connected device? [y/N]: "
if /i not "!RESTORE_LOCAL!"=="y" goto :extract_local_archive
if not exist "%ADB_EXE%" (
echo [ERROR] adb.exe not found at "%ADB_EXE%"; cannot send the backup to the device.
pause
exit /b 1
)
set "RESTORE_TARGET="
for /f "skip=1 tokens=1" %%g in ('"%ADB_EXE%" devices') do (
if not "%%g"=="" (
if "!RESTORE_TARGET!"=="" set "RESTORE_TARGET=%%g"
)
)
if "!RESTORE_TARGET!"=="" (
echo [ERROR] No connected ADB device found; cannot restore the backup.
pause
exit /b 1
)
set "NOVA_BACKUP_DIR=/storage/emulated/0/Android/data/com.teslacoilsw.launcher/files/Backup"
echo Copying "%DB_PATH%" to Nova's backup folder on !RESTORE_TARGET! ...
"%ADB_EXE%" -s !RESTORE_TARGET! shell mkdir -p "%NOVA_BACKUP_DIR%"
if errorlevel 1 (
echo [ERROR] Could not create Nova's backup folder on the device.
pause
exit /b 1
)
"%ADB_EXE%" -s !RESTORE_TARGET! push "%DB_PATH%" "%NOVA_BACKUP_DIR%/"
if errorlevel 1 (
echo [ERROR] Failed to copy the backup to the device.
pause
exit /b 1
)
echo Launching Nova Launcher settings on !RESTORE_TARGET! ...
"%ADB_EXE%" -s !RESTORE_TARGET! shell am start -n com.teslacoilsw.launcher/com.teslacoilsw.launcher.preferences.SettingsActivity
echo In Nova, choose Backup & restore and restore the backup you copied.
goto :extract_local_archive
:extract_local_archive
set "EXTRACT_DIR=%WORK_DIR%\backup_extracted"
if exist "%EXTRACT_DIR%" rmdir /s /q "%EXTRACT_DIR%"
echo Extracting "%DB_PATH%" to "%EXTRACT_DIR%" ...
powershell -NoProfile -Command "Expand-Archive -LiteralPath '%DB_PATH%' -DestinationPath '%EXTRACT_DIR%' -Force"
if errorlevel 1 (
echo [ERROR] Failed to extract archive.
pause
exit /b 1
)
set "DB_PATH=%EXTRACT_DIR%\nova.db"
:: -------------------------------------------------------------------------
:: Verify database and list dock, panes, folders and other
:: -------------------------------------------------------------------------
:verify_db
if not exist "%DB_PATH%" (
echo [ERROR] nova.db not found at: "%DB_PATH%"
pause
exit /b 1
)
echo.
echo Using database: "%DB_PATH%"
echo Scanning Nova Launcher dock, panes and folders ...
echo.
set "TGT_COUNT=0"
set "LISTED_FOLDER_IDS=,"
:: 1 Dock section first as [1] dock apps plus dock folders if any
echo dock
set /a TGT_COUNT+=1
set "TGT_LABEL_!TGT_COUNT!=dock apps"
set "TGT_WHERE_!TGT_COUNT!=f.container = -101"
set "TGT_ORDER_!TGT_COUNT!=f.screen, f.cellY, f.cellX, f.rank, f._id"
echo [!TGT_COUNT!] dock apps
"%SQLITE_EXE%" -cmd ".separator |" "%DB_PATH%" "SELECT _id, CASE WHEN title IS NULL OR TRIM(title) = '' THEN '(Untitled Folder)' ELSE title END FROM favorites WHERE itemType = 2 AND container = -101 ORDER BY cellY, cellX, rank, _id;" > "%TEMP%\nova_dock_folders.txt" 2>nul
for /f "usebackq tokens=1* delims=|" %%A in ("%TEMP%\nova_dock_folders.txt") do (
set "FID=%%A"
set "FNAME=%%B"
set "FNAME=!FNAME:^M=!"
if not "!FID!"=="" (
set /a TGT_COUNT+=1
set "TGT_LABEL_!TGT_COUNT!=dock - !FNAME!"
set "TGT_WHERE_!TGT_COUNT!=f.container = !FID!"
set "TGT_ORDER_!TGT_COUNT!=f.rank, f._id"
set "LISTED_FOLDER_IDS=!LISTED_FOLDER_IDS!!FID!,"
echo [!TGT_COUNT!] !FNAME!
)
)
del "%TEMP%\nova_dock_folders.txt" >nul 2>&1
:: 2 Panes 0 to 14 with folders and loose apps via :scan_pane subroutine
for /l %%P in (0,1,14) do (
call :scan_pane %%P
)
:: 3 Other folders not already listed under dock or a pane
"%SQLITE_EXE%" -cmd ".separator |" "%DB_PATH%" "SELECT _id, CASE WHEN title IS NULL OR TRIM(title) = '' THEN '(Untitled Folder)' ELSE title END FROM favorites WHERE itemType = 2 ORDER BY LOWER(title), _id;" > "%TEMP%\nova_other_folders.txt" 2>nul
set "OTHER_HAS_FOLDERS=0"
for /f "usebackq tokens=1* delims=|" %%A in ("%TEMP%\nova_other_folders.txt") do (
set "FID=%%A"
set "FNAME=%%B"
set "FNAME=!FNAME:^M=!"
if not "!FID!"=="" (
echo !LISTED_FOLDER_IDS! | findstr /c:",!FID!," >nul
if errorlevel 1 (
if "!OTHER_HAS_FOLDERS!"=="0" (
echo other
set "OTHER_HAS_FOLDERS=1"
)
set /a TGT_COUNT+=1
set "TGT_LABEL_!TGT_COUNT!=other - !FNAME!"
set "TGT_WHERE_!TGT_COUNT!=f.container = !FID!"
set "TGT_ORDER_!TGT_COUNT!=f.rank, f._id"
echo [!TGT_COUNT!] !FNAME!
)
)
)
del "%TEMP%\nova_other_folders.txt" >nul 2>&1
echo.
set "TGT_PICK="
:: Allow q or 0 to quit cleanly without running a query
set /p "TGT_PICK=Select number [1-%TGT_COUNT%, q to quit]: "
if "%DEBUG%"=="1" echo [DEBUG] TGT_PICK="!TGT_PICK!"
if /i "!TGT_PICK!"=="q" goto :check_missing_3p
if "!TGT_PICK!"=="0" goto :check_missing_3p
set "SELECTED_LABEL="
set "SQL_WHERE="
set "SQL_ORDER="
for /l %%N in (1,1,%TGT_COUNT%) do (
if "!TGT_PICK!"=="%%N" (
set "SELECTED_LABEL=!TGT_LABEL_%%N!"
set "SQL_WHERE=!TGT_WHERE_%%N!"
set "SQL_ORDER=!TGT_ORDER_%%N!"
)
)
if "%DEBUG%"=="1" (
echo [DEBUG] SELECTED_LABEL="!SELECTED_LABEL!"
echo [DEBUG] SQL_WHERE="!SQL_WHERE!"
echo [DEBUG] SQL_ORDER="!SQL_ORDER!"
)
if "!SQL_WHERE!"=="" (
echo [ERROR] Invalid selection: "!TGT_PICK!"
pause
exit /b 1
)
:run_query
if "%DEBUG%"=="1" echo [DEBUG] Entering :run_query
:: Write label character replacer ps1 to %TEMP% so cmd never parses regex characters
set "PS_SANITIZE=%TEMP%\adbfolder_sanitize.ps1"
set "SAFE_NAME_FILE=%TEMP%\adbfolder_safename.txt"
> "%PS_SANITIZE%" echo $raw = $env:SELECTED_LABEL
>> "%PS_SANITIZE%" echo $s = [regex]::Replace($raw, '[\\/:*?"<>|() ]+', '_')
>> "%PS_SANITIZE%" echo $s = $s.Trim('_')
>> "%PS_SANITIZE%" echo if ([string]::IsNullOrWhiteSpace($s)) { $s = "nova_target" }
>> "%PS_SANITIZE%" echo [System.IO.File]::WriteAllText($env:SAFE_NAME_FILE, $s, (New-Object System.Text.UTF8Encoding($false)))
if "%DEBUG%"=="1" (
echo [DEBUG] Wrote "%PS_SANITIZE%"
echo [DEBUG] Running character replacer PowerShell script...
)
powershell -NoProfile -ExecutionPolicy Bypass -File "%PS_SANITIZE%"
if "%DEBUG%"=="1" echo [DEBUG] Character replacer exit errorlevel=!errorlevel!
set "SAFE_NAME="
if exist "%SAFE_NAME_FILE%" (
for /f "usebackq delims=" %%S in ("%SAFE_NAME_FILE%") do set "SAFE_NAME=%%S"
)
if "!SAFE_NAME!"=="" set "SAFE_NAME=nova_target"
del "%PS_SANITIZE%" >nul 2>&1
del "%SAFE_NAME_FILE%" >nul 2>&1
if "%DEBUG%"=="1" echo [DEBUG] SAFE_NAME="!SAFE_NAME!"
set "RAW_OUT=%WORK_DIR%\output.txt"
set "CLEAN_OUT=%WORK_DIR%\%SAFE_NAME%_apps.txt"
set "LOG_OUT=%WORK_DIR%\adbfolder_log.txt"
set "SQL_QUERY_FILE=%TEMP%\adbfolder_query.sql"
if "%DEBUG%"=="1" (
echo [DEBUG] RAW_OUT="%RAW_OUT%"
echo [DEBUG] CLEAN_OUT="%CLEAN_OUT%"
echo [DEBUG] SQL_QUERY_FILE="%SQL_QUERY_FILE%"
)
echo.
echo Querying "!SELECTED_LABEL!" ...
> "%SQL_QUERY_FILE%" echo .header on
>> "%SQL_QUERY_FILE%" echo .mode tabs
>> "%SQL_QUERY_FILE%" echo SELECT f._id AS item_id,
>> "%SQL_QUERY_FILE%" echo f.title AS display_name,
>> "%SQL_QUERY_FILE%" echo CASE
>> "%SQL_QUERY_FILE%" echo WHEN f.iconPackage IS NOT NULL AND LENGTH(TRIM(f.iconPackage^)^) ^> 0 THEN TRIM(f.iconPackage^)
>> "%SQL_QUERY_FILE%" echo WHEN INSTR(f.intent, 'component='^) ^> 0 THEN
>> "%SQL_QUERY_FILE%" echo CASE
>> "%SQL_QUERY_FILE%" echo WHEN INSTR(SUBSTR(f.intent, INSTR(f.intent, 'component='^) + 10^), '/'^) ^> 0 THEN SUBSTR(SUBSTR(f.intent, INSTR(f.intent, 'component='^) + 10^), 1, INSTR(SUBSTR(f.intent, INSTR(f.intent, 'component='^) + 10^), '/'^) - 1^)
>> "%SQL_QUERY_FILE%" echo WHEN INSTR(SUBSTR(f.intent, INSTR(f.intent, 'component='^) + 10^), ';'^) ^> 0 THEN SUBSTR(SUBSTR(f.intent, INSTR(f.intent, 'component='^) + 10^), 1, INSTR(SUBSTR(f.intent, INSTR(f.intent, 'component='^) + 10^), ';'^) - 1^)
>> "%SQL_QUERY_FILE%" echo ELSE SUBSTR(f.intent, INSTR(f.intent, 'component='^) + 10^)
>> "%SQL_QUERY_FILE%" echo END
>> "%SQL_QUERY_FILE%" echo WHEN INSTR(f.intent, 'package='^) ^> 0 THEN
>> "%SQL_QUERY_FILE%" echo CASE
>> "%SQL_QUERY_FILE%" echo WHEN INSTR(SUBSTR(f.intent, INSTR(f.intent, 'package='^) + 8^), ';'^) ^> 0 THEN SUBSTR(SUBSTR(f.intent, INSTR(f.intent, 'package='^) + 8^), 1, INSTR(SUBSTR(f.intent, INSTR(f.intent, 'package='^) + 8^), ';'^) - 1^)
>> "%SQL_QUERY_FILE%" echo ELSE SUBSTR(f.intent, INSTR(f.intent, 'package='^) + 8^)
>> "%SQL_QUERY_FILE%" echo END
>> "%SQL_QUERY_FILE%" echo ELSE ''
>> "%SQL_QUERY_FILE%" echo END AS package_name,
>> "%SQL_QUERY_FILE%" echo f.intent
>> "%SQL_QUERY_FILE%" echo FROM favorites f
>> "%SQL_QUERY_FILE%" echo WHERE !SQL_WHERE!
>> "%SQL_QUERY_FILE%" echo ORDER BY !SQL_ORDER!;
"%SQLITE_EXE%" "%DB_PATH%" < "%SQL_QUERY_FILE%" > "%RAW_OUT%"
if "%DEBUG%"=="1" (
echo [DEBUG] sqlite3 query exit errorlevel=!errorlevel!
echo [DEBUG] Raw %RAW_OUT% line count:
find /c /v "" "%RAW_OUT%" 2>nul
)
del "%SQL_QUERY_FILE%" >nul 2>&1
if errorlevel 1 (
echo [ERROR] SQLite query failed.
pause
exit /b 1
)
:: Write column formatter ps1 to %TEMP%
:: Add pane/folder heading, indent spaces and append to log
set "PS_FORMAT=%TEMP%\adbfolder_format.ps1"
if exist "%PS_FORMAT%" del /f /q "%PS_FORMAT%" >nul 2>&1
>> "%PS_FORMAT%" echo $rawFile = $env:RAW_OUT
>> "%PS_FORMAT%" echo $cleanFile = $env:CLEAN_OUT
>> "%PS_FORMAT%" echo $logFile = $env:LOG_OUT
>> "%PS_FORMAT%" echo $label = $env:SELECTED_LABEL
>> "%PS_FORMAT%" echo $rows = Import-Csv -LiteralPath $rawFile -Delimiter "`t"
>> "%PS_FORMAT%" echo $lines = $rows ^| Select-Object package_name, display_name ^| Format-Table -AutoSize ^| Out-String -Width 4096
>> "%PS_FORMAT%" echo $tableLines = @($lines -split "`r?`n" ^| ForEach-Object { $_.TrimEnd() } ^| Where-Object { $_ -ne '' })
>> "%PS_FORMAT%" echo $header = " $label"
>> "%PS_FORMAT%" echo if ($label -match '^pane\s+(\d+)\s+-\s+(.+)$') { $header = (' pane {0} folder "{1}"' -f $Matches[1], $Matches[2]) }
>> "%PS_FORMAT%" echo $body = ($tableLines ^| ForEach-Object { ' ' + $_ }) -join "`r`n"
>> "%PS_FORMAT%" echo $clean = $header + "`r`n" + $body + "`r`n"
>> "%PS_FORMAT%" echo $utf8 = New-Object System.Text.UTF8Encoding($false)
>> "%PS_FORMAT%" echo [System.IO.File]::WriteAllText($cleanFile, $clean, $utf8)
>> "%PS_FORMAT%" echo $timestamp = Get-Date -Format 'yyyy-MM-dd HH:mm:ss'
>> "%PS_FORMAT%" echo $entry = "`r`n============================================================`r`nExport: $timestamp`r`n$clean"
>> "%PS_FORMAT%" echo [System.IO.File]::AppendAllText($logFile, $entry, $utf8)
if "%DEBUG%"=="1" echo [DEBUG] Running formatter PowerShell script "%PS_FORMAT%"...
powershell -NoProfile -ExecutionPolicy Bypass -File "%PS_FORMAT%"
if "%DEBUG%"=="1" echo [DEBUG] PowerShell formatter exit errorlevel=!errorlevel!
del "%PS_FORMAT%" >nul 2>&1
if errorlevel 1 (
echo [ERROR] Failed to format output columns or append running log.
pause
exit /b 1
)
echo.
echo --- Result (%CLEAN_OUT%) ---
echo.
type "%CLEAN_OUT%"
echo.
echo Raw tab-delimited output saved to: "%RAW_OUT%"
echo Formatted app list saved to: "%CLEAN_OUT%"
echo Running export log saved to: "%LOG_OUT%"
echo.
:: Loop back to menu so user can export another folder or pane
set "LOOP_MORE="
set /p "LOOP_MORE=Export another folder or pane? [y/N]: "
if /i "!LOOP_MORE!"=="y" goto :verify_db
:: -------------------------------------------------------------------------
:: End-of-run check for third-party packages -3 missing from nova.db
:: -------------------------------------------------------------------------
:check_missing_3p
echo.
set "CHECK_3P="
set /p "CHECK_3P=Check user apps -3 with no icon in Nova before quitting? [y/N]: "
if /i not "!CHECK_3P!"=="y" goto :quit_script
if "%DEBUG%"=="1" (
echo [DEBUG] Entering :check_missing_3p
echo [DEBUG] ADB_EXE="%ADB_EXE%"
echo [DEBUG] SQLITE_EXE="%SQLITE_EXE%"
echo [DEBUG] DB_PATH="%DB_PATH%"
echo [DEBUG] ADB_TARGET="%ADB_TARGET%"
)
if not exist "%ADB_EXE%" (
echo [INFO] adb.exe not found at "%ADB_EXE%"; skipping device package check.
goto :quit_script
)
set "RUN_ADB_TARGET=%ADB_TARGET%"
if "!RUN_ADB_TARGET!"=="" (
for /f "skip=1 tokens=1" %%g in ('"%ADB_EXE%" devices') do (
if not "%%g"=="" (
if "!RUN_ADB_TARGET!"=="" set "RUN_ADB_TARGET=%%g"
)
)
)
if "%DEBUG%"=="1" echo [DEBUG] RUN_ADB_TARGET="!RUN_ADB_TARGET!"
if "!RUN_ADB_TARGET!"=="" (
echo [INFO] No connected ADB device found; skipping device package check.
goto :quit_script
)
if not exist "%DB_PATH%" (
echo [INFO] Nova database not available at "%DB_PATH%"; skipping device package check.
goto :quit_script
)
set "RESOLVE_LABELS="
set /p "RESOLVE_LABELS=Resolve app titles via adb/aapt slower over Wi-Fi? [y/N]: "
set "DO_RESOLVE_LABELS=0"
if /i "!RESOLVE_LABELS!"=="y" set "DO_RESOLVE_LABELS=1"
if "%DEBUG%"=="1" echo [DEBUG] DO_RESOLVE_LABELS="!DO_RESOLVE_LABELS!"
set "PM_3P_FILE=%TEMP%\adbfolder_pm3.txt"
set "NOVA_PKGS_FILE=%TEMP%\adbfolder_nova_pkgs.txt"
set "UNPLACED_OUT=%WORK_DIR%\unplaced_user_apps.txt"
set "PS_DIFF_3P=%TEMP%\adbfolder_diff_3p.ps1"
:: v3p2: Write SQL to a temp .sql file so cmd does not parse SQL operators/quotes
set "SQL_NOVA_PKGS=%TEMP%\adbfolder_nova_pkgs.sql"
if "%DEBUG%"=="1" (
echo [DEBUG] PM_3P_FILE="!PM_3P_FILE!"
echo [DEBUG] NOVA_PKGS_FILE="!NOVA_PKGS_FILE!"
echo [DEBUG] UNPLACED_OUT="!UNPLACED_OUT!"
echo [DEBUG] PS_DIFF_3P="!PS_DIFF_3P!"
echo [DEBUG] SQL_NOVA_PKGS="!SQL_NOVA_PKGS!"
)
echo Querying third-party packages from device !RUN_ADB_TARGET! ...
if "%DEBUG%"=="1" echo [DEBUG] Running adb pm list packages -3...
"%ADB_EXE%" -s !RUN_ADB_TARGET! shell pm list packages -3 2>nul > "!PM_3P_FILE!"
if "%DEBUG%"=="1" (
echo [DEBUG] adb pm exit errorlevel=!errorlevel!
echo [DEBUG] PM_3P_FILE line count:
find /c /v "" "!PM_3P_FILE!" 2>nul
)
echo Querying packages referenced anywhere in nova.db ...
if "%DEBUG%"=="1" echo [DEBUG] Writing and running sqlite3 Nova package query from .sql file...
:: v3p3: Use LENGTH/TRIM checks instead of != so delayed expansion cannot drop negation
> "!SQL_NOVA_PKGS!" echo SELECT DISTINCT package_name
>> "!SQL_NOVA_PKGS!" echo FROM (
>> "!SQL_NOVA_PKGS!" echo SELECT CASE
>> "!SQL_NOVA_PKGS!" echo WHEN iconPackage IS NOT NULL AND LENGTH(TRIM(iconPackage^)^) ^> 0 THEN TRIM(iconPackage^)
>> "!SQL_NOVA_PKGS!" echo WHEN INSTR(intent, 'component='^) ^> 0 THEN
>> "!SQL_NOVA_PKGS!" echo CASE
>> "!SQL_NOVA_PKGS!" echo WHEN INSTR(SUBSTR(intent, INSTR(intent, 'component='^) + 10^), '/'^) ^> 0 THEN SUBSTR(
>> "!SQL_NOVA_PKGS!" echo SUBSTR(intent, INSTR(intent, 'component='^) + 10^),
>> "!SQL_NOVA_PKGS!" echo 1,
>> "!SQL_NOVA_PKGS!" echo INSTR(SUBSTR(intent, INSTR(intent, 'component='^) + 10^), '/'^) - 1
>> "!SQL_NOVA_PKGS!" echo ^)
>> "!SQL_NOVA_PKGS!" echo ELSE SUBSTR(intent, INSTR(intent, 'component='^) + 10^)
>> "!SQL_NOVA_PKGS!" echo END
>> "!SQL_NOVA_PKGS!" echo ELSE ''
>> "!SQL_NOVA_PKGS!" echo END AS package_name
>> "!SQL_NOVA_PKGS!" echo FROM favorites
>> "!SQL_NOVA_PKGS!" echo )
>> "!SQL_NOVA_PKGS!" echo WHERE LENGTH(package_name^) ^> 0;
"%SQLITE_EXE%" "%DB_PATH%" < "!SQL_NOVA_PKGS!" > "!NOVA_PKGS_FILE!"
if "%DEBUG%"=="1" (
echo [DEBUG] sqlite3 Nova pkgs exit errorlevel=!errorlevel!
echo [DEBUG] NOVA_PKGS_FILE line count:
find /c /v "" "!NOVA_PKGS_FILE!" 2>nul
echo [DEBUG] Writing PS_DIFF_3P script...
)
:: v3p2: Write PS_DIFF_3P line-by-line instead of an outer parenthesized block
:: v3p4: Resolve app labels for unplaced packages via adb dumpsys and aapt/aapt2 if available
:: v3p5: Remove stray caret escaping before closing paren on standalone echo lines
:: v3p6: Prompt whether to resolve app titles and print periodic progress during lookup
if exist "!PS_DIFF_3P!" del /f /q "!PS_DIFF_3P!" >nul 2>&1
>> "!PS_DIFF_3P!" echo $adbExe = $env:ADB_EXE
>> "!PS_DIFF_3P!" echo $adbTarget = $env:RUN_ADB_TARGET
>> "!PS_DIFF_3P!" echo $resolveLabels = ($env:DO_RESOLVE_LABELS -eq '1')
>> "!PS_DIFF_3P!" echo $pm3Lines = Get-Content -LiteralPath $env:PM_3P_FILE -ErrorAction SilentlyContinue
>> "!PS_DIFF_3P!" echo $installed3 = [System.Collections.Generic.HashSet[string]]::new([System.StringComparer]::OrdinalIgnoreCase)
>> "!PS_DIFF_3P!" echo foreach ($line in $pm3Lines) {
>> "!PS_DIFF_3P!" echo $p = ($line -replace '\r', '').Trim()
>> "!PS_DIFF_3P!" echo if ($p.StartsWith('package:')) { $p = $p.Substring(8).Trim() }
>> "!PS_DIFF_3P!" echo if (-not [string]::IsNullOrWhiteSpace($p)) { [void]$installed3.Add($p) }
>> "!PS_DIFF_3P!" echo }
>> "!PS_DIFF_3P!" echo $novaLines = Get-Content -LiteralPath $env:NOVA_PKGS_FILE -ErrorAction SilentlyContinue
>> "!PS_DIFF_3P!" echo $inNova = [System.Collections.Generic.HashSet[string]]::new([System.StringComparer]::OrdinalIgnoreCase)
>> "!PS_DIFF_3P!" echo foreach ($n in $novaLines) {
>> "!PS_DIFF_3P!" echo $pkg = ($n -replace '\r', '').Trim()
>> "!PS_DIFF_3P!" echo if (-not [string]::IsNullOrWhiteSpace($pkg)) { [void]$inNova.Add($pkg) }
>> "!PS_DIFF_3P!" echo }
>> "!PS_DIFF_3P!" echo $missingList = [System.Collections.Generic.List[string]]::new()
>> "!PS_DIFF_3P!" echo foreach ($pkg in $installed3) {
>> "!PS_DIFF_3P!" echo if (-not $inNova.Contains($pkg)) { [void]$missingList.Add($pkg) }
>> "!PS_DIFF_3P!" echo }
>> "!PS_DIFF_3P!" echo $missing = @($missingList.ToArray())
>> "!PS_DIFF_3P!" echo [System.Array]::Sort($missing, [System.StringComparer]::OrdinalIgnoreCase)
>> "!PS_DIFF_3P!" echo $aaptCmd = if ($resolveLabels) { Get-Command aapt -ErrorAction SilentlyContinue } else { $null }
>> "!PS_DIFF_3P!" echo $idx = 0
>> "!PS_DIFF_3P!" echo $results = foreach ($pkg in $missing) {
>> "!PS_DIFF_3P!" echo $idx++
>> "!PS_DIFF_3P!" echo $label = ''
>> "!PS_DIFF_3P!" echo if ($resolveLabels) {
>> "!PS_DIFF_3P!" echo if (($idx %% 10) -eq 1 -or $idx -eq $missing.Count) {
>> "!PS_DIFF_3P!" echo Write-Host ("Resolving titles: {0}/{1} ({2})..." -f $idx, $missing.Count, $pkg)
>> "!PS_DIFF_3P!" echo }
>> "!PS_DIFF_3P!" echo $dumpLines = ^& $adbExe -s $adbTarget shell dumpsys package $pkg 2^>$null
>> "!PS_DIFF_3P!" echo foreach ($dl in $dumpLines) {
>> "!PS_DIFF_3P!" echo if ($dl -match 'nonLocalizedLabel="([^"]+)"') { $label = $Matches[1].Trim() }
>> "!PS_DIFF_3P!" echo }
>> "!PS_DIFF_3P!" echo if ([string]::IsNullOrWhiteSpace($label) -and $aaptCmd) {
>> "!PS_DIFF_3P!" echo $apkPathLine = (^& $adbExe -s $adbTarget shell pm path $pkg 2^>$null ^| Select-Object -First 1)
>> "!PS_DIFF_3P!" echo if ($apkPathLine -and $apkPathLine.Trim().StartsWith('package:')) {
>> "!PS_DIFF_3P!" echo $apkRemote = $apkPathLine.Trim().Substring(8).Trim()
>> "!PS_DIFF_3P!" echo $apkLocal = Join-Path $env:TEMP "adbfolder_probe.apk"
>> "!PS_DIFF_3P!" echo ^& $adbExe -s $adbTarget pull $apkRemote $apkLocal ^>$null 2^>^&1
>> "!PS_DIFF_3P!" echo if (Test-Path -LiteralPath $apkLocal) {
>> "!PS_DIFF_3P!" echo $badging = ^& $aaptCmd.Source dump badging $apkLocal 2^>$null
>> "!PS_DIFF_3P!" echo foreach ($bl in $badging) {
>> "!PS_DIFF_3P!" echo if ($bl -match "^application-label:'([^']+)'") { $label = $Matches[1].Trim(); break }
>> "!PS_DIFF_3P!" echo }
>> "!PS_DIFF_3P!" echo Remove-Item -LiteralPath $apkLocal -Force -ErrorAction SilentlyContinue
>> "!PS_DIFF_3P!" echo }
>> "!PS_DIFF_3P!" echo }
>> "!PS_DIFF_3P!" echo }
>> "!PS_DIFF_3P!" echo }
>> "!PS_DIFF_3P!" echo [PSCustomObject]@{ package_name = $pkg; app_title = $label }
>> "!PS_DIFF_3P!" echo }
>> "!PS_DIFF_3P!" echo $tableText = if (@($results).Count -gt 0) {
>> "!PS_DIFF_3P!" echo ((@($results) ^| Format-Table -AutoSize ^| Out-String -Width 4096) -split "`r?`n" ^| ForEach-Object { $_.TrimEnd() } ^| Where-Object { $_ -ne '' }) -join "`r`n" + "`r`n"
>> "!PS_DIFF_3P!" echo } else { "" }
>> "!PS_DIFF_3P!" echo [System.IO.File]::WriteAllText($env:UNPLACED_OUT, $tableText, (New-Object System.Text.UTF8Encoding($false)))
>> "!PS_DIFF_3P!" echo Write-Host ("User packages (-3): {0} | In Nova layout: {1} | No icon in Nova: {2}" -f $installed3.Count, $inNova.Count, $missing.Count)
>> "!PS_DIFF_3P!" echo if (@($results).Count -gt 0) { Write-Host ""; Write-Output $tableText.TrimEnd() }
if "%DEBUG%"=="1" (
echo [DEBUG] PS_DIFF_3P write exit errorlevel=!errorlevel!
echo [DEBUG] Generated PS_DIFF_3P contents:
type "!PS_DIFF_3P!" 2>nul
echo [DEBUG] Executing PS_DIFF_3P...
)
powershell -NoProfile -ExecutionPolicy Bypass -File "!PS_DIFF_3P!"
if "%DEBUG%"=="1" echo [DEBUG] PS_DIFF_3P execution exit errorlevel=!errorlevel!
echo Saved unplaced user app list to: "!UNPLACED_OUT!"
echo.
if not "%DEBUG%"=="1" (
del "!PM_3P_FILE!" >nul 2>&1
del "!NOVA_PKGS_FILE!" >nul 2>&1
del "!PS_DIFF_3P!" >nul 2>&1
del "!SQL_NOVA_PKGS!" >nul 2>&1
) else (
echo [DEBUG] Keeping temp files because DEBUG=1:
echo [DEBUG] "!PM_3P_FILE!"
echo [DEBUG] "!NOVA_PKGS_FILE!"
echo [DEBUG] "!PS_DIFF_3P!"
echo [DEBUG] "!SQL_NOVA_PKGS!"
)
:quit_script
pause
exit /b 0
:: -------------------------------------------------------------------------
:: Subroutine: scan_pane <pane_number>
:: -------------------------------------------------------------------------
:scan_pane
set "SCR=%~1"
"%SQLITE_EXE%" -cmd ".separator |" "%DB_PATH%" "SELECT _id, CASE WHEN title IS NULL OR TRIM(title) = '' THEN '(Untitled Folder)' ELSE title END FROM favorites WHERE itemType = 2 AND container = -100 AND CAST(screen AS INTEGER) = %SCR% ORDER BY cellY, cellX, rank, _id;" > "%TEMP%\nova_pane_folders.txt" 2>nul
set "LOOSE_CNT=0"
"%SQLITE_EXE%" "%DB_PATH%" "SELECT COUNT(*) FROM favorites WHERE container = -100 AND CAST(screen AS INTEGER) = %SCR% AND itemType <> 2;" > "%TEMP%\nova_pane_loose_cnt.txt" 2>nul
for /f "usebackq delims=" %%C in ("%TEMP%\nova_pane_loose_cnt.txt") do (
if not "%%C"=="" set "LOOSE_CNT=%%C"
)
del "%TEMP%\nova_pane_loose_cnt.txt" >nul 2>&1
set "HAS_PANE_FOLDERS=0"
for /f "usebackq tokens=1* delims=|" %%A in ("%TEMP%\nova_pane_folders.txt") do (
set "FID=%%A"
if not "!FID!"=="" set "HAS_PANE_FOLDERS=1"
)
set "PRINT_HEADER=0"
if !HAS_PANE_FOLDERS! GTR 0 set "PRINT_HEADER=1"
if !LOOSE_CNT! GTR 0 set "PRINT_HEADER=1"
if "!PRINT_HEADER!"=="1" echo pane %SCR%
for /f "usebackq tokens=1* delims=|" %%A in ("%TEMP%\nova_pane_folders.txt") do (
set "FID=%%A"
set "FNAME=%%B"
set "FNAME=!FNAME:^M=!"
if not "!FID!"=="" (
set /a TGT_COUNT+=1
set "TGT_LABEL_!TGT_COUNT!=pane %SCR% - !FNAME!"
set "TGT_WHERE_!TGT_COUNT!=f.container = !FID!"
set "TGT_ORDER_!TGT_COUNT!=f.rank, f._id"
set "LISTED_FOLDER_IDS=!LISTED_FOLDER_IDS!!FID!,"
echo [!TGT_COUNT!] !FNAME!
)
)
if !LOOSE_CNT! GTR 0 (
set /a TGT_COUNT+=1
set "TGT_LABEL_!TGT_COUNT!=pane %SCR% loose apps"
set "TGT_WHERE_!TGT_COUNT!=f.container = -100 AND CAST(f.screen AS INTEGER) = %SCR% AND f.itemType <> 2"
set "TGT_ORDER_!TGT_COUNT!=f.cellY, f.cellX, f.rank, f._id"
echo [!TGT_COUNT!] pane %SCR% loose apps
)
del "%TEMP%\nova_pane_folders.txt" >nul 2>&1
goto :eof
:: -------------------------------------------------------------------------
:: end of adbfolder.bat
:: -------------------------------------------------------------------------
:: Step by step description of what this script does
:: 1. Environment & Configuration Setup
:: A. Command environment
:: a. Disables command echoing and enables delayed expansion
:: b. Sets the working directory to the script's path
:: B. Configuration variables
:: a. Sets default configuration paths for ADB, SQLite
:: and work directories
:: b. Defines the DEBUG toggle flag
:: 2. Dependency Verification
:: A. Executable checks
:: a. Locates adb.exe and checks system PATH or configured fallback path
:: b. Locates sqlite3.exe and exits with an error if missing
:: B. Directory setup
:: a. Creates the local working directory if it does not exist
:: 3. Source Selection Menu
:: A. Choice [1]: Pull from Android via ADB
:: a. Detects connected ADB device target
:: b. Lists .novabackup files in the remote backup directory
:: with fallback search
:: c. Prompts user to select or enter a backup filename/path
:: d. Pulls the selected .novabackup file to the Windows workspace
:: e. Renames the pulled file to backup.zip and extracts it
:: into backup_extracted to retrieve nova.db
:: B. Choice [2]: Use Local Database / Archive
:: a. Prompts user for a custom path to nova.db .novabackup or .zip
:: with a retry loop
:: b. Validates file existence
:: c. Automatically extracts archives if .novabackup or .zip file
:: 4. Database Verification & Target Enumeration
:: A. Database validation
:: a. Verifies that nova.db exists at the target path
:: B. Section 1 [Dock]
:: a. Scans dock apps [container = -101]
:: b. Scans and lists any dock folders
:: C. Section 2 [Panes 0-14]
:: a. Iterates through home screen panes 0 to 14
:: via the scan_pane subroutine
:: b. Queries pane folders [itemType = 2, container = -100]
:: c. Checks for loose non-folder apps [itemType <> 2] on the pane
:: D. Section 3 [Other Folders]
:: a. Searches for orphaned folders not categorized under dock or panes
:: b. Lists and registers valid other folders
:: 5. User Selection & Query Execution [run_query]
:: A. Selection & Sanity
:: a. Prompts user to select a target number or quit [q or 0]
:: b. Sanitizes the selected label using a temporary PowerShell
:: script to generate a safe filename
:: B. Query Generation & Execution
:: a. Writes a dynamic SQLite query script to a temp file
:: [.sql] extracting item ID, app title, package name and raw intent
:: b. Executes the query against nova.db using sqlite3.exe
:: C. Output & Formatting
:: a. Formats output columns [package_name first, display_name second]
:: into an auto-sized table via PowerShell
:: b. Adds a descriptive pane/folder heading and indents the table
:: by two spaces for easier reading and future concatenation
:: c. Saves raw results [output.txt] and formatted results
:: [target_apps.txt] to the work directory
:: d. Appends each formatted export with a timestamp to
:: [adbfolder_log.txt] without overwriting previous exports
:: e. Prompts user to loop back to scan another folder/pane or proceed
:: 6. Optional Unplaced Third-Party Package Check [check_missing_3p]
:: A. Pre-check Validation
:: a. Prompts user whether to check for user-installed packages
:: [-3] missing from the Nova layout
:: b. Verifies ADB device connectivity and database availability
:: c. Optionally prompts user to resolve app labels via adb dumpsys
:: and aapt/aapt2
:: B. Data Collection
:: a. Queries installed third-party packages from device
:: [adb shell pm list packages -3]
:: b. Queries all referenced packages inside nova.db
:: C. Diff Analysis & Cleanup
:: a. Generates and executes a PowerShell diff script to find
:: installed packages with no home screen icon
:: b. Outputs a formatted table of unplaced apps to
:: unplaced_user_apps.txt
:: c. Cleans up temporary script and text files
:: [unless DEBUG=1] and exits cleanly
:: -------------------------------------------------------------------------
:: Not only is there a question of how to port this for more general use,
:: but there's also a question of which common launchers will it work with.
::
:: It may be that the native Android launcher may provide a 'parsable
:: homescreen, so I looked up which might work in addition to Nova Launcher.
::
:: So far, I "think" [tentatively] these will export/import a homescreen.
:: a. Nova [SQL, .novabackup/nova.db restore]
:: b. Lawnchair [.lawnchairbackup/restore]
:: c. Mink [JSON backup/restore]
:: d. Total Launcher [zip? backup/restore]
:: e. Niagra [nlb backup/restore]
:: d. Others? [SQLite, JSON, XML, etc.]
:: -------------------------------------------------------------------------
--
As always, it's 10X more work to document than it is to do it.
Re: Can we programmatically get package names of icons in a homescreen folder?
Author: Maria Sophia
Date: Sun, 22 Nov 2026 02:46
Date: Sun, 22 Nov 2026 02:46
994 lines
40954 bytes
40954 bytes
Here is v1p6 of adbfolder.py which is a port of v6p1 of adbfolder.bat
(since it took a half dozen iterations to make the python port work).
Interestingly, a couple of bugs showed up when I was porting because the
Python code worked differently, which actually turned out to be a blessing
as the python code was working correctly & the Windows batch was not.
That discrepancy enabled me to find the syntactical bug in the Windows
batch script, which was easy to solve but not so easy to identify.
:: v6p0 20261121 Fixed ADB shell ls wildcard expansion by moving the closing
:: quote after %ANDROID_BCK_DIR% so *.novabackup is not treated
:: as a literal filename (which had forced a global search)
What I learned from that effort is it's sometimes useful to port your code
to another format and then when you run it, you might find syntax issues.
Anyway, here's the working python code, which I only tested on Windows, but
which should work on any platform, as I'm all about leveraging solutions.
#!/usr/bin/env python3
# -------------------------------------------------------------------------
# adbfolder.py
# Usage: python adbfolder.py
# -------------------------------------------------------------------------
# Outputs a perfect textual inventory, with debug capability, of an Android
# homescreen, including location of all panes, folders, packages and titles.
#
# Requires adb, sqlite3, tabulate and optionally aapt/aapt2
#
# Intended to assist in debugging, inventory, archival, backup and restore.
# Runs on Windows over Wi-Fi/USB, but can be ported to other platforms.
#
# Will pull a backup from android via adb or read an existing nova db or
# nova backup archive on windows needing only adb and sql dependencies
#
# List order is top to bottom, left to right, meaning the leftmost pane
# is 1st, then subsequent panes, from 0 to 1 to 2 and so on to the right.
#
# Similarly, the topleft folder is 1st, then the next folder to the right.
#
# Likewise, packages and titles inside of folders are listed in top to
# bottom order, left to right, providing an exact textual description.
#
# Bare icons, not inside folders, are listed separately as a line item.
# The dock and folders in the dock are treated much like the panes are.
#
# This script not only provides a textual inventory of the name and
# homescreen location of every folder name, package name and display
# name ever added to the homescreen, but it optionally will 'diff'
# against packages which were manually installed by the user but
# which have no current homescreen icon (i.e., "headless" apps).
#
# Note the display_name is the current icon title for a given app icon,
# which can be changed by the user, so it's not always the original.
# However, for apps installed by the user but without homescreen icons,
# the optional lookup pulls the app's original defined Android app_label.
#
# Output is appended to a timestamped running log file for traceability.
# Unless the user wipes out the running log, this becomes an automatic
# audit of all the physical changes a user has made to the homescreen.
# -------------------------------------------------------------------------
# Q: Why is saying YES to "Resolve app titles via adb/aapt" very slow?
# A: For each of the unplaced packages, the script does:
# a. adb shell dumpsys package <pkg> to look for nonLocalizedLabel=
# b. If that fails: adb shell pm path <pkg> to find the APK location
# c. adb pull <apk> to download the APK to the PC
# d. aapt dump badging <apk> to read the app label from the APK
# Which is up to 4 ADB commands times N apps = 4N round-trips.
# Over USB, each round-trip is fast (milliseconds).
# But, over Wi-Fi, each one has wireless handshake latency,
# so the total time adds up just waiting on ADB to return results.
# -------------------------------------------------------------------------
# v1p6 20261121 Ported to adbfolder.py v1p6 (took a half-dozen iterations)
# Matched output of abfolder.bat v6p1 with adbfolder.py v1p6
# v1p0 20261121 First attempt at porting adbfolder.bat to adbfolder.py
# -------------------------------------------------------------------------
import os
import sys
import re
import subprocess
import shutil
import sqlite3
import zipfile
import logging
from pathlib import Path
from datetime import datetime
from tabulate import tabulate
# ---------------------------------------------------------------------------
# Configuration
# ---------------------------------------------------------------------------
DEBUG = False # set True for verbose traces
ADB_EXE = Path(r"C:\app\editor\android\scrcpy\adb.exe")
SQLITE_EXE = Path(r"C:\app\editor\android\sdk\platform-tools\sqlite3.exe")
WORK_DIR = Path(r"C:\app\editor\android\scrcpy\nova")
ANDROID_BCK_DIR = "/storage/emulated/0/0000/bck/nova_backup"
DEFAULT_CONTAINER = 2921
TEMP = Path(os.environ.get("TEMP", Path.home() / "tmp"))
def debug(msg):
if DEBUG:
print(f"[DEBUG] {msg}")
# ---------------------------------------------------------------------------
# Helpers
# ---------------------------------------------------------------------------
def run(cmd, **kwargs):
"""Run a command and return CompletedProcess."""
debug(f"Running: {' '.join(map(str, cmd))}")
return subprocess.run(cmd, capture_output=True, text=True, **kwargs)
def which(exe_name):
"""Return path to executable if found in PATH or configured paths."""
found = shutil.which(exe_name)
return found
def ensure_dir(path: Path):
path.mkdir(parents=True, exist_ok=True)
def prompt(msg, default=None):
if default is not None:
msg = f"{msg} [Default: {default}]: "
else:
msg = f"{msg}: "
val = input(msg).strip()
return val if val else (default or "")
def yes_no(msg, default="n"):
val = prompt(f"{msg} [y/N]" if default != "y" else f"{msg} [Y/n]", default)
return val.lower().startswith("y")
# ---------------------------------------------------------------------------
# Dependency check
# ---------------------------------------------------------------------------
def check_dependencies():
print("Checking required tools (adb and sqlite3) ...")
# ADB
global ADB_EXE
path_adb = which("adb")
if not ADB_EXE.exists():
if path_adb:
print(f"[INFO] Configured ADB_EXE not found; using PATH: {path_adb}")
ADB_EXE = Path(path_adb)
else:
print(f"[WARN] adb.exe not found at '{ADB_EXE}' and not in PATH.")
else:
if not path_adb:
print(f"[INFO] adb.exe found at configured path, though not in PATH.")
# SQLite
global SQLITE_EXE
path_sqlite = which("sqlite3")
if not SQLITE_EXE.exists():
if path_sqlite:
print(f"[INFO] Configured SQLITE_EXE not found; using PATH: {path_sqlite}")
SQLITE_EXE = Path(path_sqlite)
else:
print(f"[ERROR] sqlite3.exe not found at '{SQLITE_EXE}' and not in PATH.")
input("Press Enter to exit...")
sys.exit(1)
else:
if not path_sqlite:
print(f"[INFO] sqlite3.exe found at configured path, though not in PATH.")
ensure_dir(WORK_DIR)
print(f"Working directory: {Path.cwd()}")
print(f"Nova work directory: {WORK_DIR}")
print("----------------")
print()
# ---------------------------------------------------------------------------
# ADB helpers
# ---------------------------------------------------------------------------
def adb_devices():
"""Return list of connected device serials."""
res = run([str(ADB_EXE), "devices"])
devices = []
for line in res.stdout.strip().splitlines()[1:]:
parts = line.split()
if parts and "\t" in line or len(parts) >= 2:
serial = parts[0]
state = parts[1] if len(parts) > 1 else ""
if state == "device":
devices.append(serial)
return devices
def adb_shell(serial, cmd):
return run([str(ADB_EXE), "-s", serial, "shell", cmd])
def adb_pull(serial, remote, local):
return run([str(ADB_EXE), "-s", serial, "pull", remote, str(local)])
def adb_push(serial, local, remote):
return run([str(ADB_EXE), "-s", serial, "push", str(local), remote])
# ---------------------------------------------------------------------------
# Backup pull from Android
# ---------------------------------------------------------------------------
def pull_from_android():
print("--- Pull Nova Backup from Android ---")
if not ADB_EXE.exists():
print(f"[ERROR] adb.exe not found at: '{ADB_EXE}'")
input("Press Enter to exit...")
sys.exit(1)
devices = adb_devices()
if not devices:
print("[ERROR] No connected ADB devices found.")
input("Press Enter to exit...")
sys.exit(1)
serial = devices[0]
debug(f"ADB_TARGET={serial}")
print(f"Targeting device: {serial}")
make_bck = yes_no("Open Nova Launcher settings on device to create a new backup first?")
if make_bck:
print("Launching Nova Launcher settings on device ...")
print("Tap Backup & restore > Backup > Save to save to your device")
run([
str(ADB_EXE), "-s", serial, "shell",
"am", "start",
"-n",
"com.teslacoilsw.launcher/com.teslacoilsw.launcher.preferences.SettingsActivity"
])
input("Create your backup in Nova Launcher on the device, then press ENTER to list backups.")
print(f"Listing backups in {ANDROID_BCK_DIR} ...")
print()
# List backups in default dir
res = adb_shell(serial, f"ls -1t '{ANDROID_BCK_DIR}'/*.novabackup 2>/dev/null")
backups = parse_adb_lines(res.stdout)
if not backups:
print(f"[INFO] No .novabackup files found in {ANDROID_BCK_DIR}.")
print("Searching Android storage for *.novabackup files ...")
print()
search_cmd = (
"for d in /storage/emulated/0 /storage/*; "
"do [ -d \"$d\" ] && [ \"$d\" != \"/storage/emulated\" ] && "
"find \"$d\" -maxdepth 5 -name '*.novabackup' 2>/dev/null; done"
)
res = adb_shell(serial, search_cmd)
backups = parse_adb_lines(res.stdout)
if not backups:
print(f"[WARN] No .novabackup files found in {ANDROID_BCK_DIR} or Android storage.")
remote_bck = manual_backup_path()
else:
print()
for i, (fname, fpath) in enumerate(backups, 1):
print(f" [{i}] {fname}")
pick = prompt(f"Select backup number [1-{len(backups)}, Default: 1]", "1")
try:
idx = int(pick) - 1
if not (0 <= idx < len(backups)):
raise ValueError
except ValueError:
# Treat as manual path
remote_bck = manual_backup_path(pick)
else:
fname, fpath = backups[idx]
remote_bck = fpath
return download_and_extract(serial, remote_bck)
def parse_adb_lines(text):
"""Parse ADB output into list of (filename, fullpath)."""
results = []
for line in text.splitlines():
line = line.strip().replace("\r", "")
if not line:
continue
path = Path(line)
fname = path.name
results.append((fname, line))
# Newest first, matching `ls -1t`
results.sort(key=lambda x: x[0], reverse=True)
return results
def manual_backup_path(prefill=""):
if prefill:
bck_file = prefill.strip().strip('"')
else:
bck_file = prompt(
"Enter backup filename or full Android path "
"e.g. 2026-11-19_12-57.novabackup"
)
if not bck_file:
print("[ERROR] No backup filename provided.")
input("Press Enter to exit...")
sys.exit(1)
remote_bck = bck_file
if not remote_bck.startswith("/"):
remote_bck = f"{ANDROID_BCK_DIR}/{remote_bck}"
fname = Path(remote_bck).name
return remote_bck
def download_and_extract(serial, remote_bck):
local_bck = WORK_DIR / Path(remote_bck).name
local_zip = WORK_DIR / "backup.zip"
extract_dir = WORK_DIR / "backup_extracted"
print()
print(f'Pulling "{remote_bck}" to "{local_bck}" ...')
res = adb_pull(serial, remote_bck, local_bck)
if res.returncode != 0:
print("[ERROR] Failed to pull backup from Android.")
input("Press Enter to exit...")
sys.exit(1)
if local_zip.exists():
local_zip.unlink()
# Rename pulled file to backup.zip
shutil.move(str(local_bck), str(local_zip))
if extract_dir.exists():
shutil.rmtree(extract_dir)
print(f"Extracting backup.zip to '{extract_dir}' ...")
try:
with zipfile.ZipFile(local_zip, "r") as zf:
zf.extractall(extract_dir)
except Exception as e:
print(f"[ERROR] Failed to extract backup.zip: {e}")
input("Press Enter to exit...")
sys.exit(1)
db_path = extract_dir / "nova.db"
return db_path
# ---------------------------------------------------------------------------
# Local source selection
# ---------------------------------------------------------------------------
def use_local_source():
print("--- Local Database Selection ---")
print(f'Enter the path to nova.db or a .novabackup or .zip file.')
print(f'Default: {WORK_DIR / "backup_extracted" / "nova.db"}')
print()
while True:
user_db = prompt("Path to database or backup file [Enter for default]")
if not user_db:
db_path = WORK_DIR / "backup_extracted" / "nova.db"
else:
user_db = user_db.strip().strip('"')
db_path = Path(user_db).resolve()
if not db_path.exists():
print(f"[ERROR] File not found: '{db_path}'")
retry = prompt("Try again? [Y/n]", "y")
if retry.lower().startswith("n"):
sys.exit(1)
continue
ext = db_path.suffix.lower()
if ext == ".novabackup":
return extract_local_archive(db_path, restore_prompt=True)
elif ext == ".zip":
return extract_local_archive(db_path, restore_prompt=False)
else:
return db_path
def extract_local_archive(archive_path, restore_prompt=False):
extract_dir = WORK_DIR / "backup_extracted"
if extract_dir.exists():
shutil.rmtree(extract_dir)
print(f'Extracting "{archive_path}" to "{extract_dir}" ...')
try:
with zipfile.ZipFile(archive_path, "r") as zf:
zf.extractall(extract_dir)
except Exception as e:
print(f"[ERROR] Failed to extract archive: {e}")
input("Press Enter to exit...")
sys.exit(1)
db_path = extract_dir / "nova.db"
if restore_prompt and yes_no("Restore this backup in Nova on the connected device?"):
restore_backup_to_device(db_path)
return db_path
def restore_backup_to_device(db_path):
if not ADB_EXE.exists():
print(f"[ERROR] adb.exe not found at '{ADB_EXE}'; cannot send backup to device.")
input("Press Enter to exit...")
sys.exit(1)
devices = adb_devices()
if not devices:
print("[ERROR] No connected ADB device found; cannot restore the backup.")
input("Press Enter to exit...")
sys.exit(1)
serial = devices[0]
nova_backup_dir = "/storage/emulated/0/Android/data/com.teslacoilsw.launcher/files/Backup"
print(f'Copying "{db_path}" to Nova backup folder on {serial} ...')
adb_shell(serial, f"mkdir -p '{nova_backup_dir}'")
res = adb_push(serial, db_path, nova_backup_dir + "/")
if res.returncode != 0:
print("[ERROR] Failed to copy the backup to the device.")
input("Press Enter to exit...")
sys.exit(1)
print(f"Launching Nova Launcher settings on {serial} ...")
run([
str(ADB_EXE), "-s", serial, "shell",
"am", "start",
"-n",
"com.teslacoilsw.launcher/com.teslacoilsw.launcher.preferences.SettingsActivity"
])
print("In Nova, choose Backup & restore and restore the backup you copied.")
# ---------------------------------------------------------------------------
# SQLite helpers (use Python sqlite3 module, fall back to CLI)
# ---------------------------------------------------------------------------
def sqlite_query(db_path, sql, params=()):
"""Execute a SELECT query using Python sqlite3. Returns list of tuples."""
try:
conn = sqlite3.connect(str(db_path))
cur = conn.execute(sql, params)
rows = cur.fetchall()
conn.close()
return rows
except sqlite3.Error as e:
print(f"[ERROR] SQLite query failed: {e}")
input("Press Enter to exit...")
sys.exit(1)
def sqlite_query_cli(db_path, sql, params=()):
"""Fallback: write SQL to temp file and run sqlite3 CLI."""
sql_file = TEMP / "adbfolder_query.sql"
sql_file.write_text(sql, encoding="utf-8")
res = run([str(SQLITE_EXE), str(db_path)], input=sql, text=True)
if res.returncode != 0:
print(f"[ERROR] sqlite3 CLI failed: {res.stderr}")
input("Press Enter to exit...")
sys.exit(1)
rows = []
for line in res.stdout.strip().splitlines():
rows.append(tuple(line.split("\t")))
return rows
# ---------------------------------------------------------------------------
# Target enumeration
# ---------------------------------------------------------------------------
class Target:
def __init__(self, num, label, where, order):
self.num = num
self.label = label
self.where = where
self.order = order
def enumerate_targets(db_path):
targets = []
tgt_count = 0
listed_folder_ids = set()
# 1. Dock
print("dock")
tgt_count += 1
targets.append(Target(tgt_count, "dock apps", "f.container = -101",
"f.screen, f.cellY, f.cellX, f.rank, f._id"))
print(f" [{tgt_count}] dock apps")
rows = sqlite_query(db_path,
"SELECT _id, COALESCE(NULLIF(TRIM(title), ''), '(Untitled Folder)') "
"FROM favorites WHERE itemType = 2 AND container = -101 "
"ORDER BY cellY, cellX, rank, _id")
for fid, fname in rows:
tgt_count += 1
label = f"dock - {fname}"
targets.append(Target(tgt_count, label, f"f.container = {fid}",
"f.rank, f._id"))
listed_folder_ids.add(str(fid))
print(f" [{tgt_count}] {fname}")
# 2. Panes 0-14
for pane in range(15):
tgt_count = scan_pane(db_path, pane, targets, tgt_count, listed_folder_ids)
# 3. Other folders (orphaned folders not under dock or a pane)
rows = sqlite_query(db_path,
"SELECT _id, COALESCE(NULLIF(TRIM(title), ''), '(Untitled Folder)') "
"FROM favorites WHERE itemType = 2 "
"ORDER BY LOWER(title), _id")
other_has_folders = False
for fid, fname in rows:
if str(fid) in listed_folder_ids:
continue
if not other_has_folders:
print("other")
other_has_folders = True
tgt_count += 1
label = f"other - {fname}"
targets.append(Target(tgt_count, label, f"f.container = {fid}",
"f.rank, f._id"))
print(f" [{tgt_count}] {fname}")
return targets, tgt_count
def scan_pane(db_path, pane, targets, tgt_count, listed_folder_ids):
rows = sqlite_query(db_path,
"SELECT _id, COALESCE(NULLIF(TRIM(title), ''), '(Untitled Folder)') "
"FROM favorites WHERE itemType = 2 AND container = -100 "
"AND CAST(screen AS INTEGER) = ? "
"ORDER BY cellY, cellX, rank, _id", (pane,))
loose_cnt = sqlite_query(db_path,
"SELECT COUNT(*) FROM favorites WHERE container = -100 "
"AND CAST(screen AS INTEGER) = ? AND itemType <> 2", (pane,))[0][0]
has_pane_folders = len(rows) > 0
print_header = has_pane_folders or loose_cnt > 0
if print_header:
print(f"pane {pane}")
for fid, fname in rows:
tgt_count += 1
label = f"pane {pane} - {fname}"
targets.append(Target(tgt_count, label, f"f.container = {fid}",
"f.rank, f._id"))
listed_folder_ids.add(str(fid))
print(f" [{tgt_count}] {fname}")
if loose_cnt > 0:
tgt_count += 1
label = f"pane {pane} loose apps"
where = (f"f.container = -100 AND CAST(f.screen AS INTEGER) = {pane} "
f"AND f.itemType <> 2")
order = "f.cellY, f.cellX, f.rank, f._id"
targets.append(Target(tgt_count, label, where, order))
print(f" [{tgt_count}] pane {pane} loose apps")
return tgt_count
# ---------------------------------------------------------------------------
# Sanitize label -> safe filename
# ---------------------------------------------------------------------------
def sanitize_label(label):
safe = re.sub(r'[\\/:*?"<>|() ]+', '_', label).strip('_')
if not safe:
safe = "nova_target"
return safe
# ---------------------------------------------------------------------------
# Run query and format output
# ---------------------------------------------------------------------------
def run_query(db_path, target, work_dir):
safe_name = sanitize_label(target.label)
raw_out = work_dir / "output.txt"
clean_out = work_dir / f"{safe_name}_apps.txt"
log_out = work_dir / "adbfolder_log.txt"
sql = f"""
SELECT f._id AS item_id,
f.title AS display_name,
CASE
WHEN f.iconPackage IS NOT NULL AND LENGTH(TRIM(f.iconPackage)) > 0
THEN TRIM(f.iconPackage)
WHEN INSTR(f.intent, 'component=') > 0 THEN
CASE
WHEN INSTR(SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10), '/') > 0
THEN SUBSTR(SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10),
1, INSTR(SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10), '/') - 1)
WHEN INSTR(SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10), ';') > 0
THEN SUBSTR(SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10),
1, INSTR(SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10), ';') - 1)
ELSE SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10)
END
WHEN INSTR(f.intent, 'package=') > 0 THEN
CASE
WHEN INSTR(SUBSTR(f.intent, INSTR(f.intent, 'package=') + 8), ';') > 0
THEN SUBSTR(SUBSTR(f.intent, INSTR(f.intent, 'package=') + 8),
1, INSTR(SUBSTR(f.intent, INSTR(f.intent, 'package=') + 8), ';') - 1)
ELSE SUBSTR(f.intent, INSTR(f.intent, 'package=') + 8)
END
ELSE ''
END AS package_name,
f.intent
FROM favorites f
WHERE {target.where}
ORDER BY {target.order};
"""
print()
print(f'Querying "{target.label}" ...')
try:
rows = sqlite_query(db_path, sql)
except SystemExit:
rows = sqlite_query_cli(db_path, sql)
# Write raw tab-delimited output (all columns)
with open(raw_out, "w", encoding="utf-8") as f:
f.write("item_id\tdisplay_name\tpackage_name\tintent\n")
for row in rows:
f.write("\t".join(str(c) if c is not None else "" for c in row) + "\n")
# Format only package_name and display_name, in that order
display_rows = [(row[2], row[1]) for row in rows] # (package_name, display_name)
table_text = ""
if display_rows:
table_text = tabulate(
display_rows,
headers=["package_name", "display_name"],
tablefmt="plain"
)
indented = [" " + line for line in table_text.splitlines()]
# Header matching batch format
if target.label.startswith("pane ") and " - " in target.label:
parts = target.label.split(" - ", 1)
pane_num = parts[0].replace("pane ", "").strip()
folder_name = parts[1]
header = f' pane {pane_num} folder "{folder_name}"'
else:
header = f" {target.label}"
clean_text = header + "\n" + "\n".join(indented) + "\n"
# Write clean output
clean_out.write_text(clean_text, encoding="utf-8")
# Append to running log
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
entry = (
"\n============================================================\n"
f"Export: {timestamp}\n"
f"{clean_text}"
)
with open(log_out, "a", encoding="utf-8") as f:
f.write(entry)
print()
print(f"--- Result ({clean_out}) ---")
print()
print(clean_text)
print(f"Raw tab-delimited output saved to: {raw_out}")
print(f"Formatted app list saved to: {clean_out}")
print(f"Running export log saved to: {log_out}")
print()
return clean_out
# ---------------------------------------------------------------------------
# Optional: check missing third-party packages
# ---------------------------------------------------------------------------
def check_missing_3p(serial, db_path, work_dir):
print()
if not yes_no("Check user apps -3 with no icon in Nova before quitting?"):
return
if not ADB_EXE.exists():
print(f"[INFO] adb.exe not found at '{ADB_EXE}'; skipping device package check.")
return
devices = adb_devices()
if not devices:
print("[INFO] No connected ADB device found; skipping device package check.")
return
target_serial = devices[0]
debug(f"RUN_ADB_TARGET={target_serial}")
if not db_path or not db_path.exists():
print("[INFO] Nova database not available; skipping device package check.")
return
resolve_labels = yes_no("Resolve app titles via adb/aapt slower over Wi-Fi?", default="n")
do_resolve = resolve_labels
pm_3p_file = TEMP / "adbfolder_pm3.txt"
nova_pkgs_file = TEMP / "adbfolder_nova_pkgs.txt"
unplaced_out = work_dir / "unplaced_user_apps.txt"
print(f"Querying third-party packages from device {target_serial} ...")
res = adb_shell(target_serial, "pm list packages -3 2>/dev/null")
pm_3p_file.write_text(res.stdout, encoding="utf-8")
installed3 = set()
for line in pm_3p_file.read_text(encoding="utf-8").splitlines():
p = line.replace("\r", "").strip()
if p.startswith("package:"):
p = p[8:].strip()
if p:
installed3.add(p)
print("Querying packages referenced anywhere in nova.db ...")
rows = sqlite_query(db_path,
"SELECT DISTINCT package_name FROM ("
" SELECT CASE"
" WHEN iconPackage IS NOT NULL AND LENGTH(TRIM(iconPackage)) > 0"
" THEN TRIM(iconPackage)"
" WHEN INSTR(intent, 'component=') > 0 THEN"
" CASE"
" WHEN INSTR(SUBSTR(intent, INSTR(intent, 'component=') + 10), '/') > 0"
" THEN SUBSTR(SUBSTR(intent, INSTR(intent, 'component=') + 10),"
" 1, INSTR(SUBSTR(intent, INSTR(intent, 'component=') + 10), '/') - 1)"
" ELSE SUBSTR(intent, INSTR(intent, 'component=') + 10)"
" END"
" ELSE ''"
" END AS package_name"
" FROM favorites"
")"
"WHERE LENGTH(package_name) > 0")
in_nova = set()
for (pkg,) in rows:
if pkg:
in_nova.add(pkg)
missing = sorted(installed3 - in_nova, key=str.lower)
results = []
for i, pkg in enumerate(missing, 1):
label = ""
if do_resolve:
if i % 10 == 1 or i == len(missing):
print(f"Resolving titles: {i}/{len(missing)} ({pkg})...")
dump = adb_shell(target_serial, f"dumpsys package {pkg} 2>/dev/null")
for dl in dump.stdout.splitlines():
m = re.search(r'nonLocalizedLabel="([^"]+)"', dl)
if m:
label = m.group(1).strip()
if not label:
# Try aapt path
apk_path = shutil.which("aapt") or shutil.which("aapt2")
if apk_path:
path_res = adb_shell(target_serial, f"pm path {pkg} 2>/dev/null")
for pl in path_res.stdout.splitlines():
pl = pl.strip()
if pl.startswith("package:"):
apk_remote = pl[8:].strip()
apk_local = TEMP / "adbfolder_probe.apk"
pull_res = adb_pull(target_serial, apk_remote, apk_local)
if pull_res.returncode == 0 and apk_local.exists():
badging = run([apk_path, "dump", "badging", str(apk_local)],
capture_output=True, text=True)
for bl in badging.stdout.splitlines():
m = re.match(r"^application-label:'([^']+)'", bl)
if m:
label = m.group(1).strip()
break
try:
apk_local.unlink()
except Exception:
pass
break
results.append((pkg, label))
# Write output
lines = []
if results:
lines.append(tabulate(results, headers=["package_name", "app_title"],
tablefmt="plain").splitlines())
flat = []
for group in lines:
flat.extend(group)
table_text = "\n".join(flat) + ("\n" if flat else "")
unplaced_out.write_text(table_text, encoding="utf-8")
print()
print(f"User packages (-3): {len(installed3)} | "
f"In Nova layout: {len(in_nova)} | "
f"No icon in Nova: {len(missing)}")
if results:
print()
print(table_text.rstrip())
print(f"Saved unplaced user app list to: {unplaced_out}")
print()
# Cleanup temp files unless debug
if not DEBUG:
for f in [pm_3p_file, nova_pkgs_file]:
try:
f.unlink()
except Exception:
pass
# ---------------------------------------------------------------------------
# Main
# ---------------------------------------------------------------------------
def main():
global DEBUG
# Allow env override
if os.environ.get("ADBFOLDER_DEBUG", "0") == "1":
DEBUG = True
check_dependencies()
print("Select source for Nova Launcher database:")
print("[1] Pull .novabackup from Android via ADB and extract nova.db [Default]")
print("[2] Use an existing nova.db or .novabackup or .zip already on Windows")
print()
src_choice = prompt("Enter choice [1 or 2]", "1")
if src_choice == "2":
db_path = use_local_source()
else:
db_path = pull_from_android()
if not db_path or not db_path.exists():
print(f"[ERROR] nova.db not found at: '{db_path}'")
input("Press Enter to exit...")
sys.exit(1)
print()
print(f"Using database: {db_path}")
print("Scanning Nova Launcher dock, panes and folders ...")
print()
targets, tgt_count = enumerate_targets(db_path)
print()
pick = prompt(f"Select number [1-{tgt_count}, q to quit]")
if pick.lower() == "q" or pick == "0":
check_missing_3p(None, db_path, WORK_DIR)
print("Bye.")
return
try:
idx = int(pick) - 1
if not (0 <= idx < tgt_count):
raise ValueError
except ValueError:
print(f"[ERROR] Invalid selection: '{pick}'")
input("Press Enter to exit...")
sys.exit(1)
target = targets[idx]
debug(f"SELECTED_LABEL={target.label}")
debug(f"SQL_WHERE={target.where}")
debug(f"SQL_ORDER={target.order}")
run_query(db_path, target, WORK_DIR)
while True:
loop_more = yes_no("Export another folder or pane?", default="n")
if not loop_more:
break
# Re-enumerate (in case something changed) and pick again
targets, tgt_count = enumerate_targets(db_path)
print()
pick = prompt(f"Select number [1-{tgt_count}, q to quit]")
if pick.lower() == "q" or pick == "0":
break
try:
idx = int(pick) - 1
if not (0 <= idx < tgt_count):
raise ValueError
except ValueError:
print(f"[ERROR] Invalid selection: '{pick}'")
break
target = targets[idx]
run_query(db_path, target, WORK_DIR)
check_missing_3p(None, db_path, WORK_DIR)
input("Press Enter to exit...")
if __name__ == "__main__":
main()
# -------------------------------------------------------------------------
# end of adbfolder.py
# -------------------------------------------------------------------------
# Step by step description of what this script does
# 1. Environment & Configuration Setup
# A. Command environment
# a. Disables command echoing and enables delayed expansion
# b. Sets the working directory to the script's path
# B. Configuration variables
# a. Sets default configuration paths for ADB, SQLite
# and work directories
# b. Defines the DEBUG toggle flag
# 2. Dependency Verification
# A. Executable checks
# a. Locates adb.exe and checks system PATH or configured fallback path
# b. Locates sqlite3.exe and exits with an error if missing
# B. Directory setup
# a. Creates the local working directory if it does not exist
# 3. Source Selection Menu
# A. Choice [1]: Pull from Android via ADB
# a. Detects connected ADB device target
# b. Lists .novabackup files in the remote backup directory
# with fallback search
# c. Prompts user to select or enter a backup filename/path
# d. Pulls the selected .novabackup file to the Windows workspace
# e. Renames the pulled file to backup.zip and extracts it
# into backup_extracted to retrieve nova.db
# B. Choice [2]: Use Local Database / Archive
# a. Prompts user for a custom path to nova.db .novabackup or .zip
# with a retry loop
# b. Validates file existence
# c. Automatically extracts archives if .novabackup or .zip file
# 4. Database Verification & Target Enumeration
# A. Database validation
# a. Verifies that nova.db exists at the target path
# B. Section 1 [Dock]
# a. Scans dock apps [container = -101]
# b. Scans and lists any dock folders
# C. Section 2 [Panes 0-14]
# a. Iterates through home screen panes 0 to 14
# via the scan_pane subroutine
# b. Queries pane folders [itemType = 2, container = -100]
# c. Checks for loose non-folder apps [itemType <> 2] on the pane
# D. Section 3 [Other Folders]
# a. Searches for orphaned folders not categorized under dock or panes
# b. Lists and registers valid other folders
# 5. User Selection & Query Execution [run_query]
# A. Selection & Sanity
# a. Prompts user to select a target number or quit [q or 0]
# b. Sanitizes the selected label using a temporary PowerShell
# script to generate a safe filename
# B. Query Generation & Execution
# a. Writes a dynamic SQLite query script to a temp file
# [.sql] extracting item ID, app title, package name and raw intent
# b. Executes the query against nova.db using sqlite3.exe
# C. Output & Formatting
# a. Formats output columns [package_name first, display_name second]
# into an auto-sized table via PowerShell
# b. Adds a descriptive pane/folder heading and indents the table
# by two spaces for easier reading and future concatenation
# c. Saves raw results [output.txt] and formatted results
# [target_apps.txt] to the work directory
# d. Appends each formatted export with a timestamp to
# [adbfolder_log.txt] without overwriting previous exports
# e. Prompts user to loop back to scan another folder/pane or proceed
# 6. Optional Unplaced Third-Party Package Check [check_missing_3p]
# A. Pre-check Validation
# a. Prompts user whether to check for user-installed packages
# [-3] missing from the Nova layout
# b. Verifies ADB device connectivity and database availability
# c. Optionally prompts user to resolve app labels via adb dumpsys
# and aapt/aapt2
# B. Data Collection
# a. Queries installed third-party packages from device
# [adb shell pm list packages -3]
# b. Queries all referenced packages inside nova.db
# C. Diff Analysis & Cleanup
# a. Generates and executes a PowerShell diff script to find
# installed packages with no home screen icon
# b. Outputs a formatted table of unplaced apps to
# unplaced_user_apps.txt
# c. Cleans up temporary script and text files
# [unless DEBUG=1] and exits cleanly
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
--
On Usenet are helpful kind-hearted volunteers who know how do to things.
Re: Can we programmatically get package names of icons in a homescreen folder?
Author: Maria Sophia
Date: Sun, 22 Nov 2026 02:55
Date: Sun, 22 Nov 2026 02:55
71 lines
5665 bytes
5665 bytes
Here's a sample of how many iterations such things tend to take...
C:\app\editor\android\scrcpy> dir adbfolder*
Directory of C:\app\editor\android\scrcpy
11/21/2026 10:22 PM 49,782 adbfolder.bat
11/19/2026 10:59 PM 8,392 adbfolder.bat_v1p0.txt
11/19/2026 11:17 PM 10,960 adbfolder.bat_v1p1.txt
11/19/2026 11:20 PM 11,324 adbfolder.bat_v1p2.txt
11/19/2026 11:23 PM 12,712 adbfolder.bat_v1p3.txt
11/19/2026 11:48 PM 13,732 adbfolder.bat_v1p4.txt
11/19/2026 11:52 PM 15,500 adbfolder.bat_v1p5.txt
11/19/2026 11:56 PM 15,646 adbfolder.bat_v1p6.txt
11/20/2026 12:08 AM 17,612 adbfolder.bat_v1p7.txt
11/20/2026 12:13 AM 20,506 adbfolder.bat_v1p8.txt
11/20/2026 12:24 AM 21,847 adbfolder.bat_v1p9.txt
11/20/2026 12:27 AM 21,976 adbfolder.bat_v2p0.txt
11/20/2026 12:31 AM 22,565 adbfolder.bat_v2p1.txt
11/20/2026 12:39 AM 25,095 adbfolder.bat_v2p2.txt
11/20/2026 12:49 AM 19,915 adbfolder.bat_v2p3.txt
11/20/2026 01:07 AM 22,339 adbfolder.bat_v2p4.txt
11/20/2026 01:12 AM 22,539 adbfolder.bat_v2p5.txt
11/20/2026 01:16 AM 22,615 adbfolder.bat_v2p6.txt
11/20/2026 01:25 AM 22,315 adbfolder.bat_v2p7.txt
11/20/2026 01:26 AM 22,811 adbfolder.bat_v2p8.txt
11/20/2026 01:53 AM 26,974 adbfolder.bat_v2p9.txt
11/20/2026 02:10 AM 27,537 adbfolder.bat_v3p0.txt
11/20/2026 02:13 AM 28,815 adbfolder.bat_v3p1.txt
11/20/2026 02:16 AM 30,225 adbfolder.bat_v3p2.txt
11/20/2026 02:23 AM 30,856 adbfolder.bat_v3p3.txt
11/20/2026 02:26 AM 33,435 adbfolder.bat_v3p4.txt
11/20/2026 02:29 AM 33,541 adbfolder.bat_v3p5.txt
11/20/2026 02:41 AM 34,672 adbfolder.bat_v3p6.txt
11/20/2026 03:02 AM 35,318 adbfolder.bat_v3p7.txt
11/20/2026 03:09 AM 36,169 adbfolder.bat_v3p8.txt
11/20/2026 03:13 AM 30,020 adbfolder.bat_v3p9.txt
11/20/2026 03:27 AM 35,595 adbfolder.bat_v4p0.txt
11/20/2026 03:38 AM 36,131 adbfolder.bat_v4p1.txt
11/20/2026 03:42 AM 36,028 adbfolder.bat_v4p2.txt
11/20/2026 03:55 AM 36,312 adbfolder.bat_v4p3.txt
11/20/2026 04:00 AM 36,316 adbfolder.bat_v4p4.txt
11/20/2026 04:10 AM 37,178 adbfolder.bat_v4p5.txt
11/20/2026 04:10 AM 30,190 adbfolder.bat_v4p6.txt
11/20/2026 04:39 AM 31,783 adbfolder.bat_v4p7.txt
11/20/2026 04:51 AM 31,923 adbfolder.bat_v4p8.txt
11/20/2026 04:53 AM 30,991 adbfolder.bat_v4p9.txt
11/20/2026 04:57 AM 31,593 adbfolder.bat_v5p0.txt
11/20/2026 05:00 AM 31,144 adbfolder.bat_v5p1.txt
11/20/2026 05:04 AM 31,064 adbfolder.bat_v5p2.txt
11/20/2026 05:18 AM 38,215 adbfolder.bat_v5p3.txt
11/20/2026 05:52 AM 42,401 adbfolder.bat_v5p4.txt
11/21/2026 01:09 AM 43,764 adbfolder.bat_v5p5.txt
11/21/2026 02:59 PM 45,057 adbfolder.bat_v5p6.txt
11/21/2026 03:26 PM 46,559 adbfolder.bat_v5p7.txt
11/21/2026 03:36 PM 46,781 adbfolder.bat_v5p8.txt
11/21/2026 04:10 PM 48,281 adbfolder.bat_v5p9.txt
11/21/2026 04:26 PM 48,307 adbfolder.bat_v6.0.txt
11/21/2026 09:42 PM 49,634 adbfolder.bat_v6p0.txt
11/21/2026 10:41 PM 49,146 adbfolder.bat_v6p1.txt
11/21/2026 10:42 PM 37,477 adbfolder.py
11/21/2026 08:27 PM 29,889 adbfolder.py_v1p0.txt
11/21/2026 08:28 PM 29,696 adbfolder.py_v1p1.txt
11/21/2026 08:32 PM 29,551 adbfolder.py_v1p2.txt
11/21/2026 08:41 PM 29,857 adbfolder.py_v1p3.txt
11/21/2026 08:54 PM 29,937 adbfolder.py_v1p4.txt
11/21/2026 10:17 PM 29,941 adbfolder.py_v1p5.txt
11/21/2026 10:42 PM 37,477 adbfolder.py_v1p6.txt
62 File(s) 1,895,963 bytes
0 Dir(s) 27,955,589,120 bytes free
C:\app\editor\android\scrcpy> python adbfolder.py
Re: Can we programmatically get package names of icons in a homescreen folder?
Author: Maria Sophia
Date: Sun, 22 Nov 2026 06:31
Date: Sun, 22 Nov 2026 06:31
129 lines
7972 bytes
7972 bytes
Maria Sophia wrote:
> C:\app\editor\android\scrcpy> python adbfolder.py
What's different between the batch and python is mostly:
a. SQLite queries primarily use Python's built-in sqlite3 module.
b. Output tables use the third-party tabulate module.
c. Archive extraction uses Python's zipfile.
d. Filename sanitization uses Python regular expressions.
e. There are no generated PowerShell scripts or BAT subroutines.
f. The optional missing-package check uses Python sets to
compare installed packages against Nova database packages.
g. Debugging can be enabled with DEBUG = True or the ADBFOLDER_DEBUG=1
environment variable.
As a result of the rewrite, I'm beginning to less-hate python since
it's actually more intuitive than the Windows batch scripting was. :)
Here's the new flow in the python script...
# ----------------------------------------------------------------------
# Step by step description of what this script does
# ----------------------------------------------------------------------
# 1. Environment & Configuration Setup
# A. Command environment
# a. Initializes Python execution environment
# b. Imports required Python modules and dependencies
# B. Configuration variables
# a. Sets default configuration paths for ADB, SQLite
# and work directories
# b. Defines the DEBUG toggle flag
# c. Defines temporary and Android backup directories
#
# 2. Dependency Verification
# A. Executable checks
# a. Locates adb.exe and checks system PATH
# or configured fallback path
# b. Locates sqlite3.exe and exits with an error if missing
# B. Directory setup
# a. Creates the Nova work directory if it does not exist
#
# 3. Source Selection Menu
# A. Choice [1]: Pull from Android via ADB
# a. Detects connected ADB device target
# b. Optionally launches Nova Launcher settings to create a backup
# c. Lists .novabackup files in the remote backup directory
# with fallback search of Android storage
# d. Prompts user to select or enter a backup filename/path
# e. Pulls the selected .novabackup file to the Windows workspace
# f. Renames the pulled file to backup.zip and extracts it
# into backup_extracted to retrieve nova.db
# B. Choice [2]: Use Local Database / Archive
# a. Prompts user for a custom path to nova.db, .novabackup or .zip
# with a retry loop
# b. Validates file existence
# c. Automatically extracts archives when necessary
# d. Optionally offers to restore a .novabackup database
# to the device
#
# 4. Database Verification & Target Enumeration
# A. Database validation
# a. Verifies that nova.db exists at the target path
# B. Section 1 [Dock]
# a. Scans dock apps [container = -101]
# b. Scans and lists any dock folders
# C. Section 2 [Panes 0-14]
# a. Iterates through home screen panes 0 to 14
# via the scan_pane function
# b. Queries pane folders [itemType = 2, container = -100]
# c. Checks for loose non-folder apps [itemType <> 2] on each pane
# D. Section 3 [Other Folders]
# a. Searches for orphaned folders not categorized under dock
# or panes
# b. Lists and registers remaining folders
#
# 5. User Selection & Query Execution [run_query]
# A. Selection & Sanity
# a. Prompts user to select a target number or quit [q or 0]
# b. Sanitizes the selected label to generate a safe filename
# B. Query Generation & Execution
# a. Builds a dynamic SQLite query extracting:
# - Item ID
# - Display name
# - Package name
# - Raw intent
# b. Executes the query against nova.db using Python sqlite3
# c. Falls back to the sqlite3 command-line executable if necessary
# C. Output & Formatting
# a. Writes raw tab-delimited results to output.txt
# b. Formats output columns [package_name, display_name]
# into an aligned table via tabulate
# c. Adds a descriptive pane/folder heading and indents the table
# by two spaces for easier reading and future concatenation
# d. Saves formatted results to [target]_apps.txt
# e. Appends each formatted export with a timestamp to
# adbfolder_log.txt without overwriting previous exports
# f. Displays the formatted results and output file locations
# D. Repeat Export
# a. Prompts user to export another folder or pane
# b. Re-enumerates targets in case the database layout has changed
# c. Repeats the selection and export process as requested
#
# 6. Optional Unplaced Third-Party Package Check [check_missing_3p]
# A. Pre-check Validation
# a. Prompts user whether to check for user-installed packages
# [-3] missing from the Nova layout
# b. Verifies ADB device connectivity and database availability
# c. Optionally prompts to resolve app titles via adb/aapt
# B. Data Collection
# a. Queries installed third-party packages from device
# [adb shell pm list packages -3]
# b. Queries all referenced packages inside nova.db
# c. Compares installed packages against packages referenced in Nova
# C. Optional App Title Resolution
# a. Runs adb shell dumpsys package for each unplaced package
# b. Searches for nonLocalizedLabel in the package information
# c. If unavailable, uses adb shell pm path to locate the APK
# d. Pulls the APK to the PC and uses aapt/aapt2 to read its label
# D. Diff Analysis & Output
# a. Identifies installed third-party packages with no Nova icon
# b. Generates a formatted package_name / app_title table
# c. Saves results to unplaced_user_apps.txt
# d. Displays package counts and the resulting unplaced app list
# E. Cleanup
# a. Removes temporary package-list files unless DEBUG=1
# b. Exits cleanly
# -------------------------------------------------------------------
# -------------------------------------------------------------------
--
The whole point of every Usenet thread here is to add technical value.
Re: Can we programmatically get package names of icons in a homescreen folder?
Author: Maria Sophia
Date: Sun, 22 Nov 2026 10:11
Date: Sun, 22 Nov 2026 10:11
1084 lines
44077 bytes
44077 bytes
Lawrence kindly suggested a few fixes, most of which I just implemented.
Running the batch script against the python script had the surprising
result of finding some bugs since they acted slightly differently at first.
If someone can test this on macOS/Linux, that would be nice, but I'm well
aware that Nova Launcher is required but I can upload a database if that
would help. Just suggest where I can upload the database to.
Directory of C:\app\editor\android\scrcpy\nova\backup_extracted
11/22/2026 05:34 AM 7,696,384 nova.db
11/22/2026 05:34 AM 6,455 nova.xml
11/22/2026 05:34 AM 4,818 supportDetails.txt
#!/usr/bin/env python3
# ----------------------------------------------------------------------
# adbfolder.py
# Usage: python adbfolder.py
# ----------------------------------------------------------------------
# Outputs a perfect textual inventory, with debug capability, of an Android
# homescreen, including location of all panes, folders, packages and titles.
#
# Requires adb, sqlite3, tabulate and Nova Launcher (on Android).
# Optionally requires aapt/aapt2 to determine labels on orphan packages.
#
# Intended to assist in debug, inventory, archival, backup and restore.
# Tested on Windows over Wi-Fi/USB, but should work on macOS/Linux also.
#
# Will pull a backup from android via adb or read an existing nova db or
# nova backup archive on windows needing only adb and sql dependencies
#
# List order is top to bottom, left to right, meaning the leftmost pane
# is 1st, then subsequent panes, from 0 to 1 to 2 and so on to the right.
#
# Similarly, the topleft folder is 1st, then the next folder to the right.
#
# Likewise, packages and titles inside of folders are listed in top to
# bottom order, left to right, providing an exact textual description.
#
# Bare icons, not inside folders, are listed separately as a line item.
# The dock and folders in the dock are treated much like the panes are.
#
# This script not only provides a textual inventory of the name and
# homescreen location of every folder name, package name and display
# name ever added to the homescreen, but it optionally will 'diff'
# against packages which were manually installed by the user but
# which have no current homescreen icon (i.e., "headless" apps).
#
# Note the display_name is the current icon title for a given app icon,
# which can be changed by the user, so it's not always the original.
# However, for apps installed by the user but without homescreen icons,
# the optional lookup pulls the app's original defined Android app_label.
#
# Output is appended to a timestamped running log file for traceability.
# Unless the user wipes out the running log, this becomes an automatic
# audit of all the physical changes a user has made to the homescreen.
# ----------------------------------------------------------------------
# Q: Why is saying YES to "Resolve app titles via adb/aapt" very slow?
# A: For each of the unplaced packages, the script does:
# a. adb shell dumpsys package <pkg> to look for nonLocalizedLabel=
# b. If that fails: adb shell pm path <pkg> to find the APK location
# c. adb pull <apk> to download the APK to the PC
# d. aapt dump badging <apk> to read the app label from the APK
# Which is up to 4 ADB commands times N apps = 4N round-trips.
# Over USB, each round-trip is fast (milliseconds).
# But, over Wi-Fi, each one has wireless handshake latency,
# so the total time adds up just waiting on ADB to return results.
# ----------------------------------------------------------------------
# v1p9 20261122 Replaced redundant which() wrapper with a direct
# shutil.which import so that which("adb"), which("sqlite3"),
# which("aapt") and which("aapt2") all work out of the box.
# v1p8 20261121 Fixed bugs in the optional search for orphan packages
# v1p7 20261121 Modified the closing comments to reflect the python flow
# Fixed passing of capture_output=True and text=True twice by
# mistake in the helper section.
# v1p6 20261121 Ported to adbfolder.py v1p6 (took a half-dozen iterations)
# Matched output of abfolder.bat v6p1 with adbfolder.py v1p6
# v1p0 20261121 First attempt at porting adbfolder.bat to adbfolder.py
# What's different between the batch and python is mostly:
# a. SQLite queries primarily use Python's built-in sqlite3 module.
# b. Output tables use the third-party tabulate module.
# c. Archive extraction uses Python's zipfile.
# d. Filename sanitization uses Python regular expressions.
# e. There are no generated PowerShell scripts or BAT subroutines.
# f. The optional missing-package check uses Python sets to
# compare installed packages against Nova database packages.
# g. Debugging is enabled with DEBUG = True or the ADBFOLDER_DEBUG=1
# environment variable.
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
import os
import sys
import re
import subprocess
import shutil
import sqlite3
import zipfile
import logging
from shutil import which
from pathlib import Path
from datetime import datetime
from tabulate import tabulate
# ------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------
DEBUG = False # set True for verbose traces
ADB_EXE = Path(r"C:\app\editor\android\scrcpy\adb.exe")
SQLITE_EXE = Path(r"C:\app\editor\android\sdk\platform-tools\sqlite3.exe")
WORK_DIR = Path(r"C:\app\editor\android\scrcpy\nova")
ANDROID_BCK_DIR = "/storage/emulated/0/0000/bck/nova_backup"
DEFAULT_CONTAINER = 2921
TEMP = Path(os.environ.get("TEMP", Path.home() / "tmp"))
def debug(msg):
if DEBUG:
print(f"[DEBUG] {msg}")
# ------------------------------------------------------------------------
# Helpers
# ------------------------------------------------------------------------
def run(cmd, **kwargs):
"""Run a command and return CompletedProcess."""
debug(f"Running: {' '.join(map(str, cmd))}")
kwargs.setdefault("capture_output", True)
kwargs.setdefault("text", True)
kwargs.setdefault("encoding", "utf-8")
kwargs.setdefault("errors", "replace")
kwargs.setdefault("timeout", 60)
return subprocess.run(cmd, **kwargs)
def ensure_dir(path: Path):
path.mkdir(parents=True, exist_ok=True)
def prompt(msg, default=None):
if default is not None:
msg = f"{msg} [Default: {default}]: "
else:
msg = f"{msg}: "
val = input(msg).strip()
return val if val else (default or "")
def yes_no(msg, default="n"):
val = prompt(f"{msg} [y/N]" if default != "y" else f"{msg} [Y/n]", default)
return val.lower().startswith("y")
# ------------------------------------------------------------------------
# Dependency check
# ------------------------------------------------------------------------
def check_dependencies():
print("Checking required tools (adb and sqlite3) ...")
# ADB
global ADB_EXE
path_adb = which("adb")
if not ADB_EXE.exists():
if path_adb:
print(f"[INFO] Configured ADB_EXE not found; using PATH: {path_adb}")
ADB_EXE = Path(path_adb)
else:
print(f"[WARN] adb.exe not found at '{ADB_EXE}' and not in PATH.")
else:
if not path_adb:
print(f"[INFO] adb.exe found at configured path, though not in PATH.")
# SQLite
global SQLITE_EXE
path_sqlite = which("sqlite3")
if not SQLITE_EXE.exists():
if path_sqlite:
print(f"[INFO] Configured SQLITE_EXE not found; using PATH: {path_sqlite}")
SQLITE_EXE = Path(path_sqlite)
else:
print(f"[ERROR] sqlite3.exe not found at '{SQLITE_EXE}' and not in PATH.")
input("Press Enter to exit...")
sys.exit(1)
else:
if not path_sqlite:
print(f"[INFO] sqlite3.exe found at configured path, though not in PATH.")
ensure_dir(WORK_DIR)
print(f"Working directory: {Path.cwd()}")
print(f"Nova work directory: {WORK_DIR}")
print("----------------")
print()
# ------------------------------------------------------------------------
# ADB helpers
# ------------------------------------------------------------------------
def adb_devices():
"""Return list of connected device serials."""
res = run([str(ADB_EXE), "devices"])
devices = []
for line in res.stdout.strip().splitlines()[1:]:
parts = line.split()
if parts and "\t" in line or len(parts) >= 2:
serial = parts[0]
state = parts[1] if len(parts) > 1 else ""
if state == "device":
devices.append(serial)
return devices
def adb_shell(serial, cmd):
return run([str(ADB_EXE), "-s", serial, "shell", cmd])
def adb_pull(serial, remote, local):
return run([str(ADB_EXE), "-s", serial, "pull", remote, str(local)])
def adb_push(serial, local, remote):
return run([str(ADB_EXE), "-s", serial, "push", str(local), remote])
# ------------------------------------------------------------------------
# Backup pull from Android
# ------------------------------------------------------------------------
def pull_from_android():
print("--- Pull Nova Backup from Android ---")
if not ADB_EXE.exists():
print(f"[ERROR] adb.exe not found at: '{ADB_EXE}'")
input("Press Enter to exit...")
sys.exit(1)
devices = adb_devices()
if not devices:
print("[ERROR] No connected ADB devices found.")
input("Press Enter to exit...")
sys.exit(1)
serial = devices[0]
debug(f"ADB_TARGET={serial}")
print(f"Targeting device: {serial}")
make_bck = yes_no("Open Nova Launcher settings on device to create a new backup first?")
if make_bck:
print("Launching Nova Launcher settings on device ...")
print("Tap Backup & restore > Backup > Save to save to your device")
run([
str(ADB_EXE), "-s", serial, "shell",
"am", "start",
"-n",
"com.teslacoilsw.launcher/com.teslacoilsw.launcher.preferences.SettingsActivity"
])
input("Create your backup in Nova Launcher on the device, then press ENTER to list backups.")
print(f"Listing backups in {ANDROID_BCK_DIR} ...")
print()
# List backups in default dir
res = adb_shell(serial, f"ls -1t '{ANDROID_BCK_DIR}'/*.novabackup 2>/dev/null")
backups = parse_adb_lines(res.stdout)
if not backups:
print(f"[INFO] No .novabackup files found in {ANDROID_BCK_DIR}.")
print("Searching Android storage for *.novabackup files ...")
print()
search_cmd = (
"for d in /storage/emulated/0 /storage/*; "
"do [ -d \"$d\" ] && [ \"$d\" != \"/storage/emulated\" ] && "
"find \"$d\" -maxdepth 5 -name '*.novabackup' 2>/dev/null; done"
)
res = adb_shell(serial, search_cmd)
backups = parse_adb_lines(res.stdout)
if not backups:
print(f"[WARN] No .novabackup files found in {ANDROID_BCK_DIR} or Android storage.")
remote_bck = manual_backup_path()
else:
print()
for i, (fname, fpath) in enumerate(backups, 1):
print(f" [{i}] {fname}")
pick = prompt(f"Select backup number [1-{len(backups)}, Default: 1]", "1")
try:
idx = int(pick) - 1
if not (0 <= idx < len(backups)):
raise ValueError
except ValueError:
# Treat as manual path
remote_bck = manual_backup_path(pick)
else:
fname, fpath = backups[idx]
remote_bck = fpath
return download_and_extract(serial, remote_bck)
def parse_adb_lines(text):
"""Parse ADB output into list of (filename, fullpath)."""
results = []
for line in text.splitlines():
line = line.strip().replace("\r", "")
if not line:
continue
path = Path(line)
fname = path.name
results.append((fname, line))
# Newest first, matching `ls -1t`
results.sort(key=lambda x: x[0], reverse=True)
return results
def manual_backup_path(prefill=""):
if prefill:
bck_file = prefill.strip().strip('"')
else:
bck_file = prompt(
"Enter backup filename or full Android path "
"e.g. 2026-11-19_12-57.novabackup"
)
if not bck_file:
print("[ERROR] No backup filename provided.")
input("Press Enter to exit...")
sys.exit(1)
remote_bck = bck_file
if not remote_bck.startswith("/"):
remote_bck = f"{ANDROID_BCK_DIR}/{remote_bck}"
fname = Path(remote_bck).name
return remote_bck
def download_and_extract(serial, remote_bck):
local_bck = WORK_DIR / Path(remote_bck).name
local_zip = WORK_DIR / "backup.zip"
extract_dir = WORK_DIR / "backup_extracted"
print()
print(f'Pulling "{remote_bck}" to "{local_bck}" ...')
res = adb_pull(serial, remote_bck, local_bck)
if res.returncode != 0:
print("[ERROR] Failed to pull backup from Android.")
input("Press Enter to exit...")
sys.exit(1)
if local_zip.exists():
local_zip.unlink()
# Rename pulled file to backup.zip
shutil.move(str(local_bck), str(local_zip))
if extract_dir.exists():
shutil.rmtree(extract_dir)
print(f"Extracting backup.zip to '{extract_dir}' ...")
try:
with zipfile.ZipFile(local_zip, "r") as zf:
zf.extractall(extract_dir)
except Exception as e:
print(f"[ERROR] Failed to extract backup.zip: {e}")
input("Press Enter to exit...")
sys.exit(1)
db_path = extract_dir / "nova.db"
return db_path
# ------------------------------------------------------------------------
# Local source selection
# ------------------------------------------------------------------------
def use_local_source():
print("--- Local Database Selection ---")
print(f'Enter the path to nova.db or a .novabackup or .zip file.')
print(f'Default: {WORK_DIR / "backup_extracted" / "nova.db"}')
print()
while True:
user_db = prompt("Path to database or backup file [Enter for default]")
if not user_db:
db_path = WORK_DIR / "backup_extracted" / "nova.db"
else:
user_db = user_db.strip().strip('"')
db_path = Path(user_db).resolve()
if not db_path.exists():
print(f"[ERROR] File not found: '{db_path}'")
retry = prompt("Try again? [Y/n]", "y")
if retry.lower().startswith("n"):
sys.exit(1)
continue
ext = db_path.suffix.lower()
if ext == ".novabackup":
return extract_local_archive(db_path, restore_prompt=True)
elif ext == ".zip":
return extract_local_archive(db_path, restore_prompt=False)
else:
return db_path
def extract_local_archive(archive_path, restore_prompt=False):
extract_dir = WORK_DIR / "backup_extracted"
if extract_dir.exists():
shutil.rmtree(extract_dir)
print(f'Extracting "{archive_path}" to "{extract_dir}" ...')
try:
with zipfile.ZipFile(archive_path, "r") as zf:
zf.extractall(extract_dir)
except Exception as e:
print(f"[ERROR] Failed to extract archive: {e}")
input("Press Enter to exit...")
sys.exit(1)
db_path = extract_dir / "nova.db"
if restore_prompt and yes_no("Restore this backup in Nova on the connected device?"):
restore_backup_to_device(db_path)
return db_path
def restore_backup_to_device(db_path):
if not ADB_EXE.exists():
print(f"[ERROR] adb.exe not found at '{ADB_EXE}'; cannot send backup to device.")
input("Press Enter to exit...")
sys.exit(1)
devices = adb_devices()
if not devices:
print("[ERROR] No connected ADB device found; cannot restore the backup.")
input("Press Enter to exit...")
sys.exit(1)
serial = devices[0]
nova_backup_dir = "/storage/emulated/0/Android/data/com.teslacoilsw.launcher/files/Backup"
print(f'Copying "{db_path}" to Nova backup folder on {serial} ...')
adb_shell(serial, f"mkdir -p '{nova_backup_dir}'")
res = adb_push(serial, db_path, nova_backup_dir + "/")
if res.returncode != 0:
print("[ERROR] Failed to copy the backup to the device.")
input("Press Enter to exit...")
sys.exit(1)
print(f"Launching Nova Launcher settings on {serial} ...")
run([
str(ADB_EXE), "-s", serial, "shell",
"am", "start",
"-n",
"com.teslacoilsw.launcher/com.teslacoilsw.launcher.preferences.SettingsActivity"
])
print("In Nova, choose Backup & restore and restore the backup you copied.")
# ------------------------------------------------------------------------
# SQLite helpers (use Python sqlite3 module, fall back to CLI)
# ------------------------------------------------------------------------
def sqlite_query(db_path, sql, params=()):
"""Execute a SELECT query using Python sqlite3. Returns list of tuples."""
try:
conn = sqlite3.connect(str(db_path))
cur = conn.execute(sql, params)
rows = cur.fetchall()
conn.close()
return rows
except sqlite3.Error as e:
print(f"[ERROR] SQLite query failed: {e}")
input("Press Enter to exit...")
sys.exit(1)
def sqlite_query_cli(db_path, sql, params=()):
"""Fallback: write SQL to temp file and run sqlite3 CLI."""
sql_file = TEMP / "adbfolder_query.sql"
sql_file.write_text(sql, encoding="utf-8")
res = run([str(SQLITE_EXE), str(db_path)], input=sql, text=True)
if res.returncode != 0:
print(f"[ERROR] sqlite3 CLI failed: {res.stderr}")
input("Press Enter to exit...")
sys.exit(1)
rows = []
for line in res.stdout.strip().splitlines():
rows.append(tuple(line.split("\t")))
return rows
# ------------------------------------------------------------------------
# Target enumeration
# ------------------------------------------------------------------------
class Target:
def __init__(self, num, label, where, order):
self.num = num
self.label = label
self.where = where
self.order = order
def enumerate_targets(db_path):
targets = []
tgt_count = 0
listed_folder_ids = set()
# 1. Dock
print("dock")
tgt_count += 1
targets.append(Target(tgt_count, "dock apps", "f.container = -101",
"f.screen, f.cellY, f.cellX, f.rank, f._id"))
print(f" [{tgt_count}] dock apps")
rows = sqlite_query(db_path,
"SELECT _id, COALESCE(NULLIF(TRIM(title), ''), '(Untitled Folder)') "
"FROM favorites WHERE itemType = 2 AND container = -101 "
"ORDER BY cellY, cellX, rank, _id")
for fid, fname in rows:
tgt_count += 1
label = f"dock - {fname}"
targets.append(Target(tgt_count, label, f"f.container = {fid}",
"f.rank, f._id"))
listed_folder_ids.add(str(fid))
print(f" [{tgt_count}] {fname}")
# 2. Panes 0-14
for pane in range(15):
tgt_count = scan_pane(db_path, pane, targets, tgt_count, listed_folder_ids)
# 3. Other folders (orphaned folders not under dock or a pane)
rows = sqlite_query(db_path,
"SELECT _id, COALESCE(NULLIF(TRIM(title), ''), '(Untitled Folder)') "
"FROM favorites WHERE itemType = 2 "
"ORDER BY LOWER(title), _id")
other_has_folders = False
for fid, fname in rows:
if str(fid) in listed_folder_ids:
continue
if not other_has_folders:
print("other")
other_has_folders = True
tgt_count += 1
label = f"other - {fname}"
targets.append(Target(tgt_count, label, f"f.container = {fid}",
"f.rank, f._id"))
print(f" [{tgt_count}] {fname}")
return targets, tgt_count
def scan_pane(db_path, pane, targets, tgt_count, listed_folder_ids):
rows = sqlite_query(db_path,
"SELECT _id, COALESCE(NULLIF(TRIM(title), ''), '(Untitled Folder)') "
"FROM favorites WHERE itemType = 2 AND container = -100 "
"AND CAST(screen AS INTEGER) = ? "
"ORDER BY cellY, cellX, rank, _id", (pane,))
loose_cnt = sqlite_query(db_path,
"SELECT COUNT(*) FROM favorites WHERE container = -100 "
"AND CAST(screen AS INTEGER) = ? AND itemType <> 2", (pane,))[0][0]
has_pane_folders = len(rows) > 0
print_header = has_pane_folders or loose_cnt > 0
if print_header:
print(f"pane {pane}")
for fid, fname in rows:
tgt_count += 1
label = f"pane {pane} - {fname}"
targets.append(Target(tgt_count, label, f"f.container = {fid}",
"f.rank, f._id"))
listed_folder_ids.add(str(fid))
print(f" [{tgt_count}] {fname}")
if loose_cnt > 0:
tgt_count += 1
label = f"pane {pane} loose apps"
where = (f"f.container = -100 AND CAST(f.screen AS INTEGER) = {pane} "
f"AND f.itemType <> 2")
order = "f.cellY, f.cellX, f.rank, f._id"
targets.append(Target(tgt_count, label, where, order))
print(f" [{tgt_count}] pane {pane} loose apps")
return tgt_count
# ------------------------------------------------------------------------
# Sanitize label -> safe filename
# ------------------------------------------------------------------------
def sanitize_label(label):
safe = re.sub(r'[\\/:*?"<>|() ]+', '_', label).strip('_')
if not safe:
safe = "nova_target"
return safe
# ------------------------------------------------------------------------
# Run query and format output
# ------------------------------------------------------------------------
def run_query(db_path, target, work_dir):
safe_name = sanitize_label(target.label)
raw_out = work_dir / "output.txt"
clean_out = work_dir / f"{safe_name}_apps.txt"
log_out = work_dir / "adbfolder_log.txt"
sql = f"""
SELECT f._id AS item_id,
f.title AS display_name,
CASE
WHEN f.iconPackage IS NOT NULL AND LENGTH(TRIM(f.iconPackage)) > 0
THEN TRIM(f.iconPackage)
WHEN INSTR(f.intent, 'component=') > 0 THEN
CASE
WHEN INSTR(SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10), '/') > 0
THEN SUBSTR(SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10),
1, INSTR(SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10), '/') - 1)
WHEN INSTR(SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10), ';') > 0
THEN SUBSTR(SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10),
1, INSTR(SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10), ';') - 1)
ELSE SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10)
END
WHEN INSTR(f.intent, 'package=') > 0 THEN
CASE
WHEN INSTR(SUBSTR(f.intent, INSTR(f.intent, 'package=') + 8), ';') > 0
THEN SUBSTR(SUBSTR(f.intent, INSTR(f.intent, 'package=') + 8),
1, INSTR(SUBSTR(f.intent, INSTR(f.intent, 'package=') + 8), ';') - 1)
ELSE SUBSTR(f.intent, INSTR(f.intent, 'package=') + 8)
END
ELSE ''
END AS package_name,
f.intent
FROM favorites f
WHERE {target.where}
ORDER BY {target.order};
"""
print()
print(f'Querying "{target.label}" ...')
try:
rows = sqlite_query(db_path, sql)
except SystemExit:
rows = sqlite_query_cli(db_path, sql)
# Write raw tab-delimited output (all columns)
with open(raw_out, "w", encoding="utf-8") as f:
f.write("item_id\tdisplay_name\tpackage_name\tintent\n")
for row in rows:
f.write("\t".join(str(c) if c is not None else "" for c in row) + "\n")
# Format only package_name and display_name, in that order
display_rows = [(row[2], row[1]) for row in rows] # (package_name, display_name)
table_text = ""
if display_rows:
table_text = tabulate(
display_rows,
headers=["package_name", "display_name"],
tablefmt="plain"
)
indented = [" " + line for line in table_text.splitlines()]
# Header matching batch format
if target.label.startswith("pane ") and " - " in target.label:
parts = target.label.split(" - ", 1)
pane_num = parts[0].replace("pane ", "").strip()
folder_name = parts[1]
header = f' pane {pane_num} folder "{folder_name}"'
else:
header = f" {target.label}"
clean_text = header + "\n" + "\n".join(indented) + "\n"
# Write clean output
clean_out.write_text(clean_text, encoding="utf-8")
# Append to running log
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
entry = (
"\n============================================================\n"
f"Export: {timestamp}\n"
f"{clean_text}"
)
with open(log_out, "a", encoding="utf-8") as f:
f.write(entry)
print()
print(f"--- Result ({clean_out}) ---")
print()
print(clean_text)
print(f"Raw tab-delimited output saved to: {raw_out}")
print(f"Formatted app list saved to: {clean_out}")
print(f"Running export log saved to: {log_out}")
print()
return clean_out
# ------------------------------------------------------------------------
# Optional: check missing third-party packages
# ------------------------------------------------------------------------
def check_missing_3p(serial, db_path, work_dir):
print()
if not yes_no("Check user apps -3 with no icon in Nova before quitting?"):
return
if not ADB_EXE.exists():
print(f"[INFO] adb.exe not found at '{ADB_EXE}'; skipping device package check.")
return
devices = adb_devices()
if not devices:
print("[INFO] No connected ADB device found; skipping device package check.")
return
target_serial = devices[0]
debug(f"RUN_ADB_TARGET={target_serial}")
if not db_path or not db_path.exists():
print("[INFO] Nova database not available; skipping device package check.")
return
resolve_labels = yes_no(
"Resolve app titles via adb/aapt slower over Wi-Fi?",
default="n"
)
do_resolve = resolve_labels
pm_3p_file = TEMP / "adbfolder_pm3.txt"
nova_pkgs_file = TEMP / "adbfolder_nova_pkgs.txt"
unplaced_out = work_dir / "unplaced_user_apps.txt"
print(f"Querying third-party packages from device {target_serial} ...")
res = adb_shell(target_serial, "pm list packages -3 2>/dev/null")
pm_3p_file.write_text(res.stdout, encoding="utf-8")
installed3 = set()
for line in pm_3p_file.read_text(encoding="utf-8").splitlines():
p = line.replace("\r", "").strip()
if p.startswith("package:"):
p = p[8:].strip()
if p:
installed3.add(p)
print("Querying packages referenced anywhere in nova.db ...")
rows = sqlite_query(db_path,
"SELECT DISTINCT package_name FROM ("
" SELECT CASE"
" WHEN iconPackage IS NOT NULL AND LENGTH(TRIM(iconPackage)) > 0"
" THEN TRIM(iconPackage)"
" WHEN INSTR(intent, 'component=') > 0 THEN"
" CASE"
" WHEN INSTR(SUBSTR(intent, INSTR(intent, 'component=') + 10), '/') > 0"
" THEN SUBSTR(SUBSTR(intent, INSTR(intent, 'component=') + 10),"
" 1, INSTR(SUBSTR(intent, INSTR(intent, 'component=') + 10), '/') - 1)"
" ELSE SUBSTR(intent, INSTR(intent, 'component=') + 10)"
" END"
" ELSE ''"
" END AS package_name"
" FROM favorites"
")"
"WHERE LENGTH(package_name) > 0")
in_nova = set()
for (pkg,) in rows:
if pkg:
in_nova.add(pkg)
missing = sorted(installed3 - in_nova, key=str.lower)
results = []
for i, pkg in enumerate(missing, 1):
label = ""
if do_resolve:
if i % 10 == 1 or i == len(missing):
print(f"Resolving titles: {i}/{len(missing)} ({pkg})...")
dump = adb_shell(
target_serial,
f"dumpsys package {pkg} 2>/dev/null"
)
for dl in dump.stdout.splitlines():
m = re.search(r'nonLocalizedLabel="([^"]+)"', dl)
if m:
label = m.group(1).strip()
if not label:
# Try aapt path
# apk_path = shutil.which("aapt") or shutil.which("aapt2")
apk_path = which("aapt") or which("aapt2")
if apk_path:
path_res = adb_shell(
target_serial,
f"pm path {pkg} 2>/dev/null"
)
for pl in path_res.stdout.splitlines():
pl = pl.strip()
if pl.startswith("package:"):
apk_remote = pl[8:].strip()
apk_local = TEMP / "adbfolder_probe.apk"
pull_res = adb_pull(
target_serial,
apk_remote,
apk_local
)
if pull_res.returncode == 0 and apk_local.exists():
badging = run([
apk_path,
"dump",
"badging",
str(apk_local)
])
if badging.stdout:
for bl in badging.stdout.splitlines():
m = re.match(
r"^application-label:'([^']+)'",
bl
)
if m:
label = m.group(1).strip()
break
if badging.returncode != 0:
debug(
f"AAPT failed for {pkg}: {badging.stderr}"
)
try:
apk_local.unlink()
except Exception:
pass
break
results.append((pkg, label))
# Write output
lines = []
if results:
lines.append(
tabulate(
results,
headers=["package_name", "app_title"],
tablefmt="plain"
).splitlines()
)
flat = []
for group in lines:
flat.extend(group)
table_text = "\n".join(flat) + ("\n" if flat else "")
unplaced_out.write_text(table_text, encoding="utf-8")
print()
print(
f"User packages (-3): {len(installed3)} | "
f"In Nova layout: {len(in_nova)} | "
f"No icon in Nova: {len(missing)}"
)
if results:
print()
print(table_text.rstrip())
print(f"Saved unplaced user app list to: {unplaced_out}")
print()
# Cleanup temp files unless debug
if not DEBUG:
for f in [pm_3p_file, nova_pkgs_file]:
try:
f.unlink()
except Exception:
pass
# ------------------------------------------------------------------------
# Main
# ------------------------------------------------------------------------
def main():
global DEBUG
# Allow env override
if os.environ.get("ADBFOLDER_DEBUG", "0") == "1":
DEBUG = True
check_dependencies()
print("Select source for Nova Launcher database:")
print("[1] Pull .novabackup from Android via ADB and extract nova.db [Default]")
print("[2] Use an existing nova.db or .novabackup or .zip already on Windows")
print()
src_choice = prompt("Enter choice [1 or 2]", "1")
if src_choice == "2":
db_path = use_local_source()
else:
db_path = pull_from_android()
if not db_path or not db_path.exists():
print(f"[ERROR] nova.db not found at: '{db_path}'")
input("Press Enter to exit...")
sys.exit(1)
print()
print(f"Using database: {db_path}")
print("Scanning Nova Launcher dock, panes and folders ...")
print()
targets, tgt_count = enumerate_targets(db_path)
print()
pick = prompt(f"Select number [1-{tgt_count}, q to quit]")
if pick.lower() == "q" or pick == "0":
check_missing_3p(None, db_path, WORK_DIR)
print("Bye.")
return
try:
idx = int(pick) - 1
if not (0 <= idx < tgt_count):
raise ValueError
except ValueError:
print(f"[ERROR] Invalid selection: '{pick}'")
input("Press Enter to exit...")
sys.exit(1)
target = targets[idx]
debug(f"SELECTED_LABEL={target.label}")
debug(f"SQL_WHERE={target.where}")
debug(f"SQL_ORDER={target.order}")
run_query(db_path, target, WORK_DIR)
while True:
loop_more = yes_no("Export another folder or pane?", default="n")
if not loop_more:
break
# Re-enumerate (in case something changed) and pick again
targets, tgt_count = enumerate_targets(db_path)
print()
pick = prompt(f"Select number [1-{tgt_count}, q to quit]")
if pick.lower() == "q" or pick == "0":
break
try:
idx = int(pick) - 1
if not (0 <= idx < tgt_count):
raise ValueError
except ValueError:
print(f"[ERROR] Invalid selection: '{pick}'")
break
target = targets[idx]
run_query(db_path, target, WORK_DIR)
check_missing_3p(None, db_path, WORK_DIR)
input("Press Enter to exit...")
if __name__ == "__main__":
main()
# ----------------------------------------------------------------------
# end of adbfolder.py
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# Step by step description of what this script does
# ----------------------------------------------------------------------
# 1. Environment & Configuration Setup
# A. Command environment
# a. Initializes Python execution environment
# b. Imports required Python modules and dependencies
# B. Configuration variables
# a. Sets default configuration paths for ADB, SQLite
# and work directories
# b. Defines the DEBUG toggle flag
# c. Defines temporary and Android backup directories
#
# 2. Dependency Verification
# A. Executable checks
# a. Locates adb.exe and checks system PATH
# or configured fallback path
# b. Locates sqlite3.exe and exits with an error if missing
# B. Directory setup
# a. Creates the Nova work directory if it does not exist
#
# 3. Source Selection Menu
# A. Choice [1]: Pull from Android via ADB
# a. Detects connected ADB device target
# b. Optionally launches Nova Launcher settings to create a backup
# c. Lists .novabackup files in the remote backup directory
# with fallback search of Android storage
# d. Prompts user to select or enter a backup filename/path
# e. Pulls the selected .novabackup file to the Windows workspace
# f. Renames the pulled file to backup.zip and extracts it
# into backup_extracted to retrieve nova.db
# B. Choice [2]: Use Local Database / Archive
# a. Prompts user for a custom path to nova.db, .novabackup or .zip
# with a retry loop
# b. Validates file existence
# c. Automatically extracts archives when necessary
# d. Optionally offers to restore a .novabackup database
# to the device
#
# 4. Database Verification & Target Enumeration
# A. Database validation
# a. Verifies that nova.db exists at the target path
# B. Section 1 [Dock]
# a. Scans dock apps [container = -101]
# b. Scans and lists any dock folders
# C. Section 2 [Panes 0-14]
# a. Iterates through home screen panes 0 to 14
# via the scan_pane function
# b. Queries pane folders [itemType = 2, container = -100]
# c. Checks for loose non-folder apps [itemType <> 2] on each pane
# D. Section 3 [Other Folders]
# a. Searches for orphaned folders not categorized under dock
# or panes
# b. Lists and registers remaining folders
#
# 5. User Selection & Query Execution [run_query]
# A. Selection & Sanity
# a. Prompts user to select a target number or quit [q or 0]
# b. Sanitizes the selected label to generate a safe filename
# B. Query Generation & Execution
# a. Builds a dynamic SQLite query extracting:
# i. Item ID
# ii. Display name
# iii. Package name
# iv. Raw intent
# b. Executes the query against nova.db using Python sqlite3
# c. Falls back to the sqlite3 command-line executable if necessary
# C. Output & Formatting
# a. Writes raw tab-delimited results to output.txt
# b. Formats output columns [package_name, display_name]
# into an aligned table via tabulate
# c. Adds a descriptive pane/folder heading and indents the table
# by two spaces for easier reading and future concatenation
# d. Saves formatted results to [target]_apps.txt
# e. Appends each formatted export with a timestamp to
# adbfolder_log.txt without overwriting previous exports
# f. Displays the formatted results and output file locations
# D. Repeat Export
# a. Prompts user to export another folder or pane
# b. Re-enumerates targets in case the database layout has changed
# c. Repeats the selection and export process as requested
#
# 6. Optional Unplaced Third-Party Package Check [check_missing_3p]
# A. Pre-check Validation
# a. Prompts user whether to check for user-installed packages
# [-3] missing from the Nova layout
# b. Verifies ADB device connectivity and database availability
# c. Optionally prompts to resolve app titles via adb/aapt
# B. Data Collection
# a. Queries installed third-party packages from device
# [adb shell pm list packages -3]
# b. Queries all referenced packages inside nova.db
# c. Compares installed packages against packages referenced in Nova
# C. Optional App Title Resolution
# a. Runs adb shell dumpsys package for each unplaced package
# b. Searches for nonLocalizedLabel in the package information
# c. If unavailable, uses adb shell pm path to locate the APK
# d. Pulls the APK to the PC and uses aapt/aapt2 to read its label
# D. Diff Analysis & Output
# a. Identifies installed third-party packages with no Nova icon
# b. Generates a formatted package_name / app_title table
# c. Saves results to unplaced_user_apps.txt
# d. Displays package counts and the resulting unplaced app list
# E. Cleanup
# a. Removes temporary package-list files unless DEBUG=1
# b. Exits cleanly
# -------------------------------------------------------------------
# -------------------------------------------------------------------
--
Usenet is all about intelligent kind-hearted people helping the team learn.
Re: Can we programmatically get package names of icons in a homescreen folder?
Author: Maria Sophia
Date: Sun, 22 Nov 2026 19:47
Date: Sun, 22 Nov 2026 19:47
1230 lines
49181 bytes
49181 bytes
I tentatively declare this functionality has never been written before.
AFAICT anyway... (but I'd be happy if someone can prove me wrong)...
I ran a seach today, and while I can find some overlap (see references
added to the code below), this appears to be UNIQUE functionality for us.
Which is a good thing.
I'm all about adding value that was not there before I added it.
It's how I'm wired.
Below is a sample run so people get an idea of the input and output steps.
C:\app\editor\android\scrcpy> python adbfolder.py
Checking required tools (adb and sqlite3) ...
Working directory: C:\app\editor\android\scrcpy
Nova work directory: C:\app\editor\android\scrcpy\nova
----------------
Select source for Nova Launcher database:
[1] Pull .novabackup from Android via ADB and extract nova.db [Default]
[2] Use an existing nova.db or .novabackup or .zip already on Windows
Enter choice [1 or 2] [Default: 1]: 1
--- Pull Nova Backup from Android ---
Targeting device: 192.168.1.4:5555
Open Nova Launcher settings on device to create a new backup first? [y/N] [Default: n]: n
Listing backups in /storage/emulated/0/0000/bck/nova_backup ...
[1] 2026-11-21_16-55.novabackup
[2] 2026-11-21_16-37.novabackup
[3] 2026-11-21_11-39.novabackup
[4] 2026-11-21_11-05.novabackup
[5] 2026-11-21_10-26.novabackup
[6] 2026-11-20_21-09.novabackup
[7] 2026-11-20_20-49.novabackup
[8] 2026-11-20_20-48.novabackup
[9] 2026-11-20_00-43.novabackup
[10] 2026-11-20_00-28.novabackup
[11] 2026-11-19_12-57.novabackup
[12] 2026-08-19_21-51.novabackup
[13] 2026-08-19_11-31.novabackup
[14] 2026-08-16_11-36.novabackup
Select backup number [1-14, Default: 1] [Default: 1]: 1
Pulling "/storage/emulated/0/0000/bck/nova_backup/2026-11-21_16-55.novabackup" to "C:\app\editor\android\scrcpy\nova\2026-11-21_16-55.novabackup" ...
Extracting backup.zip to 'C:\app\editor\android\scrcpy\nova\backup_extracted' ...
Using database: C:\app\editor\android\scrcpy\nova\backup_extracted\nova.db
Scanning Nova Launcher dock, panes and folders ...
dock
[1] dock apps
[2] shortcuts
pane 0
[3] track
[4] Remote
[5] TTS
[6] webcam
[7] todo
[8] automate
[9] obd
[10] stuff
[11] sos
[12] Clock
[13] backgnd
[14] converter
[15] privacy
[16] SvcMode
[17] epub
[18] PlantID
[19] hike
[20] motion
[21] toon
[22] shortcut
pane 1
[23] time
[24] comms
[25] buy
[26] files
[27] net
[28] web
[29] weather
[30] nature
[31] auto
[32] pic
[33] audio
[34] vid
[35] todo
[36] spoof
[37] sensor
[38] apk
[39] sys
Select number [1-39, q to quit]: 36
Querying "pane 1 - spoof" ...
--- Result (C:\app\editor\android\scrcpy\nova\pane_1_-_spoof_apps.txt) ---
pane 1 folder "spoof"
package_name display_name
com.rasfar.mock.location Mocation
com.discipleskies.mock_location_spoofer DS Fake GPS Location
com.mock.cartage Cartage
fake.gps.location.changer.spoof.location Fake GPS Location
com.bomerapps.movablemockgps Movable Mock GPS
Raw tab-delimited output saved to: C:\app\editor\android\scrcpy\nova\output.txt
Formatted app list saved to: C:\app\editor\android\scrcpy\nova\pane_1_-_spoof_apps.txt
Running export log saved to: C:\app\editor\android\scrcpy\nova\adbfolder_log.txt
Export another folder or pane? [y/N] [Default: n]: n
Check user apps -3 with no icon in Nova before quitting? [y/N] [Default: n]: y
Resolve app titles via adb/aapt slower over Wi-Fi? [y/N] [Default: n]: y
Querying third-party packages from device 192.168.1.4:5555 ...
Querying packages referenced anywhere in nova.db ...
Resolving titles: 1/65 (ai.articlereader.mobileapp)...
Resolving titles: 11/65 (com.cloudedge.smarteye)...
Resolving titles: 21/65 (com.i45.launchdialer)...
Resolving titles: 31/65 (com.netvor.settings.database.provider)...
Resolving titles: 41/65 (dev.patrickgold.florisboard)...
Resolving titles: 51/65 (org.bromite.webview)...
Resolving titles: 61/65 (org.schabi.newpipe.debug)...
Resolving titles: 65/65 (za.kilowatch.ultimatefilemanager)...
User packages (-3): 635 | In Nova layout: 856 | No icon in Nova: 65
package_name app_title
ai.articlereader.mobileapp Article Reader
app.fluffy Fluffy
asav.roomtemperature.us Room Temperature Thermometer
aws.apps.usbDeviceEnumerator USB Device Info
com.alextern.shortcutexecutors ShortcutExecutors
.... scores of identified headless apps removed for brevity ...
qrcodegenerator.qrcreator.qrmaker.createqrcode QR Code Generator
rb.camere AllWrite
za.kilowatch.ultimatefilemanager Ultimate File Manager Pro
Saved unplaced user app list to: C:\app\editor\android\scrcpy\nova\unplaced_user_apps.txt
Press Enter to exit...
C:\app\editor\android\scrcpy> type adbfolder.py
#!/usr/bin/env python3
# ----------------------------------------------------------------------
# adbfolder.py
# Usage: python adbfolder.py
# ----------------------------------------------------------------------
# This functionality doesn't exist anywhere else in the world (AFAIK).
# An Android homescreen forensic inventory and archival utility.
#
# Outputs a perfect textual inventory, with debug capability, of an Android
# homescreen, including location of all panes, folders, packages and titles.
#
# Requires adb, sqlite3, tabulate and Nova Launcher (on Android).
# Optionally requires aapt/aapt2 to determine labels on orphan packages.
#
# Intended to assist in debug, inventory, archival, backup and restore.
# Tested on Windows over Wi-Fi/USB, but should work on macOS/Linux also.
#
# Will pull a backup from android via adb or read an existing nova db or
# nova backup archive on windows needing only adb and sql dependencies
#
# List order is top to bottom, left to right, meaning the leftmost pane
# is 1st, then subsequent panes, from 0 to 1 to 2 and so on to the right.
#
# Similarly, the topleft folder is 1st, then the next folder to the right.
#
# Likewise, packages and titles inside of folders are listed in top to
# bottom order, left to right, providing an exact textual description.
#
# Bare icons, not inside folders, are listed separately as a line item.
# The dock and folders in the dock are treated much like the panes are.
#
# This script not only provides a textual inventory of the name and
# homescreen location of every folder name, package name and display
# name ever added to the homescreen, but it optionally will 'diff'
# against packages which were manually installed by the user but
# which have no current homescreen icon (i.e., "headless" apps).
#
# Note the display_name is the current icon title for a given app icon,
# which can be changed by the user, so it's not always the original.
# However, for apps installed by the user but without homescreen icons,
# the optional lookup pulls the app's original defined Android app_label.
#
# Output is appended to a timestamped running log file for traceability.
# Unless the user wipes out the running log, this becomes an automatic
# audit of all the physical changes a user has made to the homescreen.
# ----------------------------------------------------------------------
# Q: Why is saying YES to "Resolve app titles via adb/aapt" very slow?
# A: For each of the unplaced packages, the script does:
# a. adb shell dumpsys package <pkg> to look for nonLocalizedLabel=
# b. If that fails: adb shell pm path <pkg> to find the APK location
# c. adb pull <apk> to download the APK to the PC
# d. aapt dump badging <apk> to read the app label from the APK
# Which is up to 4 ADB commands times N apps = 4N round-trips.
# Over USB, each round-trip is fast (milliseconds).
# But, over Wi-Fi, each one has wireless handshake latency,
# so the total time adds up just waiting on ADB to return results.
# ----------------------------------------------------------------------
# I think this is unique functionality, but please see also:
# novalaunchereditor
# <https://github.com/SamLeatherdale/novalaunchereditor>
# SQLite Viewer
# <https://www.sqliteview.com/app>
# Note that Lawnchair purports to import Nova SQL databases
# <https://github.com/LawnchairLauncher/docs/blob/main/help/core-features/backup-restore-and-reset.md>
# ----------------------------------------------------------------------
# v2p0 20261122 Searched the Internet for any application that has this
# functionality (see references above) and didn't find anything yet.
# v1p9 20261122 Replaced redundant which() wrapper with a direct
# shutil.which import so that which("adb"), which("sqlite3"),
# which("aapt") and which("aapt2") all work out of the box.
# v1p8 20261121 Fixed bugs in the optional search for orphan packages
# v1p7 20261121 Modified the closing comments to reflect the python flow
# Fixed passing of capture_output=True and text=True twice by
# mistake in the helper section.
# v1p6 20261121 Ported to adbfolder.py v1p6 (took a half-dozen iterations)
# Matched output of abfolder.bat v6p1 with adbfolder.py v1p6
# v1p0 20261121 First attempt at porting adbfolder.bat to adbfolder.py
# What's different between the batch and python is mostly:
# a. SQLite queries primarily use Python's built-in sqlite3 module.
# b. Output tables use the third-party tabulate module.
# c. Archive extraction uses Python's zipfile.
# d. Filename sanitization uses Python regular expressions.
# e. There are no generated PowerShell scripts or BAT subroutines.
# f. The optional missing-package check uses Python sets to
# compare installed packages against Nova database packages.
# g. Debugging is enabled with DEBUG = True or the ADBFOLDER_DEBUG=1
# environment variable.
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
import os
import sys
import re
import subprocess
import shutil
import sqlite3
import zipfile
import logging
from shutil import which
from pathlib import Path
from datetime import datetime
from tabulate import tabulate
# ------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------
DEBUG = False # set True for verbose traces
ADB_EXE = Path(r"C:\app\editor\android\scrcpy\adb.exe")
SQLITE_EXE = Path(r"C:\app\editor\android\sdk\platform-tools\sqlite3.exe")
WORK_DIR = Path(r"C:\app\editor\android\scrcpy\nova")
ANDROID_BCK_DIR = "/storage/emulated/0/0000/bck/nova_backup"
DEFAULT_CONTAINER = 2921
TEMP = Path(os.environ.get("TEMP", Path.home() / "tmp"))
def debug(msg):
if DEBUG:
print(f"[DEBUG] {msg}")
# ------------------------------------------------------------------------
# Helpers
# ------------------------------------------------------------------------
def run(cmd, **kwargs):
"""Run a command and return CompletedProcess."""
debug(f"Running: {' '.join(map(str, cmd))}")
kwargs.setdefault("capture_output", True)
kwargs.setdefault("text", True)
kwargs.setdefault("encoding", "utf-8")
kwargs.setdefault("errors", "replace")
kwargs.setdefault("timeout", 60)
return subprocess.run(cmd, **kwargs)
def ensure_dir(path: Path):
path.mkdir(parents=True, exist_ok=True)
def prompt(msg, default=None):
if default is not None:
msg = f"{msg} [Default: {default}]: "
else:
msg = f"{msg}: "
val = input(msg).strip()
return val if val else (default or "")
def yes_no(msg, default="n"):
val = prompt(f"{msg} [y/N]" if default != "y" else f"{msg} [Y/n]", default)
return val.lower().startswith("y")
# ------------------------------------------------------------------------
# Dependency check
# ------------------------------------------------------------------------
def check_dependencies():
print("Checking required tools (adb and sqlite3) ...")
# ADB
global ADB_EXE
path_adb = which("adb")
if not ADB_EXE.exists():
if path_adb:
print(f"[INFO] Configured ADB_EXE not found; using PATH: {path_adb}")
ADB_EXE = Path(path_adb)
else:
print(f"[WARN] adb.exe not found at '{ADB_EXE}' and not in PATH.")
else:
if not path_adb:
print(f"[INFO] adb.exe found at configured path, though not in PATH.")
# SQLite
global SQLITE_EXE
path_sqlite = which("sqlite3")
if not SQLITE_EXE.exists():
if path_sqlite:
print(f"[INFO] Configured SQLITE_EXE not found; using PATH: {path_sqlite}")
SQLITE_EXE = Path(path_sqlite)
else:
print(f"[ERROR] sqlite3.exe not found at '{SQLITE_EXE}' and not in PATH.")
input("Press Enter to exit...")
sys.exit(1)
else:
if not path_sqlite:
print(f"[INFO] sqlite3.exe found at configured path, though not in PATH.")
ensure_dir(WORK_DIR)
print(f"Working directory: {Path.cwd()}")
print(f"Nova work directory: {WORK_DIR}")
print("----------------")
print()
# ------------------------------------------------------------------------
# ADB helpers
# ------------------------------------------------------------------------
def adb_devices():
"""Return list of connected device serials."""
res = run([str(ADB_EXE), "devices"])
devices = []
for line in res.stdout.strip().splitlines()[1:]:
parts = line.split()
if parts and "\t" in line or len(parts) >= 2:
serial = parts[0]
state = parts[1] if len(parts) > 1 else ""
if state == "device":
devices.append(serial)
return devices
def adb_shell(serial, cmd):
return run([str(ADB_EXE), "-s", serial, "shell", cmd])
def adb_pull(serial, remote, local):
return run([str(ADB_EXE), "-s", serial, "pull", remote, str(local)])
def adb_push(serial, local, remote):
return run([str(ADB_EXE), "-s", serial, "push", str(local), remote])
# ------------------------------------------------------------------------
# Backup pull from Android
# ------------------------------------------------------------------------
def pull_from_android():
print("--- Pull Nova Backup from Android ---")
if not ADB_EXE.exists():
print(f"[ERROR] adb.exe not found at: '{ADB_EXE}'")
input("Press Enter to exit...")
sys.exit(1)
devices = adb_devices()
if not devices:
print("[ERROR] No connected ADB devices found.")
input("Press Enter to exit...")
sys.exit(1)
serial = devices[0]
debug(f"ADB_TARGET={serial}")
print(f"Targeting device: {serial}")
make_bck = yes_no("Open Nova Launcher settings on device to create a new backup first?")
if make_bck:
print("Launching Nova Launcher settings on device ...")
print("Tap Backup & restore > Backup > Save to save to your device")
run([
str(ADB_EXE), "-s", serial, "shell",
"am", "start",
"-n",
"com.teslacoilsw.launcher/com.teslacoilsw.launcher.preferences.SettingsActivity"
])
input("Create your backup in Nova Launcher on the device, then press ENTER to list backups.")
print(f"Listing backups in {ANDROID_BCK_DIR} ...")
print()
# List backups in default dir
res = adb_shell(serial, f"ls -1t '{ANDROID_BCK_DIR}'/*.novabackup 2>/dev/null")
backups = parse_adb_lines(res.stdout)
if not backups:
print(f"[INFO] No .novabackup files found in {ANDROID_BCK_DIR}.")
print("Searching Android storage for *.novabackup files ...")
print()
search_cmd = (
"for d in /storage/emulated/0 /storage/*; "
"do [ -d \"$d\" ] && [ \"$d\" != \"/storage/emulated\" ] && "
"find \"$d\" -maxdepth 5 -name '*.novabackup' 2>/dev/null; done"
)
res = adb_shell(serial, search_cmd)
backups = parse_adb_lines(res.stdout)
if not backups:
print(f"[WARN] No .novabackup files found in {ANDROID_BCK_DIR} or Android storage.")
remote_bck = manual_backup_path()
else:
print()
for i, (fname, fpath) in enumerate(backups, 1):
print(f" [{i}] {fname}")
pick = prompt(f"Select backup number [1-{len(backups)}, Default: 1]", "1")
try:
idx = int(pick) - 1
if not (0 <= idx < len(backups)):
raise ValueError
except ValueError:
# Treat as manual path
remote_bck = manual_backup_path(pick)
else:
fname, fpath = backups[idx]
remote_bck = fpath
return download_and_extract(serial, remote_bck)
def parse_adb_lines(text):
"""Parse ADB output into list of (filename, fullpath)."""
results = []
for line in text.splitlines():
line = line.strip().replace("\r", "")
if not line:
continue
path = Path(line)
fname = path.name
results.append((fname, line))
# Newest first, matching `ls -1t`
results.sort(key=lambda x: x[0], reverse=True)
return results
def manual_backup_path(prefill=""):
if prefill:
bck_file = prefill.strip().strip('"')
else:
bck_file = prompt(
"Enter backup filename or full Android path "
"e.g. 2026-11-19_12-57.novabackup"
)
if not bck_file:
print("[ERROR] No backup filename provided.")
input("Press Enter to exit...")
sys.exit(1)
remote_bck = bck_file
if not remote_bck.startswith("/"):
remote_bck = f"{ANDROID_BCK_DIR}/{remote_bck}"
fname = Path(remote_bck).name
return remote_bck
def download_and_extract(serial, remote_bck):
local_bck = WORK_DIR / Path(remote_bck).name
local_zip = WORK_DIR / "backup.zip"
extract_dir = WORK_DIR / "backup_extracted"
print()
print(f'Pulling "{remote_bck}" to "{local_bck}" ...')
res = adb_pull(serial, remote_bck, local_bck)
if res.returncode != 0:
print("[ERROR] Failed to pull backup from Android.")
input("Press Enter to exit...")
sys.exit(1)
if local_zip.exists():
local_zip.unlink()
# Rename pulled file to backup.zip
shutil.move(str(local_bck), str(local_zip))
if extract_dir.exists():
shutil.rmtree(extract_dir)
print(f"Extracting backup.zip to '{extract_dir}' ...")
try:
with zipfile.ZipFile(local_zip, "r") as zf:
zf.extractall(extract_dir)
except Exception as e:
print(f"[ERROR] Failed to extract backup.zip: {e}")
input("Press Enter to exit...")
sys.exit(1)
db_path = extract_dir / "nova.db"
return db_path
# ------------------------------------------------------------------------
# Local source selection
# ------------------------------------------------------------------------
def use_local_source():
print("--- Local Database Selection ---")
print(f'Enter the path to nova.db or a .novabackup or .zip file.')
print(f'Default: {WORK_DIR / "backup_extracted" / "nova.db"}')
print()
while True:
user_db = prompt("Path to database or backup file [Enter for default]")
if not user_db:
db_path = WORK_DIR / "backup_extracted" / "nova.db"
else:
user_db = user_db.strip().strip('"')
db_path = Path(user_db).resolve()
if not db_path.exists():
print(f"[ERROR] File not found: '{db_path}'")
retry = prompt("Try again? [Y/n]", "y")
if retry.lower().startswith("n"):
sys.exit(1)
continue
ext = db_path.suffix.lower()
if ext == ".novabackup":
return extract_local_archive(db_path, restore_prompt=True)
elif ext == ".zip":
return extract_local_archive(db_path, restore_prompt=False)
else:
return db_path
def extract_local_archive(archive_path, restore_prompt=False):
extract_dir = WORK_DIR / "backup_extracted"
if extract_dir.exists():
shutil.rmtree(extract_dir)
print(f'Extracting "{archive_path}" to "{extract_dir}" ...')
try:
with zipfile.ZipFile(archive_path, "r") as zf:
zf.extractall(extract_dir)
except Exception as e:
print(f"[ERROR] Failed to extract archive: {e}")
input("Press Enter to exit...")
sys.exit(1)
db_path = extract_dir / "nova.db"
if restore_prompt and yes_no("Restore this backup in Nova on the connected device?"):
restore_backup_to_device(db_path)
return db_path
def restore_backup_to_device(db_path):
if not ADB_EXE.exists():
print(f"[ERROR] adb.exe not found at '{ADB_EXE}'; cannot send backup to device.")
input("Press Enter to exit...")
sys.exit(1)
devices = adb_devices()
if not devices:
print("[ERROR] No connected ADB device found; cannot restore the backup.")
input("Press Enter to exit...")
sys.exit(1)
serial = devices[0]
nova_backup_dir = "/storage/emulated/0/Android/data/com.teslacoilsw.launcher/files/Backup"
print(f'Copying "{db_path}" to Nova backup folder on {serial} ...')
adb_shell(serial, f"mkdir -p '{nova_backup_dir}'")
res = adb_push(serial, db_path, nova_backup_dir + "/")
if res.returncode != 0:
print("[ERROR] Failed to copy the backup to the device.")
input("Press Enter to exit...")
sys.exit(1)
print(f"Launching Nova Launcher settings on {serial} ...")
run([
str(ADB_EXE), "-s", serial, "shell",
"am", "start",
"-n",
"com.teslacoilsw.launcher/com.teslacoilsw.launcher.preferences.SettingsActivity"
])
print("In Nova, choose Backup & restore and restore the backup you copied.")
# ------------------------------------------------------------------------
# SQLite helpers (use Python sqlite3 module, fall back to CLI)
# ------------------------------------------------------------------------
def sqlite_query(db_path, sql, params=()):
"""Execute a SELECT query using Python sqlite3. Returns list of tuples."""
try:
conn = sqlite3.connect(str(db_path))
cur = conn.execute(sql, params)
rows = cur.fetchall()
conn.close()
return rows
except sqlite3.Error as e:
print(f"[ERROR] SQLite query failed: {e}")
input("Press Enter to exit...")
sys.exit(1)
def sqlite_query_cli(db_path, sql, params=()):
"""Fallback: write SQL to temp file and run sqlite3 CLI."""
sql_file = TEMP / "adbfolder_query.sql"
sql_file.write_text(sql, encoding="utf-8")
res = run([str(SQLITE_EXE), str(db_path)], input=sql, text=True)
if res.returncode != 0:
print(f"[ERROR] sqlite3 CLI failed: {res.stderr}")
input("Press Enter to exit...")
sys.exit(1)
rows = []
for line in res.stdout.strip().splitlines():
rows.append(tuple(line.split("\t")))
return rows
# ------------------------------------------------------------------------
# Target enumeration
# ------------------------------------------------------------------------
class Target:
def __init__(self, num, label, where, order):
self.num = num
self.label = label
self.where = where
self.order = order
def enumerate_targets(db_path):
targets = []
tgt_count = 0
listed_folder_ids = set()
# 1. Dock
print("dock")
tgt_count += 1
targets.append(Target(tgt_count, "dock apps", "f.container = -101",
"f.screen, f.cellY, f.cellX, f.rank, f._id"))
print(f" [{tgt_count}] dock apps")
rows = sqlite_query(db_path,
"SELECT _id, COALESCE(NULLIF(TRIM(title), ''), '(Untitled Folder)') "
"FROM favorites WHERE itemType = 2 AND container = -101 "
"ORDER BY cellY, cellX, rank, _id")
for fid, fname in rows:
tgt_count += 1
label = f"dock - {fname}"
targets.append(Target(tgt_count, label, f"f.container = {fid}",
"f.rank, f._id"))
listed_folder_ids.add(str(fid))
print(f" [{tgt_count}] {fname}")
# 2. Panes 0-14
for pane in range(15):
tgt_count = scan_pane(db_path, pane, targets, tgt_count, listed_folder_ids)
# 3. Other folders (orphaned folders not under dock or a pane)
rows = sqlite_query(db_path,
"SELECT _id, COALESCE(NULLIF(TRIM(title), ''), '(Untitled Folder)') "
"FROM favorites WHERE itemType = 2 "
"ORDER BY LOWER(title), _id")
other_has_folders = False
for fid, fname in rows:
if str(fid) in listed_folder_ids:
continue
if not other_has_folders:
print("other")
other_has_folders = True
tgt_count += 1
label = f"other - {fname}"
targets.append(Target(tgt_count, label, f"f.container = {fid}",
"f.rank, f._id"))
print(f" [{tgt_count}] {fname}")
return targets, tgt_count
def scan_pane(db_path, pane, targets, tgt_count, listed_folder_ids):
rows = sqlite_query(db_path,
"SELECT _id, COALESCE(NULLIF(TRIM(title), ''), '(Untitled Folder)') "
"FROM favorites WHERE itemType = 2 AND container = -100 "
"AND CAST(screen AS INTEGER) = ? "
"ORDER BY cellY, cellX, rank, _id", (pane,))
loose_cnt = sqlite_query(db_path,
"SELECT COUNT(*) FROM favorites WHERE container = -100 "
"AND CAST(screen AS INTEGER) = ? AND itemType <> 2", (pane,))[0][0]
has_pane_folders = len(rows) > 0
print_header = has_pane_folders or loose_cnt > 0
if print_header:
print(f"pane {pane}")
for fid, fname in rows:
tgt_count += 1
label = f"pane {pane} - {fname}"
targets.append(Target(tgt_count, label, f"f.container = {fid}",
"f.rank, f._id"))
listed_folder_ids.add(str(fid))
print(f" [{tgt_count}] {fname}")
if loose_cnt > 0:
tgt_count += 1
label = f"pane {pane} loose apps"
where = (f"f.container = -100 AND CAST(f.screen AS INTEGER) = {pane} "
f"AND f.itemType <> 2")
order = "f.cellY, f.cellX, f.rank, f._id"
targets.append(Target(tgt_count, label, where, order))
print(f" [{tgt_count}] pane {pane} loose apps")
return tgt_count
# ------------------------------------------------------------------------
# Sanitize label -> safe filename
# ------------------------------------------------------------------------
def sanitize_label(label):
safe = re.sub(r'[\\/:*?"<>|() ]+', '_', label).strip('_')
if not safe:
safe = "nova_target"
return safe
# ------------------------------------------------------------------------
# Run query and format output
# ------------------------------------------------------------------------
def run_query(db_path, target, work_dir):
safe_name = sanitize_label(target.label)
raw_out = work_dir / "output.txt"
clean_out = work_dir / f"{safe_name}_apps.txt"
log_out = work_dir / "adbfolder_log.txt"
sql = f"""
SELECT f._id AS item_id,
f.title AS display_name,
CASE
WHEN f.iconPackage IS NOT NULL AND LENGTH(TRIM(f.iconPackage)) > 0
THEN TRIM(f.iconPackage)
WHEN INSTR(f.intent, 'component=') > 0 THEN
CASE
WHEN INSTR(SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10), '/') > 0
THEN SUBSTR(SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10),
1, INSTR(SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10), '/') - 1)
WHEN INSTR(SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10), ';') > 0
THEN SUBSTR(SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10),
1, INSTR(SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10), ';') - 1)
ELSE SUBSTR(f.intent, INSTR(f.intent, 'component=') + 10)
END
WHEN INSTR(f.intent, 'package=') > 0 THEN
CASE
WHEN INSTR(SUBSTR(f.intent, INSTR(f.intent, 'package=') + 8), ';') > 0
THEN SUBSTR(SUBSTR(f.intent, INSTR(f.intent, 'package=') + 8),
1, INSTR(SUBSTR(f.intent, INSTR(f.intent, 'package=') + 8), ';') - 1)
ELSE SUBSTR(f.intent, INSTR(f.intent, 'package=') + 8)
END
ELSE ''
END AS package_name,
f.intent
FROM favorites f
WHERE {target.where}
ORDER BY {target.order};
"""
print()
print(f'Querying "{target.label}" ...')
try:
rows = sqlite_query(db_path, sql)
except SystemExit:
rows = sqlite_query_cli(db_path, sql)
# Write raw tab-delimited output (all columns)
with open(raw_out, "w", encoding="utf-8") as f:
f.write("item_id\tdisplay_name\tpackage_name\tintent\n")
for row in rows:
f.write("\t".join(str(c) if c is not None else "" for c in row) + "\n")
# Format only package_name and display_name, in that order
display_rows = [(row[2], row[1]) for row in rows] # (package_name, display_name)
table_text = ""
if display_rows:
table_text = tabulate(
display_rows,
headers=["package_name", "display_name"],
tablefmt="plain"
)
indented = [" " + line for line in table_text.splitlines()]
# Header matching batch format
if target.label.startswith("pane ") and " - " in target.label:
parts = target.label.split(" - ", 1)
pane_num = parts[0].replace("pane ", "").strip()
folder_name = parts[1]
header = f' pane {pane_num} folder "{folder_name}"'
else:
header = f" {target.label}"
clean_text = header + "\n" + "\n".join(indented) + "\n"
# Write clean output
clean_out.write_text(clean_text, encoding="utf-8")
# Append to running log
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
entry = (
"\n============================================================\n"
f"Export: {timestamp}\n"
f"{clean_text}"
)
with open(log_out, "a", encoding="utf-8") as f:
f.write(entry)
print()
print(f"--- Result ({clean_out}) ---")
print()
print(clean_text)
print(f"Raw tab-delimited output saved to: {raw_out}")
print(f"Formatted app list saved to: {clean_out}")
print(f"Running export log saved to: {log_out}")
print()
return clean_out
# ------------------------------------------------------------------------
# Optional: check missing third-party packages
# ------------------------------------------------------------------------
def check_missing_3p(serial, db_path, work_dir):
print()
if not yes_no("Check user apps -3 with no icon in Nova before quitting?"):
return
if not ADB_EXE.exists():
print(f"[INFO] adb.exe not found at '{ADB_EXE}'; skipping device package check.")
return
devices = adb_devices()
if not devices:
print("[INFO] No connected ADB device found; skipping device package check.")
return
target_serial = devices[0]
debug(f"RUN_ADB_TARGET={target_serial}")
if not db_path or not db_path.exists():
print("[INFO] Nova database not available; skipping device package check.")
return
resolve_labels = yes_no(
"Resolve app titles via adb/aapt slower over Wi-Fi?",
default="n"
)
do_resolve = resolve_labels
pm_3p_file = TEMP / "adbfolder_pm3.txt"
nova_pkgs_file = TEMP / "adbfolder_nova_pkgs.txt"
unplaced_out = work_dir / "unplaced_user_apps.txt"
print(f"Querying third-party packages from device {target_serial} ...")
res = adb_shell(target_serial, "pm list packages -3 2>/dev/null")
pm_3p_file.write_text(res.stdout, encoding="utf-8")
installed3 = set()
for line in pm_3p_file.read_text(encoding="utf-8").splitlines():
p = line.replace("\r", "").strip()
if p.startswith("package:"):
p = p[8:].strip()
if p:
installed3.add(p)
print("Querying packages referenced anywhere in nova.db ...")
rows = sqlite_query(db_path,
"SELECT DISTINCT package_name FROM ("
" SELECT CASE"
" WHEN iconPackage IS NOT NULL AND LENGTH(TRIM(iconPackage)) > 0"
" THEN TRIM(iconPackage)"
" WHEN INSTR(intent, 'component=') > 0 THEN"
" CASE"
" WHEN INSTR(SUBSTR(intent, INSTR(intent, 'component=') + 10), '/') > 0"
" THEN SUBSTR(SUBSTR(intent, INSTR(intent, 'component=') + 10),"
" 1, INSTR(SUBSTR(intent, INSTR(intent, 'component=') + 10), '/') - 1)"
" ELSE SUBSTR(intent, INSTR(intent, 'component=') + 10)"
" END"
" ELSE ''"
" END AS package_name"
" FROM favorites"
")"
"WHERE LENGTH(package_name) > 0")
in_nova = set()
for (pkg,) in rows:
if pkg:
in_nova.add(pkg)
missing = sorted(installed3 - in_nova, key=str.lower)
results = []
for i, pkg in enumerate(missing, 1):
label = ""
if do_resolve:
if i % 10 == 1 or i == len(missing):
print(f"Resolving titles: {i}/{len(missing)} ({pkg})...")
dump = adb_shell(
target_serial,
f"dumpsys package {pkg} 2>/dev/null"
)
for dl in dump.stdout.splitlines():
m = re.search(r'nonLocalizedLabel="([^"]+)"', dl)
if m:
label = m.group(1).strip()
if not label:
# Try aapt path
# apk_path = shutil.which("aapt") or shutil.which("aapt2")
apk_path = which("aapt") or which("aapt2")
if apk_path:
path_res = adb_shell(
target_serial,
f"pm path {pkg} 2>/dev/null"
)
for pl in path_res.stdout.splitlines():
pl = pl.strip()
if pl.startswith("package:"):
apk_remote = pl[8:].strip()
apk_local = TEMP / "adbfolder_probe.apk"
pull_res = adb_pull(
target_serial,
apk_remote,
apk_local
)
if pull_res.returncode == 0 and apk_local.exists():
badging = run([
apk_path,
"dump",
"badging",
str(apk_local)
])
if badging.stdout:
for bl in badging.stdout.splitlines():
m = re.match(
r"^application-label:'([^']+)'",
bl
)
if m:
label = m.group(1).strip()
break
if badging.returncode != 0:
debug(
f"AAPT failed for {pkg}: {badging.stderr}"
)
try:
apk_local.unlink()
except Exception:
pass
break
results.append((pkg, label))
# Write output
lines = []
if results:
lines.append(
tabulate(
results,
headers=["package_name", "app_title"],
tablefmt="plain"
).splitlines()
)
flat = []
for group in lines:
flat.extend(group)
table_text = "\n".join(flat) + ("\n" if flat else "")
unplaced_out.write_text(table_text, encoding="utf-8")
print()
print(
f"User packages (-3): {len(installed3)} | "
f"In Nova layout: {len(in_nova)} | "
f"No icon in Nova: {len(missing)}"
)
if results:
print()
print(table_text.rstrip())
print(f"Saved unplaced user app list to: {unplaced_out}")
print()
# Cleanup temp files unless debug
if not DEBUG:
for f in [pm_3p_file, nova_pkgs_file]:
try:
f.unlink()
except Exception:
pass
# ------------------------------------------------------------------------
# Main
# ------------------------------------------------------------------------
def main():
global DEBUG
# Allow env override
if os.environ.get("ADBFOLDER_DEBUG", "0") == "1":
DEBUG = True
check_dependencies()
print("Select source for Nova Launcher database:")
print("[1] Pull .novabackup from Android via ADB and extract nova.db [Default]")
print("[2] Use an existing nova.db or .novabackup or .zip already on Windows")
print()
src_choice = prompt("Enter choice [1 or 2]", "1")
if src_choice == "2":
db_path = use_local_source()
else:
db_path = pull_from_android()
if not db_path or not db_path.exists():
print(f"[ERROR] nova.db not found at: '{db_path}'")
input("Press Enter to exit...")
sys.exit(1)
print()
print(f"Using database: {db_path}")
print("Scanning Nova Launcher dock, panes and folders ...")
print()
targets, tgt_count = enumerate_targets(db_path)
print()
pick = prompt(f"Select number [1-{tgt_count}, q to quit]")
if pick.lower() == "q" or pick == "0":
check_missing_3p(None, db_path, WORK_DIR)
print("Bye.")
return
try:
idx = int(pick) - 1
if not (0 <= idx < tgt_count):
raise ValueError
except ValueError:
print(f"[ERROR] Invalid selection: '{pick}'")
input("Press Enter to exit...")
sys.exit(1)
target = targets[idx]
debug(f"SELECTED_LABEL={target.label}")
debug(f"SQL_WHERE={target.where}")
debug(f"SQL_ORDER={target.order}")
run_query(db_path, target, WORK_DIR)
while True:
loop_more = yes_no("Export another folder or pane?", default="n")
if not loop_more:
break
# Re-enumerate (in case something changed) and pick again
targets, tgt_count = enumerate_targets(db_path)
print()
pick = prompt(f"Select number [1-{tgt_count}, q to quit]")
if pick.lower() == "q" or pick == "0":
break
try:
idx = int(pick) - 1
if not (0 <= idx < tgt_count):
raise ValueError
except ValueError:
print(f"[ERROR] Invalid selection: '{pick}'")
break
target = targets[idx]
run_query(db_path, target, WORK_DIR)
check_missing_3p(None, db_path, WORK_DIR)
input("Press Enter to exit...")
if __name__ == "__main__":
main()
# ----------------------------------------------------------------------
# end of adbfolder.py
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# Step by step description of what this script does
# ----------------------------------------------------------------------
# 1. Environment & Configuration Setup
# A. Command environment
# a. Initializes Python execution environment
# b. Imports required Python modules and dependencies
# B. Configuration variables
# a. Sets default configuration paths for ADB, SQLite
# and work directories
# b. Defines the DEBUG toggle flag
# c. Defines temporary and Android backup directories
#
# 2. Dependency Verification
# A. Executable checks
# a. Locates adb.exe and checks system PATH
# or configured fallback path
# b. Locates sqlite3.exe and exits with an error if missing
# B. Directory setup
# a. Creates the Nova work directory if it does not exist
#
# 3. Source Selection Menu
# A. Choice [1]: Pull from Android via ADB
# a. Detects connected ADB device target
# b. Optionally launches Nova Launcher settings to create a backup
# c. Lists .novabackup files in the remote backup directory
# with fallback search of Android storage
# d. Prompts user to select or enter a backup filename/path
# e. Pulls the selected .novabackup file to the Windows workspace
# f. Renames the pulled file to backup.zip and extracts it
# into backup_extracted to retrieve nova.db
# B. Choice [2]: Use Local Database / Archive
# a. Prompts user for a custom path to nova.db, .novabackup or .zip
# with a retry loop
# b. Validates file existence
# c. Automatically extracts archives when necessary
# d. Optionally offers to restore a .novabackup database
# to the device
#
# 4. Database Verification & Target Enumeration
# A. Database validation
# a. Verifies that nova.db exists at the target path
# B. Section 1 [Dock]
# a. Scans dock apps [container = -101]
# b. Scans and lists any dock folders
# C. Section 2 [Panes 0-14]
# a. Iterates through home screen panes 0 to 14
# via the scan_pane function
# b. Queries pane folders [itemType = 2, container = -100]
# c. Checks for loose non-folder apps [itemType <> 2] on each pane
# D. Section 3 [Other Folders]
# a. Searches for orphaned folders not categorized under dock
# or panes
# b. Lists and registers remaining folders
#
# 5. User Selection & Query Execution [run_query]
# A. Selection & Sanity
# a. Prompts user to select a target number or quit [q or 0]
# b. Sanitizes the selected label to generate a safe filename
# B. Query Generation & Execution
# a. Builds a dynamic SQLite query extracting:
# i. Item ID
# ii. Display name
# iii. Package name
# iv. Raw intent
# b. Executes the query against nova.db using Python sqlite3
# c. Falls back to the sqlite3 command-line executable if necessary
# C. Output & Formatting
# a. Writes raw tab-delimited results to output.txt
# b. Formats output columns [package_name, display_name]
# into an aligned table via tabulate
# c. Adds a descriptive pane/folder heading and indents the table
# by two spaces for easier reading and future concatenation
# d. Saves formatted results to [target]_apps.txt
# e. Appends each formatted export with a timestamp to
# adbfolder_log.txt without overwriting previous exports
# f. Displays the formatted results and output file locations
# D. Repeat Export
# a. Prompts user to export another folder or pane
# b. Re-enumerates targets in case the database layout has changed
# c. Repeats the selection and export process as requested
#
# 6. Optional Unplaced Third-Party Package Check [check_missing_3p]
# A. Pre-check Validation
# a. Prompts user whether to check for user-installed packages
# [-3] missing from the Nova layout
# b. Verifies ADB device connectivity and database availability
# c. Optionally prompts to resolve app titles via adb/aapt
# B. Data Collection
# a. Queries installed third-party packages from device
# [adb shell pm list packages -3]
# b. Queries all referenced packages inside nova.db
# c. Compares installed packages against packages referenced in Nova
# C. Optional App Title Resolution
# a. Runs adb shell dumpsys package for each unplaced package
# b. Searches for nonLocalizedLabel in the package information
# c. If unavailable, uses adb shell pm path to locate the APK
# d. Pulls the APK to the PC and uses aapt/aapt2 to read its label
# D. Diff Analysis & Output
# a. Identifies installed third-party packages with no Nova icon
# b. Generates a formatted package_name / app_title table
# c. Saves results to unplaced_user_apps.txt
# d. Displays package counts and the resulting unplaced app list
# E. Cleanup
# a. Removes temporary package-list files unless DEBUG=1
# b. Exits cleanly
# -------------------------------------------------------------------
# -------------------------------------------------------------------
--
Usenet is where you can sometimes find people who know more than you do.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads