1
dot-files/bin/set-icon

26 lines
717 B
Bash
Executable File

#!/bin/bash
################################################################################
#
# set-icon
# Sets an icon for a file or directory by name
#
################################################################################
LOCATION="${1}"
ICON_NAME="${2}"
if [[ -z "${LOCATION}" ]]; then
echo "Please specify a location"
echo "Usage: set-icon LOCATION [ICON_NAME]"
exit 1
fi
if [[ -z "${ICON_NAME}" ]]; then
echo "Unsetting metadata::custom-icon-name for ${LOCATION}"
gio set "${LOCATION}" metadata::custom-icon-name -t unset
else
echo "Setting metadata::custom-icon-name for ${LOCATION} to ${ICON_NAME}"
gio set "${LOCATION}" metadata::custom-icon-name "${ICON_NAME}"
fi