Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Rainmeter Side of handling
- [MeasureAhkWindowMessaging]
- Measure=Plugin
- Plugin=WindowMessagePlugin
- WindowClass=AutoHotkey
- [BG]
- Meter=Image
- x=0
- y=0
- w=#SCREENAREAWIDTH#
- h=#SCREENAREAHEIGHT#
- SolidColor=0,0,0,0
- [LeftSide]
- Meter=Image
- x=0
- y=(0.2*#SCREENAREAHEIGHT#)
- w=2
- h=(0.6*#SCREENAREAHEIGHT#)
- SolidColor=0,0,0,1
- ;Sends a message to AHK with 'id' "10001" and 'content' "1"
- ;'id' and 'content' are arbitrary
- MouseOverAction=[!CommandMeasure MeasureAhkWindowMessaging "SendMessage 10001 1 0"]
- [RightSide]
- Meter=Image
- x=(#SCREENAREAWIDTH#-2)
- y=(0.2*#SCREENAREAHEIGHT#)
- w=2
- h=(0.6*#SCREENAREAHEIGHT#)
- SolidColor=0,0,0,1
- ;Sends a message to AHK with 'id' "10001" and 'content' "2"
- ;'id' and 'content' are arbitrary
- MouseOverAction=[!CommandMeasure MeasureAhkWindowMessaging "SendMessage 10001 2 0"]
- ;==============================================================================================
- ;AutoHotkey side of Handling
- #SingleInstance Force
- #noEnv
- #UseHook
- SendMode Input
- /*
- Works in conjunction with Rainmeter, VirtualDesktopSwitcher.ini
- Receives a message with 'id' "10001" and 'content' "1" or "2"
- Switches to left or right depending on the 'content'
- In this case, when rainmeter sends "1", it switches to the left plane,
- and when rainmeter sends "2", it switches to the right plane.
- */
- OnMessage(10001, "RainmeterWindowMessage")
- RainmeterWindowMessage(wParam, lParam) {
- If (wParam = 1) {
- Send #^{Left}
- }
- If (wParam = 2) {
- Send #^{Right}
- }
- Sleep 300
- }
- /*
- Binds "windows+w" to close the current virtual desktop,
- and binds "windows+n" to open a new virtual desktop.
- */
- #w::send, #^{F4}
- #n::send, #^d
- ;==============================================================================================
- ;Copy the rainmeter section of code and save as .ini
- ;Copy the AutoHotkey section of code and save as .ahk
- ;Load the .ini file and run the .ahk file
- ;Reference: https://autohotkey.com/boards/viewtopic.php?t=12476
- ;Edited Autohotkey's section for optimisation, replaced chunky code with one liner that works better.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement