Show description on items
This commit is contained in:
parent
32c9823a09
commit
4427993db9
103
build.zig
103
build.zig
@ -1,57 +1,102 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *std.Build) void {
|
pub fn build(b: *std.Build) void {
|
||||||
// const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
// const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
// Step 1: Generate Qt resources automatically
|
|
||||||
const rcc_cmd = b.addSystemCommand(&.{ "rcc", "ui/resources.qrc", "-o", "qrc_resources.cpp" });
|
|
||||||
|
|
||||||
// Create the executable
|
// Create the executable
|
||||||
const mod = b.createModule(.{
|
const exe = b.addExecutable(.{
|
||||||
.target = b.graph.host,
|
.name = "waycast",
|
||||||
|
.target = target,
|
||||||
|
.optimize = optimize,
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.addCSourceFiles(.{
|
// Set C++20 standard
|
||||||
.files = &.{
|
exe.linkLibCpp();
|
||||||
"main.cpp",
|
|
||||||
"qrc_resources.cpp",
|
// Add include directories (equivalent to CMake include_directories)
|
||||||
},
|
exe.addIncludePath(b.path("lib"));
|
||||||
.flags = &.{
|
exe.addIncludePath(b.path("lib/ui"));
|
||||||
|
exe.addIncludePath(b.path("lib/plugins"));
|
||||||
|
exe.addIncludePath(b.path("src"));
|
||||||
|
|
||||||
|
// Add source files (equivalent to CMake GLOB_RECURSE and target_sources)
|
||||||
|
const src_files = [_][]const u8{
|
||||||
|
// Main source
|
||||||
|
"src/main.cpp",
|
||||||
|
|
||||||
|
// Library UI files
|
||||||
|
"lib/ui/AppListModel.cpp",
|
||||||
|
"lib/ui/ListItem.cpp",
|
||||||
|
|
||||||
|
// Plugin files
|
||||||
|
"src/plugins/DesktopAppPlugin/DesktopAppListItem.cpp",
|
||||||
|
};
|
||||||
|
|
||||||
|
exe.addCSourceFiles(.{
|
||||||
|
.files = &src_files,
|
||||||
|
.flags = &[_][]const u8{
|
||||||
"-std=c++20",
|
"-std=c++20",
|
||||||
|
"-fmodules-ts",
|
||||||
|
"-mavx2",
|
||||||
"-Wall",
|
"-Wall",
|
||||||
"-Wextra",
|
"-Wextra",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const exe = b.addExecutable(.{
|
// System library dependencies (equivalent to find_package and target_link_libraries)
|
||||||
.name = "waycast",
|
// Qt6 libraries
|
||||||
.root_module = mod,
|
|
||||||
});
|
|
||||||
|
|
||||||
exe.step.dependOn(&rcc_cmd.step);
|
|
||||||
|
|
||||||
// Link C++ standard library
|
|
||||||
exe.linkLibCpp();
|
|
||||||
// Link Qt6
|
|
||||||
exe.linkSystemLibrary("Qt6Core");
|
exe.linkSystemLibrary("Qt6Core");
|
||||||
exe.linkSystemLibrary("Qt6Quick");
|
|
||||||
exe.linkSystemLibrary("Qt6Gui");
|
exe.linkSystemLibrary("Qt6Gui");
|
||||||
exe.linkSystemLibrary("Qt6Qml");
|
exe.linkSystemLibrary("Qt6Qml");
|
||||||
|
exe.linkSystemLibrary("Qt6Quick");
|
||||||
|
exe.linkSystemLibrary("Qt6QuickControls2");
|
||||||
|
exe.linkSystemLibrary("Qt6Widgets");
|
||||||
|
|
||||||
|
// LayerShellQt
|
||||||
|
exe.linkSystemLibrary("LayerShellQtInterface");
|
||||||
|
|
||||||
|
// GIO (GLib) - equivalent to pkg_check_modules(GIO REQUIRED gio-2.0)
|
||||||
|
exe.linkSystemLibrary("gio-2.0");
|
||||||
|
exe.linkSystemLibrary("gobject-2.0");
|
||||||
|
exe.linkSystemLibrary("glib-2.0");
|
||||||
|
|
||||||
|
// Add pkg-config paths for system libraries
|
||||||
|
exe.addLibraryPath(.{ .cwd_relative = "/usr/lib" });
|
||||||
|
exe.addLibraryPath(.{ .cwd_relative = "/usr/local/lib" });
|
||||||
|
|
||||||
|
// QML resource compilation (equivalent to qt_add_qml_module)
|
||||||
|
// Note: This is simplified - full Qt QML module support would need more complex setup
|
||||||
|
_ = b.addSystemCommand(&.{
|
||||||
|
"rcc", "-binary", "-o", "qml_resources.rcc", "ui/Main.qml"
|
||||||
|
});
|
||||||
|
|
||||||
|
// Set RPATH for runtime library discovery (equivalent to INSTALL_RPATH)
|
||||||
|
if (target.result.os.tag == .linux) {
|
||||||
|
exe.addRPath(.{ .cwd_relative = "$ORIGIN" });
|
||||||
|
}
|
||||||
|
|
||||||
// Install the executable
|
// Install the executable
|
||||||
b.installArtifact(exe);
|
b.installArtifact(exe);
|
||||||
|
|
||||||
// Create a run step
|
// Create run command
|
||||||
const run_cmd = b.addRunArtifact(exe);
|
const run_cmd = b.addRunArtifact(exe);
|
||||||
run_cmd.step.dependOn(b.getInstallStep());
|
run_cmd.step.dependOn(b.getInstallStep());
|
||||||
|
|
||||||
// Allow passing arguments to the program
|
// Allow passing arguments
|
||||||
if (b.args) |args| {
|
if (b.args) |args| {
|
||||||
run_cmd.addArgs(args);
|
run_cmd.addArgs(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the run step
|
// Create run step
|
||||||
const run_step = b.step("run", "Run the application");
|
const run_step = b.step("run", "Run waycast");
|
||||||
run_step.dependOn(&run_cmd.step);
|
run_step.dependOn(&run_cmd.step);
|
||||||
}
|
|
||||||
|
// Create build step (equivalent to make bld)
|
||||||
|
const build_step = b.step("bld", "Build waycast");
|
||||||
|
build_step.dependOn(&exe.step);
|
||||||
|
|
||||||
|
// Combined build and run step (equivalent to make br)
|
||||||
|
const build_run_step = b.step("br", "Build and run waycast");
|
||||||
|
build_run_step.dependOn(&run_cmd.step);
|
||||||
|
}
|
@ -3,6 +3,7 @@
|
|||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QWindow>
|
#include <QWindow>
|
||||||
#include <QStyleHints>
|
#include <QStyleHints>
|
||||||
|
#include <QSurfaceFormat>
|
||||||
#include <QtQuickControls2/QQuickStyle>
|
#include <QtQuickControls2/QQuickStyle>
|
||||||
#include <LayerShellQt/window.h>
|
#include <LayerShellQt/window.h>
|
||||||
|
|
||||||
@ -74,6 +75,11 @@ int main(int argc, char *argv[])
|
|||||||
QWindow *window = qobject_cast<QWindow *>(rootObjects.first());
|
QWindow *window = qobject_cast<QWindow *>(rootObjects.first());
|
||||||
if (window)
|
if (window)
|
||||||
{
|
{
|
||||||
|
// Enable transparency support
|
||||||
|
QSurfaceFormat format = window->format();
|
||||||
|
format.setAlphaBufferSize(8);
|
||||||
|
window->setFormat(format);
|
||||||
|
|
||||||
LayerShellQt::Window *layerWindow = LayerShellQt::Window::get(window);
|
LayerShellQt::Window *layerWindow = LayerShellQt::Window::get(window);
|
||||||
if (layerWindow)
|
if (layerWindow)
|
||||||
{
|
{
|
||||||
|
31
ui/Main.qml
31
ui/Main.qml
@ -14,6 +14,9 @@ ApplicationWindow {
|
|||||||
|
|
||||||
Material.theme: Material.Dark
|
Material.theme: Material.Dark
|
||||||
|
|
||||||
|
// Set window opacity for semi-transparency
|
||||||
|
opacity: 0.95
|
||||||
|
|
||||||
Shortcut {
|
Shortcut {
|
||||||
sequence: "Escape"
|
sequence: "Escape"
|
||||||
onActivated: Qt.quit()
|
onActivated: Qt.quit()
|
||||||
@ -75,7 +78,7 @@ ApplicationWindow {
|
|||||||
|
|
||||||
delegate: ItemDelegate {
|
delegate: ItemDelegate {
|
||||||
width: listView.width
|
width: listView.width
|
||||||
height: 40
|
height: 60
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@ -110,11 +113,29 @@ ApplicationWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Column {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
text: model.name
|
spacing: 2
|
||||||
color: Material.foreground
|
|
||||||
font.pixelSize: 14
|
Text {
|
||||||
|
text: model.name
|
||||||
|
color: Material.foreground
|
||||||
|
font.pixelSize: 14
|
||||||
|
font.weight: Font.Medium
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: model.description || ""
|
||||||
|
color: Material.color(Material.Grey, Material.Shade400)
|
||||||
|
font.pixelSize: 11
|
||||||
|
visible: text.length > 0
|
||||||
|
opacity: 0.8
|
||||||
|
|
||||||
|
// Truncate long descriptions
|
||||||
|
elide: Text.ElideRight
|
||||||
|
maximumLineCount: 1
|
||||||
|
width: Math.min(implicitWidth, listView.width - 60) // Leave space for icon and margins
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user