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
Quick
QuickControls2
Widgets
)
find_package(LayerShellQt REQUIRED)
@ -53,6 +54,8 @@ target_link_libraries(waycast PRIVATE
Qt6::Gui
Qt6::Qml
Qt6::Quick
Qt6::QuickControls2
Qt6::Widgets
PkgConfig::GIO
LayerShellQt::Interface
)

View File

@ -2,6 +2,8 @@
#include <QQmlApplicationEngine>
#include <QIcon>
#include <QWindow>
#include <QStyleHints>
#include <QtQuickControls2/QQuickStyle>
#include <LayerShellQt/window.h>
#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::FileSearchPlugin>());
// Enable system theme support
app.setDesktopSettingsAware(true);
// Ensure we follow system color scheme
app.setAttribute(Qt::AA_UseStyleSheetPropagationInWidgetStyles, true);
// Set dark theme
QQuickStyle::setStyle("Material");
qputenv("QT_QUICK_CONTROLS_MATERIAL_THEME", "Dark");
QQmlApplicationEngine engine;

View File

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