Skip to content

Commit

Permalink
[eos-update-notifier] streamlined code for icons
Browse files Browse the repository at this point in the history
  • Loading branch information
manuel-192 committed Oct 5, 2023
1 parent b464baa commit 93c3644
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
4 changes: 2 additions & 2 deletions eos-update-notifier/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
pkgname=eos-update-notifier
pkgdesc="Software update notifier and 'news for you' for EndeavourOS users."
pkgver=23
pkgrel=15
pkgrel=16
arch=('any')
license=('GPL')
depends=(eos-bash-shared pacman-contrib xdg-utils libnotify)
Expand Down Expand Up @@ -34,7 +34,7 @@ source=(
$_url/$pkgname.service
$_url/checkupdatesext
)
sha512sums=('e6c5885c0789ff673b46aabca297661638ce1acb16a1b83385cb3ea30b4895ba15aa4f4cb1448158aa3d838da727463ece8c11c06f8675c436ec044292646f0f'
sha512sums=('5d7e2312bf93226f240a8e7c2970e88c01acf370d4c77ab088b8ec6b0be9a4fb7e85bf5ae70a591878257951794757edc394cd70f3dfaa61e578ba8f60a26806'
'8873c225c650f272221e8057b28bb6bd917e6da1e97baa79eafe42e8f1e7efb485dc094d66cba55fe4cc7421a556048e0ae171371766d36d7dfe8add79ac6e3d'
'd046e675f98a52b9c310e970c5a0b0bc92b08b60d55b9d39140516977e8a6ceb4b3f9d9b05d12fce377b5744f4563e5e66a86ceecafb57f5bd486f968dc57234'
'27acf7725d0e760b9dbc9d96e7dabf64339214163615155ae4fe2b4999c741e15590fc708866d830c584e321d7298d0ed5d0566adb6791c09c743289dbbebd6a'
Expand Down
31 changes: 15 additions & 16 deletions eos-update-notifier/eos-update-notifier
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ export -f eos_yad_DIE
export -f eos_yad_WARN
#######################################################################

AssignIconVariables_in_eos_bash_shared # get common icons

ICO_UPDATE_AVAILABLE=$(eos_icon_path apps software-update-available) # app specific icons

# ICO_UPDATE_AVAILABLE=/usr/share/icons/Qogir/scalable/apps/software-update-available.svg

eos_un_log() {
local date="$(/usr/bin/date '+%x %X')"
echo "" >> $EOS_UPDATE_NOTIFIER_LOG
Expand Down Expand Up @@ -63,7 +69,7 @@ YadNonFocused() {

ShowTray() {
# Tray notification may have issues on EOS...
eos_yad --notification --image="$_UpdateNotifyIcon" \
eos_yad --notification --image="$ICO_UPDATE_AVAILABLE" \
--text="$progname: $update_count $source updates are available at $date"
}
ShowNotify() {
Expand All @@ -89,7 +95,7 @@ ShowNotify() {
local bop=update
local bname=Update
local action=$(eos_notification \
"$_UpdateNotifyIcon" \
"$ICO_UPDATE_AVAILABLE" \
"normal" \
"$expiretime" \
"EndeavourOS Update Notifier" \
Expand All @@ -114,7 +120,7 @@ ShowNotify() {
;;
"notify+tray")
eos_notification \
"$_UpdateNotifyIcon" \
"$ICO_UPDATE_AVAILABLE" \
"normal" \
"$expiretime" \
"EndeavourOS Update Notifier" \
Expand All @@ -128,13 +134,6 @@ ShowNonFocused() {
local date="$(/usr/bin/date '+%x %X')"
local source="$1"
local pkgs="\n<tt>$updates</tt>" # for notify and notify+tray
local _UpdateNotifyIcon

if [ -n "UpdateNotifyIcon" ] ; then
_UpdateNotifyIcon="$UpdateNotifyIcon"
else
_UpdateNotifyIcon=system-software-update
fi

if [ "$pkgsonly" = "yes" ] ; then # cmd line options override config file options
ShowHowAboutUpdates=window
Expand Down Expand Up @@ -221,7 +220,7 @@ Update_common() {
eos-kernel-nvidia-update-check $(echo "$updates" | tail -n +3 | awk '{print $1}') 2> $tmpfile || {
cat $tmpfile | eos_yad_problem "Warning" --text="Update conflict detected. Do you want to continue (not recommended)?" \
--width=800 --height=300 \
--button=' Continue!system-run!Ignore this warning and continue':2
--button=' Continue!$ICO_OPERATION_TEST!Ignore this warning and continue':2
retvalue=$?
case "$retvalue" in
0) retvalue=1 ;; # eos_yad_problem returns 0 when quitting!
Expand Down Expand Up @@ -305,13 +304,13 @@ Update_common() {
eos_yad --form \
--title="EndeavourOS update notifier" --text="$msg" \
--timeout=10 --timeout-indicator=left \
--image=dialog-information --width=350 --no-focus \
--image="$ICO_INFO" --width=350 --no-focus \
--button=yad-quit:0
else
echo "$msg" | \
eos_yad --text-info --title="EndeavourOS update notifier" --no-focus \
--height=100 --width=350 --timeout=10 --timeout-indicator=left \
--theme="Classic" --tail --button=yad-quit:0 --image=info
--theme="Classic" --tail --button=yad-quit:0 --image="$ICO_INFO"
fi
fi
fi
Expand Down Expand Up @@ -528,7 +527,7 @@ Configure() {
--form
--title="Configure update checking"
--text="$progname: configure the schedule of system update checks."
--image=preferences-system
--image="$ICO_PREFERENCES_SYSTEM"
--field="Check period!How often checks will be executed":CB "$times"
--field="Check always after system startup!Enable/disable update check right after boot":CHK "$onstartupsec"
--field="Persistent!When selected, if a check is missed, the check will be executed as soon as possible":CHK "$persistent"
Expand All @@ -554,7 +553,7 @@ Configure() {
local defaultperiod=daily
cmd=(
eos_yad --list --radiolist --column=Select --column=Period --width=400 --height=250
--image=preferences-system
--image="$ICO_PREFERENCES_SYSTEM"
--title="Configure update check schedule"
--text="Select the period for system updates"
--button="Set to default":10 --button=yad-cancel:1 --button=yad-ok:0
Expand Down Expand Up @@ -681,7 +680,7 @@ yad_infomsg() {
local title="$2"
test -n "$title" || title="Info"
echo2 "$title: $msg"
eos_yad --form --text="$msg" --title="$title" --button=yad-ok:0 --image=info
eos_yad --form --text="$msg" --title="$title" --button=yad-ok:0 --image="$ICO_INFO"
}

Main()
Expand Down

0 comments on commit 93c3644

Please sign in to comment.