KeyboardCowboy icon indicating copy to clipboard operation
KeyboardCowboy copied to clipboard

Applications quick peek and hide if active

Open ww7 opened this issue 1 year ago • 25 comments

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

ww7 avatar Jul 11 '24 11:07 ww7

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

zenangst avatar Jul 11 '24 12:07 zenangst

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 avatar Aug 30 '24 06:08 zenangst

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

zenangst avatar Aug 30 '24 06:08 zenangst

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

ww7 avatar Sep 02 '24 08:09 ww7

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? - https://github.com/zenangst/KeyboardCowboy/issues/547#issuecomment-2320159843

Or am I missing something?

zenangst avatar Sep 02 '24 11:09 zenangst

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!

ww7 avatar Sep 02 '24 16:09 ww7

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

theprivacydesigner avatar Oct 20 '24 01:10 theprivacydesigner

@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

zenangst avatar Oct 20 '24 13:10 zenangst

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

theprivacydesigner avatar Oct 20 '24 17:10 theprivacydesigner

@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.

zenangst avatar Oct 20 '24 17:10 zenangst

@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.

theprivacydesigner avatar Oct 21 '24 20:10 theprivacydesigner

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

ww7 avatar Oct 22 '24 00:10 ww7

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

zenangst avatar Oct 22 '24 15:10 zenangst

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

ww7 avatar Oct 23 '24 14:10 ww7

@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 avatar Oct 23 '24 19:10 zenangst

I think I managed to figure it out now.

zenangst avatar Oct 23 '24 20:10 zenangst

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 avatar Oct 24 '24 04:10 ww7

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

ww7 avatar Oct 24 '24 04:10 ww7

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

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

zenangst avatar Oct 24 '24 22:10 zenangst

@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)

ww7 avatar Oct 25 '24 08:10 ww7

@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.

zenangst avatar Oct 25 '24 08:10 zenangst

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 avatar Oct 25 '24 09:10 ww7

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

ww7 avatar Oct 25 '24 09:10 ww7

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.

zenangst avatar Nov 04 '24 23:11 zenangst

Hoping to have Peek with the ability to hide someday :)

ww7 avatar Dec 12 '24 01:12 ww7