Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/BRIDGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ Cas spéciaux traités avant le `switch` : `dictation` (renvoie `{"dictation": {

### Clés de `preference`

`args.key` choisit la préférence ; `enabled` (booléen) ou `value` (nombre / chaîne) porte la valeur. Clés : `accentBorders`, `activeBorderOnly`, `autoTile`, `autostart`, `bookmarksRailVisible`, `clipboardHistory`, `clipboardImages`, `clipboardLimit`, `customGlassOpacity`, `desktopIndicator`, `desktopLogo`, `dictationEnabled`, `dictationKey`, `dockDrawerOpen`, `dockVisible`, `dockWidth`, `explorerTheme`, `filesDefaultHandler`, `filesPreload`, `frameThickness`, `glassOpacity`, `iconSize`, `lyrics`, `motion`, `osd`, `peripheralBattery`, `pill`, `quietFullscreen`, `reducedEffects`, `replaceTaskbar`, `screenFrame`, `socialBackground`, `socialRailVisible`, `taskbar`, `tileExclusionRemove`, `topActivationMargin`. Le détail des champs par clé est dans le schéma (`preferenceKeys`).
`args.key` choisit la préférence ; `enabled` (booléen) ou `value` (nombre / chaîne) porte la valeur. Clés : `accentBorders`, `activeBorderOnly`, `autoTile`, `autostart`, `bookmarksRailVisible`, `clipboardHistory`, `clipboardImages`, `clipboardLimit`, `customGlassOpacity`, `desktopIndicator`, `desktopLogo`, `dictationEnabled`, `dictationKey`, `dockDrawerOpen`, `dockVisible`, `dockWidth`, `explorerTheme`, `filesDefaultHandler`, `filesPreload`, `frameThickness`, `glassOpacity`, `iconSize`, `lyrics`, `motion`, `osd`, `peripheralBattery`, `pill`, `quietFullscreen`, `reducedEffects`, `replaceTaskbar`, `screenFrame`, `socialBackground`, `socialRailVisible`, `taskbar`, `tileExclusionRemove`, `topActivationMargin`, `topHoverEnabled`. Le détail des champs par clé est dans le schéma (`preferenceKeys`).

## Réponse générale (serveur -> client)

Expand Down
3 changes: 3 additions & 0 deletions docs/bridge-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,9 @@
},
"topActivationMargin": {
"value": "number"
},
"topHoverEnabled": {
"enabled": "boolean"
}
},
"replyKeys": {
Expand Down
3 changes: 3 additions & 0 deletions src/backend/Bridge/QtShellBridge.Actions.Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@ async Task OnPreference(BridgeCall c)
case "socialRailVisible":
Store.State.SocialRailVisible = Flag(c.Args, "enabled");
break;
case "topHoverEnabled":
Store.State.TopHoverEnabled = Flag(c.Args, "enabled");
break;
case "clipboardImages":
Store.State.ClipboardImages = Flag(c.Args, "enabled");
owner.ApplyClipboardSettings();
Expand Down
1 change: 1 addition & 0 deletions src/backend/Bridge/QtShellBridge.State.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ object State()
replaceTaskbar = Store.State.ReplaceTaskbar,
bookmarksRailVisible = Store.State.BookmarksRailVisible,
socialRailVisible = Store.State.SocialRailVisible,
topHoverEnabled = Store.State.TopHoverEnabled,
clipboardImages = Store.State.ClipboardImages,
clipboardLimit = Store.State.ClipboardLimit,
shortcuts = owner.Shortcuts.List(),
Expand Down
1 change: 1 addition & 0 deletions src/backend/Core/Preferences.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public int SettingsSchema
public bool DockVisible { get; set; } = true;
public bool BookmarksRailVisible { get; set; } = true;
public bool SocialRailVisible { get; set; } = true;
public bool TopHoverEnabled { get; set; } = true;
// Win+Alt+S : ouvre la page de réglages
public ShortcutPreferences SettingsShortcut { get; set; } = new() { Modifiers = 9, Key = 0x53 };
// Écran de verrouillage : jamais de mot de passe en clair, seulement sel + empreinte PBKDF2 (voir LockSecret).
Expand Down
3 changes: 2 additions & 1 deletion src/frontend/bridge_pointer.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ def _poll_pointer(self):
self.pill_was_over = over_pill
top_inside = self.top.isVisible() and (panel_rect.adjusted(-12, -2, 12, 16).contains(point) or over_pill)
top_edge = (
geometry.top()
bool(self._state.get("settings", {}).get("topHoverEnabled", True))
and geometry.top()
<= point.y()
<= geometry.top() + int(self._state.get("settings", {}).get("topActivationMargin", 2))
and abs(point.x() - geometry.center().x()) < 460
Expand Down
12 changes: 11 additions & 1 deletion src/frontend/bridge_theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,17 @@ def theme_pending_expire(self):

@Slot(str, int, result='QVariantMap')
def surfaceForScreen(self, name, revision):
return self.surface_scene.data.get(name, {}) if self.surface_scene else {}
if not self.surface_scene:
return {}
entry = self.surface_scene.data.get(name)
if not entry:
return {}
if 'path' not in entry and name in self.surface_scene.paths:
from surface_geometry import svg_path

outline = svg_path(self.surface_scene.paths[name])
return {**entry, 'path': outline, 'outline': outline}
return entry

def sync_explorer_theme(self):
if not self.settings.get('explorerTheme', False) and not self.settings.get('accentBorders', True):
Expand Down
4 changes: 3 additions & 1 deletion src/frontend/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1152,5 +1152,7 @@
"Paramètres Wi-Fi": "Wi-Fi settings",
"Entrée audio": "Audio input",
"Dictée": "Dictation",
"Fonds d’écran": "Wallpapers"
"Fonds d’écran": "Wallpapers",
"Barre supérieure (bord haut)": "Top bar (top edge)",
"Se déploie quand la souris touche le haut de l’écran": "Expands when the pointer touches the top edge of the screen"
}
4 changes: 3 additions & 1 deletion src/frontend/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -1152,5 +1152,7 @@
"Paramètres Wi-Fi": "Ajustes de Wi-Fi",
"Entrée audio": "Entrada de audio",
"Dictée": "Dictado",
"Fonds d’écran": "Fondos de pantalla"
"Fonds d’écran": "Fondos de pantalla",
"Barre supérieure (bord haut)": "Barra superior (borde superior)",
"Se déploie quand la souris touche le haut de l’écran": "Se despliega cuando el puntero toca el borde superior de la pantalla"
}
4 changes: 3 additions & 1 deletion src/frontend/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1152,5 +1152,7 @@
"Paramètres Wi-Fi": "Paramètres Wi-Fi",
"Entrée audio": "Entrée audio",
"Dictée": "Dictée",
"Fonds d’écran": "Fonds d’écran"
"Fonds d’écran": "Fonds d’écran",
"Barre supérieure (bord haut)": "Barre supérieure (bord haut)",
"Se déploie quand la souris touche le haut de l’écran": "Se déploie quand la souris touche le haut de l’écran"
}
8 changes: 5 additions & 3 deletions src/frontend/native_glass.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def __init__(self, bridge, library=None):
bridge.surfaceChanged.connect(self.request_sync)
self.timer = QTimer(self)
self.timer.setInterval(250)
self.timer.timeout.connect(self.sync)
self.timer.timeout.connect(lambda: self.sync(from_timer=True))
self.timer.start()
self.request_sync()

Expand All @@ -109,7 +109,7 @@ def request_sync(self, *args):
self.queued = True
QTimer.singleShot(0, self.sync)

def sync(self):
def sync(self, from_timer=False):
self.queued = False
if self.stopped:
return
Expand Down Expand Up @@ -226,7 +226,9 @@ def sync(self):
busy = bool(visible)
# Pendant une animation (la géométrie change à chaque image) l'ordre Z ne change pas : la passe n'a lieu qu'à
# l'apparition d'une fenêtre, puis à la première synchronisation sans mouvement (fin d'animation, tick de 250 ms).
if topmost_due(self.topmost_handles, handles, moved):
if (handles != self.topmost_handles or from_timer) if not self.windows else topmost_due(
self.topmost_handles, handles, moved
):
self.raise_content(handles)
self.topmost_handles = handles
for window in locking:
Expand Down
16 changes: 16 additions & 0 deletions src/frontend/qml/settings/PageDocks.qml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,22 @@ ColumnLayout {
})
}
}

SettingsRow {
rowId: "topHover"
target: topHover

SettingsSwitch {
id: topHover

objectName: "topHoverToggle"
value: Bridge.settings.topHoverEnabled ?? true
onToggled: Bridge.action("preference", {
key: "topHoverEnabled",
enabled: checked
})
}
}
}

SettingsSection {
Expand Down
8 changes: 8 additions & 0 deletions src/frontend/qml/settings/SettingsIndex.qml
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,14 @@ QtObject {
desc: qsTr("Se déploie quand la souris touche le bord droit de l’écran"),
kw: "reseaux sociaux messagerie social rail droite"
},
{
id: "topHover",
page: 2,
section: qsTr("Visibilité"),
label: qsTr("Barre supérieure (bord haut)"),
desc: qsTr("Se déploie quand la souris touche le haut de l’écran"),
kw: "barre superieure top bar dashboard hover survol haut"
},
{
id: "replaceTaskbar",
page: 2,
Expand Down
45 changes: 39 additions & 6 deletions src/frontend/surface_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from PySide6.QtCore import QObject, QTimer, QRectF, Qt
from PySide6.QtGui import QPainterPath, QTransform, QRegion
from functools import lru_cache
import time
from PySide6.QtWidgets import QApplication


Expand Down Expand Up @@ -158,6 +159,12 @@ def __init__(self, bridge):
self.revision = 0
self.stopped = False
self.input_masks = {}
self._top_mask_at = 0.0
self._top_mask_pending = None
self._top_mask_timer = QTimer(self)
self._top_mask_timer.setSingleShot(True)
self._top_mask_timer.setInterval(100)
self._top_mask_timer.timeout.connect(self._apply_top_mask_pending)
self.pill_watched = None
bridge.changed.connect(self.request)
bridge.geometryChanged.connect(self.request)
Expand Down Expand Up @@ -320,16 +327,28 @@ def pill_view(window):
int(window.winId()), None
) # dock masqué : on oublie son masque, il est réappliqué à la prochaine apparition
if window and spec:
offset = spec[1] - window.y() if is_dock else 0
mask_key = (window.width(), window.height(), round(spec[2]), round(spec[3]), spec[4], round(offset))
offset = 0
mask_key = (window.width(), window.height(), round(spec[2]), round(spec[3]), spec[4])
handle = int(window.winId())
if self.input_masks.get(handle) != mask_key:
path = (
QTransform()
.translate((window.width() - spec[2]) / 2, offset)
.map(builder(spec[2], spec[3], spec[4]))
)
window.setMask(QRegion(path.toFillPolygon().toPolygon(), Qt.WindingFill))
region = QRegion(path.toFillPolygon().toPolygon(), Qt.WindingFill)
if is_dock:
window.setMask(region)
else:
now = time.monotonic()
if handle not in self.input_masks or now - self._top_mask_at >= 0.10:
window.setMask(region)
self._top_mask_at = now
self._top_mask_pending = None
self._top_mask_timer.stop()
else:
self._top_mask_pending = (window, region)
self._top_mask_timer.start()
self.input_masks[handle] = mask_key
displays = [
(s.name(), s.geometry().x(), s.geometry().y(), s.geometry().width(), s.geometry().height())
Expand All @@ -352,6 +371,13 @@ def pill_view(window):
if signature == self.signature:
return
self.signature = signature
if not (bridge.glassEnabled and not bridge.reducedEffects):
if self.paths or self.data:
self.paths = {}
self.data = {}
self.revision += 1
bridge.surfaceChanged.emit()
return
paths = {}
data = {}
for name, x, y, w, h in displays:
Expand Down Expand Up @@ -380,11 +406,8 @@ def local(spec):
)
# Le rendu de courbes de Qt exige une silhouette normalisée pour les contours qui se chevauchent.
simple = path.simplified()
outline = svg_path(simple)
paths[name] = simple
data[name] = {
'path': outline,
'outline': outline,
'visible': not path.isEmpty(),
'components': (thickness, local(top), local(dock), local(rail), local(left), local(dictation), local(pill)),
}
Expand All @@ -393,6 +416,16 @@ def local(spec):
self.revision += 1
bridge.surfaceChanged.emit()

def _apply_top_mask_pending(self):
pending = self._top_mask_pending
self._top_mask_pending = None
if pending and not self.stopped:
window, region = pending
window.setMask(region)
self._top_mask_at = time.monotonic()

def stop(self):
self.stopped = True
self.timer.stop()
self._top_mask_timer.stop()
self._top_mask_pending = None
1 change: 1 addition & 0 deletions tests/Winlestia.Tests/BridgeHandlerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ public void CaptureShortcutModeFollowsTheFlag() => With(r =>
[InlineData("dockDrawerOpen", nameof(Preferences.DockDrawerOpen))]
[InlineData("bookmarksRailVisible", nameof(Preferences.BookmarksRailVisible))]
[InlineData("socialRailVisible", nameof(Preferences.SocialRailVisible))]
[InlineData("topHoverEnabled", nameof(Preferences.TopHoverEnabled))]
[InlineData("clipboardImages", nameof(Preferences.ClipboardImages))]
[InlineData("clipboardHistory", nameof(Preferences.ClipboardHistory))]
[InlineData("socialBackground", nameof(Preferences.SocialBackground))]
Expand Down