ramensoftware / windows-11-taskbar-styling-guide

A collection of commonly requested taskbar styling customizations for Windows 11
147 stars 12 forks source link

Is it possible to move the system tray/clock? #65

Open sealevelcain opened 1 month ago

sealevelcain commented 1 month ago

Would it be possible to move the system tray/clock? I'd like to centralise it so it sits next to the task list if possible. TaskbarXI had a similar feature, but the project has been abandoned and many of the features are broken.

bbmaster123 commented 1 month ago

yes it is possible, but you may need to adjust some of the other elements to get everything looking correct. You can target the whole button with: SystemTray.OmniButton

or just the time with: SystemTray.DateTimeIconContent

set the style to: Transform3D:=<CompositeTransform3D TranslateX="-350"/> replacing 350 with the number of pixel to move to the left.

use UWPSpy to find what other elements you'll need to target. moving the time on its own isn't enough as it will leave a blank space.

Good luck :) I hope you get it to look how you want!

image

dpcdpc11 commented 5 days ago

yes it is possible, but you may need to adjust some of the other elements to get everything looking correct. You can target the whole button with: SystemTray.OmniButton

or just the time with: SystemTray.DateTimeIconContent

set the style to: Transform3D:=<CompositeTransform3D TranslateX="-350"/> replacing 350 with the number of pixel to move to the left.

use UWPSpy to find what other elements you'll need to target. moving the time on its own isn't enough as it will leave a blank space.

Good luck :) I hope you get it to look how you want!

image

I'm trying to achieve the same as the OP but using absolute values to move the systray section is not a solution because the tasks list width is dynamic so the position of the systray should also be dynamic in relation to the tasks list width. Would it be possible to use variables for the TranslateX value of the systray something like TranslateX=Taskbar.TaskList.Width?

Here's my result so far, but as you can see the last icon is cut of because the systray doesn't move to the right when I open new apps on the taskbar: image

Any help would be great. Thanks!

bbmaster123 commented 5 days ago

@dpcdpc11 Unfortunately no, you can't use a variable for the value Since this isn't actually a real dock, it doesn't behave like one, and there's not a whole lot that can be done about that, but we can try to work around that limitation a little

instead of having the dock expand and contract as apps are opened and closed, we can set the size of the running apps list to a more appropriate value, which should force the taskbar to collapse into the 3-dot button when full and you open another app for example:

Target:
Grid#RootGrid
Styles:
Width=1985
Margin=-10,0,0,0
dpcdpc11 commented 5 days ago

@ bbmaster123 thanks for the reply! I know it's not a dock but since this is the direction Microsoft is taking the taskbar, I thought that maybe there's a trick to do it since the Widgets button can sit either on the left corner or on the center dynamically.

Your solution would be great but in my case, it's not, since I use two displays and one is oriented vertically, so the taskbar needs to be narrower there.

As a side note, would it be possible to hide the systray on the secondary monitor altogether?

bbmaster123 commented 5 days ago

Unfortunately there is no trick that I know of. That is also quite a niche screen setup, as useful as it sounds!

As I don't have 2 screens, and I haven't been able to get that going in vmware, I can't really test. If I recall, there isn't a way to differentiate between taskbar 1 and taskbar 2 in the styler mod. Check UWPspy, I don't know but maybe if you can see both taskbars in the list, it might be possible. Let me know if anything interesting shows up.

Otherwise, I might suggest using 2 different taskbars, or maybe a dock such as object dock, and the taskbar

dpcdpc11 commented 2 days ago

@bbmaster123 I've used UWPspy and yes, there are two taskbars but they both have the same name. How can I target them differently since I don't see any unique ID attribute for each of them?

bbmaster123 commented 2 days ago

you cannot target them separately if there isn't anything unique to either of them

dpcdpc11 commented 2 days ago

I see. That's a bummer, but if I right-click the second one and uncheck Visible, only the second one gets hidden. So in theory, there should be a way to target each taskbar instance. Here's a screenshot of what I see: image

bbmaster123 commented 2 days ago

UWPspy is a bit different, there are some things you can do in UWPspy that don't work in the styler mods, for example WinUI3

