It is currently April 25th, 2024, 12:52 am

Virtual Desktops and Scrolling Meters

Get help with creating, editing & fixing problems with skins
trainwreck
Posts: 15
Joined: August 12th, 2014, 7:12 pm

Virtual Desktops and Scrolling Meters

Post by trainwreck »

I've been using Rainmeter for a few years to display the contents of a series of text files on the desktop. Nothing graphic or artsy... I just put my tasks for different projects in .txt files and like to see them throughout the day. If I click on one, then it pops up in my text editor.

Two questions:
1. Can I make a meter only appear on a certain desktop? I've searched the forums and found posts on Dexpot and VirtualWin but I'm using WIN10 and really liking it's native virtual desktops. I don't see a need for a 3rd party app. I've looked at Raindexer but wasn't sure if it's really required or not. Is there any direct integration with Win10 virtual desktops? This link (https://docs.rainmeter.net/manual/plugins/virtualdesktops/) says that "Only Dexpot and VirtuaWin are currently supported".

2. I was looking at the manual and saw some information on actions for the mouse scroll wheel. Is it possible for the text displayed in the meter to be scrollable while I hover over that meter?

Thanks.
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Virtual Desktops and Scrolling Meters

Post by balala »

trainwreck wrote:2. I was looking at the manual and saw some information on actions for the mouse scroll wheel. Is it possible for the text displayed in the meter to be scrollable while I hover over that meter?
Even if not the way as Windows handles this, a sort of scroll is possible. The following code does it:

Code: Select all

[Rainmeter]
Update=1000
BackgroundMode=2
SolidColor=80,80,80,160

[Variables]
Y=0
Offset=175
Text=If you only want to download skins from the Internet and use them as-is, then the answer is "none." Rainmeter provides a basic user interface for managing your library of skins, saving and restoring layouts, and changing basic settings such as a skin's location, transparency, and "always on top" behavior. Most Rainmeter features can be reached through the basic Manage window or context menus. Some skin authors create their own controls for users to customize their skins. These controls may be included as a separate utility, or they may be created entirely within Rainmeter as another skin. If this is the case, then you will not need to know any code to customize these skins.

