Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In System Tray, cannot open Network, Sound and Power flyout. #50

Closed
arudei-dev opened this issue Oct 23, 2017 · 28 comments
Closed

In System Tray, cannot open Network, Sound and Power flyout. #50

arudei-dev opened this issue Oct 23, 2017 · 28 comments
Assignees
Labels
Milestone

Comments

@arudei-dev
Copy link

The icon responsible for showing the status of each entity does not respond to any click.

@dremin dremin added the Bug label Oct 24, 2017
@dremin
Copy link
Collaborator

dremin commented Oct 24, 2017

I'm exploring a few different possibilities here:

  1. Find a way to make these work
  2. Hide them, and instead rely on a button to open Action Center
  3. Implementing these directly into Cairo.

The problem is they are owned by explorer.exe, which Cairo doesn't have much control over. I'll keep this issue updated, but in the meantime I highly recommend Volume2 for volume control; it's incredibly flexible and is what I have been using.

@dremin dremin self-assigned this Oct 24, 2017
@dremin dremin added this to the Milestone 3 milestone Oct 24, 2017
@arudei-dev
Copy link
Author

Actually, I have an idea and here's my proposal:

Since I've been doing a custom implementation of macOS shells too, I would suggest adding custom execution code for these special entity of Windows 10 tray icon by custom linking them into their corresponding shell commands, such as 'ms-availablenetworks:' for Networks flyout, using system key combinations for Action Center, etc.

@arudei-dev
Copy link
Author

Whoops, accidentally closed the issue!

@dremin
Copy link
Collaborator

dremin commented Oct 25, 2017

Thanks for reminding me of the available networks URI! For Action Center, I have implemented the ms-actioncenter: URI. It looks like I could use sndvol -f to display a volume slider, albeit the old one. Unfortunately, I haven't found a way to activate the modern Volume or Power flyouts yet.

@arudei-dev
Copy link
Author

I think I got a better idea: #54

@dremin
Copy link
Collaborator

dremin commented Nov 28, 2017

I have started this by adding Action Center support in the latest Milestone 3 release. Please check for updates.

@arudei-dev
Copy link
Author

Thanks! Just the flyout issues left then.

