guix_mirror_bot pushed a commit to branch master
in repository guix.

commit bbdd8493ceb68b7a581ff3dd0a496287e53df40d
Author: Sughosha <[email protected]>
AuthorDate: Fri Mar 27 18:02:09 2026 +0530

    gnu: Add nwg-drawer.
    
    * gnu/packages/nwg-shell.scm (nwg-drawer): New variable.
    * gnu/packages/patches/nwg-drawer-0.7.5-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                         |  86 ++++++++++++++
 .../patches/nwg-drawer-0.7.5-fallback-paths.patch  | 131 +++++++++++++++++++++
 3 files changed, 218 insertions(+)

diff --git a/gnu/local.mk b/gnu/local.mk
index 4035fe5e4c..1cd3a50598 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2019,6 +2019,7 @@ 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-drawer-0.7.5-fallback-paths.patch   \
   %D%/packages/patches/obs-advanced-masks-nlohmann-json.patch  \
   %D%/packages/patches/obs-modules-location.patch              \
   %D%/packages/patches/ocaml-ctypes-test-oo.patch              \
diff --git a/gnu/packages/nwg-shell.scm b/gnu/packages/nwg-shell.scm
index 48eec0ad1d..f99c848ed7 100644
--- a/gnu/packages/nwg-shell.scm
+++ b/gnu/packages/nwg-shell.scm
@@ -18,15 +18,21 @@
 
 (define-module (gnu packages nwg-shell)
   #:use-module (guix build-system copy)
+  #:use-module (guix build-system go)
   #:use-module (guix build-system pyproject)
   #:use-module (guix gexp)
   #:use-module (guix git-download)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (gnu packages)
+  #:use-module (gnu packages base)
   #:use-module (gnu packages bash)
+  #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages glib)
+  #:use-module (gnu packages golang-graphics)
+  #:use-module (gnu packages golang-xyz)
   #:use-module (gnu packages gtk)
+  #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python-build))
 
 (define-public nwg-shell-wallpapers
@@ -146,3 +152,83 @@ Hyprland.
 
 This application is a part of the nwg-shell project.")
     (license license:expat)))
