test: launch an application from the shell
This commit is contained in:
parent
8c70733b9b
commit
12014a121d
12
README.md
12
README.md
@ -16,3 +16,15 @@ Default theme can be set using the envar `DIYA_DEFAULT_THEME`, this will cause t
|
|||||||
|
|
||||||
Default virtual keyboard keymap can be set via the `DIYA_VKB_KEYMAP` environment variable. When created virtual keyboard,
|
Default virtual keyboard keymap can be set via the `DIYA_VKB_KEYMAP` environment variable. When created virtual keyboard,
|
||||||
the shell will search for keymap file in: `/home/$USER/.config/diya/xkb/${DIYA_VKB_KEYMAP}.keymap`
|
the shell will search for keymap file in: `/home/$USER/.config/diya/xkb/${DIYA_VKB_KEYMAP}.keymap`
|
||||||
|
|
||||||
|
|
||||||
|
# Launch terminal based application
|
||||||
|
|
||||||
|
create file in `/home/$USER/bin/xdg-terminal-exec` with:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
#! /bin/sh
|
||||||
|
foot $@
|
||||||
|
```
|
||||||
|
|
||||||
|
this allows gtk4-launch to launch a terminal based application
|
@ -45,10 +45,10 @@
|
|||||||
<object class="GtkBox" id="taskbar">
|
<object class="GtkBox" id="taskbar">
|
||||||
<property name="orientation">horizontal</property>
|
<property name="orientation">horizontal</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkToggleButton" id="btn_user">
|
<object class="GtkButton" id="btn_launch">
|
||||||
<property name="visible">1</property>
|
<property name="visible">1</property>
|
||||||
<property name="label" translatable="yes">User</property>
|
<property name="label" translatable="yes">Terminal</property>
|
||||||
<!--signal name="toggled" handler="diya_dashboard_toggle"/-->
|
<signal name="clicked" handler="diya_dashboard_launch"/>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
@ -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_display_name(element_data));
|
||||||
g_warning("%s", g_app_info_get_id(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_name(element_data));
|
||||||
|
g_warning("%s", g_app_info_get_executable(element_data));
|
||||||
//g_warning("%s", g_app_info_get_icon(element_data));
|
//g_warning("%s", g_app_info_get_icon(element_data));
|
||||||
}
|
}
|
||||||
g_list_free_full(apps, g_object_unref);
|
g_list_free_full(apps, g_object_unref);
|
||||||
|
@ -105,7 +105,7 @@ static void diya_session_on_key_pressed(DiyaShell* shell, struct xkb_keymap *xkb
|
|||||||
DiyaSessionShell* self = DIYA_SESSION_SHELL(shell);
|
DiyaSessionShell* self = DIYA_SESSION_SHELL(shell);
|
||||||
uint32_t keycode = key + 8;
|
uint32_t keycode = key + 8;
|
||||||
xkb_keysym_t sym = xkb_state_key_get_one_sym(xkb_state, keycode);
|
xkb_keysym_t sym = xkb_state_key_get_one_sym(xkb_state, keycode);
|
||||||
|
g_debug("Key press %d", sym);
|
||||||
switch(sym)
|
switch(sym)
|
||||||
{
|
{
|
||||||
case XKB_KEY_Escape:
|
case XKB_KEY_Escape:
|
||||||
|
@ -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)
|
static void diya_dashboard_widget_class_init(DiyaDashboardWidgetClass* class)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS(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, revealer);
|
||||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), DiyaDashboardWidget, search_entry);
|
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_set_css_name(GTK_WIDGET_CLASS(class), "diya-dashboard");
|
||||||
//gtk_widget_class_bind_template_child(GTK_WIDGET_CLASS (class), ExampleAppWindow, stack);
|
//gtk_widget_class_bind_template_child(GTK_WIDGET_CLASS (class), ExampleAppWindow, stack);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user