[MeterString]
Meter=STRING
X=0
Y=#Y#
W=150
H=(200-#Y#)
Padding=3,2,3,2
ClipString=1
FontColor=220,220,220
FontEffectColor=0,0,0
SolidColor=0,0,0,1
StringEffect=Shadow
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=#Text#
MouseScrollDownAction=[!SetVariable Y "(Clamp((#Y#-5),-#Offset#,0))"][!UpdateMeter "MeterString"][!Redraw]
MouseScrollUpAction=[!SetVariable Y "(Clamp((#Y#+5),-#Offset#,0))"][!UpdateMeter "MeterString"][!Redraw]
DynamicVariables=1
The Text variable is copied from Rainmeter help. When you scroll, the value of the Y variable is updated by the !SetVariable bangs of the MouseScrollDownAction and MouseScrollUpAction options. The position and height of the string meter are determined based on this value.
A disadvantage of this code, as it is right now is that you have to manually add the Offset variable. Its value depends on the length of the Text variable. I couldn't figure out yet how to automatically determine this value. Maybe I will...
apu889
Posts: 13
Joined: May 1st, 2017, 11:58 am

Re: Virtual Desktops and Scrolling Meters

Post by apu889 »

balala wrote:Even if not the way as Windows handles this, a sort of scroll is possible. The following code does it:

Code: Select all

[Rainmeter]
Update=1000
BackgroundMode=2
SolidColor=80,80,80,160

[Variables]
Y=0
Offset=175
Text=If you only want to download skins from the Internet and use them as-is, then the answer is "none." Rainmeter provides a basic user interface for managing your library of skins, saving and restoring layouts, and changing basic settings such as a skin's location, transparency, and "always on top" behavior. Most Rainmeter features can be reached through the basic Manage window or context menus. Some skin authors create their own controls for users to customize their skins. These controls may be included as a separate utility, or they may be created entirely within Rainmeter as another skin. If this is the case, then you will not need to know any code to customize these skins.

[MeterString]
Meter=STRING
X=0
Y=#Y#
W=150
H=(200-#Y#)
Padding=3,2,3,2
ClipString=1
FontColor=220,220,220
FontEffectColor=0,0,0
SolidColor=0,0,0,1
StringEffect=Shadow
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=#Text#
MouseScrollDownAction=[!SetVariable Y "(Clamp((#Y#-5),-#Offset#,0))"][!UpdateMeter "MeterString"][!Redraw]
MouseScrollUpAction=[!SetVariable Y "(Clamp((#Y#+5),-#Offset#,0))"][!UpdateMeter "MeterString"][!Redraw]
DynamicVariables=1
The Text variable is copied from Rainmeter help. When you scroll, the value of the Y variable is updated by the !SetVariable bangs of the MouseScrollDownAction and MouseScrollUpAction options. The position and height of the string meter are determined based on this value.
A disadvantage of this code, as it is right now is that you have to manually add the Offset variable. Its value depends on the length of the Text variable. I couldn't figure out yet how to automatically determine this value. Maybe I will...
Hey thank you so much for the Clamp things, now i can do scrolling on my skin so well

but the problem is, how can i add a meter right below this meter?
i mean, say i want to add a new meter [NewMeter] using Y=0R just below the [MeterString], but because [MeterString] has an special #Y# formulas, it positioned [NewMeter] behind the [MeterString], not below it.

sorry my bad english, and sorry for bumping this thread too :oops:
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Virtual Desktops and Scrolling Meters

Post by balala »

apu889 wrote:but the problem is, how can i add a meter right below this meter?
i mean, say i want to add a new meter [NewMeter] using Y=0R just below the [MeterString], but because [MeterString] has an special #Y# formulas, it positioned [NewMeter] behind the [MeterString], not below it.
Try this:

Code: Select all

[MeterString2]
Meter=STRING
X=0
Y=([MeterString:Y]+[MeterString:H])
Padding=3,2,3,2
ClipString=1
FontColor=220,220,220
FontEffectColor=0,0,0
SolidColor=0,0,0,1
StringEffect=Shadow
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=Some text
UpdateDivider=-1
DynamicVariables=1
The most important options here are the followings:
  • Y=([MeterString:Y]+[MeterString:H]), which position this second string meter (named in the above code [MeterString2]), immediately below the [MeterString], calculating its vertical position from the vertical position and the height of the first string meter.
  • UpdateDivider=-1, which doesn't let this second string meter to be updated. This way, no matter how are you scrolling the first meter, the second one will keep its position to the initial value.
Is this what you wanted to achieve?
apu889
Posts: 13
Joined: May 1st, 2017, 11:58 am

Re: Virtual Desktops and Scrolling Meters

Post by apu889 »

balala wrote: The most important options here are the followings:
  • Y=([MeterString:Y]+[MeterString:H]), which position this second string meter (named in the above code [MeterString2]), immediately below the [MeterString], calculating its vertical position from the vertical position and the height of the first string meter.
  • UpdateDivider=-1, which doesn't let this second string meter to be updated. This way, no matter how are you scrolling the first meter, the second one will keep its position to the initial value.
Is this what you wanted to achieve?
Yeah, that's exatcly what i wanted. thanks a bunch :D

now how to place [MeterString2] above [MeterString] , or vice versa - [MeterString] below [MeterString2]

Also using this method, why the StringAlign=center just shows the text in a half and StringAlign=right makes it gone?

sorry if i ask a lot silly question, i'm newbie at skinning rainmeter, and kinda confusing with this math-thingy :oops:
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Virtual Desktops and Scrolling Meters

Post by balala »

apu889 wrote:now how to place [MeterString2] above [MeterString] , or vice versa - [MeterString] below [MeterString2]
This is a bit harder, because in first case (when the second string was placed below the first one), the lower limit of the first string was set with the H option. But if you place those meters inversely, there is no way to set the above limit of the "scollable" string. It simply will be visible up to the upper edge of the skin.
One solution would be to create an opaque background for the fixed meter:

Code: Select all

[Rainmeter]
Update=1000
BackgroundMode=2
SolidColor=80,80,80

[Variables]
Y=20
Offset=175
Text=If you only want to download skins from the Internet and use them as-is, then the answer is "none." Rainmeter provides a basic user interface for managing your library of skins, saving and restoring layouts, and changing basic settings such as a skin's location, transparency, and "always on top" behavior. Most Rainmeter features can be reached through the basic Manage window or context menus. Some skin authors create their own controls for users to customize their skins. These controls may be included as a separate utility, or they may be created entirely within Rainmeter as another skin. If this is the case, then you will not need to know any code to customize these skins.

[MeterString]
Meter=STRING
X=0
Y=#Y#
W=150
H=(200-#Y#)
Padding=3,2,3,2
ClipString=1
FontColor=220,220,220
FontEffectColor=0,0,0
SolidColor=0,0,0,1
StringEffect=Shadow
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=#Text#
MouseScrollDownAction=[!SetVariable Y "(Clamp((#Y#-5),(20-#Offset#),20))"][!UpdateMeter "MeterString"][!Redraw]
MouseScrollUpAction=[!SetVariable Y "(Clamp((#Y#+5),(20-#Offset#),20))"][!UpdateMeter "MeterString"][!Redraw]
DynamicVariables=1

[MeterString2]
Meter=STRING
X=0
Y=0
W=150
H=16
Padding=3,2,3,2
ClipString=1
FontColor=220,220,220
FontEffectColor=0,0,0
SolidColor=80,80,80
StringEffect=Shadow
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=Some text
UpdateDivider=-1
DynamicVariables=1
Note the W, H and SolidColor options of the [MeterString2] meter. The first two options are needed to set the surface of the meter, while the SolidColor option will set an opaque background for it. I used the same color as is set for the background of the whole skin (in the [Rainmeter] section).
This definitely is not the most elegant solution, because if instead of the solid color, you would want to use an image as background of the skin, you'd have some problems, but at least in some cases this could help.
apu889 wrote:Also using this method, why the StringAlign=center just shows the text in a half and StringAlign=right makes it gone?
Because the alignment is related to the point set by the X and Y coordinates. Eg:

Code: Select all

X=0
Y=0
StringAlign=Right
means that the beginning of the string is placed to the point with the X=0 and Y=0 coordinates. But related to this pont, the string is aligned to right, which means that the mentioned point is the upper right corner of the string. This way, the string goes outside of the skin, to left. No skin can show the meters which go outside the skin, to left, or up. That's how we hidden the string which went up, when you scrolled it.
Or if you align the string to Center, the left side of it goes outside the skin and became invisible, while the right side (behind the Y=0 point) is still visible.
apu889
Posts: 13
Joined: May 1st, 2017, 11:58 am

Re: Virtual Desktops and Scrolling Meters

Post by apu889 »

hey, thanks a lot for your guide. really :D. i was able to made my very first Rainmeter Skin. It pretty basic so, nothing superior but very useful (atleast for myself, hehe). i'm planned to do further improvements on it, like AutoScroll text.

i thought the AutoScroll logic was calculate something like

Code: Select all

lengthSongSeconds / numberofLine
and then using song progress to track the scroll position.

am i right? or maybe you had another advice to achieve that?
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Virtual Desktops and Scrolling Meters

Post by balala »

apu889 wrote:i thought the AutoScroll logic was calculate something like

Code: Select all

lengthSongSeconds / numberofLine
and then using song progress to track the scroll position.

am i right? or maybe you had another advice to achieve that?
I'm not entirely sure, because although I checked the skin, I didn't analyze it deeply, but I don't think this, in this form, will properly work, because dividing the progress (or the length of the song), expressed into seconds (lengthSongSeconds) with the number of lines into the returned string (which I suppose would be give by the numberofLine), won't give any useful information. Instead, dividing the progress with the length (but both MUST be converted into seconds, instead of the "normal" string format of them) will give the progress as percentage and this would be much useful, in my opinion.
Long story short, if you figured out how to do the thing you want to, please post the code (or the skin) to can check it.
Anyway, congratulations for your first skin, especially the scrolling feature, which work well.
apu889
Posts: 13
Joined: May 1st, 2017, 11:58 am

Re: Virtual Desktops and Scrolling Meters

Post by apu889 »

balala wrote:I'm not entirely sure, because although I checked the skin, I didn't analyze it deeply, but I don't think this, in this form, will properly work, because dividing the progress (or the length of the song), expressed into seconds (lengthSongSeconds) with the number of lines into the returned string (which I suppose would be give by the numberofLine), won't give any useful information. Instead, dividing the progress with the length (but both MUST be converted into seconds, instead of the "normal" string format of them) will give the progress as percentage and this would be much useful, in my opinion.
Long story short, if you figured out how to do the thing you want to, please post the code (or the skin) to can check it.
Well, i seek out SCALPi skin which also has AutoScrolling feature. Yeah its achieved by dividing Height of total-lines-of-the text with progress percentage to adjust scroll position. He was using .lua script to measure the total lines height and multplying it with FontSize to adapting the result with different font size.

But since i want my skin to be "dynamic" (user allows to set the height & width) and also using ClipString=2, which it will change the proper height of the skin, i try to get the actual height of the obtained lyrics.

This is my code, i know this is bad approach but it works atleast :D

Code: Select all

[cCounter]
Measure=Calc
Formula=(#Offset#)/100*[mProgress]
DynamicVariables=1

[TemplateMeter]
W=#SkinWidth#
ClipString=2
AntiAlias=1
FontFace=#Font#
FontSize=#FontSize#
FontColor=#TextColor#,#TextColorA#
StringStyle=#TextStyle#
StringEffect=#TextEffect#
SolidColor=#Background#,#BackgroundA#
Padding=#SkinPadding#,#SkinPadding#,#SkinPadding#,#SkinPadding#
AntiAlias=1

[MeterM]
Meter=String
MeterStyle=TemplateMeter
DynamicVariables=1
SolidColor=0,0,0,0
FontColor=0,0,0,0
Y=0
X=0

[MeterLyric]
Meter=STRING
MeterStyle=TemplateMeter
X=0
Y=(#Y#-[cCounter])
H=(#SkinHeight#+[cCounter])
Padding=#SkinPadding#,#SkinPadding#,#SkinPadding#,0
Text=Searching...
OnUpdateAction=[!WriteKeyValue "Variables" "Offset" ([MeterM:H]) "#@#Variables.inc"]
ToolTipText=Click to open Settings#CRLF#Use mousewheel to scroll the lyric
ToolTipHidden=#DisableTooltip#
DynamicVariables=1
MouseActionCursor=0
LeftMouseUpAction=[!ActivateConfig "#ROOTCONFIG#\SettingsWindow"]
[MeterM] is actual lyrics text, with actual height and only used to set the Offset var, not to show lyrics on the skin. So i try to hide it with 0 Alpha (SolidColor=0,0,0,0). and then [MeterLyric] is where the lyrics are displayed on the skin, with custom height.

And here comes the problem, since [MeterM] present, if the lyrics are too long, i'm unable to move the skin because height of the [MeterM] fill out my screen, invisible-ity. Can you suggest another neat method? forget about manual scrolling, i just want to figuring out this autoscroll thing.

i hope you understand, bcz i'm not so good in english right now :oops:
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Virtual Desktops and Scrolling Meters

Post by balala »

apu889 wrote:[MeterM] is actual lyrics text, with actual height and only used to set the Offset var, not to show lyrics on the skin. So i try to hide it with 0 Alpha (SolidColor=0,0,0,0). and then [MeterLyric] is where the lyrics are displayed on the skin, with custom height.
I'm not entirely sure I understood the problem: if you want to hide the lyrics, what should be auto scrolled?
Also, don't forget that setting an invisible color for a string meter, doesn't completely hide the meter. You also should set an invisible color to the fonts, to their effect, if any is set and so on. And even if everything is set to invisible through the colors, if you don't uncheck the "Keep on screen" setting which I talked about above, you still can't drag the skin anywhere, the same limitation applies.
In my opinion, a much simpler method would be to add a Hidden=1 option to the appropriate meter. In this case you don't have to uncheck the "Keep on screen" settings, because the meter being hidden, it doesn't need space. If you add the mentioned option, both the width and the height of the meter is set to zero.
apu889 wrote:And here comes the problem, since [MeterM] present, if the lyrics are too long, i'm unable to move the skin because height of the [MeterM] fill out my screen, invisible-ity. Can you suggest another neat method? forget about manual scrolling, i just want to figuring out this autoscroll thing.
As far as I understood, quickly two methods come to my mind:
  • Right click the skin, go to Settings and uncheck the "Keep on screen" option. This way you'll be able to move the skin anywhere, even if it partially or totally goes outside of the screen.
  • Set a proper width and height for the skin, using the SkinWidth and SkinHeight options, within the [Rainmeter] section.
Does any of these methods help?
apu889 wrote:i hope you understand, bcz i'm not so good in english right now :oops:
Don't worry, me neither.