From f00afe0cf147b3ce948493267d828923e243d75e Mon Sep 17 00:00:00 2001
From: hunabku94 <135148639+hunabku94@users.noreply.github.com>
Date: Wed, 25 Sep 2024 11:30:20 +0200
Subject: [PATCH 1/4] Add dark and blue color version icons
---
src/icons/arch-update-blue.svg | 21 ++++++++++++++++
src/icons/arch-update-dark.svg | 21 ++++++++++++++++
.../arch-update_updates-available-blue.svg | 25 +++++++++++++++++++
.../arch-update_updates-available-dark.svg | 25 +++++++++++++++++++
4 files changed, 92 insertions(+)
create mode 100644 src/icons/arch-update-blue.svg
create mode 100644 src/icons/arch-update-dark.svg
create mode 100644 src/icons/arch-update_updates-available-blue.svg
create mode 100644 src/icons/arch-update_updates-available-dark.svg
diff --git a/src/icons/arch-update-blue.svg b/src/icons/arch-update-blue.svg
new file mode 100644
index 00000000..627dd4e0
--- /dev/null
+++ b/src/icons/arch-update-blue.svg
@@ -0,0 +1,21 @@
+
+
diff --git a/src/icons/arch-update-dark.svg b/src/icons/arch-update-dark.svg
new file mode 100644
index 00000000..e69cdb29
--- /dev/null
+++ b/src/icons/arch-update-dark.svg
@@ -0,0 +1,21 @@
+
+
diff --git a/src/icons/arch-update_updates-available-blue.svg b/src/icons/arch-update_updates-available-blue.svg
new file mode 100644
index 00000000..7f93ebb8
--- /dev/null
+++ b/src/icons/arch-update_updates-available-blue.svg
@@ -0,0 +1,25 @@
+
+
diff --git a/src/icons/arch-update_updates-available-dark.svg b/src/icons/arch-update_updates-available-dark.svg
new file mode 100644
index 00000000..edc7851b
--- /dev/null
+++ b/src/icons/arch-update_updates-available-dark.svg
@@ -0,0 +1,25 @@
+
+
From 4ab4015ff7daf5434468e53dfcb3a585f60f64e9 Mon Sep 17 00:00:00 2001
From: Robin Candau
Date: Wed, 25 Sep 2024 14:30:23 +0200
Subject: [PATCH 2/4] feat: Add dark and blue variants to the systray icon set
and add the "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 https://github.com/Antiz96/arch-update/issues/240
---
README-fr.md | 1 +
README.md | 1 +
doc/man/arch-update.conf.5 | 4 ++++
doc/man/fr/arch-update.conf.5 | 4 ++++
res/config/arch-update.conf.example | 1 +
src/icons/{arch-update.svg => arch-update-light.svg} | 0
...lable.svg => arch-update_updates-available-light.svg} | 0
src/lib/common.sh | 9 +++++++--
src/lib/config.sh | 5 +++++
9 files changed, 23 insertions(+), 2 deletions(-)
rename src/icons/{arch-update.svg => arch-update-light.svg} (100%)
rename src/icons/{arch-update_updates-available.svg => arch-update_updates-available-light.svg} (100%)
diff --git a/README-fr.md b/README-fr.md
index 7c76421b..cdbcfe61 100644
--- a/README-fr.md
+++ b/README-fr.md
@@ -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.
```
diff --git a/README.md b/README.md
index 7e408727..3810c58e 100644
--- a/README.md
+++ b/README.md
@@ -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.
```
diff --git a/doc/man/arch-update.conf.5 b/doc/man/arch-update.conf.5
index 9e4b3cda..0c4a2e75 100644
--- a/doc/man/arch-update.conf.5
+++ b/doc/man/arch-update.conf.5
@@ -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)
diff --git a/doc/man/fr/arch-update.conf.5 b/doc/man/fr/arch-update.conf.5
index ea4c00fb..ad72f233 100644
--- a/doc/man/fr/arch-update.conf.5
+++ b/doc/man/fr/arch-update.conf.5
@@ -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)
diff --git a/res/config/arch-update.conf.example b/res/config/arch-update.conf.example
index ef0875df..5c36819c 100644
--- a/res/config/arch-update.conf.example
+++ b/res/config/arch-update.conf.example
@@ -11,3 +11,4 @@
#PrivilegeElevationCommand=sudo
#DiffProg=$DIFFPROG
#AURHelper=paru
+#TrayIconStyle=light
diff --git a/src/icons/arch-update.svg b/src/icons/arch-update-light.svg
similarity index 100%
rename from src/icons/arch-update.svg
rename to src/icons/arch-update-light.svg
diff --git a/src/icons/arch-update_updates-available.svg b/src/icons/arch-update_updates-available-light.svg
similarity index 100%
rename from src/icons/arch-update_updates-available.svg
rename to src/icons/arch-update_updates-available-light.svg
diff --git a/src/lib/common.sh b/src/lib/common.sh
index af6502a0..65300938 100755
--- a/src/lib/common.sh
+++ b/src/lib/common.sh
@@ -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"
}
diff --git a/src/lib/config.sh b/src/lib/config.sh
index 237c02d2..3520a058 100755
--- a/src/lib/config.sh
+++ b/src/lib/config.sh
@@ -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
From 0c70508fa40f3cb2bbe6afad9f9c05c723cf053b Mon Sep 17 00:00:00 2001
From: Robin Candau
Date: Wed, 25 Sep 2024 14:34:48 +0200
Subject: [PATCH 3/4] style: Add missing double quotes
---
src/lib/common.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lib/common.sh b/src/lib/common.sh
index 65300938..da689110 100755
--- a/src/lib/common.sh
+++ b/src/lib/common.sh
@@ -124,7 +124,7 @@ if [ -n "${diff_prog}" ]; then
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
+if [ -z "${tray_icon_style}" ]; then
tray_icon_style="light"
fi
From 34f00ab7c0400329dffa1ac41c5f4b4ea1c3a34a Mon Sep 17 00:00:00 2001
From: Robin Candau
Date: Wed, 25 Sep 2024 14:40:52 +0200
Subject: [PATCH 4/4] style: typo fixes
---
README.md | 2 +-
doc/man/arch-update.conf.5 | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 3810c58e..5edbdcd3 100644
--- a/README.md
+++ b/README.md
@@ -221,7 +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".
+- TrayIconStyle=[Style/Color] # Style to be used for the systray applet icon. Valid options are the available style/color variants 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.
```
diff --git a/doc/man/arch-update.conf.5 b/doc/man/arch-update.conf.5
index 0c4a2e75..1b7d03d9 100644
--- a/doc/man/arch-update.conf.5
+++ b/doc/man/arch-update.conf.5
@@ -57,7 +57,7 @@ AUR helper to be used for AUR packages support. Valid options are paru or yay. I
.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".
+Style to be used for the systray applet icon. Valid options are the available style/color variants 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)