jointhefreeworld.org

Building Conky with Wayland Support on GNU Guix

februari 17, 2025

Conky is a lightweight system monitor that can display system statistics on the desktop. While it was originally built for X11, recent versions have added experimental Wayland support. Since I use GNU Guix and run a Wayland-based environment (Sway), I wanted to get Conky building with Wayland support. This post explains how I achieved that.

Guix is a functional package manager that allows you to define software packages declaratively. Since Conky is not in the official Guix repository with Wayland support enabled, I created a custom package definition for it.

Enabled Wayland Build Option: The -DBUILD_WAYLAND=ON flag ensures Wayland support is compiled in.

Added Required Dependencies: Added gperf , cairo, pango wayland and wayland-protocols to inputs.

Since Conky was originally designed for X11, some adjustments are needed for Wayland:

No own_window: In X11, Conky runs in its own window. On Wayland, it needs to be embedded into a compositor-specific layer.

Use xwayland If Needed: Some features might require running Conky through XWayland.

Wayland-Specific Patches: Some users have patched Conky to integrate better with Wayland. If needed, applying community patches might help.

With a bit of tweaking, I got Conky running with Wayland on GNU Guix. While it’s still experimental, it works well enough for basic system monitoring. If you’re on a similar setup and want a lightweight system monitor, give this a try!

Below a screenshot of how it runs in Sway, on Guix (SSS - Supreme Sexp System):

Below is the Guile Scheme code I used:

(define-module (sss packages conky)
  #:use-module (guix packages)
  #:use-module (guix utils)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix build-system cmake)
  #:use-module ((guix licenses)
                #:prefix license:)
  #:use-module (gnu packages curl)
  #:use-module (gnu packages fontutils)
  #:use-module (gnu packages image)
  #:use-module (gnu packages linux)
  #:use-module (gnu packages freedesktop)
  #:use-module (gnu packages gtk)
  #:use-module (gnu packages lua)
  #:use-module (gnu packages ncurses)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages gperf)
  #:use-module (gnu packages pulseaudio)
  #:use-module (gnu packages xorg))

(define-public sss-conky
  (package
    (name "conky")
    (home-page "https://github.com/brndnmtthws/conky")
    (version "1.22.0")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url home-page)
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "08ggr2nks3g1lk5k9hlv9mzyzbxms6yamhw4ndhayhn6n9dzqsnx"))))
    (build-system cmake-build-system)
    (arguments
     `(#:configure-flags (list "-DRELEASE=true" "-DBUILD_PULSEAUDIO=ON"
                               "-DBUILD_WLAN=ON" "-DBUILD_TESTS=ON"
                               "-DBUILD_WAYLAND=ON")
       #:phases (modify-phases %standard-phases
                  (add-after 'unpack 'add-freetype-to-search-path
                    (lambda* (#:key inputs #:allow-other-keys)
                      (substitute* "cmake/ConkyPlatformChecks.cmake"
                        (("set\\(INCLUDE_SEARCH_PATH")
                         (string-append "set(INCLUDE_SEARCH_PATH "
                                        (assoc-ref inputs "freetype")
                                        "/include/freetype2 "))) #t))
                  (replace 'install
                    (lambda* (#:key outputs #:allow-other-keys)
                      (let* ((out (assoc-ref outputs "out"))
                             (bin (string-append out "/bin")))
                        (install-file "src/conky" bin)) #t)))))
    (inputs (list freetype
                  imlib2
                  libx11
                  libxdamage
                  libxext
                  cairo
                  libxft
                  libxi
                  libxinerama
                  pango
                  pulseaudio
                  lua
                  gperf
                  ncurses
                  wayland
                  wayland-protocols
                  curl
                  wireless-tools))
    (native-inputs (list pkg-config))
    (synopsis "Lightweight system monitor for X")
    (description
     "Conky is a lightweight system monitor for X that displays operating
system statistics (CPU, disk, and memory usage, etc.) and more on the
desktop.")
    (license license:gpl3+)))