2023-11-04 22:33:23 -07:00
|
|
|
{{- if (eq .host.distro.family "linux") -}}
|
2023-01-09 10:28:15 -08:00
|
|
|
#!/usr/bin/env bash
|
2023-04-11 20:57:02 -07:00
|
|
|
# @file Linux Shortcut Removal
|
|
|
|
# @brief Cleans up desktop shortcuts that are out of place or unwanted on Linux devices
|
|
|
|
# @description
|
|
|
|
# This script loops through the `.removeLinuxShortcuts` value in `home/.chezmoidata.yaml` and removes
|
|
|
|
# desktop shortcuts that have been deemed to be unnecessary or obtrusive.
|
2023-01-09 10:28:15 -08:00
|
|
|
|
2023-11-04 20:56:58 -07:00
|
|
|
{{ includeTemplate "universal/profile" }}
|
|
|
|
{{ includeTemplate "universal/logg" }}
|
|
|
|
|
2023-01-09 11:20:36 -08:00
|
|
|
{{ $removeShortcuts := join " " .removeLinuxShortcuts }}
|
2023-01-09 10:28:15 -08:00
|
|
|
# shortcuts to remove: {{ $removeShortcuts }}
|
|
|
|
|
2023-11-04 21:06:36 -07:00
|
|
|
logg info 'Processing remove shortcuts step for Linux machines'
|
|
|
|
|
2023-01-09 10:28:15 -08:00
|
|
|
### Remove unnecessary desktop shortcuts
|
|
|
|
for DESKTOP_ICON in {{ $removeShortcuts }}; do
|
|
|
|
for SHORTCUT_FOLDER in {{ .host.home }}/.local/share/applications {{ .host.home }}/.local/share/applications/wine/Programs; do
|
|
|
|
if [ -f "$SHORTCUT_FOLDER/$DESKTOP_ICON" ]; then
|
|
|
|
rm -f "$SHORTCUT_FOLDER/$DESKTOP_ICON"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
for SHORTCUT_FOLDER in /usr/share/applications /usr/local/share/applications /var/lib/snapd/desktop/applications; do
|
|
|
|
if [ -f "$SHORTCUT_FOLDER/$DESKTOP_ICON" ]; then
|
|
|
|
sudo rm -f "$SHORTCUT_FOLDER/$DESKTOP_ICON"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
2023-11-04 22:33:23 -07:00
|
|
|
{{ end -}}
|