From a9c8685c09f40c72e35322457e90741cf48e399e Mon Sep 17 00:00:00 2001 From: meowmeowcat <68463158+meowmeowmeowcat@users.noreply.github.com> Date: Thu, 4 Nov 2021 18:39:50 +0800 Subject: [PATCH] first commit --- README.md | 4 ++++ hideicons | 29 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 README.md create mode 100644 hideicons diff --git a/README.md b/README.md new file mode 100644 index 0000000..a6639ce --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +# hideicons + +Display or hide the desktop icons from the command line. + diff --git a/hideicons b/hideicons new file mode 100644 index 0000000..8e422c7 --- /dev/null +++ b/hideicons @@ -0,0 +1,29 @@ +#!/bin/bash + +if ! [[ "$OSTYPE" == "darwin"* ]]; then + echo "isarm only supports macOS." + exit 1 +fi + +if [ -z "$1" ] + then + result_read="defaults read com.apple.finder CreateDesktop" + if $result_read | grep -q "true"; then + defaults write com.apple.finder CreateDesktop false + killall Finder + echo "Desktop icons are hidden!" + exit 0 + elif $result_read | grep -q "false"; then + defaults write com.apple.finder CreateDesktop true + killall Finder + echo "Desktop icons are shown!" + exit 0 + fi +fi + +case "$1" in + --help|-h) echo "Display or hide the desktop icons from the command line."; exit 0 + ;; + --version|-v) echo "Version 0.0.1"; exit 0 + ;; +esac