windowrules: allow incrementing window props (#9566)

This commit is contained in:
MightyPlaza 2025-04-15 23:00:40 +00:00 committed by GitHub
parent 8b7b169043
commit ffd6cf65e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 191 additions and 102 deletions

View file

@ -4,6 +4,7 @@
#include "PointerManager.hpp"
#include "../xwayland/XWayland.hpp"
#include "../managers/HookSystemManager.hpp"
#include "../helpers/Monitor.hpp"
static int cursorAnimTimer(SP<CEventLoopTimer> self, void* data) {
const auto cursorMgr = reinterpret_cast<CCursorManager*>(data);

View file

@ -18,6 +18,7 @@
#include "../managers/EventManager.hpp"
#include "../render/Renderer.hpp"
#include "../hyprerror/HyprError.hpp"
#include "../config/ConfigManager.hpp"
#include <optional>
#include <iterator>
@ -3221,7 +3222,7 @@ SDispatchResult CKeybindManager::setProp(std::string args) {
} else if (auto search = NWindowProperties::boolWindowProperties.find(PROP); search != NWindowProperties::boolWindowProperties.end()) {
auto pWindowDataElement = search->second(PWINDOW);
if (VAL == "toggle")
*pWindowDataElement = CWindowOverridableVar(!pWindowDataElement->valueOrDefault(), PRIORITY_SET_PROP);
pWindowDataElement->increment(true, PRIORITY_SET_PROP);
else if (VAL == "unset")
pWindowDataElement->unset(PRIORITY_SET_PROP);
else
@ -3229,12 +3230,18 @@ SDispatchResult CKeybindManager::setProp(std::string args) {
} else if (auto search = NWindowProperties::intWindowProperties.find(PROP); search != NWindowProperties::intWindowProperties.end()) {
if (VAL == "unset")
search->second(PWINDOW)->unset(PRIORITY_SET_PROP);
else if (const auto V = configStringToInt(VAL); V)
*(search->second(PWINDOW)) = CWindowOverridableVar((int)*V, PRIORITY_SET_PROP);
else if (VAL.starts_with("relative")) {
const Hyprlang::INT V = std::stoi(VAL.substr(VAL.find(' ')));
search->second(PWINDOW)->increment(V, PRIORITY_SET_PROP);
} else if (const auto V = configStringToInt(VAL); V)
*(search->second(PWINDOW)) = CWindowOverridableVar((Hyprlang::INT)*V, PRIORITY_SET_PROP);
} else if (auto search = NWindowProperties::floatWindowProperties.find(PROP); search != NWindowProperties::floatWindowProperties.end()) {
if (VAL == "unset")
search->second(PWINDOW)->unset(PRIORITY_SET_PROP);
else {
else if (VAL.starts_with("relative")) {
const auto V = std::stof(VAL.substr(VAL.find(' ')));
search->second(PWINDOW)->increment(V, PRIORITY_SET_PROP);
} else {
const auto V = std::stof(VAL);
*(search->second(PWINDOW)) = CWindowOverridableVar(V, PRIORITY_SET_PROP);
}

View file

@ -1,6 +1,7 @@
#include "PointerManager.hpp"
#include "../Compositor.hpp"
#include "../config/ConfigValue.hpp"
#include "../config/ConfigManager.hpp"
#include "../protocols/PointerGestures.hpp"
#include "../protocols/RelativePointer.hpp"
#include "../protocols/FractionalScale.hpp"

View file

@ -2,6 +2,7 @@
#include "../Compositor.hpp"
#include "../events/Events.hpp"
#include "../config/ConfigValue.hpp"
#include "../helpers/Monitor.hpp"
#include "../protocols/XDGShell.hpp"
#include "../protocols/core/Compositor.hpp"
#include "../xwayland/XWayland.hpp"

View file

@ -4,6 +4,7 @@
#include <cstdint>
#include <ranges>
#include "../../config/ConfigValue.hpp"
#include "../../config/ConfigManager.hpp"
#include "../../desktop/Window.hpp"
#include "../../desktop/LayerSurface.hpp"
#include "../../protocols/CursorShape.hpp"

View file

@ -4,6 +4,7 @@
#include "../../Compositor.hpp"
#include "../../desktop/LayerSurface.hpp"
#include "../../config/ConfigValue.hpp"
#include "../../helpers/Monitor.hpp"
#include "../../devices/ITouch.hpp"
#include "../SeatManager.hpp"
#include "managers/AnimationManager.hpp"