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   "666666aa"
col_chg:        &col_chg        "dddd77ff"
col_visible_ws: &col_visible_ws "42429cff"

font_default: &font_default "Fira Sans:size=12"
font_supplements_big: &font_supplements_big "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:
              #default: {string: {text: "{name}", foreground: *col_fg_alt, margin: 7}}
              #conditions:
                #state == focused: {string: {text: "{name}", margin: 7}}

    - script:
        path: /home/midgard/.config/yambar/sway.py
        anchors:
          monitor_sep: &monitor_sep {string: {text: "|"}}
          ws_common: &ws_common {left-margin: 7, right-margin: 7}
          ws_default: &ws_default {foreground: *col_fg_alt,     <<: *ws_common}
          ws_focused: &ws_focused {foreground: *col_fg,         <<: *ws_common}
          ws_visible: &ws_visible {foreground: *col_visible_ws, <<: *ws_common}
        content:
          - list:
              spacing: 0
              items:
                - map:
                    default:                 {string: {text: "{ws0}", <<: *ws_default}}
                    conditions:
                      ws0_state == unused:   {empty: {}}
                      ws0_state == focused:  {string: {text: "{ws0}", <<: *ws_focused}}
                      ws0_state == visible:  {string: {text: "{ws0}", <<: *ws_visible}}
                - map: {default: {empty: {}}, conditions: {ws1_new_monitor: *monitor_sep}}
                - map:
                    default:                 {string: {text: "{ws1}", <<: *ws_default}}
                    conditions:
                      ws1_state == unused:   {empty: {}}
                      ws1_state == focused:  {string: {text: "{ws1}", <<: *ws_focused}}
                      ws1_state == visible:  {string: {text: "{ws1}", <<: *ws_visible}}
                - map: {default: {empty: {}}, conditions: {ws2_new_monitor: *monitor_sep}}
                - map:
                    default:                 {string: {text: "{ws2}", <<: *ws_default}}
                    conditions:
                      ws2_state == unused:   {empty: {}}
                      ws2_state == focused:  {string: {text: "{ws2}", <<: *ws_focused}}
                      ws2_state == visible:  {string: {text: "{ws2}", <<: *ws_visible}}
                - map: {default: {empty: {}}, conditions: {ws3_new_monitor: *monitor_sep}}
                - map:
                    default:                 {string: {text: "{ws3}", <<: *ws_default}}
                    conditions:
                      ws3_state == unused:   {empty: {}}
                      ws3_state == focused:  {string: {text: "{ws3}", <<: *ws_focused}}
                      ws3_state == visible:  {string: {text: "{ws3}", <<: *ws_visible}}
                - map: {default: {empty: {}}, conditions: {ws4_new_monitor: *monitor_sep}}
                - map:
                    default:                 {string: {text: "{ws4}", <<: *ws_default}}
                    conditions:
                      ws4_state == unused:   {empty: {}}
                      ws4_state == focused:  {string: {text: "{ws4}", <<: *ws_focused}}
                      ws4_state == visible:  {string: {text: "{ws4}", <<: *ws_visible}}
                - map: {default: {empty: {}}, conditions: {ws5_new_monitor: *monitor_sep}}
                - map:
                    default:                 {string: {text: "{ws5}", <<: *ws_default}}
                    conditions:
                      ws5_state == unused:   {empty: {}}
                      ws5_state == focused:  {string: {text: "{ws5}", <<: *ws_focused}}
                      ws5_state == visible:  {string: {text: "{ws5}", <<: *ws_visible}}
                - map: {default: {empty: {}}, conditions: {ws6_new_monitor: *monitor_sep}}
                - map:
                    default:                 {string: {text: "{ws6}", <<: *ws_default}}
                    conditions:
                      ws6_state == unused:   {empty: {}}
                      ws6_state == focused:  {string: {text: "{ws6}", <<: *ws_focused}}
                      ws6_state == visible:  {string: {text: "{ws6}", <<: *ws_visible}}
                - map: {default: {empty: {}}, conditions: {ws7_new_monitor: *monitor_sep}}
                - map:
                    default:                 {string: {text: "{ws7}", <<: *ws_default}}
                    conditions:
                      ws7_state == unused:   {empty: {}}
                      ws7_state == focused:  {string: {text: "{ws7}", <<: *ws_focused}}
                      ws7_state == visible:  {string: {text: "{ws7}", <<: *ws_visible}}
                - map: {default: {empty: {}}, conditions: {ws8_new_monitor: *monitor_sep}}
                - map:
                    default:                 {string: {text: "{ws8}", <<: *ws_default}}
                    conditions:
                      ws8_state == unused:   {empty: {}}
                      ws8_state == focused:  {string: {text: "{ws8}", <<: *ws_focused}}
                      ws8_state == visible:  {string: {text: "{ws8}", <<: *ws_visible}}
                - map: {default: {empty: {}}, conditions: {ws9_new_monitor: *monitor_sep}}
                - map:
                    default:                 {string: {text: "{ws9}", <<: *ws_default}}
                    conditions:
                      ws9_state == unused:   {empty: {}}
                      ws9_state == focused:  {string: {text: "{ws9}", <<: *ws_focused}}
                      ws9_state == visible:  {string: {text: "{ws9}", <<: *ws_visible}}
                - map: {default: {empty: {}}, conditions: {ws10_new_monitor: *monitor_sep}}
                - map:
                    default:                 {string: {text: "{ws10}", <<: *ws_default}}
                    conditions:
                      ws10_state == unused:   {empty: {}}
                      ws10_state == focused: {string: {text: "{ws10}", <<: *ws_focused}}
                      ws10_state == visible: {string: {text: "{ws10}", <<: *ws_visible}}
                - map: {default: {empty: {}}, conditions: {ws11_new_monitor: *monitor_sep}}
                - map:
                    default:                 {string: {text: "{ws11}", <<: *ws_default}}
                    conditions:
                      ws11_state == unused:   {empty: {}}
                      ws11_state == focused: {string: {text: "{ws11}", <<: *ws_focused}}
                      ws11_state == visible: {string: {text: "{ws11}", <<: *ws_visible}}
                - map:
                    default:
                      - {empty: {left-margin: 5}}
                      - string:
                          text: "{mode}"
                          left-margin: 5
                          right-margin: 5
                          deco:
                            background:
                              color: 9c5842d8
                    conditions:
                      mode == default: {empty: {}}

    - 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

    - cpu:
        interval: 5000
        content:
          list:
            spacing: 0
            font: *font_supplements
            items:
              - ramp:
                  tag: cpu0
                  items: &cpu_ramp
                    # 
                    - empty: {}                                        #  0-6
                    - empty: {}                                        #  6-12
                    - empty: {}                                        # 12-18
                    - empty: {}                                        # 18-25
                    - empty: {}                                        # 25-31
                    - empty: {}                                        # 31-37
                    - empty: {}                                        # 37-43
                    - empty: {}                                        # 43-50
                    - empty: {}                                        # 50-56
                    - empty: {}                                        # 56-62
                    - string: {margin: 1, text: "", foreground: "88888888"       } # 62-68
                    - string: {margin: 1, text: "", foreground: "888888aa"       } # 68-75
                    - string: {margin: 1, text: "", foreground: "888888cc"       } # 75-81
                    - string: {margin: 1, text: "", foreground: "888888ee"       } # 81-87
                    - string: {margin: 1, text: "", foreground: *col_fg_caution  } # 87-93
                    - string: {margin: 1, text: "", foreground: *col_fg_caution  } # 93-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}

    - script:
        poll-interval: 5
        path: /home/midgard/.config/yambar/temp.sh
        content:
          map:
            default:
              - string: &str_temp {text: "{temp}°C", font: "Fira Mono:size=12", right-margin: 5}
              - string: &str_rpm {text: "{rpm} RPM", font: "Fira Sans:size=12", foreground: *col_fg_alt}
            conditions:
              status == normal:
                empty: {}
              status == caution:
                - string: {<<: *str_temp, foreground: *col_fg_caution}
                - string: {<<: *str_rpm}
              status == alert:
                - string: {<<: *str_temp, foreground: *col_fg_alert}
                - string: {<<: *str_rpm}



  center:
    - script:
        path: /home/midgard/.config/yambar/clock.py
        content:
          map:
            default:
              list:
                spacing: 0
                foreground: "ff0000ff"
                items: &clock_contents
                  - string:
                      text: "{weekday}       "
                      font: Fira Sans:size=12
                  - string:
                      text: "{hour} "
                      font: Fira Sans:size=14

                  - string: {text: "{hands}\uecfd", font: *font_supplements_big}

                  - string:
                      text: " {minute}"
                      font: Fira Sans:size=14
                  - string:
                      text: "       {date}"
                      font: Fira Sans:size=12
            conditions:
              time_of_day == night:     {list: {foreground: "888888ff", items: *clock_contents}}
              #time_of_day == morning:   {list: {foreground: "ddbb99ff", items: *clock_contents}}
              time_of_day == morning:   {list: {foreground: "e2d39aff", items: *clock_contents}}
              #time_of_day == noon:      {list: {foreground: "ddddbbff", items: *clock_contents}}
              time_of_day == noon:      {list: {foreground: "dec7aaff", items: *clock_contents}}
              #time_of_day == afternoon: {list: {foreground: "ddddddff", items: *clock_contents}}
              time_of_day == afternoon: {list: {foreground: "deceb9ff", items: *clock_contents}}
              #time_of_day == evening:   {list: {foreground: "dd99bbff", items: *clock_contents}}
              time_of_day == evening:   {list: {foreground: "ff948dff", items: *clock_contents}}


  right:
    - alsa:
        card: hw:PCH
        mixer: Master
        font: Material Icons:pixelsize=15
        content:
          - map:
              default:
                ramp:
                  tag: volume
                  items:
                    - string: {text: ""}
                    - string: {text: ""}
                    - string: {text: ""}
              conditions:
                muted: {string: {text: "", foreground: "777777ff"}}

    - mpd:
        host: /var/lib/mpd/socket
        content:
          map:
            foreground: *col_fg_alt
            default: {empty: {}}
            conditions:
              state == 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"
                      - map:
                          default: {string: {text: "–"}}
                          conditions:
                            artist == "": {empty: {}}
                      - string:
                          text: "{title}"
                          max: 20
                          font: "Fira Sans:size=11"
                      - map:
                          default: {empty: {}}
                          conditions:
                            title == "":
                              string:
                                text: "{file}"
                                max: 20
              #state == paused:
                #- string: {text: "", font: *font_material}
                #- list: *mpd

    - network:
        name: wlp58s0
        content:
          map:
            font: *font_supplements
            default: {string: {foreground: *col_fg_alt, text: "{state}"}}
            conditions:
              state == down: {string: {foreground: *col_fg_alt, text: ""}}
              state == dormant: {string: {text: ""}}
              state == 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
            default: {empty: {}}
            conditions:
              state == up:
                string: {text: ""}

    - battery:
        name: BAT0
        content:
          map:
            font: *font_supplements
            default:
              ramp:
                tag: capacity
                items: *battery_range
            conditions:
              state == charging:
                ramp:
                  tag: capacity
                  items: *battery_range_charging
              state == full:
                ramp:
                  tag: capacity
                  items: *battery_range_charging
              state == not charging:
                - ramp:
                    tag: capacity
                    items: *battery_range_charging
                - string: {text: "×", foreground: *col_fg_alert}
