# \[meta\] macOS Shortcut to tell you if Shapr3D quit yet

**URL:** <https://discourse.shapr3d.com/t/meta-macos-shortcut-to-tell-you-if-shapr3d-quit-yet/31170>\
**Category:** Share your creations\
**Created:** [April 6, 2024, 1:37pm UTC](https://discourse.shapr3d.com/t/meta-macos-shortcut-to-tell-you-if-shapr3d-quit-yet/31170 "2024-04-06T13:37:33Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![masukomi](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.shapr3d.com/masukomi/32/34507_2.png) [@masukomi](https://discourse.shapr3d.com/u/masukomi)\
**Post date:** [April 6, 2024, 1:37pm UTC](https://discourse.shapr3d.com/t/meta-macos-shortcut-to-tell-you-if-shapr3d-quit-yet/31170/1 "2024-04-06T13:37:33Z")

</div>

This post describes the difficulty of restarting Shapr3D on macOS to get around bugs, and a Shortcut (shortcuts app) to easily help you monitor it until it quits.

Problem:  
Shapr3D still has a bunch of bugs on macOS and many of them are solved by simply quitting and restarting it.

Unfortunately, Shapr3D Takes a _reeeealy_ long time to actually quit behind the scenes. To the user it looks like it quits instantly, but it’s actually still running just with no user facing stuff. On my machine it’s ~37 seconds before it finally quits.

If you restart it before it’s _fully_ shut down it just redraws the window instead of actually “restarting” because it never actually quit.

So, if you need to actually restart it to get past a bug you need to wait until it _fully_ quits, so you need to know when it fully quits.

Solution:  
Create a new Shortcut with the Shortcuts app that opens Activity Monitor and searches for Shapr so that you know when it’s actually quit and can be restarted.

Here’s what it looks like:

 ![shortcuts app screenshot showing showing the script described below](https://us1.discourse-cdn.com/flex002/uploads/shapr3d/original/3X/8/b/8b7eca251e0a68e72dd7eab2f5998778b9d2ec86.png)

It’s a simple 2 step Shortcut.

- “Open App” action with “Activity Monitor” as the name of the app to open.
- “Run Applescript” action with the following text in it.

```auto
on run {input, parameters}
	(* Your script goes here *)
	tell application "Activity Monitor" to activate
	tell application "System Events"
		keystroke "f" using {command down, option down}
		keystroke "Shapr"
	end tell
	return input
end run

```

You’ll Also need to go grant the Shortcuts app the permission to type things.

System Settings \> Privacy & Security \> Accessibility - toggle the switch next to Shortcuts.

Full disclosure this does mean that if you run shortcuts you didn’t create they could do anything you can do with a keyboard, which is a potential security risk.

When you run this script it opens Activity Monitor, and types the keycombo to select the search box. Then it types in “Shapr”. After a short pause for the net poll of Activity Monitor you should see this.

 ![screenshot of the activity monitor app with shapr in the search field](https://us1.discourse-cdn.com/flex002/uploads/shapr3d/original/3X/8/8/88898e3941f0f423bdca37b6b97aa3f479caea71.jpeg)

just wait for the row with the Shapr3D icon to go away. That’s when it’s finished quitting.

BONUS:  
Did you know you can invoke shortcuts from the Elgato Stream Deck? Now I’ve got a physical button on my desk that I can press to invoke this. Yes, I have to do it that often.

---

<div class="post-metadata">

**Author:** ![Xdrakosha](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.shapr3d.com/xdrakosha/32/24881_2.png) [@Xdrakosha](https://discourse.shapr3d.com/u/Xdrakosha)\
**Post date:** [April 6, 2024, 2:43pm UTC](https://discourse.shapr3d.com/t/meta-macos-shortcut-to-tell-you-if-shapr3d-quit-yet/31170/2 "2024-04-06T14:43:18Z")

</div>

Isn’t that easier to do using `ps` instead of activity monitor?

BTW: on my Mac it stops after 2-3 sec totally.

---

<div class="post-metadata">

**Author:** ![Xdrakosha](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.shapr3d.com/xdrakosha/32/24881_2.png) [@Xdrakosha](https://discourse.shapr3d.com/u/Xdrakosha)\
**Post date:** [April 6, 2024, 2:55pm UTC](https://discourse.shapr3d.com/t/meta-macos-shortcut-to-tell-you-if-shapr3d-quit-yet/31170/3 "2024-04-06T14:55:39Z")

</div>

If you need it I can write bash script which will kill current process, wait till it stops completely and rerun the app.

---

<div class="post-metadata">

**Author:** ![Xdrakosha](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.shapr3d.com/xdrakosha/32/24881_2.png) [@Xdrakosha](https://discourse.shapr3d.com/u/Xdrakosha)\
**Post date:** [April 6, 2024, 3:34pm UTC](https://discourse.shapr3d.com/t/meta-macos-shortcut-to-tell-you-if-shapr3d-quit-yet/31170/4 "2024-04-06T15:34:19Z")

</div>

Here is the code. Just put it in the .sh file and give it executable permissions.

```auto
#!/usr/bin/env bash
APP="/Applications/Shapr3D.app/Contents/MacOS/Shapr3D"

PID=`ps axw | grep -v "grep" | grep $APP | awk ' { print $1 }'`

while kill $PID 2> /dev/null; do
    echo "Still running..."
    sleep 1
done

exec $APP 2> /dev/null &

```

To force it run by mouse double-clicking change the extension to .command

---

<div class="post-metadata">

**Author:** ![Xdrakosha](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.shapr3d.com/xdrakosha/32/24881_2.png) [@Xdrakosha](https://discourse.shapr3d.com/u/Xdrakosha)\
**Post date:** [April 6, 2024, 3:38pm UTC](https://discourse.shapr3d.com/t/meta-macos-shortcut-to-tell-you-if-shapr3d-quit-yet/31170/5 "2024-04-06T15:38:44Z")

</div>

Just an example how it can be used

---

<div class="post-metadata">

**Author:** ![Steve](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.shapr3d.com/steve/32/2446_2.png) [@Steve](https://discourse.shapr3d.com/u/Steve)\
**Post date:** [April 6, 2024, 5:09pm UTC](https://discourse.shapr3d.com/t/meta-macos-shortcut-to-tell-you-if-shapr3d-quit-yet/31170/6 "2024-04-06T17:09:21Z")

</div>

Great shell script! Most of my career was spent as a Unix Sysadmin, and my first instinct is still to look for a command line solution. Although, to be fair to masukomi, the AppleScript shortcut is a pretty clever solution for all these young kids who only feel comfortable in a GUI environment 😁

Also, excellent choice in wallpaper.

---

<div class="post-metadata">

**Author:** ![Xdrakosha](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.shapr3d.com/xdrakosha/32/24881_2.png) [@Xdrakosha](https://discourse.shapr3d.com/u/Xdrakosha)\
**Post date:** [April 6, 2024, 5:13pm UTC](https://discourse.shapr3d.com/t/meta-macos-shortcut-to-tell-you-if-shapr3d-quit-yet/31170/7 "2024-04-06T17:13:53Z")

</div>

> [@Steve](#):
>
> Most of my career was spent as a Unix Sysadmin

I’m still on this way 🙂

> [@Steve](#):
>
> Although, to be fair to masukomi, the AppleScript shortcut is a pretty clever solution

It is but… you need to close the app, then run this shortcut and after you see app is closed rerun the app.

Mine solution is all in one, you just need to run it and it will done the job. Also no necesity of strange permissions for shortcuts app.

---

<div class="post-metadata">

**Author:** ![Steve](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.shapr3d.com/steve/32/2446_2.png) [@Steve](https://discourse.shapr3d.com/u/Steve)\
**Post date:** [April 6, 2024, 5:25pm UTC](https://discourse.shapr3d.com/t/meta-macos-shortcut-to-tell-you-if-shapr3d-quit-yet/31170/8 "2024-04-06T17:25:18Z")

</div>

Oh, I absolutely agree that your shell script is a much better solution. I guess I’m just a grumpy old fart who couldn’t resist being a little snarky towards the younger generation who rarely bother to learn or understand everything that this amazing hardware and software can do for them.

---

<div class="post-metadata">

**Author:** ![Xdrakosha](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.shapr3d.com/xdrakosha/32/24881_2.png) [@Xdrakosha](https://discourse.shapr3d.com/u/Xdrakosha)\
**Post date:** [April 6, 2024, 5:41pm UTC](https://discourse.shapr3d.com/t/meta-macos-shortcut-to-tell-you-if-shapr3d-quit-yet/31170/9 "2024-04-06T17:41:16Z")

</div>

> [@Steve](#):
>
> Most of my career was spent as a Unix Sysadmin, and my first instinct is still to look for a command line solution.

That’s why I like MacOS so much because it is almost that old good linux undercover 🙂

---

<div class="post-metadata">

**Author:** ![Steve](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.shapr3d.com/steve/32/2446_2.png) [@Steve](https://discourse.shapr3d.com/u/Steve)\
**Post date:** [April 6, 2024, 5:51pm UTC](https://discourse.shapr3d.com/t/meta-macos-shortcut-to-tell-you-if-shapr3d-quit-yet/31170/10 "2024-04-06T17:51:31Z")

</div>

> [@Xdrakosha](#):
>
> That’s why I like MacOS so much because it is almost that old good linux undercover 🙂

Agree wholeheartedly!!! And anything not included can easily be found with Homebrew or Github.

---

<div class="post-metadata">

**Author:** ![Xdrakosha](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.shapr3d.com/xdrakosha/32/24881_2.png) [@Xdrakosha](https://discourse.shapr3d.com/u/Xdrakosha)\
**Post date:** [April 6, 2024, 8:49pm UTC](https://discourse.shapr3d.com/t/meta-macos-shortcut-to-tell-you-if-shapr3d-quit-yet/31170/11 "2024-04-06T20:49:58Z")

</div>

Made app-like variant. Just unpack and run it then you need it.

[Restart.zip](https://discourse.shapr3d.com/uploads/short-url/sRoyp7nQuP5X8dO7KKzPEyvrQ6y.zip) (842.1 KB)

---

<div class="post-metadata">

**Author:** ![Steve](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.shapr3d.com/steve/32/2446_2.png) [@Steve](https://discourse.shapr3d.com/u/Steve)\
**Post date:** [April 6, 2024, 11:47pm UTC](https://discourse.shapr3d.com/t/meta-macos-shortcut-to-tell-you-if-shapr3d-quit-yet/31170/12 "2024-04-06T23:47:12Z")

</div>

Thanks, I wasn’t really asking for a copy — just recognizing your good taste 🙂

---

<div class="post-metadata">

**Author:** ![Xdrakosha](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.shapr3d.com/xdrakosha/32/24881_2.png) [@Xdrakosha](https://discourse.shapr3d.com/u/Xdrakosha)\
**Post date:** [April 7, 2024, 5:28am UTC](https://discourse.shapr3d.com/t/meta-macos-shortcut-to-tell-you-if-shapr3d-quit-yet/31170/13 "2024-04-07T05:28:45Z")

</div>

> [@Steve](#):
>
> I wasn’t really asking for a copy

That wasn’t for you but you free to use it 😆
