summarylogtreecommitdiffstats
path: root/fix-scrolling.patch
blob: 49da2958deb64ede3973324d2e682ea979e764d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
diff '--color=auto' -Naur xfce4-panel-4.16.0-orig/plugins/pager/Makefile.in xfce4-panel-4.16.0/plugins/pager/Makefile.in
--- xfce4-panel-4.16.0-orig/plugins/pager/Makefile.in	2020-12-23 00:01:41.000000000 +0100
+++ xfce4-panel-4.16.0/plugins/pager/Makefile.in	2021-01-19 23:23:26.875526146 +0100
@@ -894,8 +894,8 @@
 
 @INTLTOOL_DESKTOP_RULE@
 
-@MAINTAINER_MODE_TRUE@pager-dialog_ui.h: pager-dialog.glade
-@MAINTAINER_MODE_TRUE@	$(AM_V_GEN) xdt-csource --static --strip-comments --strip-content --name=pager_dialog_ui $< >$@
+pager-dialog_ui.h: pager-dialog.glade
+	$(AM_V_GEN) xdt-csource --static --strip-comments --strip-content --name=pager_dialog_ui $< >$@
 
 # vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
 
diff '--color=auto' -Naur xfce4-panel-4.16.0-orig/plugins/pager/pager.c xfce4-panel-4.16.0/plugins/pager/pager.c
--- xfce4-panel-4.16.0-orig/plugins/pager/pager.c	2020-12-11 00:14:07.000000000 +0100
+++ xfce4-panel-4.16.0/plugins/pager/pager.c	2021-01-19 23:23:34.819563569 +0100
@@ -53,8 +53,11 @@
                                                            guint              prop_id,
                                                            const GValue      *value,
                                                            GParamSpec        *pspec);
-static gboolean pager_plugin_scroll_event                 (GtkWidget         *widget,
+static gboolean pager_buttons_scroll_event                (GtkWidget         *widget,
                                                            GdkEventScroll    *event);
+static gboolean pager_plugin_scroll_event                 (GtkWidget         *widget,
+                                                           GdkEventScroll    *event,
+                                                           gpointer           user_data);
 static void     pager_plugin_drag_begin_event             (GtkWidget         *widget,
                                                            GdkDragContext    *context,
                                                            gpointer           user_data);
@@ -74,6 +77,7 @@
 static void     pager_plugin_configure_workspace_settings (GtkWidget         *button);
 static void     pager_plugin_configure_plugin             (XfcePanelPlugin   *panel_plugin);
 static void     pager_plugin_screen_layout_changed        (PagerPlugin       *plugin);
+static void     pager_plugin_get_ratio                    (PagerPlugin       *plugin);
 static void     pager_plugin_get_preferred_width          (GtkWidget           *widget,
                                                            gint                *minimum_width,
                                                            gint                *natural_width);
@@ -101,15 +105,15 @@
   XfcePanelPlugin __parent__;
 
   GtkWidget     *pager;
-  GObject       *numbering_switch;
-  GObject       *numbering_label;
-  GObject       *scrolling_switch;
-  GObject       *scrolling_label;
+  GObject       *numbering_toggle;
+  GObject       *scrolling_toggle;
+  GObject       *invert_scrolling_toggle;
 
   WnckScreen    *wnck_screen;
 
   /* settings */
   guint          scrolling : 1;
+  guint          invert_scrolling : 1;
   guint          wrap_workspaces : 1;
   guint          miniature_view : 1;
   gint           rows;
@@ -121,6 +125,7 @@
 {
   PROP_0,
   PROP_WORKSPACE_SCROLLING,
+  PROP_INVERT_WORKSPACE_SCROLLING,
   PROP_WRAP_WORKSPACES,
   PROP_MINIATURE_VIEW,
   PROP_ROWS,
@@ -147,7 +152,7 @@
   gobject_class->set_property = pager_plugin_set_property;
 
   widget_class = GTK_WIDGET_CLASS (klass);
-  widget_class->scroll_event = pager_plugin_scroll_event;
+  widget_class->scroll_event = pager_buttons_scroll_event;
   widget_class->get_preferred_width = pager_plugin_get_preferred_width;
   widget_class->get_preferred_width_for_height  = pager_plugin_get_preferred_width_for_height;
   widget_class->get_preferred_height = pager_plugin_get_preferred_height;
@@ -175,6 +180,13 @@
                                                          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   g_object_class_install_property (gobject_class,
+                                   PROP_INVERT_WORKSPACE_SCROLLING,
+                                   g_param_spec_boolean ("workspace-invert-scrolling",
+                                                         NULL, NULL,
+                                                         TRUE,
+                                                         G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_property (gobject_class,
                                    PROP_MINIATURE_VIEW,
                                    g_param_spec_boolean ("miniature-view",
                                                          NULL, NULL,
@@ -203,6 +215,7 @@
 {
   plugin->wnck_screen = NULL;
   plugin->scrolling = TRUE;
+  plugin->invert_scrolling = FALSE;
   plugin->wrap_workspaces = FALSE;
   plugin->miniature_view = TRUE;
   plugin->rows = 1;
@@ -225,6 +238,15 @@
     {
     case PROP_WORKSPACE_SCROLLING:
       g_value_set_boolean (value, plugin->scrolling);
+
+      if (G_IS_OBJECT (plugin->invert_scrolling_toggle))
+        gtk_widget_set_sensitive (GTK_WIDGET (plugin->invert_scrolling_toggle), plugin->scrolling);
+
+      pager_plugin_screen_layout_changed (plugin);
+      break;
+
+    case PROP_INVERT_WORKSPACE_SCROLLING:
+      g_value_set_boolean (value, plugin->invert_scrolling);
       break;
 
     case PROP_WRAP_WORKSPACES:
@@ -234,14 +256,8 @@
     case PROP_MINIATURE_VIEW:
       g_value_set_boolean (value, plugin->miniature_view);
 
-      if (G_IS_OBJECT (plugin->numbering_label))
-        gtk_widget_set_visible (GTK_WIDGET (plugin->numbering_label), !plugin->miniature_view);
-      if (G_IS_OBJECT (plugin->numbering_switch))
-        gtk_widget_set_visible (GTK_WIDGET (plugin->numbering_switch), !plugin->miniature_view);
-      if (G_IS_OBJECT (plugin->scrolling_label))
-        gtk_widget_set_visible (GTK_WIDGET (plugin->scrolling_label), !plugin->miniature_view);
-      if (G_IS_OBJECT (plugin->scrolling_switch))
-        gtk_widget_set_visible (GTK_WIDGET (plugin->scrolling_switch), !plugin->miniature_view);
+      if (G_IS_OBJECT (plugin->numbering_toggle))
+        gtk_widget_set_sensitive (GTK_WIDGET (plugin->numbering_toggle), !plugin->miniature_view);
 
       pager_plugin_screen_layout_changed (plugin);
       break;
@@ -276,6 +292,10 @@
       plugin->scrolling = g_value_get_boolean (value);
       break;
 
+    case PROP_INVERT_WORKSPACE_SCROLLING:
+      plugin->invert_scrolling = g_value_get_boolean (value);
+      break;
+
     case PROP_WRAP_WORKSPACES:
       plugin->wrap_workspaces = g_value_get_boolean (value);
       break;
@@ -355,10 +375,20 @@
 
 
 static gboolean
+pager_buttons_scroll_event (GtkWidget      *widget,
+                            GdkEventScroll *event)
+{
+  pager_plugin_scroll_event(widget, event, XFCE_PAGER_PLUGIN (widget));
+}
+
+
+
+static gboolean
 pager_plugin_scroll_event (GtkWidget      *widget,
-                           GdkEventScroll *event)
+                           GdkEventScroll *event,
+                           gpointer        user_data)
 {
-  PagerPlugin        *plugin = XFCE_PAGER_PLUGIN (widget);
+  PagerPlugin        *plugin = user_data;
   WnckWorkspace      *active_ws;
   WnckWorkspace      *new_ws;
   gint                active_n;
@@ -390,31 +420,91 @@
   active_ws = wnck_screen_get_active_workspace (plugin->wnck_screen);
   active_n = wnck_workspace_get_number (active_ws);
 
-  if (scrolling_direction == GDK_SCROLL_UP
-      || scrolling_direction == GDK_SCROLL_LEFT)
-    active_n--;
-  else
-    active_n++;
-
   n_workspaces = wnck_screen_get_workspace_count (plugin->wnck_screen) - 1;
 
-  if (plugin->wrap_workspaces == TRUE)
+  if (n_workspaces == 0)
   {
-    /* wrap around */
-    if (active_n < 0)
-      active_n = n_workspaces;
-    else if (active_n > n_workspaces)
-      active_n = 0;
+    /* do we have only one workspace or are we in viewport mode (compiz) */
+    if (wnck_workspace_is_virtual (active_ws))
+    {
+      /* viewport mode */
+      int viewport_x;
+      int viewport_y;
+      int screen_width, screen_height;
+      int workspace_width, workspace_height;
+      int scroll_direction;
+
+      /* total workspacesize, e.g. 5120x1024 (5120=4x1280) */
+      workspace_width  = wnck_workspace_get_width  (active_ws);
+      workspace_height = wnck_workspace_get_height (active_ws);
+      /* current screensize, e.g. 1280x1024 */
+      screen_width  = wnck_screen_get_width  (plugin->wnck_screen);
+      screen_height = wnck_screen_get_height (plugin->wnck_screen);
+      /* current viewportcoordinates, e.g. 0,0 or 1280,0 */
+      viewport_x = wnck_workspace_get_viewport_x (active_ws);
+      viewport_y = wnck_workspace_get_viewport_y (active_ws);
+
+      if (scrolling_direction == GDK_SCROLL_UP
+          || scrolling_direction == GDK_SCROLL_LEFT)
+        scroll_direction = (plugin->invert_scrolling ? +1 : -1);
+      else
+        scroll_direction = (plugin->invert_scrolling ? -1 : +1);
+
+      /* viewportscroll is only in x-direction */
+      viewport_x = viewport_x + (scroll_direction * screen_width);
+
+      if (plugin->wrap_workspaces == TRUE)
+      {
+        /* wrap if needed */
+        if (viewport_x > workspace_width)
+            viewport_x = 0;
+        if (viewport_x < 0)
+            viewport_x = workspace_width - screen_width;
+      }
+      else if (viewport_x < 0 || viewport_x >= workspace_width)
+      {
+        /* we do not need to do anything */
+        return TRUE;
+      }
+
+      wnck_screen_move_viewport (plugin->wnck_screen,
+                                   viewport_x, viewport_y);
+    }
+    else
+    {
+      /* only one workspace, no need to do anything */
+      return TRUE;
+    }
+
+
   }
-  else if (active_n < 0 || active_n > n_workspaces )
+  else
   {
-    /* we do not need to do anything */
-    return TRUE;
-  }
+    /* real workspaces */
+    if (scrolling_direction == GDK_SCROLL_UP
+        || scrolling_direction == GDK_SCROLL_LEFT)
+      active_n = active_n + (plugin->invert_scrolling ? +1 : -1);
+    else
+      active_n = active_n + (plugin->invert_scrolling ? -1 : +1);
+
+    if (plugin->wrap_workspaces == TRUE)
+    {
+      /* wrap around */
+      if (active_n < 0)
+        active_n = n_workspaces;
+      else if (active_n > n_workspaces)
+        active_n = 0;
+    }
+    else if (active_n < 0 || active_n > n_workspaces )
+    {
+      /* we do not need to do anything */
+      return TRUE;
+    }
 
-  new_ws = wnck_screen_get_workspace (plugin->wnck_screen, active_n);
-  if (new_ws != NULL && active_ws != new_ws)
-    wnck_workspace_activate (new_ws, event->time);
+    new_ws = wnck_screen_get_workspace (plugin->wnck_screen, active_n);
+    if (new_ws != NULL && active_ws != new_ws)
+      wnck_workspace_activate (new_ws, event->time);
+  }
 
   return TRUE;
 }
@@ -475,13 +565,13 @@
         g_message ("Setting the pager rows returned false. Maybe the setting is not applied.");
 
       wnck_pager_set_orientation (WNCK_PAGER (plugin->pager), orientation);
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-      plugin->ratio = (gfloat) gdk_screen_width () / (gfloat) gdk_screen_height ();
-G_GNUC_END_IGNORE_DEPRECATIONS
       g_signal_connect_after (G_OBJECT (plugin->pager), "drag-begin",
                               G_CALLBACK (pager_plugin_drag_begin_event), plugin);
       g_signal_connect_after (G_OBJECT (plugin->pager), "drag-end",
                               G_CALLBACK (pager_plugin_drag_end_event), plugin);
+      /* overwrite default WnckPager widget scroll-event */
+      g_signal_connect(G_OBJECT(plugin->pager), "scroll-event",
+                       G_CALLBACK(pager_plugin_scroll_event), plugin);
     }
   else
     {
@@ -537,6 +627,7 @@
   const PanelProperty  properties[] =
   {
     { "workspace-scrolling", G_TYPE_BOOLEAN },
+    { "workspace-invert-scrolling", G_TYPE_BOOLEAN },
     { "wrap-workspaces", G_TYPE_BOOLEAN },
     { "miniature-view", G_TYPE_BOOLEAN },
     { "rows", G_TYPE_UINT },
@@ -690,6 +781,14 @@
 
 
 static void
+workspace_scrolling_toggled (GtkWidget *widget, GtkWidget *invert)
+{
+  gtk_widget_set_sensitive (invert, gtk_toggle_button_get_active GTK_TOGGLE_BUTTON (widget));
+}
+
+
+
+static void
 pager_plugin_configure_plugin (XfcePanelPlugin *panel_plugin)
 {
   PagerPlugin *plugin = XFCE_PAGER_PLUGIN (panel_plugin);
@@ -717,13 +816,24 @@
   g_signal_connect (G_OBJECT (object), "clicked",
       G_CALLBACK (pager_plugin_configure_workspace_settings), dialog);
 
-  plugin->scrolling_label = gtk_builder_get_object (builder, "workspace-scrolling-label");
-  plugin->scrolling_switch = gtk_builder_get_object (builder, "workspace-scrolling");
-  panel_return_if_fail (GTK_IS_SWITCH (plugin->scrolling_switch));
+  plugin->scrolling_toggle = gtk_builder_get_object (builder, "workspace-scrolling");
+  panel_return_if_fail (GTK_IS_TOGGLE_BUTTON (plugin->scrolling_toggle));
   g_object_bind_property (G_OBJECT (plugin), "workspace-scrolling",
-                          G_OBJECT (plugin->scrolling_switch), "active",
+                          G_OBJECT (plugin->scrolling_toggle), "active",
                           G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
 
+  plugin->invert_scrolling_toggle = gtk_builder_get_object (builder, "workspace-invert-scrolling");
+  panel_return_if_fail (GTK_IS_TOGGLE_BUTTON (plugin->invert_scrolling_toggle));
+  g_object_bind_property (G_OBJECT (plugin), "workspace-invert-scrolling",
+                          G_OBJECT (plugin->invert_scrolling_toggle), "active",
+                          G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
+
+  gtk_widget_set_sensitive (GTK_WIDGET (plugin->invert_scrolling_toggle),
+      gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (plugin->scrolling_toggle)));
+
+  g_signal_connect (G_OBJECT (plugin->scrolling_toggle), "toggled",
+      G_CALLBACK (workspace_scrolling_toggled), plugin->invert_scrolling_toggle);
+
   object = gtk_builder_get_object (builder, "appearance");
   panel_return_if_fail (GTK_IS_COMBO_BOX (object));
   g_object_bind_property (G_OBJECT (plugin), "miniature-view",
@@ -736,17 +846,13 @@
                           G_OBJECT (object), "value",
                           G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
 
-  plugin->numbering_label = gtk_builder_get_object (builder, "numbering-label");
-  plugin->numbering_switch = gtk_builder_get_object (builder, "numbering");
-  panel_return_if_fail (GTK_IS_SWITCH (plugin->numbering_switch));
+  plugin->numbering_toggle = gtk_builder_get_object (builder, "numbering");
+  panel_return_if_fail (GTK_IS_TOGGLE_BUTTON (plugin->numbering_toggle));
   g_object_bind_property (G_OBJECT (plugin), "numbering",
-                          G_OBJECT (plugin->numbering_switch), "active",
+                          G_OBJECT (plugin->numbering_toggle), "active",
                           G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
 
-  gtk_widget_set_visible (GTK_WIDGET (plugin->numbering_label), !plugin->miniature_view);
-  gtk_widget_set_visible (GTK_WIDGET (plugin->numbering_switch), !plugin->miniature_view);
-  gtk_widget_set_visible (GTK_WIDGET (plugin->scrolling_label), !plugin->miniature_view);
-  gtk_widget_set_visible (GTK_WIDGET (plugin->scrolling_switch), !plugin->miniature_view);
+  gtk_widget_set_sensitive (GTK_WIDGET (plugin->numbering_toggle), !plugin->miniature_view);
 
   /* update the rows limit */
   pager_plugin_configure_n_workspaces_changed (plugin->wnck_screen, NULL, builder);
@@ -756,6 +862,30 @@
 
 
 static void
+pager_plugin_get_ratio (PagerPlugin *plugin)
+{
+  WnckWorkspace *active_ws;
+  GdkRectangle geometry = {0};
+
+  panel_return_if_fail (XFCE_IS_PAGER_PLUGIN (plugin));
+  panel_return_if_fail (WNCK_IS_SCREEN (plugin->wnck_screen));
+
+  active_ws = wnck_screen_get_active_workspace (plugin->wnck_screen);
+  if (wnck_workspace_is_virtual (active_ws))
+    {
+      /* Calculate the ratio for a virtual workspace as used by Compiz */
+      plugin->ratio = (gfloat) wnck_workspace_get_width (active_ws) / (gfloat) wnck_workspace_get_height (active_ws);
+    }
+  else
+    {
+      /* Calculate the ratio for a non-virtual workspace */
+      gdk_monitor_get_geometry(gdk_display_get_primary_monitor(gdk_display_get_default()), &geometry);
+      plugin->ratio = (gfloat) geometry.width / (gfloat) geometry.height;
+    }
+}
+
+
+static void
 pager_plugin_get_preferred_width (GtkWidget *widget,
                                   gint      *minimum_width,
                                   gint      *natural_width)
@@ -777,6 +907,9 @@
     {
       n_workspaces = wnck_screen_get_workspace_count (plugin->wnck_screen);
       n_cols = MAX (1, (n_workspaces + plugin->rows - 1) / plugin->rows);
+
+      pager_plugin_get_ratio(plugin);
+
       min_width = nat_width = (gint) (xfce_panel_plugin_get_size (XFCE_PANEL_PLUGIN (plugin)) / plugin->rows * plugin->ratio * n_cols);
     }
 
@@ -808,6 +941,9 @@
     {
       n_workspaces = wnck_screen_get_workspace_count (plugin->wnck_screen);
       n_cols = MAX (1, (n_workspaces + plugin->rows - 1) / plugin->rows);
+
+      pager_plugin_get_ratio(plugin);
+
       if (mode == XFCE_PANEL_PLUGIN_MODE_VERTICAL)
         min_height = nat_height = (gint) (xfce_panel_plugin_get_size (XFCE_PANEL_PLUGIN (plugin)) / plugin->rows / plugin->ratio * n_cols);
       else /* (mode == XFCE_PANEL_PLUGIN_MODE_DESKBAR) */
diff '--color=auto' -Naur xfce4-panel-4.16.0-orig/plugins/pager/pager-dialog.glade xfce4-panel-4.16.0/plugins/pager/pager-dialog.glade
--- xfce4-panel-4.16.0-orig/plugins/pager/pager-dialog.glade	2020-08-22 00:05:41.000000000 +0200
+++ xfce4-panel-4.16.0/plugins/pager/pager-dialog.glade	2021-01-19 23:23:26.879526164 +0100
@@ -115,111 +115,64 @@
             <property name="position">0</property>
           </packing>
         </child>
+
+        <!-- Switcher options -->
         <child>
-          <object class="GtkGrid">
+          <object class="GtkBox">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
+            <property name="spacing">6</property>
+            <property name="orientation">vertical</property>
             <property name="border_width">6</property>
-            <property name="row_spacing">6</property>
-            <property name="column_spacing">12</property>
+
+            <!-- Appearance label -->
             <child>
-              <object class="GtkLabel" id="label4">
+              <object class="GtkLabel" id="label5">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="margin_left">12</property>
-                <property name="label" translatable="yes">Number of _rows:</property>
-                <property name="use_underline">True</property>
-                <property name="xalign">0</property>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkSpinButton" id="spin1">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="halign">end</property>
-                <property name="adjustment">rows</property>
-                <property name="snap_to_ticks">True</property>
-                <property name="numeric">True</property>
-                <property name="update_policy">if-valid</property>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkSwitch" id="numbering">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="halign">end</property>
-                <property name="valign">center</property>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">2</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkSwitch" id="workspace-scrolling">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="halign">end</property>
-                <property name="valign">center</property>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">3</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="numbering-label">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="margin_left">12</property>
-                <property name="label" translatable="yes">Show workspace number</property>
-                <property name="xalign">0</property>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">2</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="workspace-scrolling-label">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="margin_left">12</property>
-                <property name="label" translatable="yes">Switch workspaces using the mouse wheel</property>
+                <property name="label" translatable="yes">&lt;b&gt;Appearance&lt;/b&gt;</property>
+                <property name="use_markup">True</property>
                 <property name="xalign">0</property>
+                <property name="margin_left">6</property>
+                <property name="margin_top">6</property>
               </object>
               <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">3</property>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
               </packing>
             </child>
+
+            <!-- Grid for combobox and spinbox -->
             <child>
-              <object class="GtkBox">
+              <object class="GtkGrid">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="spacing">12</property>
+                <property name="border_width">6</property>
+                <property name="row_spacing">6</property>
+                <property name="column_spacing">12</property>
+                <property name="margin_left">6</property>
+
+                <!-- Mode label -->
                 <child>
-                  <object class="GtkLabel" id="label5">
+                  <object class="GtkLabel" id="appearance-label">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">&lt;b&gt;Appearance&lt;/b&gt;</property>
+                    <property name="label" translatable="yes">Mode:</property>
+                    <property name="tooltip_text" translatable="yes">Switch between different workspace switcher layouts</property>
                     <property name="use_markup">True</property>
+                    <property name="margin_left">6</property>
                     <property name="xalign">0</property>
                   </object>
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">True</property>
-                    <property name="position">0</property>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">0</property>
                   </packing>
                 </child>
+
+                <!-- Mode combobox -->
                 <child>
                   <object class="GtkComboBox" id="appearance">
                     <property name="visible">True</property>
@@ -229,6 +182,7 @@
                     <property name="model">appearance-model</property>
                     <property name="active">0</property>
                     <property name="id_column">1</property>
+                    <property name="tooltip_text" translatable="yes">Switch between different workspace switcher layouts</property>
                     <child>
                       <object class="GtkCellRendererText" id="renderer"/>
                       <attributes>
@@ -239,25 +193,134 @@
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">True</property>
-                    <property name="position">1</property>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">0</property>
+                  </packing>
+                </child>
+
+                <!-- Number of rows label -->
+                <child>
+                  <object class="GtkLabel" id="label4">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="margin_left">6</property>
+                    <property name="label" translatable="yes">Number of _rows:</property>
+                    <property name="tooltip_text" translatable="yes">Number of rows in the workspace switcher</property>
+                    <property name="use_underline">True</property>
+                    <property name="xalign">0</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">1</property>
+                  </packing>
+                </child>
+
+                <!-- Number of rows spinbutton -->
+                <child>
+                  <object class="GtkSpinButton" id="spin1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="halign">end</property>
+                    <property name="adjustment">rows</property>
+                    <property name="snap_to_ticks">True</property>
+                    <property name="numeric">True</property>
+                    <property name="update_policy">if-valid</property>
+                    <property name="tooltip_text" translatable="yes">Number of rows in the workspace switcher</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">1</property>
                   </packing>
                 </child>
               </object>
               <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">0</property>
-                <property name="width">2</property>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+
+            <!-- Show workspace number toggle -->
+            <child>
+              <object class="GtkCheckButton" id="numbering">
+                <property name="label" translatable="yes">Show workspace _number</property>
+                <property name="tooltip_text" translatable="yes">Show the workspace number in the button</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="margin_left">12</property>
+                <property name="receives_default">False</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+
+            <!-- Behaviour label -->
+            <child>
+              <object class="GtkLabel" id="behaviour-label">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">&lt;b&gt;Behaviour&lt;/b&gt;</property>
+                <property name="use_markup">True</property>
+                <property name="xalign">0</property>
+                <property name="margin_left">6</property>
+                <property name="margin_top">6</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">3</property>
+              </packing>
+            </child>
+
+            <!-- Scrolling behaviour toggle -->
+            <child>
+              <object class="GtkCheckButton" id="workspace-scrolling">
+                <property name="label" translatable="yes">Switch _workspaces using the mouse wheel</property>
+                <property name="tooltip_text" translatable="yes">Switch workspaces using the mouse wheel on the workspace switcher</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="margin_left">12</property>
+                <property name="receives_default">False</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">4</property>
+              </packing>
+            </child>
+
+            <!-- Invert scrolling toggle -->
+            <child>
+              <object class="GtkCheckButton" id="workspace-invert-scrolling">
+                <property name="label" translatable="yes">_Invert mouse wheel workspace switching direction</property>
+                <property name="tooltip_text" translatable="yes">Invert the direction in which the workspaces are switched</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="margin_left">24</property>
+                <property name="receives_default">False</property>
+                <property name="use_underline">True</property>
+                <property name="draw_indicator">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">5</property>
               </packing>
             </child>
           </object>
-          <packing>
-            <property name="expand">True</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
         </child>
       </object>
     </child>
+
     <action-widgets>
       <action-widget response="0">help-button</action-widget>
       <action-widget response="0">close-button</action-widget>