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

Applications quick peek and hide if active #547

Open
ww7 opened this issue Jul 11, 2024 · 24 comments
Open

Applications quick peek and hide if active #547

ww7 opened this issue Jul 11, 2024 · 24 comments

Comments

@ww7
Copy link

ww7 commented Jul 11, 2024

I'm fan of Apptivate keyboard shortcuts manager, it abandoned since 2021 but still works.

Two nice features from Apptivate is missing at KeyboardCowboy:

  • quick peek: show window when shortcut hold down (or last in sequence) and hide app window if shortcut is released after some delay of holding
  • hide if applications windows already active
@zenangst
Copy link
Owner

Oh, those are both interesting ideas.
Thanks for sharing @ww7, I'll see if these a doable without too much of a rewrite ❤️

@zenangst
Copy link
Owner

zenangst commented Aug 30, 2024

Just thought of something that I've used in the past.
So if you have two groups:

  • Global
  • Specific App (for this example, Let's use Terminal)

The global would for example hold a shortcut to show an application:
fn-t -> Terminal.

And when Xcode Terminal is open, you remap fn-t to Hide.

You won't get the quick peek, you you'll be able to toggle ("peek") by pushing it once to show and twice to hide.

Hope that helps.

@zenangst
Copy link
Owner

Could you share some more insight to hide if applications windows already active?

@ww7
Copy link
Author

ww7 commented Sep 2, 2024

I mean frontmost application, like
Bundle Identifier: org.mozilla.firefoxdeveloperedition
File Path: /Applications/Firefox Developer Edition.app/Contents/MacOS/firefox

@zenangst
Copy link
Owner

zenangst commented Sep 2, 2024

So you want to be able to hide the current application?
Could you achieve this with a Group that is scoped to that application?
Similar to what I described here? - #547 (comment)

Or am I missing something?

@ww7
Copy link
Author

ww7 commented Sep 2, 2024

Yes, thanks! Hiding is not an issue at all, I simply meaning it will be easy to use the same shortcut for hide specific app.
Also peek functionality as it implemented it Apptivate app.
It smart!

@theprivacydesigner
Copy link

And when Xcode is open, you remap fn-t to Hide.

@zenangst Did you mean Terminal (instead of Xcode) here, since the example is around Terminal?

If so, I can’t make your suggestion work.

  1. I’ve created a shortcut to open Obsidian with F1
  2. I’ve created an Obsidian-specific group and added a new shortcut: hide Obsidian with F1

The first shortcut works, the second one doesn’t.
What am I missing?

Screenshot 2024-10-19 at 5 54 28 PM Screenshot 2024-10-19 at 5 54 43 PM

@zenangst
Copy link
Owner

zenangst commented Oct 20, 2024

@theprivacydesigner

Oh right, yeah Xcode was a typo, meant Terminal.

I think you setup looks correct.
I've installed Obsidian and will try and recreate the your desired workflow to check if there is a bug in the mix or if something "non obvious" is missing, because this should work.

What if you try to use the Hide command using a keyboard shortcut instead of the application command.

image

@theprivacydesigner
Copy link

That did the trick! Thank you.
For reference:
Screenshot 2024-10-20 at 10 03 30 AM

@zenangst
Copy link
Owner

@theprivacydesigner Fantastic! I'm still gonna check if there is a bug in the hide application command, so thanks for bringing it to my attention.

@theprivacydesigner
Copy link

@zenangst just a guess but... in the first setup I tried (the one that didn’t work) I turned on notifications for each command... it looked like both show and hide were triggered when the application was in focus. Which probably is why the app wasn’t hiding.

@ww7
Copy link
Author

ww7 commented Oct 22, 2024

Hide can be implemented regardless to which windows in focus, but via "Active" status.

@zenangst
Copy link
Owner

Hey @ww7,

Here is some good news for you... I went ahead and implemented application peeking functionality that will be available in the upcoming version.

image

@ww7
Copy link
Author

ww7 commented Oct 23, 2024

Great, thanks! Peek will switch to app if hold less than 100-400ms?

@zenangst
Copy link
Owner

@ww7 Not currently, the implementation that I made is based on keyDown show and then keyUp to hide it again when the user releases the key. But I do like the suggestion.

I'm gonna take a stab at it because I can see the potential in it not disappearing if I hold the key down for a longer period of time.

@zenangst
Copy link
Owner

I think I managed to figure it out now.

@ww7
Copy link
Author

ww7 commented Oct 24, 2024

Initial suggestion is wrongly described by me.

Peek implementation can be in same time as application activation, hiding and peek.

  1. Activate after keyDown and keyUp with delay between less than 400ms (or 100-400)
  2. Hide if app is frontmost (active) with same behavior as Activate
  3. Peek after keyDown and keyUp holded, and hide if keyUp released (but hold longer 400ms)

@ww7
Copy link
Author

ww7 commented Oct 24, 2024

Current default app activation may have "hide if active" flag, this allows to have less shortcuts.

@zenangst
Copy link
Owner

zenangst commented Oct 24, 2024

@ww7 3.25.0 now support peeking (sounded way better in my head 🤣).

https://github.com/zenangst/KeyboardCowboy/releases/tag/3.25.0

@ww7
Copy link
Author

ww7 commented Oct 25, 2024

@zenangst peeking works nice!
one request, to add "Hide if active" ("Hide if frontmost") as flag/checkbox or as default behavior for Peek (when not held)

@zenangst
Copy link
Owner

@ww7 I managed to achieve that behavior by just having a keyboard shortcut scoped to that app.

Screenshot 2024-10-25 at 10 54 36 Screenshot 2024-10-25 at 10 55 01

I guess that option would save you creating a group and having multiple shortcuts.

@ww7
Copy link
Author

ww7 commented Oct 25, 2024

I have all my apps with shortcuts (~30), it hard to manage Hide for all of them, my previous workflow was:

  • hold keys - peek
  • press once - show
  • press second time - hide
    So with press it works also as Peek but without need to hold the last key

As I have two languages (non-latin), all shortcuts doubled... Manage Hide to all of them blowing mind

(offtopic about interface: "Check for updates" window have funny ).), "About" new line before last ) and "Whats new" truncate some peoples)

@ww7
Copy link
Author

ww7 commented Oct 25, 2024

Initially I thought peek and hide if active/frontmost can be as flags for Opening

@zenangst
Copy link
Owner

zenangst commented Nov 4, 2024

Hey @ww7, I had a thought. Instead of making 'Peek' a modifier, let's make it an action. That way, users won't accidentally mix it with 'hide' or 'unhide,' which wouldn't make much sense.

Oh, and 'Peek' also has some special behavior when it comes to 'keyUp' based on a time interval. I didn't want that to be part of the regular path if the user just wants to open an application.

I know this got a bit technical, but I hope you get the idea.

By the way, I think we could still add 'Hide when active/frontmost' as a modifier. I'll check if we can't get that into the next version.

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

No branches or pull requests

3 participants