dotfiles

commit 86d70524f6e0591d7a221fb5ae789a4effa567f0

Author: Honza Pokorny <honza@redhat.com>

i3 things

 i3/config | 12 ++++++------
 i3/i3status.conf | 2 +-
 i3/i3status.py | 38 ++++++++++++++++++++++++++++++++++++++


diff --git a/i3/config b/i3/config
index 6ce86aa323405aff6a142b724c3ba6776c75ed84..bb8812e104aa626c2b83a1bbf779b68253d03bb4 100644
--- a/i3/config
+++ b/i3/config
@@ -3,8 +3,7 @@
 # Font for window titles. Will also be used by the bar unless a different font
 # is used in the bar {} block below. ISO 10646 = Unicode
 # font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
-# font pango:Hack 10
-font pango:Ubuntu Mono 12
+font pango:NotoSans Regular 10
 
 # The font above is very space-efficient, that is, it looks good, sharp and
 # clear in small sizes. However, if you need a lot of unicode glyphs or
@@ -118,6 +117,10 @@         bindsym Return mode "default"
         bindsym Escape mode "default"
 }
 
+# class                 border  backgr. text    indicator child_border
+client.focused          #333333 #333333 #ffffff #2e9ef4   #285577
+
+
 bindsym $mod+r mode "resize"
 
 bindsym $mod+i exec i3-input
@@ -147,8 +150,5 @@
 exec i3-battery-check
 exec dropbox 'start'
 exec nm-applet
-# exec workrave
-# exec redshift
 
-exec_always --no-startup-id ~/.config/polybar/launch.sh
-
+# exec_always --no-startup-id ~/.config/polybar/launch.sh




diff --git a/i3/i3status.conf b/i3/i3status.conf
index 083358a31154fd889b9252f2eef816ed9b7c44c8..31c67c965e89eb21d1be3b836239b2487916afe6 100644
--- a/i3/i3status.conf
+++ b/i3/i3status.conf
@@ -7,7 +7,7 @@
 order += "ethernet enp0s25"
 order += "wireless wlp3s0"
 order += "volume master"
-order += "battery 0"
+# order += "battery 0"
 order += "cpu_usage"
 order += "disk /home/"
 order += "tztime utc"




diff --git a/i3/i3status.py b/i3/i3status.py
index 6ddb03639897e7adb25805e9ecc8c39f53bc00a2..8d66fdcf45217f7c3046b0e475c05a4c800f1b1a 100755
--- a/i3/i3status.py
+++ b/i3/i3status.py
@@ -40,6 +40,43 @@         'color': '#00FF00' if vpn_connected else '#FF0000',
     }
 
 
+def get_battery():
+    battery_path = '/sys/class/power_supply/BAT0/uevent'
+    battery_level = 0
+    battery_status = ''
+    battery_critical = False
+
+    f = open(battery_path)
+    battery_data = f.readlines()
+    f.close()
+
+    for line in battery_data:
+        label, value = line.split('=')
+        value = value.replace('\n', '')
+
+        if label == 'POWER_SUPPLY_CAPACITY':
+            battery_level = int(value)
+
+        if label == 'POWER_SUPPLY_STATUS':
+            battery_status = value
+
+    if battery_level < 15:
+        battery_critical = True
+
+    if battery_status == 'Discharging':
+        battery_status = '(bat)'
+    else:
+        battery_status = '(ac)'
+
+    text = 'B: {}% {}'.format(battery_level, battery_status)
+
+    return {
+        'full_text': text,
+        'name': 'bat',
+        'color': '#FF0000' if battery_critical else '#FFFFFF',
+    }
+
+
 def print_line(message):
     sys.stdout.write(message + '\n')
     sys.stdout.flush()
@@ -71,6 +108,7 @@         j = json.loads(line)
 
         j.insert(6, get_memory())
         j.insert(0, get_vpn())
+        j.insert(6, get_battery())
 
         print_line(prefix+json.dumps(j))