Coder Social home page Coder Social logo

itsdrike / hyprland-dwindle-autogroup Goto Github PK

View Code? Open in Web Editor NEW
28.0 1.0 0.0 80 KB

Hyprland plugin that overrides groupping behavior on dwindle layout to automatically group child nodes on creation

License: BSD 3-Clause "New" or "Revised" License

Makefile 7.11% C++ 92.89%
hyprland hyprland-plugin

hyprland-dwindle-autogroup's Introduction

Dwindle-Autogroup

This plugin changes the behavior of the togglegroup dispatcher for dwindle layout, to automatically group all of the child windows when a new group is created.

Important

dwindle-autogroup follows hyprland-git and requires hyprland-git to work properly. If you want to use a versioned hyprland, you'll have to reset dwindle-autogroup to a commit from before that hyprland version's release date.

Before Hyprland v0.23.0beta, this groupping behavior was actually the default behavior, however as that release introduced group support for other layouts, including floating windows, this dwindle specific feature was removed (in PR #1580) and togglegroup now only creates a group window, and requires you to move in all of the windows that should be a part of that group into it manually.

Showcase

2023-12-15.01-29-25.mp4

Installation

Hyprpm

The recommended way to install this plugin is via hyprpm:

  • hyprpm add https://github.com/ItsDrike/hyprland-dwindle-autogroup
  • hyprpm enable dwindle-autogroup

To automatically load the plugin when hyprland starts, add exec-once = hyprpm reload -n to your hyprland config.

Add the line "ItsDrike/hyprland-dwindle-autogroup" to your hyprload.toml config, like this:

plugins = [
    "ItsDrike/hyprland-dwindle-autogroup",
]

Then update via hyprload,update dispatcher.

Manual installation

  1. Clone the Hyprland repository and build the plugin environment

    • git clone --recursive https://github.com/hyprwm/Hyprland
    • In the Hyprland directory: make pluginenv
    • Ideally, you should use this instance of Hyprland as your compositor, to do that, run make install. This is heavily recommended, as using a different Hyprland instance might cause incompatibilities.
  2. Build the plugn

    • Run make all
  3. Add this line to the bottom of your hyprland config

    • exec-once=hyprctl plugin load <ABSOLUTE PATH TO split-monitor-workspaces.so>

Development

When developing, it is useful to run make clangd, to generate compile_flags.txt file, allowing Clang language server to properly recognize the imports, and give you autocompletion.

Disclaimer

I'm very new to C++ development, and I'm also not very familiar with Hyprland's codebase. So while I will do my best to follow best practices, with so little experience, you can be pretty much certain that there will be bugs, and that the code will not be pretty. But hey, if you know about something that I did wrong, feel free to PR/make an issue about it.

hyprland-dwindle-autogroup's People

Contributors

itsdrike avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

hyprland-dwindle-autogroup's Issues

Hyprland 0.4 support

After updating to hyprland 0.4, the plugin doesn't seem to be working.

Cheers.

Hyprland compositor crashes when using togglegroup dispatcher on a single window

Issue Summary

When using the toggle group dispatcher on a single window or trying to ungroup an already tiled child node using the toggle group feature, the hyprland compositor crashes.

Steps to reproduce

  1. use togglegroup in a single pane for example open kitty and just use the toggle group dispatcher
  2. Hyprland promptly crashes with step 1

Expected behavior

Not to crash but either to toggle a group with a single node or not group at all

Environment

  • Operating System: Arch Linux x86_64
  • Hyprland version:Hyprland, built from branch main at commit 2b4d96e0efe4ce4a13b8cdef0d1ff5981f674542dirty (examples: pull correct wlr dirs in example plugin).
  • plugin version: latest git

Additional details

coredump : https://paste.rs/Zn5
hyprland crash log: https://paste.rs/3B6

plugin crashes/dosent work in the latest arch release 0.27.2

hyprctl version -->

Hyprland, built from branch  at commit b08b72358ad549fd066e5be0fc3aa4c9df367607 dirty ().
Tag: v0.27.2

flags: (if any)

ps : This time I recompiled the plugin against the corresponding hyprland release.

New hyprland version breaks the plugin (v0.30.0)

On the latest hyprland release of version 0.30.0 the plugin can't compile .

g++ -shared -g -fPIC --no-gnu-unique -std=c++23 `pkg-config --cflags pixman-1 libdrm hyprland` -Iinclude -DWLR_USE_UNSTABLE src/main.cpp -o dwindle-autogroup.so
src/main.cpp: In function ‘void moveIntoGroup(CWindow*, CWindow*)’:
src/main.cpp:36:68: error: ‘CHyprGroupBarDecoration’ was not declared in this scope
   36 |         window->m_dWindowDecorations.emplace_back(std::make_unique<CHyprGroupBarDecoration>(window));
      |                                                                    ^~~~~~~~~~~~~~~~~~~~~~~
src/main.cpp:36:92: error: no matching function for call to ‘make_unique<<expression error> >(CWindow*&)’
   36 |         window->m_dWindowDecorations.emplace_back(std::make_unique<CHyprGroupBarDecoration>(window));
      |                                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
In file included from /usr/include/c++/13.2.1/memory:78,
                 from /usr/local/include/hyprland/src/plugins/HookSystem.hpp:5,
                 from /usr/local/include/hyprland/src/plugins/PluginAPI.hpp:24,
                 from include/globals.hpp:3,
                 from src/main.cpp:1:
/usr/include/c++/13.2.1/bits/unique_ptr.h:1069:5: note: candidate: ‘template<class _Tp, class ... _Args> constexpr std::__detail::__unique_ptr_t<_Tp> std::make_unique(_Args&& ...)’
 1069 |     make_unique(_Args&&... __args)
      |     ^~~~~~~~~~~
/usr/include/c++/13.2.1/bits/unique_ptr.h:1069:5: note:   template argument deduction/substitution failed:
src/main.cpp:36:92: error: template argument 1 is invalid
   36 |         window->m_dWindowDecorations.emplace_back(std::make_unique<CHyprGroupBarDecoration>(window));
      |                                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/usr/include/c++/13.2.1/bits/unique_ptr.h:1084:5: note: candidate: ‘template<class _Tp> constexpr std::__detail::__unique_ptr_array_t<_Tp> std::make_unique(size_t)’
 1084 |     make_unique(size_t __num)
      |     ^~~~~~~~~~~
/usr/include/c++/13.2.1/bits/unique_ptr.h:1084:5: note:   template argument deduction/substitution failed:
src/main.cpp:36:92: error: template argument 1 is invalid
   36 |         window->m_dWindowDecorations.emplace_back(std::make_unique<CHyprGroupBarDecoration>(window));
      |                                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/usr/include/c++/13.2.1/bits/unique_ptr.h:1094:5: note: candidate: ‘template<class _Tp, class ... _Args> std::__detail::__invalid_make_unique_t<_Tp> std::make_unique(_Args&& ...)’ (deleted)
 1094 |     make_unique(_Args&&...) = delete;
      |     ^~~~~~~~~~~
/usr/include/c++/13.2.1/bits/unique_ptr.h:1094:5: note:   template argument deduction/substitution failed:
src/main.cpp:36:92: error: template argument 1 is invalid
   36 |         window->m_dWindowDecorations.emplace_back(std::make_unique<CHyprGroupBarDecoration>(window));
      |                                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
make: *** [Makefile:26: all] Error 1

compilation error in hyprland v0.26.0

The plugin doesn't compile with the latest release of hyprland, giving the error

g++ -shared -fPIC --no-gnu-unique src/main.cpp -o dwindle-autogroup.so -g -I "/usr/include/pixman-1" -I "/usr/include/libdrm" -I "/home/adharsh/dot/plugins/Hyprland" -I "/home/adharsh/dot/plugins/Hyprland/subprojects/wlroots/include" -I "/home/adharsh/dot/plugins/Hyprland/subprojects/wlroots/build/include" -Iinclude -std=c++23
In file included from /home/adharsh/dot/plugins/Hyprland/src/includes.hpp:53,
                 from /home/adharsh/dot/plugins/Hyprland/src/defines.hpp:1,
                 from /home/adharsh/dot/plugins/Hyprland/src/Window.hpp:3,
                 from src/main.cpp:5:
/home/adharsh/dot/plugins/Hyprland/subprojects/wlroots/include/wlr/types/wlr_layer_shell_v1.h:16:10: fatal error: wlr-layer-shell-unstable-v1-protocol.h: No such file or directory
   16 | #include "wlr-layer-shell-unstable-v1-protocol.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:22: dwindle-autogroup.so] Error 1

Crash when toggling on floating window

I am not sure if it is a known issue, but it segfaults when toggling the grouping in a floating window and the logs say that it is causes by the plugin.

The logs:

--------------------------------------------
   Hyprland Crash Report
--------------------------------------------
All these computers...

Hyprland received signal 11 (Segmentation fault)

Version: 6c4e2489a0a153ac2a92744ecb2985280c97fc89
Tag: v0.36.0-69-g6c4e2489

Hyprland seems to be running with plugins. This crash might not be Hyprland's fault.
Plugins:
	dwindle-autogroup (ItsDrike) 1.0


System info:
	System name: Linux
	Node name: SG-Manjaro
	Release: 6.6.26-1-MANJARO
	Version: #1 SMP PREEMPT_DYNAMIC Wed Apr 10 20:11:08 UTC 2024

GPU:
	04:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Renoir [Radeon RX Vega 6 (Ryzen 4000/5000 Mobile Series)] [1002:1636] (rev c2) (prog-if 00 [VGA controller])


os-release:
	NAME="Manjaro Linux"
	PRETTY_NAME="Manjaro Linux"
	ID=manjaro
	ID_LIKE=arch
	BUILD_ID=rolling
	ANSI_COLOR="32;1;24;144;200"
	HOME_URL="https://manjaro.org/"
	DOCUMENTATION_URL="https://wiki.manjaro.org/"
	SUPPORT_URL="https://forum.manjaro.org/"
	BUG_REPORT_URL="https://docs.manjaro.org/reporting-bugs/"
	PRIVACY_POLICY_URL="https://manjaro.org/privacy-policy/"
	LOGO=manjarolinux
	


Backtrace:
	#0 | Hyprland(_Z12getBacktracev+0x48) [0x563bb1620708]
		getBacktrace()
		??:?
	#1 | Hyprland(_ZN13CrashReporter18createAndSaveCrashEi+0x6da) [0x563bb15bfdba]
		CrashReporter::createAndSaveCrash(int)
		??:?
	#2 | Hyprland(_Z25handleUnrecoverableSignali+0x41) [0x563bb15339d1]
		handleUnrecoverableSignal(int)
		??:?
	#3 | /usr/lib/libc.so.6(+0x40770) [0x7f4cfb96c770]
		??
		??:0
	#4 | /home/user/.local/share/hyprpm/dwindle-autogroup/dwindle-autogroup.so(_Z14newCreateGroupP7CWindow+0x159) [0x7f4ca6639174]
		__static_initialization_and_destruction_0()
		Windows.cpp:?
	#5 | Hyprland(_ZN15CKeybindManager11toggleGroupENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x45) [0x563bb1672645]
		CKeybindManager::toggleGroup(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)
		??:?
	#6 | Hyprland(_ZNSt17_Function_handlerIFvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEPS6_E9_M_invokeERKSt9_Any_dataOS5_+0x5f) [0x563bb168431f]
		std::_Function_handler<void (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >), void (*)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)>::_M_invoke(std::_Any_data const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)
		??:?
	#7 | Hyprland(_ZN15CKeybindManager14handleKeybindsEjRK19SPressedKeyWithModsb+0x75e) [0x563bb167f2de]
		CKeybindManager::handleKeybinds(unsigned int, SPressedKeyWithMods const&, bool)
		??:?
	#8 | Hyprland(_ZN15CKeybindManager10onKeyEventEP22wlr_keyboard_key_eventP9SKeyboard+0x6f0) [0x563bb16816e0]
		CKeybindManager::onKeyEvent(wlr_keyboard_key_event*, SKeyboard*)
		??:?
	#9 | Hyprland(_ZN13CInputManager13onKeyboardKeyEP22wlr_keyboard_key_eventP9SKeyboard+0x25c) [0x563bb169feec]
		CInputManager::onKeyboardKey(wlr_keyboard_key_event*, SKeyboard*)
		??:?
	#10 | Hyprland(_Z13handleWrappedP11wl_listenerPv+0x57) [0x563bb163d957]
		handleWrapped(wl_listener*, void*)
		??:?
	#11 | /usr/lib/libwayland-server.so.0(wl_signal_emit_mutable+0x7e) [0x7f4cfc56601e]
		??
		??:0
	#12 | /home/user/projects/tools/Hyprland/subprojects/wlroots/build/libwlroots.so.13032(wlr_keyboard_notify_key+0x20) [0x7f4cfc639480]
		CPopup::onUnmap() [clone .cold]
		Popup.cpp:?
	#13 | /home/user/projects/tools/Hyprland/subprojects/wlroots/build/libwlroots.so.13032(+0x52479) [0x7f4cfc601479]
		??
		??:0
	#14 | /home/user/projects/tools/Hyprland/subprojects/wlroots/build/libwlroots.so.13032(+0x5158b) [0x7f4cfc60058b]
		??
		??:0
	#15 | /usr/lib/libwayland-server.so.0(wl_event_loop_dispatch+0xa2) [0x7f4cfc567ae2]
		??
		??:0
	#16 | /usr/lib/libwayland-server.so.0(wl_display_run+0x27) [0x7f4cfc5682d7]
		??
		??:0
	#17 | Hyprland(_ZN11CCompositor15startCompositorEv+0x695) [0x563bb15479e5]
		CCompositor::startCompositor()
		??:?
	#18 | Hyprland(main+0x7b5) [0x563bb151e7c5]
		main
		??:?
	#19 | /usr/lib/libc.so.6(+0x29cd0) [0x7f4cfb955cd0]
		??
		??:0
	#20 | /usr/lib/libc.so.6(__libc_start_main+0x8a) [0x7f4cfb955d8a]
		??
		??:0
	#21 | Hyprland(_start+0x25) [0x563bb1533875]
		_start
		??:?


Log tail:
[LOG] Registered signal for owner 563bb4120cf0: 563bb3f498d8 -> 563bb4120d70 (owner: textInput)
[LOG] Registered signal for owner 563bb4120cf0: 563bb3f498e8 -> 563bb4120e40 (owner: textInput)
[LOG] New XDG Toplevel created. (class: null)
[LOG] Registered signal for owner 563bb4d0f310: 563bb3f74598 -> 563bb4d0f378 (owner: XDG Window)
[LOG] Registered signal for owner 563bb4d0f310: 563bb3f91088 -> 563bb4d0f448 (owner: XDG Window)
[LOG] Registered signal for owner 563bb4d0f310: 563bb3f74588 -> 563bb4d0f310 (owner: XDG Window)
[types/xdg_shell/wlr_xdg_surface.c:169] A configure is scheduled for an uninitialized xdg_surface 0x563bb3f90fe0
[LOG] Searching for matching rules for kitty (title: kitty)
[LOG] Layout predicts size [Vector2D: x: 1920, y: 1080] for [Window 563bb4d0f310: title: ""]
[LOG] Registered signal for owner 563bb4d0f310: 563bb41e61e0 -> 563bb4d0f8c0 (owner: Toplevel)
[LOG] Registered signal for owner 563bb4d0f310: 563bb41e61f0 -> 563bb4d0f928 (owner: Toplevel)
[LOG] Registered signal for owner 563bb4d0f310: 563bb41e6200 -> 563bb4d0f858 (owner: Toplevel)
[LOG] Registered signal for owner 563bb4d0fb30: 563bb3f745c8 -> 563bb4d0fb78 (owner: CWLSurface)
[LOG] Registered signal for owner 563bb4d0fb30: 563bb3f74588 -> 563bb4d0fbe0 (owner: CWLSurface)
[LOG] CWLSurface 563bb4d0fb30 called init()
[LOG] Registered signal for owner 563bb4d0f310: 563bb3f745a8 -> 563bb4d0f3e0 (owner: CWindow)
[LOG] Registered signal for owner 563bb3cb7cf0: 563bb3f745b8 -> 563bb3cb7dc0 (owner: CSubsurface Head)
[LOG] Registered signal for owner 563bb42bcd00: 563bb3f910a8 -> 563bb42bce80 (owner: CPopup Head)
[LOG] Searching for matching rules for kitty (title: zsh)
[LOG] OPENINGON: [Node nullptr], Monitor: 2
[LOG] Set keyboard focus to surface 563bb3f742b0, with [Window 563bb4d0f310: title: "zsh"]
[LOG] Searching for matching rules for kitty (title: zsh)
[LOG] [hookSystem] New hook event registered: activeWindow
[LOG] Registered signal for owner 563bb4d0f310: 563bb3e8d678 -> 563bb4d0f4b0 (owner: XDG Window Late)
[LOG] Registered signal for owner 563bb4d0f310: 563bb3e8d608 -> 563bb4d0f6b8 (owner: XDG Window Late)
[LOG] Registered signal for owner 563bb4d0f310: 563bb3e8d628 -> 563bb4d0f650 (owner: XDG Window Late)
[LOG] Registered signal for owner 563bb4d0f310: 563bb3e8d638 -> 563bb4d0f5e8 (owner: XDG Window Late)
[LOG] Registered signal for owner 563bb4d0f310: 563bb3e8d648 -> 563bb4d0f720 (owner: XDG Window Late)
[LOG] Registered signal for owner 563bb4d0f310: 563bb3e8d618 -> 563bb4d0f580 (owner: XDG Window Late)
[LOG] Registered signal for owner 563bb4d0f310: 563bb3f910c8 -> 563bb4d0fac8 (owner: XDG Window Late)
[LOG] Map request dispatched, monitor DP-4, window pos: [1.00000, 39.00000], window size: [1918.00000, 1040.00000]
[LOG] Searching for matching rules for kitty (title: zsh)
[LOG] Framebuffer created, status 36053
[LOG] cursorImage request: surface 563bb3f73ec0
[LOG] Registered signal for owner 563bb38edfc8: 563bb3f741d8 -> 563bb38ee010 (owner: CWLSurface)
[LOG] Registered signal for owner 563bb38edfc8: 563bb3f74198 -> 563bb38ee078 (owner: CWLSurface)
[LOG] CWLSurface 563bb38edfc8 called init()
[LOG] cursorImage request: surface 563bb3f73ec0
[LOG] cursorImage request: surface 563bb3f73ec0
[LOG] Keybind triggered, calling dispatcher (64, , 116)
[LOG] Searching for matching rules for kitty (title: zsh)
[LOG] [hookSystem] New hook event registered: changeFloatingMode
[LOG] Removing last node (dwindle)
[LOG] cursorImage request: surface 563bb3f73ec0
[LOG] cursorImage request: surface 563bb3f73ec0
[LOG] [hookSystem] New hook event registered: windowTitle
[LOG] Searching for matching rules for kitty (title: ~)
[LOG] Window 563bb4d0f310 set title to ~
[LOG] Searching for matching rules for kitty (title: user@SG-Manjaro:~)
[LOG] Window 563bb4d0f310 set title to user@SG-Manjaro:~
[LOG] Keybind triggered, calling dispatcher (64, , 103)
[LOG] Scanout mode OFF set for [Window 563bb4d0f310: title: "user@SG-Manjaro:~"]
[LOG] [dwindle-autogroup] Triggered createGroup for 563bb4d0f310
[LOG] [dwindle-autogroup] Collecting dwindle child nodes

Welp latest commit kills hyprland

After the latest commit (49b4591) , the plugin is causing Hyprland v0.30.0 to crash with the following error logs:

Error Logs:

https://paste.rs/g3B9L
https://paste.rs/qEqBt
https://paste.rs/LOwKI
coredump

Steps to Reproduce:

To reproduce the issue, follow these steps:

  • Use the latest version of Hyprland (v0.30.0).
  • Enable the plugin.
  • Use the toggle group dispatcher on a single client.

Expected Behavior:

The plugin should work as expected and not cause any errors or crashes in Hyprland.

Actual Behavior:

After enabling the plugin and using the toggle group dispatcher on a single client, it triggers the mentioned error logs and crashes the Compositor.

On Hyprland version: 0.30.0

Weird ungroupping beahvior

While the groupping does work and automatically moves child nodes into a group, ungroupping seems to be pretty chaotic, and on group dissolve, the windows are all over the place, messing up the rest of the layout.

This is the default ungroupping beahvior currently present in hyprland, it would be worth it to change this to the original behavior too, for consistency and to prevent group dissolving to mess up the rest of your layout.

wf-recorder-video-ARjTR.mp4

welp the plugin is broken again

In the latest 0.29.1 update in arch , I cant compile the plugin.

these are the error logs

g++ -shared -g -fPIC --no-gnu-unique -std=c++23 `pkg-config --cflags pixman-1 libdrm hyprland` -Iinclude -DWLR_USE_UNSTABLE src/main.cpp -o dwindle-autogroup.so
In file included from /usr/local/include/hyprland/src/defines.hpp:1,
                 from /usr/local/include/hyprland/src/Window.hpp:3,
                 from src/main.cpp:3:
/usr/local/include/hyprland/src/includes.hpp:149:10: fatal error: ext-workspace-unstable-v1-protocol.h: No such file or directory
  149 | #include "ext-workspace-unstable-v1-protocol.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:26: all] Error 1

[Feature request] add support for hyprpm

In the git branch hyprpm is a new method of installing plugins in hyprland
Currently installing this plugin with hyprpm is not possible as it gives an error in manifest issue.Would be great if this plugin had support for hyprpm

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.