nwg-piotr / nwg-drawer

Application drawer for wlroots-based Wayland compositors
MIT License
250 stars 27 forks source link

Categories not showing #69

Closed phdpe closed 2 years ago

phdpe commented 2 years ago

First thank you for making so many great tools. I am using SwayWM on Arch and nwg-drawer is exactly what I am looking for.

I have installed nwg-drawer on two of my machines, both have same set up (Arch+Sway). However, on my laptop (thinkpad), nwg-drawer does not have any categories, other than "All". On the other machine (thinkcentre), all categories (including icons) showed up correctly.

I checked /usr/share/nwg-drawer and I do have all the necessary files in the desktop-directories directory. On both machines, I use default settings without any modification.

I also noticed that on thinkcentre, nwg-drawer automatically copies drawer.css to my local config folder, even after I try to delete it. This was not the case on my thinkpad.

All packages are latest., installed from official repo.

The only difference I can think of is that Thinkcentre used to have Gnome installed, and then I uninstalled it to switch to Sway. On Thinkpad, I started fresh with Sway. I wonder if there is any on Gnome that made nwg-drawer categories working properly?

Thank you!

nwg-piotr commented 2 years ago

I checked /usr/share/nwg-drawer and I do have all the necessary files in the desktop-directories directory. On both machines, I use default settings without any modification.

That's where we take category names from. We would need a special program version to debug this issue, and you'd have to build it locally, run, and show me the output. Would you like me to prepare it?

I also noticed that on thinkcentre, nwg-drawer automatically copies drawer.css to my local config folder, even after I try to delete it. This was not the case on my thinkpad.

It's expected behavior. It should always be like this. You can edit the file, but if you delete it, it'll be re-created.

phdpe commented 2 years ago

We would need a special program version to debug this issue, and you'd have to build it locally, run, and show me the output. Would you like me to prepare it?

Yes, please. I can try to build locally.

nwg-piotr commented 2 years ago

OK. Now you need to:

  1. Kill your running instance of nwg-drawer, if any: pkill -f nwg-drawer
  2. Clone the check69 branch: git clone https://github.com/nwg-piotr/nwg-drawer.git -b check69
  3. cd nwg-drawer
  4. Run the program w/ the debug flag: go run . -d (it may take quite a lot of time at the first try)
  5. Show me the terminal output.
phdpe commented 2 years ago

here it is... it seems like (1) even though it says it was copying the css file to local folder, it did not (2) it was looking for dir files in local folder as well.

# github.com/gotk3/gotk3/glib
cgo-gcc-prolog: In function ‘_cgo_200740c87a77_Cfunc_g_binding_get_source’:
cgo-gcc-prolog:71:2: warning: ‘g_binding_get_source’ is deprecated: Use 'g_binding_dup_source' instead [-Wdeprecated-declarations]
In file included from /usr/include/glib-2.0/glib-object.h:22,
                 from /usr/include/glib-2.0/gio/gioenums.h:28,
                 from /usr/include/glib-2.0/gio/giotypes.h:28,
                 from /usr/include/glib-2.0/gio/gio.h:26,
                 from ../../go/pkg/mod/github.com/gotk3/gotk3@v0.6.1/glib/gbinding.go:3:
/usr/include/glib-2.0/gobject/gbinding.h:113:23: note: declared here
  113 | GObject *             g_binding_get_source          (GBinding *binding);
      |                       ^~~~~~~~~~~~~~~~~~~~
cgo-gcc-prolog: In function ‘_cgo_200740c87a77_Cfunc_g_binding_get_target’:
cgo-gcc-prolog:107:2: warning: ‘g_binding_get_target’ is deprecated: Use 'g_binding_dup_target' instead [-Wdeprecated-declarations]
/usr/include/glib-2.0/gobject/gbinding.h:117:23: note: declared here
  117 | GObject *             g_binding_get_target          (GBinding *binding);
      |                       ^~~~~~~~~~~~~~~~~~~~
