-
Notifications
You must be signed in to change notification settings - Fork 11
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
Bar Height does not work #884
Comments
This is just a wild guess, but this might be related to both 16 and 30 being less than the minimum height on your computer. The minimum height can vary depending on various configuration settings, including this one: #730 (comment). Related, on some computers, a binding minimum height results in cropping, while on others it results in the bar height being set to the minimum height. |
But I have using default scaling and default font size on Windows 11, resolution 1920x1080 monitor and this bar looks very big, for this configuration they should be something around 20,24px for best result :( |
Are you using the default style sheet for the bar otherwise? That one may already have the smallest bar height given the inner bar elements (it has with my system settings). If so, you could reduce the font size, padding and margins for some of the inner elements to allow for a smaller bar height. |
Padding and margins is set to 0, font size is really small but looks that font size does not affect this problem, like is there is some minimum height is set of 30px and bar won't go smaller. |
If you link your resources file, I can take a look. |
Yes, I can But also here is what happened without resources loaded. 1.mp4Edit: this resources file is just a test to trying figure a problem |
Can you try this one: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="bar:height" TargetType="RelativePanel">
<Setter Property="Height" Value="8" />
</Style>
<!-- Shared text block style -->
<Style x:Key="_base:text_block" TargetType="TextBlock">
<Setter Property="Margin" Value="0" />
<Setter Property="Padding" Value="0" />
<Setter Property="FontSize" Value="2" />
</Style>
<!-- Shared button style -->
<Style x:Key="_base:button" TargetType="Button">
<Setter Property="Margin" Value="0" />
<Setter Property="Padding" Value="0" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="FontSize" Value="2" />
</Style>
<!-- Root panel -->
<Style x:Key="bar:root_panel" TargetType="RelativePanel">
<Setter Property="Margin" Value="0" />
<Setter Property="Padding" Value="0" />
</Style>
<StaticResource x:Key="bar:active_layout:button" ResourceKey="_base:button" />
<StaticResource x:Key="bar:tree_layout:button" ResourceKey="_base:button" />
<StaticResource x:Key="bar:workspace:button" ResourceKey="_base:button" />
<StaticResource x:Key="bar:focused_window:text_block" ResourceKey="_base:text_block" />
<StaticResource x:Key="bar:date_time:text_block" ResourceKey="_base:text_block" />
</ResourceDictionary> |
Thanks for checking. I tried setting my display to your resolution and scaling, and on my side the bar shrinks as expected. So this confirms that it is behaving differently on different systems. To further debug, it would be useful if we could pinpoint what configuration setting in our System is making the difference. Unfortunately, I don't have a good guess at the moment. @dalyIsaac if you have a moment, could you also try load the above resource from your user config? I may misremember, but I vaguely recollect that you were also experiencing a minimum height issue at some point, whereas I for the same configuration saw the bar cropping content. Maybe this is related? |
There is a serious problem with scaling. Check this. Recording.2024-04-28.231625_1.mp4 |
Update, if I set custom scale 100% does not work, but if I set custom scale 101,102,103... in that case is working fine... so scale 100% is problem there... |
That's super useful! I think @dalyIsaac is also using 100% scaling, so that lines up. Not sure right now whether that's something going wrong on the whim-side or on the xaml-side. Isaac, do you have a hunch? In the meantime, is there any drawback to setting the scale to 101%? We should probably add a note to the docs, maybe with a suggestion how to workaround the issue until we find a proper fix. |
This issue may be that there's (confusingly) two ways to set the bar height:
I'm not sure what the reason behind this - dealing with Windows scaling has been somewhat painful. Using the config you linked in #884 (comment) and updating the Hopefully this helps 🤞 |
I will test this in the Beta and Dev channels to check if there is anything wrong with Windows. A simple fix is to disable scaling bar in Whim |
One clarifications regarding the two settings: They are both doing the same thing. The
Normally, one should only need to use one or the other. Note though that |
Ok same things on Beta and Dev. Anyway, I have checked the size in pixels of this bar, so when I start Whim, whatever the height I have in the config, the bar is always 39px. But if I change the scaling and switch it back to default (100%), I get a 16px bar as I defined in the config. I have checked this code and can't understand, 39px has no logic. |
I stand corrected 😄
This doesn't surprise me - window scaling behavior has changed quite a bit over the different Windows versions and APIs.
This does actually ring a bell. There is some weird chicanery to deal with monitors which have monitors of different scaling, but that case was for monitors which don't have 100% scaling: Whim/src/Whim/Native/DeferWindowPosHandle.cs Lines 134 to 144 in 2062e05
|
In #886 I've updated how bar windows positions are set - they now use the workaround I mentioned for monitors with non-100% scaling. For some reason I haven't looked into yet, it appears that you have to set If it doesn't work, let me know and I'll take deeper look. |
The .height works correctly now, but the font doesn't rescale to match (text gets cut off). I put in urob's bar.resources.xaml in the .whim folder but it doesn't appear to be doing anything. Would be nice if Whim just checked the font sizes and made sure they are at most equal to or -1 of bar height (could factor in margins as well). |
The font doesn't scale automatically, you'll have to manually configure it (via
Did you tell Whim to use it in your
We could try to do something like this eventually. But it's a bit tricky given that the font rendering depends on various OS settings like display scale and font accessibility scale. More importantly, the "max font size" also depends on various properties like margin, padding, border sizes, etc. Given that those can be freely styled in the xaml file, it's hard to predict from the Whim-side how that affects the bar spacing without knowing what style properties the user ends up using. One may consider this a downside of giving full flexibility to the user to style the bar via a xaml-stylesheet, though I would consider it a feature. |
I have created empty bar to check what is wrong, there is some minimum of Bar Height or not?
Whether I set the height to 16 or 30, the result appears the same; however, setting it to 150 shows a noticeable difference.
bar.resources.xaml
whim.config.csx
The text was updated successfully, but these errors were encountered: