horriblename / hyprgrass

hyprland plugin for touch gestures
BSD 3-Clause "New" or "Revised" License
268 stars 11 forks source link

Cannot build hyprgrass on nixos unstable #100

Closed mjschwenne closed 6 months ago

mjschwenne commented 6 months ago

I had hyprgrass installed and working correctly as recently as last week, but today I was updating my system again and I got this error message:

g++ -Isrc/libhyprgrass.so.p -Isrc -I../src -I/nix/store/ddm2gijvzba4bil3z35q515ap185jpsk-wf-touch-git-dev/include -I/nix/store/p624jarli65hvy4lx49l1ppv523ilfi3-glm-0.9.9.8/include -I/nix/store/aldmf9w7jiss99b93dfndd1nsb9s5qn7-pixman-0.43.4/include/pixman-1 -I/nix/store/bf9ay9lix3w9830i65a4pvwjznx3ggc5-libdrm-2.4.120-dev/include -I/nix/store/bf9ay9lix3w9830i65a4pvwjznx3ggc5-libdrm-2.4.120-dev/include/libdrm -I/nix/store/4173v1jzz279illgdjv5smih57r0y807-hyprland-0.38.0+date=2024-04-03_fbdaf74-dev/include -I/nix/store/4173v1jzz279illgdjv5smih57r0y807-hyprland-0.38.0+date=2024-04-03_fbdaf74-dev/include/hyprland/protocols -I/nix/store/4173v1jzz279illgdjv5smih57r0y807-hyprland-0.38.0+date=2024-04-03_fbdaf74-dev/include/hyprland/wlroots -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c++23 -fPIC -DWLR_USE_UNSTABLE -MD -MQ src/libhyprgrass.so.p/GestureManager.cpp.o -MF src/libhyprgrass.so.p/GestureManager.cpp.o.d -o src/libhyprgrass.so.p/GestureManager.cpp.o -c ../src/GestureManager.cpp
../src/GestureManager.cpp: In member function 'bool GestureManager::handleWorkspaceSwipe(GestureDirection)':
../src/GestureManager.cpp:247:91: error: cannot convert 'PHLWORKSPACE' {aka 'std::shared_ptr<CWorkspace>'} to 'const int&'
  247 |     const auto VERTANIMS = g_pCompositor->getWorkspaceByID(g_pCompositor->m_pLastMonitor->activeWorkspace)
      |                                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
      |                                                                                           |
      |                                                                                           PHLWORKSPACE {aka std::shared_ptr<CWorkspace>}
