Last active
March 10, 2023 19:24
-
-
Save ncronquist/8de841dbefa9f21e1a50854d2f48d1c9 to your computer and use it in GitHub Desktop.
AutoHotKey Script to Support Em Dash and Moving Windows Across Virtual Desktops
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;#SETUP START | |
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
#SingleInstance force | |
ListLines Off | |
SetBatchLines -1 | |
SendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. | |
#KeyHistory 0 | |
#WinActivateForce | |
Process, Priority,, H | |
SetWinDelay -1 | |
SetControlDelay -1 | |
;include the library | |
#Include VD.ahk | |
; VD.init() ;COMMENT OUT `static dummyStatic1 := VD.init()` if you don't want to init at start of script | |
;you should WinHide invisible programs that have a window. | |
WinHide, % "Malwarebytes Tray Application" | |
;#SETUP END | |
!-:: | |
Send, — | |
return | |
VD.createUntil(3) ;create until we have at least 3 VD | |
return | |
^#+Left:: | |
n := VD.getCurrentDesktopNum() | |
if n = 1 | |
{ | |
Return | |
} | |
n -= 1 | |
VD.MoveWindowToDesktopNum("A",n), VD.goToDesktopNum(n) | |
Return | |
^#+Right:: | |
n := VD.getCurrentDesktopNum() | |
if n = % VD.getCount() | |
{ | |
Return | |
} | |
n += 1 | |
VD.MoveWindowToDesktopNum("A",n), VD.goToDesktopNum(n) | |
Return |
Shortcuts from this Script
- Em Dash -
alt
+-
Win
+Ctrl
+Shift
+→
: Move current window to the next desktopWin
+Ctrl
+Shift
+←
: Move current window to the previous desktop
Setup
Instructions pulled from https://superuser.com/a/1728476/706553
- Download and install AutoHotKey
- When installing AutoHotKey, you will get the option to select ANSI or Unicode — make sure to select Unicode.
- Clone the VD.ahk repository (it is an AutoHotkey library adding several script functions for managing virtual desktops)
- Inside the cloned directory, create a new file (arbitrary name, ending with .ahk) and paste the content from this gist into it.
- Double-click the script to run it. The shortcuts noted above should now work.
- To make sure the script runs on every Windows startup, create a shortcut to it and put it into the folder for your Startup programs. Open that folder by typing shell:startup in the window that pops up after you hit Win + R.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When installing AutoHotKey, you will get the option to select ANSI or Unicode — make sure to select Unicode.