Skip to content
This repository has been archived by the owner on Dec 23, 2018. It is now read-only.

Design error in shortcuts and handler #105

Open
buzzer8 opened this issue Apr 6, 2018 · 1 comment
Open

Design error in shortcuts and handler #105

buzzer8 opened this issue Apr 6, 2018 · 1 comment
Labels

Comments

@buzzer8
Copy link

buzzer8 commented Apr 6, 2018

First of all, i'm very new to autohotkey code, its my first time to look at this kinda code. Thank you for that nice script, Its exact what i'm looking for. But you have a design error at hotkey and hotkeyhandlingi think. I'm not able to have a hotkey like Home or PgDn for switching directly to the desired screen. This is, i think so after looking to your code, because you get the number of the screen to switch to by looking at the hotkey name, for example 3 or Numpad3, so 3 is the screen to switch to. PgDn doesn't have a number attached with the desired screen, so i failed switching the screen by this or simular hotkeys.

BUT i managed to changed your code to work with hotkeys with no screen number attached in a very simple way. As i said, this is my first look at autohotkey code. So don't blame me for the way i did it. Maybe you find a better way or cleaner.

Cut of the settings file:

Desktop1=Home
Desktop2=End
Desktop3=PgUp
Desktop4=PgDn

In the file virtual-desktop-enhancer.ahk i changed the lines (166 & 167)

setUpHotkeyWithOneSetOfModifiersAndIdentifier(hkModifiersSwitch, hkDesktopI, "OnShiftNumberedPress", "[KeyboardShortcutsModifiers] SwitchDesktop")
setUpHotkeyWithOneSetOfModifiersAndIdentifier(hkModifiersMove, hkDesktopI, "OnMoveNumberedPress", "[KeyboardShortcutsModifiers] MoveWindowToDesktop")

to

setUpHotkeyWithOneSetOfModifiersAndIdentifier(hkModifiersSwitch, hkDesktopI, "OnShiftNumberedPress"i, "[KeyboardShortcutsModifiers] SwitchDesktop")
setUpHotkeyWithOneSetOfModifiersAndIdentifier(hkModifiersMove, hkDesktopI, "OnMoveNumberedPress"i, "[KeyboardShortcutsModifiers] MoveWindowToDesktop")

and i added this (has to be extended to work with more than 4 screens) above line 211

OnShiftNumberedPress1() {
SwitchToDesktop(1)
}
OnShiftNumberedPress2() {
SwitchToDesktop(2)
}
OnShiftNumberedPress3() {
SwitchToDesktop(3)
}
OnShiftNumberedPress4() {
SwitchToDesktop(4)
}

And it worked. Maybe you recode it to a maybe better cleaner way and add it to the code.

Cheers

@sdias
Copy link
Owner

sdias commented Jul 23, 2018

Hi. You're absolutely right, it makes no sense as it is... Your suggestion should work fine, yes, but I would like the solution to be a bit more generic. I'll mark it as a bug so it can be picked up later. Thanks.

@sdias sdias added the bug label Jul 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants