Giter Club home page Giter Club logo

goobar's Introduction

goobar

goobar is a status line generator similar in spirit to i3status(1). The main difference is that goobar is written in GNU Guile and highly extensible.

It consists of two distinct parts: a set of status collectors, and a program that converts their results to a format that can be consumed by window managers such as Sway or i3.

Requirements

Goobar has no dependencies apart from Guile itself. For extra functionality, consider installing:

Installation

From a source checkout, run:

$ autoreconf -vif
$ ./configure && make -j $(nproc)
# At this stage, you can run the program as:
$ ./pre-inst-env goobar
# Or install it:
$ sudo make install

If you have GNU Guix on your system, you can install goobar with e.g. guix package -p /tmp/goobar -f guix.scm and then run it as /tmp/goobar/bin/goobar.

Configuration

By default, the output is similar to that of i3status:

$ goobar
IPv6: โŒ | ๐Ÿ–ด 81% | ๐Ÿ“ถ Home Wifi (68%, 144.4 Mb/s) | E: down | ๐Ÿ”‹ 75.62% 06:35 | ๐Ÿ”Š 99% | ๐Ÿ‹๏ธ 0.40 | ๐ŸŒก๏ธ46ยฐC | 6.7 GiB | 2023-06-26 20:49:05
IPv6: โŒ | ๐Ÿ–ด 81% | ๐Ÿ“ถ Home Wifi (69%, 144.4 Mb/s) | E: down | ๐Ÿ”‹ 75.55% 06:31 | ๐Ÿ”Š 99% | ๐Ÿ‹๏ธ 0.44 | ๐ŸŒก๏ธ47ยฐC | 6.7 GiB | 2023-06-26 20:49:10
[...]

It can be customized by creating ~/.config/goobar/config.scm. This file should return a list of either <status> objects, or plain strings.

Statuses or strings can be "annotated" to provide extra properties, such as custom color, width, alignment, etc. See man 7 swaybar-protocol for a list of properties, all of which are supported by (goobar annotation).

Example:

(use-modules (status)
             (status collector backlight)
             (status collector battery)
             (status collector cpu-usage)
             (status collector disk)
             (status collector ipv6)
             (status collector load)
             (status collector network-rate)
             (status collector pulseaudio)
             (status collector time)
             (status collector wifi)
             (goobar annotation)
             (ice-9 format))

(define (random-color)
  (format #f "#~2,'0x~2,'0x~2,'0x"
          (random 255) (random 255) (random 255)))

(list (disk-status "/" #:degraded-threshold "80%")
      (disk-status "/home")
      (ipv6-status
       ;; Don't bother printing the full IPv6 address.
       #:format (lambda (status)
                  (if (status-good? status) "โœ”" "โŒ")))
      (annotate
       (wifi-status "wlp0s20f3"
                    #:format
                    (lambda (status)
                      (if (status-bad? status)
                          "down"
                          (let ((data (status-data status)))
                            (format #f "~a (~d%~a)"
                                    (assoc-ref data 'ssid)
                                    (assoc-ref data 'quality)
                                    ;; Print bitrate only when available.
                                    (format #f "~@[, ~a~]"
                                            (and=> (assoc-ref data 'bitrate)
                                                   format-bitrate)))))))
       ;; Disable separator to meld with the rate status below.
       #:separator? #f)
      (network-rate-status "wlp0s20f3"
                           #:format
                           (lambda (status)
                             (let* ((data (status-data status))
                                    (down (assoc-ref data 'rx-bytes/sec)))
                               (format #f "โฌ‡ ~a" (format-bytes down)))))
      (battery-status "BAT0")
      ;; Remove silly load icon.
      (annotate (load-status '5min) #:icon #f)
      (cpu-usage-status)
      (pulseaudio-status "0")
      (backlight-status)
      (annotate (format #f "Hi ~a!" (getenv "USER")) #:color (random-color))
      (time-status "%d/%m %T"))

Contributing

Pull requests welcome! There are a bunch of TODOs in the code, and probably even more bugs. Feel free to add more status collectors. Note that the status collector API is subject to change, feedback wanted.

Planned features that are not yet implemented:

  • Bidirectional communication (click events)
  • More output formats (dzen2, xmobar, etc)

License

Unless otherwise noted, all code is GNU General Public License version 3, or (at your option) any later version.

goobar's People

Contributors

mbakke avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.