diff --git a/i3_config b/i3_config index 83340c9..09262bd 100644 --- a/i3_config +++ b/i3_config @@ -157,7 +157,8 @@ bindsym $mod+r mode "resize" # finds out, if available) bar { position top - status_command i3status + status_command /home/von/vdotfiles/i3_status + tray_output primary } new_window pixel 1 diff --git a/i3_status b/i3_status new file mode 100755 index 0000000..52353d8 --- /dev/null +++ b/i3_status @@ -0,0 +1,34 @@ +#!/usr/bin/python3 -u + +import time +import psutil + +def status_print(status_msg): + prefix = '[' + postfix = ']' + result = list() + for element in status_msg: + result.append('{"full_text":"' + element + '"}') + print(prefix + ','.join(result) + postfix) + +print('{"version":1}\n[') +while True: + values = list() + current_time = time.strftime('%a %d %H:%M') + values.append(current_time) + mem = psutil.virtual_memory() + memory = 'RAM: {}% ({:.3}G)'.format(100.0 - mem.percent, mem.available / 2**30) + values.append(memory) + with open('/sys/class/power_supply/BAT0/capacity', 'r') as capacity, open('/sys/class/power_supply/BAT0/status', 'r') as status: + batt_status = status.read().strip() + batt_capacity = capacity.read().strip() + if batt_status != 'Discharging': + batt_status = '↑' + else: + batt_status = '↓' + batt = 'BAT: ' + batt_capacity + '% ' + batt_status + values.append(batt) + values.reverse() + status_print(values) + time.sleep(5) + print(',', end='') diff --git a/i3status.conf b/i3status.conf deleted file mode 100644 index 5de5259..0000000 --- a/i3status.conf +++ /dev/null @@ -1,57 +0,0 @@ -# i3status configuration file. -# see "man i3status" for documentation. - -# It is important that this file is edited as UTF-8. -# The following line should contain a sharp s: -# ß -# If the above line is not correctly displayed, fix your editor first! - -general { - colors = true - interval = 5 -} - -#order += "ipv6" -order += "disk /" -#order += "run_watch DHCP" -#order += "run_watch VPN" -order += "wireless _first_" -order += "ethernet _first_" -order += "battery 0" -order += "load" -order += "tztime local" - -wireless _first_ { - format_up = "W: (%quality at %essid) %ip" - format_down = "W: down" -} - -ethernet _first_ { - # if you use %speed, i3status requires root privileges - format_up = "E: %ip (%speed)" - format_down = "E: down" -} - -battery 0 { - format = "%status %percentage %remaining" -} - -#run_watch DHCP { -# pidfile = "/var/run/dhclient*.pid" -#} - -#run_watch VPN { -# pidfile = "/var/run/vpnc/pid" -#} - -tztime local { - format = "%a %d %H:%M" -} - -load { - format = "%1min" -} - -disk "/" { - format = "%avail" -} diff --git a/screenrc b/screenrc index b26db02..b7f8bb4 100644 --- a/screenrc +++ b/screenrc @@ -10,7 +10,7 @@ defscrollback 10000 vbell off bell off autodetach on -term screen-256color +term screen altscreen on activity "activity on %n" caption always '%{=}%{RW} %H %{Yw} %S %{wd} %-w%{wk}[%t]%{wd}%+w' diff --git a/tmux.conf b/tmux.conf index cd1a84d..fe0169b 100644 --- a/tmux.conf +++ b/tmux.conf @@ -42,7 +42,7 @@ set -g set-titles "off" set -g status-left-length "20" set -g status-right-length "40" set -g terminal-override "rxvt-unicode*:sitm@,ritm@,xterm-*:Tc" -set -g default-terminal "screen-256color" +set -g default-terminal "screen" set -g status-position "bottom" set -g status-justify "centre" set -g status-left-length "100"