[yambar] Add yambar config

This commit is contained in:
Midgard 2022-08-29 23:02:24 +02:00
parent a6a8819a7d
commit 456be23b52
Signed by untrusted user who does not match committer: midgard
GPG key ID: 511C112F1331BBB4
4 changed files with 388 additions and 0 deletions

Binary file not shown.

61
yambar/clock.py Executable file
View file

@ -0,0 +1,61 @@
#!/usr/bin/env python3
import sys
from datetime import datetime
import time
import pytz
FILL_CLOCK_FACE = False
# if len(sys.argv) < 3:
# print("Usage: {scriptname} timezone_left timezone_right".format(scriptname=sys.argv[0]), file=sys.stderr)
# exit(1)
# try:
# tzleft = pytz.timezone(sys.argv[1])
# tzright = pytz.timezone(sys.argv[2])
# except pytz.exceptions.UnknownTimeZoneError as e:
# print('Unknown time zone "{}"'.format(e.args[0]), file=sys.stderr)
# exit(1)
hourhands = ""
minutehands = ""
def face_for(t):
minute = minutehands[ t.minute // 5 ]
hour = hourhands [ t.hour % 12 ]
return hour + minute + ""
def time_of_day(t):
if t.hour < 5 or t.hour > 22:
return "night"
elif t.hour < 10:
return "morning"
elif t.hour < 14:
return "noon"
elif t.hour < 19:
return "afternoon"
else:
return "evening"
while True:
utcnow = datetime.now(tz=pytz.utc)
localnow = datetime.now()
# leftnow = utcnow.astimezone(tzleft )
# rightnow = utcnow.astimezone(tzright)
print(f"""time_of_day|string|{time_of_day(localnow)}
face|string|{face_for(localnow)}
hour|string|{localnow.strftime("%H")}
minute|string|{localnow.strftime("%M")}
weekday|string|{localnow.strftime("%A")}
date|string|{localnow.strftime("%d %b")}
""", flush = True)
delay = 60 - localnow.second - (localnow.microsecond * 10e-7)
time.sleep(delay)

310
yambar/config.yml Normal file
View file

@ -0,0 +1,310 @@
col_fg: &col_fg "dfdfdfff"
col_fg_alt: &col_fg_alt "777777ff"
col_fg_caution: &col_fg_caution "bd2c40ff"
col_fg_alert: &col_fg_alert "ff4e4eff"
col_meter_bg: &col_meter_bg "444444ff"
col_chg: &col_chg "dddd77ff"
font_default: &font_default "Fira Sans:size=12"
font_supplements_20: &font_supplements_20 "Bar Material Supplements:pixelsize=20"
font_supplements: &font_supplements "Bar Material Supplements:size=14"
font_material: &font_material "Material Icons:size=14"
battery_bg: &battery_bg
string: {text: "", foreground: *col_meter_bg}
battery_caution_bg: &battery_caution_bg
string: {text: "", foreground: "ff5555ff"}
battery_range: &battery_range
- string: {text: "\uecfd", foreground: "ff5555ff"} # {{{ Battery range 0- 5
- list: {spacing: 0, items: [*battery_caution_bg, {string: {text: "\uecfd"}}]} # 5-10
- list: {spacing: 0, items: [*battery_caution_bg, {string: {text: "\uecfd"}}]} # 10-15
- list: {spacing: 0, items: [*battery_caution_bg, {string: {text: "\uecfd"}}]} # 15-20
- list: {spacing: 0, items: [*battery_bg, {string: {text: "\uecfd"}}]} # 20-25
- list: {spacing: 0, items: [*battery_bg, {string: {text: "\uecfd"}}]} # 25-30
- list: {spacing: 0, items: [*battery_bg, {string: {text: "\uecfd"}}]} # 30-35
- list: {spacing: 0, items: [*battery_bg, {string: {text: "\uecfd"}}]} # 35-40
- list: {spacing: 0, items: [*battery_bg, {string: {text: "\uecfd"}}]} # 40-45
- list: {spacing: 0, items: [*battery_bg, {string: {text: "\uecfd"}}]} # 45-50
- list: {spacing: 0, items: [*battery_bg, {string: {text: "\uecfd"}}]} # 50-55
- list: {spacing: 0, items: [*battery_bg, {string: {text: "\uecfd"}}]} # 55-60
- list: {spacing: 0, items: [*battery_bg, {string: {text: "\uecfd"}}]} # 60-65
- list: {spacing: 0, items: [*battery_bg, {string: {text: "\uecfd"}}]} # 65-70
- list: {spacing: 0, items: [*battery_bg, {string: {text: "\uecfd"}}]} # 70-75
- list: {spacing: 0, items: [*battery_bg, {string: {text: "\uecfd"}}]} # 75-80
- list: {spacing: 0, items: [*battery_bg, {string: {text: "\uecfd"}}]} # 80-85
- list: {spacing: 0, items: [*battery_bg, {string: {text: "\uecfd"}}]} # 85-90
- list: {spacing: 0, items: [*battery_bg, {string: {text: "\uecfd"}}]} # 90-95
- string: {text: "\uecfd"} # }}} 95-100
charging: &chg_icon {string: {text: "\uecfd", foreground: "000000ff"}}
battery_range_charging: &battery_range_charging
- list: {spacing: 0, items: [*battery_bg, {string: {text: , foreground: *col_chg}}, *chg_icon]} # 0- 5 {{{ Battery range
- list: {spacing: 0, items: [*battery_bg, {string: {text: , foreground: *col_chg}}, *chg_icon]} # 5-10
- list: {spacing: 0, items: [*battery_bg, {string: {text: , foreground: *col_chg}}, *chg_icon]} # 10-15
- list: {spacing: 0, items: [*battery_bg, {string: {text: , foreground: *col_chg}}, *chg_icon]} # 15-20
- list: {spacing: 0, items: [*battery_bg, {string: {text: , foreground: *col_chg}}, *chg_icon]} # 20-25
- list: {spacing: 0, items: [*battery_bg, {string: {text: , foreground: *col_chg}}, *chg_icon]} # 25-30
- list: {spacing: 0, items: [*battery_bg, {string: {text: , foreground: *col_chg}}, *chg_icon]} # 30-35
- list: {spacing: 0, items: [*battery_bg, {string: {text: , foreground: *col_chg}}, *chg_icon]} # 35-40
- list: {spacing: 0, items: [*battery_bg, {string: {text: , foreground: *col_chg}}, *chg_icon]} # 40-45
- list: {spacing: 0, items: [*battery_bg, {string: {text: , foreground: *col_chg}}, *chg_icon]} # 45-50
- list: {spacing: 0, items: [*battery_bg, {string: {text: , foreground: *col_chg}}, *chg_icon]} # 50-55
- list: {spacing: 0, items: [*battery_bg, {string: {text: , foreground: *col_chg}}, *chg_icon]} # 55-60
- list: {spacing: 0, items: [*battery_bg, {string: {text: , foreground: *col_chg}}, *chg_icon]} # 60-65
- list: {spacing: 0, items: [*battery_bg, {string: {text: , foreground: *col_chg}}, *chg_icon]} # 65-70
- list: {spacing: 0, items: [*battery_bg, {string: {text: , foreground: *col_chg}}, *chg_icon]} # 70-75
- list: {spacing: 0, items: [*battery_bg, {string: {text: , foreground: *col_chg}}, *chg_icon]} # 75-80
- list: {spacing: 0, items: [*battery_bg, {string: {text: , foreground: *col_chg}}, *chg_icon]} # 80-85
- list: {spacing: 0, items: [*battery_bg, {string: {text: , foreground: *col_chg}}, *chg_icon]} # 85-90
- list: {spacing: 0, items: [*battery_bg, {string: {text: , foreground: *col_chg}}, *chg_icon]} # 90-95
- list: {spacing: 0, foreground: *col_chg, items: [ # 95-100
{string: {text: "\uecfd"}},
{string: {text: " unplug", font: *font_default}}
]} # }}}
bar:
height: 21
location: top
background: 111111d8
foreground: *col_fg
font: *font_default
left-margin: 3
right-margin: 10
spacing: 10
left:
- i3:
sort: ascending
content:
"":
map:
tag: state
default: {string: {text: "{name}", foreground: *col_fg_alt, margin: 7}}
values:
"focused": {string: {text: "{name}", margin: 7}}
#current:
#list:
#left-margin: 25
#spacing: 0
#items:
#- { string: {text: "{application}", foreground: *col_fg_alt}}
#- map:
#tag: application
#default: { string: {text: ": ", foreground: *col_fg_alt}}
#values:
#"": {empty: {}}
#- { string: {text: "{title}", foreground: *col_fg_alt}}
- mem:
interval: 1500
content:
ramp:
tag: percent_used
items:
- empty: {} # 0- 5
- empty: {} # 5-10
- empty: {} # 10-15
- empty: {} # 15-20
- empty: {} # 20-25
- empty: {} # 25-30
- empty: {} # 30-35
- empty: {} # 35-40
- empty: {} # 40-45
- empty: {} # 45-50
- empty: {} # 50-55
- empty: {} # 55-60
- empty: {} # 60-65
- empty: {} # 65-70
- empty: {} # 70-75
- string: {text: "RAM {percent_used}%"} # 75-80
- string: {text: "RAM {percent_used}%"} # 80-85
- string: {text: "RAM {percent_used}%"} # 85-90
- string: {foreground: *col_fg_caution, text: "RAM {percent_used}%"} # 90-95
- string: {foreground: *col_fg_alert, text: "RAM {percent_used}%"} # 95-100
- script:
font: "Fira Mono:size=12"
poll-interval: 5
path: /home/midgard/.config/yambar/temp.sh
content:
map:
tag: status
default: {string: {text: "{temp}°C {rpm} RPM"}}
values:
normal:
empty: {}
caution:
string: {text: "{temp}°C {rpm} RPM", foreground: *col_fg_caution}
alert:
string: {text: "{temp}°C {rpm} RPM", foreground: *col_fg_alert}
center:
- script:
path: /home/midgard/.config/yambar/clock.py
content:
map:
tag: time_of_day
default:
list:
foreground: "ff0000ff"
items: &clock_contents
- string:
text: "{weekday} "
font: Fira Sans:size=12
- string:
text: "{hour} "
font: Fira Sans:size=14
- string:
text: "{face}\uecfd"
font: *font_supplements_20
#foreground: "{color}"
- string:
text: " {minute}"
font: Fira Sans:size=14
- string:
text: " {date}"
font: Fira Sans:size=12
values:
night: {list: {foreground: "888888ff", items: *clock_contents}}
morning: {list: {foreground: "ddbb99ff", items: *clock_contents}}
noon: {list: {foreground: "ddddbbff", items: *clock_contents}}
afternoon: {list: {foreground: "ddddddff", items: *clock_contents}}
evening: {list: {foreground: "dd99bbff", items: *clock_contents}}
right:
- cpu:
interval: 1500
content:
list:
spacing: 0
font: "Fira Code:size=12"
items:
- ramp:
tag: cpu0
items: &cpu_ramp
- empty: {} # 0-12
- empty: {} # 12-25
- empty: {} # 25-37
- empty: {} # 37-50
- empty: {} # 50-62
- string: {margin: 1, text: "▅", foreground: "666666ff" } # 62-75
- string: {margin: 1, text: "▆", foreground: "888888ff" } # 75-87
- string: {margin: 1, text: "▇", foreground: *col_fg_caution } # 87-100
- ramp: {tag: cpu1, items: *cpu_ramp}
- ramp: {tag: cpu2, items: *cpu_ramp}
- ramp: {tag: cpu3, items: *cpu_ramp}
- ramp: {tag: cpu4, items: *cpu_ramp}
- ramp: {tag: cpu5, items: *cpu_ramp}
- ramp: {tag: cpu6, items: *cpu_ramp}
- ramp: {tag: cpu7, items: *cpu_ramp}
- alsa:
card: hw:PCH
mixer: Master
font: Material Icons:pixelsize=15
content:
- map:
tag: muted
default:
ramp:
tag: volume
items:
- string: {text: ""}
- string: {text: ""}
- string: {text: ""}
values:
true: {string: {text: "", foreground: "777777ff"}}
- mpd:
host: /var/lib/mpd/socket
content:
map:
foreground: *col_fg_alt
tag: state
default: {empty: {}}
values:
playing:
- string: {text: "", font: *font_material}
- list: &mpd
items:
#- progress-bar:
#tag: elapsed
#margin: 5
#length: 10
#font: "Fira Code:size=10"
#start: {empty: {}}
#end: {empty: {}}
#fill: {string: {text: "─", foreground: "999999ff"}}
#empty: {string: {text: "─", foreground: "333333ff"}}
#indicator: {string: {text: "╴", foreground: "eeeeeeff"}}
- string:
text: "{artist} "
max: 15
font: "Fira Sans:size=11"
- string:
text: "{title}"
max: 20
font: "Fira Sans:size=11"
#paused:
#- string: {text: "", font: *font_material}
#- list: *mpd
- network:
name: wlp58s0
content:
map:
font: *font_supplements
tag: state
default: {string: {foreground: *col_fg_alt, text: "{state}"}}
values:
"down": {string: {foreground: *col_fg_alt, text: ""}}
"dormant": {string: {text: ""}}
"up":
list:
spacing: 0
items:
- string: {text: "", foreground: *col_meter_bg}
- ramp:
tag: signal
items:
- {string: {text: "\uecfd"}}
- {string: {text: "\uecfd"}}
- {string: {text: "\uecfd"}}
- {string: {text: "\uecfd"}}
- network:
name: enp57s0f1
content:
map:
font: *font_material
tag: state
default: {empty: {}}
values:
"up":
string: {text: ""}
- battery:
name: BAT0
content:
map:
font: *font_supplements
tag: state
default:
ramp:
tag: capacity
items: *battery_range
values:
"charging":
ramp:
tag: capacity
items: *battery_range_charging
"not charging":
- ramp:
tag: capacity
items: *battery_range_charging
- string: {text: "×", foreground: *col_fg_alert}

17
yambar/temp.sh Executable file
View file

@ -0,0 +1,17 @@
#!/bin/sh
temp="$( (cat /sys/class/thermal/thermal_zone*/temp 2>/dev/null | maths max | tr -d $'\n'; echo " / 1000") | bc)"
rpm="$(sudo fan_control rpm 1)"
echo "temp|int|$temp"
echo "rpm|int|${rpm% RPM}"
if test "$temp" -ge 90; then
status=alert
elif test "$temp" -ge 80; then
status=caution
elif test "$temp" -gt 55 || test "${rpm% RPM}" -gt 3000; then
status=active
else
status=normal
fi
echo "status|string|$status"
echo