forked from quickshell/quickshell
		
	all: import module dependencies via qmldir
Improves compatibility with qml tooling.
This commit is contained in:
		
							parent
							
								
									0519acf1d6
								
							
						
					
					
						commit
						569c40494d
					
				
					 7 changed files with 23 additions and 66 deletions
				
			
		| 
						 | 
					@ -51,16 +51,19 @@ endfunction()
 | 
				
			||||||
# -----
 | 
					# -----
 | 
				
			||||||
 | 
					
 | 
				
			||||||
qt_add_library(quickshell-wayland STATIC)
 | 
					qt_add_library(quickshell-wayland STATIC)
 | 
				
			||||||
qt_add_qml_module(quickshell-wayland URI Quickshell.Wayland VERSION 0.1)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# required to make sure the constructor is linked
 | 
					# required to make sure the constructor is linked
 | 
				
			||||||
add_library(quickshell-wayland-init OBJECT init.cpp)
 | 
					add_library(quickshell-wayland-init OBJECT init.cpp)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					set(WAYLAND_MODULES)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if (WAYLAND_WLR_LAYERSHELL)
 | 
					if (WAYLAND_WLR_LAYERSHELL)
 | 
				
			||||||
	target_sources(quickshell-wayland PRIVATE wlr_layershell.cpp)
 | 
						target_sources(quickshell-wayland PRIVATE wlr_layershell.cpp)
 | 
				
			||||||
	add_subdirectory(wlr_layershell)
 | 
						add_subdirectory(wlr_layershell)
 | 
				
			||||||
	target_compile_definitions(quickshell-wayland PRIVATE QS_WAYLAND_WLR_LAYERSHELL)
 | 
						target_compile_definitions(quickshell-wayland PRIVATE QS_WAYLAND_WLR_LAYERSHELL)
 | 
				
			||||||
	target_compile_definitions(quickshell-wayland-init PRIVATE QS_WAYLAND_WLR_LAYERSHELL)
 | 
						target_compile_definitions(quickshell-wayland-init PRIVATE QS_WAYLAND_WLR_LAYERSHELL)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						list(APPEND WAYLAND_MODULES Quickshell.Wayland._WlrLayerShell)
 | 
				
			||||||
endif()
 | 
					endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if (WAYLAND_SESSION_LOCK)
 | 
					if (WAYLAND_SESSION_LOCK)
 | 
				
			||||||
| 
						 | 
					@ -75,6 +78,12 @@ endif()
 | 
				
			||||||
target_link_libraries(quickshell-wayland PRIVATE ${QT_DEPS})
 | 
					target_link_libraries(quickshell-wayland PRIVATE ${QT_DEPS})
 | 
				
			||||||
target_link_libraries(quickshell-wayland-init PRIVATE ${QT_DEPS})
 | 
					target_link_libraries(quickshell-wayland-init PRIVATE ${QT_DEPS})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					qt_add_qml_module(quickshell-wayland
 | 
				
			||||||
 | 
						URI Quickshell.Wayland
 | 
				
			||||||
 | 
						VERSION 0.1
 | 
				
			||||||
 | 
						IMPORTS ${WAYLAND_MODULES}
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
qs_pch(quickshell-wayland)
 | 
					qs_pch(quickshell-wayland)
 | 
				
			||||||
qs_pch(quickshell-waylandplugin)
 | 
					qs_pch(quickshell-waylandplugin)
 | 
				
			||||||
qs_pch(quickshell-wayland-init)
 | 
					qs_pch(quickshell-wayland-init)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,15 +1,24 @@
 | 
				
			||||||
qt_add_library(quickshell-hyprland STATIC)
 | 
					qt_add_library(quickshell-hyprland STATIC)
 | 
				
			||||||
qt_add_qml_module(quickshell-hyprland URI Quickshell.Hyprland VERSION 0.1)
 | 
					
 | 
				
			||||||
 | 
					target_link_libraries(quickshell-hyprland PRIVATE ${QT_DEPS})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					set(HYPRLAND_MODULES)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if (HYPRLAND_FOCUS_GRAB)
 | 
					if (HYPRLAND_FOCUS_GRAB)
 | 
				
			||||||
	add_subdirectory(focus_grab)
 | 
						add_subdirectory(focus_grab)
 | 
				
			||||||
 | 
						list(APPEND HYPRLAND_MODULES Quickshell.Hyprland._FocusGrab)
 | 
				
			||||||
endif()
 | 
					endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if (HYPRLAND_GLOBAL_SHORTCUTS)
 | 
					if (HYPRLAND_GLOBAL_SHORTCUTS)
 | 
				
			||||||
	add_subdirectory(global_shortcuts)
 | 
						add_subdirectory(global_shortcuts)
 | 
				
			||||||
 | 
						list(APPEND HYPRLAND_MODULES Quickshell.Hyprland._GlobalShortcuts)
 | 
				
			||||||
endif()
 | 
					endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
target_link_libraries(quickshell-hyprland PRIVATE ${QT_DEPS})
 | 
					qt_add_qml_module(quickshell-hyprland
 | 
				
			||||||
 | 
						URI Quickshell.Hyprland
 | 
				
			||||||
 | 
						VERSION 0.1
 | 
				
			||||||
 | 
						IMPORTS ${HYPRLAND_MODULES}
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
qs_pch(quickshell-hyprland)
 | 
					qs_pch(quickshell-hyprland)
 | 
				
			||||||
qs_pch(quickshell-hyprlandplugin)
 | 
					qs_pch(quickshell-hyprlandplugin)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,21 +9,14 @@ qt_add_qml_module(quickshell-hyprland-focus-grab
 | 
				
			||||||
	VERSION 0.1
 | 
						VERSION 0.1
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
add_library(quickshell-hyprland-focus-grab-init OBJECT init.cpp)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
wl_proto(quickshell-hyprland-focus-grab
 | 
					wl_proto(quickshell-hyprland-focus-grab
 | 
				
			||||||
	hyprland-focus-grab-v1
 | 
						hyprland-focus-grab-v1
 | 
				
			||||||
	"${CMAKE_CURRENT_SOURCE_DIR}/hyprland-focus-grab-v1.xml"
 | 
						"${CMAKE_CURRENT_SOURCE_DIR}/hyprland-focus-grab-v1.xml"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
target_link_libraries(quickshell-hyprland-focus-grab PRIVATE ${QT_DEPS} wayland-client)
 | 
					target_link_libraries(quickshell-hyprland-focus-grab PRIVATE ${QT_DEPS} wayland-client)
 | 
				
			||||||
target_link_libraries(quickshell-hyprland-focus-grab-init PRIVATE ${QT_DEPS})
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
qs_pch(quickshell-hyprland-focus-grab)
 | 
					qs_pch(quickshell-hyprland-focus-grab)
 | 
				
			||||||
qs_pch(quickshell-hyprland-focus-grabplugin)
 | 
					qs_pch(quickshell-hyprland-focus-grabplugin)
 | 
				
			||||||
qs_pch(quickshell-hyprland-focus-grab-init)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
target_link_libraries(quickshell PRIVATE
 | 
					target_link_libraries(quickshell PRIVATE quickshell-hyprland-focus-grabplugin)
 | 
				
			||||||
	quickshell-hyprland-focus-grabplugin
 | 
					 | 
				
			||||||
	quickshell-hyprland-focus-grab-init
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,20 +0,0 @@
 | 
				
			||||||
#include <qqml.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "../../../core/plugin.hpp"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class HyprlandFocusGrabPlugin: public QuickshellPlugin {
 | 
					 | 
				
			||||||
	void registerTypes() override {
 | 
					 | 
				
			||||||
		qmlRegisterModuleImport(
 | 
					 | 
				
			||||||
		    "Quickshell.Hyprland",
 | 
					 | 
				
			||||||
		    QQmlModuleImportModuleAny,
 | 
					 | 
				
			||||||
		    "Quickshell.Hyprland._FocusGrab",
 | 
					 | 
				
			||||||
		    QQmlModuleImportLatest
 | 
					 | 
				
			||||||
		);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
QS_REGISTER_PLUGIN(HyprlandFocusGrabPlugin);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
} // namespace
 | 
					 | 
				
			||||||
| 
						 | 
					@ -9,21 +9,14 @@ qt_add_qml_module(quickshell-hyprland-global-shortcuts
 | 
				
			||||||
	VERSION 0.1
 | 
						VERSION 0.1
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
add_library(quickshell-hyprland-global-shortcuts-init OBJECT init.cpp)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
wl_proto(quickshell-hyprland-global-shortcuts
 | 
					wl_proto(quickshell-hyprland-global-shortcuts
 | 
				
			||||||
	hyprland-global-shortcuts-v1
 | 
						hyprland-global-shortcuts-v1
 | 
				
			||||||
	"${CMAKE_CURRENT_SOURCE_DIR}/hyprland-global-shortcuts-v1.xml"
 | 
						"${CMAKE_CURRENT_SOURCE_DIR}/hyprland-global-shortcuts-v1.xml"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
target_link_libraries(quickshell-hyprland-global-shortcuts PRIVATE ${QT_DEPS} wayland-client)
 | 
					target_link_libraries(quickshell-hyprland-global-shortcuts PRIVATE ${QT_DEPS} wayland-client)
 | 
				
			||||||
target_link_libraries(quickshell-hyprland-global-shortcuts-init PRIVATE ${QT_DEPS})
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
qs_pch(quickshell-hyprland-global-shortcuts)
 | 
					qs_pch(quickshell-hyprland-global-shortcuts)
 | 
				
			||||||
qs_pch(quickshell-hyprland-global-shortcutsplugin)
 | 
					qs_pch(quickshell-hyprland-global-shortcutsplugin)
 | 
				
			||||||
qs_pch(quickshell-hyprland-global-shortcuts-init)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
target_link_libraries(quickshell PRIVATE
 | 
					target_link_libraries(quickshell PRIVATE quickshell-hyprland-global-shortcutsplugin)
 | 
				
			||||||
	quickshell-hyprland-global-shortcutsplugin
 | 
					 | 
				
			||||||
	quickshell-hyprland-global-shortcuts-init
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,20 +0,0 @@
 | 
				
			||||||
#include <qqml.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "../../../core/plugin.hpp"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class HyprlandFocusGrabPlugin: public QuickshellPlugin {
 | 
					 | 
				
			||||||
	void registerTypes() override {
 | 
					 | 
				
			||||||
		qmlRegisterModuleImport(
 | 
					 | 
				
			||||||
		    "Quickshell.Hyprland",
 | 
					 | 
				
			||||||
		    QQmlModuleImportModuleAny,
 | 
					 | 
				
			||||||
		    "Quickshell.Hyprland._GlobalShortcuts",
 | 
					 | 
				
			||||||
		    QQmlModuleImportLatest
 | 
					 | 
				
			||||||
		);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
QS_REGISTER_PLUGIN(HyprlandFocusGrabPlugin);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
} // namespace
 | 
					 | 
				
			||||||
| 
						 | 
					@ -34,13 +34,6 @@ class WaylandPlugin: public QuickshellPlugin {
 | 
				
			||||||
		// will not be registered. This can be worked around with a module import which makes
 | 
							// will not be registered. This can be worked around with a module import which makes
 | 
				
			||||||
		// the QML_ELMENT module import the old register-type style module.
 | 
							// the QML_ELMENT module import the old register-type style module.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		qmlRegisterModuleImport(
 | 
					 | 
				
			||||||
		    "Quickshell.Wayland",
 | 
					 | 
				
			||||||
		    QQmlModuleImportModuleAny,
 | 
					 | 
				
			||||||
		    "Quickshell.Wayland._WlrLayerShell",
 | 
					 | 
				
			||||||
		    QQmlModuleImportLatest
 | 
					 | 
				
			||||||
		);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		qmlRegisterModuleImport(
 | 
							qmlRegisterModuleImport(
 | 
				
			||||||
		    "Quickshell",
 | 
							    "Quickshell",
 | 
				
			||||||
		    QQmlModuleImportModuleAny,
 | 
							    QQmlModuleImportModuleAny,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue