Skip to content

Instantly share code, notes, and snippets.

@Geobert
Last active March 5, 2024 15:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Geobert/0ba4fe8d75c4fc668b027e44ee21e10a to your computer and use it in GitHub Desktop.
Save Geobert/0ba4fe8d75c4fc668b027e44ee21e10a to your computer and use it in GitHub Desktop.
#singleinstance
; Move the taskbar to left screen, right side.
; Can’t use it because for some reason, when interacting with the taskbar with the mouse, it goes back to main screen
MoveTaskbar()
{
If MonitorGetCount() > 1
{
WinExist("ahk_class Shell_TrayWnd")
SendMessage(0x0231)
WinMove -54, 0, 54, 1080
SendMessage(0x0232)
}
}
; Move the taskbar using mouse, and resize it a bit
MoveTaskbar2()
{
If MonitorGetCount() > 1
{
CoordMode "Mouse", "Screen"
WinExist("ahk_class Shell_TrayWnd")
WinGetPos &X, &Y
MouseClickDrag "Left", X + 20, 1100, -54, 600
MouseClickDrag "Left", -54, 600, -58, 600
}
}
MoveTaskbarCb(wParam, lParam, msg, hwnd)
{
If MonitorGetCount() > 1
{
Sleep 2000
MoveTaskbar2()
}
}
OnMessage 0x007E, MoveTaskbarCb
Persistent
@Geobert
Copy link
Author

Geobert commented Mar 5, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment