Show Dot Files

Show hidden dot files in Finder, and hide them again

Image preview of Show Dot Files plugin.

showdotfiles.2m.sh

Edit
Open on GitHub
#!/bin/bash

# Metadata
# --------
#  <xbar.title>Show Dot Files</xbar.title>
#  <xbar.version>v1.0</xbar.version>
#  <xbar.author>Jerry L Hoover</xbar.author>
#  <xbar.author.github>realjhoo</xbar.author.github>
#  <xbar.desc>Show hidden dot files in Finder, and hide them again</xbar.desc>
#  <xbar.image>https://realjhoo.com/img/showdotfilesxbar.gif</xbar.image>
#  <xbar.dependencies>bash</xbar.dependencies>
#  <xbar.abouturl>https://github.com/realjhoo/show-dot-files-xbar</xbar.abouturl>

invisibleIcon="| templateImage=iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAIRlWElmTU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAABIAAAAAQAAAEgAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAABigAwAEAAAAAQAAABgAAAAAEQ8YrgAAAAlwSFlzAAALEwAACxMBAJqcGAAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDYuMC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6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6HsMKrFXsa3hmDUrdbB0Piw9SXCpn8Ent3h0CcOjvAZpR3Jm8VnLmn+W4A1yYJCGjdVzqrbUnfUWuUyVJ0qLbItPLm1wwkegEjuOvQWOVS3KjNnk1wy6YZEbmRfOtogFNsCCka1aAse6NrnpmHrkfKkij6QrWS/RvgGRR/oVWLzvmBqUl2IMewUM/AjVMrGVrUg7Cgc/0/ABzDG370XDVyiTNH0qHhDhE/ukoq3vBVhYhn4qGC+USf7Zxy79zwRencSNVH/9uW6awML6PV2ZSJ+9zyd53384Jg6TEx3KX2bTpL2rdWP/v3YBVY2SLwF+qwMAAAAASUVORK5CYII="

if [ "$1" = 'showDotFiles' ]
then
  defaults write com.apple.finder AppleShowAllFiles YES
  killall Finder
elif [ "$1" = 'hideDotFiles' ]
then
  defaults write com.apple.finder AppleShowAllFiles NO
  killall Finder
fi

showAllFiles=`defaults read com.apple.finder AppleShowAllFiles`

if [ $showAllFiles = "NO" ]
then
  # Show Dot Files
  echo $invisibleIcon
  echo '---'
  echo "Show Dot Files | shell='$0' param1=showDotFiles terminal=false refresh=true"
  echo "Show Dot Files Version 1.0 | disabled=true"
else
  # Hide Dot Files
  echo $visibleIcon
  echo '---'
  echo "Hide Dot Files | shell=$0 param1=hideDotFiles terminal=false refresh=true"
  echo "Show Dot Files v1.0 | disabled=true"
fi