diff options
Diffstat (limited to 'modules')
21 files changed, 5 insertions, 2664 deletions
diff --git a/modules/areapicker/AreaPicker.qml b/modules/areapicker/AreaPicker.qml deleted file mode 100644 index 308b7d2..0000000 --- a/modules/areapicker/AreaPicker.qml +++ /dev/null @@ -1,125 +0,0 @@ -pragma ComponentBehavior: Bound - -import qs.components.containers -import qs.components.misc -import qs.services -import Quickshell -import Quickshell.Wayland -import Quickshell.Io - -Scope { - LazyLoader { - id: root - - property bool freeze - property bool closing - property bool clipboardOnly - - Variants { - model: Screens.screens - - StyledWindow { - id: win - - required property ShellScreen modelData - - screen: modelData - name: "area-picker" - WlrLayershell.exclusionMode: ExclusionMode.Ignore - WlrLayershell.layer: WlrLayer.Overlay - WlrLayershell.keyboardFocus: root.closing ? WlrKeyboardFocus.None : WlrKeyboardFocus.Exclusive - mask: root.closing ? empty : null - - anchors.top: true - anchors.bottom: true - anchors.left: true - anchors.right: true - - Region { - id: empty - } - - Picker { - loader: root - screen: win.modelData - } - } - } - } - - IpcHandler { - target: "picker" - - function open(): void { - root.freeze = false; - root.closing = false; - root.clipboardOnly = false; - root.activeAsync = true; - } - - function openFreeze(): void { - root.freeze = true; - root.closing = false; - root.clipboardOnly = false; - root.activeAsync = true; - } - - function openClip(): void { - root.freeze = false; - root.closing = false; - root.clipboardOnly = true; - root.activeAsync = true; - } - - function openFreezeClip(): void { - root.freeze = true; - root.closing = false; - root.clipboardOnly = true; - root.activeAsync = true; - } - } - - CustomShortcut { - name: "screenshot" - description: "Open screenshot tool" - onPressed: { - root.freeze = false; - root.closing = false; - root.clipboardOnly = false; - root.activeAsync = true; - } - } - - CustomShortcut { - name: "screenshotFreeze" - description: "Open screenshot tool (freeze mode)" - onPressed: { - root.freeze = true; - root.closing = false; - root.clipboardOnly = false; - root.activeAsync = true; - } - } - - CustomShortcut { - name: "screenshotClip" - description: "Open screenshot tool (clipboard)" - onPressed: { - root.freeze = false; - root.closing = false; - root.clipboardOnly = true; - root.activeAsync = true; - } - } - - CustomShortcut { - name: "screenshotFreezeClip" - description: "Open screenshot tool (freeze mode, clipboard)" - onPressed: { - root.freeze = true; - root.closing = false; - root.clipboardOnly = true; - root.activeAsync = true; - } - } -} diff --git a/modules/background/Background.qml b/modules/background/Background.qml index c1f149a..44d3491 100644 --- a/modules/background/Background.qml +++ b/modules/background/Background.qml @@ -51,103 +51,6 @@ Loader { wallpaper: wallpaper } } - - Loader { - id: clockLoader - active: Config.background.desktopClock.enabled - - anchors.margins: Appearance.padding.large * 2 - anchors.leftMargin: Appearance.padding.large * 2 + Config.bar.sizes.innerWidth + Math.max(Appearance.padding.smaller, Config.border.thickness) - - state: Config.background.desktopClock.position - states: [ - State { - name: "top-left" - AnchorChanges { - target: clockLoader - anchors.top: parent.top - anchors.left: parent.left - } - }, - State { - name: "top-center" - AnchorChanges { - target: clockLoader - anchors.top: parent.top - anchors.horizontalCenter: parent.horizontalCenter - } - }, - State { - name: "top-right" - AnchorChanges { - target: clockLoader - anchors.top: parent.top - anchors.right: parent.right - } - }, - State { - name: "middle-left" - AnchorChanges { - target: clockLoader - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - } - }, - State { - name: "middle-center" - AnchorChanges { - target: clockLoader - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - } - }, - State { - name: "middle-right" - AnchorChanges { - target: clockLoader - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - } - }, - State { - name: "bottom-left" - AnchorChanges { - target: clockLoader - anchors.bottom: parent.bottom - anchors.left: parent.left - } - }, - State { - name: "bottom-center" - AnchorChanges { - target: clockLoader - anchors.bottom: parent.bottom - anchors.horizontalCenter: parent.horizontalCenter - } - }, - State { - name: "bottom-right" - AnchorChanges { - target: clockLoader - anchors.bottom: parent.bottom - anchors.right: parent.right - } - } - ] - - transitions: Transition { - AnchorAnimation { - duration: Appearance.anim.durations.expressiveDefaultSpatial - easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial - } - } - - sourceComponent: DesktopClock { - wallpaper: behindClock - absX: clockLoader.x - absY: clockLoader.y - } - } } } } diff --git a/modules/background/Wallpaper.qml b/modules/background/Wallpaper.qml index 39a48fc..0929895 100644 --- a/modules/background/Wallpaper.qml +++ b/modules/background/Wallpaper.qml @@ -11,7 +11,7 @@ import QtQuick Item { id: root - property string source: Wallpapers.current + property string source: Paths.wallpaper property Image current: one onSourceChanged: { @@ -56,42 +56,6 @@ Item { font.pointSize: Appearance.font.size.extraLarge * 2 font.bold: true } - - StyledRect { - implicitWidth: selectWallText.implicitWidth + Appearance.padding.large * 2 - implicitHeight: selectWallText.implicitHeight + Appearance.padding.small * 2 - - radius: Appearance.rounding.full - color: Colours.palette.m3primary - - FileDialog { - id: dialog - - title: qsTr("Select a wallpaper") - filterLabel: qsTr("Image files") - filters: Images.validImageExtensions - onAccepted: path => Wallpapers.setWallpaper(path) - } - - StateLayer { - radius: parent.radius - color: Colours.palette.m3onPrimary - - function onClicked(): void { - dialog.open(); - } - } - - StyledText { - id: selectWallText - - anchors.centerIn: parent - - text: qsTr("Set it now!") - color: Colours.palette.m3onPrimary - font.pointSize: Appearance.font.size.large - } - } } } } @@ -118,7 +82,7 @@ Item { anchors.fill: parent opacity: 0 - scale: Wallpapers.showPreview ? 1 : 0.8 + scale: 0.8 onStatusChanged: { if (status === Image.Ready) diff --git a/modules/controlcenter/PaneRegistry.qml b/modules/controlcenter/PaneRegistry.qml index ca48551..20719ca 100644 --- a/modules/controlcenter/PaneRegistry.qml +++ b/modules/controlcenter/PaneRegistry.qml @@ -24,30 +24,6 @@ QtObject { readonly property string icon: "volume_up" readonly property string component: "audio/AudioPane.qml" }, - QtObject { - readonly property string id: "appearance" - readonly property string label: "appearance" - readonly property string icon: "palette" - readonly property string component: "appearance/AppearancePane.qml" - }, - QtObject { - readonly property string id: "taskbar" - readonly property string label: "taskbar" - readonly property string icon: "task_alt" - readonly property string component: "taskbar/TaskbarPane.qml" - }, - QtObject { - readonly property string id: "launcher" - readonly property string label: "launcher" - readonly property string icon: "apps" - readonly property string component: "launcher/LauncherPane.qml" - }, - QtObject { - readonly property string id: "dashboard" - readonly property string label: "dashboard" - readonly property string icon: "dashboard" - readonly property string component: "dashboard/DashboardPane.qml" - } ] readonly property int count: panes.length diff --git a/modules/controlcenter/Panes.qml b/modules/controlcenter/Panes.qml index ab2f808..4794c03 100644 --- a/modules/controlcenter/Panes.qml +++ b/modules/controlcenter/Panes.qml @@ -3,10 +3,6 @@ pragma ComponentBehavior: Bound import "bluetooth" import "network" import "audio" -import "appearance" -import "taskbar" -import "launcher" -import "dashboard" import qs.components import qs.services import qs.config diff --git a/modules/controlcenter/Session.qml b/modules/controlcenter/Session.qml index 8a8545f..b7dd888 100644 --- a/modules/controlcenter/Session.qml +++ b/modules/controlcenter/Session.qml @@ -14,8 +14,6 @@ QtObject { readonly property BluetoothState bt: BluetoothState {} readonly property NetworkState network: NetworkState {} readonly property EthernetState ethernet: EthernetState {} - readonly property LauncherState launcher: LauncherState {} - readonly property VpnState vpn: VpnState {} onActiveChanged: activeIndex = Math.max(0, panes.indexOf(active)) onActiveIndexChanged: if (panes[activeIndex]) diff --git a/modules/controlcenter/appearance/AppearancePane.qml b/modules/controlcenter/appearance/AppearancePane.qml deleted file mode 100644 index b4a3367..0000000 --- a/modules/controlcenter/appearance/AppearancePane.qml +++ /dev/null @@ -1,263 +0,0 @@ -pragma ComponentBehavior: Bound - -import ".." -import "../components" -import "./sections" -import "../../launcher/services" -import qs.components -import qs.components.controls -import qs.components.effects -import qs.components.containers -import qs.components.images -import qs.services -import qs.config -import qs.utils -import Caelestia.Models -import Quickshell -import Quickshell.Widgets -import QtQuick -import QtQuick.Layouts - -Item { - id: root - - required property Session session - - property real animDurationsScale: Config.appearance.anim.durations.scale ?? 1 - property string fontFamilyMaterial: Config.appearance.font.family.material ?? "Material Symbols Rounded" - property string fontFamilyMono: Config.appearance.font.family.mono ?? "CaskaydiaCove NF" - property string fontFamilySans: Config.appearance.font.family.sans ?? "Rubik" - property real fontSizeScale: Config.appearance.font.size.scale ?? 1 - property real paddingScale: Config.appearance.padding.scale ?? 1 - property real roundingScale: Config.appearance.rounding.scale ?? 1 - property real spacingScale: Config.appearance.spacing.scale ?? 1 - property bool transparencyEnabled: Config.appearance.transparency.enabled ?? false - property real transparencyBase: Config.appearance.transparency.base ?? 0.85 - property real transparencyLayers: Config.appearance.transparency.layers ?? 0.4 - property real borderRounding: Config.border.rounding ?? 1 - property real borderThickness: Config.border.thickness ?? 1 - - property bool desktopClockEnabled: Config.background.desktopClock.enabled ?? false - property real desktopClockScale: Config.background.desktopClock.scale ?? 1 - property string desktopClockPosition: Config.background.desktopClock.position ?? "bottom-right" - property bool desktopClockShadowEnabled: Config.background.desktopClock.shadow.enabled ?? true - property real desktopClockShadowOpacity: Config.background.desktopClock.shadow.opacity ?? 0.7 - property real desktopClockShadowBlur: Config.background.desktopClock.shadow.blur ?? 0.4 - property bool desktopClockBackgroundEnabled: Config.background.desktopClock.background.enabled ?? false - property real desktopClockBackgroundOpacity: Config.background.desktopClock.background.opacity ?? 0.7 - property bool desktopClockBackgroundBlur: Config.background.desktopClock.background.blur ?? false - property bool desktopClockInvertColors: Config.background.desktopClock.invertColors ?? false - property bool backgroundEnabled: Config.background.enabled ?? true - property bool wallpaperEnabled: Config.background.wallpaperEnabled ?? true - property bool visualiserEnabled: Config.background.visualiser.enabled ?? false - property bool visualiserAutoHide: Config.background.visualiser.autoHide ?? true - property real visualiserRounding: Config.background.visualiser.rounding ?? 1 - property real visualiserSpacing: Config.background.visualiser.spacing ?? 1 - - anchors.fill: parent - - function saveConfig() { - Config.appearance.anim.durations.scale = root.animDurationsScale; - - Config.appearance.font.family.material = root.fontFamilyMaterial; - Config.appearance.font.family.mono = root.fontFamilyMono; - Config.appearance.font.family.sans = root.fontFamilySans; - Config.appearance.font.size.scale = root.fontSizeScale; - - Config.appearance.padding.scale = root.paddingScale; - Config.appearance.rounding.scale = root.roundingScale; - Config.appearance.spacing.scale = root.spacingScale; - - Config.appearance.transparency.enabled = root.transparencyEnabled; - Config.appearance.transparency.base = root.transparencyBase; - Config.appearance.transparency.layers = root.transparencyLayers; - - Config.background.desktopClock.enabled = root.desktopClockEnabled; - Config.background.enabled = root.backgroundEnabled; - Config.background.desktopClock.scale = root.desktopClockScale; - Config.background.desktopClock.position = root.desktopClockPosition; - Config.background.desktopClock.shadow.enabled = root.desktopClockShadowEnabled; - Config.background.desktopClock.shadow.opacity = root.desktopClockShadowOpacity; - Config.background.desktopClock.shadow.blur = root.desktopClockShadowBlur; - Config.background.desktopClock.background.enabled = root.desktopClockBackgroundEnabled; - Config.background.desktopClock.background.opacity = root.desktopClockBackgroundOpacity; - Config.background.desktopClock.background.blur = root.desktopClockBackgroundBlur; - Config.background.desktopClock.invertColors = root.desktopClockInvertColors; - - Config.background.wallpaperEnabled = root.wallpaperEnabled; - - Config.background.visualiser.enabled = root.visualiserEnabled; - Config.background.visualiser.autoHide = root.visualiserAutoHide; - Config.background.visualiser.rounding = root.visualiserRounding; - Config.background.visualiser.spacing = root.visualiserSpacing; - - Config.border.rounding = root.borderRounding; - Config.border.thickness = root.borderThickness; - - Config.save(); - } - - Component { - id: appearanceRightContentComponent - - Item { - id: rightAppearanceFlickable - - ColumnLayout { - id: contentLayout - - anchors.fill: parent - spacing: 0 - - StyledText { - Layout.alignment: Qt.AlignHCenter - Layout.bottomMargin: Appearance.spacing.normal - text: qsTr("Wallpaper") - font.pointSize: Appearance.font.size.extraLarge - font.weight: 600 - } - - Loader { - id: wallpaperLoader - - Layout.fillWidth: true - Layout.fillHeight: true - Layout.bottomMargin: -Appearance.padding.large * 2 - - active: { - const isActive = root.session.activeIndex === 3; - const isAdjacent = Math.abs(root.session.activeIndex - 3) === 1; - const splitLayout = root.children[0]; - const loader = splitLayout && splitLayout.rightLoader ? splitLayout.rightLoader : null; - const shouldActivate = loader && loader.item !== null && (isActive || isAdjacent); - return shouldActivate; - } - - onStatusChanged: { - if (status === Loader.Error) { - console.error("[AppearancePane] Wallpaper loader error!"); - } - } - - sourceComponent: WallpaperGrid { - session: root.session - } - } - } - } - } - - SplitPaneLayout { - anchors.fill: parent - - leftContent: Component { - - StyledFlickable { - id: sidebarFlickable - readonly property var rootPane: root - flickableDirection: Flickable.VerticalFlick - contentHeight: sidebarLayout.height - - StyledScrollBar.vertical: StyledScrollBar { - flickable: sidebarFlickable - } - - ColumnLayout { - id: sidebarLayout - anchors.left: parent.left - anchors.right: parent.right - spacing: Appearance.spacing.small - - readonly property var rootPane: sidebarFlickable.rootPane - - readonly property bool allSectionsExpanded: - themeModeSection.expanded && - colorVariantSection.expanded && - colorSchemeSection.expanded && - animationsSection.expanded && - fontsSection.expanded && - scalesSection.expanded && - transparencySection.expanded && - borderSection.expanded && - backgroundSection.expanded - - RowLayout { - spacing: Appearance.spacing.smaller - - StyledText { - text: qsTr("Appearance") - font.pointSize: Appearance.font.size.large - font.weight: 500 - } - - Item { - Layout.fillWidth: true - } - - IconButton { - icon: sidebarLayout.allSectionsExpanded ? "unfold_less" : "unfold_more" - type: IconButton.Text - label.animate: true - onClicked: { - const shouldExpand = !sidebarLayout.allSectionsExpanded; - themeModeSection.expanded = shouldExpand; - colorVariantSection.expanded = shouldExpand; - colorSchemeSection.expanded = shouldExpand; - animationsSection.expanded = shouldExpand; - fontsSection.expanded = shouldExpand; - scalesSection.expanded = shouldExpand; - transparencySection.expanded = shouldExpand; - borderSection.expanded = shouldExpand; - backgroundSection.expanded = shouldExpand; - } - } - } - - ThemeModeSection { - id: themeModeSection - } - - ColorVariantSection { - id: colorVariantSection - } - - ColorSchemeSection { - id: colorSchemeSection - } - - AnimationsSection { - id: animationsSection - rootPane: sidebarFlickable.rootPane - } - - FontsSection { - id: fontsSection - rootPane: sidebarFlickable.rootPane - } - - ScalesSection { - id: scalesSection - rootPane: sidebarFlickable.rootPane - } - - TransparencySection { - id: transparencySection - rootPane: sidebarFlickable.rootPane - } - - BorderSection { - id: borderSection - rootPane: sidebarFlickable.rootPane - } - - BackgroundSection { - id: backgroundSection - rootPane: sidebarFlickable.rootPane - } - } - } - } - - rightContent: appearanceRightContentComponent - } -} diff --git a/modules/controlcenter/appearance/sections/AnimationsSection.qml b/modules/controlcenter/appearance/sections/AnimationsSection.qml deleted file mode 100644 index 0cba5ce..0000000 --- a/modules/controlcenter/appearance/sections/AnimationsSection.qml +++ /dev/null @@ -1,44 +0,0 @@ -pragma ComponentBehavior: Bound - -import ".." -import "../../components" -import qs.components -import qs.components.controls -import qs.components.containers -import qs.services -import qs.config -import QtQuick -import QtQuick.Layouts - -CollapsibleSection { - id: root - - required property var rootPane - - title: qsTr("Animations") - showBackground: true - - SectionContainer { - contentSpacing: Appearance.spacing.normal - - SliderInput { - Layout.fillWidth: true - - label: qsTr("Animation duration scale") - value: rootPane.animDurationsScale - from: 0.1 - to: 5.0 - decimals: 1 - suffix: "×" - validator: DoubleValidator { - bottom: 0.1 - top: 5.0 - } - - onValueModified: newValue => { - rootPane.animDurationsScale = newValue; - rootPane.saveConfig(); - } - } - } -} diff --git a/modules/controlcenter/appearance/sections/BackgroundSection.qml b/modules/controlcenter/appearance/sections/BackgroundSection.qml deleted file mode 100644 index 9d6bc6e..0000000 --- a/modules/controlcenter/appearance/sections/BackgroundSection.qml +++ /dev/null @@ -1,345 +0,0 @@ -pragma ComponentBehavior: Bound - -import ".." -import "../../components" -import qs.components -import qs.components.controls -import qs.components.containers -import qs.services -import qs.config -import QtQuick -import QtQuick.Layouts - -CollapsibleSection { - id: root - - required property var rootPane - - title: qsTr("Background") - showBackground: true - - SwitchRow { - label: qsTr("Background enabled") - checked: rootPane.backgroundEnabled - onToggled: checked => { - rootPane.backgroundEnabled = checked; - rootPane.saveConfig(); - } - } - - SwitchRow { - label: qsTr("Wallpaper enabled") - checked: rootPane.wallpaperEnabled - onToggled: checked => { - rootPane.wallpaperEnabled = checked; - rootPane.saveConfig(); - } - } - - StyledText { - Layout.topMargin: Appearance.spacing.normal - text: qsTr("Desktop Clock") - font.pointSize: Appearance.font.size.larger - font.weight: 500 - } - - SwitchRow { - label: qsTr("Desktop Clock enabled") - checked: rootPane.desktopClockEnabled - onToggled: checked => { - rootPane.desktopClockEnabled = checked; - rootPane.saveConfig(); - } - } - - SectionContainer { - id: posContainer - - contentSpacing: Appearance.spacing.small - z: 1 - - readonly property var pos: (rootPane.desktopClockPosition || "top-left").split('-') - readonly property string currentV: pos[0] - readonly property string currentH: pos[1] - - function updateClockPos(v, h) { - rootPane.desktopClockPosition = v + "-" + h; - rootPane.saveConfig(); - } - - StyledText { - text: qsTr("Positioning") - font.pointSize: Appearance.font.size.larger - font.weight: 500 - } - - SplitButtonRow { - label: qsTr("Vertical Position") - enabled: rootPane.desktopClockEnabled - - menuItems: [ - MenuItem { - text: qsTr("Top") - icon: "vertical_align_top" - property string val: "top" - }, - MenuItem { - text: qsTr("Middle") - icon: "vertical_align_center" - property string val: "middle" - }, - MenuItem { - text: qsTr("Bottom") - icon: "vertical_align_bottom" - property string val: "bottom" - } - ] - - Component.onCompleted: { - for (let i = 0; i < menuItems.length; i++) { - if (menuItems[i].val === posContainer.currentV) - active = menuItems[i]; - } - } - - // The signal from SplitButtonRow - onSelected: item => posContainer.updateClockPos(item.val, posContainer.currentH) - } - - SplitButtonRow { - label: qsTr("Horizontal Position") - enabled: rootPane.desktopClockEnabled - expandedZ: 99 - - menuItems: [ - MenuItem { - text: qsTr("Left") - icon: "align_horizontal_left" - property string val: "left" - }, - MenuItem { - text: qsTr("Center") - icon: "align_horizontal_center" - property string val: "center" - }, - MenuItem { - text: qsTr("Right") - icon: "align_horizontal_right" - property string val: "right" - } - ] - - Component.onCompleted: { - for (let i = 0; i < menuItems.length; i++) { - if (menuItems[i].val === posContainer.currentH) - active = menuItems[i]; - } - } - - onSelected: item => posContainer.updateClockPos(posContainer.currentV, item.val) - } - } - - SwitchRow { - label: qsTr("Invert colors") - checked: rootPane.desktopClockInvertColors - onToggled: checked => { - rootPane.desktopClockInvertColors = checked; - rootPane.saveConfig(); - } - } - - SectionContainer { - contentSpacing: Appearance.spacing.small - - StyledText { - text: qsTr("Shadow") - font.pointSize: Appearance.font.size.larger - font.weight: 500 - } - - SwitchRow { - label: qsTr("Enabled") - checked: rootPane.desktopClockShadowEnabled - onToggled: checked => { - rootPane.desktopClockShadowEnabled = checked; - rootPane.saveConfig(); - } - } - - SectionContainer { - contentSpacing: Appearance.spacing.normal - - SliderInput { - Layout.fillWidth: true - - label: qsTr("Opacity") - value: rootPane.desktopClockShadowOpacity * 100 - from: 0 - to: 100 - suffix: "%" - validator: IntValidator { - bottom: 0 - top: 100 - } - formatValueFunction: val => Math.round(val).toString() - parseValueFunction: text => parseInt(text) - - onValueModified: newValue => { - rootPane.desktopClockShadowOpacity = newValue / 100; - rootPane.saveConfig(); - } - } - } - - SectionContainer { - contentSpacing: Appearance.spacing.normal - - SliderInput { - Layout.fillWidth: true - - label: qsTr("Blur") - value: rootPane.desktopClockShadowBlur * 100 - from: 0 - to: 100 - suffix: "%" - validator: IntValidator { - bottom: 0 - top: 100 - } - formatValueFunction: val => Math.round(val).toString() - parseValueFunction: text => parseInt(text) - - onValueModified: newValue => { - rootPane.desktopClockShadowBlur = newValue / 100; - rootPane.saveConfig(); - } - } - } - } - - SectionContainer { - contentSpacing: Appearance.spacing.small - - StyledText { - text: qsTr("Background") - font.pointSize: Appearance.font.size.larger - font.weight: 500 - } - - SwitchRow { - label: qsTr("Enabled") - checked: rootPane.desktopClockBackgroundEnabled - onToggled: checked => { - rootPane.desktopClockBackgroundEnabled = checked; - rootPane.saveConfig(); - } - } - - SwitchRow { - label: qsTr("Blur enabled") - checked: rootPane.desktopClockBackgroundBlur - onToggled: checked => { - rootPane.desktopClockBackgroundBlur = checked; - rootPane.saveConfig(); - } - } - - SectionContainer { - contentSpacing: Appearance.spacing.normal - - SliderInput { - Layout.fillWidth: true - - label: qsTr("Opacity") - value: rootPane.desktopClockBackgroundOpacity * 100 - from: 0 - to: 100 - suffix: "%" - validator: IntValidator { - bottom: 0 - top: 100 - } - formatValueFunction: val => Math.round(val).toString() - parseValueFunction: text => parseInt(text) - - onValueModified: newValue => { - rootPane.desktopClockBackgroundOpacity = newValue / 100; - rootPane.saveConfig(); - } - } - } - } - - StyledText { - Layout.topMargin: Appearance.spacing.normal - text: qsTr("Visualiser") - font.pointSize: Appearance.font.size.larger - font.weight: 500 - } - - SwitchRow { - label: qsTr("Visualiser enabled") - checked: rootPane.visualiserEnabled - onToggled: checked => { - rootPane.visualiserEnabled = checked; - rootPane.saveConfig(); - } - } - - SwitchRow { - label: qsTr("Visualiser auto hide") - checked: rootPane.visualiserAutoHide - onToggled: checked => { - rootPane.visualiserAutoHide = checked; - rootPane.saveConfig(); - } - } - - SectionContainer { - contentSpacing: Appearance.spacing.normal - - SliderInput { - Layout.fillWidth: true - - label: qsTr("Visualiser rounding") - value: rootPane.visualiserRounding - from: 0 - to: 10 - stepSize: 1 - validator: IntValidator { - bottom: 0 - top: 10 - } - formatValueFunction: val => Math.round(val).toString() - parseValueFunction: text => parseInt(text) - - onValueModified: newValue => { - rootPane.visualiserRounding = Math.round(newValue); - rootPane.saveConfig(); - } - } - } - - SectionContainer { - contentSpacing: Appearance.spacing.normal - - SliderInput { - Layout.fillWidth: true - - label: qsTr("Visualiser spacing") - value: rootPane.visualiserSpacing - from: 0 - to: 2 - validator: DoubleValidator { - bottom: 0 - top: 2 - } - - onValueModified: newValue => { - rootPane.visualiserSpacing = newValue; - rootPane.saveConfig(); - } - } - } -} diff --git a/modules/controlcenter/appearance/sections/BorderSection.qml b/modules/controlcenter/appearance/sections/BorderSection.qml deleted file mode 100644 index 9532d70..0000000 --- a/modules/controlcenter/appearance/sections/BorderSection.qml +++ /dev/null @@ -1,68 +0,0 @@ -pragma ComponentBehavior: Bound - -import ".." -import "../../components" -import qs.components -import qs.components.controls -import qs.components.containers -import qs.services -import qs.config -import QtQuick -import QtQuick.Layouts - -CollapsibleSection { - id: root - - required property var rootPane - - title: qsTr("Border") - showBackground: true - - SectionContainer { - contentSpacing: Appearance.spacing.normal - - SliderInput { - Layout.fillWidth: true - - label: qsTr("Border rounding") - value: rootPane.borderRounding - from: 0.1 - to: 100 - decimals: 1 - suffix: "px" - validator: DoubleValidator { - bottom: 0.1 - top: 100 - } - - onValueModified: newValue => { - rootPane.borderRounding = newValue; - rootPane.saveConfig(); - } - } - } - - SectionContainer { - contentSpacing: Appearance.spacing.normal - - SliderInput { - Layout.fillWidth: true - - label: qsTr("Border thickness") - value: rootPane.borderThickness - from: 0.1 - to: 100 - decimals: 1 - suffix: "px" - validator: DoubleValidator { - bottom: 0.1 - top: 100 - } - - onValueModified: newValue => { - rootPane.borderThickness = newValue; - rootPane.saveConfig(); - } - } - } -} diff --git a/modules/controlcenter/appearance/sections/ColorSchemeSection.qml b/modules/controlcenter/appearance/sections/ColorSchemeSection.qml deleted file mode 100644 index 95cb4b7..0000000 --- a/modules/controlcenter/appearance/sections/ColorSchemeSection.qml +++ /dev/null @@ -1,145 +0,0 @@ -pragma ComponentBehavior: Bound - -import ".." -import "../../../launcher/services" -import qs.components -import qs.components.controls -import qs.components.containers -import qs.services -import qs.config -import Quickshell -import QtQuick -import QtQuick.Layouts - -CollapsibleSection { - title: qsTr("Color scheme") - description: qsTr("Available color schemes") - showBackground: true - - ColumnLayout { - Layout.fillWidth: true - spacing: Appearance.spacing.small / 2 - - Repeater { - model: Schemes.list - - delegate: StyledRect { - required property var modelData - - Layout.fillWidth: true - - readonly property string schemeKey: `${modelData.name} ${modelData.flavour}` - readonly property bool isCurrent: schemeKey === Schemes.currentScheme - - color: Qt.alpha(Colours.tPalette.m3surfaceContainer, isCurrent ? Colours.tPalette.m3surfaceContainer.a : 0) - radius: Appearance.rounding.normal - border.width: isCurrent ? 1 : 0 - border.color: Colours.palette.m3primary - - StateLayer { - function onClicked(): void { - const name = modelData.name; - const flavour = modelData.flavour; - const schemeKey = `${name} ${flavour}`; - - Schemes.currentScheme = schemeKey; - Quickshell.execDetached(["caelestia", "scheme", "set", "-n", name, "-f", flavour]); - - Qt.callLater(() => { - reloadTimer.restart(); - }); - } - } - - Timer { - id: reloadTimer - interval: 300 - onTriggered: { - Schemes.reload(); - } - } - - RowLayout { - id: schemeRow - - anchors.fill: parent - anchors.margins: Appearance.padding.normal - - spacing: Appearance.spacing.normal - - StyledRect { - id: preview - - Layout.alignment: Qt.AlignVCenter - - border.width: 1 - border.color: Qt.alpha(`#${modelData.colours?.outline}`, 0.5) - - color: `#${modelData.colours?.surface}` - radius: Appearance.rounding.full - implicitWidth: iconPlaceholder.implicitWidth - implicitHeight: iconPlaceholder.implicitWidth - - MaterialIcon { - id: iconPlaceholder - visible: false - text: "circle" - font.pointSize: Appearance.font.size.large - } - - Item { - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.right: parent.right - - implicitWidth: parent.implicitWidth / 2 - clip: true - - StyledRect { - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.right: parent.right - - implicitWidth: preview.implicitWidth - color: `#${modelData.colours?.primary}` - radius: Appearance.rounding.full - } - } - } - - Column { - Layout.fillWidth: true - spacing: 0 - - StyledText { - text: modelData.flavour ?? "" - font.pointSize: Appearance.font.size.normal - } - - StyledText { - text: modelData.name ?? "" - font.pointSize: Appearance.font.size.small - color: Colours.palette.m3outline - - elide: Text.ElideRight - anchors.left: parent.left - anchors.right: parent.right - } - } - - Loader { - active: isCurrent - - sourceComponent: MaterialIcon { - text: "check" - color: Colours.palette.m3onSurfaceVariant - font.pointSize: Appearance.font.size.large - } - } - } - - implicitHeight: schemeRow.implicitHeight + Appearance.padding.normal * 2 - } - } - } -} diff --git a/modules/controlcenter/appearance/sections/ColorVariantSection.qml b/modules/controlcenter/appearance/sections/ColorVariantSection.qml deleted file mode 100644 index 3aa17dd..0000000 --- a/modules/controlcenter/appearance/sections/ColorVariantSection.qml +++ /dev/null @@ -1,91 +0,0 @@ -pragma ComponentBehavior: Bound - -import ".." -import "../../../launcher/services" -import qs.components -import qs.components.controls -import qs.components.containers -import qs.services -import qs.config -import Quickshell -import QtQuick -import QtQuick.Layouts - -CollapsibleSection { - title: qsTr("Color variant") - description: qsTr("Material theme variant") - showBackground: true - - ColumnLayout { - Layout.fillWidth: true - spacing: Appearance.spacing.small / 2 - - Repeater { - model: M3Variants.list - - delegate: StyledRect { - required property var modelData - - Layout.fillWidth: true - - color: Qt.alpha(Colours.tPalette.m3surfaceContainer, modelData.variant === Schemes.currentVariant ? Colours.tPalette.m3surfaceContainer.a : 0) - radius: Appearance.rounding.normal - border.width: modelData.variant === Schemes.currentVariant ? 1 : 0 - border.color: Colours.palette.m3primary - - StateLayer { - function onClicked(): void { - const variant = modelData.variant; - - Schemes.currentVariant = variant; - Quickshell.execDetached(["caelestia", "scheme", "set", "-v", variant]); - - Qt.callLater(() => { - reloadTimer.restart(); - }); - } - } - - Timer { - id: reloadTimer - interval: 300 - onTriggered: { - Schemes.reload(); - } - } - - RowLayout { - id: variantRow - - anchors.left: parent.left - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - anchors.margins: Appearance.padding.normal - - spacing: Appearance.spacing.normal - - MaterialIcon { - text: modelData.icon - font.pointSize: Appearance.font.size.large - fill: modelData.variant === Schemes.currentVariant ? 1 : 0 - } - - StyledText { - Layout.fillWidth: true - text: modelData.name - font.weight: modelData.variant === Schemes.currentVariant ? 500 : 400 - } - - MaterialIcon { - visible: modelData.variant === Schemes.currentVariant - text: "check" - color: Colours.palette.m3primary - font.pointSize: Appearance.font.size.large - } - } - - implicitHeight: variantRow.implicitHeight + Appearance.padding.normal * 2 - } - } - } -} diff --git a/modules/controlcenter/appearance/sections/FontsSection.qml b/modules/controlcenter/appearance/sections/FontsSection.qml deleted file mode 100644 index 3988863..0000000 --- a/modules/controlcenter/appearance/sections/FontsSection.qml +++ /dev/null @@ -1,282 +0,0 @@ -pragma ComponentBehavior: Bound - -import ".." -import "../../components" -import qs.components -import qs.components.controls -import qs.components.containers -import qs.services -import qs.config -import QtQuick -import QtQuick.Layouts - -CollapsibleSection { - id: root - - required property var rootPane - - title: qsTr("Fonts") - showBackground: true - - CollapsibleSection { - id: materialFontSection - title: qsTr("Material font family") - expanded: true - showBackground: true - nested: true - - Loader { - id: materialFontLoader - Layout.fillWidth: true - Layout.preferredHeight: item ? Math.min(item.contentHeight, 300) : 0 - active: materialFontSection.expanded - - sourceComponent: StyledListView { - id: materialFontList - property alias contentHeight: materialFontList.contentHeight - - clip: true - spacing: Appearance.spacing.small / 2 - model: Qt.fontFamilies() - - StyledScrollBar.vertical: StyledScrollBar { - flickable: materialFontList - } - - delegate: StyledRect { - required property string modelData - required property int index - - width: ListView.view.width - - readonly property bool isCurrent: modelData === rootPane.fontFamilyMaterial - color: Qt.alpha(Colours.tPalette.m3surfaceContainer, isCurrent ? Colours.tPalette.m3surfaceContainer.a : 0) - radius: Appearance.rounding.normal - border.width: isCurrent ? 1 : 0 - border.color: Colours.palette.m3primary - - StateLayer { - function onClicked(): void { - rootPane.fontFamilyMaterial = modelData; - rootPane.saveConfig(); - } - } - - RowLayout { - id: fontFamilyMaterialRow - - anchors.left: parent.left - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - anchors.margins: Appearance.padding.normal - - spacing: Appearance.spacing.normal - - StyledText { - text: modelData - font.pointSize: Appearance.font.size.normal - } - - Item { - Layout.fillWidth: true - } - - Loader { - active: isCurrent - - sourceComponent: MaterialIcon { - text: "check" - color: Colours.palette.m3onSurfaceVariant - font.pointSize: Appearance.font.size.large - } - } - } - - implicitHeight: fontFamilyMaterialRow.implicitHeight + Appearance.padding.normal * 2 - } - } - } - } - - CollapsibleSection { - id: monoFontSection - title: qsTr("Monospace font family") - expanded: false - showBackground: true - nested: true - - Loader { - Layout.fillWidth: true - Layout.preferredHeight: item ? Math.min(item.contentHeight, 300) : 0 - active: monoFontSection.expanded - - sourceComponent: StyledListView { - id: monoFontList - property alias contentHeight: monoFontList.contentHeight - - clip: true - spacing: Appearance.spacing.small / 2 - model: Qt.fontFamilies() - - StyledScrollBar.vertical: StyledScrollBar { - flickable: monoFontList - } - - delegate: StyledRect { - required property string modelData - required property int index - - width: ListView.view.width - - readonly property bool isCurrent: modelData === rootPane.fontFamilyMono - color: Qt.alpha(Colours.tPalette.m3surfaceContainer, isCurrent ? Colours.tPalette.m3surfaceContainer.a : 0) - radius: Appearance.rounding.normal - border.width: isCurrent ? 1 : 0 - border.color: Colours.palette.m3primary - - StateLayer { - function onClicked(): void { - rootPane.fontFamilyMono = modelData; - rootPane.saveConfig(); - } - } - - RowLayout { - id: fontFamilyMonoRow - - anchors.left: parent.left - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - anchors.margins: Appearance.padding.normal - - spacing: Appearance.spacing.normal - - StyledText { - text: modelData - font.pointSize: Appearance.font.size.normal - } - - Item { - Layout.fillWidth: true - } - - Loader { - active: isCurrent - - sourceComponent: MaterialIcon { - text: "check" - color: Colours.palette.m3onSurfaceVariant - font.pointSize: Appearance.font.size.large - } - } - } - - implicitHeight: fontFamilyMonoRow.implicitHeight + Appearance.padding.normal * 2 - } - } - } - } - - CollapsibleSection { - id: sansFontSection - title: qsTr("Sans-serif font family") - expanded: false - showBackground: true - nested: true - - Loader { - Layout.fillWidth: true - Layout.preferredHeight: item ? Math.min(item.contentHeight, 300) : 0 - active: sansFontSection.expanded - - sourceComponent: StyledListView { - id: sansFontList - property alias contentHeight: sansFontList.contentHeight - - clip: true - spacing: Appearance.spacing.small / 2 - model: Qt.fontFamilies() - - StyledScrollBar.vertical: StyledScrollBar { - flickable: sansFontList - } - - delegate: StyledRect { - required property string modelData - required property int index - - width: ListView.view.width - - readonly property bool isCurrent: modelData === rootPane.fontFamilySans - color: Qt.alpha(Colours.tPalette.m3surfaceContainer, isCurrent ? Colours.tPalette.m3surfaceContainer.a : 0) - radius: Appearance.rounding.normal - border.width: isCurrent ? 1 : 0 - border.color: Colours.palette.m3primary - - StateLayer { - function onClicked(): void { - rootPane.fontFamilySans = modelData; - rootPane.saveConfig(); - } - } - - RowLayout { - id: fontFamilySansRow - - anchors.left: parent.left - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - anchors.margins: Appearance.padding.normal - - spacing: Appearance.spacing.normal - - StyledText { - text: modelData - font.pointSize: Appearance.font.size.normal - } - - Item { - Layout.fillWidth: true - } - - Loader { - active: isCurrent - - sourceComponent: MaterialIcon { - text: "check" - color: Colours.palette.m3onSurfaceVariant - font.pointSize: Appearance.font.size.large - } - } - } - - implicitHeight: fontFamilySansRow.implicitHeight + Appearance.padding.normal * 2 - } - } - } - } - - SectionContainer { - contentSpacing: Appearance.spacing.normal - - SliderInput { - Layout.fillWidth: true - - label: qsTr("Font size scale") - value: rootPane.fontSizeScale - from: 0.7 - to: 1.5 - decimals: 2 - suffix: "×" - validator: DoubleValidator { - bottom: 0.7 - top: 1.5 - } - - onValueModified: newValue => { - rootPane.fontSizeScale = newValue; - rootPane.saveConfig(); - } - } - } -} diff --git a/modules/controlcenter/appearance/sections/ScalesSection.qml b/modules/controlcenter/appearance/sections/ScalesSection.qml deleted file mode 100644 index b0e6e38..0000000 --- a/modules/controlcenter/appearance/sections/ScalesSection.qml +++ /dev/null @@ -1,92 +0,0 @@ -pragma ComponentBehavior: Bound - -import ".." -import "../../components" -import qs.components -import qs.components.controls -import qs.components.containers -import qs.services -import qs.config -import QtQuick -import QtQuick.Layouts - -CollapsibleSection { - id: root - - required property var rootPane - - title: qsTr("Scales") - showBackground: true - - SectionContainer { - contentSpacing: Appearance.spacing.normal - - SliderInput { - Layout.fillWidth: true - - label: qsTr("Padding scale") - value: rootPane.paddingScale - from: 0.5 - to: 2.0 - decimals: 1 - suffix: "×" - validator: DoubleValidator { - bottom: 0.5 - top: 2.0 - } - - onValueModified: newValue => { - rootPane.paddingScale = newValue; - rootPane.saveConfig(); - } - } - } - - SectionContainer { - contentSpacing: Appearance.spacing.normal - - SliderInput { - Layout.fillWidth: true - - label: qsTr("Rounding scale") - value: rootPane.roundingScale - from: 0.1 - to: 5.0 - decimals: 1 - suffix: "×" - validator: DoubleValidator { - bottom: 0.1 - top: 5.0 - } - - onValueModified: newValue => { - rootPane.roundingScale = newValue; - rootPane.saveConfig(); - } - } - } - - SectionContainer { - contentSpacing: Appearance.spacing.normal - - SliderInput { - Layout.fillWidth: true - - label: qsTr("Spacing scale") - value: rootPane.spacingScale - from: 0.1 - to: 2.0 - decimals: 1 - suffix: "×" - validator: DoubleValidator { - bottom: 0.1 - top: 2.0 - } - - onValueModified: newValue => { - rootPane.spacingScale = newValue; - rootPane.saveConfig(); - } - } - } -} diff --git a/modules/controlcenter/appearance/sections/ThemeModeSection.qml b/modules/controlcenter/appearance/sections/ThemeModeSection.qml deleted file mode 100644 index 04eed91..0000000 --- a/modules/controlcenter/appearance/sections/ThemeModeSection.qml +++ /dev/null @@ -1,23 +0,0 @@ -pragma ComponentBehavior: Bound - -import ".." -import qs.components -import qs.components.controls -import qs.components.containers -import qs.services -import qs.config -import QtQuick - -CollapsibleSection { - title: qsTr("Theme mode") - description: qsTr("Light or dark theme") - showBackground: true - - SwitchRow { - label: qsTr("Dark mode") - checked: !Colours.currentLight - onToggled: checked => { - Colours.setMode(checked ? "dark" : "light"); - } - } -} diff --git a/modules/controlcenter/appearance/sections/TransparencySection.qml b/modules/controlcenter/appearance/sections/TransparencySection.qml deleted file mode 100644 index 9a48629..0000000 --- a/modules/controlcenter/appearance/sections/TransparencySection.qml +++ /dev/null @@ -1,79 +0,0 @@ -pragma ComponentBehavior: Bound - -import ".." -import "../../components" -import qs.components -import qs.components.controls -import qs.components.containers -import qs.services -import qs.config -import QtQuick -import QtQuick.Layouts - -CollapsibleSection { - id: root - - required property var rootPane - - title: qsTr("Transparency") - showBackground: true - - SwitchRow { - label: qsTr("Transparency enabled") - checked: rootPane.transparencyEnabled - onToggled: checked => { - rootPane.transparencyEnabled = checked; - rootPane.saveConfig(); - } - } - - SectionContainer { - contentSpacing: Appearance.spacing.normal - - SliderInput { - Layout.fillWidth: true - - label: qsTr("Transparency base") - value: rootPane.transparencyBase * 100 - from: 0 - to: 100 - suffix: "%" - validator: IntValidator { - bottom: 0 - top: 100 - } - formatValueFunction: val => Math.round(val).toString() - parseValueFunction: text => parseInt(text) - - onValueModified: newValue => { - rootPane.transparencyBase = newValue / 100; - rootPane.saveConfig(); - } - } - } - - SectionContainer { - contentSpacing: Appearance.spacing.normal - - SliderInput { - Layout.fillWidth: true - - label: qsTr("Transparency layers") - value: rootPane.transparencyLayers * 100 - from: 0 - to: 100 - suffix: "%" - validator: IntValidator { - bottom: 0 - top: 100 - } - formatValueFunction: val => Math.round(val).toString() - parseValueFunction: text => parseInt(text) - - onValueModified: newValue => { - rootPane.transparencyLayers = newValue / 100; - rootPane.saveConfig(); - } - } - } -} diff --git a/modules/controlcenter/components/ConnectedButtonGroup.qml b/modules/controlcenter/components/ConnectedButtonGroup.qml deleted file mode 100644 index ab707fb..0000000 --- a/modules/controlcenter/components/ConnectedButtonGroup.qml +++ /dev/null @@ -1,115 +0,0 @@ -import ".." -import qs.components -import qs.components.controls -import qs.components.effects -import qs.services -import qs.config -import QtQuick -import QtQuick.Layouts - -StyledRect { - id: root - - property var options: [] // Array of {label: string, propertyName: string, onToggled: function, state: bool?} - property var rootItem: null // The root item that contains the properties we want to bind to - property string title: "" // Optional title text - property int rows: 1 // Number of rows - - Layout.fillWidth: true - implicitHeight: layout.implicitHeight + Appearance.padding.large * 2 - radius: Appearance.rounding.normal - color: Colours.layer(Colours.palette.m3surfaceContainer, 2) - clip: true - - Behavior on implicitHeight { - Anim {} - } - - ColumnLayout { - id: layout - - anchors.fill: parent - anchors.margins: Appearance.padding.large - spacing: Appearance.spacing.normal - - StyledText { - visible: root.title !== "" - text: root.title - font.pointSize: Appearance.font.size.normal - } - - GridLayout { - id: buttonGrid - Layout.alignment: Qt.AlignHCenter - rowSpacing: Appearance.spacing.small - columnSpacing: Appearance.spacing.small - rows: root.rows - columns: Math.ceil(root.options.length / root.rows) - - Repeater { - id: repeater - model: root.options - - delegate: TextButton { - id: button - required property int index - required property var modelData - - Layout.fillWidth: true - text: modelData.label - - property bool _checked: false - - checked: _checked - toggle: false - type: TextButton.Tonal - - // Create binding in Component.onCompleted - Component.onCompleted: { - if (modelData.state !== undefined && modelData.state) { - _checked = modelData.state; - } - else if (root.rootItem && modelData.propertyName) { - const propName = modelData.propertyName; - const rootItem = root.rootItem; - _checked = Qt.binding(function () { - return rootItem[propName] ?? false; - }); - } - } - - // Match utilities Toggles radius styling - // Each button has full rounding (not connected) since they have spacing - radius: stateLayer.pressed ? Appearance.rounding.small / 2 : internalChecked ? Appearance.rounding.small : Appearance.rounding.normal - - // Match utilities Toggles inactive color - inactiveColour: Colours.layer(Colours.palette.m3surfaceContainerHighest, 2) - - // Adjust width similar to utilities toggles - Layout.preferredWidth: implicitWidth + (stateLayer.pressed ? Appearance.padding.large : internalChecked ? Appearance.padding.smaller : 0) - - onClicked: { - if (modelData.onToggled && root.rootItem && modelData.propertyName) { - const currentValue = root.rootItem[modelData.propertyName] ?? false; - modelData.onToggled(!currentValue); - } - } - - Behavior on Layout.preferredWidth { - Anim { - duration: Appearance.anim.durations.expressiveFastSpatial - easing.bezierCurve: Appearance.anim.curves.expressiveFastSpatial - } - } - - Behavior on radius { - Anim { - duration: Appearance.anim.durations.expressiveFastSpatial - easing.bezierCurve: Appearance.anim.curves.expressiveFastSpatial - } - } - } - } - } - } -} diff --git a/modules/controlcenter/launcher/LauncherPane.qml b/modules/controlcenter/launcher/LauncherPane.qml deleted file mode 100644 index b236cf9..0000000 --- a/modules/controlcenter/launcher/LauncherPane.qml +++ /dev/null @@ -1,658 +0,0 @@ -pragma ComponentBehavior: Bound - -import ".." -import "../components" -import "../../launcher/services" -import qs.components -import qs.components.controls -import qs.components.effects -import qs.components.containers -import qs.services -import qs.config -import qs.utils -import Caelestia -import Quickshell -import Quickshell.Widgets -import QtQuick -import QtQuick.Layouts -import "../../../utils/scripts/fuzzysort.js" as Fuzzy - -Item { - id: root - - required property Session session - - property var selectedApp: root.session.launcher.active - property bool hideFromLauncherChecked: false - property bool favouriteChecked: false - - anchors.fill: parent - - onSelectedAppChanged: { - root.session.launcher.active = root.selectedApp; - updateToggleState(); - } - - Connections { - target: root.session.launcher - function onActiveChanged() { - root.selectedApp = root.session.launcher.active; - updateToggleState(); - } - } - - function updateToggleState() { - if (!root.selectedApp) { - root.hideFromLauncherChecked = false; - root.favouriteChecked = false; - return; - } - - const appId = root.selectedApp.id || root.selectedApp.entry?.id; - - root.hideFromLauncherChecked = Config.launcher.hiddenApps && Config.launcher.hiddenApps.length > 0 && Strings.testRegexList(Config.launcher.hiddenApps, appId); - root.favouriteChecked = Config.launcher.favouriteApps && Config.launcher.favouriteApps.length > 0 && Strings.testRegexList(Config.launcher.favouriteApps, appId); - } - - function saveHiddenApps(isHidden) { - if (!root.selectedApp) { - return; - } - - const appId = root.selectedApp.id || root.selectedApp.entry?.id; - - const hiddenApps = Config.launcher.hiddenApps ? [...Config.launcher.hiddenApps] : []; - - if (isHidden) { - if (!hiddenApps.includes(appId)) { - hiddenApps.push(appId); - } - } else { - const index = hiddenApps.indexOf(appId); - if (index !== -1) { - hiddenApps.splice(index, 1); - } - } - - Config.launcher.hiddenApps = hiddenApps; - Config.save(); - } - - AppDb { - id: allAppsDb - - path: `${Paths.state}/apps.sqlite` - favouriteApps: Config.launcher.favouriteApps - entries: DesktopEntries.applications.values - } - - property string searchText: "" - - function filterApps(search: string): list<var> { - if (!search || search.trim() === "") { - const apps = []; - for (let i = 0; i < allAppsDb.apps.length; i++) { - apps.push(allAppsDb.apps[i]); - } - return apps; - } - - if (!allAppsDb.apps || allAppsDb.apps.length === 0) { - return []; - } - - const preparedApps = []; - for (let i = 0; i < allAppsDb.apps.length; i++) { - const app = allAppsDb.apps[i]; - const name = app.name || app.entry?.name || ""; - preparedApps.push({ - _item: app, - name: Fuzzy.prepare(name) - }); - } - - const results = Fuzzy.go(search, preparedApps, { - all: true, - keys: ["name"], - scoreFn: r => r[0].score - }); - - return results.sort((a, b) => b._score - a._score).map(r => r.obj._item); - } - - property list<var> filteredApps: [] - - function updateFilteredApps() { - filteredApps = filterApps(searchText); - } - - onSearchTextChanged: { - updateFilteredApps(); - } - - Component.onCompleted: { - updateFilteredApps(); - } - - Connections { - target: allAppsDb - function onAppsChanged() { - updateFilteredApps(); - } - } - - SplitPaneLayout { - anchors.fill: parent - - leftContent: Component { - - ColumnLayout { - id: leftLauncherLayout - anchors.fill: parent - - spacing: Appearance.spacing.small - - RowLayout { - spacing: Appearance.spacing.smaller - - StyledText { - text: qsTr("Launcher") - font.pointSize: Appearance.font.size.large - font.weight: 500 - } - - Item { - Layout.fillWidth: true - } - - ToggleButton { - toggled: !root.session.launcher.active - icon: "settings" - accent: "Primary" - iconSize: Appearance.font.size.normal - horizontalPadding: Appearance.padding.normal - verticalPadding: Appearance.padding.smaller - tooltip: qsTr("Launcher settings") - - onClicked: { - if (root.session.launcher.active) { - root.session.launcher.active = null; - } else { - if (root.filteredApps.length > 0) { - root.session.launcher.active = root.filteredApps[0]; - } - } - } - } - } - - StyledText { - Layout.topMargin: Appearance.spacing.large - text: qsTr("Applications (%1)").arg(root.searchText ? root.filteredApps.length : allAppsDb.apps.length) - font.pointSize: Appearance.font.size.normal - font.weight: 500 - } - - StyledText { - text: qsTr("All applications available in the launcher") - color: Colours.palette.m3outline - } - - StyledRect { - Layout.fillWidth: true - Layout.topMargin: Appearance.spacing.normal - Layout.bottomMargin: Appearance.spacing.small - - color: Colours.layer(Colours.palette.m3surfaceContainer, 2) - radius: Appearance.rounding.full - - implicitHeight: Math.max(searchIcon.implicitHeight, searchField.implicitHeight, clearIcon.implicitHeight) - - MaterialIcon { - id: searchIcon - - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: Appearance.padding.normal - - text: "search" - color: Colours.palette.m3onSurfaceVariant - } - - StyledTextField { - id: searchField - - anchors.left: searchIcon.right - anchors.right: clearIcon.left - anchors.leftMargin: Appearance.spacing.small - anchors.rightMargin: Appearance.spacing.small - - topPadding: Appearance.padding.normal - bottomPadding: Appearance.padding.normal - - placeholderText: qsTr("Search applications...") - - onTextChanged: { - root.searchText = text; - } - } - - MaterialIcon { - id: clearIcon - - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - anchors.rightMargin: Appearance.padding.normal - - width: searchField.text ? implicitWidth : implicitWidth / 2 - opacity: { - if (!searchField.text) - return 0; - if (clearMouse.pressed) - return 0.7; - if (clearMouse.containsMouse) - return 0.8; - return 1; - } - - text: "close" - color: Colours.palette.m3onSurfaceVariant - - MouseArea { - id: clearMouse - - anchors.fill: parent - hoverEnabled: true - cursorShape: searchField.text ? Qt.PointingHandCursor : undefined - - onClicked: searchField.text = "" - } - - Behavior on width { - Anim { - duration: Appearance.anim.durations.small - } - } - - Behavior on opacity { - Anim { - duration: Appearance.anim.durations.small - } - } - } - } - - Loader { - id: appsListLoader - Layout.fillWidth: true - Layout.fillHeight: true - asynchronous: true - active: true - - sourceComponent: StyledListView { - id: appsListView - - Layout.fillWidth: true - Layout.fillHeight: true - - model: root.filteredApps - spacing: Appearance.spacing.small / 2 - clip: true - - StyledScrollBar.vertical: StyledScrollBar { - flickable: parent - } - - delegate: StyledRect { - required property var modelData - - width: parent ? parent.width : 0 - implicitHeight: 40 - - readonly property bool isSelected: root.selectedApp === modelData - - color: isSelected ? Colours.layer(Colours.palette.m3surfaceContainer, 2) : "transparent" - radius: Appearance.rounding.normal - - opacity: 0 - - Behavior on opacity { - NumberAnimation { - duration: 1000 - easing.type: Easing.OutCubic - } - } - - Component.onCompleted: { - opacity = 1; - } - - StateLayer { - function onClicked(): void { - root.session.launcher.active = modelData; - } - } - - RowLayout { - anchors.left: parent.left - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - anchors.margins: Appearance.padding.normal - - spacing: Appearance.spacing.normal - - IconImage { - Layout.alignment: Qt.AlignVCenter - implicitSize: 32 - source: { - const entry = modelData.entry; - return entry ? Quickshell.iconPath(entry.icon, "image-missing") : "image-missing"; - } - } - - StyledText { - Layout.fillWidth: true - text: modelData.name || modelData.entry?.name || qsTr("Unknown") - font.pointSize: Appearance.font.size.normal - } - - Loader { - Layout.alignment: Qt.AlignVCenter - readonly property bool isHidden: modelData ? Strings.testRegexList(Config.launcher.hiddenApps, modelData.id) : false - readonly property bool isFav: modelData ? Strings.testRegexList(Config.launcher.favouriteApps, modelData.id) : false - active: isHidden || isFav - - sourceComponent: isHidden ? hiddenIcon : (isFav ? favouriteIcon : null) - } - - Component { - id: hiddenIcon - MaterialIcon { - text: "visibility_off" - fill: 1 - color: Colours.palette.m3primary - } - } - - Component { - id: favouriteIcon - MaterialIcon { - text: "favorite" - fill: 1 - color: Colours.palette.m3primary - } - } - } - } - } - } - } - } - - rightContent: Component { - Item { - id: rightLauncherPane - - property var pane: root.session.launcher.active - property string paneId: pane ? (pane.id || pane.entry?.id || "") : "" - property Component targetComponent: settings - property Component nextComponent: settings - property var displayedApp: null - - function getComponentForPane() { - return pane ? appDetails : settings; - } - - Component.onCompleted: { - displayedApp = pane; - targetComponent = getComponentForPane(); - nextComponent = targetComponent; - } - - Loader { - id: rightLauncherLoader - - anchors.fill: parent - - opacity: 1 - scale: 1 - transformOrigin: Item.Center - clip: false - - sourceComponent: rightLauncherPane.targetComponent - active: true - - property var displayedApp: rightLauncherPane.displayedApp - - onItemChanged: { - if (item && rightLauncherPane.pane && rightLauncherPane.displayedApp !== rightLauncherPane.pane) { - rightLauncherPane.displayedApp = rightLauncherPane.pane; - } - } - } - - Behavior on paneId { - PaneTransition { - target: rightLauncherLoader - propertyActions: [ - PropertyAction { - target: rightLauncherPane - property: "displayedApp" - value: rightLauncherPane.pane - }, - PropertyAction { - target: rightLauncherLoader - property: "active" - value: false - }, - PropertyAction { - target: rightLauncherPane - property: "targetComponent" - value: rightLauncherPane.nextComponent - }, - PropertyAction { - target: rightLauncherLoader - property: "active" - value: true - } - ] - } - } - - onPaneChanged: { - nextComponent = getComponentForPane(); - paneId = pane ? (pane.id || pane.entry?.id || "") : ""; - } - - onDisplayedAppChanged: { - if (displayedApp) { - const appId = displayedApp.id || displayedApp.entry?.id; - root.hideFromLauncherChecked = Config.launcher.hiddenApps && Config.launcher.hiddenApps.length > 0 && Strings.testRegexList(Config.launcher.hiddenApps, appId); - root.favouriteChecked = Config.launcher.favouriteApps && Config.launcher.favouriteApps.length > 0 && Strings.testRegexList(Config.launcher.favouriteApps, appId); - } else { - root.hideFromLauncherChecked = false; - root.favouriteChecked = false; - } - } - } - } - } - - Component { - id: settings - - StyledFlickable { - id: settingsFlickable - flickableDirection: Flickable.VerticalFlick - contentHeight: settingsInner.height - - StyledScrollBar.vertical: StyledScrollBar { - flickable: settingsFlickable - } - - Settings { - id: settingsInner - - anchors.left: parent.left - anchors.right: parent.right - anchors.top: parent.top - session: root.session - } - } - } - - Component { - id: appDetails - - ColumnLayout { - id: appDetailsLayout - anchors.fill: parent - - readonly property var displayedApp: parent && parent.displayedApp !== undefined ? parent.displayedApp : null - - spacing: Appearance.spacing.normal - - SettingsHeader { - Layout.leftMargin: Appearance.padding.large * 2 - Layout.rightMargin: Appearance.padding.large * 2 - Layout.topMargin: Appearance.padding.large * 2 - visible: displayedApp === null - icon: "apps" - title: qsTr("Launcher Applications") - } - - Item { - Layout.alignment: Qt.AlignHCenter - Layout.leftMargin: Appearance.padding.large * 2 - Layout.rightMargin: Appearance.padding.large * 2 - Layout.topMargin: Appearance.padding.large * 2 - visible: displayedApp !== null - implicitWidth: Math.max(appIconImage.implicitWidth, appTitleText.implicitWidth) - implicitHeight: appIconImage.implicitHeight + Appearance.spacing.normal + appTitleText.implicitHeight - - ColumnLayout { - anchors.centerIn: parent - spacing: Appearance.spacing.normal - - IconImage { - id: appIconImage - Layout.alignment: Qt.AlignHCenter - implicitSize: Appearance.font.size.extraLarge * 3 * 2 - source: { - const app = appDetailsLayout.displayedApp; - if (!app) - return "image-missing"; - const entry = app.entry; - if (entry && entry.icon) { - return Quickshell.iconPath(entry.icon, "image-missing"); - } - return "image-missing"; - } - } - - StyledText { - id: appTitleText - Layout.alignment: Qt.AlignHCenter - text: displayedApp ? (displayedApp.name || displayedApp.entry?.name || qsTr("Application Details")) : "" - font.pointSize: Appearance.font.size.large - font.bold: true - } - } - } - - Item { - Layout.fillWidth: true - Layout.fillHeight: true - Layout.topMargin: Appearance.spacing.large - Layout.leftMargin: Appearance.padding.large * 2 - Layout.rightMargin: Appearance.padding.large * 2 - - StyledFlickable { - id: detailsFlickable - anchors.fill: parent - flickableDirection: Flickable.VerticalFlick - contentHeight: debugLayout.height - - StyledScrollBar.vertical: StyledScrollBar { - flickable: parent - } - - ColumnLayout { - id: debugLayout - anchors.left: parent.left - anchors.right: parent.right - anchors.top: parent.top - spacing: Appearance.spacing.normal - - SwitchRow { - Layout.topMargin: Appearance.spacing.normal - visible: appDetailsLayout.displayedApp !== null - label: qsTr("Mark as favourite") - checked: root.favouriteChecked - // disabled if: - // * app is hidden - // * app isn't in favouriteApps array but marked as favourite anyway - // ^^^ This means that this app is favourited because of a regex check - // this button can not toggle regexed apps - enabled: appDetailsLayout.displayedApp !== null && !root.hideFromLauncherChecked && (Config.launcher.favouriteApps.indexOf(appDetailsLayout.displayedApp.id || appDetailsLayout.displayedApp.entry?.id) !== -1 || !root.favouriteChecked) - opacity: enabled ? 1 : 0.6 - onToggled: checked => { - root.favouriteChecked = checked; - const app = appDetailsLayout.displayedApp; - if (app) { - const appId = app.id || app.entry?.id; - const favouriteApps = Config.launcher.favouriteApps ? [...Config.launcher.favouriteApps] : []; - if (checked) { - if (!favouriteApps.includes(appId)) { - favouriteApps.push(appId); - } - } else { - const index = favouriteApps.indexOf(appId); - if (index !== -1) { - favouriteApps.splice(index, 1); - } - } - Config.launcher.favouriteApps = favouriteApps; - Config.save(); - } - } - } - SwitchRow { - Layout.topMargin: Appearance.spacing.normal - visible: appDetailsLayout.displayedApp !== null - label: qsTr("Hide from launcher") - checked: root.hideFromLauncherChecked - // disabled if: - // * app is favourited - // * app isn't in hiddenApps array but marked as hidden anyway - // ^^^ This means that this app is hidden because of a regex check - // this button can not toggle regexed apps - enabled: appDetailsLayout.displayedApp !== null && !root.favouriteChecked && (Config.launcher.hiddenApps.indexOf(appDetailsLayout.displayedApp.id || appDetailsLayout.displayedApp.entry?.id) !== -1 || !root.hideFromLauncherChecked) - opacity: enabled ? 1 : 0.6 - onToggled: checked => { - root.hideFromLauncherChecked = checked; - const app = appDetailsLayout.displayedApp; - if (app) { - const appId = app.id || app.entry?.id; - const hiddenApps = Config.launcher.hiddenApps ? [...Config.launcher.hiddenApps] : []; - if (checked) { - if (!hiddenApps.includes(appId)) { - hiddenApps.push(appId); - } - } else { - const index = hiddenApps.indexOf(appId); - if (index !== -1) { - hiddenApps.splice(index, 1); - } - } - Config.launcher.hiddenApps = hiddenApps; - Config.save(); - } - } - } - } - } - } - } - } -} diff --git a/modules/controlcenter/launcher/Settings.qml b/modules/controlcenter/launcher/Settings.qml deleted file mode 100644 index ea8e5bb..0000000 --- a/modules/controlcenter/launcher/Settings.qml +++ /dev/null @@ -1,166 +0,0 @@ -pragma ComponentBehavior: Bound - -import ".." -import "../components" -import qs.components -import qs.components.controls -import qs.components.effects -import qs.services -import qs.config -import QtQuick -import QtQuick.Layouts - -ColumnLayout { - id: root - - required property Session session - - spacing: Appearance.spacing.normal - - SettingsHeader { - icon: "apps" - title: qsTr("Launcher Settings") - } - - SectionHeader { - Layout.topMargin: Appearance.spacing.large - title: qsTr("General") - description: qsTr("General launcher settings") - } - - SectionContainer { - ToggleRow { - label: qsTr("Enabled") - checked: Config.launcher.enabled - toggle.onToggled: { - Config.launcher.enabled = checked; - Config.save(); - } - } - - ToggleRow { - label: qsTr("Show on hover") - checked: Config.launcher.showOnHover - toggle.onToggled: { - Config.launcher.showOnHover = checked; - Config.save(); - } - } - - ToggleRow { - label: qsTr("Vim keybinds") - checked: Config.launcher.vimKeybinds - toggle.onToggled: { - Config.launcher.vimKeybinds = checked; - Config.save(); - } - } - } - - SectionHeader { - Layout.topMargin: Appearance.spacing.large - title: qsTr("Display") - description: qsTr("Display and appearance settings") - } - - SectionContainer { - contentSpacing: Appearance.spacing.small / 2 - - PropertyRow { - label: qsTr("Max shown items") - value: qsTr("%1").arg(Config.launcher.maxShown) - } - - PropertyRow { - showTopMargin: true - label: qsTr("Drag threshold") - value: qsTr("%1 px").arg(Config.launcher.dragThreshold) - } - } - - SectionHeader { - Layout.topMargin: Appearance.spacing.large - title: qsTr("Prefixes") - description: qsTr("Command prefix settings") - } - - SectionContainer { - contentSpacing: Appearance.spacing.small / 2 - - PropertyRow { - label: qsTr("Special prefix") - value: Config.launcher.specialPrefix || qsTr("None") - } - - PropertyRow { - showTopMargin: true - label: qsTr("Action prefix") - value: Config.launcher.actionPrefix || qsTr("None") - } - } - - SectionHeader { - Layout.topMargin: Appearance.spacing.large - title: qsTr("Fuzzy search") - description: qsTr("Fuzzy search settings") - } - - SectionContainer { - ToggleRow { - label: qsTr("Apps") - checked: Config.launcher.useFuzzy.apps - toggle.onToggled: { - Config.launcher.useFuzzy.apps = checked; - Config.save(); - } - } - } - - SectionHeader { - Layout.topMargin: Appearance.spacing.large - title: qsTr("Sizes") - description: qsTr("Size settings for launcher items") - } - - SectionContainer { - contentSpacing: Appearance.spacing.small / 2 - - PropertyRow { - label: qsTr("Item width") - value: qsTr("%1 px").arg(Config.launcher.sizes.itemWidth) - } - - PropertyRow { - showTopMargin: true - label: qsTr("Item height") - value: qsTr("%1 px").arg(Config.launcher.sizes.itemHeight) - } - - PropertyRow { - showTopMargin: true - label: qsTr("Wallpaper width") - value: qsTr("%1 px").arg(Config.launcher.sizes.wallpaperWidth) - } - - PropertyRow { - showTopMargin: true - label: qsTr("Wallpaper height") - value: qsTr("%1 px").arg(Config.launcher.sizes.wallpaperHeight) - } - } - - SectionHeader { - Layout.topMargin: Appearance.spacing.large - title: qsTr("Hidden apps") - description: qsTr("Applications hidden from launcher") - } - - SectionContainer { - contentSpacing: Appearance.spacing.small / 2 - - PropertyRow { - label: qsTr("Total hidden") - value: qsTr("%1").arg(Config.launcher.hiddenApps ? Config.launcher.hiddenApps.length : 0) - } - } -} diff --git a/modules/launcher/services/Apps.qml b/modules/launcher/services/Apps.qml index 7f2d645..7569a1e 100644 --- a/modules/launcher/services/Apps.qml +++ b/modules/launcher/services/Apps.qml @@ -13,7 +13,7 @@ Searcher { if (entry.runInTerminal) Quickshell.execDetached({ - command: ["app2unit", "--", ...Config.general.apps.terminal, `${Quickshell.shellDir}/assets/wrap_term_launch.sh`, ...entry.command], + command: ["app2unit", "--", ...Config.general.apps.terminal, ...entry.command], workingDirectory: entry.workingDirectory }); else diff --git a/modules/utilities/cards/Toggles.qml b/modules/utilities/cards/Toggles.qml index d610586..4777648 100644 --- a/modules/utilities/cards/Toggles.qml +++ b/modules/utilities/cards/Toggles.qml @@ -20,13 +20,13 @@ StyledRect { return Config.utilities.quickToggles.filter(item => { if (!item.enabled) return false; - + if (seenIds.has(item.id)) { return false; } if (item.id === "vpn") { - return Config.utilities.vpn.provider.some(p => + return Config.utilities.vpn.provider.some(p => typeof p === "object" ? (p.enabled === true) : false ); } |