It is currently May 19th, 2022, 2:46 pm

Rounded Screen Corners

General topics related to Rainmeter.
User avatar
balala
Rainmeter Sage
Posts: 14209
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Rounded Screen Corners

Post by balala »

Yincognito wrote: April 18th, 2022, 4:51 pm Well, I don't see why it does affect it either, but this skin, being all over the screen, does that.
Let's clarify something, because I don't really understand. By "general window" I meant a general window, like a Notepad, a web browser (any of them) or the Manage Rainmeter dialog (or finally any other real running program). I didn't mean at all skins. General windows are going always behind the taskbar, they can't stay over. Skins on the other hand can, how they stay, depends on their Position settings. :confused:
User avatar
Yincognito
Rainmeter Sage
Posts: 4694
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Rounded Screen Corners

Post by Yincognito »

balala wrote: April 18th, 2022, 5:36 pm Let's clarify something, because I don't really understand. By "general window" I meant a general window, like a Notepad, a web browser (any of them) or the Manage Rainmeter dialog (or finally any other real running program). I didn't mean at all skins. General windows are going always behind the taskbar, they can't stay over. Skins on the other hand can, how they stay, depends on their Position settings. :confused:
Yes, we're on the same page regarding general windows - I meant the same, I actually use Notepad in my tests. That being said, this skin (or its properties like being full screen and staying topmost) is interfering with the normal behavior of general windows of going behind the taskbar. I don't know of a simpler way of summarizing what happens here, really. :)
User avatar
Yincognito
Rainmeter Sage
Posts: 4694
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Rounded Screen Corners

Post by Yincognito »

istir wrote: April 18th, 2022, 5:00 pm If I get what you mean it sadly doesn't work. I loaded top and bottom ones as two different skins and it loaded them as "one". I attached the one I tried loading.
Well, it does for me...

[SkinsFolder]\Rounded Corners Top\Rounded Corners Top.ini:

Code: Select all

[Variables]
CornerRadius=10
CornerColor=0,0,0

[Rainmeter]
Update=-1

