Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/background/meson.build
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
executable('wf-background', ['background.cpp'],
executable('wf-background', ['background.cpp', version_h],
dependencies: [gtkmm, gtklayershell, wayland_client, libutil, wf_protos, wfconfig, epoxy],
install: true)
4 changes: 2 additions & 2 deletions src/dock/meson.build
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
executable('wf-dock', ['dock.cpp', 'dock-app.cpp', 'toplevel.cpp', 'toplevel-icon.cpp'],
executable('wf-dock', ['dock.cpp', 'dock-app.cpp', 'toplevel.cpp', 'toplevel-icon.cpp', version_h,],
dependencies: [gtkmm, gtklayershell, wayland_client, libutil, wf_protos, wfconfig],
install: true)
install: true)
2 changes: 1 addition & 1 deletion src/locker-pin/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ deps = [

executable(
'wf-locker-pin',
['locker-pin.cpp'],
['locker-pin.cpp', version_h],
dependencies: deps,
install: true,
)
2 changes: 1 addition & 1 deletion src/locker/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ endif

executable(
'wf-locker',
['locker.cpp', 'lockscreen.cpp', 'timedrevealer.cpp'] + widget_sources,
['locker.cpp', 'lockscreen.cpp', 'timedrevealer.cpp', version_h] + widget_sources,
dependencies: deps,
install: true,
)
2 changes: 1 addition & 1 deletion src/panel/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ endif

executable(
'wf-panel',
['panel.cpp'] + widget_sources,
['panel.cpp', version_h] + widget_sources,
dependencies: deps,
install: true,
)
16 changes: 15 additions & 1 deletion src/util/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ util = static_library(
'network/settings.cpp',
'network/connection.cpp',
'background-gl.cpp',
'icon-select.cpp'
'icon-select.cpp',
],
dependencies: [
wf_protos,
Expand All @@ -32,5 +32,19 @@ util = static_library(
],
)

git_command = [
'sh',
'-c', 'printf "@0@ version @1@-%s (%s) branch %s gtk @2@" "$(git rev-parse --short HEAD)" "$(git log -1 --format=%as)" "$(git rev-parse --abbrev-ref HEAD)"'.format(meson.project_name(), meson.project_version(), gtkmm.version()),
]

fallback_string = '@0@ version @1@-unknown-commit (unknown-date) branch unknown-branch gtk @2@'.format(meson.project_name(), meson.project_version(), gtkmm.version())

version_h = vcs_tag(
input: 'version.h.in',
output: 'version.h',
command: git_command,
fallback: fallback_string,
)

util_includes = include_directories('.')
libutil = declare_dependency(link_with: util, include_directories: util_includes)
2 changes: 2 additions & 0 deletions src/util/version.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#pragma once
#define WF_SHELL_VERSION_STRING "@VCS_TAG@"
12 changes: 11 additions & 1 deletion src/util/wf-shell-app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <wayfire/config/file.hpp>
#include <wf-option-wrap.hpp>
#include <gtk-utils.hpp>
#include "version.h"

#include <unistd.h>

Expand Down Expand Up @@ -370,7 +371,6 @@ WayfireShellApp::WayfireShellApp()

void WayfireShellApp::init_app()
{
std::cout << "setting up" << std::endl;
app = Gtk::Application::create(
this->get_application_name(), Gio::Application::Flags::NONE | this->get_extra_application_flags());
app->signal_activate().connect(
Expand Down Expand Up @@ -402,6 +402,16 @@ WayfireShellApp& WayfireShellApp::get()

void WayfireShellApp::run(int argc, char **argv)
{
for (int i = 1; i < argc; ++i)
{
std::string arg = argv[i];
if ((arg == "-v") || (arg == "--version"))
{
std::cout << WF_SHELL_VERSION_STRING << std::endl;
return; // Terminate early
}
}

app->run(argc, argv);
}

Expand Down