dremin added a commit that referenced this issue Dec 30, 2017
Clicking works on more icons now (such as network: #50), fixed accidental double clicks, removed dependency on Visual C++ Redistributable, fixed Action Center on newer Windows 10 builds
@simonporte
Copy link
Contributor

As a workaround for lack of sound dropdown, you can use EarTrumpet if you are on Windows 10.
It's a clone of the default tray icon, but with a more convenient volume mixer.
But I encounter a crash when lauched after Cairo, of after a few click if lauched before Cairo. I fill in a separate issue for this bug.

@simonporte
Copy link
Contributor

As seen in #77, try disabling "Periodically re-establish notification area hook".
Ear Trumpet and native network tray will work correctly then.

@dremin
Copy link
Collaborator

dremin commented Jan 19, 2018

One alternative network icon solution is to change the action of clicking the network icon. You can do this via a registry change on Windows 10:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Control Panel\Settings\Network

  1. Right-click the registry key > Permissions > Change Owner to yourself and then give yourself full control
  2. Double-click "ReplaceVan"
  3. Use one of the following settings:
    0: Default
    1: Open Network settings
    2: Windows 8 behavior

@cosmicdan
Copy link

cosmicdan commented Feb 25, 2018

You might of already discovered this, but in Windows 10 (and 8 I assume) the explorer shell is built like a UWP app. The systray flyouts, action center, start menu itself and all that are using Xaml rather than GDI+ - so it can't be manipulated easily.

The explorer shell used to be an app appearing in the WindowsApps folder in earlier builds, but it's since been moved somewhere secret. In my research, I think the only way to truly figure out how to hook/simulate this behavior is by finding where the explorer shell UI stuff is and reverse engineering it.

@arudei-dev
Copy link
Author

@cosmicdan correct. However in previous builds Windows create an entry point (usually a shell command or keyboard shortcut) that triggers them, and while it isn't a perfect implementation, it serves the purpose. It seems that Microsoft 'forgot' to reimplement them at the moment.

@cosmicdan
Copy link

Indeed, Microsoft "forgot" to implement a lot of things in Windows 10's explorer :)

I'll keep an eye on this thread in case somebody finds a solution. I too am working on a shell replacement augmentation (not something that completely replaces the environment like Cairo does but just adds a Gnome-like toolbar to the top Window) so I would be interested in any discovery anybody might make in this area.

Good to see how far Cairo shell has come, though - glad it's still in active development!

@dremin
Copy link
Collaborator

dremin commented Feb 27, 2018

I'm not sure the problem is that the flyouts are XAML per se-- here's the issue as I see it (based on my time on the issue, but who knows, maybe I'm way far off):

Explorer's taskbar window (Shell_TrayWnd) is still present when Cairo is open due to all of the features Explorer provides. Cairo gets notification area icons by creating its own Shell_TrayWnd and advertising that a new taskbar was created. Some icons do some positioning and other logic based on the location of Shell_TrayWnd. Unfortunately sometimes Cairo's window is found first, sometimes Explorer's is found first. If Explorer's window is found first, the XAML flyout for Network works just fine even when invoked from Cairo. However, if Cairo's window is found first, for some reason the flyout doesn't open.

This is why the Network flyout works if the "periodically re-establish notification area hook" option is disabled in Cairo settings. All this option does when enabled is re-create and re-advertise a new Shell_TrayWnd every 10 seconds or so (yes, it's nasty), which causes Cairo's Shell_TrayWnd to be found before Explorer's usually. So, disabling this option means that Explorer's Shell_TrayWnd is found first.

To solve this we need to figure out what the flyouts are looking for that Cairo isn't providing an expected result to. However, it has been leaked that a new 'control center' interface is coming to Windows 10, which would render this moot if it can be invoked similar to Action Center.

@cosmicdan
Copy link

cosmicdan commented Feb 27, 2018

To solve this we need to figure out what the flyouts are looking for that Cairo isn't providing an expected result to.

And the only way I know of to do that would be to intercept window messages, but I have tried this and cannot get anything. That's why my theory is that it's now all done internally by the new explorer UWP/Xaml app itself, and the Win32 API that you're relying on (I assume Cairo shell is sending a TaskbarCreated message?) is only possible for compatibility.

Maybe writing a global message hook that just dumps info before passing the message on, then firing ms-availablenetworks: while that's active and sifting through the myriad of messages that were dumped...? But I don't know if these URI commands even send window messages.

@dremin
Copy link
Collaborator

dremin commented Mar 27, 2018

The Network flyout in Windows 10 should be fully functional now in this test build without needing to disable the "periodically re-establish notification area hook" option. Could someone please double-check on their system as well? Thanks!

@josuave
Copy link
Collaborator

josuave commented Mar 28, 2018 via email

@dremin
Copy link
Collaborator

dremin commented Apr 2, 2018

The working network flyout is in the latest release! Is anyone able to try the Power flyout?

@simonporte
Copy link
Contributor

simonporte commented Apr 2, 2018

Network flyout working, but icon closes and opens panel.
On first click it opens, if you click further it will close quickly and open.
Didn't try behavior on escape and click outside.

Power flyout not working but right click does (it is an "old" contextual menu, not a black modern one like Network flyout)

Sound flyout not working as before.

dremin added a commit that referenced this issue Apr 14, 2018
More notification area tweaks
@dremin
Copy link
Collaborator

dremin commented Apr 14, 2018

Sound is available in the latest build.

@josuave
Copy link
Collaborator

josuave commented Apr 22, 2018

A trick to allow the Network and other Explorer notify apps (WiFi) to display in the upper right quadrant.
Quit Cairo, unlock windows taskbar if needed, dock it to the top edge, restart cario. I am investigating a way to do this in code. It seems windows 10 broke moving the taskbar via API

@dremin
Copy link
Collaborator

dremin commented Apr 28, 2018

By chance have recent improvements enabled the Power icon to work?

@josuave
Copy link
Collaborator

josuave commented Apr 28, 2018 via email

@dremin
Copy link
Collaborator

dremin commented May 2, 2018

This is great news! I'll close this out since we now have functional network, sound, and power flyouts.

@dremin dremin closed this as completed May 2, 2018
@skyborgff
Copy link

skyborgff commented Jun 20, 2018

@dremin Did you end up finding the ms-availablenetworks: URI But for the modern Sound and Power?

@dremin
Copy link
Collaborator

dremin commented Jun 29, 2018

@skyborgff I ended up implementing sound another way, and heard that power is working correctly in the latest builds. Are these working for you?

@skyborgff
Copy link

@dremin I'm not using this project, i wanted to know for a project of my own (a rainmeter skin). could you provide me the power URI (if it exists) please?

@dremin
Copy link
Collaborator

dremin commented Jun 30, 2018

@skyborgff Unfortunately I did not find a URI for power.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants