From b2ece494c66e8e167e59c6947015af3c1e0d1c04 Mon Sep 17 00:00:00 2001 From: he3als <65787561+he3als@users.noreply.github.com> Date: Sun, 14 Jul 2024 23:03:44 +0100 Subject: [PATCH] feat(general conf): location scripts (issue #1127) --- src/playbook/Configuration/atlas/services.yml | 6 ++++ .../tweaks/qol/set-hidden-settings-pages.yml | 4 +-- .../Location/Disable Location (default).cmd | 34 +++++++++++++++++++ .../Location/Enable Location.cmd | 34 +++++++++++++++++++ 4 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 src/playbook/Executables/AtlasDesktop/3. General Configuration/Location/Disable Location (default).cmd create mode 100644 src/playbook/Executables/AtlasDesktop/3. General Configuration/Location/Enable Location.cmd diff --git a/src/playbook/Configuration/atlas/services.yml b/src/playbook/Configuration/atlas/services.yml index a12a4bfcb5..9245d4588f 100644 --- a/src/playbook/Configuration/atlas/services.yml +++ b/src/playbook/Configuration/atlas/services.yml @@ -27,6 +27,12 @@ actions: exeDir: true wait: true + - !writeStatus: {status: 'Disabling Location'} + - !cmd: + command: '"AtlasDesktop\3. General Configuration\Location\Disable Location (default).cmd" /silent' + exeDir: true + wait: true + ############################################################################################## ## SERVICES ## ############################################################################################## diff --git a/src/playbook/Configuration/tweaks/qol/set-hidden-settings-pages.yml b/src/playbook/Configuration/tweaks/qol/set-hidden-settings-pages.yml index 048b17b5c7..76c3b86730 100644 --- a/src/playbook/Configuration/tweaks/qol/set-hidden-settings-pages.yml +++ b/src/playbook/Configuration/tweaks/qol/set-hidden-settings-pages.yml @@ -8,7 +8,7 @@ actions: - !registryValue: path: 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer' value: 'SettingsPageVisibility' - data: 'hide:recovery;maps;maps-downloadmaps;findmydevice;privacy;privacy-speechtyping;privacy-speech;privacy-feedback;privacy-activityhistory;search-permissions;privacy-location;privacy-general;sync;cortana-windowssearch;mobile-devices;mobile-devices-addphone;workplace;backup' + data: 'hide:recovery;maps;maps-downloadmaps;findmydevice;privacy;privacy-speechtyping;privacy-speech;privacy-feedback;privacy-activityhistory;search-permissions;privacy-general;sync;cortana-windowssearch;mobile-devices;mobile-devices-addphone;workplace;backup' type: REG_SZ builds: [ '<22000' ] @@ -16,6 +16,6 @@ actions: - !registryValue: path: 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer' value: 'SettingsPageVisibility' - data: 'hide:recovery;maps;maps-downloadmaps;findmydevice;privacy;privacy-feedback;privacy-activityhistory;search-permissions;privacy-location;privacy-general;sync;cortana-windowssearch;mobile-devices;mobile-devices-addphone;workplace;family-group;deviceusage;home' + data: 'hide:recovery;maps;maps-downloadmaps;findmydevice;privacy;privacy-feedback;privacy-activityhistory;search-permissions;privacy-general;sync;cortana-windowssearch;mobile-devices;mobile-devices-addphone;workplace;family-group;deviceusage;home' type: REG_SZ builds: [ '>=22000' ] diff --git a/src/playbook/Executables/AtlasDesktop/3. General Configuration/Location/Disable Location (default).cmd b/src/playbook/Executables/AtlasDesktop/3. General Configuration/Location/Disable Location (default).cmd new file mode 100644 index 0000000000..386955df14 --- /dev/null +++ b/src/playbook/Executables/AtlasDesktop/3. General Configuration/Location/Disable Location (default).cmd @@ -0,0 +1,34 @@ +@echo off + +if "%~1"=="/silent" goto :main + +set "___args="%~f0" %*" +fltmc > nul 2>&1 || ( + echo Administrator privileges are required. + powershell -c "Start-Process -Verb RunAs -FilePath 'cmd' -ArgumentList """/c $env:___args"""" 2> nul || ( + echo You must run this script as admin. + if "%*"=="" pause + exit /b 1 + ) + exit /b +) + +:main +( + sc config lfsvc start=disabled + sc config MapsBroker start=disabled +) > nul + +( + sc stop lfsvc + sc stop MapsBroker + taskkill /f /im SystemSettings.exe +) > nul 2>&1 + +"%windir%\AtlasModules\Scripts\settingsPages.cmd" /hide privacy-location + +if "%~1"=="/silent" exit /b + +echo Finished, please reboot your device for changes to apply. +pause +exit /b \ No newline at end of file diff --git a/src/playbook/Executables/AtlasDesktop/3. General Configuration/Location/Enable Location.cmd b/src/playbook/Executables/AtlasDesktop/3. General Configuration/Location/Enable Location.cmd new file mode 100644 index 0000000000..d66d383135 --- /dev/null +++ b/src/playbook/Executables/AtlasDesktop/3. General Configuration/Location/Enable Location.cmd @@ -0,0 +1,34 @@ +@echo off + +if "%~1"=="/silent" goto :main + +set "___args="%~f0" %*" +fltmc > nul 2>&1 || ( + echo Administrator privileges are required. + powershell -c "Start-Process -Verb RunAs -FilePath 'cmd' -ArgumentList """/c $env:___args"""" 2> nul || ( + echo You must run this script as admin. + if "%*"=="" pause + exit /b 1 + ) + exit /b +) + +:main +( + sc config lfsvc start=demand + sc config MapsBroker start=auto +) > nul + +( + sc start lfsvc + sc start MapsBroker + taskkill /f /im SystemSettings.exe +) > nul 2>&1 + +"%windir%\AtlasModules\Scripts\settingsPages.cmd" /unhide privacy-location + +if "%~1"=="/silent" exit /b + +echo Finished, please reboot your device for changes to apply. +pause +exit /b \ No newline at end of file