have you tried turning on Detailed property list and looking at the automation entries near the top under attributes? Maybe you can find a unique name, id, etc under any of the targets. They just have to be different values. If there aren't any unique values you can only do it through uwpspy for now

dpcdpc11 commented 2 days ago

I see. After enabling the Detailed property list, I see something called AutomationProperties.Annotations attribute with a different value for each taskbar: 553611192 and 172679832 respectively. Now how can I target those in the style mod?

bbmaster123 commented 2 days ago

first make sure those numbers don't change if you restart explorer.exe If they stay static, you can target them like this:

Grid#SystemTrayFrameGrid[AutomationProperties.Annotations=553611192]

dpcdpc11 commented 1 day ago

It seems that the values of AutomationProperties.Annotations keep changing every time I run UWPSpy and the same goes for other attributes as well, such as RowDefinitions. And regardless of which I try to target using your suggestion, when I use Visibility=Collapsed in Style Mod, both system trays are getting hidden. So the only way to hide the tray on the second screen is to use UWPSpy directly. Bummer :( Anyway, thanks again for your effort in trying to make this work. I really appreciate your effort!

bbmaster123 commented 1 day ago

That's unfortunate :(

one quick idea I just had, and I'm not sure it will work, but do you have any 3rd party apps that run on only 1 of the taskbars? maybe they would appear in the visual tree in UWPspy and you could hopefully use that to help target?

dpcdpc11 commented 1 day ago

All my apps are pinned on the main taskbar and I use my second screen to move Chrome tabs but then I have Chrome tabs on both taskbar. So I'm not sure how to target the secondary taskbar since you can't pin apps on the secondary taskbar on Windows 11.

sealevelcain commented 1 day ago

In the taskbar settings, you can change the appearance of taskbar buttons independently for each taskbar - perhaps changing this setting can help you target them separately? image

dpcdpc11 commented 1 day ago

@sealevelcain both options are already set to Always since I don't have to see app labels. Not sure how that helps.

sealevelcain commented 1 day ago

@dpcdpc11 Having separate settings might provide a way for you to identify the taskbars separately within UWPSpy.

dpcdpc11 commented 1 day ago

@sealevelcain not sure what you mean by "having separate settings". There are no separate settings in Windows for each taskbar.

bbmaster123 commented 1 day ago

@dpcdpc11 @sealevelcain

That's actually a good idea, it might not let you target everything but you could might at least be able to access the apps list

when you switch between labels and no labels, the target changes from TaskListButtonPanel to TaskListLabeledButtonPanel. If one taskbar has the labels, that makes that target (and its children) unique enough. You could then hide the labels and set the button width so it visually matches.

Look at sealevelcain's screenshot, there are 2 dropdowns :)

sealevelcain commented 1 day ago

@dpcdpc11 I've literally just posted a screenshot of one - you can set label behaviour for each taskbar independently. Open the settings and look for yourself.

dpcdpc11 commented 1 day ago

I see what you mean now, guys. I thought you meant completely separate Taskbar Behavor settings. The problem is that I have custom icons set to the pinned apps and if I enable to show the labels, the apps revert to the default icon and I'm also not a fan of the labels view. But I'll give that a try and see how it goes. @sealevelcain thanks for the suggestion!

dpcdpc11 commented 1 day ago

So here's what I see with the labels on for the secondary taskbar:

image

Now how do I target the SystemTray.SystemTrayFrame or the SystemTrayFrameGrid since it's on a different thread than the Taskbar.TaskListLabeledButtonPanel?

bbmaster123 commented 1 day ago

are you able to style each taskbar's IconPanel seperately? Don't worry too much about the icons as this is only to test whether this can even be done at all right now If it does work, you would need to find a way to make one of your taskbar's tray area unique and target that. If not, there's nothing we can do at the moment, although future updates might have a chance at brining proper support for additional taskbars, eventually

sealevelcain commented 1 day ago

@dpcdpc11 The only other potential solution I can think of would be to remove the clock from the system tray (see below), and then add a new clock to the taskbar on your main monitor with ElevenClock.

Screenshot 2024-09-13 214931