Alexays / Waybar

Highly customizable Wayland bar for Sway and Wlroots based compositors. :v: :tada:
MIT License
5.82k stars 657 forks source link

The fallback location of Hyprland socket is not properly configured when $TMP environment variable is set #3280

Closed amvasilyev closed 1 month ago

amvasilyev commented 1 month ago

In 0.10.3 Waybar was updated to support the new location of Hyprland IPC socket. The corresponding code contains logic to find the fallback location. The code uses the std::filesystem::temp_directory_path function to get location of the temp directory.

The temp_directory_path function does not always return path to the /tmp directory and may be affected by several environment variables. My distribution provides a $TMP variable that does not point to the /tmp directory. Therefore the path is not properly computed, the module can not communicate with Hyprland.

In old version of Hyprland wiki specifies the directory of the socket to be /tmp. Taking into account that previous Waybar was working perfectly fine with the same directory I suggest to change the search path to /tmp:

     socketFolder = xdgRuntimeDir / "hypr";
   } else {
     spdlog::warn("$XDG_RUNTIME_DIR/hypr does not exist, falling back to /tmp/hypr");
-    socketFolder = std::filesystem::temp_directory_path() / "hypr";
+    socketFolder = std::filesystem::path("/tmp") / "hypr";
   }
   socketFolder = socketFolder / instanceSig;
   return socketFolder;
Slimemaster0 commented 1 month ago

If you want to fix it for your self just do exec = $XDG_RUNTIME_DIR=/path/to/runtime/dir waybar in your Hyprland config. But yes you shouldn't have to fix it your self.