Compare commits

..
5 Commits
6 changed files with 48 additions and 21 deletions
+1 -1
View File
@@ -35,7 +35,7 @@
</screenshots> </screenshots>
<releases> <releases>
<release version="0.1.0" date="2026-02-28"> <release version="0.1.0" date="2026-03-01">
<description> <description>
<p>Initial release.</p> <p>Initial release.</p>
</description> </description>
+3 -4
View File
@@ -16,10 +16,9 @@
"buildsystem": "meson", "buildsystem": "meson",
"sources": [ "sources": [
{ {
"type": "git", "type": "archive",
"url": "https://gitea.angeltech.jp/Angel-Technologies/MoeMoji", "url": "https://gitea.angeltech.jp/Angel-Technologies/MoeMoji/archive/v0.1.2.tar.gz",
"tag": "v0.1.0", "sha256": "01fd51050f723fc14ba49f8dc09fb5e67336c7e9a54f0c39cb16c69930b26358"
"commit": "17678d789a3d1fd3f22449a1a06927ebee5d982e"
} }
] ]
} }
+2 -2
View File
@@ -9,7 +9,7 @@ static void register_with_portal (void) {
GDBusConnection *bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error); GDBusConnection *bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
if (bus == NULL) { if (bus == NULL) {
g_warning ("portal register: can't get session bus: %s", error->message); g_warning ("portal register: can't get session bus: %s", error->message);
g_error_free (error); g_clear_error (&error);
return; return;
} }
GVariantBuilder options; GVariantBuilder options;
@@ -28,7 +28,7 @@ static void register_with_portal (void) {
-1, NULL, &error); -1, NULL, &error);
if (result == NULL) { if (result == NULL) {
g_info ("portal register: %s", error->message); g_info ("portal register: %s", error->message);
g_error_free (error); g_clear_error (&error);
} else { } else {
g_variant_unref (result); g_variant_unref (result);
} }
+39 -12
View File
@@ -94,9 +94,12 @@ static void toggle_window(MoeMojiApplication *self) {
} }
static gboolean on_close_request(GtkWindow *window, gpointer user_data) { static gboolean on_close_request(GtkWindow *window, gpointer user_data) {
(void)user_data; MoeMojiApplication *self = MOEMOJI_APPLICATION(user_data);
gtk_widget_set_visible(GTK_WIDGET(window), FALSE); if (self->has_tray) {
return TRUE; gtk_widget_set_visible(GTK_WIDGET(window), FALSE);
return TRUE;
}
return FALSE;
} }
static void dbusmenu_method_call(G_GNUC_UNUSED GDBusConnection *connection, static void dbusmenu_method_call(G_GNUC_UNUSED GDBusConnection *connection,
@@ -291,13 +294,38 @@ static void setup_sni(MoeMojiApplication *self) {
if (self->dbus_conn == NULL) { if (self->dbus_conn == NULL) {
g_warning("session bus: %s", error->message); g_warning("session bus: %s", error->message);
g_clear_error(&error); g_clear_error(&error);
self->has_tray = FALSE;
return; return;
} }
GVariant *result = g_dbus_connection_call_sync(
self->dbus_conn, "org.freedesktop.DBus", "/org/freedesktop/DBus",
"org.freedesktop.DBus", "NameHasOwner",
g_variant_new("(s)", "org.kde.StatusNotifierWatcher"), G_VARIANT_TYPE("(b)"),
G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
if (result == NULL) {
g_warning("NameHasOwner check failed: %s", error->message);
g_clear_error(&error);
self->has_tray = FALSE;
return;
}
gboolean watcher_exists = FALSE;
g_variant_get(result, "(b)", &watcher_exists);
g_variant_unref(result);
if (!watcher_exists) {
g_info("No StatusNotifierWatcher found, skipping tray setup");
self->has_tray = FALSE;
return;
}
self->has_tray = TRUE;
GDBusNodeInfo *sni_node = GDBusNodeInfo *sni_node =
g_dbus_node_info_new_for_xml(sni_introspection_xml, &error); g_dbus_node_info_new_for_xml(sni_introspection_xml, &error);
if (sni_node == NULL) { if (sni_node == NULL) {
g_warning("Failed to parse SNI introspection XML: %s", error->message); g_warning("Failed to parse SNI introspection XML: %s", error->message);
g_error_free(error); g_clear_error(&error);
return; return;
} }
self->sni_registration_id = g_dbus_connection_register_object( self->sni_registration_id = g_dbus_connection_register_object(
@@ -306,14 +334,14 @@ static void setup_sni(MoeMojiApplication *self) {
g_dbus_node_info_unref(sni_node); g_dbus_node_info_unref(sni_node);
if (self->sni_registration_id == 0) { if (self->sni_registration_id == 0) {
g_warning("Failed to register SNI object: %s", error->message); g_warning("Failed to register SNI object: %s", error->message);
g_error_free(error); g_clear_error(&error);
return; return;
} }
GDBusNodeInfo *menu_node = GDBusNodeInfo *menu_node =
g_dbus_node_info_new_for_xml(dbusmenu_introspection_xml, &error); g_dbus_node_info_new_for_xml(dbusmenu_introspection_xml, &error);
if (menu_node == NULL) { if (menu_node == NULL) {
g_warning("Failed to parse dbusmenu introspection XML: %s", error->message); g_warning("Failed to parse dbusmenu introspection XML: %s", error->message);
g_error_free(error); g_clear_error(&error);
return; return;
} }
self->menu_registration_id = g_dbus_connection_register_object( self->menu_registration_id = g_dbus_connection_register_object(
@@ -322,7 +350,7 @@ static void setup_sni(MoeMojiApplication *self) {
g_dbus_node_info_unref(menu_node); g_dbus_node_info_unref(menu_node);
if (self->menu_registration_id == 0) { if (self->menu_registration_id == 0) {
g_warning("dbusmenu register: %s", error->message); g_warning("dbusmenu register: %s", error->message);
g_error_free(error); g_clear_error(&error);
} }
const gchar *unique_name = g_dbus_connection_get_unique_name(self->dbus_conn); const gchar *unique_name = g_dbus_connection_get_unique_name(self->dbus_conn);
g_dbus_connection_call( g_dbus_connection_call(
@@ -332,11 +360,10 @@ static void setup_sni(MoeMojiApplication *self) {
NULL, NULL, NULL); NULL, NULL, NULL);
} }
static void on_shortcuts_activated(GDBusProxy *proxy, const gchar *sender_name, static void on_shortcuts_activated(G_GNUC_UNUSED GDBusProxy *proxy,
G_GNUC_UNUSED const gchar *sender_name,
const gchar *signal_name, const gchar *signal_name,
GVariant *parameters, gpointer user_data) { GVariant *parameters, gpointer user_data) {
(void)proxy;
(void)sender_name;
if (g_strcmp0(signal_name, "Activated") != 0) if (g_strcmp0(signal_name, "Activated") != 0)
return; return;
MoeMojiApplication *self = MOEMOJI_APPLICATION(user_data); MoeMojiApplication *self = MOEMOJI_APPLICATION(user_data);
@@ -481,7 +508,7 @@ static void setup_global_shortcuts(MoeMojiApplication *self) {
"org.freedesktop.portal.GlobalShortcuts", NULL, &error); "org.freedesktop.portal.GlobalShortcuts", NULL, &error);
if (self->shortcuts_proxy == NULL) { if (self->shortcuts_proxy == NULL) {
g_warning("GlobalShortcuts: Failed to create proxy: %s", error->message); g_warning("GlobalShortcuts: Failed to create proxy: %s", error->message);
g_error_free(error); g_clear_error(&error);
return; return;
} }
g_timeout_add(500, (GSourceFunc)begin_create_session, self); g_timeout_add(500, (GSourceFunc)begin_create_session, self);
@@ -533,7 +560,7 @@ static void moemoji_application_activate(GApplication *app) {
self->window = g_object_new(MOEMOJI_TYPE_WINDOW, "application", self->window = g_object_new(MOEMOJI_TYPE_WINDOW, "application",
GTK_APPLICATION(self), NULL); GTK_APPLICATION(self), NULL);
g_signal_connect(self->window, "close-request", g_signal_connect(self->window, "close-request",
G_CALLBACK(on_close_request), NULL); G_CALLBACK(on_close_request), self);
self->window_created = TRUE; self->window_created = TRUE;
} else { } else {
toggle_window(self); toggle_window(self);
+1
View File
@@ -16,6 +16,7 @@ struct _MoeMojiApplication {
const gchar *tray_icon_name; const gchar *tray_icon_name;
GDBusProxy *shortcuts_proxy; GDBusProxy *shortcuts_proxy;
gchar *shortcuts_session_path; gchar *shortcuts_session_path;
gboolean has_tray;
}; };
G_BEGIN_DECLS G_BEGIN_DECLS
+2 -2
View File
@@ -222,8 +222,8 @@ static void update_spacer_height(MoeMojiWindow *self) {
gtk_widget_set_size_request(self->bottom_spacer, -1, spacer_h); gtk_widget_set_size_request(self->bottom_spacer, -1, spacer_h);
} }
static void on_scroll_changed(GtkAdjustment *adj, gpointer user_data) { static void on_scroll_changed(G_GNUC_UNUSED GtkAdjustment *adj,
(void)adj; gpointer user_data) {
MoeMojiWindow *self = MOEMOJI_WINDOW(user_data); MoeMojiWindow *self = MOEMOJI_WINDOW(user_data);
update_chip_from_scroll(self); update_chip_from_scroll(self);
} }