-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathprefs.js
More file actions
1851 lines (1702 loc) · 75.4 KB
/
Copy pathprefs.js
File metadata and controls
1851 lines (1702 loc) · 75.4 KB
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
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright 2026 Daniel Blandford
import Adw from 'gi://Adw';
import Gdk from 'gi://Gdk';
import GLib from 'gi://GLib';
import GObject from 'gi://GObject';
import Gio from 'gi://Gio';
import Gtk from 'gi://Gtk';
import { ExtensionPreferences } from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';
import { buildWidgetPreferenceSections } from './src/shared/home_screen/widgets/widgetFramework.js';
import { openWidgetSettingsWindow } from './src/shared/home_screen/widgets/widgetSettingsWindow.js';
// --- Icon chooser infrastructure ---
const IconDataItem = GObject.registerClass({
Properties: {
'display-name': GObject.ParamSpec.string(
'display-name', '', '', GObject.ParamFlags.READWRITE, ''),
'icon-string': GObject.ParamSpec.string(
'icon-string', '', '', GObject.ParamFlags.READWRITE, ''),
},
}, class IconDataItem extends GObject.Object {});
let _iconCachePromise = null;
function _getSystemIcons() {
if (_iconCachePromise)
return _iconCachePromise;
_iconCachePromise = new Promise(resolve => {
GLib.idle_add(GLib.PRIORITY_LOW, () => {
const display = Gdk.Display.get_default();
const theme = Gtk.IconTheme.get_for_display(display);
const names = [...new Set(theme.get_icon_names())].sort();
resolve(names);
return GLib.SOURCE_REMOVE;
});
});
return _iconCachePromise;
}
function _clearIconCache() {
_iconCachePromise = null;
}
const IconChooserDialog = GObject.registerClass({
Signals: { 'response': { param_types: [GObject.TYPE_INT] } },
}, class IconChooserDialog extends Adw.Window {
_init(parent) {
super._init({
modal: true,
transient_for: parent,
default_width: 520,
default_height: 580,
title: 'Choose Icon',
});
this._iconString = '';
this._filterMode = 'all';
this._searchDelay = 0;
const toolbarView = new Adw.ToolbarView();
this.set_content(toolbarView);
const headerBar = new Adw.HeaderBar();
const cancelBtn = new Gtk.Button({ label: 'Cancel' });
cancelBtn.connect('clicked', () => this.close());
headerBar.pack_start(cancelBtn);
const selectBtn = new Gtk.Button({
label: 'Select',
css_classes: ['suggested-action'],
sensitive: false,
});
selectBtn.connect('clicked', () => {
this.emit('response', Gtk.ResponseType.APPLY);
this.close();
});
headerBar.pack_end(selectBtn);
toolbarView.add_top_bar(headerBar);
const contentBox = new Gtk.Box({
orientation: Gtk.Orientation.VERTICAL,
spacing: 8,
margin_start: 12, margin_end: 12,
margin_top: 8, margin_bottom: 8,
});
toolbarView.set_content(contentBox);
const searchRow = new Gtk.Box({ spacing: 8 });
const searchEntry = new Gtk.SearchEntry({
hexpand: true,
placeholder_text: 'Search icons\u2026',
});
searchRow.append(searchEntry);
const filterMenu = new Gio.Menu();
filterMenu.append('All', 'icon-filter.set::all');
filterMenu.append('Symbolic', 'icon-filter.set::symbolic');
filterMenu.append('Full Color', 'icon-filter.set::color');
const filterBtn = new Gtk.MenuButton({
icon_name: 'view-more-symbolic',
menu_model: filterMenu,
tooltip_text: 'Filter icon type',
});
const filterAction = new Gio.SimpleAction({
name: 'set',
parameter_type: GLib.VariantType.new('s'),
});
filterAction.connect('activate', (_a, param) => {
this._filterMode = param.unpack();
this._applyFilter(searchEntry.get_text());
});
const actionGroup = new Gio.SimpleActionGroup();
actionGroup.add_action(filterAction);
this.insert_action_group('icon-filter', actionGroup);
searchRow.append(filterBtn);
contentBox.append(searchRow);
this._store = new Gio.ListStore({ item_type: IconDataItem });
this._filterModel = new Gtk.FilterListModel({
model: this._store,
filter: Gtk.CustomFilter.new(null),
});
this._selection = new Gtk.SingleSelection({
model: this._filterModel,
autoselect: false,
});
this._selection.connect('notify::selected-item', () => {
const item = this._selection.get_selected_item();
if (item) {
this._iconString = item.icon_string;
selectBtn.sensitive = true;
} else {
selectBtn.sensitive = false;
}
});
const factory = new Gtk.SignalListItemFactory();
factory.connect('setup', (_f, listItem) => {
const box = new Gtk.Box({
orientation: Gtk.Orientation.VERTICAL,
spacing: 4, halign: Gtk.Align.CENTER,
valign: Gtk.Align.CENTER,
});
const img = new Gtk.Image({ pixel_size: 32 });
box.append(img);
listItem.set_child(box);
});
factory.connect('bind', (_f, listItem) => {
const item = listItem.get_item();
const box = listItem.get_child();
const img = box.get_first_child();
img.icon_name = item.icon_string;
box.tooltip_text = item.display_name;
});
const gridView = new Gtk.GridView({
model: this._selection,
factory,
min_columns: 4,
max_columns: 9,
css_classes: ['convergence-icon-grid'],
vexpand: true,
});
gridView.connect('activate', (_gv, pos) => {
this._selection.set_selected(pos);
this._iconString = this._selection.get_selected_item()?.icon_string ?? '';
if (this._iconString) {
this.emit('response', Gtk.ResponseType.APPLY);
this.close();
}
});
const scroll = new Gtk.ScrolledWindow({
hscrollbar_policy: Gtk.PolicyType.NEVER,
vexpand: true,
css_classes: ['card'],
});
scroll.set_child(gridView);
contentBox.append(scroll);
const browseBtn = new Gtk.Button({
label: 'Browse Files\u2026',
halign: Gtk.Align.CENTER,
margin_top: 4,
});
browseBtn.connect('clicked', () => {
const fd = new Gtk.FileDialog({
title: 'Choose Icon',
default_filter: (() => {
const f = new Gtk.FileFilter();
f.set_name('Images');
f.add_mime_type('image/svg+xml');
f.add_mime_type('image/png');
f.add_mime_type('image/jpeg');
f.add_pixbuf_formats();
return f;
})(),
});
fd.open(this, null, (_d, res) => {
try {
const file = fd.open_finish(res);
if (file) {
this._iconString = file.get_path();
this.emit('response', Gtk.ResponseType.APPLY);
this.close();
}
} catch (_e) { /* cancelled */ }
});
});
contentBox.append(browseBtn);
searchEntry.connect('search-changed', () => {
if (this._searchDelay)
GLib.source_remove(this._searchDelay);
this._searchDelay = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 300, () => {
this._searchDelay = 0;
this._applyFilter(searchEntry.get_text());
return GLib.SOURCE_REMOVE;
});
});
_getSystemIcons().then(names => {
for (const name of names)
this._store.append(new IconDataItem({ display_name: name, icon_string: name }));
});
}
get iconString() {
return this._iconString;
}
_applyFilter(text) {
const query = (text ?? '').toLowerCase();
const mode = this._filterMode;
this._filterModel.set_filter(Gtk.CustomFilter.new(item => {
const name = item.display_name;
if (query && !name.includes(query))
return false;
if (mode === 'symbolic')
return name.endsWith('-symbolic');
if (mode === 'color')
return !name.endsWith('-symbolic');
return true;
}));
}
});
function _createIconChooserRow(settings, key, parentWindow, {title, defaultIcon} = {}) {
defaultIcon = defaultIcon || 'view-app-grid-symbolic';
title = title || 'App grid button icon';
const row = new Adw.ActionRow({
title,
subtitle: settings.get_string(key) || `(default: ${defaultIcon})`,
});
const preview = new Gtk.Image({
pixel_size: 24,
valign: Gtk.Align.CENTER,
});
row.add_suffix(preview);
const _setPreviewIcon = (iconStr) => {
if (iconStr && iconStr.startsWith('/')) {
try {
preview.set_from_gicon(Gio.FileIcon.new(Gio.File.new_for_path(iconStr)));
return;
} catch (_e) {}
}
preview.icon_name = iconStr || 'image-missing';
};
const chooseBtn = new Gtk.Button({
icon_name: 'document-edit-symbolic',
valign: Gtk.Align.CENTER,
tooltip_text: 'Choose icon',
});
chooseBtn.connect('clicked', () => {
const dlg = new IconChooserDialog(parentWindow);
dlg.connect('response', (_d, type) => {
if (type === Gtk.ResponseType.APPLY && dlg.iconString) {
settings.set_string(key, dlg.iconString);
}
});
dlg.present();
});
row.add_suffix(chooseBtn);
const resetBtn = new Gtk.Button({
icon_name: 'edit-undo-symbolic',
valign: Gtk.Align.CENTER,
tooltip_text: 'Reset to default',
});
resetBtn.connect('clicked', () => {
settings.set_string(key, '');
});
row.add_suffix(resetBtn);
const defaultLabel = defaultIcon.startsWith('/')
? GLib.path_get_basename(defaultIcon) : defaultIcon;
const _update = () => {
const val = settings.get_string(key);
row.subtitle = val || `(default: ${defaultLabel})`;
_setPreviewIcon(val || defaultIcon);
};
settings.connect(`changed::${key}`, _update);
_update();
return row;
}
export default class ConvergencePreferences extends ExtensionPreferences {
fillPreferencesWindow(window) {
const settings = this.getSettings();
const settingsSchema = settings.settings_schema;
const pageByName = new Map();
const hasKey = key => {
try {
return !!settingsSchema?.has_key(key);
} catch (_e) {
return false;
}
};
// --- Desktop tab ---
const desktopPage = new Adw.PreferencesPage({
title: 'Desktop',
icon_name: 'video-display-symbolic',
});
desktopPage.set_name('desktop');
pageByName.set('desktop', desktopPage);
pageByName.set('windows', desktopPage);
window.add(desktopPage);
const generalGroup = new Adw.PreferencesGroup({
title: 'General',
});
desktopPage.add(generalGroup);
// --- App Windows popup ---
const appWindowsRow = new Adw.ActionRow({
title: 'App windows',
subtitle: 'Rounded corners and window appearance',
activatable: true,
});
appWindowsRow.add_suffix(new Gtk.Image({ icon_name: 'go-next-symbolic' }));
appWindowsRow.connect('activated', () => {
const dlg = new Adw.Dialog({
title: 'App Windows',
content_width: 500,
content_height: 300,
});
const tv = new Adw.ToolbarView();
tv.add_top_bar(new Adw.HeaderBar());
const pg = new Adw.PreferencesPage();
tv.set_content(pg);
dlg.set_child(tv);
const grp = new Adw.PreferencesGroup({
title: 'App Windows',
description: 'Configure window appearance',
});
pg.add(grp);
const cornersEnabledRow = new Adw.SwitchRow({
title: 'Rounded corners',
subtitle: 'Apply rounded corners to windows (resets to off on each startup)',
});
settings.bind('rounded-corners-enabled', cornersEnabledRow, 'active', Gio.SettingsBindFlags.DEFAULT);
grp.add(cornersEnabledRow);
const cornerRadiusRow = new Adw.SpinRow({
title: 'Corner radius',
subtitle: 'Corner radius in pixels for maximized windows (0 to disable)',
adjustment: new Gtk.Adjustment({
lower: 0, upper: 50, step_increment: 1, page_increment: 5,
}),
});
settings.bind('window-corner-radius', cornerRadiusRow, 'value', Gio.SettingsBindFlags.DEFAULT);
grp.add(cornerRadiusRow);
const cornerSmoothingRow = new Adw.SpinRow({
title: 'Corner smoothing',
subtitle: 'Squircle smoothing (0 = circular, 1 = max smoothness)',
digits: 2,
adjustment: new Gtk.Adjustment({
lower: 0, upper: 1, step_increment: 0.05, page_increment: 0.1,
}),
});
settings.bind('window-corner-smoothing', cornerSmoothingRow, 'value', Gio.SettingsBindFlags.DEFAULT);
grp.add(cornerSmoothingRow);
dlg.present(window);
});
generalGroup.add(appWindowsRow);
// --- Multi-Monitor popup ---
const multiMonRow = new Adw.ActionRow({
title: 'Multi-monitor',
subtitle: 'Independent workspaces and workspace shortcut behavior',
activatable: true,
});
multiMonRow.add_suffix(new Gtk.Image({ icon_name: 'go-next-symbolic' }));
multiMonRow.connect('activated', () => {
const dlg = new Adw.Dialog({
title: 'Multi-Monitor',
content_width: 500,
content_height: 500,
});
const tv = new Adw.ToolbarView();
tv.add_top_bar(new Adw.HeaderBar());
const pg = new Adw.PreferencesPage();
tv.set_content(pg);
dlg.set_child(tv);
const grp = new Adw.PreferencesGroup({
title: 'Multi-Monitor',
description: 'Control workspace behavior across multiple displays',
});
pg.add(grp);
const independentWsRow = new Adw.SwitchRow({
title: 'Independent workspaces',
subtitle: 'Each monitor navigates its own workspace stack independently',
});
if (hasKey('independent-workspaces')) {
try {
settings.bind('independent-workspaces', independentWsRow, 'active', Gio.SettingsBindFlags.DEFAULT);
} catch (_e) {
independentWsRow.set_sensitive(false);
independentWsRow.set_subtitle('Unavailable: schema key independent-workspaces is missing');
}
} else {
independentWsRow.set_sensitive(false);
independentWsRow.set_subtitle('Unavailable: schema key independent-workspaces is missing');
}
grp.add(independentWsRow);
const vanillaPrimaryWsRow = new Adw.SwitchRow({
title: 'Vanilla primary workspaces',
subtitle: 'Keep GNOME-native workspace behavior on primary display while secondary displays stay independent',
});
if (hasKey('independent-workspaces-vanilla-primary')) {
try {
settings.bind('independent-workspaces-vanilla-primary', vanillaPrimaryWsRow, 'active', Gio.SettingsBindFlags.DEFAULT);
} catch (_e) {
vanillaPrimaryWsRow.set_sensitive(false);
vanillaPrimaryWsRow.set_subtitle('Unavailable: schema key independent-workspaces-vanilla-primary is missing');
}
} else {
vanillaPrimaryWsRow.set_sensitive(false);
vanillaPrimaryWsRow.set_subtitle('Unavailable: schema key independent-workspaces-vanilla-primary is missing');
}
if (hasKey('independent-workspaces') && hasKey('independent-workspaces-vanilla-primary')) {
independentWsRow.bind_property(
'active', vanillaPrimaryWsRow, 'sensitive',
GObject.BindingFlags.SYNC_CREATE
);
}
grp.add(vanillaPrimaryWsRow);
const workspaceShortcutTargetRow = new Adw.ComboRow({
title: 'Workspace shortcut target',
subtitle: 'When independent workspaces is enabled, keyboard shortcuts target pointer or focused monitor',
model: new Gtk.StringList({ strings: ['Pointer monitor', 'Focused monitor'] }),
});
if (hasKey('workspace-shortcut-target-monitor')) {
const shortcutTargetMap = { pointer: 0, focused: 1 };
const shortcutTargetValues = ['pointer', 'focused'];
workspaceShortcutTargetRow.set_selected(
shortcutTargetMap[settings.get_string('workspace-shortcut-target-monitor')] ?? 0
);
workspaceShortcutTargetRow.connect('notify::selected', () => {
settings.set_string(
'workspace-shortcut-target-monitor',
shortcutTargetValues[workspaceShortcutTargetRow.get_selected()] ?? 'pointer'
);
});
settings.connect('changed::workspace-shortcut-target-monitor', () => {
workspaceShortcutTargetRow.set_selected(
shortcutTargetMap[settings.get_string('workspace-shortcut-target-monitor')] ?? 0
);
});
} else {
workspaceShortcutTargetRow.set_sensitive(false);
workspaceShortcutTargetRow.set_subtitle('Unavailable: schema key workspace-shortcut-target-monitor is missing');
}
if (hasKey('independent-workspaces')) {
independentWsRow.bind_property(
'active', workspaceShortcutTargetRow, 'sensitive',
GObject.BindingFlags.SYNC_CREATE
);
}
grp.add(workspaceShortcutTargetRow);
const homeInOverviewRow = new Adw.SwitchRow({
title: 'Show homescreen in overview',
subtitle: 'Only affects GNOME overview; normal workspace visibility is unchanged',
});
if (hasKey('show-home-in-overview')) {
try {
settings.bind('show-home-in-overview', homeInOverviewRow, 'active', Gio.SettingsBindFlags.DEFAULT);
} catch (_e) {
homeInOverviewRow.set_sensitive(false);
homeInOverviewRow.set_subtitle('Unavailable: schema key show-home-in-overview is missing');
}
} else {
homeInOverviewRow.set_sensitive(false);
homeInOverviewRow.set_subtitle('Unavailable: schema key show-home-in-overview is missing');
}
grp.add(homeInOverviewRow);
dlg.present(window);
});
generalGroup.add(multiMonRow);
// --- Taskbar ---
pageByName.set('dock', desktopPage);
const dockTaskbarModeRow = new Adw.SwitchRow({
title: 'Panel mode',
subtitle: 'Span the full height of the monitor edge',
});
settings.bind(
'taskbar-panel-mode',
dockTaskbarModeRow,
'active',
Gio.SettingsBindFlags.DEFAULT
);
const dockLayoutGroup = new Adw.PreferencesGroup({
title: 'Taskbar',
description: 'Placement, appearance, mode, and effects for the taskbar',
});
desktopPage.add(dockLayoutGroup);
const visibilitySettingsRow = new Adw.ActionRow({
title: 'Visibility',
subtitle: 'When the taskbar shows and when it retracts',
activatable: true,
});
visibilitySettingsRow.add_suffix(new Gtk.Image({
icon_name: 'go-next-symbolic',
}));
visibilitySettingsRow.connect('activated', () => {
const visDialog = new Adw.Dialog({
title: 'Taskbar Visibility',
content_width: 500,
content_height: 500,
});
const visToolbarView = new Adw.ToolbarView();
const visHeaderBar = new Adw.HeaderBar();
visToolbarView.add_top_bar(visHeaderBar);
const visDialogPage = new Adw.PreferencesPage();
visToolbarView.set_content(visDialogPage);
visDialog.set_child(visToolbarView);
const dockVisibilityGroup = new Adw.PreferencesGroup({
title: 'Visibility',
description: 'When the taskbar shows and when it retracts',
});
visDialogPage.add(dockVisibilityGroup);
const dockModeRow = new Adw.ComboRow({
title: 'Taskbar visibility',
subtitle: 'How the taskbar appears on the desktop',
model: new Gtk.StringList({ strings: ['Always visible', 'Auto-hide'] }),
});
const dockModeValue = settings.get_string('taskbar-secondary-mode');
dockModeRow.set_selected(dockModeValue === 'hidden' ? 1 : 0);
dockModeRow.connect('notify::selected', () => {
settings.set_string('taskbar-secondary-mode',
dockModeRow.get_selected() === 1 ? 'hidden' : 'visible');
});
settings.connect('changed::taskbar-secondary-mode', () => {
let val = settings.get_string('taskbar-secondary-mode');
dockModeRow.set_selected(val === 'hidden' ? 1 : 0);
});
dockVisibilityGroup.add(dockModeRow);
const dockHoverRow = new Adw.SwitchRow({
title: 'Show on hover',
subtitle: 'Reveal the taskbar when hovering the screen edge',
});
settings.bind(
'taskbar-autohide-hover',
dockHoverRow,
'active',
Gio.SettingsBindFlags.DEFAULT
);
dockModeRow.bind_property(
'selected', dockHoverRow, 'sensitive',
GObject.BindingFlags.SYNC_CREATE
);
dockVisibilityGroup.add(dockHoverRow);
const dockOverlapHideRow = new Adw.SwitchRow({
title: 'Hide when window overlaps',
subtitle: 'Hide taskbar when windows move behind its area',
});
settings.bind(
'taskbar-hide-when-overlapped',
dockOverlapHideRow,
'active',
Gio.SettingsBindFlags.DEFAULT
);
dockVisibilityGroup.add(dockOverlapHideRow);
const dockMaximizedAvoidRow = new Adw.SwitchRow({
title: 'Keep maximized windows clear',
subtitle: 'Hide taskbar when a maximized window is present to avoid overlap',
});
settings.bind(
'taskbar-maximized-avoid-taskbar',
dockMaximizedAvoidRow,
'active',
Gio.SettingsBindFlags.DEFAULT
);
dockVisibilityGroup.add(dockMaximizedAvoidRow);
let dockIntellihideRow = null;
if (hasKey('taskbar-intellihide')) {
dockIntellihideRow = new Adw.SwitchRow({
title: 'Intellihide',
subtitle: 'Auto-hide taskbar when windows overlap; reveal on pointer-at-edge',
});
settings.bind(
'taskbar-intellihide',
dockIntellihideRow,
'active',
Gio.SettingsBindFlags.DEFAULT
);
dockVisibilityGroup.add(dockIntellihideRow);
}
const syncDockVisibilityDependents = () => {
const alwaysVisible = dockModeRow.get_selected() === 0;
dockOverlapHideRow.set_sensitive(alwaysVisible);
dockMaximizedAvoidRow.set_sensitive(alwaysVisible);
if (dockIntellihideRow)
dockIntellihideRow.set_sensitive(alwaysVisible);
};
dockModeRow.connect('notify::selected', syncDockVisibilityDependents);
syncDockVisibilityDependents();
visDialog.present(window);
});
dockLayoutGroup.add(visibilitySettingsRow);
const dockMonitorModeRow = new Adw.ComboRow({
title: 'Taskbar displays',
subtitle: 'Show taskbar on all displays or only one display',
model: new Gtk.StringList({ strings: ['All multi-window displays', 'Single display only'] }),
});
const dockMonitorModeValue = settings.get_string('taskbar-monitor-mode');
dockMonitorModeRow.set_selected(dockMonitorModeValue === 'single' ? 1 : 0);
dockMonitorModeRow.connect('notify::selected', () => {
settings.set_string('taskbar-monitor-mode',
dockMonitorModeRow.get_selected() === 1 ? 'single' : 'all');
});
settings.connect('changed::taskbar-monitor-mode', () => {
let val = settings.get_string('taskbar-monitor-mode');
dockMonitorModeRow.set_selected(val === 'single' ? 1 : 0);
});
dockLayoutGroup.add(dockMonitorModeRow);
const dockSingleTargetRow = new Adw.ComboRow({
title: 'Single-display target',
subtitle: 'Primary, or the focused display (pointer display when using a mouse)',
model: new Gtk.StringList({ strings: ['Primary display', 'Focused/pointer display'] }),
});
const dockSingleTargetValue = settings.get_string('taskbar-single-monitor-target');
dockSingleTargetRow.set_selected(dockSingleTargetValue === 'focused' ? 1 : 0);
dockSingleTargetRow.connect('notify::selected', () => {
settings.set_string('taskbar-single-monitor-target',
dockSingleTargetRow.get_selected() === 1 ? 'focused' : 'primary');
});
settings.connect('changed::taskbar-single-monitor-target', () => {
let val = settings.get_string('taskbar-single-monitor-target');
dockSingleTargetRow.set_selected(val === 'focused' ? 1 : 0);
});
dockMonitorModeRow.bind_property(
'selected', dockSingleTargetRow, 'sensitive',
GObject.BindingFlags.SYNC_CREATE
);
dockLayoutGroup.add(dockSingleTargetRow);
if (hasKey('taskbar-app-grid-icon')) {
const dockIconRow = _createIconChooserRow(settings, 'taskbar-app-grid-icon', window);
dockLayoutGroup.add(dockIconRow);
}
const effectsSettingsRow = new Adw.ActionRow({
title: 'Effects & indicators',
subtitle: 'Animations, hover effects, running indicators, and badges',
activatable: true,
});
effectsSettingsRow.add_suffix(new Gtk.Image({
icon_name: 'go-next-symbolic',
}));
effectsSettingsRow.connect('activated', () => {
const effDialog = new Adw.Dialog({
title: 'Effects & Indicators',
content_width: 500,
content_height: 650,
});
const effToolbarView = new Adw.ToolbarView();
const effHeaderBar = new Adw.HeaderBar();
effToolbarView.add_top_bar(effHeaderBar);
const effDialogPage = new Adw.PreferencesPage();
effToolbarView.set_content(effDialogPage);
effDialog.set_child(effToolbarView);
const dockEffectsGroup = new Adw.PreferencesGroup({
title: 'Animations',
description: 'Launch effects and hover animations',
});
effDialogPage.add(dockEffectsGroup);
const dockAnimateOpenRow = new Adw.SwitchRow({
title: 'Animate opening applications',
subtitle: 'Play a launch animation on app activation',
});
settings.bind(
'taskbar-animate-opening-apps',
dockAnimateOpenRow,
'active',
Gio.SettingsBindFlags.DEFAULT
);
dockEffectsGroup.add(dockAnimateOpenRow);
const hoverAnimRow = new Adw.SwitchRow({
title: 'Animate hovering app icons',
subtitle: 'Animate taskbar icons when the pointer hovers over them',
});
settings.bind(
'taskbar-animate-hover',
hoverAnimRow,
'active',
Gio.SettingsBindFlags.DEFAULT
);
dockEffectsGroup.add(hoverAnimRow);
const hoverAnimExpanderRow = new Adw.ExpanderRow({
title: 'Hover animation options',
subtitle: 'Type, duration, zoom, travel, rotation, and extent',
show_enable_switch: false,
});
hoverAnimRow.bind_property(
'active', hoverAnimExpanderRow, 'sensitive',
GObject.BindingFlags.SYNC_CREATE
);
dockEffectsGroup.add(hoverAnimExpanderRow);
const hoverTypeRow = new Adw.ComboRow({
title: 'Animation type',
subtitle: 'SIMPLE raises only the hovered icon; RIPPLE and PLANK animate neighbours',
model: new Gtk.StringList({ strings: ['Simple', 'Ripple', 'Plank'] }),
});
const hoverTypeMap = { SIMPLE: 0, RIPPLE: 1, PLANK: 2 };
const hoverTypeValues = ['SIMPLE', 'RIPPLE', 'PLANK'];
hoverTypeRow.set_selected(hoverTypeMap[settings.get_string('taskbar-hover-animation-type')] ?? 0);
hoverTypeRow.connect('notify::selected', () => {
let val = hoverTypeValues[hoverTypeRow.get_selected()] ?? 'SIMPLE';
settings.set_string('taskbar-hover-animation-type', val);
const defaults = {
SIMPLE: { duration: 160, rotation: 0, travel: 0.30, zoom: 1.0, convexity: 1.0, extent: 4 },
RIPPLE: { duration: 130, rotation: 10, travel: 0.40, zoom: 1.25, convexity: 1.0, extent: 4 },
PLANK: { duration: 100, rotation: 0, travel: 0.0, zoom: 2.0, convexity: 1.0, extent: 4 },
};
let d = defaults[val];
if (d) {
settings.set_int('taskbar-hover-animation-duration', d.duration);
settings.set_int('taskbar-hover-animation-rotation', d.rotation);
settings.set_double('taskbar-hover-animation-travel', d.travel);
settings.set_double('taskbar-hover-animation-zoom', d.zoom);
settings.set_double('taskbar-hover-animation-convexity', d.convexity);
settings.set_int('taskbar-hover-animation-extent', d.extent);
}
});
settings.connect('changed::taskbar-hover-animation-type', () => {
hoverTypeRow.set_selected(hoverTypeMap[settings.get_string('taskbar-hover-animation-type')] ?? 0);
});
hoverAnimExpanderRow.add_row(hoverTypeRow);
const hoverDurationAdj = new Gtk.Adjustment({ lower: 0, upper: 300, step_increment: 10, page_increment: 50 });
const hoverDurationRow = new Adw.SpinRow({ title: 'Duration (ms)', adjustment: hoverDurationAdj });
settings.bind('taskbar-hover-animation-duration', hoverDurationAdj, 'value', Gio.SettingsBindFlags.DEFAULT);
hoverAnimExpanderRow.add_row(hoverDurationRow);
const hoverZoomAdj = new Gtk.Adjustment({ lower: 0.5, upper: 2.5, step_increment: 0.05, page_increment: 0.25 });
const hoverZoomRow = new Adw.SpinRow({ title: 'Zoom', digits: 2, adjustment: hoverZoomAdj });
settings.bind('taskbar-hover-animation-zoom', hoverZoomAdj, 'value', Gio.SettingsBindFlags.DEFAULT);
hoverAnimExpanderRow.add_row(hoverZoomRow);
const hoverTravelAdj = new Gtk.Adjustment({ lower: -1.0, upper: 1.0, step_increment: 0.05, page_increment: 0.1 });
const hoverTravelRow = new Adw.SpinRow({ title: 'Travel', digits: 2, adjustment: hoverTravelAdj });
settings.bind('taskbar-hover-animation-travel', hoverTravelAdj, 'value', Gio.SettingsBindFlags.DEFAULT);
hoverAnimExpanderRow.add_row(hoverTravelRow);
const hoverRotationAdj = new Gtk.Adjustment({ lower: -30, upper: 30, step_increment: 1, page_increment: 5 });
const hoverRotationRow = new Adw.SpinRow({ title: 'Rotation (\u00B0)', adjustment: hoverRotationAdj });
settings.bind('taskbar-hover-animation-rotation', hoverRotationAdj, 'value', Gio.SettingsBindFlags.DEFAULT);
hoverAnimExpanderRow.add_row(hoverRotationRow);
const hoverConvexAdj = new Gtk.Adjustment({ lower: 0.0, upper: 3.0, step_increment: 0.1, page_increment: 0.5 });
const hoverConvexRow = new Adw.SpinRow({ title: 'Convexity', digits: 1, adjustment: hoverConvexAdj });
settings.bind('taskbar-hover-animation-convexity', hoverConvexAdj, 'value', Gio.SettingsBindFlags.DEFAULT);
hoverAnimExpanderRow.add_row(hoverConvexRow);
const hoverExtentAdj = new Gtk.Adjustment({ lower: 1, upper: 10, step_increment: 1, page_increment: 2 });
const hoverExtentRow = new Adw.SpinRow({ title: 'Extent (icons)', adjustment: hoverExtentAdj });
settings.bind('taskbar-hover-animation-extent', hoverExtentAdj, 'value', Gio.SettingsBindFlags.DEFAULT);
hoverAnimExpanderRow.add_row(hoverExtentRow);
const hoverHlRow = new Adw.SwitchRow({
title: 'Highlight hovering app icons',
subtitle: 'Show a coloured background behind taskbar icons on hover',
});
settings.bind(
'taskbar-hover-highlight-enabled',
hoverHlRow,
'active',
Gio.SettingsBindFlags.DEFAULT
);
dockEffectsGroup.add(hoverHlRow);
const hoverHlExpanderRow = new Adw.ExpanderRow({
title: 'Hover highlight options',
subtitle: 'Colour, pressed colour, and border radius',
show_enable_switch: false,
});
hoverHlRow.bind_property(
'active', hoverHlExpanderRow, 'sensitive',
GObject.BindingFlags.SYNC_CREATE
);
dockEffectsGroup.add(hoverHlExpanderRow);
const hoverHlColorRow = new Adw.ActionRow({ title: 'Highlight colour' });
const hoverHlColorBtn = new Gtk.ColorButton({
valign: Gtk.Align.CENTER,
use_alpha: true,
});
{
let rgba = new Gdk.RGBA();
rgba.parse(settings.get_string('taskbar-hover-highlight-color'));
hoverHlColorBtn.set_rgba(rgba);
}
hoverHlColorBtn.connect('color-set', () => {
settings.set_string('taskbar-hover-highlight-color',
hoverHlColorBtn.get_rgba().to_string());
});
settings.connect('changed::taskbar-hover-highlight-color', () => {
let rgba = new Gdk.RGBA();
rgba.parse(settings.get_string('taskbar-hover-highlight-color'));
hoverHlColorBtn.set_rgba(rgba);
});
hoverHlColorRow.add_suffix(hoverHlColorBtn);
hoverHlExpanderRow.add_row(hoverHlColorRow);
const hoverHlPressedRow = new Adw.ActionRow({ title: 'Pressed colour' });
const hoverHlPressedBtn = new Gtk.ColorButton({
valign: Gtk.Align.CENTER,
use_alpha: true,
});
{
let rgba = new Gdk.RGBA();
rgba.parse(settings.get_string('taskbar-hover-highlight-pressed-color'));
hoverHlPressedBtn.set_rgba(rgba);
}
hoverHlPressedBtn.connect('color-set', () => {
settings.set_string('taskbar-hover-highlight-pressed-color',
hoverHlPressedBtn.get_rgba().to_string());
});
settings.connect('changed::taskbar-hover-highlight-pressed-color', () => {
let rgba = new Gdk.RGBA();
rgba.parse(settings.get_string('taskbar-hover-highlight-pressed-color'));
hoverHlPressedBtn.set_rgba(rgba);
});
hoverHlPressedRow.add_suffix(hoverHlPressedBtn);
hoverHlExpanderRow.add_row(hoverHlPressedRow);
const hoverHlBrAdj = new Gtk.Adjustment({ lower: 0, upper: 24, step_increment: 1, page_increment: 4 });
const hoverHlBrRow = new Adw.SpinRow({ title: 'Border radius (px)', adjustment: hoverHlBrAdj });
settings.bind('taskbar-hover-highlight-border-radius', hoverHlBrAdj, 'value', Gio.SettingsBindFlags.DEFAULT);
hoverHlExpanderRow.add_row(hoverHlBrRow);
const hoverHlRunningRow = new Adw.ActionRow({ title: 'Running app colour' });
const hoverHlRunningBtn = new Gtk.ColorButton({
valign: Gtk.Align.CENTER,
use_alpha: true,
});
{
let rgba = new Gdk.RGBA();
rgba.parse(settings.get_string('taskbar-hover-highlight-running-color'));
hoverHlRunningBtn.set_rgba(rgba);
}
hoverHlRunningBtn.connect('color-set', () => {
settings.set_string('taskbar-hover-highlight-running-color',
hoverHlRunningBtn.get_rgba().to_string());
});
settings.connect('changed::taskbar-hover-highlight-running-color', () => {
let rgba = new Gdk.RGBA();
rgba.parse(settings.get_string('taskbar-hover-highlight-running-color'));
hoverHlRunningBtn.set_rgba(rgba);
});
hoverHlRunningRow.add_suffix(hoverHlRunningBtn);
hoverHlExpanderRow.add_row(hoverHlRunningRow);
const hoverHlFocusedRow = new Adw.ActionRow({ title: 'Focused app colour' });
const hoverHlFocusedBtn = new Gtk.ColorButton({
valign: Gtk.Align.CENTER,
use_alpha: true,
});
{
let rgba = new Gdk.RGBA();
rgba.parse(settings.get_string('taskbar-hover-highlight-focused-color'));
hoverHlFocusedBtn.set_rgba(rgba);
}
hoverHlFocusedBtn.connect('color-set', () => {
settings.set_string('taskbar-hover-highlight-focused-color',
hoverHlFocusedBtn.get_rgba().to_string());
});
settings.connect('changed::taskbar-hover-highlight-focused-color', () => {
let rgba = new Gdk.RGBA();
rgba.parse(settings.get_string('taskbar-hover-highlight-focused-color'));
hoverHlFocusedBtn.set_rgba(rgba);
});
hoverHlFocusedRow.add_suffix(hoverHlFocusedBtn);
hoverHlExpanderRow.add_row(hoverHlFocusedRow);
const indicatorsGroup = new Adw.PreferencesGroup({
title: 'Indicators',
description: 'Running app markers, highlights, and badges',
});
effDialogPage.add(indicatorsGroup);
const dockIndicatorsRow = new Adw.SwitchRow({
title: 'Show open-app indicators',
subtitle: 'Show running/focused state markers on taskbar icons',
});
settings.bind(
'taskbar-show-open-indicators',
dockIndicatorsRow,
'active',
Gio.SettingsBindFlags.DEFAULT
);
indicatorsGroup.add(dockIndicatorsRow);
const dockHighlightFillRow = new Adw.SwitchRow({
title: 'Highlight fill layer',
subtitle: 'Show background fill for running/focused app highlights',
});
settings.bind(
'taskbar-highlight-fill-enabled',
dockHighlightFillRow,
'active',
Gio.SettingsBindFlags.DEFAULT
);
indicatorsGroup.add(dockHighlightFillRow);
const dockHighlightEdgeRow = new Adw.SwitchRow({
title: 'Highlight bottom edge layer',
subtitle: 'Show bottom edge line for running/focused app highlights',
});
settings.bind(
'taskbar-highlight-edge-enabled',
dockHighlightEdgeRow,
'active',
Gio.SettingsBindFlags.DEFAULT
);
indicatorsGroup.add(dockHighlightEdgeRow);
const dockHighlightStripRow = new Adw.SwitchRow({
title: 'Running-state strip layer',
subtitle: 'Show additional running-state strip on taskbar highlights',
});
settings.bind(
'taskbar-highlight-strip-enabled',
dockHighlightStripRow,
'active',
Gio.SettingsBindFlags.DEFAULT
);
indicatorsGroup.add(dockHighlightStripRow);
if (hasKey('taskbar-notification-badges')) {
const dockNotifBadgesRow = new Adw.SwitchRow({
title: 'Notification badges',
subtitle: 'Show notification count badges on taskbar icons',
});
settings.bind(
'taskbar-notification-badges',
dockNotifBadgesRow,
'active',
Gio.SettingsBindFlags.DEFAULT
);
indicatorsGroup.add(dockNotifBadgesRow);
}
const minimizeGroup = new Adw.PreferencesGroup({
title: 'Minimize',
description: 'Window minimize animation behavior',
});
effDialogPage.add(minimizeGroup);