#!/bin/bash set-conky-update-interval() { sed -ri 's#^(update_interval) = .*,#\1 = '"$1"',#' ~/.i3/conkyrc-perl } if [[ $# -gt 0 ]]; then set-conky-update-interval "$1" elif [[ "$(cat /sys/class/power_supply/ACAD/online)" = "0" ]]; then set-conky-update-interval 3 else set-conky-update-interval 0.5 fi