From 456be23b52ea994a8e84613d866b9de0f2c9a64a Mon Sep 17 00:00:00 2001 From: Midgard <2885-Midgard@users.noreply.framagit.org> Date: Mon, 29 Aug 2022 23:02:24 +0200 Subject: [PATCH] [yambar] Add yambar config --- yambar/bar-material-supplements.ttf | Bin 0 -> 5028 bytes yambar/clock.py | 61 ++++++ yambar/config.yml | 310 ++++++++++++++++++++++++++++ yambar/temp.sh | 17 ++ 4 files changed, 388 insertions(+) create mode 100644 yambar/bar-material-supplements.ttf create mode 100755 yambar/clock.py create mode 100644 yambar/config.yml create mode 100755 yambar/temp.sh diff --git a/yambar/bar-material-supplements.ttf b/yambar/bar-material-supplements.ttf new file mode 100644 index 0000000000000000000000000000000000000000..0e766339598b95e068d01560b35a6d107a4df5fb GIT binary patch literal 5028 zcmds5du)`)5ue$;m$8k{KA+ErA36ItADBCH{_aHxg_I-)@d%MfzyVTv*akcCOJ^I1 zuo8qKM4~(>F?rA^Q7V!&ZK~2JQc=|)8mVcNG&EAvrWHw1)c|UsuGKhFMD4r&_Iq3m z#Z}Wk``yjX?Ck8$?Ck7(yB{$TmC=5ZG}zX5=lY}B7d|Jdcn;j!Rkz;OMqz44eHito z4I3A0EB~;)g^2f}zNw=xGk7lX31r1H;GNi&85+#zF%nhuqTRKt_x_#Z@`DJG?F3O# zdv{l+(|`Y`PoQlIkm?4*wJQHB^i7~Xzq@aEubYy;Mg0TR-{~Fb$Sj{&_6Yi~Mtx^r zX73;@U5j?uM1lTHU)OV29-Jha>w*n~g9Agu8yil&MC68j{Eyuj-~P$mS76UcHU4gl zU;O?}ucH338lTkM0Y@G!uGwC;>sxA_WiwAw= z`TQ7dvr#@jMK-%WlF??An$FQ^HI?WL)suDJ&4vK6jrcIx$t9i@zXtCK1M?+{a}j1k zc9hoRwg})mcHY)WH(!41^0bWSrm@fi8 z1Hgy6iNJbY@rM8*K!u4_UGZlDn!uPVjd691Iy?RcIAGYV;z);Db8bICP0g|v6MG!k zWv$5Nw=Yj4?(o1X9~u-YO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W*%k4E-f`o=JyJ)ZmVpOw}U zoZ5_&D&rh%++fsMwvt9nzN7?AnzW6od8TM;-ha12`D?7Y^b zC3VvyCT*h_FEnX8xp~;69pFEKe38Lg(zsMoZr{Lqs8d-68tS?$M!{-P>qD*P(Ehc0pqRK5D@X z1GE(IbuBe|Y3LuNBtTKEw1lW_pnte+AiJw8ptZyTO9Qjb2u)fnnv80(R`mM1>i>hI zHtBvIf~VDt1GwmSWrunO`a$i`mm~V$`*KGn8@;|iue~E7P_BB^VS`DqV97SNW0N`A z#YH@ai@AhLak4LCH<#lC;NeR4auxfyn*BVFYq*x{kc)5N05@31Kp^j)|i1>U41?MBg0*>m_;N_qSfNG zS{%*dXci}KapD#yVQ~@`Cuwn#$&wwJ;q4vSp5dO3Os^f4SW=a(F;!}M8Q05%UMBT2 zrI%^FT%wmZ8fDU@hTA#P+w1D+&SZD>^zYJFmvKACfep0!3Q>hSwyH5ApY^+riVD@L zKs`D>SCjvvs?7W@L+mDD%aQ&KW^8Ii|3YK+Qo^`5(U$z}NI!AhfZ~Gkr)Z0~m9`)Y zZozknE$Z%+|0w|9h7_hZ0UtnRJ>Ur7DBuOa4^6D 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) diff --git a/yambar/config.yml b/yambar/config.yml new file mode 100644 index 0000000..a41a473 --- /dev/null +++ b/yambar/config.yml @@ -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} diff --git a/yambar/temp.sh b/yambar/temp.sh new file mode 100755 index 0000000..b08b796 --- /dev/null +++ b/yambar/temp.sh @@ -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