Skip to content

installation

dwl installation

sudo pacman -S wlroots wayland-protocols xorg-xwayland kitty keyd wmenu slurp grim wl-clipboard fcft tllist libnotify dunst tesseract-data-eng ranger python-pillow ttf-sarasa-gothic noto-fonts noto-fonts-emoji
cd ~/admin
lftp -c 'mirror --paralel=100 configs.vectorspace.xyz/dwl; exit'
chmod +x bin/*

someblocks installation

lftp -c 'mirror --paralel=100 configs.vectorspace.xyz/someblocks; exit'
cd someblocks
chmod +x blocks/*
chmod +x scripts/route-monitor.sh

Setup these files for battery monitoring:

/etc/udev/rules.d/90-battery-monitor.rules
# Rule for when switching to battery
ACTION=="change", SUBSYSTEM=="power_supply", ATTRS{type}=="Mains", ATTRS{online}=="0", \
    RUN+="/bin/sh -c 'pgrep someblocks >/dev/null && pkill -SIGRTMIN+10 someblocks || true'"

# Rule for when switching to AC
ACTION=="change", SUBSYSTEM=="power_supply", ATTRS{type}=="Mains", ATTRS{online}=="1", \
    RUN+="/bin/sh -c 'pgrep someblocks >/dev/null && pkill -SIGRTMIN+10 someblocks || true'"

Reload udev:

sudo udevadm control --reload-rules
sudo udevadm trigger

Setup these files for default ip interface/route monitoring:

~/.config/systemd/user/route-monitor.service
[Unit]
Description=Monitor IP route changes
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
ExecStart=%h/admin/someblocks/scripts/route-monitor.sh
Restart=always
RestartSec=3

[Install]
WantedBy=default.target
~/.config/systemd/user/route-monitor.sh
#!/bin/bash
# Save as route-monitor.sh

ip monitor route | while read line; do
    # Check if the line contains information about the default route
    if [[ "$line" == *"default"* ]]; then
        echo "Default route changed: $line" | logger -t route-monitor

        # Add your commands here
        # For example, to send a signal to someblocks:
        pgrep someblocks >/dev/null && pkill -SIGRTMIN+15 someblocks

        # Or run any other script/command:
        # /path/to/your/script.sh
    fi
done

startup command

dbus-run-session sh -c 'someblocks -p | dwl'

Note:

  1. dbus-run-session can only take a single command, so we use sh -c since we need more.
  2. someblocks has to print to the stdout, hence someblocks -p
  3. the result of someblocks -p has to be piped to dwl.

Comments