From a139c29a2be0cd2f425114a3e53bbf53e76d602c Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Sun, 13 Apr 2025 17:07:32 +0200 Subject: [PATCH] toggleable sidebar --- .config/hypr/hyprland/keybinds.conf | 7 ++--- .../modules/sidebarRight/SidebarRight.qml | 26 ++++++++++++++++++- .config/quickshell/shell.qml | 5 ++-- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/.config/hypr/hyprland/keybinds.conf b/.config/hypr/hyprland/keybinds.conf index 5d3b89ece..bfa6578b6 100644 --- a/.config/hypr/hyprland/keybinds.conf +++ b/.config/hypr/hyprland/keybinds.conf @@ -59,6 +59,7 @@ bind = Super, Down, movefocus, d # [hidden] bind = Super, BracketLeft, movefocus, l # [hidden] bind = Super, BracketRight, movefocus, r # [hidden] bindm = Super, mouse:272, movewindow +bindm = Super, mouse:274, movewindow bindm = Super, mouse:273, resizewindow bind = Super, Q, killactive, bind = Super+Shift+Alt, Q, exec, hyprctl kill # Pick and kill a window @@ -163,9 +164,9 @@ bindir = Super, Super_L, exec, agsv1 -t 'overview' # Toggle overview/launcher bind = Super, Tab, exec, agsv1 -t 'overview' # [hidden] bind = Super, Slash, exec, for ((i=0; i<$(hyprctl monitors -j | jq length); i++)); do agsv1 -t "cheatsheet""$i"; done # Show cheatsheet bind = Super, B, exec, agsv1 -t 'sideleft' # Toggle left sidebar -bind = Super, A, exec, agsv1 -t 'sideleft' # [hidden] -bind = Super, O, exec, agsv1 -t 'sideleft' # [hidden] -bind = Super, N, exec, agsv1 -t 'sideright' # Toggle right sidebar +bind = Super, A, exec, qs ipc call sidebarLeft toggle || agsv1 -t 'sideleft' # [hidden] +bind = Super, O, exec, qs ipc call sidebarLeft toggle || agsv1 -t 'sideleft' # [hidden] +bind = Super, N, exec, qs ipc call sidebarRight toggle || agsv1 -t 'sideright' # Toggle right sidebar bind = Super, M, exec, agsv1 run-js 'openMusicControls.value = (!mpris.getPlayer() ? false : !openMusicControls.value);' # Toggle music controls bind = Super, Comma, exec, agsv1 run-js 'openColorScheme.value = true; Utils.timeout(2000, () => openColorScheme.value = false);' # View color scheme and options bind = Super, K, exec, for ((i=0; i<$(hyprctl monitors -j | jq length); i++)); do agsv1 -t "osk""$i"; done # Toggle on-screen keyboard diff --git a/.config/quickshell/modules/sidebarRight/SidebarRight.qml b/.config/quickshell/modules/sidebarRight/SidebarRight.qml index fcb296431..8b6b6494e 100644 --- a/.config/quickshell/modules/sidebarRight/SidebarRight.qml +++ b/.config/quickshell/modules/sidebarRight/SidebarRight.qml @@ -3,7 +3,9 @@ import "../common/widgets" import QtQuick import QtQuick.Controls import QtQuick.Layouts +import Quickshell.Io import Quickshell +import Quickshell.Wayland Scope { id: bar @@ -14,13 +16,15 @@ Scope { model: Quickshell.screens PanelWindow { - id: barRoot + id: sidebarRoot + visible: false property var modelData screen: modelData exclusiveZone: 0 width: sidebarWidth + WlrLayershell.namespace: "quickshell:sidebarRight" color: "transparent" anchors { @@ -32,6 +36,7 @@ Scope { // Background Rectangle { id: sidebarRightBackground + anchors.centerIn: parent width: parent.width - Appearance.sizes.hyprlandGapsOut * 2 height: parent.height - Appearance.sizes.hyprlandGapsOut * 2 @@ -39,6 +44,25 @@ Scope { radius: Appearance.rounding.screenRounding - Appearance.sizes.elevationMargin + 1 } + // Shadow + // DropShadow { + // anchors.fill: sideRightBackground + // horizontalOffset: 0 + // verticalOffset: 2 + // radius: 3 + // samples: 17 + // color: Appearance.m3colors.m3shadow + // source: sideRightBackground + // } + + IpcHandler { + target: "sidebarRight" + + function toggle(): void { + sidebarRoot.visible = !sidebarRoot.visible + } + } + } } diff --git a/.config/quickshell/shell.qml b/.config/quickshell/shell.qml index 869923f3a..5f822082e 100644 --- a/.config/quickshell/shell.qml +++ b/.config/quickshell/shell.qml @@ -13,8 +13,9 @@ ShellRoot { Bar { } - // SidebarRight { - // } + SidebarRight { + } + ScreenCorners { } }