Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ Breaks:
dde-clipboard (<< 1:6.0.14),
libdde-shell-dev (<< 2.0.38)
Replaces: libdde-shell-dev (<< 2.0.38)
Description: An wrapper for developed based on dde-shell plugin system
Description: desktop shell and plugin host for DDE
DDE Shell provides the desktop shell infrastructure used by the Deepin
Desktop Environment and hosts components implemented through its plugin
system, including panels and other desktop user-interface elements.

Package: dde-shell-example
Architecture: any
Expand All @@ -99,8 +102,9 @@ Depends:
${misc:Depends},
${shlibs:Depends},
Multi-Arch: same
Description: DDE Shell example
This package contains some plugins based on dde-shell plugin system.
Description: example plugins for the DDE desktop shell
This package contains example plugins that demonstrate how to develop and
integrate components with the DDE Shell plugin system.

Package: libdde-shell-dev
Architecture: any
Expand Down
2 changes: 2 additions & 0 deletions panels/dock/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ ds_install_package(PACKAGE org.deepin.ds.dock TARGET dockpanel)
ds_handle_package_translation(PACKAGE org.deepin.ds.dock)

# sub plugins
add_subdirectory(cardleft)
add_subdirectory(showdesktop)
add_subdirectory(taskmanager)
add_subdirectory(tray)
Expand Down Expand Up @@ -140,6 +141,7 @@ qt_add_qml_module(dock-plugin
SHARED
SOURCES ${plugin_sources}
QML_FILES DockCompositor.qml OverflowContainer.qml MenuHelper.qml DockPalette.qml
ShellSurfaceItemProxy.qml
AppletItemButton.qml
AppletItemBackground.qml
AppletDockItem.qml
Expand Down
6 changes: 6 additions & 0 deletions panels/dock/DockCompositor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Item {
property ListModel trayPluginSurfaces: ListModel {}
property ListModel quickPluginSurfaces: ListModel {}
property ListModel fixedPluginSurfaces: ListModel {}
property ListModel cardPluginSurfaces: ListModel {}

property var compositor: waylandCompositor
property var panelScale: 1.0
Expand Down Expand Up @@ -62,6 +63,7 @@ Item {
let ret = findSurfaceFromModel(trayPluginSurfaces, surfaceId)
if (ret === null) ret = findSurfaceFromModel(quickPluginSurfaces, surfaceId)
if (ret === null) ret = findSurfaceFromModel(fixedPluginSurfaces, surfaceId)
if (ret === null) ret = findSurfaceFromModel(cardPluginSurfaces, surfaceId)
return ret
}

Expand Down Expand Up @@ -92,6 +94,8 @@ Item {
quickPluginSurfaces.append({shellSurface: dockPluginSurface})
} else if (dockPluginSurface.pluginType === Dock.Fixed) {
fixedPluginSurfaces.append({shellSurface: dockPluginSurface})
} else if (dockPluginSurface.pluginType === Dock.Card) {
cardPluginSurfaces.append({shellSurface: dockPluginSurface})
}
dockCompositor.pluginSurfacesUpdated()
}
Expand All @@ -104,6 +108,8 @@ Item {
removeDockPluginSurface(quickPluginSurfaces, dockPluginSurface)
} else if (dockPluginSurface.pluginType === Dock.Fixed) {
removeDockPluginSurface(fixedPluginSurfaces, dockPluginSurface)
} else if (dockPluginSurface.pluginType === Dock.Card) {
removeDockPluginSurface(cardPluginSurfaces, dockPluginSurface)
}
dockCompositor.pluginSurfacesUpdated()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Item {
property bool pressed: tapHandler.pressed
property int cursorShape: Qt.ArrowCursor
property alias shellSurfaceItem: impl

implicitWidth: shellSurface ? shellSurface.width : 16
implicitHeight: shellSurface ? shellSurface.height : 16

Expand Down
5 changes: 5 additions & 0 deletions panels/dock/cardleft/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPDX-FileCopyrightText: 2026 UnionTech Software Technology Co., Ltd.
#
# SPDX-License-Identifier: GPL-3.0-or-later

ds_install_package(PACKAGE org.deepin.ds.dock.cardleft)
216 changes: 216 additions & 0 deletions panels/dock/cardleft/package/CardLeftDockArea.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
// SPDX-FileCopyrightText: 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Window 2.15
import QtWayland.Compositor

import org.deepin.ds 1.0
import org.deepin.ds.dock 1.0
import org.deepin.dtk 1.0 as D

AppletDockItem {
id: root

readonly property bool fashionMode: Panel.fashionMode
readonly property int dockSize: Panel.rootObject.dockSize
readonly property int hoverInset: 3
readonly property real taskbarRadius: Panel.rootObject.fashionDock.backgroundRadius
readonly property real hoverBackgroundRadius: taskbarRadius - hoverInset
readonly property int adaptiveCardLeftWidth: 150 + Math.max(0, dockSize / 4)
readonly property int rightContentPadding: Math.max(10, Math.round(adaptiveCardLeftWidth * 0.07))
readonly property int verticalInset: Math.max(5, Math.round(dockSize * 0.16))
readonly property int pageContentHeight: Math.max(24, dockSize - verticalInset * 2)

readonly property color primaryTextColor: Panel.colorTheme === Dock.Dark
? Qt.rgba(1, 1, 1, 0.96)
: Qt.rgba(0, 0, 0, 0.92)

dockOrder: 5
shouldVisible: fashionMode && pageCount > 0
readonly property int pageCount: DockCompositor.cardPluginSurfaces.count
property bool contentHovered: false
readonly property bool effectiveHovered: rootHoverHandler.hovered || contentHovered

visible: shouldVisible
implicitWidth: adaptiveCardLeftWidth
implicitHeight: dockSize
clip: true

function updateContentHovered() {
const item = swipeView.currentItem
contentHovered = !!item && item.surfaceHovered
}

HoverHandler {
id: rootHoverHandler
acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad | PointerDevice.Stylus
}

AppletItemBackground {
x: root.hoverInset
y: root.hoverInset
width: parent.width - root.hoverInset
height: parent.height - root.hoverInset * 2
radius: root.hoverBackgroundRadius
enabled: false
opacity: root.effectiveHovered ? 1 : 0
D.ColorSelector.hovered: root.effectiveHovered

Behavior on opacity {
NumberAnimation {
duration: 150
easing.type: Easing.OutCubic
}
}
}

Item {
anchors.right: parent.right
anchors.rightMargin: 8
anchors.verticalCenter: parent.verticalCenter
visible: root.effectiveHovered && root.pageCount > 1
width: pageIndicator.implicitHeight
height: pageIndicator.implicitWidth

PageIndicator {
id: pageIndicator

anchors.centerIn: parent
rotation: 90
count: swipeView.count
currentIndex: swipeView.currentIndex
padding: 0
spacing: 4

delegate: Rectangle {
required property int index

implicitWidth: 2
implicitHeight: 2
radius: width / 2
color: root.primaryTextColor
opacity: index === pageIndicator.currentIndex ? 1 : 0.35
}
}
}

SwipeView {
id: swipeView

anchors.left: parent.left
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: 8
anchors.rightMargin: root.rightContentPadding
height: root.pageContentHeight
orientation: Qt.Vertical
interactive: count > 1
clip: true

onCurrentItemChanged: {
root.updateContentHovered()
surfaceGeometryUpdateTimer.restart()
}

Repeater {
model: DockCompositor.cardPluginSurfaces

delegate: Item {
id: surfaceHost

property var plugin: model.shellSurface
readonly property bool surfaceHovered: SwipeView.isCurrentItem && surfaceItem.hovered

ShellSurfaceItemProxy {
id: surfaceItem
width: parent.width
height: parent.height
shellSurface: surfaceHost.plugin
}

function updateSurfaceGeometry() {
if (!plugin || !SwipeView.isCurrentItem || !surfaceHost.Window.window) {
return
}

const window = surfaceHost.Window.window
const windowPosition = surfaceHost.mapToItem(window.contentItem, 0, 0)
const globalPosition = Qt.point(windowPosition.x + window.x,
windowPosition.y + window.y)

plugin.updatePluginGeometry(Qt.rect(Math.round(windowPosition.x),
Math.round(windowPosition.y),
Math.round(width),
Math.round(height)))
plugin.setGlobalPos(Qt.point(Math.round(globalPosition.x),
Math.round(globalPosition.y)))
surfaceItem.fixPosition()
}

Component.onCompleted: updateSurfaceGeometry()
onWidthChanged: geometryUpdateTimer.restart()
onHeightChanged: geometryUpdateTimer.restart()
onVisibleChanged: {
geometryUpdateTimer.restart()
root.updateContentHovered()
}
onSurfaceHoveredChanged: root.updateContentHovered()

Timer {
id: geometryUpdateTimer
interval: 50
repeat: false
onTriggered: surfaceHost.updateSurfaceGeometry()
}
}
}
}

Item {
anchors.fill: parent
z: 1

WheelHandler {
target: null
enabled: swipeView.count > 1
acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad

onWheel: function(wheel) {
const deltaY = wheel.angleDelta.y !== 0 ? wheel.angleDelta.y : wheel.pixelDelta.y
if (deltaY === 0) {
return
}

const step = deltaY < 0 ? 1 : -1
const nextIndex = (swipeView.currentIndex + step + swipeView.count) % swipeView.count
swipeView.setCurrentIndex(nextIndex)
wheel.accepted = true
}
}
}

Connections {
target: swipeView.contentItem
ignoreUnknownSignals: true

function onContentYChanged() {
surfaceGeometryUpdateTimer.restart()
}
}

Timer {
id: surfaceGeometryUpdateTimer

interval: 50
repeat: false
onTriggered: {
const item = swipeView.currentItem
if (item) {
item.updateSurfaceGeometry()
}
}
}
}
8 changes: 8 additions & 0 deletions panels/dock/cardleft/package/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
Comment thread
wjyrich marked this conversation as resolved.
"Plugin": {
"Version": "1.0",
"Id": "org.deepin.ds.dock.cardleft",
"Url": "CardLeftDockArea.qml",
"Parent": "org.deepin.ds.dock"
}
}
4 changes: 3 additions & 1 deletion panels/dock/constants.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-License-Identifier: LGPL-3.0-or-later
Expand Down Expand Up @@ -36,6 +36,7 @@ enum IndicatorStyle {
enum ItemAlignment {
CenterAlignment = 0,
LeftAlignment = 1,
FashionAlignment = 2,
};

enum ColorTheme {
Expand Down Expand Up @@ -79,6 +80,7 @@ enum TrayPluginType {
Tray = 1,
Fixed,
Quick,
Card,
};

enum TrayPluginSizePolicy {
Expand Down
11 changes: 11 additions & 0 deletions panels/dock/dockpanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ bool DockPanel::init()
});
connect(SETTINGS, &DockSettings::positionChanged, this, [this, dockDaemonAdaptor](){
Q_EMIT positionChanged(position());
Q_EMIT fashionModeChanged();
Q_EMIT dockDaemonAdaptor->PositionChanged(position());
Q_EMIT dockDaemonAdaptor->FrontendWindowRectChanged(frontendWindowRect());

Expand All @@ -117,6 +118,9 @@ bool DockPanel::init()
connect(SETTINGS, &DockSettings::dockSizeChanged, this, &DockPanel::dockSizeChanged);
connect(SETTINGS, &DockSettings::hideModeChanged, this, &DockPanel::hideModeChanged);
connect(SETTINGS, &DockSettings::itemAlignmentChanged, this, &DockPanel::itemAlignmentChanged);
connect(SETTINGS, &DockSettings::itemAlignmentChanged, this, [this](){
Q_EMIT fashionModeChanged();
});
connect(SETTINGS, &DockSettings::indicatorStyleChanged, this, &DockPanel::indicatorStyleChanged);
connect(SETTINGS, &DockSettings::lockedChanged, this, &DockPanel::lockedChanged);

Expand Down Expand Up @@ -298,6 +302,13 @@ void DockPanel::setItemAlignment(const ItemAlignment& alignment)
SETTINGS->setItemAlignment(alignment);
}

bool DockPanel::fashionMode()
{
const auto dockPosition = position();
return itemAlignment() == FashionAlignment
&& (dockPosition == Top || dockPosition == Bottom);
}

IndicatorStyle DockPanel::indicatorStyle()
{
return SETTINGS->indicatorStyle();
Expand Down
4 changes: 4 additions & 0 deletions panels/dock/dockpanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class DockPanel : public DS_NAMESPACE::DPanel, public QDBusContext
Q_PROPERTY(HideMode hideMode READ hideMode WRITE setHideMode NOTIFY hideModeChanged FINAL)
Q_PROPERTY(Position position READ position WRITE setPosition NOTIFY positionChanged FINAL)
Q_PROPERTY(ItemAlignment itemAlignment READ itemAlignment WRITE setItemAlignment NOTIFY itemAlignmentChanged FINAL)
Q_PROPERTY(bool fashionMode READ fashionMode NOTIFY fashionModeChanged FINAL)
Q_PROPERTY(IndicatorStyle indicatorStyle READ indicatorStyle WRITE setIndicatorStyle NOTIFY indicatorStyleChanged FINAL)
Q_PROPERTY(bool showInPrimary READ showInPrimary WRITE setShowInPrimary NOTIFY showInPrimaryChanged FINAL)
Q_PROPERTY(QString screenName READ screenName NOTIFY screenNameChanged FINAL)
Expand Down Expand Up @@ -72,6 +73,8 @@ class DockPanel : public DS_NAMESPACE::DPanel, public QDBusContext
ItemAlignment itemAlignment();
void setItemAlignment(const ItemAlignment& alignment);

bool fashionMode();

IndicatorStyle indicatorStyle();
void setIndicatorStyle(const IndicatorStyle& style);

Expand Down Expand Up @@ -127,6 +130,7 @@ private Q_SLOTS:
void beforePositionChanged(Position beforePosition);
void positionChanged(Position position);
void itemAlignmentChanged(ItemAlignment alignment);
void fashionModeChanged();
void indicatorStyleChanged(IndicatorStyle style);
void showInPrimaryChanged(bool showInPrimary);
void dockScreenChanged(QScreen *screen);
Expand Down
Loading
Loading