From 1099258d07c360de85ede978e65cb8babbd93462 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Sun, 1 Jun 2025 18:14:02 +0200 Subject: [PATCH] left sidebar: add detach/attach instructions + keybind --- .config/hypr/hyprland/keybinds.conf | 3 ++- .../quickshell/modules/sidebarLeft/AiChat.qml | 14 ++++++++++++-- .../quickshell/modules/sidebarLeft/Anime.qml | 4 ++-- .../modules/sidebarLeft/SidebarLeft.qml | 19 ++++++++++++++----- 4 files changed, 30 insertions(+), 10 deletions(-) diff --git a/.config/hypr/hyprland/keybinds.conf b/.config/hypr/hyprland/keybinds.conf index b15bde77a..8feb3c2ca 100644 --- a/.config/hypr/hyprland/keybinds.conf +++ b/.config/hypr/hyprland/keybinds.conf @@ -19,8 +19,9 @@ bind = Super, mouse_down,global, quickshell:overviewToggleReleaseInterrupt # [hi bindit = ,Super_L, global, quickshell:workspaceNumber # [hidden] bindd = Super, V, Clipboard history >> clipboard, global, quickshell:overviewClipboardToggle # Clipboard history >> clipboard bindd = Super, Tab, Toggle overview, global, quickshell:overviewToggle # [hidden] Toggle overview/launcher (alt) -bind = Super, B, global, quickshell:sidebarLeftToggle # [hidden] bindd = Super, A, Toggle left sidebar, global, quickshell:sidebarLeftToggle # Toggle left sidebar +bind = Super+Alt, A, global, quickshell:sidebarLeftToggleDetach # [hidden] +bind = Super, B, global, quickshell:sidebarLeftToggle # [hidden] bind = Super, O, global, quickshell:sidebarLeftToggle # [hidden] bindd = Super, N, Toggle right sidebar, global, quickshell:sidebarRightToggle # Toggle right sidebar bindd = Super, Slash, Toggle cheatsheet, global, quickshell:cheatsheetToggle # Toggle cheatsheet diff --git a/.config/quickshell/modules/sidebarLeft/AiChat.qml b/.config/quickshell/modules/sidebarLeft/AiChat.qml index a17954e6a..66d994a1d 100644 --- a/.config/quickshell/modules/sidebarLeft/AiChat.qml +++ b/.config/quickshell/modules/sidebarLeft/AiChat.qml @@ -215,18 +215,28 @@ int main(int argc, char* argv[]) { MaterialSymbol { Layout.alignment: Qt.AlignHCenter - iconSize: 55 + iconSize: 60 color: Appearance.m3colors.m3outline text: "neurology" } StyledText { id: widgetNameText Layout.alignment: Qt.AlignHCenter - font.pixelSize: Appearance.font.pixelSize.normal + font.pixelSize: Appearance.font.pixelSize.larger + font.family: Appearance.font.family.title color: Appearance.m3colors.m3outline horizontalAlignment: Text.AlignHCenter text: qsTr("Large language models") } + StyledText { + id: widgetDescriptionText + Layout.fillWidth: true + font.pixelSize: Appearance.font.pixelSize.small + color: Appearance.m3colors.m3outline + horizontalAlignment: Text.AlignLeft + wrapMode: Text.Wrap + text: qsTr("Ctrl+O to expand the sidebar\nCtrl+P to detach sidebar into a window") + } } } } diff --git a/.config/quickshell/modules/sidebarLeft/Anime.qml b/.config/quickshell/modules/sidebarLeft/Anime.qml index 8d6c77a3f..1edb8252e 100644 --- a/.config/quickshell/modules/sidebarLeft/Anime.qml +++ b/.config/quickshell/modules/sidebarLeft/Anime.qml @@ -205,14 +205,14 @@ Item { MaterialSymbol { Layout.alignment: Qt.AlignHCenter - iconSize: 55 + iconSize: 60 color: Appearance.m3colors.m3outline text: "bookmark_heart" } StyledText { id: widgetNameText Layout.alignment: Qt.AlignHCenter - font.pixelSize: Appearance.font.pixelSize.normal + font.pixelSize: Appearance.font.pixelSize.larger color: Appearance.m3colors.m3outline horizontalAlignment: Text.AlignHCenter text: qsTr("Anime boorus") diff --git a/.config/quickshell/modules/sidebarLeft/SidebarLeft.qml b/.config/quickshell/modules/sidebarLeft/SidebarLeft.qml index 80f5e17b0..a62593d75 100644 --- a/.config/quickshell/modules/sidebarLeft/SidebarLeft.qml +++ b/.config/quickshell/modules/sidebarLeft/SidebarLeft.qml @@ -18,7 +18,7 @@ Scope { // Scope property int sidebarPadding: 15 property var tabButtonList: [{"icon": "neurology", "name": qsTr("Intelligence")}, {"icon": "bookmark_heart", "name": qsTr("Anime")}] property int selectedTab: 0 - property bool pin: false + property bool detach: false property Component contentComponent: SidebarLeftContent {} property Item sidebarContent @@ -29,8 +29,8 @@ Scope { // Scope sidebarLoader.item.contentParent.children = [root.sidebarContent]; } - onPinChanged: { - if (root.pin) { + onDetachChanged: { + if (root.detach) { sidebarContent.parent = null; // Detach content from sidebar sidebarLoader.active = false; // Unload sidebar detachedSidebarLoader.active = true; // Load detached window @@ -117,7 +117,7 @@ Scope { // Scope sidebarRoot.extend = !sidebarRoot.extend; } else if (event.key === Qt.Key_P) { - root.pin = !root.pin; + root.detach = !root.detach; } event.accepted = true; } @@ -143,7 +143,7 @@ Scope { // Scope Keys.onPressed: (event) => { if (event.modifiers === Qt.ControlModifier) { if (event.key === Qt.Key_P) { - root.pin = !root.pin; + root.detach = !root.detach; } event.accepted = true; } @@ -195,4 +195,13 @@ Scope { // Scope } } + GlobalShortcut { + name: "sidebarLeftToggleDetach" + description: qsTr("Detach left sidebar into a window/Attach it back") + + onPressed: { + root.detach = !root.detach; + } + } + }