+
+(define-public nwg-drawer
+  (package
+    (name "nwg-drawer")
+    (version "0.7.5")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nwg-piotr/nwg-drawer";)
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1f347n1f9nzqr2ryc49nv74kz6qyh6yk8g2b0rdbd3flgx4kap8v"))
+       (patches
+        (search-patches "nwg-drawer-0.7.5-fallback-paths.patch"))))
+    (build-system go-build-system)
+    (arguments
+     (list
+      #:install-source? #f
+      #:import-path "github.com/nwg-piotr/nwg-drawer"
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'patch-paths
+            (lambda* (#:key inputs #:allow-other-keys)
+              (with-directory-excursion "src/github.com/nwg-piotr/nwg-drawer"
+                (substitute* '("main.go" "tools.go")
+                  (("\\/usr\\/bin\\/env") (search-input-file inputs 
"/bin/env"))
+                  (("\\/usr\\/share") (string-append #$output "/share"))))))
+          (add-after 'install 'install-data
+            (lambda _
+              (mkdir-p (string-append #$output "/share/nwg-drawer"))
+              (with-directory-excursion (string-append "src/github.com/"
+                                                       "nwg-piotr/"
+                                                       "nwg-drawer")
+                (copy-recursively "desktop-directories"
+                                  (string-append #$output "/share/"
+                                                 "nwg-drawer/"
+                                                 "desktop-directories"))
+                (copy-recursively "img"
+                                  (string-append #$output "/share/"
+                                                 "nwg-drawer/img"))
+                (install-file "drawer.css"
+                              (string-append #$output "/share/nwg-drawer"))
+                (install-file "README.md"
+                              (string-append #$output
+                                             "/share/doc/nwg-drawer")))))
+          (add-after 'install 'wrap-program
+            (lambda _
+              (wrap-program (string-append #$output "/bin/nwg-drawer")
+                `("PATH" prefix
+                  (,(dirname (which "xdg-open"))))
+                `("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-expr-lang-expr
+           go-github-com-fsnotify-fsnotify
+           go-github-com-google-shlex
+           go-github-com-joshuarubin-go-sway
+           go-github-com-sirupsen-logrus
+           pkg-config))
+    (inputs
+     (list bash-minimal
+           coreutils-minimal
+           gtk+
+           gtk-layer-shell
+           xdg-utils))       ;for 'xdg-open'
+    (home-page "https://nwg-piotr.github.io/nwg-shell/nwg-drawer";)
+    (synopsis "Application drawer for wlroots-based Wayland compositors")
+    (description
+     "nwg-drawer is an application launcher.  It's being developed with sway 
and
+Hyprland in mind, but should also work with other wlroots-based Wayland
+compositors.
+
+This application is a part of the nwg-shell project.")
+    (license license:expat)))
diff --git a/gnu/packages/patches/nwg-drawer-0.7.5-fallback-paths.patch 
b/gnu/packages/patches/nwg-drawer-0.7.5-fallback-paths.patch
new file mode 100644
index 0000000000..e8d00b7768
--- /dev/null
+++ b/gnu/packages/patches/nwg-drawer-0.7.5-fallback-paths.patch
@@ -0,0 +1,131 @@
+https://github.com/nwg-piotr/nwg-drawer/pull/189
+
+From c023ac254da1c5abeb4999d06d8c20d06d5ecefa Mon Sep 17 00:00:00 2001
+From: Sughosha <[email protected]>
+Date: Sat, 18 Apr 2026 13:38:38 +0530
+Subject: [PATCH] Support fallback paths
+
+---
+ main.go | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++------
+ 1 file changed, 54 insertions(+), 6 deletions(-)
+
+diff --git a/main.go b/main.go
+index cfae982..fa4b5f7 100644
+--- a/main.go
++++ b/main.go
+@@ -43,6 +43,12 @@ var (
+       hyprlandMonitors []monitor
+       beenScrolled     bool
+       firstPowerBtn    *gtk.Button
++      iconPoweroff     string
++      iconSleep        string
++      iconReboot       string
++      iconExit         string
++      iconLock         string
++      cssFilePath      string
+ )
+ 
+ var categoryNames = [...]string{
+@@ -338,7 +344,14 @@ func main() {
+ 
+       // Copy default style sheet if not found
+       if !pathExists(filepath.Join(configDirectory, "drawer.css")) {
+-              err := copyFile(filepath.Join(dataDirectory, "drawer.css"), 
filepath.Join(configDirectory, "drawer.css"))
++              if pathExists(filepath.Join(dataDirectory, "drawer.css")) {
++                      cssFilePath = filepath.Join(dataDirectory, "drawer.css")
++              } else if pathExists("/usr/local/share/nwg-drawer/drawer.css"){
++                      cssFilePath = "/usr/local/share/nwg-drawer/drawer.css"
++              } else {
++                      cssFilePath = "/usr/share/nwg-drawer/drawer.css"
++              }
++              err := copyFile(cssFilePath, filepath.Join(configDirectory, 
"drawer.css"))
+               if err != nil {
+                       log.Errorf("Failed copying 'drawer.css' file: %s", err)
+               }
+@@ -667,7 +680,14 @@ func main() {
+                       if *pbPoweroff != "" {
+                               btn := gtk.NewButton()
+                               if !*pbUseIconTheme {
+-                                      btn = 
powerButton(filepath.Join(dataDirectory, "img/poweroff.svg"), *pbPoweroff)
++                                      if 
pathExists(filepath.Join(dataDirectory, "img/poweroff.svg")) {
++                                              iconPoweroff = 
filepath.Join(dataDirectory, "img/poweroff.svg")
++                                      } else if 
pathExists("/usr/local/share/nwg-drawer/img/poweroff.svg"){
++                                              iconPoweroff = 
"/usr/local/share/nwg-drawer/img/poweroff.svg"
++                                      } else {
++                                              iconPoweroff = 
"/usr/share/nwg-drawer/img/poweroff.svg"
++                                      }
++                                      btn = powerButton(iconPoweroff, 
*pbPoweroff)
+                               } else {
+                                       btn = 
powerButton("system-shutdown-symbolic", *pbPoweroff)
+                               }
+@@ -676,8 +696,15 @@ func main() {
+                       }
+                       if *pbSleep != "" {
+                               btn := gtk.NewButton()
++                              if pathExists(filepath.Join(dataDirectory, 
"img/sleep.svg")) {
++                                      iconSleep = 
filepath.Join(dataDirectory, "img/sleep.svg")
++                              } else if 
pathExists("/usr/local/share/nwg-drawer/img/sleep.svg"){
++                                      iconSleep = 
"/usr/local/share/nwg-drawer/img/sleep.svg"
++                              } else {
++                                      iconSleep = 
"/usr/share/nwg-drawer/img/sleep.svg"
++                              }
+                               if !*pbUseIconTheme {
+-                                      btn = 
powerButton(filepath.Join(dataDirectory, "img/sleep.svg"), *pbSleep)
++                                      btn = powerButton(iconSleep, *pbSleep)
+                               } else {
+                                       btn = powerButton("face-yawn-symbolic", 
*pbSleep)
+                               }
+@@ -686,8 +713,15 @@ func main() {
+                       }
+                       if *pbReboot != "" {
+                               btn := gtk.NewButton()
++                              if pathExists(filepath.Join(dataDirectory, 
"img/reboot.svg")) {
++                                      iconReboot = 
filepath.Join(dataDirectory, "img/reboot.svg")
++                              } else if 
pathExists("/usr/local/share/nwg-drawer/img/reboot.svg"){
++                                      iconReboot = 
"/usr/local/share/nwg-drawer/img/reboot.svg"
++                              } else {
++                                      iconReboot = 
"/usr/share/nwg-drawer/img/reboot.svg"
++                              }
+                               if !*pbUseIconTheme {
+-                                      btn = 
powerButton(filepath.Join(dataDirectory, "img/reboot.svg"), *pbReboot)
++                                      btn = powerButton(iconReboot, *pbReboot)
+                               } else {
+                                       btn = 
powerButton("system-reboot-symbolic", *pbReboot)
+                               }
+@@ -696,8 +730,15 @@ func main() {
+                       }
+                       if *pbExit != "" {
+                               btn := gtk.NewButton()
++                              if pathExists(filepath.Join(dataDirectory, 
"img/exit.svg")) {
++                                      iconExit = filepath.Join(dataDirectory, 
"img/exit.svg")
++                              } else if 
pathExists("/usr/local/share/nwg-drawer/img/exit.svg"){
++                                      iconExit = 
"/usr/local/share/nwg-drawer/img/exit.svg"
++                              } else {
++                                      iconExit = 
"/usr/share/nwg-drawer/img/exit.svg"
++                              }
+                               if !*pbUseIconTheme {
+-                                      btn = 
powerButton(filepath.Join(dataDirectory, "img/exit.svg"), *pbExit)
++                                      btn = powerButton(iconExit, *pbExit)
+                               } else {
+                                       btn = 
powerButton("system-log-out-symbolic", *pbExit)
+                               }
+@@ -706,8 +747,15 @@ func main() {
+                       }
+                       if *pbLock != "" {
+                               btn := gtk.NewButton()
++                              if pathExists(filepath.Join(dataDirectory, 
"img/lock.svg")) {
++                                      iconLock = filepath.Join(dataDirectory, 
"img/lock.svg")
++                              } else if 
pathExists("/usr/local/share/nwg-drawer/img/lock.svg"){
++                                      iconLock = 
"/usr/local/share/nwg-drawer/img/lock.svg"
++                              } else {
++                                      iconLock = 
"/usr/share/nwg-drawer/img/lock.svg"
++                              }
+                               if !*pbUseIconTheme {
+-                                      btn = 
powerButton(filepath.Join(dataDirectory, "img/lock.svg"), *pbLock)
++                                      btn = powerButton(iconLock, *pbLock)
+                               } else {
+                                       btn = 
powerButton("system-lock-screen-symbolic", *pbLock)
+                               }
+-- 
+2.52.0
+

Reply via email to