Closed Marshall-Brooks closed 1 week ago
Unfortunately its not possible to remove that space with the styler mod, as the parent element is a WrapGrid inside an ItemPresenter, which means it has already determined which icons to include, and laid out the icon grid in the overflow area.
What I've been doing, even before Windhawk, is to launch those programs I don't want shown using AdvancedRun, and a simple bat script to launch those apps as "hidden" so it doesn't show up anywhere except task manager, and then scheduled those to run at logon with task scheduler.
Thanks - that's what I needed to know!!!
@bbmaster123 - Follow-up question: If it wanted to remove the icon with WH but was okay with leaving the grid space for it, how would I do that? I mentioned in the other thread that I could hide the icon with UWPSpy, but the "hide" command would be for Windows.UI.Xaml.Controls.ContentPresenter - and there are a lot of those.
PS Tray Factory works well, but there are a few icons that it doesn't recognize and won't allow me to hide.
I like your approach with AdvancedRun, but this is a managed computer (not by me), so if I removed the startup entry for the program, they would likely just re-install the startup entry later. But if I hide the icon after the computer starts, they won't know or care.
Additional thoughts:
ah yes, you need to specify which specific element to target by using a unique identifier in square brackets, something like:
Target: SystemTray.NotifyIconView[AutomationProperties.Name=Windows Security - Actions Recommended]
Style:
Visibility=Collapsed
The caveat is that the value MUST be unique to the element to be targeted, or else it would still apply to all elements with that class. Of course this would still leave that empty space...
I'm thinking if I put the icons at the end of the list and then hide them, the space taken up by the grid would not be noticeable.
this is true, you might be able to do something like
SystemTray.NotifyIconView[AutomationProperties.Position=6]
for example and never notice the blank spot, but like you mentioned if the order gets messed up the style would hide the wrong icon. Name/Properties is usually a better way to target
But if I hide the icon after the computer starts, they won't know or care.
so task scheduler wouldn't be an option on this computer? It doesn't count as a startup item and wont show in task manager, tasks are separate. All it does is trigger an action when whatever condition you set is met, in this case run this .bat file when logon completes (or whenever you like). See if you can add your own, it should stick.
If you can't create a scheduled task, how about a desktop shortcut that does the same thing? You'll still have to double click it though
Task scheduler would be an option. Removing it from the startup sequencer and launching it with AdvancedRun probably is not an option.
What could probably work, but it is a bunch of effort would be allowing the programs to load at startup and then having some script that runs from task scheduler that kills the affected programs and then relaunches them hidden using AdvancedRun. But I can live with just hiding the icon.
Follow-up question - and I think I know the answer, but I could be wrong ... Let's use Windows Security for the example:
I think if I start the computer, wait for Windows Security to load, and then load Windhawk with the visibility collapsed line, it will remove the icon.
I think if I start the computer, load WindHawk with the visibility collapsed line, and Windhawk loads before the Windows Security Center loads, the icon would NOT be removed (I could be wrong). In this case, I could probably modify my startup script slightly to load Windhawk, wait 5 minutes or so, remove Windhawk, and then re-load WindHawk.
Thank you again for the help with this!!!
It doesn't seem to be working for me (it doesn't seem to be working in UWPSpy either, so I'm not sure what is wrong.
I tried what you posted and I also tried:
Windows.UI.Xaml.Controls.ContentPresenter>SystemTray.NotifyIconView[AutomationProperties.Name=Windows Security - Actions Recommended]
and
Windows.UI.Xaml.Controls.ContentPresenter#SystemTray.NotifyIconView[AutomationProperties.Name=Windows Security - Actions Recommended]
Also - I checked and all the icons have unique names except two of them have "(null)", but both of those are icons I want to hide anyway.
make sure you have a space before and after the > symbol Also make sure the name is correct in uwpspy, most names never change but some can change. In those cases you'll need a unique identifier that never changes. It doesn't necessarily have to be name or position either, any property that is unique will work such as tooltip or AutomationID
If you can't get it working, it probably isn't possible in the styler mod
Not working with the spaces before and after the > either. Then again, it wasn't working in UWPSpy and it was last week. I think I'll try again after a re-boot ...
Sorry my attention is split at the moment, I should have also mentioned before to not use uwpspy and windhawk at the same time. disable the mod first, then open uwpspy to avoid conflicts
let me know if it still isn't working in uwpspy after the reboot.
I knew UWPSpy and Windhawk conflicted, but I wasn't sure how.
After a re-boot, with UWP Spy, I was able to hide the icons with WindHawk disabled. I was not able to hide them with Windhawk. In UWP Spy, I was able to apply the property to the NotifyIconView line, just like you have it.
So I am facing the following issues:
Two additional questions and some odd test results:
Test Results: I exited Windhawk and hid my Microsoft Outlook icon. Then I closed and re-opened Microsoft Outlook. Not only did the icon stay hidden, but the blank space disappeared and the other icons were shifted over.
This implies that ideally I want to load windhawk before the other programs start to load and I won't have any issues. (PS Tray Factory said it needed to be loaded with Windows - which might be related to this condition.)
Also - oddly - when I closed outlook the entry disappeared in UWPSpy - so I couldn't remove the visibility=Collapsed entry. An explorer restart didn't work either. Finally, I did a re-boot and the Outlook icon was back.
2nd question: How do I exit UWPSpy? There have been times that I selected the wrong Explorer instance and I opened UWPSpy again and it said it was already spying on this process. I didn't see it in Task Manager to close it there. I think if I closed it the Outlook icon would have been restored, but I didn't know how to. (Also, the Windhawk changes might not be working if UWPSpy is still running, but I don't know how to verify that. I know I tested Windhawk yesterday before I tried UWPSpy and the icons were not hidden then.)
I suspect I need to put them in the order I want and then hide the unwanted ones that are at the end.
Yea that's why using name/id is usually a better idea when possible, I had success in my test vm with
Windows.UI.Xaml.Controls.ContentPresenter > SystemTray.NotifyIconView[AutomationProperties.Name=Xbox App] > Grid
in windhawk.
let me know if you have any more questions :)
I had success in my test vm with Windows.UI.Xaml.Controls.ContentPresenter > SystemTray.NotifyIconView[AutomationProperties.Name=Xbox App] > Grid in windhawk.
At least that confirms it is possible. Doesn't seem to be working for me, any idea where the error might be (anything I'm missing?):
Old outlook ...
restart the process if uwpspy has already been started, even if its already been closed. That resets everything as all of this happens in memory only.
Didn't work that way, which I thought was odd - i.e. I hid the icon in UWPSpy. I re-started Explore and the Outlook icon was still hidden. I rebooted the PC and the Outlook icon showed up again.
I'm seeing very odd results now. The Outlook icon is not showing in the overflow tray, although Outlook is still running (this is what I was trying to do with Windhawk). I exited Windhawk and the icon is still not shown. Several other icons are also not shown - some that I wanted to hide but didn't attempt to hide yet, but some icons that I didn't intend to hide are also hidden and some that I planned to hide but didn't try to change yet are still shown ...
I'm going to reboot again ...
that is very odd, a full reboot shouldn't be necessary. I don't see an issue with your target or style code either... what other mods do you have running? (windhawk or otherwise?) Did you maybe modify the included processes in advanced? What build of windows are you on? Do you have 2 or more monitors? You disabled your PS tray thing? Just trying to think of anything else that might be interfering
Making progress ... I made a fork of Taskbar Styler and I can hide (at least one) of the overflow icons using the Fork. So one of my Taskbar Styler settings is interfering with this change working.
NOTE: I don't fully understand how the fork works. I took the mod I was using and selected Fork and edited the fork. In the fork, I see the settings I was previously using in the source code window but they are not in the settings window and are not applied.
Even more odd ... If I toggle the fork on and off, the icons appear and disappear. However, if I enable the fork and then enable the taskbar styler mod, the icon stays hidden, however, adding the line to the taskbar styler mod does not work. If I leave Taskbar Styler running and disable and re-enable the fork, the icon disappears, so it doesn't matter which mod is started first. Strange.
Answering your other questions:
Possible conflicting settings with Taskbar Styler (I forgot what some of these do):
Target: SystemTray.OmniButton#NotificationCenterButton > Grid > ContentPresenter > ItemsPresenter > StackPanel > ContentPresenter > SystemTray.IconView#SystemTrayIcon > Grid > Grid > SystemTray.TextIconContent Visibility=Collapsed
Target: SystemTray.Stack#ShowDesktopStack Width = 12
Target: SystemTray.OmniButton#ControlCenterButton > Grid > ContentPresenter > ItemsPresenter > StackPanel > ContentPresenter[1] > SystemTray.IconView > Grid > Grid Visibility = Collapsed
Target: //SystemTray.ImageIconContent > Grid#ContainerGrid > Image Width = //18 Height = //18 I commented this out - not sure what it was doing.
Target: SystemTray.NotifyIconView#NotifyItemIcon MinWidth = 18
Target: SystemTray.ImageIconContent > Grid#ContainerGrid Padding=2,0
Target: SystemTray.TextIconContent > Grid#ContainerGrid > SystemTray.AdaptiveTextBlock#Base > TextBlock#InnerTextBlock Fontsize = 25
Target: taskbar:TaskListButtonPanel#IconPanel Padding=0,0,0,0
Target: Windows.UI.Xaml.Controls.Grid#OverflowRootGrid Padding=0,0,0,0
Target: Windows.UI.Xaml.Controls.ContentPresenter Height=24 Width = 24
Thank you again for all your help with this!!!
Okay - between the two Taskbar Stylers I'm 95% there. Jabra Direct had a name property of "(null)", but there was an option in the software to turn off the tray icon, so I unchecked that.
I have one icon that also uses a name of (null), and I didn't see a way to get rid of that. I haven't used UWPSpy yet to look for other properties for it, but I don't remember any useful ones. (As you suggested, I don't want to use IconPosition11 b/c if another icon shows up, WH will hide the wrong icon and show this one.)
[AutomationProperties.Name=(null)] didn't do anything. [AutomationProperties.Name=] cleared out all the icons and caused an Explorer restart ...
If I have to live with it, I can do that ...
so when you fork the mod, it essentially creates a new copy of the original mod. The forked version of the mod only duplicates the mod itself, not the styles you've set. If both mods are enabled, both are trying to inject into explorer.exe at the same time, which could cause conflicts, especially if both are trying to modify the same targets. Whichever of the two are loaded first, is the one that will be applying the styles, generally
If you go to the advanced tab in the mod, you will see a box with all your style code (mod settings). You can copy/paste the whole code from the original mod to the forked mod, and click save, if you wanted.
multiple monitors have been known to cause strange behaviors in other cases, would you mind testing with just 1 display, just to be sure?
If you see null, it didn't have a property set, which in that case you can't modify a non existent property obviously, nothing we can really do to get around that. If there are actually no other unique properties to target, then we just can't target that specific element
Honestly, if you can find a way to be able to use advancedrun instead, I would recommend trying that as its easy to do and very reliable, plus it doesn't leave that space.
Okay - I'm seeing things that I don't understand, but it is working properly. I have taskbar styler modifying a lot of settings and taskbar styler - fork - overflow modifying the overflow status. Both are working fine, and it seems to work regardless of what order I enable them in. However, if I entered the fork settings in the original mod, they didn't work.
Now, when I exited WindHawk so I could run UWPSpy - SOME of my icons that I had hidden came back, but not ALL of my icons came back, but I hadn't closed programs, and all of the blank space disappeared. Weird.
Restarted Explorer and restarted Windhawk and there were no changes in the icons that were shown. Toggled the fork mod on and off and the proper icons were shown and hidden.
Original settings: {"controlStyles[0].target":"taskbar:TaskListLabeledButtonPanel@CommonStates > Border#BackgroundElement","controlStyles[0].styles[0]":"Background=#FF000000","controlStyles[0].styles[1]":"Background@InactiveNormal=#df002020","controlStyles[0].styles[10]":"BorderThickness=1,1,1,1","controlStyles[0].styles[11]":"BorderBrush=#1fffffff","controlStyles[0].styles[2]":"Background@InactivePointerOver=#ff004040","controlStyles[0].styles[3]":"Background@InactivePressed=#ff004040","controlStyles[0].styles[4]":"Background@ActiveNormal=#0078D7","controlStyles[0].styles[5]":"Background@ActivePointerOver=#ff006cc1","controlStyles[0].styles[6]":"Background@ActivePressed=#ff007020","controlStyles[0].styles[7]":"Background@RequestingAttention=#ff900000","controlStyles[0].styles[8]":"Background@RequestingAttentionPointerOver=#ffb00000","controlStyles[0].styles[9]":"Background@RequestingAttentionPressed=#ffb00000","controlStyles[1].target":"taskbar:TaskListLabeledButtonPanel@RunningIndicatorStates > Rectangle#RunningIndicator","controlStyles[1].styles[0]":"Visibility=Collapsed","controlStyles[2].target":"SystemTray.OmniButton#NotificationCenterButton > Grid > ContentPresenter > ItemsPresenter > StackPanel > ContentPresenter > SystemTray.IconView#SystemTrayIcon > Grid > Grid > SystemTray.TextIconContent","controlStyles[2].styles[0]":"Visibility=Collapsed","controlStyles[3].target":"SystemTray.Stack#ShowDesktopStack","controlStyles[3].styles[0]":"Width=12","controlStyles[4].target":"SystemTray.ChevronIconView","controlStyles[4].styles[0]":"MinWidth=16","controlStyles[5].target":"SystemTray.OmniButton#ControlCenterButton > Grid > ContentPresenter > ItemsPresenter > StackPanel > ContentPresenter[1] > SystemTray.IconView > Grid > Grid","controlStyles[5].styles[0]":"Visibility=Collapsed","controlStyles[6].target":"SystemTray.ImageIconContent > Grid#ContainerGrid > Image","controlStyles[6].styles[0]":"Width=18","controlStyles[6].styles[1]":"Height=18","controlStyles[7].target":"SystemTray.NotifyIconView#NotifyItemIcon","controlStyles[7].styles[0]":"MinWidth=18","controlStyles[8].target":"SystemTray.ImageIconContent > Grid#ContainerGrid","controlStyles[8].styles[0]":"Padding=2,0","controlStyles[9].target":"SystemTray.TextIconContent > Grid#ContainerGrid > SystemTray.AdaptiveTextBlock#Base > TextBlock#InnerTextBlock","controlStyles[9].styles[0]":"Fontsize=25","controlStyles[10].target":"taskbar:TaskListButtonPanel#IconPanel","controlStyles[10].styles[0]":"Padding=0,0,0,0","controlStyles[11].target":"taskbar:TaskListButtonPanel#ExperienceToggleButtonRootPanel","controlStyles[11].styles[0]":"Padding=0, 0,0,0","controlStyles[11].styles[1]":"Height=16","controlStyles[11].styles[2]":"Width=16","controlStyles[12].target":"Windows.UI.Xaml.Controls.Grid#OverflowRootGrid","controlStyles[12].styles[0]":"Padding=0,0,0,0","controlStyles[13].target":"Windows.UI.Xaml.Controls.ContentPresenter","controlStyles[13].styles[0]":"Height=24","controlStyles[13].styles[1]":"WIdth=24","theme":"","controlStyles[7].styles[1]":"// Bell ?","controlStyles[14].target":"Windows.UI.Xaml.Controls.ContentPresenter > SystemTray.NotifyIconView[AutomationProperties.Name=DeskAlert] > Grid","controlStyles[14].styles[0]":"Visbility=Collapsed","controlStyles[11].styles[3]":"// Windows \"Start\" button"}
Fork Settings: {"theme":"","controlStyles[0].target":"Windows.UI.Xaml.Controls.ContentPresenter > SystemTray.NotifyIconView[AutomationProperties.Name=DeskAlert] > Grid","controlStyles[0].styles[0]":"Visibility=Collapsed","resourceVariables[0].variableKey":"","resourceVariables[0].value":"","controlStyles[1].target":"Windows.UI.Xaml.Controls.ContentPresenter > SystemTray.NotifyIconView[AutomationProperties.Name=Windows Security - Actions recommended.] > Grid","controlStyles[1].styles[0]":"Visibility=Collapsed","controlStyles[2].target":"Windows.UI.Xaml.Controls.ContentPresenter > SystemTray.NotifyIconView[AutomationProperties.Name=Microsoft Outlook] > Grid","controlStyles[2].styles[0]":"Visibility=Collapsed","controlStyles[3].target":"Windows.UI.Xaml.Controls.ContentPresenter > SystemTray.NotifyIconView[AutomationProperties.Name=(null)] > Grid","controlStyles[3].styles[0]":"Visibility=Collapsed","controlStyles[4].target":"Windows.UI.Xaml.Controls.ContentPresenter > SystemTray.NotifyIconView[AutomationProperties.Name=Service is enabled.] > Grid","controlStyles[4].styles[0]":"Visibility=Collapsed","controlStyles[5].target":"Windows.UI.Xaml.Controls.ContentPresenter > SystemTray.NotifyIconView[AutomationProperties.Name=Safely Remove Hardware and Eject Media] > Grid","controlStyles[5].styles[0]":"Visibility=Collapsed"}
multiple monitors have been known to cause strange behaviors in other cases, would you mind testing with just 1 display, just to be sure?
I don't see what it would gain? (What I mean is that I have it working with multiple monitors now, and I am going to be using multiple monitors, so if it works with single monitor and not multiple, that doesn't help me).
If there are actually no other unique properties to target, then we just can't target that specific element
I think I'm stuck with this one:
On the positive side: Third icon is the one I want to kill with (null) for the name. Everything else I want. Icons I want are on one line with basically a blank line below them.
Honestly, if you can find a way to be able to use advancedrun instead, I would recommend trying that as its easy to do and very reliable, plus it doesn't leave that space.
Understood. If this was my personal computer I would look into that. (If this was my personal computer, I wouldn't load half of these programs to begin with). This is my work PC so:
Re-booted and it is not working as well as I hoped ... Here is the systray after I re-booted. I manually loaded WH - some programs were loaded ahead of WH and some were loaded after WH: Basically, none of the icons are hidden. After everything finished loading, I re-started WH from the command line and I have this: basically what I wanted, except Zscaler is not being blocked. Not sure why - it was blocked previously. Opened WH and toggled the fork on and off and Zscaler was still not blocked.
Thought I would post one update and then I'm going to close the issue - although if anyone has further insights and words of wisdom, they will be welcome.
This seems to work, but it is somewhat hit or miss. I changed the settings for the forked mod to not block Zscaler and I modified my startup script to restart WH 30 seconds after the last manual startup icon was started. That wasn't enough delay, so I changed it to 45 seconds. I'll tweak that value over the next several days.
Here's how it ended up: As you can see, the Outlook icon is not being hidden and I re-started WH several times and it still was not hidden. (And I'm working without the external monitors today, which means that wasn't the ONLY source of any of the issues. It may or may not block Outlook in the future.
Oddly - if it did block Outlook (or if I changed Taskbar tray icon spacing to 12 items and moved it up), it would drop the overflow down to one line. I'm not sure why it does that. In theory it shouldn't since it only removed the image and not the space for the image, but it seems that Windows at some point evaluates the overflow tray and decides items without icons don't need grid space. (If an icon isn't visible, is it really there type of thing ...)
Sometime I'll also look at why the fork mod was needed and try to accomplish the same steps from the main version of the mod.
Massive thanks to @bbmaster123 - I wouldn't have gotten nearly this far on my own!!!
Please see https://github.com/ramensoftware/windhawk-mods/issues/1210.
Other than payware, I've somewhat figured out how to remove the icon itself, but not the grid space that the icon occupies.
Hoping someone may understand it better than I do and have helpful suggestions!
Thanks and regards,