diff --git a/PluginDirectories/1/hidden.bundle/Icon.png b/PluginDirectories/1/hidden.bundle/Icon.png new file mode 100644 index 00000000..e2001271 Binary files /dev/null and b/PluginDirectories/1/hidden.bundle/Icon.png differ diff --git a/PluginDirectories/1/hidden.bundle/examples.txt b/PluginDirectories/1/hidden.bundle/examples.txt new file mode 100644 index 00000000..01a976ea --- /dev/null +++ b/PluginDirectories/1/hidden.bundle/examples.txt @@ -0,0 +1,2 @@ +hide +hide ~message(yes) \ No newline at end of file diff --git a/PluginDirectories/1/hidden.bundle/info.json b/PluginDirectories/1/hidden.bundle/info.json new file mode 100644 index 00000000..9bf8d9d4 --- /dev/null +++ b/PluginDirectories/1/hidden.bundle/info.json @@ -0,0 +1,8 @@ +{ + "name" : "hidden", + "displayName" : "Toggle/show/hide hidden files", + "description" : "Quickly toggle/show/hide hidden files and folders in OS X", + "examples" : ["hide","hide yes","hide no"], + "categories" : ["Utilities"], + "creator_name": "Antonio Cruz", +} \ No newline at end of file diff --git a/PluginDirectories/1/hidden.bundle/plugin.py b/PluginDirectories/1/hidden.bundle/plugin.py new file mode 100644 index 00000000..cdd7f9e5 --- /dev/null +++ b/PluginDirectories/1/hidden.bundle/plugin.py @@ -0,0 +1,19 @@ +def results(fields, original_query): + if original_query == 'hide': + import os + isShowAllFiles = 'YES' == os.popen("defaults read com.apple.finder AppleShowAllFiles").read().strip() + showAllFiles = not isShowAllFiles + else: + showAllFiles = fields['~message'] != 'yes' + return { + "title": "Show hidden files" if showAllFiles else "Hide hidden files", + "run_args": ["YES" if showAllFiles else "NO"] + #"html": "

{0}

".format(message) + } + +def run(showAllFiles): + import os + cmd = showAllFiles + os.system("osascript -e 'do shell script \"defaults write com.apple.finder AppleShowAllFiles " + cmd + "\"'") + os.system("osascript -e 'tell app \"Finder\" to quit'") + os.system("osascript -e 'tell app \"Finder\" to activate'") \ No newline at end of file