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

workflow just opening system settings to sidecar menu #1

Open
xx88xx opened this issue Jan 7, 2024 · 8 comments
Open

workflow just opening system settings to sidecar menu #1

xx88xx opened this issue Jan 7, 2024 · 8 comments

Comments

@xx88xx
Copy link

xx88xx commented Jan 7, 2024

I noticed in the documentation (and in the alfred workflow blueprints) itself that it's supposed to toggle sidecar on and off with a notification saying what it's done.

for me, it's just opening up system settings to the sidecar menu, but stops there, the rest needs to be done manually. Is this correct behaviour or have I done something wrong or has os x broken this as of 14.1 (23B2073).

thank you for making this btw!!!

@kovstas
Copy link
Owner

kovstas commented Jan 7, 2024

Hi First off, thank you for opening the first issue on this repository! Off the top of my head, the issue might be related to your device name. The script specifically searches for 'iPad' in the name, and if your device has a different name, it might not be able to locate it. You can easily edit your device name using the 'Configure Workflow' button. Another thing to consider is whether there's a delay between opening dialogues, but I would start with checking the device name.
image
image

@xx88xx
Copy link
Author

xx88xx commented Jan 9, 2024

Thank for the reply!
Yes I have updated that field to the name of my iPad which is different to the default "iPad". It appears to be something different 🤔
With the delay idea, do you mean perhaps Alfred is processing the requests too fast and not able complete the command to the end?

@kovstas
Copy link
Owner

kovstas commented Jan 9, 2024

I was referring to the delay within an AppleScript in the workflow. To modify it, you need to open the workflow view and edit the 'Run Script' node.
image
image
Try to alter the values in lines with the delay 0.3 instruction, to make it longer like 0.4 or 0.5. It's possible that some macOS elements appear before the next step in the script is executed, and thus the delay may need to be slightly longer than I initially described.

@kovstas
Copy link
Owner

kovstas commented Jan 10, 2024

@xx88xx I have got rid of all of these delays, so it may fix your issue. Please try the latest release.

@xx88xx
Copy link
Author

xx88xx commented Jan 13, 2024

thanks for updating! unfortunately it seems to still act in the same way. Could it be the fact that I also have an apple tv on my network and it's forcing me decide which one? (perhaps it behaves differently when two devices on the network with sc abilities?)

@kovstas
Copy link
Owner

kovstas commented Jan 13, 2024

I'm sorry to hear that the solution didn't work for you. The logic simply searches for a menu item that contains 'iPad', and once it's found, it triggers a click on it. Regarding the apple tv, I have the same setup and it works without any issues for me.

@blqke
Copy link

blqke commented Apr 3, 2024

I am on Sonoma 14.4.1, I had this problem too

It may be due to the fact your OS is in a different language than English, because the script is looking for a window named "Displays"

exists window "Displays"

I believe you can just replace it be window "Displays" by window 1
It did the trick for me !

But then I faced another issue:

The AppleScript is clicking on the first item of the menu (pairing mouse/keyboard to the iPad), instead of the last one (which is sidecar external monitor)

image

I tried to tweak the script to make it work, but I believe there is a bug due to the fact the two menu items have the same name (here "iPad de Jules").

Let's dig to find the right menu index

wrong button, index 3 ⤵️
image
right button, index 7 ⤵️
image

so if I replace

set menuItem to (first menu item whose name contains device)

which is in fact

set menuItem to menu item 3

by

set menuItem to (last menu item whose name contains device)

which is in fact

set menuItem to menu item 7

It is still clicking on the pair mouse/keyboard button ! The only solution I found was to temporarily disable mouse/keyboard button from the monitor's advanced settings.

Hope it helps

@kovstas
Copy link
Owner

kovstas commented Nov 11, 2024

@blqke Hi! Thank you for your insights, they were really helpful in improving the script. Sorry it took me so long to revisit it. I’ve just published a new version that addresses your issues, and I believe it also solves the problem with linking the keyboard. https://github.com/kovstas/alfred-sidecar/releases/tag/v1.3

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