It is currently December 4th, 2020, 4:50 am

[Feature Suggestion] New Bang !SaveLayout

Report bugs with the Rainmeter application and suggest features.
User avatar
Nickson
Posts: 8
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: 21513
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: 8
Joined: May 10th, 2020, 7:02 pm

Re: [Feature Suggestion] New Bang !SaveLayout

Post by Nickson »

Is there any progress?
User avatar
mpurses
Posts: 12
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.