You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A while ago I made a script meant to assign icons automatically after a new installation.
So, maybe someone (a distrohopper) is interested on having a similar script to avoid doing manually all the times.
I adapted it to use the MoreWaita place icons.
#!/usr/bin/env bash# --------------------------------------------------------------------------------------------------## Automate change of folder icons using MoreWaita icon theme with gio command.## Using gio to set a custom icon:# gio set $HOME/Documents/C metadata::custom-icon \# file:///usr/share/icons/MoreWaita/places/scalable/folder-c.svg## Then you can confirm the change showing all the attributes with the command:# gio info $HOME/Documents/C# Or showing only custom-icon attribute:# gio info --attributes="metadata::custom-icon" $HOME/Documents/C# To delete the custom-icon attribute use -d flag:# gio set $HOME/Documents/C metadata::custom-icon -d## Dependencies:# gio# MoreWaita## Created by @hasecilu## License: WTFPL (https://en.wikipedia.org/wiki/WTFPL)## --------------------------------------------------------------------------------------------------
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
RED='\033[0;31m'
NC='\033[0m'# No Color
MOREWAITA_DIR=/usr/share/icons/MoreWaita/scalable/places
# MOREWAITA_DIR=$XDG_DATA_HOME/icons/MoreWaita/scalable/placesfunctionci() { # Simplify commandif [[ "$2"=="-d" ]];then# Delete custom-icon attribute
gio set"$1" metadata::custom-icon -d
else# Assign value to custom-icon attribute
gio set"$1" metadata::custom-icon file://"$2"fi
}
functioncustom-icon() {
# First argument ($1) is the folder path, ex: /home/user/C# Second argument (optional) ($2) is the picture path, ex: /usr/share/icons/MoreWaita/places/scalable/folder-c,svg# Ex: ./custom-icon /home/user/C /usr/share/icons/MoreWaita/places/scalable/folder-c.svg# If there is no second argument the icon will take the basename of the path and will be# looked for in the MOREWAITA_DIR path.# Ex: ./custom-icon /home/user/Cif [ "$del"-eq 1 ];then# Delete custom-icon attribute
[ -d"$1" ] && ci "$1" -d &&echo -e "${GREEN}$1 metadata::custom-icon attribute deleted${NC}"elseif [ $#-eq 1 ];then# Icon has the same name as the folder
i=$(basename "$1")
i=${i,,}
icon="$MOREWAITA_DIR/folder-${i}.svg"
[ -d"$1" ] && [ -f"$icon" ] && ci "$1""$icon"&&echo -e "${GREEN}$1 metadata::custom-icon attribute updated to $i.svg${NC}"
[ -d"$1" ] && [ !-f"$icon" ] &&echo -e "${RED}$icon does not exist ${NC}"elif [ $#-eq 2 ];then# Icon and folder names differ
[ -d"$1" ] && [ -f"$2" ] && ci "$1""$2"&&echo -e "${GREEN}$1 metadata::custom-icon attribute updated to $(basename "$2")${NC}"
[ -d"$1" ] && [ !-f"$2" ] &&echo -e "${RED}$(basename "$2") does not exist ${NC}"fi
[ !-d"$1" ] &&echo -e "${YELLOW}$1 folder does not exist ${NC}"fi
}
# In this case we pass a "1 argument" list because the "place icon"# uses the same name as the basename of the folderforiin Arduino FreeCAD KiCad OpenSCAD;do custom-icon "$HOME/$i";done# In this case 2-element tuples are used to link folders with "place icons",# used when folders don't match the icon nameforiin py,python games,godot;do
IFS=","read -r folder icon <<<"$i"
custom-icon "$HOME/$folder""$MOREWAITA_DIR/folder-${icon}.svg"done
The text was updated successfully, but these errors were encountered:
A while ago I made a script meant to assign icons automatically after a new installation.
So, maybe someone (a distrohopper) is interested on having a similar script to avoid doing manually all the times.
I adapted it to use the MoreWaita place icons.
The text was updated successfully, but these errors were encountered: