Add Nebula.Windows with Sway IPC backend
Introduces a new `core/windows` module (`Nebula.Windows`) with `WindowService`, window/workspace models, and a Sway IPC backend for live window tracking and control (focus, close, move/resize, snap, maximize/restore, minimize, workspace switch). The desktop shell now links this module, uses compositor focus for top-bar active app text, and adds an Open Windows section in the launcher with focus/close actions. Also updates application metadata handling to parse `StartupWMClass` and map window `app_id`/class to friendly names and icons, and revises Sway config/docs for the new floating-first Desktop 0.2 behavior with temporary compositor-provided decorations.
This commit is contained in:
@@ -13,7 +13,7 @@ set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
find_package(Qt6 6.4 REQUIRED COMPONENTS Core Gui Qml Quick)
|
||||
find_package(Qt6 6.4 REQUIRED COMPONENTS Core Gui Qml Quick Network)
|
||||
find_package(LayerShellQt REQUIRED)
|
||||
|
||||
qt_standard_project_setup(REQUIRES 6.4)
|
||||
@@ -30,6 +30,11 @@ add_subdirectory(
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/nebula-applications"
|
||||
)
|
||||
|
||||
add_subdirectory(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../../../core/windows"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/nebula-windows"
|
||||
)
|
||||
|
||||
qt_add_executable(nebula-shell
|
||||
src/main.cpp
|
||||
src/DesktopIconProvider.cpp
|
||||
@@ -48,6 +53,7 @@ set(NEBULA_SHELL_QML_FILES
|
||||
qml/components/SystemArea.qml
|
||||
qml/components/Launcher.qml
|
||||
qml/components/AppItem.qml
|
||||
qml/components/OpenWindowItem.qml
|
||||
qml/mock/MockApps.qml
|
||||
)
|
||||
|
||||
@@ -79,6 +85,7 @@ qt_add_qml_module(nebula-shell
|
||||
QtQuick
|
||||
Nebula.UI
|
||||
Nebula.Applications
|
||||
Nebula.Windows
|
||||
)
|
||||
|
||||
target_link_libraries(nebula-shell
|
||||
@@ -90,6 +97,7 @@ target_link_libraries(nebula-shell
|
||||
LayerShellQt::Interface
|
||||
NebulaUI
|
||||
NebulaApplications
|
||||
NebulaWindows
|
||||
)
|
||||
|
||||
if(TARGET NebulaUIplugin)
|
||||
@@ -98,6 +106,9 @@ endif()
|
||||
if(TARGET NebulaApplicationsplugin)
|
||||
target_link_libraries(nebula-shell PRIVATE NebulaApplicationsplugin)
|
||||
endif()
|
||||
if(TARGET NebulaWindowsplugin)
|
||||
target_link_libraries(nebula-shell PRIVATE NebulaWindowsplugin)
|
||||
endif()
|
||||
|
||||
# Generated nebula-shell_qmltyperegistrations.cpp includes "OutputTracker.hpp"
|
||||
# via __has_include. Keep src/ on the include path so that succeeds.
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
pragma Singleton
|
||||
|
||||
import QtQuick
|
||||
import Nebula.Windows
|
||||
|
||||
QtObject {
|
||||
property bool launcherOpen: false
|
||||
|
||||
// Focused-window tracking is a later compositor milestone. Launching an
|
||||
// application does not mean it has focus, so this stays "Desktop" for now.
|
||||
property string activeApplication: "Desktop"
|
||||
readonly property string activeApplication: WindowService.focusedApplicationName.length > 0
|
||||
? WindowService.focusedApplicationName
|
||||
: qsTr("Desktop")
|
||||
|
||||
function openLauncher() {
|
||||
launcherOpen = true
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import QtQuick
|
||||
import Nebula.UI
|
||||
import Nebula.Applications
|
||||
import Nebula.Windows
|
||||
|
||||
Item {
|
||||
id: root
|
||||
@@ -187,6 +188,33 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
width: parent.width
|
||||
spacing: 8
|
||||
visible: !root.searching && WindowService.windowCount > 0
|
||||
|
||||
Text {
|
||||
text: qsTr("Open Windows")
|
||||
color: Theme.textSecondary
|
||||
font.family: Theme.fontFamily
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.weight: Font.DemiBold
|
||||
font.letterSpacing: 0.4
|
||||
}
|
||||
|
||||
Column {
|
||||
width: parent.width
|
||||
spacing: 2
|
||||
|
||||
Repeater {
|
||||
model: WindowService.model
|
||||
delegate: OpenWindowItem {
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
width: parent.width
|
||||
spacing: 8
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
import QtQuick
|
||||
import Nebula.UI
|
||||
import Nebula.Windows
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
required property string windowId
|
||||
required property string displayName
|
||||
required property string iconName
|
||||
required property bool focused
|
||||
required property bool minimized
|
||||
|
||||
implicitWidth: parent ? parent.width : 200
|
||||
implicitHeight: 36
|
||||
Accessible.role: Accessible.ListItem
|
||||
Accessible.name: displayName
|
||||
Accessible.onPressAction: root.activate()
|
||||
|
||||
readonly property url iconSource: iconName.length > 0
|
||||
? ("image://desktopicon/" + encodeURIComponent(iconName))
|
||||
: ""
|
||||
|
||||
function activate() {
|
||||
WindowService.focusWindow(windowId)
|
||||
ShellState.closeLauncher()
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: Theme.radiusSmall
|
||||
color: {
|
||||
if (hover.containsMouse)
|
||||
return Theme.tileHover
|
||||
if (root.focused)
|
||||
return Theme.accentSoft
|
||||
return "transparent"
|
||||
}
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Theme.animationFast
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: 8
|
||||
anchors.rightMargin: 4
|
||||
spacing: 8
|
||||
|
||||
Rectangle {
|
||||
width: 22
|
||||
height: 22
|
||||
radius: 6
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: Theme.iconWell
|
||||
|
||||
Image {
|
||||
id: icon
|
||||
anchors.centerIn: parent
|
||||
width: 14
|
||||
height: 14
|
||||
fillMode: Image.PreserveAspectFit
|
||||
asynchronous: true
|
||||
smooth: true
|
||||
cache: true
|
||||
visible: status === Image.Ready
|
||||
source: root.iconSource
|
||||
}
|
||||
|
||||
NebulaIcon {
|
||||
anchors.centerIn: parent
|
||||
visible: icon.status !== Image.Ready
|
||||
name: "application"
|
||||
size: 12
|
||||
color: Theme.accent
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: parent.width - 22 - 28 - 16
|
||||
text: root.displayName
|
||||
color: {
|
||||
if (root.minimized)
|
||||
return Theme.textTertiary
|
||||
if (root.focused)
|
||||
return Theme.textPrimary
|
||||
return Theme.textSecondary
|
||||
}
|
||||
font.family: Theme.fontFamily
|
||||
font.pixelSize: Theme.fontSizeApp
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
Item {
|
||||
width: 28
|
||||
height: parent.height
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: "×"
|
||||
color: closeHover.containsMouse ? Theme.danger : Theme.textTertiary
|
||||
font.pixelSize: 14
|
||||
font.family: Theme.fontFamily
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: closeHover
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: WindowService.closeWindow(root.windowId)
|
||||
}
|
||||
|
||||
Accessible.role: Accessible.Button
|
||||
Accessible.name: qsTr("Close %1").arg(root.displayName)
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: hover
|
||||
anchors.fill: parent
|
||||
anchors.rightMargin: 28
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: root.activate()
|
||||
}
|
||||
|
||||
FocusFrame {
|
||||
radius: Theme.radiusSmall
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user