summary refs log tree commit diff
path: root/pkgs/applications/misc/waybar
diff options
context:
space:
mode:
authorJeremy <jtbx@duck.com>2023-08-03 20:02:11 +1200
committerAnderson Torres <torres.anderson.85@protonmail.com>2023-08-06 20:33:15 +0000
commit179f481687d038e638660d697b23b02c7367633f (patch)
tree75236326cd332885195a4f28b2e1930b607ed59f /pkgs/applications/misc/waybar
parent684f53f7c0ee3ce49f0574b0b13c6d5af46e6d19 (diff)
downloadnixpkgs-179f481687d038e638660d697b23b02c7367633f.tar
nixpkgs-179f481687d038e638660d697b23b02c7367633f.tar.gz
nixpkgs-179f481687d038e638660d697b23b02c7367633f.tar.bz2
nixpkgs-179f481687d038e638660d697b23b02c7367633f.tar.lz
nixpkgs-179f481687d038e638660d697b23b02c7367633f.tar.xz
nixpkgs-179f481687d038e638660d697b23b02c7367633f.tar.zst
nixpkgs-179f481687d038e638660d697b23b02c7367633f.zip
waybar: add hyprlandSupport feature flag
Diffstat (limited to 'pkgs/applications/misc/waybar')
-rw-r--r--pkgs/applications/misc/waybar/default.nix10
-rw-r--r--pkgs/applications/misc/waybar/hyprland.diff12
2 files changed, 20 insertions, 2 deletions
diff --git a/pkgs/applications/misc/waybar/default.nix b/pkgs/applications/misc/waybar/default.nix
index c4a764fec97..7c0c88bb6d8 100644
--- a/pkgs/applications/misc/waybar/default.nix
+++ b/pkgs/applications/misc/waybar/default.nix
@@ -18,6 +18,7 @@
 , libxkbcommon
 , cavaSupport     ? true,  alsa-lib, fftw, iniparser, ncurses, pipewire, portaudio, SDL2
 , evdevSupport    ? true,  libevdev
+, hyprlandSupport ? false, hyprland
 , inputSupport    ? true,  libinput
 , jackSupport     ? true,  libjack2
 , mpdSupport      ? true,  libmpdclient
@@ -65,6 +66,10 @@ stdenv.mkDerivation rec {
     )
   '';
 
+  # Patch for workspaces support in wlr/workspaces
+  # See https://wiki.hyprland.org/Useful-Utilities/Status-Bars/#waybar
+  patches = lib.optional hyprlandSupport [ ./hyprland.diff ];
+
   nativeBuildInputs = [
     meson ninja pkg-config scdoc wrapGAppsHook
   ] ++ lib.optional withMediaPlayer gobject-introspection;
@@ -88,6 +93,7 @@ stdenv.mkDerivation rec {
     ++ optional  cavaSupport   portaudio
     ++ optional  cavaSupport   SDL2
     ++ optional  evdevSupport  libevdev
+    ++ optional  hyprlandSupport hyprland
     ++ optional  inputSupport  libinput
     ++ optional  jackSupport   libjack2
     ++ optional  mpdSupport    libmpdclient
@@ -126,7 +132,7 @@ stdenv.mkDerivation rec {
     "-Dsystemd=disabled"
     "-Dgtk-layer-shell=enabled"
     "-Dman-pages=enabled"
-  ];
+  ] ++ lib.optional hyprlandSupport "-Dexperimental=true";
 
   preFixup = lib.optionalString withMediaPlayer ''
       cp $src/resources/custom_modules/mediaplayer.py $out/bin/waybar-mediaplayer.py
@@ -139,7 +145,7 @@ stdenv.mkDerivation rec {
     changelog = "https://github.com/alexays/waybar/releases/tag/${version}";
     description = "Highly customizable Wayland bar for Sway and Wlroots based compositors";
     license = licenses.mit;
-    maintainers = with maintainers; [ FlorianFranzen minijackson synthetica lovesegfault rodrgz ];
+    maintainers = with maintainers; [ FlorianFranzen minijackson synthetica lovesegfault rodrgz jtbx ];
     platforms = platforms.unix;
     homepage = "https://github.com/alexays/waybar";
     mainProgram = "waybar";
diff --git a/pkgs/applications/misc/waybar/hyprland.diff b/pkgs/applications/misc/waybar/hyprland.diff
new file mode 100644
index 00000000000..d3febdae4a1
--- /dev/null
+++ b/pkgs/applications/misc/waybar/hyprland.diff
@@ -0,0 +1,12 @@
+--- a/src/modules/wlr/workspace_manager.cpp
++++ b/src/modules/wlr/workspace_manager.cpp
+@@ -523,7 +523,8 @@
+   if (action.empty())
+     return true;
+   else if (action == "activate") {
+-    zext_workspace_handle_v1_activate(workspace_handle_);
++    const std::string command = "hyprctl dispatch workspace " + name_;
++    system(command.c_str());
+   } else if (action == "close") {
+     zext_workspace_handle_v1_remove(workspace_handle_);
+   } else {