Skip to content

Commit

Permalink
feat(copilot): better UX for app
Browse files Browse the repository at this point in the history
  • Loading branch information
he3als committed Jul 16, 2024
1 parent 0d1b0dd commit 431ab05
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ echo Enabling Copilot...

:: Decide if Copilot is avaliable
:: If not, it could be 24H2 (which replaces it with an app)
set "appText= "
reg query HKCU\Software\Microsoft\Windows\Shell\Copilot /v IsCopilotAvailable 2>&1 | find "0x0" > nul
if %errorlevel%==0 (call :app) else (reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowCopilotButton" /t REG_DWORD /d "1" /f > nul)

Expand All @@ -30,13 +31,15 @@ start explorer.exe

:finish
echo]
echo Finished, changes are applied.
echo Finished, changes are applied. %appText%
echo Press any key to exit...
pause > nul
exit /b

:app
echo NOTE: Copilot on the taskbar isn't available, installing the app instead...
call "%windir%\AtlasModules\Scripts\wingetCheck.cmd"
echo NOTE: Copilot on the taskbar isn't available, the app will be installed instead.
set "appText=You can find the Copilot app in your Start Menu."
call "%windir%\AtlasModules\Scripts\wingetCheck.cmd" /nodashes
if %errorlevel% neq 0 exit /b 1
echo Installing Copilot...
winget install -e --id 9NHT9RB2F4HD --uninstall-previous -h --accept-source-agreements --accept-package-agreements --force --disable-interactivity > nul
12 changes: 8 additions & 4 deletions src/playbook/Executables/AtlasModules/Scripts/wingetCheck.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

set "dashes=-----------------------------------------------------------------------------------------------------"
set "silent="
echo "%~1 %~2" | find "/silent" > nul && set silent=true
set "nodashes="
echo "%*" | find "/silent" > nul && set silent=true
echo "%*" | find "/nodashes" > nul && set nodashes=true

if not defined silent echo %dashes%
if not defined silent (if not defined nodashes echo %dashes%)

ping -n 1 -4 www.microsoft.com > nul 2>&1
if errorlevel == 1 (
Expand Down Expand Up @@ -36,8 +38,10 @@ winget search "Microsoft Visual Studio Code" --accept-source-agreements > nul 2>
)

if not defined silent (
echo %dashes%
echo]
if not defined nodashes (
echo %dashes%
echo]
)
)

exit /b
Expand Down

0 comments on commit 431ab05

Please sign in to comment.