diff options
author | Jakob Odersky <jakob@odersky.com> | 2017-05-07 17:45:29 -0700 |
---|---|---|
committer | Jakob Odersky <jakob@odersky.com> | 2017-05-07 17:45:29 -0700 |
commit | 3e70edc7aed947b0c881d5ab07bf8228c41fc26f (patch) | |
tree | ea69d42be4a2dfc5a94125d6b4729fb5f83a499e /home/.config/i3 | |
parent | d7d95d5de6b0dc82fd3ca525349602a84602da48 (diff) | |
download | dotfiles-3e70edc7aed947b0c881d5ab07bf8228c41fc26f.tar.gz dotfiles-3e70edc7aed947b0c881d5ab07bf8228c41fc26f.tar.bz2 dotfiles-3e70edc7aed947b0c881d5ab07bf8228c41fc26f.zip |
Update i3 config
Diffstat (limited to 'home/.config/i3')
-rw-r--r-- | home/.config/i3/config | 10 | ||||
-rw-r--r-- | home/.config/i3/i3blocks.conf | 1 | ||||
-rwxr-xr-x | home/.config/i3/status/battery | 67 |
3 files changed, 71 insertions, 7 deletions
diff --git a/home/.config/i3/config b/home/.config/i3/config index 6b05d00..e256fc5 100644 --- a/home/.config/i3/config +++ b/home/.config/i3/config @@ -183,19 +183,15 @@ exec --no-startup-id redshift for_window [class="Spotify"] move to workspace $workspace10 exec --no-startup-id spotify -assign [instance="gitter.im"] $workspace8 assign [instance="slack"] $workspace8 -exec --no-startup-id chromium --app=https://gitter.im exec --no-startup-id slack -assign [instance="mail.google.com"] $workspace9 -assign [instance="mail.notes.na.collabserv.com"] $workspace9 -exec --no-startup-id chromium --app=https://mail.google.com -exec --no-startup-id chromium --app=https://mail.notes.na.collabserv.com +#assign [instance="mail.google.com"] $workspace9 +#exec --no-startup-id chromium --app=https://mail.google.com # Font for window titles. Will also be used by the bar unless a different font # is used in the bar {} block below. -font pango:Ubuntu, FontAwesome 11 +font pango:Ubuntu, FontAwesome 10 set $bg-color #464f63 set $inactive-bg-color #020202 diff --git a/home/.config/i3/i3blocks.conf b/home/.config/i3/i3blocks.conf index be11f4f..a37b35b 100644 --- a/home/.config/i3/i3blocks.conf +++ b/home/.config/i3/i3blocks.conf @@ -72,6 +72,7 @@ label= interval=10 [battery] +command=~/.config/i3/status/battery label=⚡ interval=30 diff --git a/home/.config/i3/status/battery b/home/.config/i3/status/battery new file mode 100755 index 0000000..68d6054 --- /dev/null +++ b/home/.config/i3/status/battery @@ -0,0 +1,67 @@ +#!/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; +$full_text = "$percent%"; + +if ($status eq 'Discharging') { + $full_text .= ' DIS'; +} elsif ($status eq 'Charging') { + $full_text .= ' CHR'; +} + +$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 < 15) { + print "#FF0000\n"; + } + if ($percent < 5) { + exit(33); + } +} + +exit(0); |