Skip to content

Commit

Permalink
feat: Add dark and blue variants to the systray icon set and add the …
Browse files Browse the repository at this point in the history
…"TrayIconStyle" option in arch-update.conf

Add the following style/color variants to the systray applet icon set:

- dark (Useful to make the systray applet icon more visible when using a light theme)
- blue (Matches the blue variant used by the official Arch Linux logo)

Add the `TrayIconStyle` option in the `arch-update.conf` configuration file to select which icon style/color variants to use (e.g. `TrayIconStyle=dark`).
Defaults to `light`.

Closes #240
  • Loading branch information
Antiz96 committed Sep 25, 2024
1 parent cd0298d commit 4ab4015
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 2 deletions.
1 change: 1 addition & 0 deletions README-fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ Les options prises en charge sont :
- PrivilegeElevationCommand=[Cmd] # Commande à utiliser pour l'élévation de privilège. Les options valides sont `sudo`, `doas` ou `run0`. Si cette option n'est pas spécifiée, Arch-Update utilisera la première commande disponible dans l'odre suivant : `sudo`, `doas` puis `run0`.
- DiffProg=[Editeur] # Editeur à utiliser pour visualiser/editer les différences durant le traitement des fichiers pacnew. La valeur par défaut est la valeur de la variable d'environnement `$DIFFPROG` (ou `vimdiff` si `$DIFFPROG` n'est pas paramétrée). Notez qu'en raison de l'absence d'option pour préserver les variables d'environnement dans `doas`, cette option sera ignorée lors de l'utilisation de `doas` comme méthode d'élévation de privilèges.
- AURHelper=[AUR Helper] # AUR helper à utiliser pour la prise en charge des paquets AUR. Les options valides sont `paru` ou `yay`. Si cette option n'est pas spécifiée, Arch-Update utilisera le premier AUR helper disponible dans l'ordre suivant : `paru` puis `yay` (si aucun des deux n'est installé, Arch-Update ne prendra pas en compte les paquets AUR).
- TrayIconStyle=[Style/Color] # Style à utiliser pour l'icône de l'applet systray. Les options valides sont les variantes de style/couleur disponibles pour le set d'icône, listées ici : https://github.com/Antiz96/arch-update/tree/main/src/icons. La valeur par défaut est "light".
Les options sont sensibles à la casse, les majuscules doivent donc être respectées.
```
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ The supported options are:
- PrivilegeElevationCommand=[Cmd] # Command to be used for privilege elevation. Valid options are `sudo`, `doas` or `run0`. If this option is not set, Arch-Update will use the first available command in the following order: `sudo`, `doas` then `run0`.
- DiffProg=[Editor] # Editor to use to visualize/edit differences during the pacnew files processing. Defaults to the `$DIFFPROG` environment variable's value (or `vimdiff` if `$DIFFPROG` isn't set). Note that, due to the lack of option to preserve environment variable in `doas`, this option will be ignored when using `doas` as the privilege elevation method.
- AURHelper=[AUR Helper] # AUR helper to be used for AUR packages support. Valid options are `paru` or `yay`. If this option is not set, Arch-Update will use the first available AUR helper in the following order: `paru` then `yay` (in case none of them is installed, Arch-Update will not take AUR packages into account).
- TrayIconStyle=[Style/Color] # Style to be used for the systray applet icon. Valid options are the available style/color variant for the icon set, listed in https://github.com/Antiz96/arch-update/tree/main/src/icons. Defaults to "light".
Options are case sensitive, so capital letters have to be respected.
```
Expand Down
4 changes: 4 additions & 0 deletions doc/man/arch-update.conf.5
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ Command to be used for privilege elevation. Valid options are sudo, doas or run0
.B AURHelper=[AUR Helper]
AUR helper to be used for AUR packages support. Valid options are paru or yay. If this option is not set, Arch-Update will use the first installed AUR helper in the following order: paru then yay (in case none of them is installed, Arch-Update will not take AUR packages into account).

.TP
.B TrayIconStyle=[Style/Color]
Style to be used for the systray applet icon. Valid options are the available style/color variant for the icon set, listed in https://github.com/Antiz96/arch-update/tree/main/src/icons. Defaults to "light".

.SH SEE ALSO
.BR arch-update (1)

Expand Down
4 changes: 4 additions & 0 deletions doc/man/fr/arch-update.conf.5
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ Commande à utiliser pour l'élévation de privilège. Les options valides sont
.B AURHelper=[AUR Helper]
AUR helper à utiliser pour la prise en charge des paquets AUR. Les options valides sont paru ou yay. Si cette option n'est pas spécifiée, Arch-Update utilisera le premier AUR helper disponible dans l'ordre suivant : paru puis yay (si aucun des deux n'est installé, Arch-Update ne prendra pas en compte les paquets AUR).

.TP
.B TrayIconStyle=[Style/Color]
Style à utiliser pour l'icône de l'applet systray. Les options valides sont les variantes de style/couleur disponibles pour le set d'icône, listées ici : https://github.com/Antiz96/arch-update/tree/main/src/icons. La valeur par défaut est "light".

.SH VOIR AUSSI
.BR arch-update (1)

Expand Down
1 change: 1 addition & 0 deletions res/config/arch-update.conf.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
#PrivilegeElevationCommand=sudo
#DiffProg=$DIFFPROG
#AURHelper=paru
#TrayIconStyle=light
File renamed without changes
9 changes: 7 additions & 2 deletions src/lib/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,19 @@ if [ -n "${diff_prog}" ]; then
fi
fi

# Definition of the tray icon style to use (default to "light" if it isn't set in the arch-update.conf configuration file)
if [ -z ${tray_icon_style} ]; then
tray_icon_style="light"
fi

# Definition of the icon_up-to-date function: Change icon to "up to date"
icon_up-to-date() {
# shellcheck disable=SC2154
echo "${name}" > "${statedir}/tray_icon"
echo "${name}-${tray_icon_style}" > "${statedir}/tray_icon"
}

# Definition of the icon_updates-available function: Change tray icon to "updates available"
icon_updates-available() {
# shellcheck disable=SC2154
echo "${name}_updates-available" > "${statedir}/tray_icon"
echo "${name}_updates-available-${tray_icon_style}" > "${statedir}/tray_icon"
}
5 changes: 5 additions & 0 deletions src/lib/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,8 @@ if grep -Eq '^[[:space:]]*AURHelper[[:space:]]*=[[:space:]]*(paru|yay)[[:space:]
# shellcheck disable=SC2034
aur_helper=$(grep -E '^[[:space:]]*AURHelper[[:space:]]*=[[:space:]]*(paru|yay)[[:space:]]*$' "${config_file}" 2> /dev/null | awk -F '=' '{print $2}' | tr -d '[:space:]')
fi

if grep -Eq '^[[:space:]]*TrayIconStyle[[:space:]]*=[[:space:]]*(light|dark|blue)[[:space:]]*$' "${config_file}" 2> /dev/null; then
# shellcheck disable=SC2034
tray_icon_style=$(grep -E '^[[:space:]]*TrayIconStyle[[:space:]]*=[[:space:]]*(light|dark|blue)[[:space:]]*$' "${config_file}" 2> /dev/null | awk -F '=' '{print $2}' | tr -d '[:space:]')
fi

0 comments on commit 4ab4015

Please sign in to comment.