pmb6tz / windows-desktop-switcher

An AutoHotKey script for Windows that lets a user change virtual desktops by pressing CapsLock + <num>.
MIT License
1.21k stars 229 forks source link

How to disable auto-cycles #66

Closed exsabuta closed 3 years ago

exsabuta commented 3 years ago

Hi. Tell me please, how i can disable auto-cycles from the first to the last desktop?

Elijas commented 3 years ago

Hi! Thanks for asking.

Two lines are responsible for that. Switching desktop to right: https://github.com/pmb6tz/windows-desktop-switcher/blob/755abfc8258f496714aaabce75c56a60ee75c850/desktop_switcher.ahk#L154 Switching desktop to left: https://github.com/pmb6tz/windows-desktop-switcher/blob/755abfc8258f496714aaabce75c56a60ee75c850/desktop_switcher.ahk#L161

Change them to these, respectively:

_switchDesktopToTarget(CurrentDesktop == DesktopCount ? CurrentDesktop : CurrentDesktop + 1)
_switchDesktopToTarget(CurrentDesktop == 1 ? CurrentDesktop : CurrentDesktop - 1)

Then reload (shutdown and start again) the script again for the changes to be applied.

Please let us know if it works for you!

exsabuta commented 3 years ago

It works! Thanks!