test: launch an application from the shell

This commit is contained in:
DL
2025-06-17 09:36:58 +02:00
parent 8c70733b9b
commit 12014a121d
5 changed files with 42 additions and 6 deletions

View File

@@ -192,6 +192,7 @@ void diya_session_shell_launcher_init(DiyaSessionShell * shell)
g_warning("%s", g_app_info_get_display_name(element_data));
g_warning("%s", g_app_info_get_id(element_data));
g_warning("%s", g_app_info_get_name(element_data));
g_warning("%s", g_app_info_get_executable(element_data));
//g_warning("%s", g_app_info_get_icon(element_data));
}
g_list_free_full(apps, g_object_unref);

View File

@@ -105,7 +105,7 @@ static void diya_session_on_key_pressed(DiyaShell* shell, struct xkb_keymap *xkb
DiyaSessionShell* self = DIYA_SESSION_SHELL(shell);
uint32_t keycode = key + 8;
xkb_keysym_t sym = xkb_state_key_get_one_sym(xkb_state, keycode);
g_debug("Key press %d", sym);
switch(sym)
{
case XKB_KEY_Escape:

View File

@@ -108,6 +108,29 @@ static void diya_dashboard_get_property(GObject *object, guint property_id, GVal
}
}
static void diya_dashboard_launch(GtkButton* btn, DiyaDashboardWidget* self)
{
g_debug("Clicked %d %d", DIYA_IS_DASHBOARD_WIDGET(self), GTK_IS_BUTTON(btn));
GError* error = NULL;
GAppInfo* app = g_app_info_create_from_commandline("htop", "Foot", G_APP_INFO_CREATE_NEEDS_TERMINAL, &error);
if(error)
{
g_critical("Unable to create app info: %s", error->message);
g_error_free(error);
return;
}
error = NULL;
g_app_info_launch(app, NULL, NULL, &error);
if(error)
{
g_critical("Unable to launch application: %s", error->message);
g_error_free(error);
return;
}
g_object_set(self, DIYA_PROP_DASHBOARD_ACTIVE, false, NULL);
}
static void diya_dashboard_widget_class_init(DiyaDashboardWidgetClass* class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS(class);
@@ -122,7 +145,7 @@ static void diya_dashboard_widget_class_init(DiyaDashboardWidgetClass* class)
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), DiyaDashboardWidget, revealer);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), DiyaDashboardWidget, search_entry);
//gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), diya_dashboard_toggle);
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), diya_dashboard_launch);
gtk_widget_class_set_css_name(GTK_WIDGET_CLASS(class), "diya-dashboard");
//gtk_widget_class_bind_template_child(GTK_WIDGET_CLASS (class), ExampleAppWindow, stack);