i3 status and default $TERM for screen and tmux
This commit is contained in:
parent
af4c8c3d98
commit
b01252ad76
5 changed files with 38 additions and 60 deletions
|
@ -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
|
||||
|
|
34
i3_status
Executable file
34
i3_status
Executable file
|
@ -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='')
|
|
@ -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"
|
||||
}
|
2
screenrc
2
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'
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue