mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
feat: added vcs_tag to version display everywhere + rounded avatar on overview tab
This commit is contained in:
+19
-1
@@ -560,6 +560,24 @@ if sanitize
|
||||
_noctalia_sources += files('src/pipewire/pipewire_lsan.cpp')
|
||||
endif
|
||||
|
||||
git_program = find_program('git', required: false)
|
||||
if git_program.found()
|
||||
_git_revision_h = vcs_tag(
|
||||
input: 'src/core/git_revision.h.in',
|
||||
output: 'noctalia_git_revision.h',
|
||||
command: [git_program, 'describe', '--tags', '--always', '--dirty=-dirty', '--abbrev=12'],
|
||||
fallback: 'unknown',
|
||||
)
|
||||
else
|
||||
_git_revision_config = configuration_data()
|
||||
_git_revision_config.set('VCS_TAG', 'unknown')
|
||||
_git_revision_h = configure_file(
|
||||
input: 'src/core/git_revision.h.in',
|
||||
output: 'noctalia_git_revision.h',
|
||||
configuration: _git_revision_config,
|
||||
)
|
||||
endif
|
||||
|
||||
# ── Include directories ────────────────────────────────────────────────────────
|
||||
_noctalia_inc = [
|
||||
include_directories('src'),
|
||||
@@ -575,7 +593,7 @@ _noctalia_inc = [
|
||||
|
||||
# ── Executable ────────────────────────────────────────────────────────────────
|
||||
executable('noctalia',
|
||||
sources: _noctalia_sources + _protocol_sources,
|
||||
sources: _noctalia_sources + _protocol_sources + [_git_revision_h],
|
||||
dependencies: [
|
||||
sdbus_cpp_dep,
|
||||
wayland_client_dep,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "application.h"
|
||||
|
||||
#include "app/poll_source.h"
|
||||
#include "core/build_info.h"
|
||||
#include "core/deferred_call.h"
|
||||
#include "core/log.h"
|
||||
#include "core/process.h"
|
||||
@@ -256,7 +257,7 @@ void Application::syncPolkitAgent() {
|
||||
|
||||
void Application::run() {
|
||||
initLogFile();
|
||||
kLog.info("noctalia v{}", NOCTALIA_VERSION);
|
||||
kLog.info("noctalia {}", noctalia::build_info::displayVersion());
|
||||
initServices();
|
||||
initUi();
|
||||
initIpc();
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include "noctalia_git_revision.h"
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
namespace noctalia::build_info {
|
||||
|
||||
inline constexpr std::string_view version() noexcept { return NOCTALIA_VERSION; }
|
||||
|
||||
inline constexpr std::string_view revision() noexcept { return NOCTALIA_GIT_REVISION; }
|
||||
|
||||
inline std::string displayVersion() {
|
||||
std::string label = "v";
|
||||
label += version();
|
||||
|
||||
constexpr std::string_view unknownRevision = "unknown";
|
||||
const std::string_view rev = revision();
|
||||
if (!rev.empty() && rev != unknownRevision) {
|
||||
label += " (";
|
||||
label += rev;
|
||||
label += ')';
|
||||
}
|
||||
return label;
|
||||
}
|
||||
|
||||
} // namespace noctalia::build_info
|
||||
@@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#define NOCTALIA_GIT_REVISION "@VCS_TAG@"
|
||||
+4
-1
@@ -1,4 +1,5 @@
|
||||
#include "app/application.h"
|
||||
#include "core/build_info.h"
|
||||
#include "core/log.h"
|
||||
#include "ipc/cli.h"
|
||||
#include "ipc/ipc_client.h"
|
||||
@@ -8,12 +9,14 @@
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
namespace {
|
||||
|
||||
int runTopLevelFlag(const char* flag) {
|
||||
if (std::strcmp(flag, "--version") == 0) {
|
||||
std::puts("noctalia v" NOCTALIA_VERSION);
|
||||
const std::string version = noctalia::build_info::displayVersion();
|
||||
std::printf("noctalia %s\n", version.c_str());
|
||||
return 0;
|
||||
}
|
||||
if (std::strcmp(flag, "--help") == 0) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "shell/control_center/overview_tab.h"
|
||||
|
||||
#include "config/config_service.h"
|
||||
#include "core/build_info.h"
|
||||
#include "dbus/mpris/mpris_art.h"
|
||||
#include "dbus/mpris/mpris_service.h"
|
||||
#include "dbus/power/power_profiles_service.h"
|
||||
@@ -189,8 +190,8 @@ std::unique_ptr<Flex> OverviewTab::create() {
|
||||
|
||||
const float avatarSize = Style::controlHeightLg * 3.2f * scale;
|
||||
auto avatar = std::make_unique<Image>();
|
||||
avatar->setRadius(Style::radiusLg * scale);
|
||||
avatar->setBorder(roleColor(ColorRole::Primary), Style::borderWidth * 2.0f);
|
||||
avatar->setRadius(avatarSize * 0.5f);
|
||||
avatar->setBorder(roleColor(ColorRole::Primary), Style::borderWidth * 3.0f);
|
||||
avatar->setFit(ImageFit::Cover);
|
||||
avatar->setPadding(1.0f * scale);
|
||||
avatar->setSize(avatarSize, avatarSize);
|
||||
@@ -473,8 +474,8 @@ void OverviewTab::sync(Renderer& renderer) {
|
||||
if (m_userFacts != nullptr) {
|
||||
const auto uptime = systemUptime();
|
||||
const std::string uptimeText = uptime.has_value() ? formatDuration(*uptime) : "unknown";
|
||||
m_userFacts->setText(std::format("{}@{}\nUptime · {}\nNoctalia v{}", sessionDisplayName(), hostName(), uptimeText,
|
||||
NOCTALIA_VERSION));
|
||||
m_userFacts->setText(std::format("{}@{}\nUptime · {}\nNoctalia {}", sessionDisplayName(), hostName(), uptimeText,
|
||||
noctalia::build_info::displayVersion()));
|
||||
}
|
||||
if (m_weatherDate != nullptr) {
|
||||
m_weatherDate->setText(formatCurrentDate());
|
||||
|
||||
Reference in New Issue
Block a user