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

make app scriptable #1590

Closed
wants to merge 1 commit into from
Closed

Conversation

steventheworker
Copy link

@steventheworker steventheworker commented May 18, 2022

I'd like to add 5 applescript commands:

show: Calls showUI; felt natural to include

hide & showApp: These get DockAltTab v2.0 off the ground by providing previews for a specific app without changing the active app or triggering any keys (escape / Shortcut2).

trigger & countWindows: These enable some applescripts I made to replace cmd+w / cmd+m using BetterTouchTool. I use them to provide Windows-like behavior when minimizing/closing windows (no cycling).

EDIT: Also, I just realized I didn't run npm install first.

@lwouis
Copy link
Owner

lwouis commented May 19, 2022

Hi @steventheworker,

Thank you for sharing this PR!

I'm a bit confused as to the intent of this, the use-cases, etc. Could you please take a moment to explain things like:

  • How did the idea came to add these AS endpoints?
  • How would they be used, in details?
  • How come you went for this specific implementation instead of something else? For instance, there is already Add CLI support #371, and the approach discussed there would be to be able to run AltTab without UI. Like CLI would replace the UI. Here you added AS support that runs in addition to UI.
  • Are there any gotchas? Like maybe this requires the user to add a new permission in System Preferences > Security & Privacy > Automation?
  • Anything else that provides context and understand of this PR

Thank you

@steventheworker
Copy link
Author

steventheworker commented May 19, 2022

  1. I first decided to do this via AppleScript to stop DockAltTab from firing too many keyboard events (Esc key triggers an annoying beep / might accidentally close something else). I only truly need hide & showApp (for DockAltTab) but I really want the trigger & countWindows commands for my other endeavor (inspired by this reddit thread) (closing and minimizing windows w/o cycling the next window from the same app, if it's not the very next item on AltTab).

  • show: calls showUI and focuses on 1st preview
  • hide: calls hideUI
  • showApp: Shows specific app windows w/ bundleID. I ignored the blacklist for this command, so that AltTab can hide apps w/ too many windows (I like to add Stickies to my blacklist, but still have them revealed when hovering over the app icon in the dock w/ DockAltTab). Also focuses on 1st preview
  • trigger: I just needed to switch to the very next app/window in AltTab (and w/o flickering the UI) so that I could close the window from the previous app via process/application/AXCloseButton. Having another app active while closing/minimizing a window stops the cycling. So I switch apps/windows first before closing/minimizing the target window using this command.
  • countWindows: returns the count of windows in all spaces for a specific app w/ bundleID. Used to change default close behavior of apps after calling AltTab trigger and then closing a window. After closing a window in my cmd-w script I count the windows for select apps and quit them when they hit 0 windows.
  1. I don't really understand how this non-GUI CLI stuff would look like or be implemented, but I'd like to keep the keyboard / mouse events which you say would be gone? I would like to keep those (especially the arrow keys and space/cmd to select windows). And, if it's not going to be as slow as ayroblu is suggesting (4 seconds!).

  2. AltTab's permission req's would remain unchanged (scriptable apps don't need any new permissions, only apps that send the Apple Events (ie: DockAltTab, BetterTouchTool, Script Editor, etc.) need automation privileges).

  3. You can test these in Script Editor:
    tell application "AltTab" to trigger
    tell application "AltTab" to countWindows appBID "com.apple.Safari"

this will:

  • trigger Shortcut1 (w/o flickering UI)
  • return the count of windows of Safari (in all spaces)

@lwouis
Copy link
Owner

lwouis commented May 19, 2022

Oh, I found your website for DockAltTab and now I understand things a lot better. Now I understand why you want these specific endpoints.

I'm a bit hesitant to bring in these endpoints that only your app will use. As I understand the commit history, you started this companion app around 2 weeks ago.

I suggest we wait a bit and see the demand for it. If it gets popular, we can develop the integration.

I'm being cautious here because this PR is essentially an API between your app and AltTab, and a connexion like this means constant maintenance and discussing it when one side or the other change things. I learned about your project a few hours ago, so I hope you understand I can't just go straight into binding AltTab to it without further knowledge.

@steventheworker
Copy link
Author

steventheworker commented May 19, 2022

The app has been around since September 2021, I just recently rebuilt the project / replaced the commit history. About a dozen or so users have bothered me (on reddit / email / 1 github issue) about only being able to show previews for the active app only. I promised on the GitHub issue I'd be done last month. Nowadays I average 8 downloads a day on google analytics (I'd like to get people on 2.0 which is way better), but I guess I can just have them uninstall the official and have them download a custom AltTab from me instead? Since I also prefer using this app over my other one.

Additionally, solely adding showApp and hide would solve my (DockAltTab) issues, and would ONLY require the maintenance of the showApp command (since hide is literally one line). Not to mention that people can use these commands for their BetterTouchTool bindings...

@Davo00
Copy link

Davo00 commented Jul 9, 2023

Oh, I found your website for DockAltTab and now I understand things a lot better. Now I understand why you want these specific endpoints.

I'm a bit hesitant to bring in these endpoints that only your app will use. As I understand the commit history, you started this companion app around 2 weeks ago.

I suggest we wait a bit and see the demand for it. If it gets popular, we can develop the integration.

I'm being cautious here because this PR is essentially an API between your app and AltTab, and a connexion like this means constant maintenance and discussing it when one side or the other change things. I learned about your project a few hours ago, so I hope you understand I can't just go straight into binding AltTab to it without further knowledge.

A year has passed, the app is still around and is much easier to find over the search engine than AltTab. So what are your conclusions @lwouis? @steventheworker would you mind to reopen the PR?

@tmnrdhf
Copy link

tmnrdhf commented Sep 1, 2023

@lwouis any update on this? I would like to keep using the original AltTab and only add the Dock preview functionality by using the feature @steventheworker developed, instead of having to install a modded version of AltTab.

@lwouis
Copy link
Owner

lwouis commented Sep 1, 2023

Hi @tmnrdhf,

This use-case is still niche. I can't invest in it for a handful of users. That's a general rule I use for every feature suggestion. It has to be popular enough to carry its own weight, otherwise the app will get bloated. It's an unfortunate trade-off we have to make to maintain a good experience for the majority of users.

Thank you

@Davo00
Copy link

Davo00 commented Sep 2, 2023

This use-case is still niche. I can't invest in it for a handful of users. That's a general rule I use for every feature suggestion. It has to be popular enough to carry its own weight, otherwise the app will get bloated. It's an unfortunate trade-off we have to make to maintain a good experience for the majority of users.

So, how do you plan to find out if enough users want this and what is the limit you have defined?

@lwouis
Copy link
Owner

lwouis commented Sep 3, 2023

I've worked on this app for 3 years, and processed ~2500 tickets. That gives me a sense of features popularity.

There would need to be at least 20 participants to this thread so that it would show non-niche interest.

@Davo00
Copy link

Davo00 commented Sep 4, 2023

@lwouis you could also implement DockAltTab feature in your project. If you'd like to and think it's popular. @steventheworker might want to help.

Anyway, people interested please leave a👍 under this comment to keep track.

@shredthaGNAR
Copy link

Status? @steventheworker has done great job keeping app updated and functioning since PR request. However, with added applescript commands added users would be able to use your/the main repo AltTab and use DockTab separately and not have to rely on a modded(same app just with added Applescript). He can then focus solely on DockTab and upgrading that app, as having to make sure changes are insync with your repo just to disttribute same app, but with the small amont of static(?) code added in for functionality with DockTab.

Both great apps and he just happened to find a great way to utilize AltTab! It in no way changes AltTab functionality or usability-it just adds to it using combo of Actionscipt code.

Thanks both of you for great job well done. Fingers crossed

@Chrisc-c-c
Copy link

Definitely interested in DockAltTab being supported in the official build.

@tmnrdhf
Copy link

tmnrdhf commented Jun 24, 2024

@lwouis there are 20 thumbs up on @Davo00 's comment now which means we've hit your requirement 🙌 Will you consider making AltTab scriptable like @steventheworker requested? It would be so amazing not having to use a custom AltTab branch to have a nice dock preview 🙂

@niXta1
Copy link

niXta1 commented Sep 5, 2024

If DockAltTab would show a popup with instructions on how to vote if the user was interested, the votes would quickly go over 100.
My recommendation would be to add the code needed, but make it BETA, and make sure users understand that it would be unsupported at the moment. That way we will see the popularity and decide later on if it's worth the effort.

@lwouis
Copy link
Owner

lwouis commented Sep 5, 2024

Download stats show us:

So one way to look at it, is that this feature may at least benefit 0,4% of the AltTab userbase. I'm afraid it is still too niche.

Furthermore, integrating with the Dock will be a nightmare to support, I'm sure of it. Endless new categories of bugs to fix, and macOS changes will keep breaking things, no doubt.

Finally, I'd like to remind everyone that AltTab itself is under maintenance mode: #1179. This is very important context to keep in mind when discussing which tickets should be looked at.

Thank you for your understanding 🙇

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

Successfully merging this pull request may close these issues.

7 participants