100 lines
3.4 KiB
QML
100 lines
3.4 KiB
QML
|
|
// Souveraine patch to ii's stock GlobalStates.qml.
|
||
|
|
//
|
||
|
|
// Adds dockRevealPulse: a self-clearing "show the dock for a few seconds"
|
||
|
|
// trigger, driven by the gesture pill (pill/shell.qml) via the dock IPC
|
||
|
|
// while the on-screen keyboard has suppressed the dock (see Dock.qml's
|
||
|
|
// computeDockState). Everything else in this file is unchanged stock ii —
|
||
|
|
// diff against upstream before re-applying this patch if ii updates.
|
||
|
|
import qs.modules.common
|
||
|
|
import qs.services
|
||
|
|
import QtQuick
|
||
|
|
import Quickshell
|
||
|
|
import Quickshell.Hyprland
|
||
|
|
import Quickshell.Io
|
||
|
|
pragma Singleton
|
||
|
|
pragma ComponentBehavior: Bound
|
||
|
|
|
||
|
|
Singleton {
|
||
|
|
id: root
|
||
|
|
property bool barOpen: true
|
||
|
|
property bool crosshairOpen: false
|
||
|
|
property bool sidebarLeftOpen: false
|
||
|
|
property bool sidebarRightOpen: false
|
||
|
|
property bool mediaControlsOpen: false
|
||
|
|
property bool osdBrightnessOpen: false
|
||
|
|
property bool osdVolumeOpen: false
|
||
|
|
property bool oskOpen: false
|
||
|
|
property bool overlayOpen: false
|
||
|
|
property bool overviewOpen: false
|
||
|
|
property bool regionSelectorOpen: false
|
||
|
|
property bool searchOpen: false
|
||
|
|
property bool screenLocked: false
|
||
|
|
property bool screenLockContainsCharacters: false
|
||
|
|
property bool screenUnlockFailed: false
|
||
|
|
property bool screenTranslatorOpen: false
|
||
|
|
property bool sessionOpen: false
|
||
|
|
property bool superDown: false
|
||
|
|
property bool superReleaseMightTrigger: true
|
||
|
|
property real superPressTime: 0
|
||
|
|
property real superLastPressDuration: -1
|
||
|
|
property real superLastReleaseTime: 0
|
||
|
|
property bool wallpaperSelectorOpen: false
|
||
|
|
property bool workspaceShowNumbers: false
|
||
|
|
property bool dockRevealPulse: false
|
||
|
|
|
||
|
|
function pulseDockReveal() {
|
||
|
|
root.dockRevealPulse = true;
|
||
|
|
dockRevealPulseTimer.restart();
|
||
|
|
}
|
||
|
|
|
||
|
|
Timer {
|
||
|
|
id: dockRevealPulseTimer
|
||
|
|
interval: 3000
|
||
|
|
onTriggered: root.dockRevealPulse = false
|
||
|
|
}
|
||
|
|
|
||
|
|
function superPressDuration() {
|
||
|
|
const now = Date.now();
|
||
|
|
if (root.superPressTime > 0)
|
||
|
|
return now - root.superPressTime;
|
||
|
|
if (root.superLastReleaseTime > 0 && now - root.superLastReleaseTime < 250)
|
||
|
|
return root.superLastPressDuration;
|
||
|
|
return -1;
|
||
|
|
}
|
||
|
|
|
||
|
|
function shouldSuppressSuperReleaseSearch() {
|
||
|
|
const autoHide = Config?.options?.bar?.autoHide;
|
||
|
|
const showWhenPressingSuper = autoHide?.showWhenPressingSuper;
|
||
|
|
if (!autoHide?.enable || !showWhenPressingSuper?.enable || !showWhenPressingSuper?.suppressSearchOnHold)
|
||
|
|
return false;
|
||
|
|
|
||
|
|
const duration = root.superPressDuration();
|
||
|
|
return duration >= (showWhenPressingSuper?.suppressSearchDelay ?? showWhenPressingSuper?.delay ?? 140);
|
||
|
|
}
|
||
|
|
|
||
|
|
onSidebarRightOpenChanged: {
|
||
|
|
if (GlobalStates.sidebarRightOpen) {
|
||
|
|
Notifications.timeoutAll();
|
||
|
|
Notifications.markAllRead();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
GlobalShortcut {
|
||
|
|
name: "workspaceNumber"
|
||
|
|
description: "Hold to show workspace numbers, release to show icons"
|
||
|
|
|
||
|
|
onPressed: {
|
||
|
|
root.superDown = true
|
||
|
|
root.superPressTime = Date.now()
|
||
|
|
root.superLastPressDuration = -1
|
||
|
|
}
|
||
|
|
onReleased: {
|
||
|
|
const now = Date.now()
|
||
|
|
if (root.superPressTime > 0)
|
||
|
|
root.superLastPressDuration = now - root.superPressTime
|
||
|
|
root.superLastReleaseTime = now
|
||
|
|
root.superPressTime = 0
|
||
|
|
root.superDown = false
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|