Full log: ``` @nix { "action": "setPhase", "phase": "unpackPhase" } Running phase: unpackPhase unpacking source archive /nix/store/lqbxf5fqky2zlp6jkpabsxr6pd58gk0r-b3zhff76y96rw90phzy3h88iw9zhrdpn-source source root is b3zhff76y96rw90phzy3h88iw9zhrdpn-source @nix { "action": "setPhase", "phase": "patchPhase" } Running phase: patchPhase @nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" } Running phase: updateAutotoolsGnuConfigScriptsPhase @nix { "action": "setPhase", "phase": "configurePhase" } Running phase: configurePhase mesonConfigurePhase flags: --prefix=/nix/store/i8zzd2y5r0l5l4f8m9dgc8j62a5phqkh-hyprgrass-0.6.0 --libdir=/nix/store/i8zzd2y5r0l5l4f8m9dgc8j62a5phqkh-hyprgrass-0.6.0/lib --libexecdir=/nix/store/i8zzd2y5r0l5l4f8m9dgc8j62a5phqkh-hyprgrass-0.6.0/libexec --bindir=/nix/store/i8zzd2y5r0l5l4f8m9dgc8j62a5phqkh-hyprgrass-0.6.0/bin --sbindir=/nix/store/i8zzd2y5r0l5l4f8m9dgc8j62a5phqkh-hyprgrass-0.6.0/sbin --includedir=/nix/store/i8zzd2y5r0l5l4f8m9dgc8j62a5phqkh-hyprgrass-0.6.0/include --mandir=/nix/store/i8zzd2y5r0l5l4f8m9dgc8j62a5phqkh-hyprgrass-0.6.0/share/man --infodir=/nix/store/i8zzd2y5r0l5l4f8m9dgc8j62a5phqkh-hyprgrass-0.6.0/share/info --localedir=/nix/store/i8zzd2y5r0l5l4f8m9dgc8j62a5phqkh-hyprgrass-0.6.0/share/locale -Dauto_features=enabled -Dwrap_mode=nodownload --buildtype=plain The Meson build system Version: 1.3.2 Source dir: /build/b3zhff76y96rw90phzy3h88iw9zhrdpn-source Build dir: /build/b3zhff76y96rw90phzy3h88iw9zhrdpn-source/build Build type: native build Project name: hyprgrass Project version: 0.6.0 C compiler for the host machine: gcc (gcc 13.2.0 "gcc (GCC) 13.2.0") C linker for the host machine: gcc ld.bfd 2.41 C++ compiler for the host machine: g++ (gcc 13.2.0 "g++ (GCC) 13.2.0") C++ linker for the host machine: g++ ld.bfd 2.41 Host machine cpu family: x86_64 Host machine cpu: x86_64 Compiler for C++ supports arguments -std=c++23: YES meson.build:8: WARNING: Consider using the built-in option for language standard version instead of using "-std=c++23". Found pkg-config: YES (/nix/store/zwkj99kd2dzccjvnclys91cvs5cg9cib-pkg-config-wrapper-0.29.2/bin/pkg-config) 0.29.2 Run-time dependency hyprland found: YES 0.38.0 Run-time dependency wftouch found: YES 0.0 Found CMake: /nix/store/17r6ld906midfv8y7997fd56s7a87vrg-cmake-3.28.3/bin/cmake (3.28.3) Run-time dependency doctest found: YES 2.4.11 Run-time dependency pixman-1 found: YES 0.43.4 Run-time dependency libdrm found: YES 2.4.120 Build targets in project: 3 hyprgrass 0.6.0 User defined options auto_features: enabled bindir : /nix/store/i8zzd2y5r0l5l4f8m9dgc8j62a5phqkh-hyprgrass-0.6.0/bin buildtype : plain includedir : /nix/store/i8zzd2y5r0l5l4f8m9dgc8j62a5phqkh-hyprgrass-0.6.0/include infodir : /nix/store/i8zzd2y5r0l5l4f8m9dgc8j62a5phqkh-hyprgrass-0.6.0/share/info libdir : /nix/store/i8zzd2y5r0l5l4f8m9dgc8j62a5phqkh-hyprgrass-0.6.0/lib libexecdir : /nix/store/i8zzd2y5r0l5l4f8m9dgc8j62a5phqkh-hyprgrass-0.6.0/libexec localedir : /nix/store/i8zzd2y5r0l5l4f8m9dgc8j62a5phqkh-hyprgrass-0.6.0/share/locale mandir : /nix/store/i8zzd2y5r0l5l4f8m9dgc8j62a5phqkh-hyprgrass-0.6.0/share/man prefix : /nix/store/i8zzd2y5r0l5l4f8m9dgc8j62a5phqkh-hyprgrass-0.6.0 sbindir : /nix/store/i8zzd2y5r0l5l4f8m9dgc8j62a5phqkh-hyprgrass-0.6.0/sbin wrap_mode : nodownload Found ninja-1.11.1 at /nix/store/sxkp17y5ilj8j2kabc6lh74d6v0mhpgq-ninja-1.11.1/bin/ninja mesonConfigurePhase: enabled\ parallel\ building @nix { "action": "setPhase", "phase": "buildPhase" } Running phase: buildPhase build flags: -j24 [1/12] Compiling C++ object src/gestures/libgestures.a.p/Shared.cpp.o [2/12] Compiling C++ object src/gestures/libgestures.a.p/DragGesture.cpp.o [3/12] Compiling C++ object src/gestures/libgestures.a.p/CompletedGesture.cpp.o [4/12] Compiling C++ object src/gestures/test/test-gestures.p/MockGestureManager.cpp.o [5/12] Compiling C++ object src/gestures/libgestures.a.p/Actions.cpp.o [6/12] Compiling C++ object src/gestures/libgestures.a.p/Gestures.cpp.o [7/12] Linking static target src/gestures/libgestures.a [8/12] Compiling C++ object src/libhyprgrass.so.p/GestureManager.cpp.o FAILED: src/libhyprgrass.so.p/GestureManager.cpp.o g++ -Isrc/libhyprgrass.so.p -Isrc -I../src -I/nix/store/ddm2gijvzba4bil3z35q515ap185jpsk-wf-touch-git-dev/include -I/nix/store/p624jarli65hvy4lx49l1ppv523ilfi3-glm-0.9.9.8/include -I/nix/store/aldmf9w7jiss99b93dfndd1nsb9s5qn7-pixman-0.43.4/include/pixman-1 -I/nix/store/bf9ay9lix3w9830i65a4pvwjznx3ggc5-libdrm-2.4.120-dev/include -I/nix/store/bf9ay9lix3w9830i65a4pvwjznx3ggc5-libdrm-2.4.120-dev/include/libdrm -I/nix/store/4173v1jzz279illgdjv5smih57r0y807-hyprland-0.38.0+date=2024-04-03_fbdaf74-dev/include -I/nix/store/4173v1jzz279illgdjv5smih57r0y807-hyprland-0.38.0+date=2024-04-03_fbdaf74-dev/include/hyprland/protocols -I/nix/store/4173v1jzz279illgdjv5smih57r0y807-hyprland-0.38.0+date=2024-04-03_fbdaf74-dev/include/hyprland/wlroots -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c++23 -fPIC -DWLR_USE_UNSTABLE -MD -MQ src/libhyprgrass.so.p/GestureManager.cpp.o -MF src/libhyprgrass.so.p/GestureManager.cpp.o.d -o src/libhyprgrass.so.p/GestureManager.cpp.o -c ../src/GestureManager.cpp ../src/GestureManager.cpp: In member function 'bool GestureManager::handleWorkspaceSwipe(GestureDirection)': ../src/GestureManager.cpp:247:91: error: cannot convert 'PHLWORKSPACE' {aka 'std::shared_ptr'} to 'const int&' 247 | const auto VERTANIMS = g_pCompositor->getWorkspaceByID(g_pCompositor->m_pLastMonitor->activeWorkspace) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~ | | | PHLWORKSPACE {aka std::shared_ptr} In file included from /nix/store/4173v1jzz279illgdjv5smih57r0y807-hyprland-0.38.0+date=2024-04-03_fbdaf74-dev/include/hyprland/src/managers/KeybindManager.hpp:5, from ../src/GestureManager.hpp:8, from ../src/GestureManager.cpp:1: /nix/store/4173v1jzz279illgdjv5smih57r0y807-hyprland-0.38.0+date=2024-04-03_fbdaf74-dev/include/hyprland/src/Compositor.hpp:148:37: note: initializing argument 1 of 'PHLWORKSPACE CCompositor::getWorkspaceByID(const int&)' 148 | PHLWORKSPACE getWorkspaceByID(const int&); | ^~~~~~~~~~ [9/12] Compiling C++ object src/gestures/test/test-gestures.p/test.cpp.o [10/12] Compiling C++ object src/libhyprgrass.so.p/main.cpp.o ninja: build stopped: subcommand failed. ```

