From d9657a95cb6706860332ff47dad444a96bcc874a Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Thu, 4 Dec 2025 17:59:47 +0000 Subject: hyprctl: use new hyprpaper ipc format (#12537) --------- Co-authored-by: Mihai Fufezan --- hyprctl/CMakeLists.txt | 25 +- hyprctl/Strings.hpp | 186 ----------- hyprctl/hw-protocols/hyprpaper_core.xml | 144 +++++++++ hyprctl/main.cpp | 539 -------------------------------- hyprctl/src/Strings.hpp | 183 +++++++++++ hyprctl/src/helpers/Memory.hpp | 11 + hyprctl/src/hyprpaper/Hyprpaper.cpp | 148 +++++++++ hyprctl/src/hyprpaper/Hyprpaper.hpp | 8 + hyprctl/src/main.cpp | 539 ++++++++++++++++++++++++++++++++ 9 files changed, 1056 insertions(+), 727 deletions(-) delete mode 100644 hyprctl/Strings.hpp create mode 100644 hyprctl/hw-protocols/hyprpaper_core.xml delete mode 100644 hyprctl/main.cpp create mode 100644 hyprctl/src/Strings.hpp create mode 100644 hyprctl/src/helpers/Memory.hpp create mode 100644 hyprctl/src/hyprpaper/Hyprpaper.cpp create mode 100644 hyprctl/src/hyprpaper/Hyprpaper.hpp create mode 100644 hyprctl/src/main.cpp (limited to 'hyprctl') diff --git a/hyprctl/CMakeLists.txt b/hyprctl/CMakeLists.txt index db5ef615..7071ede9 100644 --- a/hyprctl/CMakeLists.txt +++ b/hyprctl/CMakeLists.txt @@ -5,11 +5,32 @@ project( DESCRIPTION "Control utility for Hyprland" ) -pkg_check_modules(hyprctl_deps REQUIRED IMPORTED_TARGET hyprutils>=0.2.4 re2) +pkg_check_modules(hyprctl_deps REQUIRED IMPORTED_TARGET hyprutils>=0.2.4 hyprwire re2) -add_executable(hyprctl "main.cpp") +file(GLOB_RECURSE HYPRCTL_SRCFILES CONFIGURE_DEPENDS "src/*.cpp" "hw-protocols/*.cpp" "include/*.hpp") + +add_executable(hyprctl ${HYPRCTL_SRCFILES}) target_link_libraries(hyprctl PUBLIC PkgConfig::hyprctl_deps) +target_include_directories(hyprctl PRIVATE "hw-protocols") + +# Hyprwire + +function(hyprprotocol protoPath protoName) + set(path ${CMAKE_CURRENT_SOURCE_DIR}/${protoPath}) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/hw-protocols/${protoName}-client.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/hw-protocols/${protoName}-client.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/hw-protocols/${protoName}-spec.hpp + COMMAND hyprwire-scanner --client ${path}/${protoName}.xml + ${CMAKE_CURRENT_SOURCE_DIR}/hw-protocols/ + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + target_sources(hyprctl PRIVATE hw-protocols/${protoName}-client.cpp + hw-protocols/${protoName}-client.hpp + hw-protocols/${protoName}-spec.hpp) +endfunction() + +hyprprotocol(hw-protocols hyprpaper_core) # binary install(TARGETS hyprctl) diff --git a/hyprctl/Strings.hpp b/hyprctl/Strings.hpp deleted file mode 100644 index 67e4f992..00000000 --- a/hyprctl/Strings.hpp +++ /dev/null @@ -1,186 +0,0 @@ -#pragma once - -#include - -const std::string_view USAGE = R"#(usage: hyprctl [flags] [args...|--help] - -commands: - activewindow → Gets the active window name and its properties - activeworkspace → Gets the active workspace and its properties - animations → Gets the current config'd info about animations - and beziers - binds → Lists all registered binds - clients → Lists all windows with their properties - configerrors → Lists all current config parsing errors - cursorpos → Gets the current cursor position in global layout - coordinates - decorations → Lists all decorations and their info - devices → Lists all connected keyboards and mice - dismissnotify [amount] → Dismisses all or up to AMOUNT notifications - dispatch [args] → Issue a dispatch to call a keybind - dispatcher with arguments - getoption