NOTE: I use ArchLinux ARM with sway wayland window manager and pipewire for audio.
All of the functionality here works with NO need to run argononeup.sh script.
As a one time setup, update pi bootloader EEPROM configuration:
sudo pacman -S rpi5-eeprom
sudo rpi-eeprom-config -e
# add following line at the end
PSU_MAX_CURRENT=5000
# save and exit/reboot
Enable i2c in /boot/config.txt configuration:
dtparam=i2c=on
Install ddcutil, i2c-tools and libgpiod packages and add your user to i2c group:
sudo pacman -S ddcutil i2c-tools libgpiod
sudo gpasswd -a ${USER} i2c
Query battery level (0..100):
printf "%d\n" $(i2cget -y 1 0x64 0x04)
Check if battery is charging or discharging:
[[ $(i2cget -y 1 0x64 0x0e) -lt 0x80 ]] && echo "charging" || echo "discharging"
Bind keyboard battery key in sway config to show desktop notification with battery level/status:
bindsym Pause exec notify-send -- "$(printf "Battery: %d%% (%s)" $(i2cget -y 1 0x64 0x04) $( [[ $(i2cget -y 1 0x64 0x0e) -lt 0x80 ]] && echo charging || echo discharging) )"
Example how it will look like with mako:
Show battery level in waybar, add this to config (updated once a minute):
"custom/battery": {
"exec": "printf \"{\\\"class\\\":\\\"%s\\\", \\\"percentage\\\": %d}\" $( [[ $(i2cget -y 1 0x64 0x0e) -lt 0x80 ]] && echo charging || echo discharging) $(i2cget -y 1 0x64 0x04)",
"return-type": "json",
"interval": 60,
"format": "{icon} {percentage}%",
"format-icons": ["", "", "", "", ""]
},
Plus set color to green when battery is charging, in waybar styles.css:
#custom-battery.charging {
color: #4f4;
}
Example how it will look like next to screen brightness value (see below), it uses font awesome for icons:
Query current screen brightness (0..100):
ddcutil --skip-ddc-checks --disable-dynamic-sleep --sleep-multiplier 0.1 --brief getvcp 10 | cut -d ' ' -f 4
Set screen brightness (0..100):
ddcutil --skip-ddc-checks --disable-dynamic-sleep --sleep-multiplier 0.1 --noverify setvcp 10 ${BRIGHTNESS}
Add brightness keys to sway config, change brightness up/down in 5% increments and notify waybar to update value:
bindsym XF86MonBrightnessDown exec "ddcutil --skip-ddc-checks --disable-dynamic-sleep --sleep-multiplier 0.1 --noverify setvcp 10 + 5; pkill -SIGRTMIN+1 waybar"
bindsym XF86MonBrightnessUp exec "ddcutil --skip-ddc-checks --disable-dynamic-sleep --sleep-multiplier 0.1 --noverify setvcp 10 - 5; pkill -SIGRTMIN+1 waybar"
Show screen brightness level in waybar, add this to config:
"custom/brightness": {
"exec": "ddcutil --disable-dynamic-sleep --sleep-multiplier 0.1 getvcp 10 --brief --skip-ddc-checks | cut -d ' ' -f 4",
"signal": 1,
"interval": 60,
"format": " {}%"
},
Mute/up/down keys work out of the box with wireplumber, add this in sway config:
bindsym XF86AudioMute exec wpctl set-mute '@DEFAULT_SINK@' toggle
bindsym XF86AudioLowerVolume exec wpctl set-volume '@DEFAULT_SINK@' 5%-
bindsym XF86AudioRaiseVolume exec wpctl set-volume '@DEFAULT_SINK@' 5%+
Bind PrtScr key to capture screenshots with grimshot (from sway-contrib) - it will place screenshot into clipboard:
bindsym Print exec grimshot copy anything
To shut down laptop when lid is closed for more than 3 minutes, use following helper script:
sudo tee /usr/local/bin/argon_lid_monitor >/dev/null <<'EOF'
#!/bin/bash
# in minutes
SHUTDOWN_TIMEOUT=3
# do not change these
GPIO_CHIP=gpiochip0
GPIO_LINE=GPIO27
gpiomon -b pull-up -c ${GPIO_CHIP} -F "%E" ${GPIO_LINE} | while read -r LINE;
do
if [[ "${LINE}" == "rising" && -v SHUTDOWN_PENDING ]]; then
echo "Lid is open, canceling pending shutdown!"
shutdown -c
unset SHUTDOWN_PENDING
elif [[ "${LINE}" == "falling" && ! -v SHUTDOWN_PENDING ]]; then
echo "Lid is closed, scheduling shutdown..."
shutdown -h +${SHUTDOWN_TIMEOUT}
SHUTDOWN_PENDING=1
fi
done
EOF
Make it executable:
sudo chmod +x /usr/local/bin/argon_lid_monitor
Then create systemd service file:
sudo tee /etc/systemd/system/argon_lid_monitor.service >/dev/null <<EOF
[Unit]
Description=Argon ONE UP Lid Monitoring
[Service]
Type=simple
ExecStart=/usr/local/bin/argon_lid_monitor
[Install]
WantedBy=multi-user.target
EOF
And enable service to run at boot:
sudo systemctl daemon-reload
sudo systemctl enable --now argon_lid_monitor
To change timeout, edit the /usr/local/bin/argon_lid_monitor file and restart the service.
Great work! Thank you!
Which kernel are you using?
The one in ArchLinux ARM or the one from RaspiOS/trixie?