[MeterShapeCorners]
Meter=Shape
Shape=Rectangle 0,0,(#ScreenAreaWidth#),(#CornerRadius#) | Fill Color #CornerColor# | StrokeWidth 0
Shape2=Rectangle 0,0,(#ScreenAreaWidth#),(#CornerRadius#*2),#CornerRadius# | Fill Color 0,0,0,0
Shape3=Combine Shape | Exclude Shape2
[SkinsFolder]\Rounded Corners Bottom\Rounded Corners Bottom.ini:

Code: Select all

[Variables]
CornerRadius=10
CornerColor=0,0,0

[Rainmeter]
Update=-1

[MeterShapeCorners]
Meter=Shape
Shape=Rectangle 0,0,(#ScreenAreaWidth#),(#CornerRadius#) | Fill Color #CornerColor# | StrokeWidth 0
Shape2=Rectangle 0,(-#CornerRadius#),(#ScreenAreaWidth#),(#CornerRadius#*2),#CornerRadius# | Fill Color 0,0,0,0
Shape3=Combine Shape | Exclude Shape2
The mistake in your code was still having the bottom skin extending all over the screen (which we already deduced that it was the problem, in combination with staying topmost) - by comparison, each of the above extends only 10 pixels in height in this case, aka the height of the corners. Obviously, they should be positioned accordingly and set to stay topmost. If needed, variations of this could be made, e.g. skins with scaling corners on scroll, or even 4 skins instead of 2, each skin representing a corner - that way, one could position the corners at will, in the case of some other window doesn't have rounded corners, etc.

P.S. Sorry for the delay in replying, been busy with other stuff until now.
P.S.S. By the way, the above works even if the skins' heights are a greater multiple of corner radius (or any other number for that matter, as long as it's not the full screen height), like in your original top skin code. Having them taking only what was necessary was just my efficiency driven approach, nothing more. :D
istir
Posts: 4
Joined: April 18th, 2022, 4:16 pm

Re: Rounded Screen Corners

Post by istir »

Oooh okay, yes it works for me now! My mistake was not thinking about "Coordinates" in skin settings. I changed Y to my screen height - corner radius and it works perfectly! I know WIndowX and WindowY in Rainmeter.ini are the equivalents of Coordinates section, but can I somehow set it from the skin itself, without having to either drag it around or fiddle in configs?
User avatar
Yincognito
Rainmeter Sage
Posts: 4694
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Rounded Screen Corners

Post by Yincognito »

istir wrote: April 18th, 2022, 8:36 pm Oooh okay, yes it works for me now! My mistake was not thinking about "Coordinates" in skin settings. I changed Y to my screen height - corner radius and it works perfectly! I know WIndowX and WindowY in Rainmeter.ini are the equivalents of Coordinates section, but can I somehow set it from the skin itself, without having to either drag it around or fiddle in configs?
Yes, of course you can. There are multiple ways of doing this, the first coming to my mind is to move the skins accordingly on refresh, by adding:

Code: Select all

OnRefreshAction=[!Move 0 0]
for the top skin, and:

Code: Select all

OnRefreshAction=[!Move 0 (#SCREENAREAHEIGHT#-#CornerRadius#)]
for the bottom one, in the [Rainmeter] section of the corresponding skin. You can, naturally, keep the [!ZPos 2] bang from the original skin there if you want.
istir
Posts: 4
Joined: April 18th, 2022, 4:16 pm

Re: Rounded Screen Corners

Post by istir »

Thank you very much, it worked!
User avatar
Yincognito
Rainmeter Sage
Posts: 4694
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Rounded Screen Corners

Post by Yincognito »

istir wrote: April 18th, 2022, 8:50 pm Thank you very much, it worked!
No problem. Now that I better think of it, you may want to change the skins to...

[SkinsFolder]\Rounded Corners Top\Rounded Corners Top.ini:

Code: Select all

[Variables]
CornerRadius=10
CornerColor=0,0,0

[Rainmeter]
Update=1000
DynamicWindowSize=1

[MeterShapeCorners]
Meter=Shape
Shape=Rectangle 0,0,(#ScreenAreaWidth#),(#CornerRadius#) | Fill Color #CornerColor# | StrokeWidth 0
Shape2=Rectangle 0,0,(#ScreenAreaWidth#),(#CornerRadius#*2),#CornerRadius# | Fill Color 0,0,0,0
Shape3=Combine Shape | Exclude Shape2
OnUpdateAction=[!Move 0 0]
DynamicVariables=1
[SkinsFolder]\Rounded Corners Bottom\Rounded Corners Bottom.ini:

Code: Select all

[Variables]
CornerRadius=10
CornerColor=0,0,0

[Rainmeter]
Update=1000
DynamicWindowSize=1

[MeterShapeCorners]
Meter=Shape
Shape=Rectangle 0,0,(#ScreenAreaWidth#),(#CornerRadius#) | Fill Color #CornerColor# | StrokeWidth 0
Shape2=Rectangle 0,(-#CornerRadius#),(#ScreenAreaWidth#),(#CornerRadius#*2),#CornerRadius# | Fill Color 0,0,0,0
Shape3=Combine Shape | Exclude Shape2
OnUpdateAction=[!Move 0 (#SCREENAREAHEIGHT#-#CornerRadius#)]
DynamicVariables=1
in order to make sure they adapt if resolution changes, either on an automatic (e.g. if some other program changes it) or a manual basis (if you change it from Start / Settings / System). In their original form, updated only once at load and with the movement being done in the non-dynamic [Rainmeter] section, such a seamless adaptation wasn't possible. I'm generally a fan of negative updates to save up resources, but then, the CPU won't feel a thing if you have 2 small shape based skins update every second anyway. ;-)
SubjunctiveQuaver
Posts: 6
Joined: April 18th, 2022, 1:53 pm

Re: Rounded Screen Corners

Post by SubjunctiveQuaver »

Yincognito wrote: April 18th, 2022, 9:21 pm No problem. Now that I better think of it, you may want to change the skins to...

[SkinsFolder]\Rounded Corners Top\Rounded Corners Top.ini:

Code: Select all

[Variables]
CornerRadius=10
CornerColor=0,0,0

[Rainmeter]
Update=1000
DynamicWindowSize=1

[MeterShapeCorners]
Meter=Shape
Shape=Rectangle 0,0,(#ScreenAreaWidth#),(#CornerRadius#) | Fill Color #CornerColor# | StrokeWidth 0
Shape2=Rectangle 0,0,(#ScreenAreaWidth#),(#CornerRadius#*2),#CornerRadius# | Fill Color 0,0,0,0
Shape3=Combine Shape | Exclude Shape2
OnUpdateAction=[!Move 0 0]
DynamicVariables=1
[SkinsFolder]\Rounded Corners Bottom\Rounded Corners Bottom.ini:

Code: Select all

[Variables]
CornerRadius=10
CornerColor=0,0,0

[Rainmeter]
Update=1000
DynamicWindowSize=1

[MeterShapeCorners]
Meter=Shape
Shape=Rectangle 0,0,(#ScreenAreaWidth#),(#CornerRadius#) | Fill Color #CornerColor# | StrokeWidth 0
Shape2=Rectangle 0,(-#CornerRadius#),(#ScreenAreaWidth#),(#CornerRadius#*2),#CornerRadius# | Fill Color 0,0,0,0
Shape3=Combine Shape | Exclude Shape2
OnUpdateAction=[!Move 0 (#SCREENAREAHEIGHT#-#CornerRadius#)]
DynamicVariables=1
in order to make sure they adapt if resolution changes, either on an automatic (e.g. if some other program changes it) or a manual basis (if you change it from Start / Settings / System). In their original form, updated only once at load and with the movement being done in the non-dynamic [Rainmeter] section, such a seamless adaptation wasn't possible. I'm generally a fan of negative updates to save up resources, but then, the CPU won't feel a thing if you have 2 small shape based skins update every second anyway. ;-)
Thank you all so much!! This one worked perfectly :D -- the regular behaviour is restored !!

BTW I have a second monitor which I also applied this to (with different resolution), so there was a bit of fiddling around with the coordinates in "OnUpdateAction" and corner radius settings, but I managed to get that working perfectly too.
User avatar
Yincognito
Rainmeter Sage
Posts: 4694
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Rounded Screen Corners

Post by Yincognito »

SubjunctiveQuaver wrote: April 19th, 2022, 3:52 am Thank you all so much!! This one worked perfectly :D -- the regular behaviour is restored !!

BTW I have a second monitor which I also applied this to (with different resolution), so there was a bit of fiddling around with the coordinates in "OnUpdateAction" and corner radius settings, but I managed to get that working perfectly too.
Excellent! :great: I suppose you appended the @N monitor number in the monitor variables the skins use, right? If so, you can share your solution, maybe it will help others in a similar situation. If not, maybe you can try doing it that way instead, after all, you can easily create some backup version of the skins and use that in the end, if by any chance you can't make it work that way.
SubjunctiveQuaver
Posts: 6
Joined: April 18th, 2022, 1:53 pm

Re: Rounded Screen Corners

Post by SubjunctiveQuaver »

Yincognito wrote: April 19th, 2022, 8:47 am Excellent! :great: I suppose you appended the @N monitor number in the monitor variables the skins use, right? If so, you can share your solution, maybe it will help others in a similar situation. If not, maybe you can try doing it that way instead, after all, you can easily create some backup version of the skins and use that in the end, if by any chance you can't make it work that way.
Ooh I've now tried that. Is there a way to get the scale/DPI of each monitor (so I can adjust the corner radius accordingly?) Below are the improved snippets; they work for any screen as long as you set the right display monitor in settings!! (Just duplicate for each screen; is there a better way to do this?) Also the settings for click through/draggable etc. can be changed, but the !AutoSelectScreen is really important to keep as 1, which is the reason why it all works, and !ZPos is 2 to stay topmost.

The top (assuming 100% scale, otherwise replace 8 with scale*8) i.e. in [SkinsFolder]\Rounded Corners Top\Rounded Corners Top.ini:

Code: Select all

[Variables]
CornerRadius=8
CornerColor=0,0,0

[Rainmeter]
Update=1000
DynamicWindowSize=1
OnRefreshAction=[!AutoSelectScreen 1][!ClickThrough 1][!Draggable 0][!KeepOnScreen 1][!SnapEdges 1][!ZPos 2]

[MeterShapeCorners]
Meter=Shape
Shape=Rectangle 0,0,(#ScreenAreaWidth#),(#CornerRadius#) | Fill Color #CornerColor# | StrokeWidth 0
Shape2=Rectangle 0,0,(#ScreenAreaWidth#),(#CornerRadius#*2),#CornerRadius# | Fill Color 0,0,0,0
Shape3=Combine Shape | Exclude Shape2
OnUpdateAction=[!Move (#ScreenAreaX#) (#ScreenAreaY#)]
DynamicVariables=1
The bottom (assuming 100% scale, otherwise replace 8 with scale*8) i.e. in [SkinsFolder]\Rounded Corners Top\Rounded Corners Bottom.ini:

Code: Select all

[Variables]
CornerRadius=8
CornerColor=0,0,0

[Rainmeter]
Update=1000
DynamicWindowSize=1
OnRefreshAction=[!AutoSelectScreen 1][!ClickThrough 1][!Draggable 0][!KeepOnScreen 1][!SnapEdges 1][!ZPos 2]

[MeterShapeCorners]
Meter=Shape
Shape=Rectangle 0,0,(#ScreenAreaWidth#),(#CornerRadius#) | Fill Color #CornerColor# | StrokeWidth 0
Shape2=Rectangle 0,(-#CornerRadius#),(#ScreenAreaWidth#),(#CornerRadius#*2),#CornerRadius# | Fill Color 0,0,0,0
Shape3=Combine Shape | Exclude Shape2
OnUpdateAction=[!Move (#ScreenAreaX#) (#ScreenAreaY#+#ScreenAreaHeight#-#CornerRadius#)]
DynamicVariables=1
Would also be good to update the metadata which right now is

Code: Select all

[Metadata]
Name=Rounded Corners
Author=eclectic-tech, RyanClark, stupd
Information=Original code by eclectic-tech and RyanClark at https://forum.rainmeter.net/viewtopic.php?t=25780 , copy pasted here; Corner radius set to match Windows 11's window corners at 1920x1980.
Version=1.0
License=Creative Commons Attribution - Non - Commercial - Share Alike 3.0
but I'm not experienced with this stuff (not usually a coder lol, and I've lost track of who's contributed hahah) - I think it's just you and I @Yincognito additionally?