diff options
| author | lukefromdc <[email protected]> | 2025-09-28 00:02:10 -0400 |
|---|---|---|
| committer | lukefromdc <[email protected]> | 2025-09-28 03:04:25 -0400 |
| commit | 271fea95072851db70191cf55a830b43656b1e47 (patch) | |
| tree | 1a7573a966dfbcfc2f393296ac4180c6afe0f4de | |
| parent | cf2f458dd8b70450c3fdffb10d4a45c8c369b3e9 (diff) | |
| download | mate-panel-Switcher-WIP.tar.bz2 mate-panel-Switcher-WIP.tar.xz | |
Workspace-switcher: Initially display a switcher applet in waylandSwitcher-WIP
*Nothing is wired up yet, this is just a displayable applet initially hardcoded to 4 workspaces. That will change to the actual number of workspaces once this is wired up to wayfire
| -rw-r--r-- | applets/wncklet/org.mate.panel.Wncklet.mate-panel-applet.desktop.in.in | 2 | ||||
| -rw-r--r-- | applets/wncklet/wayland-backend.c | 82 | ||||
| -rw-r--r-- | applets/wncklet/wayland-backend.h | 2 | ||||
| -rw-r--r-- | applets/wncklet/workspace-switcher.c | 5 |
4 files changed, 89 insertions, 2 deletions
diff --git a/applets/wncklet/org.mate.panel.Wncklet.mate-panel-applet.desktop.in.in b/applets/wncklet/org.mate.panel.Wncklet.mate-panel-applet.desktop.in.in index 99e7815c..08f46b15 100644 --- a/applets/wncklet/org.mate.panel.Wncklet.mate-panel-applet.desktop.in.in +++ b/applets/wncklet/org.mate.panel.Wncklet.mate-panel-applet.desktop.in.in @@ -24,7 +24,7 @@ Description=Switch between workspaces # Translators: Do NOT translate or transliterate this text (this is an icon file name)! Icon=mate-panel-workspace-switcher MateComponentId=OAFIID:MATE_WorkspaceSwitcherApplet;OAFIID:MATE_PagerApplet; -Platforms=X11; +Platforms=X11;Wayland; X-MATE-Bugzilla-Bugzilla=MATE X-MATE-Bugzilla-Product=mate-panel X-MATE-Bugzilla-Component=workspace switcher diff --git a/applets/wncklet/wayland-backend.c b/applets/wncklet/wayland-backend.c index f10b2d65..f99855a1 100644 --- a/applets/wncklet/wayland-backend.c +++ b/applets/wncklet/wayland-backend.c @@ -742,6 +742,88 @@ tasklist_widget_get_tasklist (GtkWidget* tasklist_widget) return g_object_get_data (G_OBJECT (tasklist_widget), tasklist_manager_key); } +GtkWidget * +wayland_pager_new (GtkWidget *box) +{ + GtkWidget *pager, *button1, *button2, *button3, *button4, *label1, *label2,* label3, *label4; + int n_spaces; + + GtkCssProvider *provider = gtk_css_provider_new (); + GtkStyleContext *context; + + static const gchar css_custom[] = + ".wl-pager-button{" + " border-width:1;" + " border-style: solid;" + " border-color: black;" + " border-radius: 0;" + "}"; + + gtk_css_provider_load_from_data (provider, css_custom, -1, NULL); + + pager = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); + button1 = gtk_toggle_button_new (); + context = gtk_widget_get_style_context (button1); + gtk_style_context_add_class (context, "wl-pager-button"); + gtk_style_context_add_provider (gtk_widget_get_style_context (GTK_WIDGET (button1)), + GTK_STYLE_PROVIDER (provider), + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + + + button2 = gtk_toggle_button_new (); + context = gtk_widget_get_style_context (button2); + gtk_style_context_add_class (context, "wl-pager-button"); + gtk_style_context_add_provider (gtk_widget_get_style_context (GTK_WIDGET (button2)), + GTK_STYLE_PROVIDER (provider), + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + + button3 = gtk_toggle_button_new (); + context = gtk_widget_get_style_context (button3); + gtk_style_context_add_class (context, "wl-pager-button"); + gtk_style_context_add_provider (gtk_widget_get_style_context (GTK_WIDGET (button3)), + GTK_STYLE_PROVIDER (provider), + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + + button4 = gtk_toggle_button_new (); + context = gtk_widget_get_style_context (button4); + gtk_style_context_add_class (context, "wl-pager-button"); + gtk_style_context_add_provider (gtk_widget_get_style_context (GTK_WIDGET (button4)), + GTK_STYLE_PROVIDER (provider), + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + + label1 = gtk_label_new(" "); + label2 = gtk_label_new(" "); + label3 = gtk_label_new(" "); + label4 = gtk_label_new(" "); + + gtk_box_pack_start (GTK_BOX (pager), button1, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (pager), button2, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (pager), button3, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (pager), button4, TRUE, TRUE, 0); + + gtk_container_add (GTK_CONTAINER(button1), label1); + gtk_container_add (GTK_CONTAINER(button2), label2); + gtk_container_add (GTK_CONTAINER(button3), label3); + gtk_container_add (GTK_CONTAINER(button4), label4); + + gtk_style_context_add_provider (gtk_widget_get_style_context (GTK_WIDGET (pager)), + GTK_STYLE_PROVIDER (provider), + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + + gtk_widget_show (button1); + gtk_widget_show (button2); + gtk_widget_show (button3); + gtk_widget_show (button4); + gtk_widget_show (label1); + gtk_widget_show (label2); + gtk_widget_show (label3); + gtk_widget_show (label4); + + + return pager; +} + + void wayland_tasklist_set_orientation (GtkWidget* tasklist_widget, GtkOrientation orient) { diff --git a/applets/wncklet/wayland-backend.h b/applets/wncklet/wayland-backend.h index e2402236..44d324a1 100644 --- a/applets/wncklet/wayland-backend.h +++ b/applets/wncklet/wayland-backend.h @@ -38,6 +38,8 @@ extern "C" { GtkWidget* wayland_tasklist_new (void); void wayland_tasklist_set_orientation (GtkWidget* tasklist_widget, GtkOrientation orient); +GtkWidget* wayland_pager_new (GtkWidget *box); + #ifdef __cplusplus } #endif diff --git a/applets/wncklet/workspace-switcher.c b/applets/wncklet/workspace-switcher.c index cba0ecbd..f194ebd5 100644 --- a/applets/wncklet/workspace-switcher.c +++ b/applets/wncklet/workspace-switcher.c @@ -31,6 +31,8 @@ #ifdef HAVE_WAYLAND #include <gdk/gdkwayland.h> +#include "wayland-protocol/wlr-foreign-toplevel-management-unstable-v1-client.h" +#include "wayland-backend.h" #endif /* HAVE_WAYLAND */ #include <libmate-desktop/mate-gsettings.h> @@ -785,7 +787,8 @@ gboolean workspace_switcher_applet_fill(MatePanelApplet* applet) #ifdef HAVE_WAYLAND if (GDK_IS_WAYLAND_DISPLAY (gdk_display_get_default ())) { - pager->pager = gtk_label_new ("[Pager not supported on Wayland]"); + GtkWidget *box; + pager->pager = wayland_pager_new(box); } else #endif /* HAVE_WAYLAND */ |
