This repository has been archived by the owner on Dec 23, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 271
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First ideas about toggling between last desktops.
This is a rapid jot down of the first ideas about enabling a hotkey to toggle between the current desktop and the last one. I am not really shure this is the most elegant way to do this, still, it seems to work ;)
- Loading branch information
Giorgio Bonvicini
authored and
Giorgio Bonvicini
committed
May 16, 2017
1 parent
6ee9b98
commit 39cbb15
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
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
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
39cbb15
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sdias Trying to implement what was asked in #40 I came up with this.
I tried to implement it so that if a user skips rapidly (waiting less than 1 sec on each desktop) from desktop 1 to 5 (for example) he then can use the hotkey
Switch/MoveWindowTo/MoveWindowToAndSwitch + C
to jump between desktop 1 and 5.Do you think this is a good way to implement it? To be honest it looks a little bit clumsy to me...
39cbb15
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@GioBonvi I like the 1 second thing, but not in all cases, since it would mean you couldn't quickly go back and forth.
In terms of the implementation, I think there are better, more centralized ways of achieving it. I'll have a try at this next weekend.
Thanks for your work though.
39cbb15
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if I understand correctly what you mean, but if you press Win + Ctrl + C rapidly multiple times it does indeed rapidly switch back and forth between two desktops,
The 1 second dealy is only used to skip "transitional" desktops and just consider the starting dekstop and the one the users lands on.
39cbb15
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@GioBonvi Oh sorry, nevermind my comment then. I need to have a closer look at the code. Sorry if my last comment was dismissive, your code looks great, it just seems there's a fair bit of duplication that could be avoided.
39cbb15
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No offense at all! I am the first to recognize that it is far from optimal ;)
It really needs to be analyzed and refactored: I just replicated 1:1 all the calls to NextDesktop and changed them to LastDesktop.
39cbb15
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sdias
I had completely forgot about this and @temporaer brought it back to my attention.
As far as I can tell this works as intended, but it should be tested on more systems: I had some trouble implementing the hooks for the hotkeys and ended up copying from the NextDesktop calls, so you should probably double check this and optimize were needed as you are more familiar with the structure of the code.
This is how I implemented it: everytime the user switches to a new dekstop the time (millisecnods after program startup) is saved into a variable: when the next switch happens the time is checked again. If more than one second has passed since the last switch the current desktop is considered "the last active desktop" and is saved in a variable.
The user can jump back to the last active desktop with a hotkey.
This is better illustrated by an example: