1
dot-files/bin/set-icon

26 lines
717 B
Plaintext
Raw Permalink Normal View History

2024-04-11 22:46:41 +00:00
#!/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