From ea44ba2c525e2295996b694dcb5aab1c3c7bf2b8 Mon Sep 17 00:00:00 2001 From: Jelte Lagendijk Date: Mon, 22 Apr 2024 08:23:05 +0200 Subject: [PATCH] feat: Add Dock Orientation/Autohide (#933) * feat: Add Dock Orientation/Autohide * Apply suggestions from code review Co-authored-by: Thiago Holanda * Rename script --------- Co-authored-by: Thiago Holanda --- commands/system/dock-autohide-toggle.sh | 23 +++++++++++++++++++++++ commands/system/dock-set-autohide.sh | 18 ++++++++++++++++++ commands/system/dock-set-position.sh | 18 ++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100755 commands/system/dock-autohide-toggle.sh create mode 100755 commands/system/dock-set-autohide.sh create mode 100755 commands/system/dock-set-position.sh diff --git a/commands/system/dock-autohide-toggle.sh b/commands/system/dock-autohide-toggle.sh new file mode 100755 index 000000000..5b05c740d --- /dev/null +++ b/commands/system/dock-autohide-toggle.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# Required parameters: +# @raycast.schemaVersion 1 +# @raycast.title Toggle Dock Autohide +# @raycast.mode silent + +# Optional parameters: +# @raycast.icon 🤖 +# @raycast.packageName System + +# Documentation: +# @raycast.description Toggle the Dock Autohide +# @raycast.author Jelte Lagendijk +# @raycast.authorURL https://raycast.com/j3lte + +autohide=$(defaults read com.apple.dock autohide) + +if [[ $autohide == 1 ]]; then + defaults write com.apple.dock autohide -bool false; killall Dock +else + defaults write com.apple.dock autohide -bool true; killall Dock +fi diff --git a/commands/system/dock-set-autohide.sh b/commands/system/dock-set-autohide.sh new file mode 100755 index 000000000..f3a4c0287 --- /dev/null +++ b/commands/system/dock-set-autohide.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# Required parameters: +# @raycast.schemaVersion 1 +# @raycast.title Dock Set Autohide +# @raycast.mode silent + +# Optional parameters: +# @raycast.icon 🤖 +# @raycast.argument1 { "type": "dropdown", "placeholder": "On/Off", "data": [{"title": "Off", "value": "false"}, {"title": "On", "value": "true"}] } +# @raycast.packageName System + +# Documentation: +# @raycast.description Set the Dock autohide +# @raycast.author Jelte Lagendijk +# @raycast.authorURL https://raycast.com/j3lte + +defaults write com.apple.dock autohide -bool $1; killall Dock diff --git a/commands/system/dock-set-position.sh b/commands/system/dock-set-position.sh new file mode 100755 index 000000000..de91f8452 --- /dev/null +++ b/commands/system/dock-set-position.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# Required parameters: +# @raycast.schemaVersion 1 +# @raycast.title Dock Position +# @raycast.mode silent + +# Optional parameters: +# @raycast.icon 🤖 +# @raycast.argument1 { "type": "dropdown", "placeholder": "Position on Screen", "data": [{"title": "Left", "value": "left"}, {"title": "Right", "value": "right"}, {"title": "Bottom", "value": "bottom"}] } +# @raycast.packageName System + +# Documentation: +# @raycast.description Set the position of the Dock in the screen +# @raycast.author Jelte Lagendijk +# @raycast.authorURL https://raycast.com/j3lte + +defaults write com.apple.dock orientation -string $1; killall Dock