It is currently April 25th, 2024, 1:44 pm

Workspace Switcher V2 Help

Get help with creating, editing & fixing problems with skins
User avatar
BlueJive
Posts: 27
Joined: February 25th, 2021, 6:45 am

Workspace Switcher V2 Help

Post by BlueJive »

So, I've finished my code. Hooray! Now I'm adding some tweaks and polish. One of these things that I want to code is something a friend coded up for Unix (which I use as well). And I think I've made a dent in starting. Here's what I hope the result will be:

Image

This is a workspace switcher. And the pacman corresponds to the open workspace. And all the rest are ghosts. (In the video dots are used for empty workspaces, but I feel that'll be going too far.). What I'm trying to go for is either a skin that allows keyboard input to switch between the workspaces as above. Or a skin that modifies itself for the pacman to be on the current open workspace, and for me to just use normal keyboard shortcuts to get there. Whichever is easier. (However, preferably the second one.)

I tried to code the first concept, but it didn't go well. And I was wondering if someone could help me tweak my code to work, or help me do the second concept. See below for a video of what happened.

Image

Obviously, this is not the way that I would like it. I would like to switch by keyboard input (or second concept) and have the pacman replace the ghost rather than going on top of it. See below for my code (code has been updates since video, minor differences may occur).

Code: Select all

[Rainmeter]
Update=-1

[style]
ImageName=#@#Icons\ghost.png
H=11
MouseOverAction=[!SetOptionGroup Icons ImageName "#@#Icons\ghost.png"][!SetOption #CURRENTSECTION# ImageName "#@#Icons\pacman.png"][!Update][!Redraw]

[ghost1]
Meter=Image
MeterStyle=style
X=20
LeftMouseUpAction=["#@#nircmd\nircmd.exe" SendKeyPress lwin+ctrl+left]["#@#nircmd\nircmd.exe" SendKeyPress lwin+ctrl+left][!Update][!Redraw]

[ghost2]
Meter=Image
MeterStyle=style
X=40
LeftMouseUpAction=[!CommandMeasure switcher "Run"][!Update][!Redraw]

[ghost3]
Meter=Image
MeterStyle=style
X=60
LeftMouseUpAction=["#@#nircmd\nircmd.exe" SendKeyPress lwin+ctrl+right]["#@#nircmd\nircmd.exe" SendKeyPress lwin+ctrl+right][!Update][!Redraw]

[pacman]
Meter=Image
MeterStyle=style
ImageName=#@#Icons\pacman.png
(Thanks to Rainmeter on Discord for helping a bit)

Thanks all! And can I just take this oppurtunity to say that this is a great community. Always so helpful, and everything so well explained. (Oh and sorry for posting so much, I hope it's okay, don't want to spam.)

:welcome:


Rainmeter 4.4.0.3433 beta (64-bit)
Language: English (1033)
Build time: 2021-02-11 20:36:28
Windows 10 Home 2009 64-bit (build 19042) - English (2057)
Path: C:\Program Files\Rainmeter\
SkinPath: C:\Users\User\OneDrive\Documents\Rainmeter\Skins\
SettingsPath: C:\Users\User\AppData\Roaming\Rainmeter\
IniFile: C:\Users\User\AppData\Roaming\Rainmeter\Rainmeter.ini
Issue tags: "Workspace switcher"
Last edited by BlueJive on February 28th, 2021, 5:25 pm, edited 1 time in total.
User avatar
ikarus1969
Posts: 571
Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria

Re: Workspace Switcher V2 Help

Post by ikarus1969 »

Just do:
  • delete the meter [pacman]. It is not needed
  • add a Group=Icons to [style] so that the MouseOverAction has something to act on
  • if you want to start with the first ghost as the pacman (the active one), add a ImageName=#@#Icons\pacman.png to [ghost1] (for starting with one of the other ghosts as the active one add the ImageName=#@#Icons\pacman.png to that ghost)
Last edited by ikarus1969 on February 26th, 2021, 4:50 pm, edited 2 times in total.
User avatar
balala
Rainmeter Sage
Posts: 16169
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Workspace Switcher V2 Help

Post by balala »

BlueJive wrote: February 26th, 2021, 3:25 pm What I'm trying to go for is either a skin that allows keyboard input to switch between the workspaces as above.
I'm not sure at all how would you like to switch (what have you to do to switch), but to can use the keyboard to do anything in Rainmeter, you have to install the HotKey plugin. You can find it here. Download the HotKey_1.0.0.12.rmskin package and install it. You'll get installed a skin and the appropriate version of the plugin. The skin itself is not too important, recommend to study it a little bit. But having the plugin installed, you can use it and can associate certain key combination to do something.
For instance add the following measure to your code:

Code: Select all

[MeasureSwitch]
Measure=Plugin
Plugin=HotKey
HotKey=Ctrl Left
KeyDownAction=[...]
DynamicVariables=1
With the above measure you'll get executed the bangs added to the KeyDownAction option everytime you hit the Ctrl and the Left keys. Obviously you can change the key combination.
User avatar
ikarus1969
Posts: 571
Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria

Re: Workspace Switcher V2 Help

Post by ikarus1969 »

balala wrote: February 26th, 2021, 4:35 pm I'm not sure at all how would you like to switch (what have you to do to switch)...
The op want's to switch between the workspaces which are integrated in windows itself. He does that by sending key-commands for "Windows-Key"-"CTRL"-"RIGHT-Cursor" and "Windows-Key"-"CTRL"-"LEFT-Cursor" by using the nirsoft utility
User avatar
ikarus1969
Posts: 571
Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria

Re: Workspace Switcher V2 Help

Post by ikarus1969 »

I used the code below, It's the code from the op modified like i posted above (and using 2 pngs i have in my resource-folder (Icon_Waage.png and Icon_Weather.png)

Code: Select all

[Rainmeter]
Update=-1

[style]
ImageName=#@#Icons\Icon_Waage.png
H=48
PreserveAspectRatio=1
MouseOverAction=[!SetOptionGroup Icons ImageName "#@#Icons\Icon_Waage.png"][!SetOption #CURRENTSECTION# ImageName "#@#Icons\Icon_Weather.png"][!Update][!Redraw]
Group=Icons

[ghost1]
Meter=Image
MeterStyle=style
X=0
LeftMouseUpAction=["#@#nircmd\nircmd.exe" SendKeyPress lwin+ctrl+left]["#@#nircmd\nircmd.exe" SendKeyPress lwin+ctrl+left][!Update][!Redraw]

[ghost2]
Meter=Image
MeterStyle=style
X=20R
LeftMouseUpAction=[!CommandMeasure switcher "Run"][!Update][!Redraw]

[ghost3]
Meter=Image
MeterStyle=style
X=20R
LeftMouseUpAction=["#@#nircmd\nircmd.exe" SendKeyPress lwin+ctrl+right]["#@#nircmd\nircmd.exe" SendKeyPress lwin+ctrl+right][!Update][!Redraw]
User avatar
balala
Rainmeter Sage
Posts: 16169
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Workspace Switcher V2 Help

Post by balala »

ikarus1969 wrote: February 26th, 2021, 4:39 pm The op want's to switch between the workspaces which are integrated in windows itself. He does that by sending key-commands for "Windows-Key"-"CTRL"-"RIGHT-Cursor" and "Windows-Key"-"CTRL"-"LEFT-Cursor" by using the nirsoft utility
Alright. It seems I misunderstood him. Sorry...
User avatar
ikarus1969
Posts: 571
Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria

Re: Workspace Switcher V2 Help

Post by ikarus1969 »

The result of my modified code:
GIF 26.02.2021 17-45-15.gif
You do not have the required permissions to view the files attached to this post.
User avatar
BlueJive
Posts: 27
Joined: February 25th, 2021, 6:45 am

Re: Workspace Switcher V2 Help

Post by BlueJive »

That's brilliant! Thanks all. As a follow up, would it be possile to instead to the second option? Have the pacman icon switch to the active virtual desktop when switched? No keybaord input, or fancy things. Just an information skin that updates based on the active desktop situation. Thanks
User avatar
ikarus1969
Posts: 571
Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria

Re: Workspace Switcher V2 Help

Post by ikarus1969 »

I don't know how to detect which virtual desktop i am on. Maybe there is some registry key which can be read by rainmeter but i don't know (yet).
Maybe you can search/ask on the forum for this?
User avatar
BlueJive
Posts: 27
Joined: February 25th, 2021, 6:45 am

Re: Workspace Switcher V2 Help

Post by BlueJive »

ikarus1969 wrote: February 27th, 2021, 6:50 am I don't know how to detect which virtual desktop i am on. Maybe there is some registry key which can be read by rainmeter but i don't know (yet).
Maybe you can search/ask on the forum for this?
A seperate thread? Okay