Skip to content

Commit

Permalink
✨ polybar[modules]: add asus-bios-version
Browse files Browse the repository at this point in the history
checks the latest available BIOS version in ASUS website and compares that with the current installed BIOS
  • Loading branch information
cristianmiranda committed Aug 7, 2024
1 parent 684f368 commit d3579de
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
10 changes: 9 additions & 1 deletion home/.config/polybar/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ separator-foreground = ${colors.disabled}

modules-left = logo i3 sxhkd-ipc hotkeys-ipc spotify-now-playing
modules-center =
modules-right = dolarblue dozer fs-root fs-home packages kernel network microphone pactl-audio brightness ups-load ups-voltage cpu-temperature cpu memory weather custom-date trayseparator spotify github thunderbird vpn do-not-disturb trayseparator
modules-right = dolarblue dozer fs-root fs-home packages kernel asus-bios-version network microphone pactl-audio brightness ups-load ups-voltage cpu-temperature cpu memory weather custom-date trayseparator spotify github thunderbird vpn do-not-disturb trayseparator

cursor-click = pointer
cursor-scroll = ns-resize
Expand Down Expand Up @@ -473,6 +473,14 @@ label = "%output%"
label-padding = 0
exec = .config/polybar/scripts/packages

[module/asus-bios-version]
type = custom/script
interval = 3600
format = <label>
label = "%output%"
click-left = "firefox --new-window https://rog.asus.com/motherboards/rog-maximus/rog-maximus-z790-hero-model/helpdesk_bios/"
exec = .config/polybar/scripts/asus-bios-version

[module/owl]
type = custom/script
format = <label>
Expand Down
20 changes: 20 additions & 0 deletions home/.config/polybar/scripts/asus-bios-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

url="https://rog.asus.com/support/webapi/product/GetPDBIOS?website=global&model=rog-maximus-z790-hero&pdid=0&m1id=21116&cpu=&LevelTagId=205902&systemCode=rog"

response=$(curl -s "$url")

clean_response=$(echo "$response" | tr -d '\n' | tr -d '\r' | tr -d '\t' | sed 's/[[:cntrl:]]//g')

latest_bios_version=$(echo "$clean_response" | jq -r '.Result.Obj[].Files[0].Version' | head -n 1)

current_bios_version=$(cat /sys/class/dmi/id/bios_version)

if [ "$latest_bios_version" != "$current_bios_version" ]; then
icon=""
color="#FF6961"
version="$latest_bios_version"
echo "%{F$color}$icon v$version%{F-}"
else
echo ""
fi

0 comments on commit d3579de

Please sign in to comment.