Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switchDesktopToLastOpened() doesn't always work correctly #70

Open
EdwinVanRooij opened this issue Mar 12, 2021 · 3 comments
Open

switchDesktopToLastOpened() doesn't always work correctly #70

EdwinVanRooij opened this issue Mar 12, 2021 · 3 comments
Labels

Comments

@EdwinVanRooij
Copy link

EdwinVanRooij commented Mar 12, 2021

I'm using the default key binding: CapsLock & tab::switchDesktopToLastOpened().

Steps to reproduce:

  • Start the script
  • Go to desktop 2 through CapsLock & 2::switchDesktopByNumber(2)
  • Go to desktop 1 through CapsLock & 1::switchDesktopByNumber(1)
  • <I receive a message from a colleague, clicking it automatically switches me to that desktop which is at desktop 2>
  • Execute switchDesktopToLastOpened()
  • Result: nothing happens.

Now it's not hard to see what's happening here, the variable LastOpenedDesktop is only set in _switchDesktopToTarget (LastOpenedDesktop := CurrentDesktop). Because of this, any other way of moving to another desktop will not register into the variable LastOpenedDesktop, thus leaving value 2 in LastOpenedDesktop, even though I'm currently at desktop 2 and 1 was my previous desktop.

tl;dr: this program assumes it is in complete control over switching desktops, leading to broken functionality

I've thought about this for a while, but I haven't been able to come up with a clean solution.

@Elijas Elijas added the bug label Mar 12, 2021
@EdwinVanRooij
Copy link
Author

EdwinVanRooij commented Mar 17, 2021

Update:
For anyone else experiencing this bug, I have found a way to "deal" with it.
It's not a solution, but rather something to deal with it in most cases.
I added a check to the script, it checks whether I'm currently on the LastOpenedDesktop. If I am, but I pressed the shortcut to switchDesktopToLastOpened(), it will always move me to desktop number 1 (hard coded).

99% of the times I'm experiencing this bug, I want to go from some desktop where I got through messaging (which is usually at desktop 2), back to my working desktop (which is desktop 1).

@itfootman
Copy link

I am experiencing this bug, any solution ?

@itfootman
Copy link

I think switching desktop by clicking the notify icon of status bar is not recorded by switchDesktopByNumber, so it can not restore to last opened desktop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants