mirror of
https://github.com/end-4/dots-hyprland.git
synced 2026-06-07 15:59:26 -05:00
114 lines
3.0 KiB
QML
114 lines
3.0 KiB
QML
import qs
|
|
import qs.services
|
|
import qs.modules.common
|
|
import QtQuick
|
|
import Quickshell.Io
|
|
import Quickshell
|
|
import Quickshell.Wayland
|
|
import Quickshell.Hyprland
|
|
|
|
Scope {
|
|
id: root
|
|
property int sidebarWidth: Appearance.sizes.sidebarWidth
|
|
|
|
PanelWindow {
|
|
id: sidebarRoot
|
|
visible: GlobalStates.sidebarRightOpen
|
|
|
|
function hide() {
|
|
GlobalStates.sidebarRightOpen = false
|
|
}
|
|
|
|
exclusiveZone: 0
|
|
implicitWidth: sidebarWidth
|
|
WlrLayershell.namespace: "quickshell:sidebarRight"
|
|
// Hyprland 0.49: Focus is always exclusive and setting this breaks mouse focus grab
|
|
// WlrLayershell.keyboardFocus: WlrKeyboardFocus.Exclusive
|
|
color: "transparent"
|
|
|
|
anchors {
|
|
top: true
|
|
right: true
|
|
bottom: true
|
|
}
|
|
|
|
HyprlandFocusGrab {
|
|
id: grab
|
|
windows: [ sidebarRoot ]
|
|
active: GlobalStates.sidebarRightOpen
|
|
onCleared: () => {
|
|
if (!active) sidebarRoot.hide()
|
|
}
|
|
}
|
|
|
|
Loader {
|
|
id: sidebarContentLoader
|
|
active: GlobalStates.sidebarRightOpen || Config?.options.sidebar.keepRightSidebarLoaded
|
|
anchors {
|
|
fill: parent
|
|
margins: Appearance.sizes.hyprlandGapsOut
|
|
leftMargin: Appearance.sizes.elevationMargin
|
|
}
|
|
width: sidebarWidth - Appearance.sizes.hyprlandGapsOut - Appearance.sizes.elevationMargin
|
|
height: parent.height - Appearance.sizes.hyprlandGapsOut * 2
|
|
|
|
focus: GlobalStates.sidebarRightOpen
|
|
Keys.onPressed: (event) => {
|
|
if (event.key === Qt.Key_Escape) {
|
|
sidebarRoot.hide();
|
|
}
|
|
}
|
|
|
|
sourceComponent: SidebarRightContent {}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
IpcHandler {
|
|
target: "sidebarRight"
|
|
|
|
function toggle(): void {
|
|
GlobalStates.sidebarRightOpen = !GlobalStates.sidebarRightOpen;
|
|
if(GlobalStates.sidebarRightOpen) Notifications.timeoutAll();
|
|
}
|
|
|
|
function close(): void {
|
|
GlobalStates.sidebarRightOpen = false;
|
|
}
|
|
|
|
function open(): void {
|
|
GlobalStates.sidebarRightOpen = true;
|
|
Notifications.timeoutAll();
|
|
}
|
|
}
|
|
|
|
GlobalShortcut {
|
|
name: "sidebarRightToggle"
|
|
description: "Toggles right sidebar on press"
|
|
|
|
onPressed: {
|
|
GlobalStates.sidebarRightOpen = !GlobalStates.sidebarRightOpen;
|
|
if(GlobalStates.sidebarRightOpen) Notifications.timeoutAll();
|
|
}
|
|
}
|
|
GlobalShortcut {
|
|
name: "sidebarRightOpen"
|
|
description: "Opens right sidebar on press"
|
|
|
|
onPressed: {
|
|
GlobalStates.sidebarRightOpen = true;
|
|
Notifications.timeoutAll();
|
|
}
|
|
}
|
|
GlobalShortcut {
|
|
name: "sidebarRightClose"
|
|
description: "Closes right sidebar on press"
|
|
|
|
onPressed: {
|
|
GlobalStates.sidebarRightOpen = false;
|
|
}
|
|
}
|
|
|
|
}
|