aboutsummaryrefslogtreecommitdiff
path: root/.config
diff options
context:
space:
mode:
Diffstat (limited to '.config')
-rw-r--r--.config/eww/eww.scss4
-rw-r--r--.config/eww/eww.yuck10
-rwxr-xr-x.config/eww/scripts/freebsd-updates.sh39
3 files changed, 46 insertions, 7 deletions
diff --git a/.config/eww/eww.scss b/.config/eww/eww.scss
index d3cba0b..ae85d45 100644
--- a/.config/eww/eww.scss
+++ b/.config/eww/eww.scss
@@ -38,12 +38,12 @@
padding-right: 10px;
}
-.apk {
+.pkg {
color: #98971a;
padding-right: 10px;
}
-.apk-empty {
+.pkg-empty {
color: #98971a;
padding-right: 0px;
}
diff --git a/.config/eww/eww.yuck b/.config/eww/eww.yuck
index 4db3241..127714e 100644
--- a/.config/eww/eww.yuck
+++ b/.config/eww/eww.yuck
@@ -91,15 +91,15 @@
(defwidget updates []
(box
- :class "${matches(chimera-updates, '^\s*$')?'apk-empty':'apk'}"
+ :class "${matches(freebsd-updates, '^\s*$')?'pkg-empty':'pkg'}"
:orientation "h"
:space-evenly false
:halign "end"
:spacing 10
(button
:class ""
- :onclick "foot bash -c 'doas apk upgrade; ~/.config/eww/scripts/chimera-updates.sh Refresh'&"
- chimera-updates)
+ :onclick "foot bash -c 'doas pkg upgrade; ~/.config/eww/scripts/freebsd-updates.sh Refresh'&"
+ freebsd-updates)
))
(defwidget idleinhibit []
@@ -153,8 +153,8 @@
(defpoll idle :interval "1s"
"scripts/idleinhibit.sh")
-(defpoll chimera-updates :interval "600s"
- "scripts/chimera-updates.sh")
+(defpoll freebsd-updates :interval "600s"
+ "scripts/freebsd-updates.sh")
(defpoll volume :interval "1s"
"scripts/volumecontrol")
diff --git a/.config/eww/scripts/freebsd-updates.sh b/.config/eww/scripts/freebsd-updates.sh
new file mode 100755
index 0000000..aadb5cf
--- /dev/null
+++ b/.config/eww/scripts/freebsd-updates.sh
@@ -0,0 +1,39 @@
+#!/usr/bin/env bash
+
+function CheckUpdates() {
+pkg upgrade -n | awk '/Installed packages to be UPGRADED:/{p=1}/^ *$/{p=0}p' | tail -n +2 1> /tmp/freebsd-updates
+updates="$(cat /tmp/freebsd-updates | awk '{ print $1 }')"
+number=$(cat /tmp/freebsd-updates | wc -l | xargs)
+
+if [ "$number" -gt 0 ]; then
+ text=" $number"
+else
+ text=""
+fi
+
+echo "$text"
+}
+
+function RefreshUpdates() {
+ value="$(CheckUpdates)"
+ eww update freebsd-updates="$value"
+}
+
+function Update() {
+ foot bash -c 'doas pkg upgrade'
+ RefreshUpdates
+}
+
+case "$1" in
+ Refresh)
+ RefreshUpdates
+ exit 0
+ ;;
+ Update)
+ Update
+ exit 0
+ ;;
+ *)
+ CheckUpdates
+ exit 0
+esac