Conversation
|
I would prefer if you remove the Input.cpp changes. IIRC returning false on an input handler cancels the event or cause some other unnecessary side effects in edge cases should the workspace creation fail. |
so what about window rendering bugs |
Some render optimization workaround I made earlier broke again. Chasing upstream changes is a cat and mouse game. I will get to it when I have more free time. |
|
I'm not an expert in this either and don't like ai slop as well but I also had Claude work on this and it based it on your PR to give an overlay for nixos users. Haven't checked it thoroughly, I just know it's working for me but if anyone else on nixos wants a solution that may work in the meantime they can try this overlay. I really appreciate your work @KZDKM btw! I love this plugin and hope that you manage to get some free time soon to work on it self: super:
{
hyprlandPlugins = super.hyprlandPlugins // {
hyprspace = super.hyprlandPlugins.hyprspace.overrideAttrs (oldAttrs: {
# Fix compatibility with Hyprland 0.51.x
# Based on PR #200: https://github.com/KZDKM/Hyprspace/pull/200
# Updates dispatcher API from V1 to V2 and fixes type casting issues
postPatch = (oldAttrs.postPatch or "") + ''
# Update dispatcher API to V2
substituteInPlace src/main.cpp \
--replace-fail 'HyprlandAPI::addDispatcher(pHandle, "overview:toggle"' \
'HyprlandAPI::addDispatcherV2(pHandle, "overview:toggle"' \
--replace-fail 'HyprlandAPI::addDispatcher(pHandle, "overview:open"' \
'HyprlandAPI::addDispatcherV2(pHandle, "overview:open"' \
--replace-fail 'HyprlandAPI::addDispatcher(pHandle, "overview:close"' \
'HyprlandAPI::addDispatcherV2(pHandle, "overview:close"'
# Fix type casting issue in Render.cpp for panelBorderWidth
substituteInPlace src/Render.cpp \
--replace-fail 'owner->m_transformedSize.x, Config::panelBorderWidth};' \
'owner->m_transformedSize.x, static_cast<double>(Config::panelBorderWidth)};'
# Fix Input.cpp to handle createNewWorkspace return value (nodiscard in 0.51)
# This captures the return value to avoid compiler warnings/errors
# Replace both occurrences on lines 92 and 97
sed -i 's/if (g_pCompositor->getWorkspaceByID(wsIDName.id) == nullptr) g_pCompositor->createNewWorkspace(wsIDName.id, ownerID);/if (g_pCompositor->getWorkspaceByID(wsIDName.id) == nullptr) { auto ws = g_pCompositor->createNewWorkspace(wsIDName.id, ownerID); (void)ws; }/g' src/Input.cpp
# Fix gesture handling for Hyprland 0.51 - the old gesture config options were removed
# Use default values (3 fingers, 300 distance) when the old config doesn't exist
substituteInPlace src/Input.cpp \
--replace-fail 'int fingers = std::any_cast<Hyprlang::INT>(HyprlandAPI::getConfigValue(pHandle, "gestures:workspace_swipe_fingers")->getValue());' \
'auto fingersConfig = HyprlandAPI::getConfigValue(pHandle, "gestures:workspace_swipe_fingers"); int fingers = fingersConfig ? std::any_cast<Hyprlang::INT>(fingersConfig->getValue()) : 3;' \
--replace-fail 'int distance = std::any_cast<Hyprlang::INT>(HyprlandAPI::getConfigValue(pHandle, "gestures:workspace_swipe_distance")->getValue());' \
'auto distanceConfig = HyprlandAPI::getConfigValue(pHandle, "gestures:workspace_swipe_distance"); int distance = distanceConfig ? std::any_cast<Hyprlang::INT>(distanceConfig->getValue()) : 300;'
'';
});
};
} |
Works for me |
|
@mssnyder thank you for this information! I will take a look. |
Right up front, I am not a C++ developer and these changes were done with Claude Code. I am however an experienced engineer; cautious and conscientious in how I use those tools and don't believe in "vibe coding" or slop.
I read and understood every line including manually correcting some things. I did not just write "fix this" and commit. I'm a fan of Ghostty's approach.
This updates the code for Hyprland 0.51 as well as addresses a couple compiler warnings. I'm using this myself on my Arch system and it seems to work well.
One thing I should call out, the changes to Input.cpp may change behavior. In the previous code, it was trying to create the workspace and then blindly changing to that workspace. In this change, I'm checking the return value of the workspace creation attempt and bailing out if it failed.