Relevant parts of my nixos config are:

flake.nix in inputs:

# hyprland
hyprland = {
  url = "github:hyprwm/Hyprland";
};

hyprland-contrib = {
  url = "github:hyprwm/contrib";
};

hyprgrass = {
  url = "github:horriblename/hyprgrass";
  inputs.hyprland.follows = "hyprland";
};

Hyprland setup:

wayland.windowManager.hyprland = {
  enable = true;
  plugins = [
    hyprgrass.packages.${pkgs.system}.default
  ];
 # Other hyprland settings... omitted
};

Thanks in advance for your assistance!

Yusuf-Duran commented 6 months ago

I got the same error on arch Linux, so this shouldn't just be nix related

horriblename commented 6 months ago

someone give me confirmation on whether or not the latest commit works

drxm1 commented 6 months ago

This is compiling now (which did not work yesterday, with the above error):

# flake.nix
...
inputs = {
      hyprland.url = "github:hyprwm/Hyprland";
      hyprgrass = {
        url = "github:horriblename/hyprgrass";
        inputs.hyprland.follows = "hyprland"; # IMPORTANT
      };
}
------
# hyprland.nix
{ config, inputs, pkgs, ... }:
{
  wayland.windowManager.hyprland = {
    ...
    plugins = [
       inputs.hyprgrass.packages.${pkgs.system}.default
    ];
    #package = inputs.hyprland.packages.${pkgs.system}.hyprland;
  };
}

Just dont know how to actually get it working as a plugin on nixos since I just switched operating system, but that is a user problem I guess.

Edit (just for giving some information): The following work on my device: bind = , swipe:4:d, killactive; bind = , edge:r:l, workspace, +1 But the three finger workspace swipe crashes hyprland:

Process 73193 (.Hyprland-wrapp) of user 1000 dumped core.
Stack trace of thread 73193:
#0  0x00007fb788064291 _ZN14GestureManager20handleWorkspaceSwipeEj (libhyprgrass.so + 0x2b291)
#1  0x00007fb78806765b _ZN14GestureManager17handleDragGestureERK11DragGesture (libhyprgrass.so + 0x2e65b)

This could, however, just be some missing drivers on my device, or a version mismatch. xdg-desktop-portal-hyprland is running.

Plugin hyprgrass by horriblename: Handle: 2d61e60 Version: 0.6 Description: Touchscreen gestures Hyprland (flake.lock): "locked": { "lastModified": 1712288444, "narHash": "sha256-UzfzS/4vGyeowWW9gYvAq3mj4MOzC2I7a9XRqsCKED4=", "owner": "hyprwm", "repo": "Hyprland", "rev": "baad44b4ca28d62fb9d86ed1f83650b6695b501d", "type": "github"

horriblename commented 6 months ago

This could, however, just be some missing drivers on my device, or a version mismatch. xdg-desktop-portal-hyprland is running.

nah its 99% my fault, the PR above only affects the workspace swipe after all

technotechnoduck commented 6 months ago

As far as i have been able to read, the issue was caused is because now the function g_pCompositor->m_pLastMonitor->activeWorkspace used to return the workspace ID, but now returns the PHLWORKSPACE.

If in the original code the GetWorkspaceByID surrounding function is removed, it works just fine.

    const bool VERTANIMS = g_pCompositor->m_pLastMonitor->activeWorkspace
        ->m_vRenderOffset.getConfig()
        ->pValues->internalStyle == "slidevert" ||
        g_pCompositor->m_pLastMonitor->activeWorkspace
        ->m_vRenderOffset.getConfig()
        ->pValues->internalStyle.starts_with("slidevert");

Does the trick.

horriblename commented 6 months ago

thanks to @technotechnoduck this is fixed