Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Hyprland clash when unplug monitor #69

Closed

Conversation

AbaoFromCUG
Copy link
Contributor

Fix

Notice

  • I would like to add CMakeLists.txt (proposal only)

@levnikmyskin
Copy link
Owner

Hi! Thank you very much for your contribution. Please, check whether this issue has already been solved on the dev branch. That's where we keep development for "rolling" hyprland (i.e., hyprland git). If not, feel free to rebase this pr so that it merges into dev rather than main :)

@AbaoFromCUG
Copy link
Contributor Author

AbaoFromCUG commented Dec 4, 2024

Hi! Thank you very much for your contribution. Please, check whether this issue has already been solved on the dev branch. That's where we keep development for "rolling" hyprland (i.e., hyprland git). If not, feel free to rebase this pr so that it merges into dev rather than main :)

I use the hyprland v0.45.2, which is release version from https://archlinux.org/packages/extra/x86_64/hyprland/
I can't build hyprland v0.45.2 with dev branch virtual-desktops, because API is incompatible:

src/main.cpp: In function ‘std::string printStateDispatch(eHyprCtlOutputFormat, std::string)’:
src/main.cpp:189:43: error: ‘class CWorkspace’ has no member named ‘getWindows’
  189 |                     windows += workspace->getWindows();
      |                                           ^~~~~~~~~~
src/main.cpp:199:25: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::unordered_map<int, std::shared_ptr<VirtualDesk> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  199 |             if (index++ < manager->vdesksMap.size() - 1)
      |                 ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/main.cpp:212:43: error: ‘class CWorkspace’ has no member named ‘getWindows’
  212 |                     windows += workspace->getWindows();
      |                                           ^~~~~~~~~~
src/main.cpp:229:25: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::unordered_map<int, std::shared_ptr<VirtualDesk> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  229 |             if (index++ < manager->vdesksMap.size() - 1)
      |                 ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/main.cpp: In function ‘std::string printLayoutDispatch(eHyprCtlOutputFormat, std::string)’:
src/main.cpp:260:25: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::unordered_map<const Hyprutils::Memory::CSharedPointer<CMonitor>, long int>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  260 |             if (++index < layout.size())
      |                 ~~~~~~~~^~~~~~~~~~~~~~~
src/VirtualDesk.cpp: In static member function ‘static Hyprutils::Memory::CSharedPointer<CMonitor> VirtualDesk::firstAvailableMonitor(const std::vector<Hyprutils::Memory::CSharedPointer<CMonitor> >&)’:
src/VirtualDesk.cpp:127:40: error: ‘class CWorkspace’ has no member named ‘getWindows’
  127 |             auto n_on_mon = workspace->getWindows();
      |                                        ^~~~~~~~~~
src/VirtualDesk.cpp: In member function ‘Layout VirtualDesk::generateCurrentMonitorLayout()’:
src/VirtualDesk.cpp:181:41: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
  181 |     for (int i = vdeskFirstWorkspace; i < vdeskFirstWorkspace + monitors.size(); i++) {
      |                                       ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [Makefile:17: virtual-desktops.so] Error 1

I want to fix the issue occurring in hyprland v0.45.2, I can confirm that it also happened in hyprland-git. Because we will release CMonitor twice times.

@AbaoFromCUG AbaoFromCUG force-pushed the abao/fix_monitor_unplug branch from ba08cb5 to adb326a Compare December 4, 2024 04:20
@AbaoFromCUG AbaoFromCUG force-pushed the abao/fix_monitor_unplug branch from adb326a to 3d977e6 Compare December 4, 2024 04:49
@levnikmyskin
Copy link
Owner

I see. The code for this has already been changed in the dev branch though. The problem about not using hooks was that the virtual desks would get completely messed up when you connected/disconnected monitors. I added a few events to Hyprland, and this is now possible (even though several problems are still there).
Thank you for the cmake stuff though!

@AbaoFromCUG
Copy link
Contributor Author

I understand. I will temporarily use the version I compiled myself, waiting for the release of hyprland.

Thank you for your patient explanation。

@AbaoFromCUG AbaoFromCUG closed this Dec 5, 2024
@levnikmyskin
Copy link
Owner

Thank you for your understanding, I'm sorry we couldn't use your work for this time, I do appreciate your contribution. And I think we're still crashing on dev, so might be related to something else. Feel free to look into it, once it's merged to main :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants