It is currently April 18th, 2024, 2:50 am

[Feature Suggestion] New Bang !SaveLayout

Report bugs with the Rainmeter application and suggest features.
User avatar
Nickson
Posts: 13
Joined: May 10th, 2020, 7:02 pm

[Feature Suggestion] New Bang !SaveLayout

Post by Nickson »

Theres currently a bang to load a layout (!LoadLayout)

It would be nice to have a bang to save the current layout.
!SaveLayoutParameters: LayoutName, Options

Saves the current layout with the specified name and options.
  • LayoutName (required): The name for the layout.
  • Options (optional): Name of one or more options. Names are separated with the | (pipe) character.
Options:
  • SaveAsEmptyLayout: If given, set option to true.
  • ExcludeInactiveSkins: If given, set option to true.
  • SaveCurrentWallpaper: If given, set option to true.
Examples:
!SaveLayout "NameOfTheLayout"
!SaveLayout "NameOfTheLayout" "SaveAsEmptyLayout"
!SaveLayout "NameOfTheLayout" "ExcludeInactiveSkins|SaveCurrentWallpaper"
One thing im not sure about:
When "SaveAsEmptyLayout" is given, then the other options need to be ignored.

!DeleteLayoutParameters: LayoutName

Deletes the named layout.
  • LayoutName (required): The name of the layout.
Example:
!DeleteLayout "NameOfTheLayout"
Last edited by Nickson on July 18th, 2020, 1:14 am, edited 2 times in total.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [Feature Suggestion] New Bang !SaveLayout

Post by jsmorley »

I'm not opposed to that in principle. Let us take a look at it.
User avatar
Nickson
Posts: 13
Joined: May 10th, 2020, 7:02 pm

Re: [Feature Suggestion] New Bang !SaveLayout

Post by Nickson »

Is there any progress?
User avatar
mpurses
Posts: 15
Joined: May 12th, 2020, 6:17 pm

Re: [Feature Suggestion] New Bang !SaveLayout

Post by mpurses »

For anyone that wants a save layout function in their skin, I made one in Sonder:
https://www.deviantart.com/michaelpurses/art/Sonder-Rainmeter-skin-838147223
Screenshot 2020-10-31 183107.png
I save the layout, wallpaper, and current custom variables. But it's pretty simple code for creating/deleting the folder and copying the current layout settings file.

Code: Select all

;Layouts
[MeasureRunCopyLayoutFolder]
Measure=Plugin
Plugin=RunCommand
Parameter=mkdir "#SETTINGSPATH#Layouts\#Name#"
DynamicVariables=1
[MeasureRunRemoveLayoutFolder]
Measure=Plugin
Plugin=RunCommand
Parameter=rmdir "#SETTINGSPATH#Layouts\#Name#"
DynamicVariables=1
[MeasureRunCopyLayoutFile]
Measure=Plugin
Plugin=RunCommand
Parameter=copy "#RainmeterLayoutFile#" "#SETTINGSPATH#Layouts\#Name#\Rainmeter.ini"
DynamicVariables=1
Call it via a text box that has the name you want to call it:

Code: Select all

Command1=[!SetVariable Name "$UserInput$"][!CommandMeasure MeasureRunCopyLayoutFolder Run][!Delay 500][!CommandMeasure MeasureRunCopyLayoutFile Run]

I use this type of code to save/apply wallpapers as well, but don't save them in the Layout folder because Rainmeter doesn't save the fit. So I apply them separately from the LoadLayout call.

Code: Select all

;Get Wallpaper data from registry:
[WallpaperPath]
Measure=Registry
RegHKey=HKEY_CURRENT_USER
RegKey=Control Panel\Desktop
RegValue=WallPaper
[WallpaperFit]
Measure=Registry
RegHKey=HKEY_CURRENT_USER
RegKey=Control Panel\Desktop
RegValue=WallpaperStyle
[WallpaperTile]
Measure=Registry
RegHKey=HKEY_CURRENT_USER
RegKey=Control Panel\Desktop
RegValue=TileWallpaper
Converting the registry number to the fit (lua):

Code: Select all

if wallfitnum == '10' then 
    wallfit = 'Fill'
    elseif wallfitnum == '6' then
    wallfit = 'Fit'
    elseif wallfitnum == '2' then
    wallfit = 'Stretch'
    elseif wallfitnum == '0' and wallfittile == '1' then
    wallfit = 'Tile'
    elseif wallfitnum == '0' and wallfittile == '0' then
    wallfit = 'Center'
    elseif wallfitnum == '22' then
    wallfit = 'Span'
end
You can look at the code further in Sonder if you want.
But ya I also would love if Rainmeter had a !Savelayout call (as well as properly saving the fit of the wallpaper)
You do not have the required permissions to view the files attached to this post.
User avatar
Nickson
Posts: 13
Joined: May 10th, 2020, 7:02 pm

Re: [Feature Suggestion] New Bang !SaveLayout

Post by Nickson »

After some timeout from actively developing my skins for rainmeter, I ran into the same problem again.
I know there are other external ways to achieve the same functionality, but Id like to have a built-in way.
User avatar
Yincognito
Rainmeter Sage
Posts: 7120
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [Feature Suggestion] New Bang !SaveLayout

Post by Yincognito »

Nickson wrote: January 14th, 2023, 5:15 pm After some timeout from actively developing my skins for rainmeter, I ran into the same problem again.
I know there are other external ways to achieve the same functionality, but Id like to have a built-in way.
Agreed on this one. For now, doing, let's say:

Code: Select all

LeftMouseUpAction=["C:\Program Files\Rainmeter\Rainmeter.exe" !Manage Layouts]
doesn't quite complete the process, but gets you really close, only typing a name, checking some boxes and a click are left to do, since it uses Rainmeter's own window for this.

Of course, silently automating this to react to skin variables and all that is not possible this way...

P.S. Personally, I'd like to have an !ActivateConfigGroup as well, if possible, to match the existing !DeactivateConfigGroup bang, even though I know it would be tricky to identify which skins belong to a certain skin group when those skins wouldn't be loaded / activated yet (in order to parse them).
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth