I always have the problem in my dock, where the download bar just stops and stays froze. I know you can do a killall -KILL Dock and it will fix the issue.
Is there a way to click a button or do a keyboard-shortcut that runs this Terminal command?
I always have the problem in my dock, where the download bar just stops and stays froze. I know you can do a killall -KILL Dock and it will fix the issue.
Is there a way to click a button or do a keyboard-shortcut that runs this Terminal command?
There are multiple ways to do this, here are 2.
Create a text file, named myScript.command. The '.command' postfix will let Finder know to run it on opening.
Add the following as plain text:
#!/bin/bash
killall -KILL Dock
Now the script exists but needs to be executable. To do this you need to do a chmod.
chmod 755 myScript.command
Running myScript.command will open a Terminal window and run the command. The first line, hashbang, will let your computer know to use bash for the following script. You can set the preferences in Terminal.app to close the terminal window after a clean exit.
Create and install the service:
killall -KILL Dockno input', save and quit.Attach a keystroke to this service:

If you want to use a shortcut to run an applescript which runs the terminal command. here is a question on superuser with the first answer explaining how to make a shortcut to an applescript.
Make a new service and add your applescript

Make a keyboard shortcut using system preferences
Keyboard shortcuts will work across applications.
Made by rahul_send89 from Super User
Then you can do this as the applescript to the Automator input (As shown on the screenshot):
do shell script "sudo killall -KILL Dock" with administrator privileges
I put it in sudo (admin) just in case it would require.
Or without admin:
do shell script "killall -KILL Dock" with user privileges