i3status_rs::blocks

Module packages

source
Expand description

Pending updates for different package manager like apt, pacman, etc.

Currently these package managers are available:

  • apt for Debian/Ubuntu based system
  • pacman for Arch based system
  • aur for Arch based system
  • dnf for Fedora based system

§Configuration

KeyValuesDefault
intervalUpdate interval in seconds.600
package_managerPackage manager to check for updatesAutomatically derived from format templates, but can be used to influence the $total value
formatA string to customise the output of this block. See below for available placeholders." $icon $total.eng(w:1) "
format_singularSame as format, but for when exactly one update is available." $icon $total.eng(w:1) "
format_up_to_dateSame as format, but for when no updates are available." $icon $total.eng(w:1) "
warning_updates_regexDisplay block as warning if updates matching regex are available.None
critical_updates_regexDisplay block as critical if updates matching regex are available.None
ignore_updates_regexDoesn’t include updates matching regex in the count.None
ignore_phased_updatesDoesn’t include potentially held back phased updates in the count. (For Debian/Ubuntu based system)false
aur_commandAUR command to check available updates, which outputs in the same format as pacman. e.g. yay -Qua (For Arch based system)Required if $aur are used
PlaceholderValueTypeUnit
iconA static iconIcon-
aptNumber of updates available in Debian/Ubuntu based systemNumber-
pacmanNumber of updates available in Arch based systemNumber-
aurNumber of updates available in Arch based systemNumber-
dnfNumber of updates available in Fedora based systemNumber-
totalNumber of updates available in all package manager listedNumber-

§Apt

Behind the scenes this uses apt, and in order to run it without root privileges i3status-rust will create its own package database in /tmp/i3rs-apt/ which may take up several MB or more. If you have a custom apt config then this block may not work as expected - in that case please open an issue.

Tip: You can grab the list of available updates using APT_CONFIG=/tmp/i3rs-apt/apt.conf apt list --upgradable

§Pacman

Requires fakeroot to be installed (only required for pacman).

Tip: You can grab the list of available updates using fakeroot pacman -Qu --dbpath /tmp/checkup-db-i3statusrs-$USER/. If you have the CHECKUPDATES_DB env var set on your system then substitute that dir instead.

Note: pikaur may hang the whole block if there is no internet connectivity reference. In that case, try a different AUR helper.

§Pacman hook

Tip: On Arch Linux you can setup a pacman hook to signal i3status-rs to update after packages have been upgraded, so you won’t have stale info in your pacman block.

In the block configuration, set signal = 1 (or other number if 1 is being used by some other block):

[[block]]
block = "packages"
signal = 1

Create /etc/pacman.d/hooks/i3status-rust.hook with the below contents:

[Trigger]
Operation = Upgrade
Type = Package
Target = *

[Action]
When = PostTransaction
Exec = /usr/bin/pkill -SIGRTMIN+1 i3status-rs

§Example

Apt only config

[[block]]
block = "packages"
interval = 1800
package_manager = ["apt"]
format = " $icon $apt updates available"
format_singular = " $icon One update available "
format_up_to_date = " $icon system up to date "
[[block.click]]
# shows dmenu with cached available updates. Any dmenu alternative should also work.
button = "left"
cmd = "APT_CONFIG=/tmp/i3rs-apt/apt.conf apt list --upgradable | tail -n +2 | rofi -dmenu"
[[block.click]]
# Updates the block on right click
button = "right"
update = true

Pacman only config:

[[block]]
block = "packages"
package_manager = ["pacman"]
interval = 600
format = " $icon $pacman updates available "
format_singular = " $icon $pacman update available "
format_up_to_date = " $icon system up to date "
[[block.click]]
# pop-up a menu showing the available updates. Replace wofi with your favourite menu command.
button = "left"
cmd = "fakeroot pacman -Qu --dbpath /tmp/checkup-db-i3statusrs-$USER/ | wofi --show dmenu"
[[block.click]]
# Updates the block on right click
button = "right"
update = true

Pacman and AUR helper config:

[[block]]
block = "packages"
package_manager = ["pacman", "aur"]
interval = 600
error_interval = 300
format = " $icon $pacman + $aur = $total updates available "
format_singular = " $icon $total update available "
format_up_to_date = " $icon system up to date "
# aur_command should output available updates to stdout (ie behave as echo -ne "update\n")
aur_command = "yay -Qua"

Dnf only config:

[[block]]
block = "packages"
package_manager = ["dnf"]
interval = 1800
format = " $icon $dnf.eng(w:1) updates available "
format_singular = " $icon One update available "
format_up_to_date = " $icon system up to date "
[[block.click]]
# shows dmenu with cached available updates. Any dmenu alternative should also work.
button = "left"
cmd = "dnf list -q --upgrades | tail -n +2 | rofi -dmenu"

Multiple package managers config:

Update the list of pending updates every thirty minutes (1800 seconds):

[[block]]
block = "packages"
package_manager = ["apt", "pacman", "aur","dnf"]
interval = 1800
format = " $icon $apt + $pacman + $aur + $dnf = $total updates available "
format_singular = " $icon One update available "
format_up_to_date = " $icon system up to date "
# If a linux update is available, but no ZFS package, it won't be possible to
# actually perform a system upgrade, so we show a warning.
warning_updates_regex = "(linux|linux-lts|linux-zen)"
# If ZFS is available, we know that we can and should do an upgrade, so we show
# the status as critical.
critical_updates_regex = "(zfs|zfs-lts)"

§Icons Used

  • update

Modules§

Structs§

Enums§

Traits§

Functions§