summaryrefslogtreecommitdiff
path: root/applets
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2018-03-14 17:17:20 +0100
committerraveit65 <[email protected]>2018-03-25 20:42:42 +0200
commitdd6f3f776ae956254433ea33341a3439b89ff070 (patch)
tree986a916d95aeb639e6c3f3dca8d8a74236b0f37d /applets
parent496ac68f8742aa1768cc8f8a443fe61d766bfbf8 (diff)
downloadmate-panel-dd6f3f776ae956254433ea33341a3439b89ff070.tar.bz2
mate-panel-dd6f3f776ae956254433ea33341a3439b89ff070.tar.xz
workspace-switcher: support i3 WM
Fixes https://github.com/mate-desktop/mate-panel/issues/711
Diffstat (limited to 'applets')
-rw-r--r--applets/wncklet/workspace-switcher.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/applets/wncklet/workspace-switcher.c b/applets/wncklet/workspace-switcher.c
index 1c584f78..09a81d0b 100644
--- a/applets/wncklet/workspace-switcher.c
+++ b/applets/wncklet/workspace-switcher.c
@@ -49,6 +49,7 @@ typedef enum {
PAGER_WM_MARCO,
PAGER_WM_METACITY,
PAGER_WM_COMPIZ,
+ PAGER_WM_I3,
PAGER_WM_UNKNOWN
} PagerWM;
@@ -74,6 +75,7 @@ typedef struct {
GtkWidget* num_workspaces_spin;
GtkWidget* workspaces_tree;
GtkListStore* workspaces_store;
+ GtkCellRenderer* cell;
GtkOrientation orientation;
int n_rows; /* for vertical layout this is cols */
@@ -99,6 +101,8 @@ static void pager_update(PagerData* pager)
wnck_pager_set_display_mode(WNCK_PAGER(pager->pager), pager->display_mode);
else if (pager->wm == PAGER_WM_METACITY)
wnck_pager_set_display_mode(WNCK_PAGER(pager->pager), pager->display_mode);
+ else if (pager->wm == PAGER_WM_I3)
+ wnck_pager_set_display_mode(WNCK_PAGER(pager->pager), pager->display_mode);
else
wnck_pager_set_display_mode(WNCK_PAGER(pager->pager), WNCK_PAGER_DISPLAY_CONTENT);
}
@@ -116,6 +120,7 @@ static void update_properties_for_wm(PagerData* pager)
gtk_widget_show(pager->workspace_names_scroll);
if (pager->display_workspaces_toggle)
gtk_widget_show(pager->display_workspaces_toggle);
+ g_object_set (pager->cell, "editable", TRUE, NULL);
break;
case PAGER_WM_METACITY:
if (pager->workspaces_frame)
@@ -126,6 +131,20 @@ static void update_properties_for_wm(PagerData* pager)
gtk_widget_show(pager->workspace_names_scroll);
if (pager->display_workspaces_toggle)
gtk_widget_show(pager->display_workspaces_toggle);
+ g_object_set (pager->cell, "editable", TRUE, NULL);
+ break;
+ case PAGER_WM_I3:
+ if (pager->workspaces_frame)
+ gtk_widget_show(pager->workspaces_frame);
+ if (pager->num_workspaces_spin)
+ gtk_widget_set_sensitive(pager->num_workspaces_spin, FALSE);
+ if (pager->workspace_names_label)
+ gtk_widget_hide(pager->workspace_names_label);
+ if (pager->workspace_names_scroll)
+ gtk_widget_hide(pager->workspace_names_scroll);
+ if (pager->display_workspaces_toggle)
+ gtk_widget_show(pager->display_workspaces_toggle);
+ g_object_set (pager->cell, "editable", FALSE, NULL);
break;
case PAGER_WM_COMPIZ:
if (pager->workspaces_frame)
@@ -136,6 +155,7 @@ static void update_properties_for_wm(PagerData* pager)
gtk_widget_hide(pager->workspace_names_scroll);
if (pager->display_workspaces_toggle)
gtk_widget_hide(pager->display_workspaces_toggle);
+ g_object_set (pager->cell, "editable", FALSE, NULL);
break;
case PAGER_WM_UNKNOWN:
if (pager->workspaces_frame)
@@ -164,6 +184,8 @@ static void window_manager_changed(WnckScreen* screen, PagerData* pager)
pager->wm = PAGER_WM_MARCO;
else if (strcmp(wm_name, "Metacity") == 0)
pager->wm = PAGER_WM_METACITY;
+ else if (strcmp(wm_name, "i3") == 0)
+ pager->wm = PAGER_WM_I3;
else if (strcmp(wm_name, "Compiz") == 0)
pager->wm = PAGER_WM_COMPIZ;
else
@@ -926,6 +948,7 @@ static void setup_dialog(GtkBuilder* builder, PagerData* pager)
g_object_unref(pager->workspaces_store);
cell = g_object_new(GTK_TYPE_CELL_RENDERER_TEXT, "editable", TRUE, NULL);
+ pager->cell = cell;
column = gtk_tree_view_column_new_with_attributes("workspace", cell, "text", 0, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(pager->workspaces_tree), column);
g_signal_connect(cell, "edited", (GCallback) workspace_name_edited, pager);