Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
IScrollSettings.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 fuddlesworth
2// SPDX-License-Identifier: LGPL-2.1-or-later
3
4#pragma once
5
6#include <QObject>
7#include <QStringList>
8
9namespace PhosphorEngine {
10
18{
19public:
20 virtual ~IScrollSettings() = default;
21
22 virtual int scrollingInnerGap() const = 0;
23 virtual bool scrollingUsePerSideOuterGap() const = 0;
24 virtual int scrollingOuterGap() const = 0;
25 virtual int scrollingOuterGapTop() const = 0;
26 virtual int scrollingOuterGapBottom() const = 0;
27 virtual int scrollingOuterGapLeft() const = 0;
28 virtual int scrollingOuterGapRight() const = 0;
30 virtual bool scrollingFocusNewWindows() const = 0;
42 virtual bool scrollingGroupSameAppAsTabs() const
43 {
44 return false;
45 }
46
51 virtual int scrollingStickyWindowHandling() const = 0;
59 virtual bool scrollingRespectMinimumSize() const = 0;
65 virtual bool scrollingCenterShortColumns() const
66 {
67 return false;
68 }
69
78 virtual bool scrollingSmartGaps() const = 0;
79
81 virtual int scrollingCenterFocusedColumn() const = 0;
82 virtual bool scrollingAlwaysCenterSingleColumn() const = 0;
86 virtual bool scrollingCropStraddlers() const
87 {
88 return false;
89 }
90
99 virtual int scrollingStripAxis() const
100 {
101 return 0;
102 }
103
111 virtual int scrollingDefaultColumnWidthKind() const = 0;
112 virtual qreal scrollingDefaultColumnWidthValue() const = 0;
118 virtual int scrollingDefaultWindowHeightKind() const = 0;
119 virtual qreal scrollingDefaultWindowHeightValue() const = 0;
123 virtual int scrollingInsertPosition() const = 0;
125 virtual int scrollingDefaultColumnDisplay() const = 0;
126
127 // ── Drag-insert edge auto-scroll (Scrolling.Behavior.DragScroll) ─────
128 //
129 // niri's dnd-edge-view-scroll: holding a dragged window near either
130 // screen edge scrolls the strip so an off-screen column can be reached.
131 // DEFAULTED, not pure, like scrollingCropStraddlers — niri's own
132 // defaults are the right answer for every implementor that has not
133 // heard of the option, the test stubs included.
134
135 // niri's four figures, named so the defaulted bodies below and
136 // ScrollEngine's pre-refresh member cache read the SAME constants rather
137 // than three hand-copied sets. src/config/settings/scrolling.cpp
138 // static_asserts ConfigDefaults against these, which is what keeps the
139 // config layer and the engine layer agreeing.
140 static constexpr bool kDragScrollEnabledDefault = true;
141 static constexpr int kDragScrollTriggerWidthDefault = 30;
142 static constexpr int kDragScrollDelayMsDefault = 100;
143 static constexpr int kDragScrollMaxSpeedDefault = 1500;
147 static constexpr int kDragScrollMaxSpeedCeiling = 10000;
148
151 virtual bool scrollingDragScrollEnabled() const
152 {
154 }
155
162 {
164 }
165
167 virtual int scrollingDragScrollDelayMs() const
168 {
170 }
171
173 virtual int scrollingDragScrollMaxSpeed() const
174 {
176 }
177
182 virtual QStringList scrollingPresetColumnWidths() const = 0;
183 virtual QStringList scrollingPresetWindowHeights() const = 0;
184
185 // ── Tab indicator geometry (Scrolling.TabIndicator) ──────────────────
186 //
187 // Only the subset that changes resolved rects lives here; it lands in
188 // ScrollLayoutParams::tabIndicator (TabIndicatorParams, ScrollTypes.h,
189 // where each field is documented in full). The indicator's PAINT settings
190 // — style, gaps between tabs, corner radius, the three colours and the
191 // five label-font keys (family, weight, italic, underline, strikeout) —
192 // are deliberately absent: they never affect layout, so they go to the
193 // KWin effect, which draws the indicator itself. The global keys travel
194 // over the settings channel the effect pulls; per-screen rule overrides
195 // are pushed by the daemon through
196 // TilingAdaptor::setScrollTabPaintOverrides. Keep that split when adding a
197 // knob, or this library grows a dependency on how the indicator happens to
198 // be drawn.
199
201 virtual bool scrollingTabIndicatorEnabled() const = 0;
207 virtual int scrollingTabIndicatorGap() const = 0;
211 virtual int scrollingTabIndicatorWidth() const = 0;
213 virtual qreal scrollingTabIndicatorLengthProportion() const = 0;
215 virtual int scrollingTabIndicatorPosition() const = 0;
216};
217
218} // namespace PhosphorEngine
219
220Q_DECLARE_INTERFACE(PhosphorEngine::IScrollSettings, "org.phosphor_works.Placement.IScrollSettings")
Settings surface the scrolling engine reads, injected by the daemon via PlacementEngineBase::setEngin...
Definition IScrollSettings.h:18
virtual ~IScrollSettings()=default
virtual int scrollingOuterGap() const =0
virtual int scrollingDefaultColumnWidthKind() const =0
Default width for new columns: kind (0 = proportion, 1 = fixed px, 2 = client decides,...
virtual bool scrollingDragScrollEnabled() const
Master switch.
Definition IScrollSettings.h:151
virtual int scrollingDefaultColumnDisplay() const =0
ColumnDisplay new columns open in (0 = normal, 1 = tabbed).
virtual int scrollingDragScrollTriggerWidth() const
Width of the band inside each work-area edge that arms the scroll, in logical pixels.
Definition IScrollSettings.h:161
virtual int scrollingStripAxis() const
Which way the strip runs: 0 auto (from the work area), 1 horizontal, 2 vertical.
Definition IScrollSettings.h:99
virtual int scrollingDefaultWindowHeightPresetIndex() const =0
virtual int scrollingDefaultColumnWidthPresetIndex() const =0
static constexpr int kDragScrollTriggerWidthDefault
Definition IScrollSettings.h:141
static constexpr int kDragScrollDelayMsDefault
Definition IScrollSettings.h:142
virtual int scrollingOuterGapRight() const =0
virtual int scrollingOuterGapTop() const =0
virtual int scrollingStickyWindowHandling() const =0
StickyWindowHandling as int (0 = treat as normal, 1 = restore only, 2 = ignore all) — the shared Phos...
virtual QStringList scrollingPresetColumnWidths() const =0
Preset proportion lists, serialized as decimal strings.
virtual qreal scrollingDefaultWindowHeightValue() const =0
virtual bool scrollingTabIndicatorHideWhenSingleTab() const =0
Skip the indicator for a tabbed column holding a single tile.
virtual bool scrollingTabIndicatorEnabled() const =0
Master switch. Off, no indicator rect resolves and nothing is reserved.
virtual int scrollingOuterGapBottom() const =0
virtual bool scrollingFocusNewWindows() const =0
Whether newly opened windows take focus (Scrolling.Behavior).
virtual int scrollingTabIndicatorGap() const =0
Gap between indicator and window; NEGATIVE puts it over the window.
virtual bool scrollingRespectMinimumSize() const =0
Whether the strip's layout math honours windows' minimum sizes (column width floor,...
virtual int scrollingInnerGap() const =0
virtual bool scrollingCropStraddlers() const
Crop mode for partial edge columns (see ConfigDefaults).
Definition IScrollSettings.h:86
virtual qreal scrollingTabIndicatorLengthProportion() const =0
Indicator length as a proportion of the column extent beside it.
virtual qreal scrollingDefaultColumnWidthValue() const =0
virtual int scrollingTabIndicatorPosition() const =0
Which column edge the indicator runs along (TabIndicatorPosition).
virtual bool scrollingSmartGaps() const =0
Zero the outer gaps when the strip holds a single column.
virtual bool scrollingAlwaysCenterSingleColumn() const =0
virtual bool scrollingCenterShortColumns() const
Whether a column whose windows do not fill the cross axis is centred on it instead of hugging the sta...
Definition IScrollSettings.h:65
virtual int scrollingDragScrollMaxSpeed() const
Scroll speed at the very edge of the work area, in logical pixels per second.
Definition IScrollSettings.h:173
virtual int scrollingDragScrollDelayMs() const
How long the cursor must sit inside the band before the strip starts moving.
Definition IScrollSettings.h:167
static constexpr int kDragScrollMaxSpeedCeiling
Upper bound the engine enforces on the speed.
Definition IScrollSettings.h:147
virtual int scrollingTabIndicatorWidth() const =0
Indicator thickness.
static constexpr int kDragScrollMaxSpeedDefault
Definition IScrollSettings.h:143
virtual QStringList scrollingPresetWindowHeights() const =0
virtual bool scrollingUsePerSideOuterGap() const =0
virtual int scrollingInsertPosition() const =0
ScrollInsertPosition as int (0 = right of active, 1 = left of active, 2 = first, 3 = last,...
virtual int scrollingOuterGapLeft() const =0
virtual int scrollingDefaultWindowHeightKind() const =0
Default height intent for fresh tiles: kind (0 = auto, 1 = fixed px, 2 = preset index,...
virtual bool scrollingGroupSameAppAsTabs() const
Whether a fresh open joins, as a tab, a column that already holds a window of the same application (S...
Definition IScrollSettings.h:42
virtual int scrollingCenterFocusedColumn() const =0
CenterFocusedColumn as int (0 = never, 1 = always, 2 = on-overflow).
static constexpr bool kDragScrollEnabledDefault
Definition IScrollSettings.h:140
virtual bool scrollingTabIndicatorPlaceWithinColumn() const =0
Reserve the indicator out of the column instead of drawing beside it.
Definition DesktopRemap.h:12