Skip to content

Instantly share code, notes, and snippets.

@vicente-gonzalez-ruiz
Last active January 2, 2024 18:17
Show Gist options
  • Save vicente-gonzalez-ruiz/fbf57dad9f23b189c3d8e55c37519eff to your computer and use it in GitHub Desktop.
Save vicente-gonzalez-ruiz/fbf57dad9f23b189c3d8e55c37519eff to your computer and use it in GitHub Desktop.

Tuning i3

(At least in Manjaro Linux) By default, after install i3, the config file is placed at:

~/.i3/config

To add some new entry to i3status (whose output is usually placed at the bottom-right of the screen):

  1. Create a new shell script with the following content:
#!/bin/sh
# Store me at ~/.i3/extended_status.sh
i3status | while :
do
    read line
    free_mem="`awk '/MemFree/ {print int($2/1024)}' /proc/meminfo`"
    free_swp="`awk '/SwapFree/ {print int($2/1024)}' /proc/meminfo`"
    rx_bytes=`cat /sys/class/net/wlp58s0/statistics/rx_bytes`
    rx_dif="`echo $rx_bytes - $old_rx_bytes | bc`"
    rx_dif=`echo $rx_dif / 1000 | bc`
    tx_bytes=`cat /sys/class/net/wlp58s0/statistics/tx_bytes`
    tx_dif="`echo $tx_bytes - $old_tx_bytes | bc`"
    tx_dif=`echo $tx_dif / 1000 | bc`
    backlight=`/usr/bin/xbacklight`
    backlight=`echo $backlight / 1 | bc`%
    echo "↑ $tx_dif kbps | ↓ $rx_dif kbps | $free_mem $free_swp MB | ☀ $backlight | $line"
    old_rx_bytes=$rx_bytes
    old_tx_bytes=$tx_bytes
done
  1. Modify the i3 config file such as:
bar {
        #status_command i3status
        status_command ~/.config/i3/extended_status.sh # ~/.i3/extended_status.sh
}
  1. chmod +x ~/.config/i3/extended_status.sh.

  2. Restart i3.

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