Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package nwg-dock-hyprland for openSUSE:Factory checked in at 2024-06-17 19:34:10 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/nwg-dock-hyprland (Old) and /work/SRC/openSUSE:Factory/.nwg-dock-hyprland.new.19518 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "nwg-dock-hyprland" Mon Jun 17 19:34:10 2024 rev:2 rq:1181320 version:0.1.9 Changes: -------- --- /work/SRC/openSUSE:Factory/nwg-dock-hyprland/nwg-dock-hyprland.changes 2023-07-24 18:25:52.622118614 +0200 +++ /work/SRC/openSUSE:Factory/.nwg-dock-hyprland.new.19518/nwg-dock-hyprland.changes 2024-06-17 19:34:20.068959287 +0200 @@ -1,0 +2,44 @@ +Wed Jun 12 16:41:31 UTC 2024 - malcolmle...@opensuse.org + +- Updated to version 0.1.9: + + Fixed crash on icons missing from GTK theme, + (gh#nwg-piotr/nwg-dock-hyprland#25). + + Fixed XDG_DATA_HOME detection, + (gh#nwg-piotr/nwg-dock-hyprland#36 and + gh#nwg-piotr/nwg-dock-hyprlandcloses #35). + + Added setting namespace for gtk-layer-shell, + (gh#nwg-piotr/nwg-dock-hyprland#37). + + Fixed mapping output->Gdk.Monitor on gtk3-1:3.24.42. +- Changes from version 0.1.8: + + Get ready for Hyprland socket files moved to + $XDG_RUNTIME_DIR/hypr, (gh#nwg-piotr/nwg-dock-hyprland#30). + + While searching .desktop files, first look for exact + 'class.desktop' file, (gh#nwg-piotr/nwg-dock-hyprland#31). +- Changes from version 0.1.7: + + Prevent crash on image not found, + (gh#nwg-piotr/nwg-dock-hyprland#25 and + gh#nwg-piotr/nwg-dock-hyprland#24). + + Use different lock files for various users (ported from + nwg-dock). +- Changes from version 0.1.6: + + Fixed nil pointer dereference while creating the fallback icon, + (gh#nwg-piotr/nwg-dock-hyprland#24). +- Changes from version 0.1.5: + + Added dispatch bringactivetotop after dispatch focuswindow, + (gh#nwg-piotr/nwg-dock-hyprland#14). + + Updated dependencies: gotk3, gotk3-layershell, logrus. + + Added -ico string argument, to specify name or full path to an + alternative launcher ICOn, + (gh#nwg-piotr/nwg-dock-hyprland#15 and + gh#nwg-piotr/nwg-dock-hyprland#17). + + Added support for apps on the special workspace, + (gh#nwg-piotr/nwg-dock-hyprland#13). + + Fixed searching icons in org.*.desktop files. +- Changes from version 0.1.4: + + Split appName string by " ", use the 1st part while searching + the icon name, (gh#nwg-piotr/nwg-dock-hyprland#11). + + Do not force use of the overlay layer when -d (autohide) + argument used, (gh#nwg-piotr/nwg-dock-hyprland#12). +- Update build requires on go >= 1.22. + +------------------------------------------------------------------- Old: ---- nwg-dock-hyprland-0.1.3.tar.gz New: ---- nwg-dock-hyprland-0.1.9.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ nwg-dock-hyprland.spec ++++++ --- /var/tmp/diff_new_pack.GFZDjY/_old 2024-06-17 19:34:21.921027425 +0200 +++ /var/tmp/diff_new_pack.GFZDjY/_new 2024-06-17 19:34:21.945028308 +0200 @@ -1,8 +1,8 @@ # # spec file for package nwg-dock-hyprland # -# Copyright (c) 2023 SUSE LLC -# Copyright (c) 2023 Malcolm J Lewis <malcolmle...@opensuse.org> +# Copyright (c) 2024 SUSE LLC +# Copyright (c) 2023-2024 Malcolm J Lewis <malcolmle...@opensuse.org> # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,13 +18,14 @@ Name: nwg-dock-hyprland -Version: 0.1.3 +Version: 0.1.9 Release: 0 Summary: Hyprland application dock License: MIT URL: https://github.com/nwg-piotr/nwg-dock-hyprland Source0: https://codeload.github.com/nwg-piotr/nwg-dock-hyprland/tar.gz/refs/tags/v%{version}#/%{name}-%{version}.tar.gz Source1: vendor.tar.zst +BuildRequires: go >= 1.22 BuildRequires: golang-packaging BuildRequires: zstd BuildRequires: pkgconfig(gtk-layer-shell-0) @@ -38,6 +39,7 @@ %autosetup -p1 -a1 %build +## Note build takes around 10 minutes, so be patient as there is no output! go build \ -mod=vendor \ -buildmode=pie ++++++ nwg-dock-hyprland-0.1.3.tar.gz -> nwg-dock-hyprland-0.1.9.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nwg-dock-hyprland-0.1.3/.github/FUNDING.yml new/nwg-dock-hyprland-0.1.9/.github/FUNDING.yml --- old/nwg-dock-hyprland-0.1.3/.github/FUNDING.yml 2023-07-02 15:26:00.000000000 +0200 +++ new/nwg-dock-hyprland-0.1.9/.github/FUNDING.yml 2024-05-19 00:54:32.000000000 +0200 @@ -1 +1,2 @@ github: nwg-piotr +liberapay: nwg diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nwg-dock-hyprland-0.1.3/Makefile new/nwg-dock-hyprland-0.1.9/Makefile --- old/nwg-dock-hyprland-0.1.3/Makefile 2023-07-02 15:26:00.000000000 +0200 +++ new/nwg-dock-hyprland-0.1.9/Makefile 2024-05-19 00:54:32.000000000 +0200 @@ -8,7 +8,7 @@ go get "github.com/sirupsen/logrus" build: - go build -o bin/nwg-dock-hyprland . + go build -v -o bin/nwg-dock-hyprland . install: -pkill -f nwg-dock-hyprland diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nwg-dock-hyprland-0.1.3/README.md new/nwg-dock-hyprland-0.1.9/README.md --- old/nwg-dock-hyprland-0.1.3/README.md 2023-07-02 15:26:00.000000000 +0200 +++ new/nwg-dock-hyprland-0.1.9/README.md 2024-05-19 00:54:32.000000000 +0200 @@ -44,7 +44,7 @@ Either start the dock permanently in `hyprland.conf`: ```text -exec_once = nwg-dock [arguments] +exec-once = nwg-dock-hyprland [arguments] ``` or assign the command to some key binding. Running the command again kills the existing program instance, so that @@ -55,13 +55,13 @@ If you run the program with the `-d` or `-r` argument (preferably in autostart), it will be running residently. ```text -exec_always nwg-dock -d +exec_always nwg-dock-hyprland -d ``` or ```text -exec_always nwg-dock -r +exec_always nwg-dock-hyprland -r ``` ### `-d` for autohiDe @@ -71,16 +71,16 @@ ### `-r` for just Resident -No hotspot will be created. To show/hide the dock, bind the `exec nwg-dock` command to some key or button. +No hotspot will be created. To show/hide the dock, bind the `exec nwg-dock-hyprland` command to some key or button. How about the `Menu` key, which is usually useless? -Re-execution of the same command hides the dock. If a resident instance found, the `nwg-dock` command w/o -arguments sends `SIGUSR1` to it. Actually `pkill -USR1 nwg-dock` could be used instead. This also works in autohiDe +Re-execution of the same command hides the dock. If a resident instance found, the `nwg-dock-hyprland` command w/o +arguments sends `SIGUSR1` to it. Actually `pkill -USR1 nwg-dock-hyprland` could be used instead. This also works in autohiDe mode. Re-execution of the command with the `-d` or `-r` argument won't kill the running instance. If the dock is running residently, another instance will just exit with 0 code. In case you'd like to terminate it anyway, you need -to `pkill -f nwg-dock`. +to `pkill -f nwg-dock-hyprland`. *NOTE: you need to kill the running instance before reloading Hyprland, if you've just changed the arguments you auto-start the dock with.* @@ -100,6 +100,8 @@ Hotspot Delay [ms]; the smaller, the faster mouse pointer needs to enter hotspot for the dock to appear; set 0 to disable (default 20) -i int Icon size (default 48) + -ico string + alternative name or path for the launcher ICOn -l string Layer "overlay", "top" or "bottom" (default "overlay") -mb int diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nwg-dock-hyprland-0.1.3/go.mod new/nwg-dock-hyprland-0.1.9/go.mod --- old/nwg-dock-hyprland-0.1.3/go.mod 2023-07-02 15:26:00.000000000 +0200 +++ new/nwg-dock-hyprland-0.1.9/go.mod 2024-05-19 00:54:32.000000000 +0200 @@ -1,19 +1,12 @@ module nwg-dock-hyprland -go 1.20 +go 1.22 require ( github.com/allan-simon/go-singleinstance v0.0.0-20210120080615-d0997106ab37 - github.com/dlasky/gotk3-layershell v0.0.0-20221218201547-1f6674a3f872 - github.com/gotk3/gotk3 v0.6.1 - github.com/joshuarubin/go-sway v1.2.0 - github.com/sirupsen/logrus v1.9.0 + github.com/dlasky/gotk3-layershell v0.0.0-20240515133811-5c5115f0d774 + github.com/gotk3/gotk3 v0.6.3 + github.com/sirupsen/logrus v1.9.3 ) -require ( - github.com/joshuarubin/lifecycle v1.0.0 // indirect - go.uber.org/atomic v1.3.2 // indirect - go.uber.org/multierr v1.1.0 // indirect - golang.org/x/sync v0.0.0-20190412183630-56d357773e84 // indirect - golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect -) +require golang.org/x/sys v0.20.0 // indirect diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nwg-dock-hyprland-0.1.3/go.sum new/nwg-dock-hyprland-0.1.9/go.sum --- old/nwg-dock-hyprland-0.1.3/go.sum 2023-07-02 15:26:00.000000000 +0200 +++ new/nwg-dock-hyprland-0.1.9/go.sum 2024-05-19 00:54:32.000000000 +0200 @@ -5,28 +5,30 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dlasky/gotk3-layershell v0.0.0-20221218201547-1f6674a3f872 h1:16qcNl+UgbvudN7wPv+zq4mmDSYJWdLv5jbVhS7+OVI= github.com/dlasky/gotk3-layershell v0.0.0-20221218201547-1f6674a3f872/go.mod h1:JHLx2Wz4mAPVwn4PFhC69ydwyHP4A3wQvlg7HKVVc1U= -github.com/gotk3/gotk3 v0.6.1 h1:GJ400a0ecEEWrzjBvzBzH+pB/esEMIGdB9zPSmBdoeo= +github.com/dlasky/gotk3-layershell v0.0.0-20230802002603-b0c42cd8474f h1:qDnUQAD7tVX/gnL6uSgouzfGNA4xXH+B/fd6Ko19GgM= +github.com/dlasky/gotk3-layershell v0.0.0-20230802002603-b0c42cd8474f/go.mod h1:JHLx2Wz4mAPVwn4PFhC69ydwyHP4A3wQvlg7HKVVc1U= +github.com/dlasky/gotk3-layershell v0.0.0-20240515133811-5c5115f0d774 h1:o87OVL4olQBlVwN3+NSVQpS6gj9FWUYtxOfHXWZigUE= +github.com/dlasky/gotk3-layershell v0.0.0-20240515133811-5c5115f0d774/go.mod h1:JHLx2Wz4mAPVwn4PFhC69ydwyHP4A3wQvlg7HKVVc1U= github.com/gotk3/gotk3 v0.6.1/go.mod h1:/hqFpkNa9T3JgNAE2fLvCdov7c5bw//FHNZrZ3Uv9/Q= -github.com/joshuarubin/go-sway v1.2.0 h1:t3eqW504//uj9PDwFf0+IVfkD+WoOGaDX5gYIe0BHyM= -github.com/joshuarubin/go-sway v1.2.0/go.mod h1:qcDd6f25vJ0++wICwA1BainIcRC67p2Mb4lsrZ0k3/k= -github.com/joshuarubin/lifecycle v1.0.0 h1:N/lPEC8f+dBZ1Tn99vShqp36LwB+LI7XNAiNadZeLUQ= -github.com/joshuarubin/lifecycle v1.0.0/go.mod h1:sRy++ATvR9Ee21tkRdFkQeywAWvDsue66V70K0Dnl54= +github.com/gotk3/gotk3 v0.6.2 h1:sx/PjaKfKULJPTPq8p2kn2ZbcNFxpOJqi4VLzMbEOO8= +github.com/gotk3/gotk3 v0.6.2/go.mod h1:/hqFpkNa9T3JgNAE2fLvCdov7c5bw//FHNZrZ3Uv9/Q= +github.com/gotk3/gotk3 v0.6.3 h1:+Ke4WkM1TQUNOlM2TZH6szqknqo+zNbX3BZWVXjSHYw= +github.com/gotk3/gotk3 v0.6.3/go.mod h1:/hqFpkNa9T3JgNAE2fLvCdov7c5bw//FHNZrZ3Uv9/Q= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= -github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4= -go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -golang.org/x/sync v0.0.0-20190412183630-56d357773e84 h1:IqXQ59gzdXv58Jmm2xn0tSOR9i6HqroaOFRQ3wR/dJQ= -golang.org/x/sync v0.0.0-20190412183630-56d357773e84/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= +golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nwg-dock-hyprland-0.1.3/hypr.go new/nwg-dock-hyprland-0.1.9/hypr.go --- old/nwg-dock-hyprland-0.1.3/hypr.go 2023-07-02 15:26:00.000000000 +0200 +++ new/nwg-dock-hyprland-0.1.9/hypr.go 2024-05-19 00:54:32.000000000 +0200 @@ -67,7 +67,7 @@ } func hyprctl(cmd string) ([]byte, error) { - socketFile := fmt.Sprintf("/tmp/hypr/%s/.socket.sock", his) + socketFile := fmt.Sprintf("%s/%s/.socket.sock", hyprDir, his) conn, err := net.Dial("unix", socketFile) if err != nil { return nil, err diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nwg-dock-hyprland-0.1.3/main.go new/nwg-dock-hyprland-0.1.9/main.go --- old/nwg-dock-hyprland-0.1.3/main.go 2023-07-02 15:26:00.000000000 +0200 +++ new/nwg-dock-hyprland-0.1.9/main.go 2024-05-19 00:54:32.000000000 +0200 @@ -22,7 +22,7 @@ "github.com/gotk3/gotk3/gtk" ) -const version = "0.1.3" +const version = "0.1.9" type WindowState int @@ -47,6 +47,7 @@ windowStateChannel chan WindowState = make(chan WindowState, 1) detectorEnteredAt int64 his string // $HYPRLAND_INSTANCE_SIGNATURE + hyprDir string // $XDG_RUNTIME_DIR/hypr since hyprland>0.39.1, earlier /tmp/hypr monitors []monitor clients []client activeClient *client @@ -63,6 +64,7 @@ var position = flag.String("p", "bottom", "Position: \"bottom\", \"top\" or \"left\"") var exclusive = flag.Bool("x", false, "set eXclusive zone: move other windows aside; overrides the \"-l\" argument") var imgSize = flag.Int("i", 48, "Icon size") +var ico = flag.String("ico", "", "alternative name or path for the launcher ICOn") var layer = flag.String("l", "overlay", "Layer \"overlay\", \"top\" or \"bottom\"") var launcherCmd = flag.String("c", "", "Command assigned to the launcher button") var alignment = flag.String("a", "center", "Alignment in full width/height: \"start\", \"center\" or \"end\"") @@ -184,8 +186,14 @@ if !*noLauncher && *launcherCmd != "" { button, _ := gtk.ButtonNew() - pixbuf, err := gdk.PixbufNewFromFileAtSize(filepath.Join(dataHome, "nwg-dock-hyprland/images/grid.svg"), imgSizeScaled, imgSizeScaled) - if err == nil { + var pixbuf *gdk.Pixbuf + var e error + if *ico == "" { + pixbuf, e = gdk.PixbufNewFromFileAtSize(filepath.Join(dataHome, "nwg-dock-hyprland/images/grid.svg"), imgSizeScaled, imgSizeScaled) + } else { + pixbuf, e = createPixbuf(*ico, imgSizeScaled) + } + if e == nil { image, _ := gtk.ImageNewFromPixbuf(pixbuf) button.SetImage(image) button.SetAlwaysShowImage(true) @@ -222,6 +230,7 @@ layershell.InitForWindow(win) layershell.SetMonitor(win, &monitor) + layershell.SetNamespace(win, "nwg-dock-hotspot") var box *gtk.Box if *position == "bottom" || *position == "top" { @@ -323,6 +332,13 @@ } log.Debugf("HYPRLAND_INSTANCE_SIGNATURE: '%s'", his) + if os.Getenv("XDG_RUNTIME_DIR") != "" && pathExists(filepath.Join(os.Getenv("XDG_RUNTIME_DIR"), "hypr")) { + hyprDir = filepath.Join(os.Getenv("XDG_RUNTIME_DIR"), "hypr") + } else { + hyprDir = "/tmp/hypr" + } + log.Debugf("hyprDir: '%s'", hyprDir) + if *autohide { log.Info("Starting in autohiDe mode") } @@ -366,7 +382,9 @@ // Unless we are in autohide/resident mode, we probably want the same key/mouse binding to turn the dock off. // Since v0.2 we can't just send SIGKILL if running instance found. We'll send SIGUSR1 instead. // If it's running with `-r` or `-d` flag, it'll show the window. If not - it will die. - lockFilePath := fmt.Sprintf("%s/nwg-dock.lock", tempDir()) + + // Use md5-hashed $USER name to create unique lock files for multiple users + lockFilePath := fmt.Sprintf("%s/nwg-dock-%s.lock", tempDir(), md5Hash(os.Getenv("USER"))) lockFile, err := singleinstance.CreateLockFile(lockFilePath) if err != nil { pid, err := readTextFile(lockFilePath) @@ -399,7 +417,10 @@ } } - dataHome = getDataHome() + dataHome, err = getDataHome() + if err != nil { + log.Fatal("Error getting data directory:", err) + } configDirectory = configDir() // if it doesn't exist: createDir(configDirectory) @@ -439,6 +460,7 @@ } layershell.InitForWindow(win) + layershell.SetNamespace(win, "nwg-dock") var output2mon map[string]*gdk.Monitor if *targetOutput != "" { @@ -489,20 +511,13 @@ menuAnchor = gdk.GDK_GRAVITY_WEST } - if *autohide { - // we need to cover the hotspot window, to avoid unwanted .Hide() and .Show() the dockWindow + if *layer == "top" { + layershell.SetLayer(win, layershell.LAYER_SHELL_LAYER_TOP) + } else if *layer == "bottom" { + layershell.SetLayer(win, layershell.LAYER_SHELL_LAYER_BOTTOM) + } else { layershell.SetLayer(win, layershell.LAYER_SHELL_LAYER_OVERLAY) layershell.SetExclusiveZone(win, -1) - } else { - // otherwise let's leave users freedom of choice - if *layer == "top" { - layershell.SetLayer(win, layershell.LAYER_SHELL_LAYER_TOP) - } else if *layer == "bottom" { - layershell.SetLayer(win, layershell.LAYER_SHELL_LAYER_BOTTOM) - } else { - layershell.SetLayer(win, layershell.LAYER_SHELL_LAYER_OVERLAY) - layershell.SetExclusiveZone(win, -1) - } } layershell.SetMargin(win, layershell.LAYER_SHELL_EDGE_TOP, *marginTop) @@ -609,7 +624,7 @@ }() addr := &net.UnixAddr{ - Name: fmt.Sprintf("/tmp/hypr/%s/.socket2.sock", his), + Name: fmt.Sprintf("%s/%s/.socket2.sock", hyprDir, his), Net: "unix", } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nwg-dock-hyprland-0.1.3/tools.go new/nwg-dock-hyprland-0.1.9/tools.go --- old/nwg-dock-hyprland-0.1.3/tools.go 2023-07-02 15:26:00.000000000 +0200 +++ new/nwg-dock-hyprland-0.1.9/tools.go 2024-05-19 00:54:32.000000000 +0200 @@ -1,19 +1,19 @@ package main import ( + "crypto/md5" + "encoding/hex" "errors" "fmt" + "github.com/gotk3/gotk3/gdk" + "github.com/gotk3/gotk3/glib" + "github.com/gotk3/gotk3/gtk" log "github.com/sirupsen/logrus" "io" "os" "os/exec" "path/filepath" "strings" - "unicode" - - "github.com/gotk3/gotk3/gdk" - "github.com/gotk3/gotk3/glib" - "github.com/gotk3/gotk3/gtk" ) func taskInstances(ID string) []client { @@ -32,7 +32,7 @@ box.PackStart(button, false, false, 0) image, err := createImage(ID, imgSizeScaled) - if err != nil { + if err != nil || image == nil { pixbuf, err := gdk.PixbufNewFromFileAtSize(filepath.Join(dataHome, "nwg-dock-hyprland/images/icon-missing.svg"), imgSizeScaled, imgSizeScaled) if err == nil { @@ -107,21 +107,22 @@ button, _ := gtk.ButtonNew() box.PackStart(button, false, false, 0) - image, err := createImage(t.Class, imgSizeScaled) - if err != nil { + image, _ := createImage(t.Class, imgSizeScaled) + if image == nil { pixbuf, err := gdk.PixbufNewFromFileAtSize(filepath.Join(dataHome, "nwg-dock-hyprland/images/icon-missing.svg"), imgSizeScaled, imgSizeScaled) if err == nil { image, _ = gtk.ImageNewFromPixbuf(pixbuf) - } else { - image, _ = gtk.ImageNew() } } - button.SetImage(image) - button.SetImagePosition(gtk.POS_TOP) - button.SetAlwaysShowImage(true) + if image != nil { + button.SetImage(image) + button.SetImagePosition(gtk.POS_TOP) + button.SetAlwaysShowImage(true) + } button.SetTooltipText(getName(t.Class)) + var img *gtk.Image if len(instances) < 2 { pixbuf, err := gdk.PixbufNewFromFileAtSize(filepath.Join(dataHome, "nwg-dock-hyprland/images/task-single.svg"), @@ -144,15 +145,21 @@ if len(instances) == 1 { button.Connect("event", func(btn *gtk.Button, e *gdk.Event) bool { btnEvent := gdk.EventButtonNewFromEvent(e) - /* EVENT_BUTTON_PRESS would be more obvious, but it causes the misbehaviour: - if con is located on an external display, after pressing the button, the conID value - "freezes", and stays the same for all taskButtons, until the right mouse click. - A gotk3 bug or WTF? */ if btnEvent.Type() == gdk.EVENT_BUTTON_RELEASE || btnEvent.Type() == gdk.EVENT_TOUCH_END { if btnEvent.Button() == 1 || btnEvent.Type() == gdk.EVENT_TOUCH_END { cmd := fmt.Sprintf("dispatch focuswindow address:%s", t.Address) + if strings.HasPrefix(t.Workspace.Name, "special") { + _, specialName, _ := strings.Cut(t.Workspace.Name, "special:") + cmd = fmt.Sprintf("dispatch togglespecialworkspace %s", specialName) + } reply, _ := hyprctl(cmd) log.Debugf("%s -> %s", cmd, reply) + + // fix #14 + cmd = "dispatch bringactivetotop" + reply, _ = hyprctl(cmd) + log.Debugf("%s -> %s", cmd, reply) + return true } else if btnEvent.Button() == 3 { contextMenu := clientMenuContext(t.Class, instances) @@ -194,18 +201,28 @@ image, _ := gtk.ImageNewFromIconName(iconName, gtk.ICON_SIZE_MENU) hbox.PackStart(image, false, false, 0) title := instance.Title - if len(title) > 20 { - title = title[:20] + if len(title) > 25 { + title = title[:25] } - label, _ := gtk.LabelNew(fmt.Sprintf("%s (%v)", title, instance.Workspace.Id)) + wsName := instance.Workspace.Name + var label *gtk.Label + label, _ = gtk.LabelNew(fmt.Sprintf("%s (%v)", title, instance.Workspace.Name)) hbox.PackStart(label, false, false, 0) menuItem.Add(hbox) menu.Append(menuItem) a := instance.Address menuItem.Connect("activate", func() { cmd := fmt.Sprintf("dispatch focuswindow address:%s", a) + if strings.HasPrefix(wsName, "special") { + _, specialName, _ := strings.Cut(wsName, "special:") + cmd = fmt.Sprintf("dispatch togglespecialworkspace %s", specialName) + } reply, _ := hyprctl(cmd) log.Debugf("%s -> %s", cmd, reply) + + cmd = "dispatch bringactivetotop" + reply, _ = hyprctl(cmd) + log.Debugf("%s -> %s", cmd, reply) }) } @@ -226,17 +243,17 @@ image, _ := gtk.ImageNewFromIconName(iconName, gtk.ICON_SIZE_MENU) hbox.PackStart(image, false, false, 0) title := instance.Title - if len(title) > 20 { - title = title[:20] + if len(title) > 25 { + title = title[:25] } // Clean non-ASCII chars - title = strings.Map(func(r rune) rune { - if r > unicode.MaxASCII { - return -1 - } - return r - }, title) - label, _ := gtk.LabelNew(fmt.Sprintf("%s (%v)", title, instance.Workspace.Id)) + //title = strings.Map(func(r rune) rune { + // if r > unicode.MaxASCII { + // return -1 + // } + // return r + //}, title) + label, _ := gtk.LabelNew(fmt.Sprintf("%s (%v)", title, instance.Workspace.Name)) hbox.PackStart(label, false, false, 0) menuItem.Add(hbox) menu.Append(menuItem) @@ -336,8 +353,8 @@ if err != nil { name = appID } - pixbuf, err := createPixbuf(name, size) - if err != nil { + pixbuf, e := createPixbuf(name, size) + if e != nil { return nil, err } image, _ := gtk.ImageNewFromPixbuf(pixbuf) @@ -385,7 +402,7 @@ func cacheDir() string { if os.Getenv("XDG_CACHE_HOME") != "" { - return os.Getenv("XDG_CONFIG_HOME") + return os.Getenv("XDG_CACHE_HOME") } if os.Getenv("HOME") != "" && pathExists(filepath.Join(os.Getenv("HOME"), ".cache")) { p := filepath.Join(os.Getenv("HOME"), ".cache") @@ -457,11 +474,30 @@ return os.Chmod(dst, srcinfo.Mode()) } -func getDataHome() string { - if os.Getenv("XDG_DATA_HOME") != "" { - return os.Getenv("XDG_DATA_HOME") +func getDataHome() (string, error) { + var dirs []string + home := os.Getenv("HOME") + xdgDataHome := os.Getenv("XDG_DATA_HOME") + if xdgDataHome != "" { + dirs = append(dirs, xdgDataHome) + } else if home != "" { + dirs = append(dirs, filepath.Join(home, ".local/share")) + } + + var xdgDataDirs []string + if os.Getenv("XDG_DATA_DIRS") != "" { + xdgDataDirs = strings.Split(os.Getenv("XDG_DATA_DIRS"), ":") + } else { + xdgDataDirs = []string{"/usr/local/share/", "/usr/share/"} } - return "/usr/share/" + dirs = append(dirs, xdgDataDirs...) + + for _, d := range dirs { + if pathExists(filepath.Join(d, "nwg-dock-hyprland")) { + return d, nil + } + } + return "", errors.New("no data directory found for nwg-dock-hyprland") } func getAppDirs() []string { @@ -504,6 +540,7 @@ } func getIcon(appName string) (string, error) { + appName = strings.Split(appName, " ")[0] if strings.HasPrefix(strings.ToUpper(appName), "GIMP") { return "gimp", nil } @@ -548,8 +585,6 @@ if strings.Count(item.Name(), ".") > 1 && strings.HasSuffix(item.Name(), fmt.Sprintf("%s.desktop", badAppID)) { return filepath.Join(d, item.Name()) - } else { - return "" } } } @@ -558,6 +593,15 @@ b4Separator = strings.Split(badAppID, " ")[0] for _, d := range appDirs { items, _ := os.ReadDir(d) + log.Info(">>>", items) + + // first look for exact 'class.desktop' file, see #31 + for _, item := range items { + if strings.ToUpper(item.Name()) == strings.ToUpper(fmt.Sprintf("%s.desktop", badAppID)) { + return filepath.Join(d, item.Name()) + } + } + for _, item := range items { if strings.Contains(strings.ToUpper(item.Name()), strings.ToUpper(b4Separator)) { return filepath.Join(d, item.Name()) @@ -787,13 +831,7 @@ num := display.GetNMonitors() for i := 0; i < num; i++ { mon, _ := display.GetMonitor(i) - geometry := mon.GetGeometry() - // assign output to monitor on the basis of the same x, y coordinates - for _, m := range monitors { - if m.X == geometry.GetX() && m.Y == geometry.GetY() { - result[m.Name] = mon - } - } + result[monitors[i].Name] = mon } return result, nil } @@ -827,3 +865,8 @@ cmd := strings.Fields(command)[0] return getCommandOutput(fmt.Sprintf("command -v %s ", cmd)) != "" } + +func md5Hash(text string) string { + hash := md5.Sum([]byte(text)) + return hex.EncodeToString(hash[:]) +} ++++++ vendor.tar.zst ++++++ ++++ 68489 lines of diff (skipped)