commit
e14d0ae694
@ -0,0 +1,64 @@
|
|||||||
|
# vim:filetype=i3
|
||||||
|
|
||||||
|
general {
|
||||||
|
colors = true
|
||||||
|
interval = 5
|
||||||
|
output_format = "i3bar"
|
||||||
|
}
|
||||||
|
|
||||||
|
order += "volume master"
|
||||||
|
order += "disk /"
|
||||||
|
order += "disk /home"
|
||||||
|
order += "wireless _first_"
|
||||||
|
order += "battery 0"
|
||||||
|
order += "battery 1"
|
||||||
|
order += "cpu_usage"
|
||||||
|
order += "load"
|
||||||
|
order += "tztime local"
|
||||||
|
order += "tztime utc"
|
||||||
|
|
||||||
|
volume master {
|
||||||
|
format = "♪:%volume"
|
||||||
|
format_muted = "♪:muted (%volume)"
|
||||||
|
device = "default"
|
||||||
|
mixer = "Master"
|
||||||
|
mixer_idx = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
disk "/" {
|
||||||
|
format = "/ %avail"
|
||||||
|
}
|
||||||
|
|
||||||
|
disk "/home" {
|
||||||
|
format = "/home %avail"
|
||||||
|
}
|
||||||
|
|
||||||
|
wireless _first_ {
|
||||||
|
format_up = "W:(%quality %essid) %ip"
|
||||||
|
format_down = "W:down"
|
||||||
|
}
|
||||||
|
|
||||||
|
battery 0 {
|
||||||
|
format = "0⚡%status %percentage"
|
||||||
|
}
|
||||||
|
|
||||||
|
battery 1 {
|
||||||
|
format = "1⚡%status %percentage"
|
||||||
|
}
|
||||||
|
|
||||||
|
cpu_usage {
|
||||||
|
format = "❤️%usage"
|
||||||
|
}
|
||||||
|
|
||||||
|
load {
|
||||||
|
format = "%1min"
|
||||||
|
}
|
||||||
|
|
||||||
|
tztime local {
|
||||||
|
format = "%Y-%m-%d %H:%M:%S"
|
||||||
|
}
|
||||||
|
|
||||||
|
tztime utc {
|
||||||
|
format = "%H:%M:%S UTC"
|
||||||
|
timezone = "UTC"
|
||||||
|
}
|
@ -0,0 +1,85 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
|
||||||
|
_BITS = []
|
||||||
|
|
||||||
|
|
||||||
|
def _bit(idx):
|
||||||
|
def wrapper(func):
|
||||||
|
_BITS.append([idx, func.__name__.replace('_', ''), func])
|
||||||
|
return func
|
||||||
|
return wrapper
|
||||||
|
|
||||||
|
|
||||||
|
@_bit(6)
|
||||||
|
def _mem():
|
||||||
|
with open('/proc/meminfo') as meminfo_fp:
|
||||||
|
attrs = {}
|
||||||
|
for line in meminfo_fp.readlines():
|
||||||
|
parts = line.split(':', 2)
|
||||||
|
attrs[parts[0].strip()] = parts[1].strip()
|
||||||
|
avail = int(attrs['MemAvailable'].split()[0])
|
||||||
|
total = int(attrs['MemTotal'].split()[0])
|
||||||
|
used = int(((total - avail) / total) * 100)
|
||||||
|
color = None
|
||||||
|
if used > 75:
|
||||||
|
color = '#ff0000'
|
||||||
|
if used < 25:
|
||||||
|
color = '#00ff00'
|
||||||
|
return 'M:{}%'.format(used), color
|
||||||
|
|
||||||
|
|
||||||
|
@_bit(0)
|
||||||
|
def _backlight(dev_dir='/sys/class/backlight/intel_backlight'):
|
||||||
|
with open('{}/brightness'.format(dev_dir)) as br_fp:
|
||||||
|
with open('{}/max_brightness'.format(dev_dir)) as mb_fp:
|
||||||
|
value = int(br_fp.read().strip())
|
||||||
|
max_value = int(mb_fp.read().strip())
|
||||||
|
pct = int(float(float(value) / float(max_value)) * 100)
|
||||||
|
color = None
|
||||||
|
if pct >= 75:
|
||||||
|
color = '#ffaa00'
|
||||||
|
if pct <= 25:
|
||||||
|
color = '#5599ff'
|
||||||
|
return '☼:{}%'.format(pct), color
|
||||||
|
|
||||||
|
|
||||||
|
def _print_line(message):
|
||||||
|
sys.stdout.write(message + '\n')
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
|
||||||
|
def _read_line():
|
||||||
|
try:
|
||||||
|
line = sys.stdin.readline().strip()
|
||||||
|
if not line:
|
||||||
|
sys.exit(3)
|
||||||
|
return line
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
|
||||||
|
def main(bits=_BITS):
|
||||||
|
_print_line(_read_line())
|
||||||
|
_print_line(_read_line())
|
||||||
|
|
||||||
|
while True:
|
||||||
|
line, prefix = _read_line(), ''
|
||||||
|
if line.startswith(','):
|
||||||
|
line, prefix = line[1:], ','
|
||||||
|
|
||||||
|
loaded = json.loads(line)
|
||||||
|
for idx, name, func in bits:
|
||||||
|
value, color = func()
|
||||||
|
record = dict(full_text=str(value), name=name)
|
||||||
|
if color is not None:
|
||||||
|
record.update(dict(color=color))
|
||||||
|
|
||||||
|
loaded.insert(idx, record)
|
||||||
|
|
||||||
|
_print_line(prefix+json.dumps(loaded))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
@ -1,7 +1,8 @@
|
|||||||
|
# vim:filetype=zsh
|
||||||
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)"
|
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)"
|
||||||
PROMPT='$(date -u +%Y-%m-%dT%H:%M:%S) ${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
|
PROMPT='$(date -u +%Y-%m-%dT%H:%M:%S) ${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
|
||||||
|
|
||||||
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
|
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
|
||||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
||||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}🙀 %{$reset_color%}"
|
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}!%{$reset_color%}"
|
||||||
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
|
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
|
||||||
|
Loading…
Reference in new issue