Skip to content

Commit 4e5aaed

Browse files
committed
fix(hot-corners): make them trigger reliably (overlay layer + absolute positioned)
1 parent 136e1db commit 4e5aaed

4 files changed

Lines changed: 27 additions & 10 deletions

File tree

src/app/application_ui.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -686,8 +686,6 @@ void Application::initNotificationAndOsd() {
686686
);
687687
m_screenCorners.initialize(m_wayland, &m_configService, &m_renderContext);
688688
m_screenCorners.onConfigReload();
689-
m_hotCorners.initialize(m_wayland, &m_configService, &m_renderContext);
690-
m_hotCorners.onConfigReload();
691689
}
692690

693691
void Application::initBarDockAndLayout() {
@@ -933,4 +931,10 @@ void Application::initWidgetControllersAndCallbacks() {
933931
}
934932
});
935933
}
934+
935+
// Created last so the corner trigger surfaces stack above the bar and dock on
936+
// their shared Overlay layer; same ordering is preserved on hot reload in
937+
// initWaylandCallbacks (bar/dock onOutputChange run before hot corners').
938+
m_hotCorners.initialize(m_wayland, &m_configService, &m_renderContext);
939+
m_hotCorners.onConfigReload();
936940
}

src/config/config_types.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1371,7 +1371,6 @@ struct PluginsConfig {
13711371
[[nodiscard]] bool isValidPluginSourceName(std::string_view name);
13721372
struct HotCornersConfig {
13731373
bool enabled = false;
1374-
std::int32_t delayMs = 150;
13751374

13761375
struct Corner {
13771376
std::string action = "none";

src/config/schema/config_schema.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,6 @@ namespace noctalia::config::schema {
434434
};
435435
static const Schema<HotCornersConfig> s = {
436436
field(&HotCornersConfig::enabled, "enabled"),
437-
field(&HotCornersConfig::delayMs, "delay_ms"),
438437
subTable(&HotCornersConfig::topLeft, "top_left", cornerSchema),
439438
subTable(&HotCornersConfig::topRight, "top_right", cornerSchema),
440439
subTable(&HotCornersConfig::bottomLeft, "bottom_left", cornerSchema),

src/shell/hot_corners/hot_corners.cpp

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55
#include "render/scene/input_area.h"
66
#include "wayland/wayland_connection.h"
77

8+
#include <cstdint>
9+
10+
namespace {
11+
// Edge length (logical px) of each corner trigger surface. The cursor pins to the
12+
// exact corner pixel on a flick, so a tiny zone suffices; keep it minimal to
13+
// barely intercept pointer input over surfaces beneath it.
14+
constexpr std::int32_t kTriggerZoneSize = 2;
15+
} // namespace
16+
817
HotCorners::HotCorners(Application* app) : m_app(app) {}
918

1019
HotCorners::~HotCorners() { destroySurfaces(); }
@@ -71,7 +80,12 @@ void HotCorners::triggerAction(const std::string& action, const std::string& com
7180
}
7281

7382
void HotCorners::buildCorner(Corner& corner, int position, wl_output* output) {
74-
LayerShellLayer layer = LayerShellLayer::Bottom;
83+
// Overlay layer (topmost) + created after the bar/dock so the trigger zone is
84+
// never occluded by shell chrome in the corner (a Top-layer bar would otherwise
85+
// swallow the pointer). Transient surfaces opened later (panels, popups, the
86+
// lock screen) are created after these and still stack above them.
87+
const LayerShellLayer layer = LayerShellLayer::Overlay;
88+
constexpr std::int32_t size = kTriggerZoneSize;
7589

7690
std::uint32_t anchor = 0;
7791
std::string cornerKey;
@@ -93,18 +107,19 @@ void HotCorners::buildCorner(Corner& corner, int position, wl_output* output) {
93107
.nameSpace = "hot_corner_" + cornerKey,
94108
.layer = layer,
95109
.anchor = anchor,
96-
.width = 1,
97-
.height = 1,
98-
.exclusiveZone = 0,
110+
.width = static_cast<std::uint32_t>(size),
111+
.height = static_cast<std::uint32_t>(size),
112+
// -1: ignore other surfaces' exclusive zones so the corner anchors to the
113+
// absolute screen edge instead of being pushed inward by the bar's zone.
114+
.exclusiveZone = -1,
99115
};
100116

101117
corner.surface = std::make_unique<LayerSurface>(*m_wayland, surfaceConfig);
102118
corner.surface->initialize(output);
103119

104120
auto inputArea = std::make_unique<InputArea>();
105-
// 1x1 region
106121
inputArea->setPosition(0, 0);
107-
inputArea->setSize(1, 1);
122+
inputArea->setSize(static_cast<float>(size), static_cast<float>(size));
108123
inputArea->setOnEnter([this, position, output](const InputArea::PointerData&) {
109124
const auto& config = m_config->config().hotCorners;
110125
std::string action;

0 commit comments

Comments
 (0)