ejbills / DockDoor

Window peeking for macOS
MIT License
295 stars 8 forks source link

Ability to change ctrl+tab to another key combination #11

Open moonlinx opened 1 week ago

moonlinx commented 1 week ago

As the title says, I am use to using command + tab to look at previews as I use alt+tab. This feature would be cool

ejbills commented 1 week ago

Apologies for the confusion with me calling it "alt-tab functionality" but it actually being invoked with CTRL-tab. That is definitely confusing.

Customization of the invocation button is planned, stay tuned!!

alessandro-newzoo commented 1 week ago

I second this request, most apps use CTRL+TAB to navigate tabs within the app itself (like Arc) and DockDoor is taking that over, so I'm forced to quit the app at the moment. Amazing work though, keep it up! :)

hasansultan92 commented 1 week ago

Hey, so Im thinking of taking on this issue along with #22. Can we discuss how to solve this? I was thinking along the lines of having a separate tab/view in the settings section of the application and there the user can choose if they want to add their own custom combination of keys or if we can disable the current MacOS CMD+TAB combination in favor of DockDoor and allow it to be on or off as per #22

ejbills commented 1 week ago

Hey, so Im thinking of taking on this issue along with #22. Can we discuss how to solve this? I was thinking along the lines of having a separate tab/view in the settings section of the application and there the user can choose if they want to add their own custom combination of keys or if we can disable the current MacOS CMD+TAB combination in favor of DockDoor and allow it to be on or off as per #22

Hey, thanks for looking into these issues.

For the keybind, I was going to use this library: https://github.com/sindresorhus/KeyboardShortcuts

All of the current implementation of the keybind is in Utilities/KeybindHelper.swift. If you go with that library, I assume it means you will have to rip out a majority of the code in that file. One thing to note: Ensure that whatever you do, pressing tab is blocked while the menu is open. Otherwise, tab will still interact with other apps on screen and it causes a mess. For the settings page, it is very simple. Copy the other settings tab code in View/Settings/settings.swift (and make a separate SwiftUI view file for it).

For implementing a toggle to disable the hover/ctrl-tab menu all together, it should be relatively easy. See in consts.swift, how I define a bool setting with Defaults.Keys -> if you search for this bool, you will see how it is injected into the settings page and is controlled with a check box. (Make sure you prompt a restart is required for this-there is an example of this code block for some other settings) For the actual logic of disabling either function: On line 40-44 of the AppDelegate.swift file, you will see the initialization of dockObserver and keybindHelper. Simply check: if Defaults[.ctrlTabEnabled] (and another similar bool for dock peeking) before running the initialization. I think that will achieve it, but more testing is required to confirm. DockObserver is for the dock peeking, KeybindHelper is the keybind as mentioned previously. Lmk if you have any other questions!