diff options
author | Jakob Odersky <jakob@odersky.com> | 2017-11-13 20:37:52 -0800 |
---|---|---|
committer | Jakob Odersky <jakob@odersky.com> | 2017-11-13 20:37:52 -0800 |
commit | 74b6cb7fdacaf3f818abc072d84288bc837fadcc (patch) | |
tree | b1b8af4eb21222d781fa74a335e3b5e6dc64a03f | |
parent | fa97af81606a16326d8711ed9abfb3dbfd748077 (diff) | |
download | dotfiles-74b6cb7fdacaf3f818abc072d84288bc837fadcc.tar.gz dotfiles-74b6cb7fdacaf3f818abc072d84288bc837fadcc.tar.bz2 dotfiles-74b6cb7fdacaf3f818abc072d84288bc837fadcc.zip |
Update i3 config
-rwxr-xr-x | home/.config/i3/status/battery | 84 | ||||
-rw-r--r-- | home/.config/sway/config | 3 |
2 files changed, 23 insertions, 64 deletions
diff --git a/home/.config/i3/status/battery b/home/.config/i3/status/battery index 68d6054..03bc740 100755 --- a/home/.config/i3/status/battery +++ b/home/.config/i3/status/battery @@ -1,67 +1,27 @@ -#!/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. +#!/bin/bash +set -e -use strict; -use warnings; -use utf8; +device="/sys/class/power_supply/BAT${BLOCK_INSTANCE:-0}" +status=$(cat "$device/status") +percent=$(cat "$device/capacity") -my $acpi; -my $status; -my $percent; -my $full_text; -my $short_text; -my $bat_number = $ENV{BLOCK_INSTANCE} || 0; +status_text="" +if [[ $status = "Discharging" ]]; then + status_text=" (DIS)" +elif [[ $status = "Charging" ]]; then + status_text=" (CHR)" +fi -# 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"; +echo "${percent}%${status_text}" +echo "${percent}%${status_text}" # 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); +if [[ $status="Discharging" ]]; then + if [[ $percent -le 15 ]]; then + echo "#FF0000"; + fi + if [[ $percent -le 5 ]]; then + exit 33 + fi +fi +exit 0 diff --git a/home/.config/sway/config b/home/.config/sway/config index 5ab91e2..6e26cbb 100644 --- a/home/.config/sway/config +++ b/home/.config/sway/config @@ -227,7 +227,7 @@ bindsym $mod+r mode "resize" # # Window borders: # - new_window pixel 1 + default_border pixel 1 # # Status Bar: # @@ -275,7 +275,6 @@ bindsym $mod+r mode "resize" } bindsym $mod+q mode "quick" - exec redshift # layout preferences |