# fonts we'll be re-using here and there
awesome: &awesome Font Awesome 6 Free Solid:style=Solid:pixelsize=16
awesome_brands: &awesome_brands Font Awesome 6 Brands Regular:style=Regular:pixelsize=16

std_overline: &std_overline {overline: { size: 1, color: ddddddff}}

# This is THE bar configuration
bar:
  height: 20
  location: top
  spacing: 5
  margin: 9

  # Default font
  font: mononoki:pixelsize=16

  foreground: ffffffff
  background: 000000cc

  left:
    - i3:
       sort: ascending
       anchors: # Not used (directly) by f00bar; used here to avoid duplication
          - string: &i3_common {margin: 5, on-click: "swaymsg --quiet workspace {name}"}
          - string: &default {<<: *i3_common, text: "{name}"}
          - focused: &focused
              deco: {stack: [background: {color: 00000000}, <<: *std_overline]}
          - invisible: &invisible {foreground: ffffff55}
          - urgent: &urgent
              foreground: 000000ff
              deco: {stack: [background: {color: ffffffff}, <<: *std_overline]}
          - map: &i3_mode
              default:
                - string:
                    margin: 5
                    text: "{mode}"
                    deco: {background: {color: cc421dff}}
                - empty: {right-margin: 7}
              conditions:
                mode == default: {empty: {}}
       content:
          "":
            map:
              conditions:
                state == focused:   {string: {<<: [*default, *focused]}}
                state == unfocused: {string: {<<: *default}}
                state == invisible: {string: {<<: [*default, *invisible]}}
                state == urgent:    {string: {<<: [*default, *urgent]}}
       
    - foreign-toplevel:
        content:
          map:
            conditions:
              ~activated: {empty: {}}
              activated:
                - string: {text: "{title}"}

  center:
    - clock:
        time-format: "%d %b %H:%M"
        content:
          - string: {text: "{time}"}


  right:
    - network:
        name: enp1s0
        content:
          map:
            conditions:
              ~carrier: {empty: {}}
              carrier:
                map:
                  default: {string: {text: , font: *awesome, foreground: ffffff66}}
                  conditions:
                    state == up && ipv4 != "": {string: {text: , font: *awesome}}

    - network:
        name: wlp2s0
        poll-interval: 1000
        content:
          map:
            default: {string: {text: , font: *awesome, foreground: ffffff66}}
            conditions:
              state == down: {string: {text: , font: *awesome, foreground: ffffff66}}
              state == up:
                map:
                  default:
                    - string: {text: , font: *awesome}

                  conditions:
                    ipv4 == "":
                      - string: {text: , font: *awesome, foreground: ffffff66}
    - alsa:
        card: hw:Generic_1
        mixer: Master
        content:
          map:
            conditions:
              ~online: {string: {text: , font: *awesome, foreground: ff0000ff}}
              online:
                map:
                  on-click: /bin/sh -c "amixer -q sset Headphone unmute && amixer -q sset Master toggle"
                  conditions:
                    muted: {string: {text: , font: *awesome, foreground: ffffff66}}
                    ~muted:
                      ramp:
                        tag: percent
                        items:
                          - string: {text: , font: *awesome}
                          - string: {text: , font: *awesome}
                          - string: {text: , font: *awesome}

    - battery:
        name: BAT0
        poll-interval: 30000
        anchors:
          discharging: &discharging
            list:
              items:
                - ramp:
                    tag: capacity
                    items:
                      - string: {text: , foreground: ff0000ff, font: *awesome}
                      - string: {text: , foreground: ffa600ff, font: *awesome}
                      - string: {text: , font: *awesome}
                      - string: {text: , font: *awesome}
                      - string: {text: , font: *awesome}
                      - string: {text: , font: *awesome}
                      - string: {text: , font: *awesome}
                      - string: {text: , font: *awesome}
                      - string: {text: , font: *awesome}
                      - string: {text: , foreground: 00ff00ff, font: *awesome}
                - string: {text: "{capacity}% {estimate}"}
        content:
          map:
            conditions:
              state == unknown:
                <<: *discharging
              state == discharging:
                <<: *discharging
              state == charging:
                - string: {text: , foreground: 00ff00ff, font: *awesome}
                - string: {text: "{capacity}% {estimate}"}
              state == full:
                - string: {text: , foreground: 00ff00ff, font: *awesome}
                - string: {text: "{capacity}% full"}
              state == "not charging":
                - ramp:
                    tag: capacity
                    items:
                      - string: {text:  , foreground: ff0000ff, font: *awesome}
                      - string: {text:  , foreground: ffa600ff, font: *awesome}
                      - string: {text:  , foreground: 00ff00ff, font: *awesome}
                      - string: {text:  , foreground: 00ff00ff, font: *awesome}
                      - string: {text:  , foreground: 00ff00ff, font: *awesome}
                      - string: {text:  , foreground: 00ff00ff, font: *awesome}
                      - string: {text:  , foreground: 00ff00ff, font: *awesome}
                      - string: {text:  , foreground: 00ff00ff, font: *awesome}
                      - string: {text:  , foreground: 00ff00ff, font: *awesome}
                      - string: {text:  , foreground: 00ff00ff, font: *awesome}
                - string: {text: "{capacity}%"}

    - label:
        content:
          string:
            on-click: session-wl
            text: 
            font: *awesome
