diff options
author | Jakob Odersky <jakob@odersky.com> | 2016-12-11 00:20:03 -0800 |
---|---|---|
committer | Jakob Odersky <jakob@odersky.com> | 2016-12-11 00:20:03 -0800 |
commit | 041568e6919ea45613bd4ceb6d423d9416b28d9a (patch) | |
tree | 35e98f9e92d635e9ebae4df7be69e789e1c94078 /home/.config/i3/status | |
parent | 234361053f5cb1c6f058c181f460ce7f254729ca (diff) | |
download | dotfiles-041568e6919ea45613bd4ceb6d423d9416b28d9a.tar.gz dotfiles-041568e6919ea45613bd4ceb6d423d9416b28d9a.tar.bz2 dotfiles-041568e6919ea45613bd4ceb6d423d9416b28d9a.zip |
Add i3 configuration
Diffstat (limited to 'home/.config/i3/status')
-rwxr-xr-x | home/.config/i3/status/load | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/home/.config/i3/status/load b/home/.config/i3/status/load new file mode 100755 index 0000000..5518e2f --- /dev/null +++ b/home/.config/i3/status/load @@ -0,0 +1,40 @@ +#!/bin/sh +# Copyright (C) 2014 Julien Bonjean <julien@bonjean.info> +# Copyright (C) 2016 Jakob Odersky <jakob@odersky.com> + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +load="$(cut -d ' ' -f1 /proc/loadavg)" +cpus="$(nproc)" + +# color if load is too high +awk -v cpus=$cpus -v cpuload=$load ' + BEGIN { + load_percent=(cpuload*100)/cpus + print cpuload + print cpuload + if (load_percent < 10) { + exit 0; + } else if (load_percent < 50) { + print "#00ff00"; + exit 0; + } else if (load_percent < 80) { + print "#ffff00"; + exit 0; + } else { + print "#ff0000"; + exit 0; + } + } +' |