From ff8cee9ddecb1f8921fdfcf6366e306df0ca4997 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Tue, 15 Apr 2025 08:58:08 +0200 Subject: [PATCH] cleaner import; sidebar quick toggles --- .../quickshell/modules/bar/ActiveWindow.qml | 4 +- .config/quickshell/modules/bar/Bar.qml | 4 +- .config/quickshell/modules/bar/Battery.qml | 4 +- .../quickshell/modules/bar/ClockWidget.qml | 4 +- .config/quickshell/modules/bar/Media.qml | 4 +- .config/quickshell/modules/bar/Resource.qml | 4 +- .config/quickshell/modules/bar/Resources.qml | 4 +- .config/quickshell/modules/bar/SysTray.qml | 4 +- .../quickshell/modules/bar/UtilButtons.qml | 4 +- .config/quickshell/modules/bar/Workspaces.qml | 4 +- .../quickshell/modules/common/Appearance.qml | 5 +- .../modules/common/MprisController.qml | 1 - .../modules/common/widgets/MaterialSymbol.qml | 2 +- .../common/widgets/SmallCircleButton.qml | 2 +- .../modules/common/widgets/StyledText.qml | 2 +- .../modules/common/widgets/StyledToolTip.qml | 21 ++++++++ .../modules/screenCorners/ScreenCorners.qml | 4 +- .../sidebarRight/QuickToggleButton.qml | 28 ++++++++--- .../modules/sidebarRight/SidebarRight.qml | 48 +++++++++++++++---- 19 files changed, 110 insertions(+), 43 deletions(-) create mode 100644 .config/quickshell/modules/common/widgets/StyledToolTip.qml diff --git a/.config/quickshell/modules/bar/ActiveWindow.qml b/.config/quickshell/modules/bar/ActiveWindow.qml index 39b34fa15..6ae04b3af 100644 --- a/.config/quickshell/modules/bar/ActiveWindow.qml +++ b/.config/quickshell/modules/bar/ActiveWindow.qml @@ -1,5 +1,5 @@ -import "../common" -import "../common/widgets" +import "root:/modules/common" +import "root:/modules/common/widgets" import QtQuick import QtQuick.Layouts import Quickshell.Wayland diff --git a/.config/quickshell/modules/bar/Bar.qml b/.config/quickshell/modules/bar/Bar.qml index b31ac371a..25fe1ddf5 100644 --- a/.config/quickshell/modules/bar/Bar.qml +++ b/.config/quickshell/modules/bar/Bar.qml @@ -1,5 +1,5 @@ -import "../common" -import "../common/widgets" +import "root:/modules/common" +import "root:/modules/common/widgets" import QtQuick import QtQuick.Controls import QtQuick.Layouts diff --git a/.config/quickshell/modules/bar/Battery.qml b/.config/quickshell/modules/bar/Battery.qml index dc3b0d057..a751bf3b1 100644 --- a/.config/quickshell/modules/bar/Battery.qml +++ b/.config/quickshell/modules/bar/Battery.qml @@ -1,5 +1,5 @@ -import "../common" -import "../common/widgets" +import "root:/modules/common" +import "root:/modules/common/widgets" import QtQuick import QtQuick.Layouts import Quickshell diff --git a/.config/quickshell/modules/bar/ClockWidget.qml b/.config/quickshell/modules/bar/ClockWidget.qml index 4568bbdcd..3e1840463 100644 --- a/.config/quickshell/modules/bar/ClockWidget.qml +++ b/.config/quickshell/modules/bar/ClockWidget.qml @@ -1,5 +1,5 @@ -import "../common" -import "../common/widgets" +import "root:/modules/common" +import "root:/modules/common/widgets" import QtQuick import QtQuick.Layouts diff --git a/.config/quickshell/modules/bar/Media.qml b/.config/quickshell/modules/bar/Media.qml index 268ea1042..1facc6673 100644 --- a/.config/quickshell/modules/bar/Media.qml +++ b/.config/quickshell/modules/bar/Media.qml @@ -1,5 +1,5 @@ -import "../common" -import "../common/widgets" +import "root:/modules/common" +import "root:/modules/common/widgets" import QtQuick import QtQuick.Layouts import Quickshell diff --git a/.config/quickshell/modules/bar/Resource.qml b/.config/quickshell/modules/bar/Resource.qml index fd9a0b87a..c55e4a8b8 100644 --- a/.config/quickshell/modules/bar/Resource.qml +++ b/.config/quickshell/modules/bar/Resource.qml @@ -1,5 +1,5 @@ -import "../common" -import "../common/widgets" +import "root:/modules/common" +import "root:/modules/common/widgets" import QtQuick import QtQuick.Layouts import Quickshell diff --git a/.config/quickshell/modules/bar/Resources.qml b/.config/quickshell/modules/bar/Resources.qml index 0a7f28f6e..6d6514632 100644 --- a/.config/quickshell/modules/bar/Resources.qml +++ b/.config/quickshell/modules/bar/Resources.qml @@ -1,5 +1,5 @@ -import "../common" -import "../common/widgets" +import "root:/modules/common" +import "root:/modules/common/widgets" import QtQuick import QtQuick.Layouts import Quickshell diff --git a/.config/quickshell/modules/bar/SysTray.qml b/.config/quickshell/modules/bar/SysTray.qml index 27d4e456e..5bf3e823f 100644 --- a/.config/quickshell/modules/bar/SysTray.qml +++ b/.config/quickshell/modules/bar/SysTray.qml @@ -1,5 +1,5 @@ -import "../common" -import "../common/widgets" +import "root:/modules/common" +import "root:/modules/common/widgets" import QtQuick import QtQuick.Layouts import Quickshell.Hyprland diff --git a/.config/quickshell/modules/bar/UtilButtons.qml b/.config/quickshell/modules/bar/UtilButtons.qml index eb0af110f..b6e6a276e 100644 --- a/.config/quickshell/modules/bar/UtilButtons.qml +++ b/.config/quickshell/modules/bar/UtilButtons.qml @@ -1,5 +1,5 @@ -import "../common" -import "../common/widgets" +import "root:/modules/common" +import "root:/modules/common/widgets" import QtQuick import QtQuick.Layouts import Quickshell diff --git a/.config/quickshell/modules/bar/Workspaces.qml b/.config/quickshell/modules/bar/Workspaces.qml index 1df21c8be..d502c5a20 100644 --- a/.config/quickshell/modules/bar/Workspaces.qml +++ b/.config/quickshell/modules/bar/Workspaces.qml @@ -1,5 +1,5 @@ -import "../common" -import "../common/widgets" +import "root:/modules/common" +import "root:/modules/common/widgets" import QtQuick import QtQuick.Controls import QtQuick.Layouts diff --git a/.config/quickshell/modules/common/Appearance.qml b/.config/quickshell/modules/common/Appearance.qml index bbbf733fc..630f1afae 100644 --- a/.config/quickshell/modules/common/Appearance.qml +++ b/.config/quickshell/modules/common/Appearance.qml @@ -122,6 +122,8 @@ Singleton { property color colLayer3Active: mix(colLayer3, colOnLayer3, 0.80); property color colPrimaryHover: mix(m3colors.m3primary, colLayer1Hover, 0.7) property color colPrimaryActive: mix(m3colors.m3primary, colLayer1Active, 0.4) + property color colTooltip: m3colors.m3inverseSurface + property color colOnTooltip: m3colors.m3inverseOnSurface } rounding: QtObject { @@ -148,7 +150,8 @@ Singleton { property int small: 11 property int normal: 12 property int large: 13 - property int larger: 16 + property int larger: 14 + property int huge: 16 } } diff --git a/.config/quickshell/modules/common/MprisController.qml b/.config/quickshell/modules/common/MprisController.qml index 590dcd86c..be0c1939f 100644 --- a/.config/quickshell/modules/common/MprisController.qml +++ b/.config/quickshell/modules/common/MprisController.qml @@ -6,7 +6,6 @@ import QtQuick import Quickshell import Quickshell.Io import Quickshell.Services.Mpris -import "../.." Singleton { id: root; diff --git a/.config/quickshell/modules/common/widgets/MaterialSymbol.qml b/.config/quickshell/modules/common/widgets/MaterialSymbol.qml index 4f0f6a0d4..57a46c5e7 100644 --- a/.config/quickshell/modules/common/widgets/MaterialSymbol.qml +++ b/.config/quickshell/modules/common/widgets/MaterialSymbol.qml @@ -1,4 +1,4 @@ -import "../" +import "root:/modules/common" import QtQuick import QtQuick.Layouts diff --git a/.config/quickshell/modules/common/widgets/SmallCircleButton.qml b/.config/quickshell/modules/common/widgets/SmallCircleButton.qml index 4cb2e9e61..e1b85dd41 100644 --- a/.config/quickshell/modules/common/widgets/SmallCircleButton.qml +++ b/.config/quickshell/modules/common/widgets/SmallCircleButton.qml @@ -1,4 +1,4 @@ -import "../" +import "root:/modules/common" import QtQuick import QtQuick.Controls import QtQuick.Layouts diff --git a/.config/quickshell/modules/common/widgets/StyledText.qml b/.config/quickshell/modules/common/widgets/StyledText.qml index 190e0b1cf..c97b5895a 100644 --- a/.config/quickshell/modules/common/widgets/StyledText.qml +++ b/.config/quickshell/modules/common/widgets/StyledText.qml @@ -1,4 +1,4 @@ -import "../" +import "root:/modules/common" import QtQuick import QtQuick.Layouts diff --git a/.config/quickshell/modules/common/widgets/StyledToolTip.qml b/.config/quickshell/modules/common/widgets/StyledToolTip.qml new file mode 100644 index 000000000..31b67ad34 --- /dev/null +++ b/.config/quickshell/modules/common/widgets/StyledToolTip.qml @@ -0,0 +1,21 @@ +import "root:/modules/common" +import "root:/modules/common/widgets" +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +ToolTip { + property string content + parent: parent + visible: parent.hovered + padding: 7 + background: Rectangle { + color: Appearance.colors.colTooltip + radius: Appearance.rounding.small + } + StyledText { + text: content + id: tooltipText + color: Appearance.colors.colOnTooltip + } +} \ No newline at end of file diff --git a/.config/quickshell/modules/screenCorners/ScreenCorners.qml b/.config/quickshell/modules/screenCorners/ScreenCorners.qml index 95764848a..f7075305f 100644 --- a/.config/quickshell/modules/screenCorners/ScreenCorners.qml +++ b/.config/quickshell/modules/screenCorners/ScreenCorners.qml @@ -1,5 +1,5 @@ -import "../common" -import "../common/widgets" +import "root:/modules/common" +import "root:/modules/common/widgets" import QtQuick import QtQuick.Controls import QtQuick.Layouts diff --git a/.config/quickshell/modules/sidebarRight/QuickToggleButton.qml b/.config/quickshell/modules/sidebarRight/QuickToggleButton.qml index 0c3cb82c1..20d3be402 100644 --- a/.config/quickshell/modules/sidebarRight/QuickToggleButton.qml +++ b/.config/quickshell/modules/sidebarRight/QuickToggleButton.qml @@ -1,19 +1,17 @@ -import "../common" -import "../common/widgets" +import "root:/modules/common" +import "root:/modules/common/widgets" import QtQuick import QtQuick.Controls +import Quickshell.Io Button { id: button property bool toggled - - signal clicked() + property string buttonIcon implicitWidth: 40 implicitHeight: 40 - onClicked: { - } background: Rectangle { anchors.fill: parent @@ -22,10 +20,26 @@ Button { (button.down ? Appearance.colors.colPrimaryActive : button.hovered ? Appearance.colors.colPrimaryHover : Appearance.m3colors.m3primary) : (button.down ? Appearance.colors.colLayer1Active : button.hovered ? Appearance.colors.colLayer1Hover : Appearance.transparentize(Appearance.colors.colLayer1Hover, 1)) + Behavior on color { + ColorAnimation { + duration: Appearance.animation.elementDecel.duration + easing.type: Appearance.animation.elementDecel.type + } + + } + MaterialSymbol { anchors.centerIn: parent - text: "coffee" + font.pointSize: Appearance.font.pointSize.larger + text: buttonIcon color: toggled ? Appearance.m3colors.m3onPrimary : Appearance.colors.colOnLayer1 + + Behavior on color { + ColorAnimation { + duration: Appearance.animation.elementDecel.duration + easing.type: Appearance.animation.elementDecel.type + } + } } } diff --git a/.config/quickshell/modules/sidebarRight/SidebarRight.qml b/.config/quickshell/modules/sidebarRight/SidebarRight.qml index 4e8463367..82e86dd9c 100644 --- a/.config/quickshell/modules/sidebarRight/SidebarRight.qml +++ b/.config/quickshell/modules/sidebarRight/SidebarRight.qml @@ -1,5 +1,5 @@ -import "../common" -import "../common/widgets" +import "root:/modules/common" +import "root:/modules/common/widgets" import QtQuick import QtQuick.Controls import QtQuick.Layouts @@ -92,7 +92,7 @@ Scope { Layout.fillHeight: false spacing: 10 Layout.margins: 10 - Layout.topMargin: 10 + Layout.bottomMargin: 5 CustomIcon { width: 25 @@ -127,15 +127,45 @@ Scope { anchors.fill: parent anchors.margins: 5 spacing: 5 - Rectangle { - width: 40 - height: 40 - color: "#77000000" - radius: Appearance.rounding.full + + QuickToggleButton { + property bool enabled: false + buttonIcon: "gamepad" + toggled: enabled + onClicked: { + enabled = !enabled + if (enabled) { + gameModeOn.running = true + } else { + gameModeOff.running = true + } + } + Process { + id: gameModeOn + command: ['bash', '-c', `hyprctl --batch "keyword animations:enabled 0; keyword decoration:shadow:enabled 0; keyword decoration:blur:enabled 0; keyword general:gaps_in 0; keyword general:gaps_out 0; keyword general:border_size 1; keyword decoration:rounding 0; keyword general:allow_tearing 1"`] + } + Process { + id: gameModeOff + command: ['bash', '-c', `hyprctl reload`] + } + StyledToolTip { + content: "Game mode" + } } QuickToggleButton { - toggled: false + toggled: idleInhibitor.running + buttonIcon: "coffee" + onClicked: { + idleInhibitor.running = !idleInhibitor.running + } + Process { + id: idleInhibitor + command: ["bash", "-c", "${XDG_CONFIG_HOME:-$HOME/.config}/quickshell/scripts/wayland-idle-inhibitor.py"] + } + StyledToolTip { + content: "Keep system awake" + } } }