Skip to content

Showcase / Document - Waybar config in Guile Scheme #3784

Open
@jjba23

Description

@jjba23

Hey ! I love WayBar and think it really is an amazing project, thank you all for your hard work, in making a solid and flexible program that the community loves.

I wanted to share my Waybar config, fully in Guile Scheme (a Lisp). I think it could be beneficial for the community to know that this is possible, and in fact real nice.

I wonder what the best place could be to document this.

One can use it like this:

(use-modules (json))

(scm->json-string sss-joe-waybar-conf #:pretty #t)

Here the config, quite similar to defaults:

(define sss-joe-waybar-conf
  `((position . bottom)
    (height . 40)
    (spacing . 4)
    (modules-left . #(clock sway/workspaces sway/mode
                            sway/scratchpad custom/media sway/window))
    (modules-center . ())
    (modules-right . #(mpd idle_inhibitor pulseaudio
                           network power-profiles-daemon cpu
                           memory temperature backlight
                           keyboard-state sway/language battery
                           battery#bat2 tray custom/power))
    (sway/workspaces . ((disable-scroll . #t)
                        (all-outputs . #t)
                        (warp-on-scroll . #f)
                        (format . "{icon}")
                        (format-icons . (("1" . "I") ("2" . "II") ("3" . "III")
                                         ("4" . "IV") ("5" . "V") ("6" . "VI")
                                         ("7" . "VII") ("8" . "VIII") ("9" . "IX")
                                         ("10" . "X") ("default" . "")
                                         ;; ("urgent" . "") ("focused" . "")
                                         ))))
    (keyboard-state . ((numlock . #t)
                       (capslock . #t)
                       (format . "{name} {icon} ")
                       (format-icons . ((locked . "")
                                        (unlocked . "")))))
    (sway/mode . ((format . "<span style=\"italic\">{}</span>")))
    (sway/scratchpad . ((format . "{icon} {count}")
                        (show-empty . #f)
                        (format-icons . #("" ""))
                        (tooltip . #t)
                        (tooltip-format . "{app}: {title}")))
    (mpd . ((format . ,(string-append
                        "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}"
                        "{artist} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) "
                        "⸨{songPosition}|{queueLength}⸩ "))
            (format-disconnected . "Disconnected ")
            (format-stopped . "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ")
            (unknown-tag . "N/A")
            (interval . 5)
            (consume-icons . ((on . "")))
            (random-icons . ((off . "<span color=\"#f53c3c\"></span> ")
                             (on . "")))
            (repeat-icons . ((on . "")))
            (single-icons . ((on . "1 ")))
            (state-icons . ((paused . "")
                            (playing . "")))
            (tooltip-format . "MPD (connected)")
            (tooltip-format-disconnected . "MPD (disconnected)")))
    (idle_inhibitor . ((format . "{icon}")
                       (format-icons . ((activated . "")
                                        (deactivated . "")))))
    (tray . ((spacing . 10)))    
    (clock . ((format . "{:%H:%M %z - SSS/GNU - %a, %d %B %Y}")
              (tooltip-format . "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>")))
    (cpu . ((format . "{usage}% ")
            (tooltip . #f)))
    (memory . ((format . "{}% ")))
    (temperature . ((critical-threshold . 80)
                    (format . "{temperatureC}°C {icon}")
                    (format-icons . #(""))))
    (backlight . ((format . "{percent}% {icon}")
                  (format-icons . #("" "" "" "" "" "" "" "" ""))))
    (battery . ((states . ((warning . 30)
                           (critical . 15)))
                (format . "{capacity}% {icon}")
                (format-full . "{capacity}% {icon}")
                (format-charging . "{capacity}% ")
                (format-plugged . "{capacity}% ")
                (format-alt . "{time} {icon}")
                (format-icons . #("" "" "" "" ""))))
    (battery#bat2 . ((bat . "BAT2")))
    (power-profiles-daemon . ((format . "{icon}")
                              (tooltip-format . "Power profile: {profile}\nDriver: {driver}")
                              (tooltip . #t)
                              (format-icons . ((default . "")
                                               (performance . "")
                                               (balanced . "")
                                               (power-saver . "")))))
    (network . ((format-wifi . "{essid} ({signalStrength}%) ")
                (format-ethernet . "{ipaddr}/{cidr} ")
                (tooltip-format . "{ifname} via {gwaddr} ")
                (format-linked . "{ifname} (No IP) ")
                (format-disconnected . "Disconnected ⚠")
                (format-alt . "{ifname}: {ipaddr}/{cidr}")))
    (pulseaudio . ((format . "{volume}% {icon} {format_source}")
                   (format-bluetooth . "{volume}% {icon} {format_source}")
                   (format-bluetooth-muted . " {icon} {format_source}")
                   (format-muted . " {format_source}")
                   (format-source . "{volume}% ")
                   (format-source-muted . "")
                   (format-icons . ((headphone . "")
                                    (hands-free . "")
                                    (headset . "")
                                    (phone . "")
                                    (portable . "")
                                    (car . "")
                                    (default . #("" "" ""))
                                    ))
                   (on-click . "pavucontrol")))
    (custom/power . ((format . "")
                     (tooltip . #f)
                     (menu . "on-click")
                     (menu-file . "$HOME/.config/waybar/power_menu.xml")
                     (menu-actions . ((shutdown . "sudo halt")
                                      (reboot . "sudo reboot")
                                      (suspend . "sudo loginctl suspend")
                                      (hibernate . "sudo loginctl hibernate")))))
    ))

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions