diff options
Diffstat (limited to 'config/i3blocks')
| -rw-r--r-- | config/i3blocks/config | 187 | ||||
| -rwxr-xr-x | config/i3blocks/scripts/backup | 47 | ||||
| -rwxr-xr-x | config/i3blocks/scripts/battery | 75 | ||||
| -rwxr-xr-x | config/i3blocks/scripts/bbswitch | 9 | ||||
| -rwxr-xr-x | config/i3blocks/scripts/email | 5 | ||||
| -rwxr-xr-x | config/i3blocks/scripts/mpd | 10 | 
6 files changed, 333 insertions, 0 deletions
diff --git a/config/i3blocks/config b/config/i3blocks/config new file mode 100644 index 0000000..ed64ff9 --- /dev/null +++ b/config/i3blocks/config @@ -0,0 +1,187 @@ +# i3blocks config file +# +# Please see man i3blocks for a complete reference! +# The man page is also hosted at http://vivien.github.io/i3blocks +# +# List of valid properties: +# +# align +# color +# command +# full_text +# instance +# interval +# label +# min_width +# name +# separator +# separator_block_width +# short_text +# signal +# urgent + +# Global properties +# +# The top properties below are applied to every block, but can be overridden. +# Each block command defaults to the script name to avoid boilerplate. +command=/usr/lib/i3blocks/$BLOCK_NAME +separator_block_width=15 +markup=none + +[mpd] +command=~/.config/i3blocks/scripts/mpd +interval=5 +signal=12 + +[keymap] +command=~/.config/i3/scripts/keyboard_layout +interval=once +signal=11 + +[backup] +command=~/.config/i3blocks/scripts/backup +interval=86400 +signal=13 + +# Volume indicator +# +# The first parameter sets the step (and units to display) +# The second parameter overrides the mixer selection +# See the script for details. +[volume] +#label=VOL +label=♪ +instance=Master +#instance=PCM +interval=once +signal=10 + +# CPU usage +# +# The script may be called with -w and -c switches to specify thresholds, +# see the script for details. +[cpu_usage] +#label=CPU +label= +interval=10 +separator=false + +# Memory usage +# +# The type defaults to "mem" if the instance is not specified. +[memory] +#label=MEM +label= +interval=30 + +[bbswitch] +command=~/.config/i3blocks/scripts/bbswitch +interval=5 + +#[memory] +#label=SWAP +#instance=swap +#separator=false +#interval=30 + +# Disk usage +# +# The directory defaults to $HOME if the instance is not specified. +# The script may be called with a optional argument to set the alert +# (defaults to 10 for 10%). +[disk] +label=/ +instance=/ +interval=30 +separator=false +[disk] +label=/home +instance=/home +interval=30 +separator=false +[disk] +label=/home_hdd +instance=/home_hdd +interval=30 + +# Network interface monitoring +# +# If the instance is not specified, use the interface used for default route. +# The address can be forced to IPv4 or IPv6 with -4 or -6 switches. +[iface] +#instance=wlan0 +color=#00FF00 +interval=10 +separator=false + +[wifi] +#instance=wlp3s0 +interval=10 +separator=false + +[bandwidth] +#instance=eth0 +interval=5 + +# OpenVPN support +# +# Support multiple VPN, with colors. +#[openvpn] +#interval=20 + +# Temperature +# +# Support multiple chips, though lm-sensors. +# The script may be called with -w and -c switches to specify thresholds, +# see the script for details. +[temperature] +#label=T +interval=10 + +#[load_average] +#interval=10 + +# Battery indicator +# +# The battery instance defaults to 0. +[battery] +command=~/.config/i3blocks/scripts/battery +#label=BAT +#label=⚡ +#instance=1 +interval=30 + +#[email] +#command=~/.config/i3blocks/scripts/email +#interval=30 + +# Date Time +# +[time] +command=date '+%Y-%m-%d %H:%M:%S' +interval=1 + +# Generic media player support +# +# This displays "ARTIST - SONG" if a music is playing. +# Supported players are: spotify, vlc, audacious, xmms2, mplayer, and others. +#[mediaplayer] +#instance=mpd +#interval=5 +#signal=10 + +# Key indicators +# +# Add the following bindings to i3 config file: +# +# bindsym --release Caps_Lock exec pkill -SIGRTMIN+11 i3blocks +# bindsym --release Num_Lock  exec pkill -SIGRTMIN+11 i3blocks +#[keyindicator] +#instance=CAPS +#interval=once +#signal=11 + +#[keyindicator] +#instance=NUM +#interval=once +#signal=11 diff --git a/config/i3blocks/scripts/backup b/config/i3blocks/scripts/backup new file mode 100755 index 0000000..24b3954 --- /dev/null +++ b/config/i3blocks/scripts/backup @@ -0,0 +1,47 @@ +#!/bin/bash + +if [[ -n "$BLOCK_BUTTON" ]]; then +	nohup urxvt -title "System backup" -hold -e sudo system-backup 2>&1 >/dev/null & +fi + +state=5 +if [[ -e ~/.backup_date ]]; then +	today=$(date +"%Y%m%d") +	prev=$(date -d `cat ~/.backup_date` +"%Y%m%d") +	dif=$(expr $today - $prev) +	if [[ $dif -ge 30 ]]; then +		state=4 +	elif [[ $dif -ge 20 ]]; then +		state=3 +	elif [[ $dif -ge 5 ]]; then +		state=2 +	elif [[ $dif -ge 2 ]]; then +		state=1 +	else +		state=0 +	fi +fi + +if [[ $state -eq 0 ]]; then +	exit 0 +fi + +echo "Do backup" +echo "Backup" +case $state in +	1) +		echo +		;; +	2) +		echo "#ffff00" +		;; +	3) +		echo "#ff8a00" +		;; +	4) +		echo "#ff5000" +		;; +	5) +		echo "#ff0000" +		;; +esac diff --git a/config/i3blocks/scripts/battery b/config/i3blocks/scripts/battery new file mode 100755 index 0000000..7a5563a --- /dev/null +++ b/config/i3blocks/scripts/battery @@ -0,0 +1,75 @@ +#!/usr/bin/perl +# +# Copyright 2014 Pierre Mavro <deimos@deimos.fr> +# Copyright 2014 Vivien Didelot <vivien@didelot.org> +# +# Licensed under the terms of the GNU GPL v3, or any later version. +# +# This script is meant to use with i3blocks. It parses the output of the "acpi" +# command (often provided by a package of the same name) to read the status of +# the battery, and eventually its remaining time (to full charge or discharge). +# +# The color will gradually change for a percentage below 85%, and the urgency +# (exit code 33) is set if there is less that 5% remaining. + +use strict; +use warnings; +use utf8; + +my $acpi; +my $status; +my $percent; +my $full_text; +my $short_text; +my $bat_number = $ENV{BLOCK_INSTANCE} || 0; + +# read the first line of the "acpi" command output +open (ACPI, "acpi -b | grep 'Battery $bat_number' |") or die; +$acpi = <ACPI>; +close(ACPI); + +# fail on unexpected output +if ($acpi !~ /: (\w+), (\d+)%/) { +	die "$acpi\n"; +} + +$status = $1; +$percent = $2; + +if ($status eq 'Discharging') { +	$full_text = '🔋 '; +} elsif ($status eq 'Charging') { +	$full_text = '🔌 '; +} + +$full_text .= "$percent%"; + +$short_text = $full_text; + +if ($acpi =~ /(\d\d:\d\d):/) { +	$full_text .= " ($1)"; +} + +# print text +print "$full_text\n"; +print "$short_text\n"; + +# consider color and urgent flag only on discharge +if ($status eq 'Discharging') { + +	if ($percent < 20) { +		print "#FF0000\n"; +	} elsif ($percent < 40) { +		print "#FFAE00\n"; +	} elsif ($percent < 60) { +		print "#FFF600\n"; +	} elsif ($percent < 85) { +		print "#A8FF00\n"; +	} + +	if ($percent < 5) { +		exit(33); +	} +} + +exit(0); diff --git a/config/i3blocks/scripts/bbswitch b/config/i3blocks/scripts/bbswitch new file mode 100755 index 0000000..a6ad24c --- /dev/null +++ b/config/i3blocks/scripts/bbswitch @@ -0,0 +1,9 @@ +#!/bin/bash + +if [ -e /proc/acpi/bbswitch ]; then +	if [ -n "`cat /proc/acpi/bbswitch | grep ON`" ]; then +		echo OPTIMUS +		echo OP +		echo '#ffff00' +	fi +fi diff --git a/config/i3blocks/scripts/email b/config/i3blocks/scripts/email new file mode 100755 index 0000000..138deb8 --- /dev/null +++ b/config/i3blocks/scripts/email @@ -0,0 +1,5 @@ +#!/bin/bash + +email-unread -s | tr "\n" " " |  sed 's/[ ]*$/\n/' +echo +echo "#ffff00" diff --git a/config/i3blocks/scripts/mpd b/config/i3blocks/scripts/mpd new file mode 100755 index 0000000..63ba924 --- /dev/null +++ b/config/i3blocks/scripts/mpd @@ -0,0 +1,10 @@ +#!/bin/bash +if [ -n "`mpc status | grep -E "(playing|paused)"`" ]; then +	echo `mpc -f "%artist%, %album%, %title%" status | head -1` +	echo +	if [ -n `mpc status | grep playing` ]; then +		echo "#ffff00" +	elif [ -n `mpc status | grep paused` ]; then +		echo "#00ff00" +	fi +fi  | 
