Code Monkey home page Code Monkey logo

Comments (5)

undergroundwires avatar undergroundwires commented on June 27, 2024 1

My best shot was the first setting in my first comment. All other global Windows key shortcuts are handled by taskbar.dll and explorer.exe, which reads that configuration.

As you report that it does not work, Copilot seems to be a different case, deeply integrated in some another process.

I cannot come up with more ideas, but I expect Microsoft to provide a documented setting for this to keep enterprises happy. I'm leaving this the community, there may be another solution in the wild that someone else knows.

from privacy.sexy.

undergroundwires avatar undergroundwires commented on June 27, 2024

Hi,

Run these commands in command line:

1.

PowerShell -ExecutionPolicy Unrestricted -Command "$keyToDisable='C'; $keyToDisableInUppercase = $keyToDisable.ToUpper(); $registryPath = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced'; $propertyName = 'DisabledHotkeys'; $disabledKeys = Get-ItemProperty -Path $registryPath -Name $propertyName -ErrorAction SilentlyContinue | Select-Object -ExpandProperty "^""$propertyName"^""; if ($disabledKeys) {; if ($disabledKeys.Contains($keyToDisableInUppercase)) {; Write-Host "^""Skipping: Key `"^""$keyToDisableInUppercase`"^"" is already disabled. All disabled keys: `"^""$disabledKeys`"^"". No action needed."^""; exit 0; }; $newKeysToDisable = "^""$($disabledKeys)$($keyToDisableInUppercase)"^""; Write-Host "^""Some keys are already disabled: `"^""$disabledKeys`"^"", but not `"^""$keyToDisableInUppercase`"^"", disabling it too, new disabled keys: `"^""$newKeysToDisable`"^""."^""; try {; Set-ItemProperty -Path $registryPath -Name $propertyName -Value "^""$newKeysToDisable"^"" -Force -ErrorAction Stop; Write-Host "^""Successfully disabled,`"^""$keyToDisableInUppercase`"^"", all disabled keys: `"^""$newKeysToDisable`"^""."^""; Exit 0; } catch {; Write-Error "^""Failed to disable `"^""$newKeysToDisable`"^"": $_"^""; Exit 1; }; } else {; Write-Host "^""No keys has been disabled before, disabling: `"^""$keyToDisableInUppercase`"^""."^""; try {; Set-ItemProperty -Path $registryPath -Name $propertyName -Value "^""$keyToDisableInUppercase"^"" -Force -ErrorAction Stop; Write-Host "^""Successfully disabled,`"^""$keyToDisableInUppercase`"^""."^""; Exit 0; } catch {; Write-Error "^""Failed to disable `"^""$keyToDisableInUppercase`"^"": $_"^""; Exit 1; }; }"

2. (It will restart explorer, needed to activate it):

taskkill /f /im explorer.exe & start explorer

You can test directly after running this script and feel free to report if it worked, if it did not, try to restart your computer and test again.

from privacy.sexy.

baek-sang avatar baek-sang commented on June 27, 2024

I ran the script from CMD and rebooted.

Skipping: Key "C" is already disabled. All disabled keys: "C". No action needed.

But the shortcut still works.

from privacy.sexy.

undergroundwires avatar undergroundwires commented on June 27, 2024

Ok thanks for the feedback. The Copilot you're seeing is not a traditional "app" but an Edge process, making it harder to target it. The script I provided would work if it was Explorer/Taskbar that was handling Win+C, but it does not seems to be the case, and the behavior is undocumented (microsoft/PowerToys#29042).

Now you can revert disabling C like this to restore default state of your computer:

PowerShell -ExecutionPolicy Unrestricted -Command "$keyToRestore='C'; $keyToRestoreInUppercase = $keyToRestore.ToUpper(); $registryPath = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced'; $propertyName = 'DisabledHotkeys'; $disabledKeys = Get-ItemProperty -Path $registryPath -Name $propertyName -ErrorAction SilentlyContinue | Select-Object -ExpandProperty "^""$propertyName"^""; if (-Not $disabledKeys) {; Write-Host "^""Skipping: No keys has been disabled before, no need to restore `"^""$keyToRestoreInUppercase`"^""."^""; Exit 0; }; if (-Not $disabledKeys.Contains($keyToRestoreInUppercase)) {; Write-Host "^""Skipping: Key `"^""$keyToRestoreInUppercase`"^"" is not disabled. All disabled keys: `"^""$disabledKeys`"^"". No action needed."^""; Exit 0; }; $newKeysToDisable = $disabledKeys.Replace($keyToRestoreInUppercase, "^"""^""); if (-Not $newKeysToDisable) {; Write-Host "^""Removing all entries from the disabled keys as the last key `"^""$keyToRestoreInUppercase`"^"" is being restored."^""; try {; Remove-ItemProperty -Path $registryPath -Name $propertyName -Force -ErrorAction Stop; Write-Host "^""Successfully removed the `"^""$propertyName`"^"" property from the registry, no disabled keys remain."^""; Exit 0; } catch {; Write-Error "^""Failed to remove the empty `"^""$propertyName`"^"" property from the registry: $_"^""; Exit 1; }; }; try {; Write-Host "^""Restoring `"^""$keyToRestoreInUppercase`"^"", all disabled keys: `"^""$disabledKeys`"^"", new disabled keys: `"^""$newKeysToDisable`"^""."^""; Set-ItemProperty -Path $registryPath -Name $propertyName -Value "^""$newKeysToDisable"^"" -Force -ErrorAction Stop; Write-Host "^""Successfully restored `"^""$keyToRestoreInUppercase`"^"", disabled keys now: `"^""$newKeysToDisable`"^""."^""; Exit 0; } catch {; Write-Error "^""Failed to restore `"^""$keysToDisable`"^"": $_"^""; Exit 1; }"

Now that the OS is clean, I'll suggest trying three other methods.
Your feedback is important and I'll update privacy.sexy based on this. So please test these one by one and see if any of them work.

I. Limit edge

Now that your OS is clean. We can try to target Edge to limit its functionality to run Copilot and see if it works.

  1. Disable web widgets:
reg add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "WebWidgetAllowed"  /t "REG_DWORD" /d "0" /f
  1. Disable Copilot and Bing Discover in Edge:
reg add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HubsSidebarEnabled" /t REG_DWORD /d "0" /f

You can now restart your computer and test. If they do not work, you can restore your OS back to its defaults:

reg delete "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "WebWidgetAllowed" /f 2>nul
reg delete "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HubsSidebarEnabled" /f 2>nul

II. Remove Edge AI app

If the above does not work, we can try this. This is an undocumented app released by Microsoft, and you might not have it.

This code would remove it:

PowerShell -ExecutionPolicy Unrestricted -Command "Get-AppxPackage 'Microsoft.Windows.Ai.Copilot.Provider' | Remove-AppxPackage"

You should not have Copilot open when you run this. This will most likely do nothing, but you'd see it in cmd if it does something.

III. Test GPO manually

If none of the above works, you can follow what @hhoneeyy reported in #335. And it's about manually running GPO. I do not understand how it can resolve the issue, this GPO is set by privacy.sexy anyway (TurnOffWindowsCopilot). You can see this article (section starting with "Click Start and open the Group policy editor") and follow to set-up this GPO and see if it would work.

from privacy.sexy.

baek-sang avatar baek-sang commented on June 27, 2024

I've done I, II, and III, but the shortcut still launches the Copilot.
Is there anything else I need to check?

from privacy.sexy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.