Waybar icon indicating copy to clipboard operation
Waybar copied to clipboard

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

Open amvasilyev opened this issue 1 month ago • 0 comments

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;

amvasilyev avatar May 19 '24 05:05 amvasilyev