mirror of
https://github.com/nikdoof/dotfiles.git
synced 2025-12-14 10:12:28 +00:00
[macos] Combine macOS specific functions
This commit is contained in:
29
macos/.config/shell-common/macos.sh
Normal file
29
macos/.config/shell-common/macos.sh
Normal file
@@ -0,0 +1,29 @@
|
||||
# Tag the file as OK to run
|
||||
function itsok() {
|
||||
if [[ $(uname) == "Darwin" ]]; then
|
||||
xattr -d com.apple.quarantine $1
|
||||
else
|
||||
echo 'This only works on macOS...'
|
||||
fi
|
||||
}
|
||||
|
||||
# Updates Homebrew installation from the Brewfile
|
||||
function update-brewfile() {
|
||||
brew bundle check --file "$HOME/.config/Brewfile" || brew bundle --cleanup -f --file "$HOME/.config/Brewfile"
|
||||
}
|
||||
|
||||
# Updates the dock
|
||||
function update-dock() {
|
||||
idx=1
|
||||
while read entry; do
|
||||
app_name=$(echo "$entry" | cut -d $'\t' -f 1)
|
||||
app_path=$(echo "$entry" | cut -d $'\t' -f 2)
|
||||
app_type=$(echo "$entry" | cut -d $'\t' -f 3)
|
||||
idx=$((idx+1))
|
||||
dockutil --no-restart -a "$app_path" > /dev/null 2>&1
|
||||
if [ "$app_type" = "persisentApps" ]; then
|
||||
dockutil --move "$app_name" -p $idx
|
||||
fi
|
||||
done < ~/.dotfiles/macos/.config/dockConfig.txt
|
||||
killall Dock
|
||||
}
|
||||
Reference in New Issue
Block a user