time="2022-09-20T17:15:31-04:00" level=info msg="term: xterm-256color"
time="2022-09-20T17:15:31-04:00" level=info msg="lang: en_US"
time="2022-09-20T17:15:31-04:00" level=info msg="Config dir: /home/user/.config/nwg-drawer"
time="2022-09-20T17:15:31-04:00" level=info msg="Copying file: /home/user/.config/nwg-drawer/drawer.css"
time="2022-09-20T17:15:31-04:00" level=info msg="Found 0 pinned items"
time="2022-09-20T17:15:31-04:00" level=debug msg="Desktop dirs location: /home/user/.local/share/nwg-drawer/desktop-directories"
time="2022-09-20T17:15:31-04:00" level=error msg="Couldn't open /home/user/.local/share/nwg-drawer/desktop-directories/utility.directory"
time="2022-09-20T17:15:31-04:00" level=error msg="Couldn't open /home/user/.local/share/nwg-drawer/desktop-directories/development.directory"
time="2022-09-20T17:15:31-04:00" level=error msg="Couldn't open /home/user/.local/share/nwg-drawer/desktop-directories/game.directory"
time="2022-09-20T17:15:31-04:00" level=error msg="Couldn't open /home/user/.local/share/nwg-drawer/desktop-directories/graphics.directory"
time="2022-09-20T17:15:31-04:00" level=error msg="Couldn't open /home/user/.local/share/nwg-drawer/desktop-directories/internet-and-network.directory"
time="2022-09-20T17:15:31-04:00" level=error msg="Couldn't open /home/user/.local/share/nwg-drawer/desktop-directories/office.directory"
time="2022-09-20T17:15:31-04:00" level=error msg="Couldn't open /home/user/.local/share/nwg-drawer/desktop-directories/audio-video.directory"
time="2022-09-20T17:15:31-04:00" level=error msg="Couldn't open /home/user/.local/share/nwg-drawer/desktop-directories/system-tools.directory"
time="2022-09-20T17:15:31-04:00" level=error msg="Couldn't open /home/user/.local/share/nwg-drawer/desktop-directories/other.directory"
time="2022-09-20T17:15:31-04:00" level=info msg="Found 31 desktop files"
time="2022-09-20T17:15:31-04:00" level=info msg="Skipped 0 duplicates; 7 .desktop entries hidden by \"NoDisplay=true\""
time="2022-09-20T17:15:31-04:00" level=info msg="/home/user/.config/nwg-drawer/preferred-apps.json file not found"
time="2022-09-20T17:15:31-04:00" level=info msg="/home/user/.config/nwg-drawer/excluded-dirs file not found"
time="2022-09-20T17:15:32-04:00" level=info msg="Preferring dark theme variants"
time="2022-09-20T17:15:32-04:00" level=error msg="ERROR: /home/user/.config/nwg-drawer/drawer.css css file not found or erroneous. Using GTK styling."
time="2022-09-20T17:15:32-04:00" level=error msg="<broken file>:1:0Failed to import: Error opening file /home/user/.config/nwg-drawer/drawer.css: No such file or directory"
time="2022-09-20T17:15:32-04:00" level=warning msg="/home/user/.config/user-dirs.dirs file not found, using defaults"

** (nwg-drawer:93344): WARNING **: 17:15:32.043: gtk-layer-shell v0.7.0 may not work on GTK v3.24.34. If you experience crashes, check https://github.com/wmww/gtk-layer-shell/blob/master/compatibility.md
time="2022-09-20T17:15:32-04:00" level=info msg="UI created in 89 ms. Thank you for your patience."
nwg-piotr commented 2 years ago

At 1: It works on my side. At 2: When installed as the AUR package, it should be on its place. See PKGBUILD.

phdpe commented 2 years ago

PKGBUILD showed it only copies to /usr/share/nwg-drawer/, am I correct? It doesnt copy all the dir files to .local/share/nwg-drawer. Once I copy all the directory files to ~/.local/share/nwg-drawer, all the dirs show up correctly.

package() {
  cd "$srcdir"
  install -d "$pkgdir"/usr/share/"$pkgname"/desktop-directories
  install -Dm644 -t "$pkgdir"/usr/share/"$pkgname"/desktop-directories/ "$pkgname"-"$pkgver"/desktop-directories/*
  install -Dm644 -t "$pkgdir"/usr/share/"$pkgname" "$pkgname"-"$pkgver"/drawer.css
  install -Dm755 -t "$pkgdir"/usr/bin "$pkgname"-"$pkgver"/bin/"$pkgname"
}
nwg-piotr commented 2 years ago

We don't use .local/share/nwg-drawer.

func setUpCategories() {
    p := filepath.Join(getDataHome(), "nwg-drawer/desktop-directories")

and getDataHome() is as below:

func getDataHome() string {
    if os.Getenv("XDG_DATA_HOME") != "" {
        return os.Getenv("XDG_DATA_HOME")
    }
    return "/usr/share/"
}

Anything wrong with your XDG_DATA_HOME environment variable?

[edit] Hmmm, it seems it should point to $HOME/.local/share...

phdpe commented 2 years ago

it's set to $HOME/.local/share in fish. It seems like your code is pointing to local.

set -gx XDG_DATA_HOME $HOME/.local/share
nwg-piotr commented 2 years ago

It seems the code is wrong, and it shows up if you set the XDG_DATA_HOME variable.

phdpe commented 2 years ago

[edit] Hmmm, it seems it should point to $HOME/.local/share...

Yeah... since I have it set, it's looking for XDG_DATA_HOME rather than XDG_DATA_DIRS

nwg-piotr commented 2 years ago

Alright, I'll give up on the env variable, and use the usr/share/ path. What do you think?

phdpe commented 2 years ago

Alright, I'll give up on the env variable, and use the usr/share/ path. What do you think?

I cant make the decision as I have next to zero development experience. I'm just glad to find a bug!

nwg-piotr commented 2 years ago

I need a coffee to make a decision. One way or another, thanks for pointing out the bug.

nwg-piotr commented 2 years ago

It should be alright now, or at least I hope so. Can't release yet, as I fixed some deprecation errors, that appeared in Go 1.19. It needs a couple of days of testing.