Dark theme

This commit is contained in:
Javier Feliz 2025-08-28 18:21:10 -04:00
parent ffde0b15e8
commit 32c9823a09
3 changed files with 16 additions and 12 deletions

View File

@ -17,6 +17,7 @@ find_package(Qt6 REQUIRED COMPONENTS
Qml Qml
Quick Quick
QuickControls2 QuickControls2
Widgets
) )
find_package(LayerShellQt REQUIRED) find_package(LayerShellQt REQUIRED)
@ -53,6 +54,8 @@ target_link_libraries(waycast PRIVATE
Qt6::Gui Qt6::Gui
Qt6::Qml Qt6::Qml
Qt6::Quick Qt6::Quick
Qt6::QuickControls2
Qt6::Widgets
PkgConfig::GIO PkgConfig::GIO
LayerShellQt::Interface LayerShellQt::Interface
) )

View File

@ -2,6 +2,8 @@
#include <QQmlApplicationEngine> #include <QQmlApplicationEngine>
#include <QIcon> #include <QIcon>
#include <QWindow> #include <QWindow>
#include <QStyleHints>
#include <QtQuickControls2/QQuickStyle>
#include <LayerShellQt/window.h> #include <LayerShellQt/window.h>
#undef signals #undef signals
@ -50,11 +52,9 @@ int main(int argc, char *argv[])
pluginManager.registerPlugin(std::make_unique<plugins::DesktopAppPlugin>()); pluginManager.registerPlugin(std::make_unique<plugins::DesktopAppPlugin>());
pluginManager.registerPlugin(std::make_unique<plugins::FileSearchPlugin>()); pluginManager.registerPlugin(std::make_unique<plugins::FileSearchPlugin>());
// Enable system theme support // Set dark theme
app.setDesktopSettingsAware(true); QQuickStyle::setStyle("Material");
qputenv("QT_QUICK_CONTROLS_MATERIAL_THEME", "Dark");
// Ensure we follow system color scheme
app.setAttribute(Qt::AA_UseStyleSheetPropagationInWidgetStyles, true);
QQmlApplicationEngine engine; QQmlApplicationEngine engine;

View File

@ -2,7 +2,6 @@ import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Window import QtQuick.Window
import QtQuick.Controls.Material import QtQuick.Controls.Material
import QtQuick.Controls.Universal
import WayCast import WayCast
ApplicationWindow { ApplicationWindow {
@ -13,6 +12,8 @@ ApplicationWindow {
flags: Qt.FramelessWindowHint flags: Qt.FramelessWindowHint
property int timeoutInterval: 5000 property int timeoutInterval: 5000
Material.theme: Material.Dark
Shortcut { Shortcut {
sequence: "Escape" sequence: "Escape"
onActivated: Qt.quit() onActivated: Qt.quit()
@ -25,8 +26,8 @@ ApplicationWindow {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
border.width: 1 border.width: 1
border.color: palette.mid border.color: Material.frameColor
color: palette.window color: Material.backgroundColor
Column { Column {
anchors.fill: parent anchors.fill: parent
@ -68,7 +69,7 @@ ApplicationWindow {
highlightFollowsCurrentItem: true highlightFollowsCurrentItem: true
highlight: Rectangle { highlight: Rectangle {
color: palette.highlight color: Material.accent
radius: 4 radius: 4
} }
@ -78,7 +79,7 @@ ApplicationWindow {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: parent.hovered ? palette.alternateBase : "transparent" color: parent.hovered ? Material.listHighlightColor : "transparent"
radius: 4 radius: 4
} }
@ -97,7 +98,7 @@ ApplicationWindow {
// Fallback if icon fails to load // Fallback if icon fails to load
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: palette.button color: Material.color(Material.Grey, Material.Shade600)
radius: 4 radius: 4
visible: parent.status === Image.Error || parent.status === Image.Null visible: parent.status === Image.Error || parent.status === Image.Null
@ -112,7 +113,7 @@ ApplicationWindow {
Text { Text {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
text: model.name text: model.name
color: palette.text color: Material.foreground
font.pixelSize: 14 font.pixelSize: 14
} }
} }