Files
andrew 4321209e92 Add floating traffic-light window chrome
Introduces a dedicated layer-shell `WindowChromeSurface` that renders macOS-style traffic-light controls over the focused Sway window titlebar, replacing the old top-bar window controls. Adds theme tokens and a reusable `TrafficLightButton` component, updates shell QML/CMake wiring, and adjusts Sway titlebar padding/title format so window titles do not overlap the overlay. Window tracking was extended with focused-window geometry/deco/fullscreen properties plus backend refresh support so the chrome follows window movement and state changes in near real time.
2026-08-26 22:38:33 +12:00

145 lines
4.0 KiB
CMake

cmake_minimum_required(VERSION 3.20)
project(nebula-shell LANGUAGES CXX)
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
message(FATAL_ERROR
"nebula-shell is a Linux Wayland shell using LayerShellQt.\n"
"Build and run it on the Ubuntu NebulaOS VM. Windows is not a supported target, "
"and LayerShellQt is not stubbed with other platform APIs.")
endif()
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 Network)
find_package(LayerShellQt REQUIRED)
qt_standard_project_setup(REQUIRES 6.4)
set(QT_QML_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/qml")
add_subdirectory(
"${CMAKE_CURRENT_SOURCE_DIR}/../../../packages/nebula-ui"
"${CMAKE_CURRENT_BINARY_DIR}/nebula-ui"
)
add_subdirectory(
"${CMAKE_CURRENT_SOURCE_DIR}/../../../core/applications"
"${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
src/DesktopIconProvider.hpp
)
set(NEBULA_SHELL_QML_FILES
qml/Main.qml
qml/ShellState.qml
qml/surfaces/DesktopSurface.qml
qml/surfaces/TopBarSurface.qml
qml/surfaces/WindowChromeSurface.qml
qml/surfaces/LauncherSurface.qml
qml/components/TopBar.qml
qml/components/WindowControls.qml
qml/components/TrafficLightButton.qml
qml/components/NebulaButton.qml
qml/components/Clock.qml
qml/components/SystemArea.qml
qml/components/Launcher.qml
qml/components/AppItem.qml
qml/components/OpenWindowItem.qml
qml/mock/MockApps.qml
)
foreach(qml_file IN LISTS NEBULA_SHELL_QML_FILES)
get_filename_component(qml_name "${qml_file}" NAME)
set_source_files_properties("${qml_file}" PROPERTIES
QT_RESOURCE_ALIAS "${qml_name}"
)
endforeach()
set_source_files_properties(qml/ShellState.qml PROPERTIES
QT_QML_SINGLETON_TYPE TRUE
QT_RESOURCE_ALIAS ShellState.qml
)
set_source_files_properties(qml/mock/MockApps.qml PROPERTIES
QT_QML_SINGLETON_TYPE TRUE
QT_RESOURCE_ALIAS MockApps.qml
)
qt_add_qml_module(nebula-shell
URI Nebula.Shell
VERSION 1.0
RESOURCE_PREFIX /qt/qml
QML_FILES ${NEBULA_SHELL_QML_FILES}
SOURCES
src/OutputTracker.hpp
src/OutputTracker.cpp
DEPENDENCIES
QtQuick
Nebula.UI
Nebula.Applications
Nebula.Windows
)
target_link_libraries(nebula-shell
PRIVATE
Qt6::Core
Qt6::Gui
Qt6::Qml
Qt6::Quick
LayerShellQt::Interface
NebulaUI
NebulaApplications
NebulaWindows
)
if(TARGET NebulaUIplugin)
target_link_libraries(nebula-shell PRIVATE NebulaUIplugin)
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.
target_include_directories(nebula-shell PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}/src"
)
set_source_files_properties(
"${CMAKE_CURRENT_BINARY_DIR}/nebula-shell_qmltyperegistrations.cpp"
PROPERTIES
COMPILE_OPTIONS "-include;${CMAKE_CURRENT_SOURCE_DIR}/src/OutputTracker.hpp"
)
set_target_properties(nebula-shell PROPERTIES
OUTPUT_NAME nebula-shell
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
)
# Shared Qt discovers QML plugins at runtime. Skip qmlimportscanner / static
# plugin importing so Qt 6.8+ does not warn about missing Qt6::*plugin targets.
if(QT6_IS_SHARED_LIBS_BUILD)
set_target_properties(nebula-shell PROPERTIES
QT_QML_MODULE_NO_IMPORT_SCAN TRUE
)
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
target_compile_options(nebula-shell PRIVATE -Wall -Wextra)
endif()