我刚刚为autohotkey编写了一个脚本,该脚本可在Windows 10中最多10个台式机上完成。
如何运作:
下载并安装autohotkey。将下面的代码复制并粘贴到记事本中,并以文件扩展名.ahk保存
我建议在启动文件夹中为此文件创建一个快捷方式,以便在Windows启动时运行。
默认热键:
切换桌面:WIN + DESKTOP NUMBER(0 =桌面编号10)
新桌面:CTRL + WIN + D
关闭桌面:CTRL + WIN + F4
显示桌面状态:WIN +'
重要:
为了使其正常工作,您必须仅使用热键来打开,关闭和更改桌面,因为脚本会侦听这些热键以了解当前和桌面总数。
如果确实使用鼠标通过WIN + TAB菜单创建,关闭或更改了桌面,则脚本将停止工作。为了使它再次运行,您需要编辑前两行以反映桌面的当前状态。(桌面数/当前桌面数)
这并不意味着您不能将WIN + TAB屏幕用作当前桌面的概述。实际上,您可以结合使用热键来组织桌面。是的,当Windows任务查看器打开时,热键仍然有效!(WIN + TAB)请勿使用鼠标!!!
另外,在Windows启动后等待脚本加载,然后再创建新的桌面,否则它将不起作用。这可能需要一点时间,具体取决于您有多少个启动程序。
好的,我添加了另一件事,以使其更轻松地将脚本与桌面状态重新同步。现在有一个热键,它将显示脚本认为桌面所在的状态,因此您所要做的就是用鼠标调整桌面以适应脚本,然后所有这些都将再次同步!对于使用瑞士键盘的人来说,使用'?0旁边的键,并带有?才有意义 在它上面,但是在其他键盘上,您可能希望更改此操作,只需将0/10(以#'开头)的热键后的行更改为所需的值即可轻松完成。
实际上,我只是意识到...。只要“桌面计数”正确,比创建新桌面会自动重新同步“当前桌面”值。
(以;开头的行是注释,不影响脚本)
码:
#NoTrayIcon
;If the script stops working:
;Change the following values to reflect your current desktop state and reload the script.
;Remember to change them back to 1 after reloading the script if you have it set to start with Windows
desktopcount := 1
currentdesktop := 1
;You can change the hotkeys for creating, closing, and switching desktops bellow.
;The current hotkeys are CTRL+WIN+D for new desktop, CTRL+WIN+F4 to close desktop
;and WIN+NUMBER for switching desktops.
;For example, to change the hotkey for new desktop replace ^#D bellow with the desired hotkey.
;Refer to the autohotkey documentation for a full list of symbols refering to modifier keys,
;as you can see ^ is CTRL and # is WIN key.
;If you wanted to change the switch desktop from WIN key to CTRL for example you would have
;to replace the # before each number to a ^
^#D::NewDesktop()
^#F4::CloseDesktop()
#1::SwitchDesktop(1)
#2::SwitchDesktop(2)
#3::SwitchDesktop(3)
#4::SwitchDesktop(4)
#5::SwitchDesktop(5)
#6::SwitchDesktop(6)
#7::SwitchDesktop(7)
#8::SwitchDesktop(8)
#9::SwitchDesktop(9)
#0::SwitchDesktop(10)
#'::MsgBox Desktop Count = %desktopcount%`nCurrent Desktop = %currentdesktop%
;Do not change anything after this line, unless you know what you are doing ;)
;-----------------------------------------------------------------------------------------------
SwitchDesktop(desktop)
{
global desktopcount
global currentdesktop
desktopdiff := desktop - currentdesktop
if (desktop > desktopcount)
{
return
}
if (desktopdiff < 0)
{
desktopdiff *= -1
Loop %desktopdiff%
{
Send ^#{Left}
}
}
else if (desktopdiff > 0)
{
Loop %desktopdiff%
{
Send ^#{Right}
}
}
currentdesktop := desktop
}
NewDesktop()
{
global desktopcount
global currentdesktop
if (desktopcount > 9)
{
return
}
desktopcount ++
currentdesktop := desktopcount
Send ^#d
}
CloseDesktop()
{
global desktopcount
global currentdesktop
desktopcount --
if (currentdesktop != 1)
{
currentdesktop --
}
Send ^#{f4}
}