added adaptive quickshell
This commit is contained in:
1 parent
6eb56d2065
commit
5b33a73fd8
189 files changed
+8678
-15
No files matched your search
@@ -0,0 +1,79 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Material
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import "services"
|
||||
import "components"
|
||||
|
||||
PanelWindow {
|
||||
id: overlay
|
||||
property string page: ""
|
||||
signal closeRequested()
|
||||
signal navigate(string name)
|
||||
readonly property string mode: screen ? Preferences.modeFor(screen) : "desktop"
|
||||
visible: page !== ""
|
||||
anchors { top: true; bottom: true; left: true; right: true }
|
||||
exclusionMode: ExclusionMode.Ignore
|
||||
WlrLayershell.layer: WlrLayer.Overlay
|
||||
WlrLayershell.keyboardFocus: WlrKeyboardFocus.Exclusive
|
||||
WlrLayershell.namespace: "adaptive-overlay"
|
||||
color: overlay.mode === "desktop" ? "#22000000" : "#80000000"
|
||||
Material.theme: Theme.dark ? Material.Dark : Material.Light
|
||||
Material.accent: Theme.primary
|
||||
MouseArea { anchors.fill: parent; onClicked: overlay.closeRequested() }
|
||||
Rectangle {
|
||||
id: card
|
||||
anchors.centerIn: parent
|
||||
anchors.horizontalCenterOffset: overlay.mode === "desktop" && (overlay.page === "notifications" || overlay.page === "quick") ? Math.max(0, (overlay.width - width) / 2 - 20) : overlay.mode === "desktop" && overlay.page === "launcher" ? -Math.max(0, (overlay.width - width) / 2 - 20) : 0
|
||||
anchors.verticalCenterOffset: overlay.mode === "desktop" && (["notifications", "quick", "launcher"].includes(overlay.page)) ? -Math.max(0, (overlay.height - height) / 2 - 64) : 0
|
||||
width: overlay.mode === "phone" ? parent.width : Math.min(parent.width - 32, overlay.mode === "tablet" ? 900 : (overlay.page === "launcher" ? 420 : (["notifications", "quick"].includes(overlay.page) ? 390 : 760)))
|
||||
height: overlay.mode === "phone" ? parent.height : Math.min(parent.height - 64, overlay.mode === "desktop" && overlay.page === "quick" ? 420 : overlay.mode === "desktop" && overlay.page === "notifications" ? 680 : (overlay.mode === "desktop" && overlay.page === "launcher" ? 560 : 780))
|
||||
radius: overlay.mode === "phone" ? 0 : 28
|
||||
color: Theme.surfaceLow
|
||||
MouseArea { anchors.fill: parent }
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
anchors.margins: overlay.mode === "desktop" ? 14 : 20
|
||||
RowLayout {
|
||||
visible: overlay.mode !== "desktop" || !["launcher", "quick"].includes(overlay.page)
|
||||
Layout.fillWidth: true
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
text: ({launcher: "Приложения", settings: "Settings", quick: "Быстрые настройки", recent: "Открытые окна", home: "Главный экран", notifications: "Уведомления", power: "Питание"})[overlay.page] || ""
|
||||
color: Theme.foreground
|
||||
font.pixelSize: overlay.mode === "desktop" ? 25 : 30
|
||||
font.weight: Font.DemiBold
|
||||
}
|
||||
ActionButton { text: "Закрыть"; onClicked: overlay.closeRequested() }
|
||||
}
|
||||
StackLayout {
|
||||
id: content
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
currentIndex: ["launcher", "settings", "quick", "recent", "power", "notifications", "home"].indexOf(overlay.page)
|
||||
Launcher { onDone: overlay.closeRequested() }
|
||||
Item {}
|
||||
Item {
|
||||
QuickSettings {
|
||||
anchors.fill: parent
|
||||
visible: overlay.mode !== "desktop"
|
||||
onNavigate: name => overlay.navigate(name)
|
||||
}
|
||||
DesktopQuickSettings {
|
||||
anchors.fill: parent
|
||||
visible: overlay.mode === "desktop"
|
||||
onNavigate: name => overlay.navigate(name)
|
||||
}
|
||||
}
|
||||
Recent { onDone: overlay.closeRequested() }
|
||||
Power { onDone: overlay.closeRequested() }
|
||||
NotificationCenter {}
|
||||
Home { onLaunchRequested: overlay.closeRequested(); onOpenLauncher: overlay.navigate("launcher") }
|
||||
}
|
||||
}
|
||||
}
|
||||
Shortcut { sequence: "Escape"; enabled: overlay.visible; onActivated: overlay.closeRequested() }
|
||||
}
|
||||
Reference in new issue
Block a user