diff --git a/meson.build b/meson.build index 1228364..58e9091 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,8 @@ -project('wdisplays', 'c') +project('com.github.cyclopsian.wdisplays', 'c', license: 'MIT', version: '0.9') + +conf = configuration_data() +conf.set('app_id', meson.project_name()) +conf.set('version', meson.project_version()) subdir('protocol') subdir('resources') diff --git a/protocol/meson.build b/protocol/meson.build index f3a1af4..887c144 100644 --- a/protocol/meson.build +++ b/protocol/meson.build @@ -5,41 +5,41 @@ wayland_protos = dependency('wayland-protocols', version: '>=1.17') wl_protocol_dir = wayland_protos.get_pkgconfig_variable('pkgdatadir') wayland_scanner_code = generator( - wayland_scanner, - output: '@BASENAME@-protocol.c', - arguments: ['private-code', '@INPUT@', '@OUTPUT@'], + wayland_scanner, + output: '@BASENAME@-protocol.c', + arguments: ['private-code', '@INPUT@', '@OUTPUT@'], ) wayland_scanner_client = generator( - wayland_scanner, - output: '@BASENAME@-client-protocol.h', - arguments: ['client-header', '@INPUT@', '@OUTPUT@'], + wayland_scanner, + output: '@BASENAME@-client-protocol.h', + arguments: ['client-header', '@INPUT@', '@OUTPUT@'], ) client_protocols = [ - [wl_protocol_dir, 'unstable/xdg-output/xdg-output-unstable-v1.xml'], - [wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'], - ['wlr-output-management-unstable-v1.xml'], - ['wlr-screencopy-unstable-v1.xml'], - ['wlr-layer-shell-unstable-v1.xml'] + [wl_protocol_dir, 'unstable/xdg-output/xdg-output-unstable-v1.xml'], + [wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'], + ['wlr-output-management-unstable-v1.xml'], + ['wlr-screencopy-unstable-v1.xml'], + ['wlr-layer-shell-unstable-v1.xml'] ] client_protos_src = [] client_protos_headers = [] foreach p : client_protocols - xml = join_paths(p) - client_protos_src += wayland_scanner_code.process(xml) - client_protos_headers += wayland_scanner_client.process(xml) + xml = join_paths(p) + client_protos_src += wayland_scanner_code.process(xml) + client_protos_headers += wayland_scanner_client.process(xml) endforeach lib_client_protos = static_library( - 'client_protos', - client_protos_src + client_protos_headers, - dependencies: [wayland_client] + 'client_protos', + client_protos_src + client_protos_headers, + dependencies: [wayland_client] ) client_protos = declare_dependency( - link_with: lib_client_protos, - sources: client_protos_headers, + link_with: lib_client_protos, + sources: client_protos_headers, ) diff --git a/resources/meson.build b/resources/meson.build index f4f3f55..97a99a6 100644 --- a/resources/meson.build +++ b/resources/meson.build @@ -5,3 +5,35 @@ resources = gnome.compile_resources( source_dir : '.', c_name : 'waydisplay_resources') +scour = find_program('scour', required: false) + +icon = 'wdisplays.svg' +icondir = get_option('datadir') / 'icons' / 'hicolor' / 'scalable' / 'apps' + +if scour.found() + custom_target('optimize-icon', + input: icon, + output: '@0@.svg'.format(meson.project_name()), + command: [scour, + '--enable-viewboxing', + '--enable-comment-stripping', + '--remove-descriptive-elements', + '--enable-id-stripping', + '--shorten-ids', + '--create-groups', + '--strip-xml-space', + '--strip-xml-prolog', + '--indent=none', + '--no-line-breaks', + '@INPUT@', '@OUTPUT@'], + install: true, + install_dir: icondir) + else +install_data(icon, install_dir: icondir) + endif + +install_data( + configure_file(input: 'wdisplays.desktop.in', + output: '@0@.desktop'.format(meson.project_name()), + configuration: conf), + install_dir: get_option('datadir') / 'applications') diff --git a/resources/wdisplays.desktop.in b/resources/wdisplays.desktop.in new file mode 100644 index 0000000..969bf9b --- /dev/null +++ b/resources/wdisplays.desktop.in @@ -0,0 +1,7 @@ +[Desktop Entry] +Version=@version@ +Type=Application +Name=wdisplays +Comment=Wlroots display configuration +Exec=wdisplays +Icon=@app_id@ diff --git a/resources/wdisplays.svg b/resources/wdisplays.svg new file mode 100644 index 0000000..f859f76 --- /dev/null +++ b/resources/wdisplays.svg @@ -0,0 +1,662 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/config.h.in b/src/config.h.in new file mode 100644 index 0000000..bdb438c --- /dev/null +++ b/src/config.h.in @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: MIT */ +/* Copyright (C) 2019 cyclopsian */ + +#ifndef WDISPLAY_CONFIG_H +#define WDISPLAY_CONFIG_H + +#define WDISPLAYS_APP_ID "@app_id@" +#define WDISPLAYS_VERSION "@version@" + +#endif diff --git a/src/main.c b/src/main.c index 203a72f..9b90550 100644 --- a/src/main.c +++ b/src/main.c @@ -1365,7 +1365,7 @@ static void activate(GtkApplication* app, gpointer user_data) { int main(int argc, char *argv[]) { g_setenv("GDK_GL", "gles", FALSE); - GtkApplication *app = gtk_application_new("org.swaywm.sway-outputs", G_APPLICATION_FLAGS_NONE); + GtkApplication *app = gtk_application_new(WDISPLAYS_APP_ID, G_APPLICATION_FLAGS_NONE); g_signal_connect(app, "activate", G_CALLBACK(activate), NULL); int status = g_application_run(G_APPLICATION(app), argc, argv); g_object_unref(app); diff --git a/src/meson.build b/src/meson.build index 26cbd2f..02139b4 100644 --- a/src/meson.build +++ b/src/meson.build @@ -7,6 +7,8 @@ gtk = dependency('gtk+-3.0') assert(gdk.get_pkgconfig_variable('targets').split().contains('wayland'), 'Wayland GDK backend not present') epoxy = dependency('epoxy') +configure_file(input: 'config.h.in', output: 'config.h', configuration: conf) + executable( 'wdisplays', [ diff --git a/src/wdisplays.h b/src/wdisplays.h index fa73ebd..e408957 100644 --- a/src/wdisplays.h +++ b/src/wdisplays.h @@ -11,6 +11,8 @@ #ifndef WDISPLAY_WDISPLAY_H #define WDISPLAY_WDISPLAY_H +#include "config.h" + #define HEADS_MAX 64 #define HOVER_USECS (100 * 1000)