guix_mirror_bot pushed a commit to branch master
in repository guix.
commit 1ff5351654f61af9127dc837468e3f444c8605f0
Author: Sughosha <[email protected]>
AuthorDate: Fri Apr 3 12:30:26 2026 +0530
gnu: Add nwg-bar.
* gnu/packages/nwg-shell.scm (nwg-bar): New variable.
* gnu/packages/patches/nwg-bar-0.1.6-fallback-paths.patch: New patch file.
* gnu/packages/patches/nwg-bar-0.1.6-fix-silent-errors.patch: New patch
file.
* gnu/local.mk (dist_patch_DATA): Register the new patch files.
Relates-to: guix/guix!7644
Reviewed-by: Maxim Cournoyer <[email protected]>
Signed-off-by: Sharlatan Hellseher <[email protected]>
---
gnu/local.mk | 2 +
gnu/packages/nwg-shell.scm | 73 ++++++++++++++++++++++
.../patches/nwg-bar-0.1.6-fallback-paths.patch | 58 +++++++++++++++++
.../patches/nwg-bar-0.1.6-fix-silent-errors.patch | 36 +++++++++++
4 files changed, 169 insertions(+)
diff --git a/gnu/local.mk b/gnu/local.mk
index 1b3295a564..1ae25dfbdf 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2019,6 +2019,8 @@ dist_patch_DATA =
\
%D%/packages/patches/nvi-assume-preserve-path.patch \
%D%/packages/patches/nvi-dbpagesize-binpower.patch \
%D%/packages/patches/nvi-db4.patch \
+ %D%/packages/patches/nwg-bar-0.1.6-fallback-paths.patch \
+ %D%/packages/patches/nwg-bar-0.1.6-fix-silent-errors.patch \
%D%/packages/patches/nwg-dock-0.4.3-fallback-paths.patch \
%D%/packages/patches/nwg-dock-hyprland-0.4.8-fallback-paths.patch \
%D%/packages/patches/nwg-drawer-0.7.5-fallback-paths.patch \
diff --git a/gnu/packages/nwg-shell.scm b/gnu/packages/nwg-shell.scm
index 0ad049f6e6..2234aa10f4 100644
--- a/gnu/packages/nwg-shell.scm
+++ b/gnu/packages/nwg-shell.scm
@@ -166,6 +166,79 @@ nwg-shell project.")
in Python. It is meant to work under a Wayland compositor, like sway or
Hyprland.
+This application is a part of the nwg-shell project.")
+ (license license:expat)))
+
+(define-public nwg-bar
+ (package
+ (name "nwg-bar")
+ (version "0.1.6")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/nwg-piotr/nwg-bar")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "0yds8sivilirw2cqkq621z731l4hragzgpajjls79f4zkwlrdpz4"))
+ (patches
+ (search-patches
+ ;; TODO: Remove this patch in the next update.
+ "nwg-bar-0.1.6-fix-silent-errors.patch"
+ "nwg-bar-0.1.6-fallback-paths.patch"))
+ (modules '((guix build utils)))
+ ;; Replace systemd commands with elogind commands.
+ (snippet
+ '(substitute* "config/bar.json"
+ (("\"systemctl (-i |)") "\"loginctl ")))))
+ (build-system go-build-system)
+ (arguments
+ (list
+ #:install-source? #f
+ #:import-path "github.com/nwg-piotr/nwg-bar"
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'patch-paths
+ (lambda _
+ (with-directory-excursion "src/github.com/nwg-piotr/nwg-bar"
+ (substitute* '("tools.go" "config/bar.json")
+ (("\\/usr\\/share") (string-append #$output "/share"))))))
+ (add-after 'install 'install-data
+ (lambda _
+ (mkdir-p (string-append #$output "/share"))
+ (with-directory-excursion (string-append "src/github.com/"
+ "nwg-piotr/nwg-bar")
+ (copy-recursively "config"
+ (string-append #$output "/share/nwg-bar"))
+ (copy-recursively "images"
+ (string-append #$output "/share/nwg-bar/"
+ "images"))
+ (install-file "README.md"
+ (string-append #$output "/share/doc/nwg-bar")))))
+ (add-after 'install 'wrap-program
+ (lambda _
+ (wrap-program (string-append #$output "/bin/nwg-bar")
+ `("GI_TYPELIB_PATH" =
+ (,(getenv "GI_TYPELIB_PATH")))))))))
+ (native-inputs
+ (list gobject-introspection
+ go-github-com-allan-simon-go-singleinstance
+ go-github-com-dlasky-gotk3-layershell
+ go-github-com-gotk3-gotk3
+ go-github-com-joshuarubin-go-sway
+ pkg-config))
+ (inputs
+ (list bash-minimal
+ gtk+
+ gtk-layer-shell))
+ (home-page "https://github.com/nwg-piotr/nwg-bar")
+ (synopsis "GTK3-based button bar for wlroots-based compositors")
+ (description
+ "nwg-bar is a Golang replacement to the @command{nwgbar} command (a part
of
+nwg-launchers), with some improvements. Originally aimed at sway, works with
+wlroots-based compositors only.
+
This application is a part of the nwg-shell project.")
(license license:expat)))
diff --git a/gnu/packages/patches/nwg-bar-0.1.6-fallback-paths.patch
b/gnu/packages/patches/nwg-bar-0.1.6-fallback-paths.patch
new file mode 100644
index 0000000000..f373d8ac90
--- /dev/null
+++ b/gnu/packages/patches/nwg-bar-0.1.6-fallback-paths.patch
@@ -0,0 +1,58 @@
+https://github.com/nwg-piotr/nwg-bar/pull/41
+
+From 9b6e47a8bc27efb37ac9244f5ec2afda4e419903 Mon Sep 17 00:00:00 2001
+From: Sughosha <[email protected]>
+Date: Sat, 18 Apr 2026 16:01:34 +0530
+Subject: [PATCH] Support fallback paths
+
+---
+ main.go | 20 ++++++++++++++++++--
+ 1 file changed, 18 insertions(+), 2 deletions(-)
+
+diff --git a/main.go b/main.go
+index d2660f1..4d9f9f6 100644
+--- a/main.go
++++ b/main.go
+@@ -29,6 +29,8 @@ var (
+ src glib.SourceHandle
+ outerOrientation gtk.Orientation
+ innerOrientation gtk.Orientation
++ cssFilePath string
++ configFilePath string
+ )
+
+ type Button struct {
+@@ -104,14 +106,28 @@ func main() {
+
+ // Copy default config
+ if !pathExists(filepath.Join(configDirectory, "style.css")) {
+- err := copyFile(filepath.Join(dataHome, "nwg-bar/style.css"),
filepath.Join(configDirectory, "style.css"))
++ if pathExists(filepath.Join(dataHome, "nwg-bar/style.css")) {
++ cssFilePath = filepath.Join(dataHome,
"nwg-bar/style.css")
++ } else if pathExists("/usr/local/share/nwg-bar/style.css") {
++ cssFilePath = "/usr/local/share/nwg-bar/style.css"
++ } else {
++ cssFilePath = "/usr/share/nwg-bar/style.css"
++ }
++ err := copyFile(cssFilePath, filepath.Join(configDirectory,
"style.css"))
+ if err != nil {
+ log.Fatal("error copying default style.css: ", err)
+ return
+ }
+ }
+ if !pathExists(filepath.Join(configDirectory, "bar.json")) {
+- err := copyFile(filepath.Join(dataHome, "nwg-bar/bar.json"),
filepath.Join(configDirectory, "bar.json"))
++ if pathExists(filepath.Join(dataHome, "nwg-bar/bar.json")) {
++ configFilePath = filepath.Join(dataHome,
"nwg-bar/bar.json")
++ } else if pathExists("/usr/local/share/nwg-bar/bar.json") {
++ configFilePath = "/usr/local/share/nwg-bar/bar.json"
++ } else {
++ configFilePath = "/usr/share/nwg-bar/bar.json"
++ }
++ err := copyFile(configFilePath, filepath.Join(configDirectory,
"bar.json"))
+ if err != nil {
+ log.Fatal("error copying default bar.json: ", err)
+ return
+--
+2.52.0
+
diff --git a/gnu/packages/patches/nwg-bar-0.1.6-fix-silent-errors.patch
b/gnu/packages/patches/nwg-bar-0.1.6-fix-silent-errors.patch
new file mode 100644
index 0000000000..90a1eed605
--- /dev/null
+++ b/gnu/packages/patches/nwg-bar-0.1.6-fix-silent-errors.patch
@@ -0,0 +1,36 @@
+From 899ac58b9c2db70d5ab2fabeb1d255d848bae109 Mon Sep 17 00:00:00 2001
+From: BBaoVanC <[email protected]>
+Date: Fri, 30 Aug 2024 13:15:24 -0500
+Subject: [PATCH] Fix a few silent errors
+
+---
+ main.go | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/main.go b/main.go
+index 26cbd24..d2660f1 100644
+--- a/main.go
++++ b/main.go
+@@ -106,12 +106,14 @@ func main() {
+ if !pathExists(filepath.Join(configDirectory, "style.css")) {
+ err := copyFile(filepath.Join(dataHome, "nwg-bar/style.css"),
filepath.Join(configDirectory, "style.css"))
+ if err != nil {
++ log.Fatal("error copying default style.css: ", err)
+ return
+ }
+ }
+ if !pathExists(filepath.Join(configDirectory, "bar.json")) {
+ err := copyFile(filepath.Join(dataHome, "nwg-bar/bar.json"),
filepath.Join(configDirectory, "bar.json"))
+ if err != nil {
++ log.Fatal("error copying default bar.json: ", err)
+ return
+ }
+ }
+@@ -127,6 +129,7 @@ func main() {
+ // parse JSON to []Button
+ err := json.Unmarshal([]byte(templateJson), &buttons)
+ if err != nil {
++ log.Fatal("error parsing config: ", err)
+ return
+ } else {
+ println(fmt.Sprintf("%v items loaded from template %s",
len(buttons), *templateFileName))