Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
ISnapSettings.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
7#include <QObject>
8
9namespace PhosphorEngine {
10
12{
13public:
14 virtual ~ISnapSettings() = default;
15
16 // Global snapping master toggle. When false the user has turned snapping
17 // off entirely: no window may be auto-snapped on open via any path (app
18 // rule, session restore, empty-zone auto-assign, last-used-zone).
19 // SnapEngine::resolveWindowRestore gates on this so the engine-internal
20 // auto-snap path and the daemon-side D-Bus gate (SnapAdaptor::applySnapResult)
21 // stay in lockstep.
22 virtual bool snappingEnabled() const = 0;
23
24 // excludedApplications() / excludedWindowClasses() are gone — the v4
25 // migration folded those flat lists into the unified WindowRule store.
26 // The daemon now wires a filtered Exclude rule set directly into the
27 // SnapEngine via `setExcludeRuleSet`; consumers that previously called
28 // these accessors evaluate against the rule set instead.
29
30 // Global minimum-window-size exclusion (the shared Exclusions surface, not a
31 // snapping-only knob): a window whose frame is smaller than these thresholds
32 // is excluded from auto-snap, matching the autotile engine which already
33 // honours them. 0 disables the respective dimension. The engine only applies
34 // these when a full WindowQuery (carrying the frame size) is available via
35 // the injected exclusion query provider; the appId-only fast path skips them.
36 virtual int minimumWindowWidth() const = 0;
37 virtual int minimumWindowHeight() const = 0;
38
40 virtual bool moveNewWindowsToLastZone() const = 0;
41 virtual bool restoreWindowsToZonesOnLogin() const = 0;
42
43 // When true, a window that is auto-placed into a zone on open (session
44 // restore, placement rule, empty-zone auto-assign, last-used-zone) is given focus.
45 // Read only on the AutoRestored commit path in SnapEngine::commitSnapImpl, so
46 // it never affects manual drag or keyboard snaps (those use UserInitiated).
47 // Mirrors AutotileConfig::focusNewWindows. Default false.
48 virtual bool focusNewWindows() const = 0;
49
50 // Force-on master toggle: when true, every layout reaching the snap-to-
51 // empty-zone path auto-assigns new windows to its first empty zone
52 // regardless of its individual `autoAssign` flag. Effective behavior is
53 // `globalAutoAssign OR layout->autoAssign()`. Autotile screens never
54 // reach this path — they're short-circuited upstream in
55 // SnapEngine::windowOpened (see lifecycle.cpp), so this flag is in
56 // practice a manual-layout-only override. Default false preserves the
57 // pre-#370 per-layout-only semantics.
58 virtual bool autoAssignAllLayouts() const = 0;
59
60 // When true, unfloating (Meta+F) a window that has NO pre-float zone to return
61 // to — a never-snapped window that defaulted to floating — snaps it to a
62 // fallback zone (last-used → first-empty → first zone in the layout) instead of
63 // leaving it floating. Default false: the window stays floating, and the
64 // interactive toggle path (toggleWindowFloat) emits the OSD feedback — the
65 // programmatic setWindowFloat path stays silent. Read in
66 // SnapEngine::unfloatToZone.
67 virtual bool unfloatFallbackToZone() const = 0;
68};
69
70} // namespace PhosphorEngine
71
72// Q_DECLARE_INTERFACE is REQUIRED at moc time for any QObject that uses
73// `Q_INTERFACES(PhosphorEngine::ISnapSettings)` to declare that it
74// implements this interface — Settings does so in src/config/settings.h.
75// Interface dispatch happens through `dynamic_cast<ISnapSettings*>` (see
76// `SnapEngine::snapSettings()` in SnapEngine.cpp), not `qobject_cast`, so the
77// IID string below is never exercised at runtime — but the macro pairing with
78// `Q_INTERFACES` is still structurally required for an implementer to compile.
79Q_DECLARE_INTERFACE(PhosphorEngine::ISnapSettings, "org.plasmazones.ISnapSettings")
Definition ISnapSettings.h:12
virtual bool unfloatFallbackToZone() const =0
virtual StickyWindowHandling snappingStickyWindowHandling() const =0
virtual bool restoreWindowsToZonesOnLogin() const =0
virtual bool autoAssignAllLayouts() const =0
virtual int minimumWindowWidth() const =0
virtual bool focusNewWindows() const =0
virtual bool moveNewWindowsToLastZone() const =0
virtual ~ISnapSettings()=default
virtual bool snappingEnabled() const =0
virtual int minimumWindowHeight() const =0
Definition EngineTypes.h:13
StickyWindowHandling
Definition EngineTypes.h:126