It is currently March 29th, 2024, 7:24 am

New Skin Position Bangs

Changes made during the Rainmeter 4.4 beta cycle.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

New Skin Position Bangs

Post by jsmorley »

We have added two new bangs to Rainmeter, that can dynamically set the values for WindowX, WindowY, AnchorX and AnchorY for a skin window. The settings will automatically be reflected in Rainmeter.ini.

[!SetWindowPosition "WindowX" "WindowY" "AnchorX" "AnchorY"]
https://docs.rainmeter.net/manual-beta/bangs/#SetWindowPosition

[!SetAnchor "AnchorX" "AnchorY"]
https://docs.rainmeter.net/manual-beta/bangs/#SetAnchor

Note that unlike !Move, these values can also use the R B % @ modifiers described in the documentation. However (formulas) cannot be used along with those modifiers.


I can imagine this being of some use for "centering" a skin in the middle of the screen.

So instead of something complicated and hideous like:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
OnRefreshAction=[!Move (#SCREENAREAWIDTH#/2-(#SkinW#/2)) (#SCREENAREAHEIGHT#/2-(#SkinH#/2))]

[Variables]
SkinW=400
SkinH=200
You might just use:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
OnRefreshAction=[!SetWindowPosition "50%" "50%" "50%" "50%"]
User avatar
Brian
Developer
Posts: 2674
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: New Skin Position Bangs

Post by Brian »

For the next beta, there are a couple of issues that have been corrected:
  1. For both of these new bangs, all the parameters (except the "config" optional parameter) will accept formulas with or without the modifiers.
  2. There was an outstanding issue with the WindowX/Y where a formula with a trailing modifier was not parsed correctly. It is now.
  3. AnchorX/Y will now support formulas.
8-)

-Brian
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: New Skin Position Bangs

Post by jsmorley »

New beta r3380 is out...

It should be noted that the way this works with formulas is:

If you edit Rainmeter.ini and use a formula in any of WindowX / WindowY / AnchorX / AnchorY, those formulas will be read, parsed, and obeyed each time the skin is loaded or refreshed. As long as you don't move the skin, the formulas as literally written will stay in Rainmeter.ini.

If you use DefaultWindowX, DefaultWindowY, DefaultAnchorX, DefaultAnchorX in the [Rainmeter] section of a skin, formulas will be read, parsed, and written the first time the skin is loaded. As long as you don't move the skin, the formulas as literally written will stay in Rainmeter.ini.

If you use the new !SetWindowPosition !SetAnchor bangs to "move" a skin, either with or without a formula, and either with or without any of the R B % @ "modifiers", the result of the formula is what will be written to Rainmeter.ini. So [!SetWindowPosition "(25*2)%" "(25*2)%" "(25*2)%" "(25*2)%"] would be written as WindowX=50.00000%.

With any of approaches, if any of WindowX / WindowY / AnchorX / AnchorY are set using any of the R B % @ "modifiers", Those modifiers will be "persistent", and even if you drag the skin, or use the !Move bang, the result will reflect the new values in the context of the modifier(s).
User avatar
SilverAzide
Rainmeter Sage
Posts: 2588
Joined: March 23rd, 2015, 5:26 pm

Re: New Skin Position Bangs

Post by SilverAzide »

Nice addition! I keep thinking Rainmeter is THIS CLOSE to being able to have skins that auto-arrange themselves the way that the old Windows Sidebar Gadgets would do. If you cast your mind back to those ancient bygone days, plopping a gadget into the sidebar would cause any other gadgets to auto-adjust their spacing so none would overlap. I can't quite get a handle on how we could do that in Rainmeter (I mean in a skin/Lua, not in something built into Rainmeter itself -- which could be nice). ...I guess you'd need a way to enumerate all active skins. Once you had that, you could use Lua to cycle through them looking for overlaps and use these new bangs to move them.
Gadgets Wiki GitHub More Gadgets...
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: New Skin Position Bangs

Post by jsmorley »

SilverAzide wrote: June 24th, 2020, 1:49 pm Nice addition! I keep thinking Rainmeter is THIS CLOSE to being able to have skins that auto-arrange themselves the way that the old Windows Sidebar Gadgets would do. If you cast your mind back to those ancient bygone days, plopping a gadget into the sidebar would cause any other gadgets to auto-adjust their spacing so none would overlap. I can't quite get a handle on how we could do that in Rainmeter (I mean in a skin/Lua, not in something built into Rainmeter itself -- which could be nice). ...I guess you'd need a way to enumerate all active skins. Once you had that, you could use Lua to cycle through them looking for overlaps and use these new bangs to move them.
That has some charm, but I'm skeptical of how to do it in a way that maintains the ultimate intent of Rainmeter, that the "user" is in control of his desktop, not the "author". I feel like this would either 1) force behavior that a user may or may not want, or 2) Require just boatloads of "settings" to control how much "spacing" you want between skin windows, how they are to be arranged; horizontal, vertical, columns, etc. etc. etc.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: New Skin Position Bangs

Post by jsmorley »

I guess my real hesitation is that the idea of Rainmeter is that each skin is a separate entity. You can mix and match them from stuff you write yourself, stuff in a "suite" from some author, or a single skin you download from deviantART. What you do with them, where you put them on the screen, which ones you load or don't load at any given time, all that, is up to you, the "user".

What Rainmeter "isn't", is a single application "container" that holds a bunch of "gadgets" that all live in the same automatically arranged box. I actually hate that entire idea.
User avatar
SilverAzide
Rainmeter Sage
Posts: 2588
Joined: March 23rd, 2015, 5:26 pm

Re: New Skin Position Bangs

Post by SilverAzide »

jsmorley wrote: June 24th, 2020, 1:55 pm That has some charm, but I'm skeptical of how to do it in a way that maintains the ultimate intent of Rainmeter, that the "user" is in control of his desktop, not the "author". I feel like this would either 1) force behavior that a user may or may not want, or 2) Require just boatloads of "settings" to control how much "spacing" you want between skin windows, how they are to be arranged; horizontal, vertical, columns, etc. etc. etc.
Well, I was thinking more along the lines of what some other skins/suites have tried to do with having a "sidebar" skin (visible or not) that controls/auto-arranges all it's "children". If you wanted total freedom, you wouldn't use the sidebar, but if you wanted things to sit along some edge of the screen in a column or row, then you'd use it. So far from what I've seen, sidebar skins don't (can't?) really work the way Windows did. (IIRC, Vista forced everything to the sidebar, but Win7 removed this restriction and allowed placing gadgets anywhere you wanted.)
Gadgets Wiki GitHub More Gadgets...
User avatar
SilverAzide
Rainmeter Sage
Posts: 2588
Joined: March 23rd, 2015, 5:26 pm

Re: New Skin Position Bangs

Post by SilverAzide »

jsmorley wrote: June 24th, 2020, 2:02 pmWhat Rainmeter "isn't", is a single application "container" that holds a bunch of "gadgets" that all live in the same automatically arranged box. I actually hate that entire idea.
LOL, OK! Fair enough! :D
Gadgets Wiki GitHub More Gadgets...
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: New Skin Position Bangs

Post by jsmorley »

SilverAzide wrote: June 24th, 2020, 2:14 pm Well, I was thinking more along the lines of what some other skins/suites have tried to do with having a "sidebar" skin (visible or not) that controls/auto-arranges all it's "children". If you wanted total freedom, you wouldn't use the sidebar, but if you wanted things to sit along some edge of the screen in a column or row, then you'd use it. So far from what I've seen, sidebar skins don't (can't?) really work the way Windows did. (IIRC, Vista forced everything to the sidebar, but Win7 removed this restriction and allowed placing gadgets anywhere you wanted.)
As I said, I understand the charm of the idea, but I'm pretty happy with how you might do it today:

1) Create a Layout that has the skins arranged and positioned in some "recommended" way.
There are lots of clever ways to do this independent of the size and resolution of the target screen. That is the point of the % percentages, and R B relativity in those settings.

2) Include this Layout in your .rmskin.

Then when the user first loads your suite, it is arranged in the recommended way. If they want to change where things are, fine. Then if they want, they can, and SHOULD, save a new Layout with the new arrangement. If they change their mind, or for any reason want to get back to your original placement, they just load your Layout again.

I always quiver with suspicion when I see the term "automatically" when applied to Rainmeter... ;-)
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: New Skin Position Bangs

Post by Yincognito »

SilverAzide wrote: June 24th, 2020, 1:49 pm Nice addition! I keep thinking Rainmeter is THIS CLOSE to being able to have skins that auto-arrange themselves the way that the old Windows Sidebar Gadgets would do. If you cast your mind back to those ancient bygone days, plopping a gadget into the sidebar would cause any other gadgets to auto-adjust their spacing so none would overlap. I can't quite get a handle on how we could do that in Rainmeter (I mean in a skin/Lua, not in something built into Rainmeter itself -- which could be nice). ...I guess you'd need a way to enumerate all active skins. Once you had that, you could use Lua to cycle through them looking for overlaps and use these new bangs to move them.
You don't need Lua, and you wouldn't necessarily need to do that for all active skins, just the ones in your group. What you need, since popping them using the mouse is inoperable due to Rainmeter not being able to detect when mouse has been released from a drag operation (unless you can find some plugins helping you with that), is:

- the number of rows and columns in the arranged skin matrix
- the width and height of a skin in the set (them having the same dimensions is a fair assumption in this case)
- the skin order in the set (this can be a comma separated list obtained from an input text or a checkbox list, that you can manipulate further in order to extract the individual skin names)

One requirement of the first two (but not both) can be set using some screen area based formula, and can even take the known or unknown gap between skins into account, if needed.

Then, from another skin (e.g. a settings one) you would compute the top left coordinates of each skin using a div and mod formula based on the above requirements / variables, and move them accordingly.

I'm on mobile now so I can't enter into details on this one, but is definitely possible. I'm doing just that in a test skin where I merge all the skins in my suite, and the difference between doing this within a single skin and doing it for multiple separated skins is not that significant.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth