guix_mirror_bot pushed a commit to branch master
in repository guix.

commit 60855a79b189ec48ebf0374707c089b21d3da8e3
Author: Sughosha <[email protected]>
AuthorDate: Fri Apr 10 14:02:59 2026 +0530

    gnu: Add nwg-dock-hyprland.
    
    * gnu/packages/nwg-shell.scm (nwg-dock-hyprland): New variable.
    * gnu/packages/patches/nwg-dock-hyprland-0.4.8-fallback-paths.patch New 
file.
    * gnu/local.mk (dist_patch_DATA): Register it.
    
    Relates-to: guix/guix!7644
    Reviewed-by: Maxim Cournoyer <[email protected]>
    Signed-off-by: Sharlatan Hellseher <[email protected]>
---
 gnu/local.mk                                       |   1 +
 gnu/packages/nwg-shell.scm                         |  74 ++++++
 .../nwg-dock-hyprland-0.4.8-fallback-paths.patch   | 278 +++++++++++++++++++++
 3 files changed, 353 insertions(+)

diff --git a/gnu/local.mk b/gnu/local.mk
index bc8edc9ac5..1b3295a564 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2020,6 +2020,7 @@ dist_patch_DATA =                                         
\
   %D%/packages/patches/nvi-dbpagesize-binpower.patch           \
   %D%/packages/patches/nvi-db4.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   \
   %D%/packages/patches/obs-advanced-masks-nlohmann-json.patch  \
   %D%/packages/patches/obs-modules-location.patch              \
diff --git a/gnu/packages/nwg-shell.scm b/gnu/packages/nwg-shell.scm
index 78c29cd307..7c445d13ae 100644
--- a/gnu/packages/nwg-shell.scm
+++ b/gnu/packages/nwg-shell.scm
@@ -999,3 +999,77 @@ button.
 
 This application is a part of the nwg-shell project.")
     (license license:expat)))
+
+(define-public nwg-dock-hyprland
+  (package
+    (name "nwg-dock-hyprland")
+    (version "0.4.8")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nwg-piotr/nwg-dock-hyprland";)
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1cfbrapdiw8qwfcbmyqz6k0q5ny8balzmpwsnp9b3rny2w0cvqkb"))
+       (patches
+        (search-patches "nwg-dock-hyprland-0.4.8-fallback-paths.patch"))))
+    (build-system go-build-system)
+    (arguments
+     (list
+       ;Tests fail due to a call having arguments but no formatting
+      ;; directives.
+      #:tests? #f
+      #:install-source? #f
+      #:import-path "github.com/nwg-piotr/nwg-dock-hyprland"
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'patch-paths
+            (lambda _
+              (with-directory-excursion (string-append "src/github.com/"
+                                                       "nwg-piotr/"
+                                                       "nwg-dock-hyprland")
+                (substitute* '("main.go" "tools.go")
+                  (("\\/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-dock-hyprland")
+                (copy-recursively "config"
+                                  (string-append #$output
+                                                 "/share/nwg-dock-hyprland"))
+                (copy-recursively "images"
+                                  (string-append #$output "/share/"
+                                                 "nwg-dock-hyprland/images"))
+                (install-file "README.md"
+                              (string-append #$output "/share/doc/"
+                                             "nwg-dock-hyprland")))))
+          (add-after 'install 'wrap-program
+            (lambda _
+              (wrap-program (string-append #$output "/bin/nwg-dock-hyprland")
+                `("GI_TYPELIB_PATH" =
+                  (,(getenv "GI_TYPELIB_PATH")))))))))
+    (native-inputs
+     (list gobject-introspection
+           go-github-com-allan-simon-go-singleinstance
+           go-github-com-diamondburned-gotk4
+           go-github-com-diamondburned-gotk4-layer-shell
+           go-github-com-sirupsen-logrus
+           pkg-config))
+    (inputs
+     (list bash-minimal
+           gtk+
+           gtk-layer-shell))
+    (home-page "https://github.com/nwg-piotr/nwg-dock-hyprland";)
+    (synopsis "GTK3 based dock for Hyprland")
+    (description
+     "nwg-dock-hyprland is a fully configurable (w/ command line arguments and
+CSS) GTK3 based dock, written in Go, aimed exclusively at Hyprland Wayland
+compositor.  It features pinned buttons, task buttons, the workspace switcher
+and the launcher button.
+
+This application is a part of the nwg-shell project.")
+    (license license:expat)))
diff --git a/gnu/packages/patches/nwg-dock-hyprland-0.4.8-fallback-paths.patch 
b/gnu/packages/patches/nwg-dock-hyprland-0.4.8-fallback-paths.patch
new file mode 100644
index 0000000000..3a5bf56c17
--- /dev/null
+++ b/gnu/packages/patches/nwg-dock-hyprland-0.4.8-fallback-paths.patch
@@ -0,0 +1,278 @@
+https://github.com/nwg-piotr/nwg-dock-hyprland/pull/115
+
+From 06844e1a74e61e8ff0bd83c240d4c86b124af1e9 Mon Sep 17 00:00:00 2001
+From: Sughosha <[email protected]>
+Date: Sat, 18 Apr 2026 12:01:42 +0530
+Subject: [PATCH] Support fallback paths
+
+---
+ main.go  |   8 +++
+ tools.go | 159 +++++++++++++++++++++++++++++++++++++++++++------------
+ 2 files changed, 133 insertions(+), 34 deletions(-)
+
+diff --git a/main.go b/main.go
+index 2cf4968..e0b1029 100644
+--- a/main.go
++++ b/main.go
+@@ -62,6 +62,7 @@ var (
+       classesToIgnore                    []string
+       mouseInsideDock                    bool
+       mouseInsideHotspot                 bool
++      cssFilePath                        string
+ )
+ 
+ // Flags
+@@ -529,6 +530,13 @@ func main() {
+       createDir(configDirectory)
+ 
+       if !pathExists(fmt.Sprintf("%s/style.css", configDirectory)) {
++              if pathExists(filepath.Join(dataHome, 
"nwg-dock-hyprland/style.css")) {
++                      cssFilePath = filepath.Join(dataHome, 
"nwg-dock-hyprland/style.css")
++              } else if 
pathExists("/usr/local/share/nwg-dock-hyprland/style.css"){
++                      cssFilePath = 
"/usr/local/share/nwg-dock-hyprland/style.css"
++              } else {
++                      cssFilePath = "/usr/share/nwg-dock-hyprland/style.css"
++              }
+               err := copyFile(filepath.Join(dataHome, 
"nwg-dock-hyprland/style.css"), fmt.Sprintf("%s/style.css", configDirectory))
+               if err != nil {
+                       log.Warnf("Error copying file: %s", err)
+diff --git a/tools.go b/tools.go
+index a8033dd..7aebf45 100644
+--- a/tools.go
++++ b/tools.go
+@@ -17,6 +17,18 @@ import (
+       "strings"
+ )
+ 
++// Icons
++var (
++      iconIconMissing                    string
++      iconTaskEmpty                      string
++      iconTaskEmptyVertical              string
++      iconGrid                           string
++      iconTaskSingle                     string
++      iconTaskSingleVertical             string
++      iconTaskMultiple                   string
++      iconTaskMultipleVertical           string
++)
++
+ func taskInstances(ID string) []client {
+       var found []client
+       for _, c := range clients {
+@@ -27,6 +39,15 @@ func taskInstances(ID string) []client {
+       return found
+ }
+ 
++func pathExists(name string) bool {
++      if _, err := os.Stat(name); err != nil {
++              if os.IsNotExist(err) {
++                      return false
++              }
++      }
++      return true
++}
++
+ func pinnedButton(ID string, position *string) *gtk.Box {
+       vertical = *position == "left" || *position == "right"
+ 
+@@ -39,8 +60,14 @@ func pinnedButton(ID string, position *string) *gtk.Box {
+ 
+       image, err := createImage(ID, imgSizeScaled)
+       if err != nil || image == nil {
+-              pixbuf, err := 
gdkpixbuf.NewPixbufFromFileAtSize(filepath.Join(dataHome, 
"nwg-dock-hyprland/images/icon-missing.svg"),
+-                      imgSizeScaled, imgSizeScaled)
++              if pathExists(filepath.Join(dataHome, 
"nwg-dock-hyprland/images/icon-missing.svg")) {
++                      iconIconMissing = filepath.Join(dataHome, 
"nwg-dock-hyprland/images/icon-missing.svg")
++              } else if 
pathExists("/usr/local/share/nwg-dock-hyprland/images/icon-missing.svg") {
++                      iconIconMissing = 
"/usr/local/share/nwg-dock-hyprland/images/icon-missing.svg"
++              } else {
++                      iconIconMissing = 
"/usr/share/nwg-dock-hyprland/images/icon-missing.svg"
++              }
++              pixbuf, err := 
gdkpixbuf.NewPixbufFromFileAtSize(iconIconMissing, imgSizeScaled, imgSizeScaled)
+               if err == nil {
+                       image = gtk.NewImageFromPixbuf(pixbuf)
+               } else {
+@@ -74,11 +101,23 @@ func pinnedButton(ID string, position *string) *gtk.Box {
+ 
+       var pixbuf *gdkpixbuf.Pixbuf
+       if !vertical {
+-              pixbuf, err = 
gdkpixbuf.NewPixbufFromFileAtSize(filepath.Join(dataHome, 
"nwg-dock-hyprland/images/task-empty.svg"),
+-                      imgSizeScaled, imgSizeScaled/8)
++              if pathExists(filepath.Join(dataHome, 
"nwg-dock-hyprland/images/task-empty.svg")) {
++                      iconTaskEmpty = filepath.Join(dataHome, 
"nwg-dock-hyprland/images/task-empty.svg")
++              } else if 
pathExists("/usr/local/share/nwg-dock-hyprland/images/task-empty.svg") {
++                      iconTaskEmpty = 
"/usr/local/share/nwg-dock-hyprland/images/task-empty.svg"
++              } else {
++                      iconTaskEmpty = 
"/usr/share/nwg-dock-hyprland/images/task-empty.svg"
++              }
++              pixbuf, err = gdkpixbuf.NewPixbufFromFileAtSize(iconTaskEmpty, 
imgSizeScaled, imgSizeScaled/8)
+       } else {
+-              pixbuf, err = 
gdkpixbuf.NewPixbufFromFileAtSize(filepath.Join(dataHome, 
"nwg-dock-hyprland/images/task-empty-vertical.svg"),
+-                      imgSizeScaled/8, imgSizeScaled)
++              if pathExists(filepath.Join(dataHome, 
"nwg-dock-hyprland/images/task-empty-vertical.svg")) {
++                      iconTaskEmptyVertical = filepath.Join(dataHome, 
"nwg-dock-hyprland/images/task-empty-vertical.svg")
++              } else if 
pathExists("/usr/local/share/nwg-dock-hyprland/images/task-empty-vertical.svg") 
{
++                      iconTaskEmptyVertical = 
"/usr/local/share/nwg-dock-hyprland/images/task-empty-vertical.svg"
++              } else {
++                      iconTaskEmptyVertical = 
"/usr/share/nwg-dock-hyprland/images/task-empty-vertical.svg"
++              }
++              pixbuf, err = 
gdkpixbuf.NewPixbufFromFileAtSize(iconTaskEmptyVertical, imgSizeScaled/8, 
imgSizeScaled)
+       }
+ 
+       if err == nil {
+@@ -120,7 +159,14 @@ func launcherButton(position *string) *gtk.Box {
+               var pixbuf *gdkpixbuf.Pixbuf
+               var e error
+               if *ico == "" {
+-                      pixbuf, e = 
gdkpixbuf.NewPixbufFromFileAtSize(filepath.Join(dataHome, 
"nwg-dock-hyprland/images/grid.svg"), imgSizeScaled, imgSizeScaled)
++                      if pathExists(filepath.Join(dataHome, 
"nwg-dock-hyprland/images/grid.svg")) {
++                              iconGrid = filepath.Join(dataHome, 
"nwg-dock-hyprland/images/grid.svg")
++                      } else if 
pathExists("/usr/local/share/nwg-dock-hyprland/images/grid.svg") {
++                              iconGrid = 
"/usr/local/share/nwg-dock-hyprland/images/grid.svg"
++                      } else {
++                              iconGrid = 
"/usr/share/nwg-dock-hyprland/images/grid.svg"
++                      }
++                      pixbuf, e = gdkpixbuf.NewPixbufFromFileAtSize(iconGrid, 
imgSizeScaled, imgSizeScaled)
+               } else {
+                       pixbuf, e = createPixbuf(*ico, imgSizeScaled)
+               }
+@@ -147,11 +193,23 @@ func launcherButton(position *string) *gtk.Box {
+                       button.Connect("enter-notify-event", cancelClose)
+ 
+                       if !vertical {
+-                              pixbuf, e = 
gdkpixbuf.NewPixbufFromFileAtSize(filepath.Join(dataHome, 
"nwg-dock-hyprland/images/task-empty.svg"),
+-                                      imgSizeScaled, imgSizeScaled/8)
++                              if pathExists(filepath.Join(dataHome, 
"nwg-dock-hyprland/images/task-empty.svg")) {
++                                      iconTaskEmpty = filepath.Join(dataHome, 
"nwg-dock-hyprland/images/task-empty.svg")
++                              } else if 
pathExists("/usr/local/share/nwg-dock-hyprland/images/task-empty.svg") {
++                                      iconTaskEmpty = 
"/usr/local/share/nwg-dock-hyprland/images/task-empty.svg"
++                              } else {
++                                      iconTaskEmpty = 
"/usr/share/nwg-dock-hyprland/images/task-empty.svg"
++                              }
++                              pixbuf, e = 
gdkpixbuf.NewPixbufFromFileAtSize(iconTaskEmpty, imgSizeScaled, imgSizeScaled/8)
+                       } else {
+-                              pixbuf, e = 
gdkpixbuf.NewPixbufFromFileAtSize(filepath.Join(dataHome, 
"nwg-dock-hyprland/images/task-empty-vertical.svg"),
+-                                      imgSizeScaled/8, imgSizeScaled)
++                              if pathExists(filepath.Join(dataHome, 
"nwg-dock-hyprland/images/task-empty-vertical.svg")) {
++                                      iconTaskEmptyVertical = 
filepath.Join(dataHome, "nwg-dock-hyprland/images/task-empty-vertical.svg")
++                              } else if 
pathExists("/usr/local/share/nwg-dock-hyprland/images/task-empty-vertical.svg") 
{
++                                      iconTaskEmptyVertical = 
"/usr/local/share/nwg-dock-hyprland/images/task-empty-vertical.svg"
++                              } else {
++                                      iconTaskEmptyVertical = 
"/usr/share/nwg-dock-hyprland/images/task-empty-vertical.svg"
++                              }
++                              pixbuf, e = 
gdkpixbuf.NewPixbufFromFileAtSize(iconTaskEmptyVertical, imgSizeScaled/8, 
imgSizeScaled)
+                       }
+ 
+                       if e == nil {
+@@ -197,8 +255,14 @@ func taskButton(t client, instances []client, position 
*string) *gtk.Box {
+       if image == nil {
+               //var pixbuf *gdk.Pixbuf
+               //var err error
+-              pixbuf, err := 
gdkpixbuf.NewPixbufFromFileAtSize(filepath.Join(dataHome, 
"nwg-dock-hyprland/images/icon-missing.svg"),
+-                      imgSizeScaled, imgSizeScaled)
++              if pathExists(filepath.Join(dataHome, 
"nwg-dock-hyprland/images/icon-missing.svg")) {
++                      iconIconMissing = filepath.Join(dataHome, 
"nwg-dock-hyprland/images/icon-missing.svg")
++              } else if 
pathExists("/usr/local/share/nwg-dock-hyprland/images/icon-missing.svg") {
++                      iconIconMissing = 
"/usr/local/share/nwg-dock-hyprland/images/icon-missing.svg"
++              } else {
++                      iconIconMissing = 
"/usr/share/nwg-dock-hyprland/images/icon-missing.svg"
++              }
++              pixbuf, err := 
gdkpixbuf.NewPixbufFromFileAtSize(iconIconMissing, imgSizeScaled, imgSizeScaled)
+ 
+               if err == nil {
+                       image = gtk.NewImageFromPixbuf(pixbuf)
+@@ -217,27 +281,63 @@ func taskButton(t client, instances []client, position 
*string) *gtk.Box {
+       var err error
+       if len(instances) > 1 {
+               if !vertical {
+-                      pixbuf, err = 
gdkpixbuf.NewPixbufFromFileAtSize(filepath.Join(dataHome, 
"nwg-dock-hyprland/images/task-multiple.svg"),
+-                              imgSizeScaled, imgSizeScaled/8)
++                      if pathExists(filepath.Join(dataHome, 
"nwg-dock-hyprland/images/task-multiple.svg")) {
++                              iconTaskMultiple = filepath.Join(dataHome, 
"nwg-dock-hyprland/images/task-multiple.svg")
++                      } else if 
pathExists("/usr/local/share/nwg-dock-hyprland/images/task-multiple.svg") {
++                              iconTaskMultiple = 
"/usr/local/share/nwg-dock-hyprland/images/task-multiple.svg"
++                      } else {
++                              iconTaskMultiple = 
"/usr/share/nwg-dock-hyprland/images/task-multiple.svg"
++                      }
++                      pixbuf, err = 
gdkpixbuf.NewPixbufFromFileAtSize(iconTaskMultiple, imgSizeScaled, 
imgSizeScaled/8)
+               } else {
+-                      pixbuf, err = 
gdkpixbuf.NewPixbufFromFileAtSize(filepath.Join(dataHome, 
"nwg-dock-hyprland/images/task-multiple-vertical.svg"),
+-                              imgSizeScaled/8, imgSizeScaled)
++                      if pathExists(filepath.Join(dataHome, 
"nwg-dock-hyprland/images/task-multiple-vertical.svg")) {
++                              iconTaskMultipleVertical = 
filepath.Join(dataHome, "nwg-dock-hyprland/images/task-multiple-vertical.svg")
++                      } else if 
pathExists("/usr/local/share/nwg-dock-hyprland/images/task-multiple-vertical.svg")
 {
++                              iconTaskMultipleVertical = 
"/usr/local/share/nwg-dock-hyprland/images/task-multiple-vertical.svg"
++                      } else {
++                              iconTaskMultipleVertical = 
"/usr/share/nwg-dock-hyprland/images/task-multiple-vertical.svg"
++                      }
++                      pixbuf, err = 
gdkpixbuf.NewPixbufFromFileAtSize(iconTaskMultipleVertical, imgSizeScaled/8, 
imgSizeScaled)
+               }
+       } else if len(instances) == 1 {
+               if !vertical {
+-                      pixbuf, err = 
gdkpixbuf.NewPixbufFromFileAtSize(filepath.Join(dataHome, 
"nwg-dock-hyprland/images/task-single.svg"),
+-                              imgSizeScaled, imgSizeScaled/8)
++                      if pathExists(filepath.Join(dataHome, 
"nwg-dock-hyprland/images/task-single.svg")) {
++                              iconTaskSingle = filepath.Join(dataHome, 
"nwg-dock-hyprland/images/task-single.svg")
++                      } else if 
pathExists("/usr/local/share/nwg-dock-hyprland/images/task-single.svg") {
++                              iconTaskSingle = 
"/usr/local/share/nwg-dock-hyprland/images/task-single.svg"
++                      } else {
++                              iconTaskSingle = 
"/usr/share/nwg-dock-hyprland/images/task-single.svg"
++                      }
++                      pixbuf, err = 
gdkpixbuf.NewPixbufFromFileAtSize(iconTaskSingle, imgSizeScaled, 
imgSizeScaled/8)
+               } else {
+-                      pixbuf, err = 
gdkpixbuf.NewPixbufFromFileAtSize(filepath.Join(dataHome, 
"nwg-dock-hyprland/images/task-single-vertical.svg"),
+-                              imgSizeScaled/8, imgSizeScaled)
++                      if pathExists(filepath.Join(dataHome, 
"nwg-dock-hyprland/images/task-single-vertical.svg")) {
++                              iconTaskSingleVertical = 
filepath.Join(dataHome, "nwg-dock-hyprland/images/task-single-vertical.svg")
++                      } else if 
pathExists("/usr/local/share/nwg-dock-hyprland/images/task-single-vertical.svg")
 {
++                              iconTaskSingleVertical = 
"/usr/local/share/nwg-dock-hyprland/images/task-single-vertical.svg"
++                      } else {
++                              iconTaskSingleVertical = 
"/usr/share/nwg-dock-hyprland/images/task-single-vertical.svg"
++                      }
++                      pixbuf, err = 
gdkpixbuf.NewPixbufFromFileAtSize(iconTaskSingleVertical, imgSizeScaled/8, 
imgSizeScaled)
+               }
+       } else {
+               if !vertical {
+-                      pixbuf, err = 
gdkpixbuf.NewPixbufFromFileAtSize(filepath.Join(dataHome, 
"nwg-dock-hyprland/images/task-empty.svg"),
+-                              imgSizeScaled, imgSizeScaled/8)
++                      if pathExists(filepath.Join(dataHome, 
"nwg-dock-hyprland/images/task-empty.svg")) {
++                              iconTaskEmpty = filepath.Join(dataHome, 
"nwg-dock-hyprland/images/task-empty.svg")
++                      } else if 
pathExists("/usr/local/share/nwg-dock-hyprland/images/task-empty.svg") {
++                              iconTaskEmpty = 
"/usr/local/share/nwg-dock-hyprland/images/task-empty.svg"
++                      } else {
++                              iconTaskEmpty = 
"/usr/share/nwg-dock-hyprland/images/task-empty.svg"
++                      }
++                      pixbuf, err = 
gdkpixbuf.NewPixbufFromFileAtSize(iconTaskEmpty, imgSizeScaled, imgSizeScaled/8)
+               } else {
+-                      pixbuf, err = 
gdkpixbuf.NewPixbufFromFileAtSize(filepath.Join(dataHome, 
"nwg-dock-hyprland/images/task-empty-vertical.svg"),
+-                              imgSizeScaled/8, imgSizeScaled)
++                      if pathExists(filepath.Join(dataHome, 
"nwg-dock-hyprland/images/task-empty-vertical.svg")) {
++                              iconTaskEmptyVertical = filepath.Join(dataHome, 
"nwg-dock-hyprland/images/task-empty-vertical.svg")
++                      } else if 
pathExists("/usr/local/share/nwg-dock-hyprland/images/task-empty-vertical.svg") 
{
++                              iconTaskEmptyVertical = 
"/usr/local/share/nwg-dock-hyprland/images/task-empty-vertical.svg"
++                      } else {
++                              iconTaskEmptyVertical = 
"/usr/share/nwg-dock-hyprland/images/task-empty-vertical.svg"
++                      }
++                      pixbuf, err = 
gdkpixbuf.NewPixbufFromFileAtSize(iconTaskEmptyVertical, imgSizeScaled/8, 
imgSizeScaled)
+               }
+       }
+       if err == nil {
+@@ -839,15 +939,6 @@ func getName(appName string) string {
+       return name
+ }
+ 
+-func pathExists(name string) bool {
+-      if _, err := os.Stat(name); err != nil {
+-              if os.IsNotExist(err) {
+-                      return false
+-              }
+-      }
+-      return true
+-}
+-
+ func loadTextFile(path string) ([]string, error) {
+       bytes, err := os.ReadFile(path)
+       if err != nil {
+-- 
+2.54.0
+

Reply via email to