Skip to content

Instantly share code, notes, and snippets.

@mmozeiko
Last active February 11, 2026 11:37
Show Gist options
  • Select an option

  • Save mmozeiko/d4839858ad8624aec8b0f8679c4233af to your computer and use it in GitHub Desktop.

Select an option

Save mmozeiko/d4839858ad8624aec8b0f8679c4233af to your computer and use it in GitHub Desktop.
Argon ONE UP extras

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.

First time setup

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

Battery

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:

image

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:

image

Screen Brightness

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": " {}%"
},

Volume keys

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%+

PrtScr button

Bind PrtScr key to capture screenshots with grimshot (from sway-contrib) - it will place screenshot into clipboard:

bindsym Print exec grimshot copy anything

Shutdown on LID close event

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.

@rbm78bln
Copy link

Great work! Thank you!

Which kernel are you using?
The one in ArchLinux ARM or the one from RaspiOS/trixie?

@mmozeiko
Copy link
Author

I am using linux-rpi-16k from archlinux arm.

@dukla2000
Copy link

Thanks for logging your work. I saw your post on Kickstarter and have gratefully borrowed some of your ideas!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment