forked from zpydr/gnome-shell-extension-taskbar
-
Notifications
You must be signed in to change notification settings - Fork 9
/
prefs.js
3229 lines (2921 loc) · 127 KB
/
prefs.js
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
// GNOME Shell Extension TaskBar 2020
// Copyright (C) 2013-2018 zpydr
// Copyright (C) 2020 c0ldplasma
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
const Gdk = imports.gi.Gdk;
const GdkPixbuf = imports.gi.GdkPixbuf;
const GObject = imports.gi.GObject;
const Gtk = imports.gi.Gtk;
const Lang = imports.lang;
const Extension = imports.misc.extensionUtils.getCurrentExtension();
const Lib = Extension.imports.lib;
const Gettext = imports.gettext.domain('TaskBar');
const _ = Gettext.gettext;
const Config = imports.misc.config;
const ExtensionUtils = imports.misc.extensionUtils;
const [major] = Config.PACKAGE_VERSION.split(".");
const ShellVersion = Number.parseInt(major);
const schema = "org.gnome.shell.extensions.TaskBar";
const RESETCOLOR = 'rgba(0,0,0,0)';
const RESETCOLORBLACK = 'rgba(0,0,0,1.0)';
const RESETCOLORWHITE = 'rgba(255,255,255,1.0)';
const RESETCOLORRED = 'rgba(255,0,0,1.0)';
const DESKTOPICON = Extension.path + '/images/desktop-button-default.png';
const APPVIEWICON = Extension.path + '/images/appview-button-default.svg';
const TRAYICON = Extension.path + '/images/bottom-panel-tray-button.svg';
const HOMEICON = Extension.path + '/images/settings-home.png';
const MAILICON = Extension.path + '/images/settings-mail.png';
const GNOMEICON = Extension.path + '/images/settings-gnome.png';
const FSFICON = Extension.path + '/images/settings-fsf.png';
const GPLICON = Extension.path + '/images/settings-gpl.png';
const SPACERICON = Extension.path + '/images/settings-1px.png';
const pretty_names = {
'key-previous-task': _('Focus previous Task (Scroll left)'),
'key-next-task': _('Focus next Task (Scroll right)'),
'key-toggle-desktop': _('Toggle Desktop View'),
}
function init() {
initTranslations("TaskBar");
}
/**
* initTranslations:
* @domain: (optional): the gettext domain to use
*
* Initialize Gettext to load translations from extensionsdir/locale.
* If @domain is not provided, it will be taken from metadata['gettext-domain']
*/
function initTranslations(domain) {
let extension = ExtensionUtils.getCurrentExtension();
domain = domain || extension.metadata['gettext-domain'];
// check if this extension was built with "make zip-file", and thus
// has the locale files in a subfolder
// otherwise assume that extension has been installed in the
// same prefix as gnome-shell
let localeDir = extension.dir.get_child('locale');
if (localeDir.query_exists(null))
imports.gettext.bindtextdomain(domain, localeDir.get_path());
else
imports.gettext.bindtextdomain(domain, Config.LOCALEDIR);
}
function buildPrefsWidget() {
let prefs = new Prefs(schema);
return prefs.buildPrefsWidget();
}
function Prefs(schema) {
this.init(schema);
}
Prefs.prototype = {
settings: null,
init: function(schema) {
let settings = new Lib.Settings(schema);
this.settings = settings.getSettings();
},
buildPrefsWidget: function() {
let notebook = new Gtk.Notebook();
notebook.set_scrollable(true);
notebook.popup_enable;
notebook.set_tab_pos(0);
this.newValueAppearance = null;
this.oldValueAppearance = null;
//
// About
//
this.gridTaskBar = new Gtk.Grid();
this.gridTaskBar.margin = this.gridTaskBar.row_spacing = 10;
this.gridTaskBar.column_spacing = 2;
let scrollWindowTaskBar = this.gridTaskBar;
let labelTaskBar = new Gtk.Label({
label: _("About")
});
notebook.append_page(scrollWindowTaskBar, labelTaskBar);
let linkImage1 = new Gtk.Image({
file: HOMEICON
});
let linkImage2 = new Gtk.Image({
file: HOMEICON
});
let linkImage3 = new Gtk.Image({
file: MAILICON
});
let linkImage4 = new Gtk.Image({
file: MAILICON
});
let linkImage5 = new Gtk.Image({
file: DESKTOPICON
});
let linkImage6 = new Gtk.Image({
file: GNOMEICON
});
let linkImage7 = new Gtk.Image({
file: FSFICON
});
let linkImage8 = new Gtk.Image({
file: SPACERICON
});
let linkImage9 = new Gtk.Image({
file: HOMEICON
});
let labelVersion1 = new Gtk.Label({
label: _("Version") + " 6"
});
this.gridTaskBar.attach(labelVersion1, 0, 1, 5, 1);
let labelVersion2 = new Gtk.Label({
label: _("GNOME Shell Version") + " " + ShellVersion
});
this.gridTaskBar.attach(labelVersion2, 0, 2, 5, 1);
let labelLink1 = new Gtk.LinkButton({
label: "extensions.gnome.org",
uri: "https://extensions.gnome.org/extension/2506/taskbar-updated"
});
this.gridTaskBar.attach(labelLink1, 1, 4, 1, 1);
let labelLink2 = new Gtk.LinkButton({
label: "github.com",
uri: "https://github.com/c0ldplasma/gnome-shell-extension-taskbar"
});
this.gridTaskBar.attach(labelLink2, 1, 5, 1, 1);
let labelLink7 = new Gtk.LinkButton({
label: "TaskBar 2020 Wiki",
uri: "https://github.com/c0ldplasma/gnome-shell-extension-taskbar/wiki"
});
this.gridTaskBar.attach(labelLink7, 1, 6, 1, 1);
let labelLink5 = new Gtk.LinkButton({
label: _("Become a Friend of GNOME"),
uri: "https://www.gnome.org/friends/"
});
this.gridTaskBar.attach(labelLink5, 3, 5, 1, 1);
let labelLink6 = new Gtk.LinkButton({
label: _("Free Software Foundation"),
uri: "https://www.fsf.org/"
});
this.gridTaskBar.attach(labelLink6, 3, 6, 1, 1);
let bugReport = new Gtk.LinkButton({
label: _("Report a Bug"),
uri: "https://github.com/c0ldplasma/gnome-shell-extension-taskbar/issues/new"
});
this.gridTaskBar.attach(bugReport, 1, 7, 1, 1);
let exportButton = new Gtk.Button({
label: _("Export Settings")
});
exportButton.connect('clicked', Lang.bind(this, this.exportSettings));
exportButton.set_tooltip_text(_("Export All TaskBar Settings. This will create a taskbar.dconf file in your home folder."));
this.gridTaskBar.attach(exportButton, 1, 9, 1, 1);
let importButton = new Gtk.Button({
label: _("Import Settings")
});
importButton.connect('clicked', Lang.bind(this, this.importSettings));
importButton.set_tooltip_text(_("Import All TaskBar Settings. This will import the taskbar.dconf file located in your home folder."));
this.gridTaskBar.attach(importButton, 3, 9, 1, 1);
let resetAllButton = new Gtk.Button({
label: _("RESET ALL !")
});
resetAllButton.connect('clicked', Lang.bind(this, this.resetAll));
resetAllButton.set_tooltip_text(_("Reset All TaskBar Settings to the Original TaskBar Settings"));
this.gridTaskBar.attach(resetAllButton, 1, 11, 1, 1);
let labelSpaceTaskBar1 = new Gtk.Label({
label: "\t"
});
this.gridTaskBar.attach(labelSpaceTaskBar1, 0, 12, 1, 1);
let labelSpaceTaskBar2 = new Gtk.Label({
label: "\t",
hexpand: true
});
this.gridTaskBar.attach(labelSpaceTaskBar2, 2, 10, 1, 1);
let labelSpaceTaskBar3 = new Gtk.Label({
label: "<b>" + _("TaskBar") + "</b>",
hexpand: true
});
labelSpaceTaskBar3.set_use_markup(true);
this.gridTaskBar.attach(labelSpaceTaskBar3, 0, 0, 5, 1);
let labelSpaceTaskBar4 = new Gtk.Label({
label: "\t"
});
this.gridTaskBar.attach(labelSpaceTaskBar4, 4, 8, 1, 1);
//
// Overview
//
this.gridComponents = new Gtk.Grid();
this.gridComponents.margin = this.gridComponents.row_spacing = 10;
this.gridComponents.column_spacing = 2;
let scrollWindowComponents = this.gridComponents;
let labelComponents = new Gtk.Label({
label: _("Overview")
});
notebook.append_page(scrollWindowComponents, labelComponents);
let labelDisplayTasks = new Gtk.Label({
label: _("Tasks")
});
this.gridComponents.attach(labelDisplayTasks, 1, 1, 1, 1);
this.valueDisplayTasks = new Gtk.Switch({
active: this.settings.get_boolean("display-tasks")
});
this.valueDisplayTasks.set_halign(Gtk.Align.END);
this.valueDisplayTasks.connect('notify::active', Lang.bind(this, this.changeDisplayTasks));
this.gridComponents.attach(this.valueDisplayTasks, 3, 1, 2, 1);
let labelDisplayDesktopButton = new Gtk.Label({
label: _("Desktop Button")
});
this.gridComponents.attach(labelDisplayDesktopButton, 1, 2, 1, 1);
this.valueDisplayDesktopButton = new Gtk.Switch({
active: this.settings.get_boolean("display-desktop-button")
});
this.valueDisplayDesktopButton.set_halign(Gtk.Align.END);
this.valueDisplayDesktopButton.connect('notify::active', Lang.bind(this, this.changeDisplayDesktopButton));
this.gridComponents.attach(this.valueDisplayDesktopButton, 3, 2, 2, 1);
let labelDisplayWorkspaceButton = new Gtk.Label({
label: _("Workspace Button")
});
this.gridComponents.attach(labelDisplayWorkspaceButton, 1, 3, 1, 1);
this.valueDisplayWorkspaceButton = new Gtk.Switch({
active: this.settings.get_boolean("display-workspace-button")
});
this.valueDisplayWorkspaceButton.set_halign(Gtk.Align.END);
this.valueDisplayWorkspaceButton.connect('notify::active', Lang.bind(this, this.changeDisplayWorkspaceButton));
this.gridComponents.attach(this.valueDisplayWorkspaceButton, 3, 3, 2, 1);
let labelDisplayShowAppsButton = new Gtk.Label({
label: _("Appview Button")
});
this.gridComponents.attach(labelDisplayShowAppsButton, 1, 4, 1, 1);
this.valueDisplayShowAppsButton = new Gtk.Switch({
active: this.settings.get_boolean("display-showapps-button")
});
this.valueDisplayShowAppsButton.set_halign(Gtk.Align.END);
this.valueDisplayShowAppsButton.connect('notify::active', Lang.bind(this, this.changeDisplayShowAppsButton));
this.gridComponents.attach(this.valueDisplayShowAppsButton, 3, 4, 2, 1);
let labelDisplayFavorites = new Gtk.Label({
label: _("Favorites")
});
this.gridComponents.attach(labelDisplayFavorites, 1, 5, 1, 1);
this.valueDisplayFavorites = new Gtk.Switch({
active: this.settings.get_boolean("display-favorites")
});
this.valueDisplayFavorites.set_halign(Gtk.Align.END);
this.valueDisplayFavorites.connect('notify::active', Lang.bind(this, this.changeDisplayFavorites));
this.gridComponents.attach(this.valueDisplayFavorites, 3, 5, 2, 1);
let valueAppearanceBox = new Gtk.Box();
let labelAppearanceBox = new Gtk.Label({
label: _("Align") + ' '
});
this.valueAppearance = new Gtk.ComboBoxText();
this.valueAppearance.append_text(_("Tasks"));
this.valueAppearance.append_text(_("Desktop Button"));
this.valueAppearance.append_text(_("Workspace Button"));
this.valueAppearance.append_text(_("Appview Button"));
this.valueAppearance.append_text(_("Favorites"));
this.valueAppearance.set_active(this.settings.get_enum("appearance-selection"));
this.valueAppearance.connect('changed', Lang.bind(this, this.changeAppearanceSelection));
valueAppearanceBox.append(labelAppearanceBox);
valueAppearanceBox.append(this.valueAppearance);
this.gridComponents.attach(valueAppearanceBox, 1, 6, 1, 1);
let valueAppearanceName = new Gtk.Button({
label: "<"
});
let value2AppearanceName = new Gtk.Button({
label: ">"
});
valueAppearanceName.connect('clicked', Lang.bind(this, this.changeAppearanceLeft));
value2AppearanceName.connect('clicked', Lang.bind(this, this.changeAppearanceRight));
this.gridComponents.attach(valueAppearanceName, 3, 6, 1, 1);
this.gridComponents.attach(value2AppearanceName, 4, 6, 1, 1);
let labelTopPanel = new Gtk.Label({
label: _("Top Panel")
});
this.gridComponents.attach(labelTopPanel, 1, 7, 1, 1);
this.valueTopPanel = new Gtk.Switch({
active: this.settings.get_boolean("top-panel")
});
this.valueTopPanel.set_halign(Gtk.Align.END);
this.valueTopPanel.connect('notify::active', Lang.bind(this, this.changeTopPanel));
this.gridComponents.attach(this.valueTopPanel, 3, 7, 2, 1);
let labelBottomPanel = new Gtk.Label({
label: _("Bottom Panel")
});
this.gridComponents.attach(labelBottomPanel, 1, 8, 1, 1);
this.valueBottomPanel = new Gtk.Switch({
active: this.settings.get_boolean("bottom-panel")
});
this.valueBottomPanel.set_halign(Gtk.Align.END);
this.valueBottomPanel.connect('notify::active', Lang.bind(this, this.changeBottomPanel));
this.gridComponents.attach(this.valueBottomPanel, 3, 8, 2, 1);
let resetComponentsButton = new Gtk.Button({
label: _("Reset Overview Tab")
});
resetComponentsButton.connect('clicked', Lang.bind(this, this.resetComponents));
resetComponentsButton.set_tooltip_text(_("Reset the Overview Tab to the Original Overview Settings"));
this.gridComponents.attach(resetComponentsButton, 1, 10, 1, 1);
let labelSpaceComponents1 = new Gtk.Label({
label: "\t"
});
this.gridComponents.attach(labelSpaceComponents1, 0, 11, 1, 1);
let labelSpaceComponents2 = new Gtk.Label({
label: "\t",
hexpand: true
});
this.gridComponents.attach(labelSpaceComponents2, 2, 9, 1, 1);
let labelSpaceComponents3 = new Gtk.Label({
label: "<b>" + _("Overview") + "</b>",
hexpand: true
});
labelSpaceComponents3.set_use_markup(true);
this.gridComponents.attach(labelSpaceComponents3, 0, 0, 6, 1);
let labelSpaceComponents4 = new Gtk.Label({
label: "\t"
});
this.gridComponents.attach(labelSpaceComponents4, 5, 1, 1, 1);
//
// Panels
//
this.gridSettings = new Gtk.Grid();
this.gridSettings.margin = this.gridSettings.row_spacing = 10;
this.gridSettings.column_spacing = 2;
let scrollWindowSettings = this.gridSettings;
let labelSettings = new Gtk.Label({
label: _("Panels")
});
notebook.append_page(scrollWindowSettings, labelSettings);
let labelPanel3 = new Gtk.Label({
label: _("Top Panel")
});
this.gridSettings.attach(labelPanel3, 3, 1, 2, 1);
let labelPanel4 = new Gtk.Label({
label: _("Bottom Panel")
});
this.gridSettings.attach(labelPanel4, 6, 1, 2, 1);
let labelPanelPosition = new Gtk.Label({
label: _("Align TaskBar")
});
this.gridSettings.attach(labelPanelPosition, 1, 2, 1, 1);
let valuePanelPosition = new Gtk.Button({
label: "<"
});
let value2PanelPosition = new Gtk.Button({
label: ">"
});
valuePanelPosition.connect('clicked', Lang.bind(this, this.changePanelPositionLeft));
value2PanelPosition.connect('clicked', Lang.bind(this, this.changePanelPositionRight));
this.gridSettings.attach(valuePanelPosition, 3, 2, 1, 1);
this.gridSettings.attach(value2PanelPosition, 4, 2, 1, 1);
let valuePanelPositionBottom = new Gtk.Button({
label: "<"
});
let value2PanelPositionBottom = new Gtk.Button({
label: ">"
});
valuePanelPositionBottom.connect('clicked', Lang.bind(this, this.changePanelPositionBottomLeft));
value2PanelPositionBottom.connect('clicked', Lang.bind(this, this.changePanelPositionBottomRight));
this.gridSettings.attach(valuePanelPositionBottom, 6, 2, 1, 1);
this.gridSettings.attach(value2PanelPositionBottom, 7, 2, 1, 1);
let labelIconSize = new Gtk.Label({
label: _("Panel Size") + " (27 px)"
});
this.gridSettings.attach(labelIconSize, 1, 3, 1, 1);
this.valueIconSize = new Gtk.Adjustment({
lower: 1,
upper: 96,
step_increment: 1
});
let value2IconSize = new Gtk.SpinButton({
adjustment: this.valueIconSize,
snap_to_ticks: true
});
value2IconSize.set_value(this.settings.get_int("panel-size"));
value2IconSize.connect("value-changed", Lang.bind(this, this.changeIconSize));
this.gridSettings.attach(value2IconSize, 3, 3, 2, 1);
this.valueIconSizeBottom = new Gtk.Adjustment({
lower: 1,
upper: 96,
step_increment: 1
});
let value2IconSizeBottom = new Gtk.SpinButton({
adjustment: this.valueIconSizeBottom,
snap_to_ticks: true
});
value2IconSizeBottom.set_value(this.settings.get_int("panel-size-bottom"));
value2IconSizeBottom.connect("value-changed", Lang.bind(this, this.changeIconSizeBottom));
this.gridSettings.attach(value2IconSizeBottom, 6, 3, 2, 1);
let labelTBIconSize = new Gtk.Label({
label: _("Adjust TaskBar Icon Size") + " (0 px)"
});
this.gridSettings.attach(labelTBIconSize, 1, 4, 1, 1);
this.valueTBIconSize = new Gtk.Adjustment({
lower: -96,
upper: 96,
step_increment: 1
});
let value2TBIconSize = new Gtk.SpinButton({
adjustment: this.valueTBIconSize,
snap_to_ticks: true
});
value2TBIconSize.set_value(this.settings.get_int("tb-icon-size"));
value2TBIconSize.connect("value-changed", Lang.bind(this, this.changeTBIconSize));
this.gridSettings.attach(value2TBIconSize, 3, 4, 2, 1);
this.valueTBIconSizeBottom = new Gtk.Adjustment({
lower: -96,
upper: 96,
step_increment: 1
});
let value2TBIconSizeBottom = new Gtk.SpinButton({
adjustment: this.valueTBIconSizeBottom,
snap_to_ticks: true
});
value2TBIconSizeBottom.set_value(this.settings.get_int("tb-icon-size-bottom"));
value2TBIconSizeBottom.connect("value-changed", Lang.bind(this, this.changeTBIconSizeBottom));
this.gridSettings.attach(value2TBIconSizeBottom, 6, 4, 2, 1);
let labelTBLabelSize = new Gtk.Label({
label: _("Adjust TaskBar Label Size") + " (0 px)"
});
this.gridSettings.attach(labelTBLabelSize, 1, 5, 1, 1);
this.valueTBLabelSize = new Gtk.Adjustment({
lower: -96,
upper: 96,
step_increment: 1
});
let value2TBLabelSize = new Gtk.SpinButton({
adjustment: this.valueTBLabelSize,
snap_to_ticks: true
});
value2TBLabelSize.set_value(this.settings.get_int("tb-label-size"));
value2TBLabelSize.connect("value-changed", Lang.bind(this, this.changeTBLabelSize));
this.gridSettings.attach(value2TBLabelSize, 3, 5, 2, 1);
this.valueTBLabelSizeBottom = new Gtk.Adjustment({
lower: -96,
upper: 96,
step_increment: 1
});
let value2TBLabelSizeBottom = new Gtk.SpinButton({
adjustment: this.valueTBLabelSizeBottom,
snap_to_ticks: true
});
value2TBLabelSizeBottom.set_value(this.settings.get_int("tb-label-size-bottom"));
value2TBLabelSizeBottom.connect("value-changed", Lang.bind(this, this.changeTBLabelSizeBottom));
this.gridSettings.attach(value2TBLabelSizeBottom, 6, 5, 2, 1);
let labelOtherPanelContent = new Gtk.Label({
label: _("Adjust Panel Content Size") + " (0 px)"
});
this.gridSettings.attach(labelOtherPanelContent, 1, 6, 1, 1);
this.valueOtherPanelContent = new Gtk.Adjustment({
lower: -96,
upper: 96,
step_increment: 1
});
let value2OtherPanelContent = new Gtk.SpinButton({
adjustment: this.valueOtherPanelContent,
snap_to_ticks: true
});
value2OtherPanelContent.set_value(this.settings.get_int("content-size"));
value2OtherPanelContent.connect("value-changed", Lang.bind(this, this.changeOtherPanelContent));
this.gridSettings.attach(value2OtherPanelContent, 3, 6, 2, 1);
let labelBottomPanelVertical = new Gtk.Label({
label: _("Anchor Point") + " (0 px)"
});
this.gridSettings.attach(labelBottomPanelVertical, 1, 7, 1, 1);
this.valueBottomPanelVertical = new Gtk.Adjustment({
lower: -100,
upper: 100,
step_increment: 1
});
this.value2BottomPanelVertical = new Gtk.SpinButton({
adjustment: this.valueBottomPanelVertical,
snap_to_ticks: true
});
this.value2BottomPanelVertical.set_value(this.settings.get_int("bottom-panel-vertical"));
this.value2BottomPanelVertical.connect("value-changed", Lang.bind(this, this.changeBottomPanelVertical));
this.gridSettings.attach(this.value2BottomPanelVertical, 6, 7, 2, 1);
let labelPanelBackgroundColor = new Gtk.Label({
label: _("Panel Background\nColor & Opacity")
});
this.gridSettings.attach(labelPanelBackgroundColor, 1, 8, 1, 1);
let colorTop = this.settings.get_string("top-panel-background-color");
let colorTopOriginal = this.settings.get_string("top-panel-original-background-color");
if (colorTop === 'unset')
colorTop = colorTopOriginal;
let rgbaTop = new Gdk.RGBA();
rgbaTop.parse(colorTop);
this.valueTopPanelBackgroundColor = new Gtk.ColorButton({
title: "TaskBar - Set Top Panel Background Color"
});
this.valueTopPanelBackgroundColor.set_use_alpha(true);
this.valueTopPanelBackgroundColor.set_rgba(rgbaTop);
this.valueTopPanelBackgroundColor.connect('color-set', Lang.bind(this, this.changeTopPanelBackgroundColor));
this.gridSettings.attach(this.valueTopPanelBackgroundColor, 3, 8, 2, 1);
let colorBottom = this.settings.get_string("bottom-panel-background-color");
let colorBottomOriginal = this.settings.get_string("bottom-panel-original-background-color");
if (colorBottom === 'unset') {
colorBottom = colorTopOriginal;
if (colorBottomOriginal === 'unset')
this.settings.set_string("bottom-panel-original-background-color", colorTopOriginal);
}
let rgbaBottom = new Gdk.RGBA();
rgbaBottom.parse(colorBottom);
this.valueBottomPanelBackgroundColor = new Gtk.ColorButton({
title: "TaskBar - Set Bottom Panel Background Color"
});
this.valueBottomPanelBackgroundColor.set_use_alpha(true);
this.valueBottomPanelBackgroundColor.set_rgba(rgbaBottom);
this.valueBottomPanelBackgroundColor.connect('color-set', Lang.bind(this, this.changeBottomPanelBackgroundColor));
this.gridSettings.attach(this.valueBottomPanelBackgroundColor, 6, 8, 2, 1);
this.resetTopPanelBackgroundColorButton = new Gtk.Button({
label: _("Reset Color")
});
this.resetTopPanelBackgroundColorButton.connect('clicked', Lang.bind(this, this.resetTopPanelBackgroundColor));
this.gridSettings.attach(this.resetTopPanelBackgroundColorButton, 3, 9, 2, 1);
this.resetBottomPanelBackgroundColorButton = new Gtk.Button({
label: _("Reset Color")
});
this.resetBottomPanelBackgroundColorButton.connect('clicked', Lang.bind(this, this.resetBottomPanelBackgroundColor));
this.gridSettings.attach(this.resetBottomPanelBackgroundColorButton, 6, 9, 2, 1);
let resetSettingsButton = new Gtk.Button({
label: _("Reset Panels Tab")
});
resetSettingsButton.connect('clicked', Lang.bind(this, this.resetSettings));
resetSettingsButton.set_tooltip_text(_("Reset the Panels Tab to the Original Panels Settings"));
this.gridSettings.attach(resetSettingsButton, 1, 11, 1, 1);
let labelSpaceSettings1 = new Gtk.Label({
label: "\t"
});
this.gridSettings.attach(labelSpaceSettings1, 0, 12, 1, 1);
let labelSpaceSettings2 = new Gtk.Label({
label: "\t",
hexpand: true
});
this.gridSettings.attach(labelSpaceSettings2, 2, 2, 1, 1);
let labelSpaceSettings3 = new Gtk.Label({
label: "\t"
});
this.gridSettings.attach(labelSpaceSettings3, 5, 10, 1, 1);
let labelSpaceSettings4 = new Gtk.Label({
label: "<b>" + _("Panels") + "</b>",
hexpand: true
});
labelSpaceSettings4.set_use_markup(true);
this.gridSettings.attach(labelSpaceSettings4, 0, 0, 9, 1);
let labelSpaceSettings5 = new Gtk.Label({
label: "\t"
});
this.gridSettings.attach(labelSpaceSettings5, 8, 1, 1, 1);
//
// Tasks (I)
//
this.gridTasks = new Gtk.Grid();
this.gridTasks.margin = this.gridTasks.row_spacing = 10;
this.gridTasks.column_spacing = 2;
let scrollWindowTasks = this.gridTasks;
let labelTasks = new Gtk.Label({
label: _("Tasks (I)")
});
notebook.append_page(scrollWindowTasks, labelTasks);
let labelAllWorkspaces = new Gtk.Label({
label: _("Tasks on All Workspaces")
});
this.gridTasks.attach(labelAllWorkspaces, 1, 1, 1, 1);
this.valueAllWorkspaces = new Gtk.Switch({
active: this.settings.get_boolean("tasks-all-workspaces")
});
this.valueAllWorkspaces.set_halign(Gtk.Align.END);
this.valueAllWorkspaces.connect('notify::active', Lang.bind(this, this.changeAllWorkspaces));
this.gridTasks.attach(this.valueAllWorkspaces, 4, 1, 1, 1);
let labelSortTasks = new Gtk.Label({
label: _("Sort or Group Tasks by Application")
});
this.gridTasks.attach(labelSortTasks, 1, 2, 1, 1);
this.valueSortTasks = new Gtk.ComboBoxText();
this.valueSortTasks.append_text(_("OFF"));
this.valueSortTasks.append_text(_("Sort"));
this.valueSortTasks.append_text(_("Sort Workspace"));
this.valueSortTasks.append_text(_("Group"));
this.valueSortTasks.append_text(_("Group Workspace"));
this.valueSortTasks.set_active(this.settings.get_enum("sort-tasks"));
this.valueSortTasks.connect('changed', Lang.bind(this, this.changeSortTasks));
this.gridTasks.attach(this.valueSortTasks, 3, 2, 2, 1);
let labelTasksLabel = new Gtk.Label({
label: _("Tasks Label")
});
this.gridTasks.attach(labelTasksLabel, 1, 3, 1, 1);
this.valueTasksLabel = new Gtk.ComboBoxText();
this.valueTasksLabel.append_text(_("OFF"));
this.valueTasksLabel.append_text(_("Window Title"));
this.valueTasksLabel.append_text(_("App Name"));
this.valueTasksLabel.set_active(this.settings.get_enum("tasks-label"));
this.valueTasksLabel.connect('changed', Lang.bind(this, this.changeTasksLabel));
this.gridTasks.attach(this.valueTasksLabel, 3, 3, 2, 1);
let labelTasksLabelWidth = new Gtk.Label({
label: _("Tasks Label Width (150 px)")
});
this.gridTasks.attach(labelTasksLabelWidth, 1, 4, 2, 1);
this.valueTasksLabelWidth = new Gtk.Adjustment({
lower: 0,
upper: 1000,
step_increment: 1
});
let value2TasksLabelWidth = new Gtk.SpinButton({
adjustment: this.valueTasksLabelWidth,
snap_to_ticks: true
});
value2TasksLabelWidth.set_value(this.settings.get_int("tasks-width"));
value2TasksLabelWidth.connect("value-changed", Lang.bind(this, this.changeTasksLabelWidth));
this.gridTasks.attach(value2TasksLabelWidth, 3, 4, 2, 1);
let labelTasksContainerWidth = new Gtk.Label({
label: _("Reserve Space on Panel (0 Tasks)")
});
this.gridTasks.attach(labelTasksContainerWidth, 1, 5, 2, 1);
this.valueTasksContainerWidth = new Gtk.Adjustment({
lower: 0,
upper: 100,
step_increment: 1
});
let value2TasksContainerWidth = new Gtk.SpinButton({
adjustment: this.valueTasksContainerWidth,
snap_to_ticks: true
});
value2TasksContainerWidth.set_value(this.settings.get_int("tasks-container-width-new"));
value2TasksContainerWidth.connect("value-changed", Lang.bind(this, this.changeTasksContainerWidth));
this.gridTasks.attach(value2TasksContainerWidth, 3, 5, 2, 1);
let labelTasksSpaces = new Gtk.Label({
label: _("Space between Tasks (4 px)")
});
this.gridTasks.attach(labelTasksSpaces, 1, 6, 2, 1);
this.valueTasksSpaces = new Gtk.Adjustment({
lower: 0,
upper: 1000,
step_increment: 1
});
let value2TasksSpaces = new Gtk.SpinButton({
adjustment: this.valueTasksSpaces,
snap_to_ticks: true
});
value2TasksSpaces.set_value(this.settings.get_int("tasks-spaces"));
value2TasksSpaces.connect("value-changed", Lang.bind(this, this.changeTasksSpaces));
this.gridTasks.attach(value2TasksSpaces, 3, 6, 2, 1);
//Array of action strings
let arrayTasksClickMenus = [
"OFF",
"Min/Max Task",
"Open App Menu",
"Close Task",
"New Instance"
];
//Left Click actions menu
let labelLeftClickMenu = new Gtk.Label({
label: _("Left Click")
});
this.gridTasks.attach(labelLeftClickMenu, 1, 7, 1, 1);
this.valueTasksLeftClickMenu = new Gtk.ComboBoxText();
arrayTasksClickMenus.forEach(string => {
this.valueTasksLeftClickMenu.append_text(_(string));
});
this.valueTasksLeftClickMenu.set_active(this.settings.get_enum("tasks-left-click"));
this.valueTasksLeftClickMenu.connect('changed', Lang.bind(this, this.changeTasksLeftClickMenu));
this.gridTasks.attach(this.valueTasksLeftClickMenu, 3, 7, 2, 1);
//Middle Click actions menu
let labelMiddleClickMenu = new Gtk.Label({
label: _("Middle Click")
});
this.gridTasks.attach(labelMiddleClickMenu, 1, 8, 1, 1);
this.valueTasksMiddleClickMenu = new Gtk.ComboBoxText();
arrayTasksClickMenus.forEach(string => {
this.valueTasksMiddleClickMenu.append_text(_(string));
});
this.valueTasksMiddleClickMenu.set_active(this.settings.get_enum("tasks-middle-click"));
this.valueTasksMiddleClickMenu.connect('changed', Lang.bind(this, this.changeTasksMiddleClickMenu));
this.gridTasks.attach(this.valueTasksMiddleClickMenu, 3, 8, 2, 1);
//Right Click actions menu
let labelRightClickMenu = new Gtk.Label({
label: _("Right Click")
});
this.gridTasks.attach(labelRightClickMenu, 1, 9, 1, 1);
this.valueTasksRightClickMenu = new Gtk.ComboBoxText();
arrayTasksClickMenus.forEach(string => {
this.valueTasksRightClickMenu.append_text(_(string));
});
this.valueTasksRightClickMenu.set_active(this.settings.get_enum("tasks-right-click"));
this.valueTasksRightClickMenu.connect('changed', Lang.bind(this, this.changeTasksRightClickMenu));
this.gridTasks.attach(this.valueTasksRightClickMenu, 3, 9, 2, 1);
let resetTasksButton = new Gtk.Button({
label: _("Reset Tasks (I) Tab")
});
resetTasksButton.connect('clicked', Lang.bind(this, this.resetTasks));
resetTasksButton.set_tooltip_text(_("Reset the Tasks (I) Tab to the Original Tasks Settings"));
this.gridTasks.attach(resetTasksButton, 1, 11, 1, 1);
let labelSpaceTasks1 = new Gtk.Label({
label: "\t"
});
this.gridTasks.attach(labelSpaceTasks1, 0, 12, 1, 1);
let labelSpaceTasks2 = new Gtk.Label({
label: "\t",
hexpand: true
});
this.gridTasks.attach(labelSpaceTasks2, 2, 10, 1, 1);
let labelSpaceTasks3 = new Gtk.Label({
label: "\t\t"
});
this.gridTasks.attach(labelSpaceTasks3, 3, 0, 1, 1);
let labelSpaceTasks4 = new Gtk.Label({
label: "<b>" + _("Tasks (I)") + "</b>",
hexpand: true
});
labelSpaceTasks4.set_use_markup(true);
this.gridTasks.attach(labelSpaceTasks4, 0, 0, 6, 1);
let labelSpaceTasks5 = new Gtk.Label({
label: "\t"
});
this.gridTasks.attach(labelSpaceTasks5, 5, 1, 1, 1);
//
// Tasks (II)
//
this.gridTasks2 = new Gtk.Grid();
this.gridTasks2.margin = this.gridTasks2.row_spacing = 10;
this.gridTasks2.column_spacing = 2;
let scrollWindowTasks2 = this.gridTasks2;
let labelTasks2 = new Gtk.Label({
label: _("Tasks (II)")
});
notebook.append_page(scrollWindowTasks2, labelTasks2);
let labelScrollTasks = new Gtk.Label({
label: _("Scroll Tasks")
});
this.gridTasks2.attach(labelScrollTasks, 1, 1, 1, 1);
this.valueScrollTasks = new Gtk.ComboBoxText();
this.valueScrollTasks.append_text(_("OFF"));
this.valueScrollTasks.append_text(_("Standard"));
this.valueScrollTasks.append_text(_("Invert"));
this.valueScrollTasks.set_active(this.settings.get_enum("scroll-tasks"));
this.valueScrollTasks.connect('changed', Lang.bind(this, this.changeScrollTasks));
this.gridTasks2.attach(this.valueScrollTasks, 3, 1, 2, 1);
let labelActiveTaskFrame = new Gtk.Label({
label: _("Active Task Frame")
});
this.gridTasks2.attach(labelActiveTaskFrame, 1, 2, 1, 1);
this.valueActiveTaskFrame = new Gtk.Switch({
active: this.settings.get_boolean("active-task-frame")
});
this.valueActiveTaskFrame.set_halign(Gtk.Align.END);
this.valueActiveTaskFrame.connect('notify::active', Lang.bind(this, this.changeActiveTaskFrame));
this.gridTasks2.attach(this.valueActiveTaskFrame, 4, 2, 1, 1);
let labelInactiveTaskFrame = new Gtk.Label({
label: _("Inactive Task Frame")
});
this.gridTasks2.attach(labelInactiveTaskFrame, 1, 3, 1, 1);
this.valueInactiveTaskFrame = new Gtk.Switch({
active: this.settings.get_boolean("inactive-task-frame")
});
this.valueInactiveTaskFrame.set_halign(Gtk.Align.END);
this.valueInactiveTaskFrame.connect('notify::active', Lang.bind(this, this.changeInactiveTaskFrame));
this.gridTasks2.attach(this.valueInactiveTaskFrame, 4, 3, 1, 1);
let labelHoverSwitchTask = new Gtk.Label({
label: _("Activate Tasks on Hover")
});
this.gridTasks2.attach(labelHoverSwitchTask, 1, 4, 1, 1);
this.valueHoverSwitchTask = new Gtk.Switch({
active: this.settings.get_boolean("hover-switch-task")
});
this.valueHoverSwitchTask.set_halign(Gtk.Align.END);
this.valueHoverSwitchTask.connect('notify::active', Lang.bind(this, this.changeHoverSwitchTask));
this.gridTasks2.attach(this.valueHoverSwitchTask, 4, 4, 1, 1);
let labelHoverDelay = new Gtk.Label({
label: _("Hover Delay") + " (350 ms)"
});
this.gridTasks2.attach(labelHoverDelay, 1, 5, 2, 1);
this.valueHoverDelay = new Gtk.Adjustment({
lower: 0,
upper: 10000,
step_increment: 1
});
let value2HoverDelay = new Gtk.SpinButton({
adjustment: this.valueHoverDelay,
snap_to_ticks: true
});
value2HoverDelay.set_value(this.settings.get_int("hover-delay"));
value2HoverDelay.connect("value-changed", Lang.bind(this, this.changeHoverDelay));
this.gridTasks2.attach(value2HoverDelay, 3, 5, 2, 1);
let labelBlinkTasks = new Gtk.Label({
label: _("Blink Tasks on Alert")
});
this.gridTasks2.attach(labelBlinkTasks, 1, 6, 1, 1);
this.valueBlinkTasks = new Gtk.Switch({
active: this.settings.get_boolean("blink-tasks")
});
this.valueBlinkTasks.set_halign(Gtk.Align.END);
this.valueBlinkTasks.connect('notify::active', Lang.bind(this, this.changeBlinkTasks));
this.gridTasks2.attach(this.valueBlinkTasks, 4, 6, 1, 1);
let labelTasksBlinkRate = new Gtk.Label({
label: _("Blink Rate") + " (750 ms)"
});
this.gridTasks2.attach(labelTasksBlinkRate, 1, 7, 2, 1);
this.valueTasksBlinkRate = new Gtk.Adjustment({
lower: 0,
upper: 10000,
step_increment: 1
});
let value2TasksBlinkRate = new Gtk.SpinButton({
adjustment: this.valueTasksBlinkRate,
snap_to_ticks: true
});
value2TasksBlinkRate.set_value(this.settings.get_int("blink-rate"));
value2TasksBlinkRate.connect("value-changed", Lang.bind(this, this.changeTasksBlinkRate));
this.gridTasks2.attach(value2TasksBlinkRate, 3, 7, 2, 1);
let labelTasksBlinkAlertColor = new Gtk.Label({
label: _("Blink Color")
});
this.gridTasks2.attach(labelTasksBlinkAlertColor, 1, 8, 1, 1);
let blinkColor = this.settings.get_string("blink-color");
let rgbaBlink = new Gdk.RGBA();
if (blinkColor === 'unset')
blinkColor = RESETCOLORRED;
rgbaBlink.parse(blinkColor);
this.valueTasksBlinkAlertColor = new Gtk.ColorButton({
title: "TaskBar - Set Blink Color"
});
this.valueTasksBlinkAlertColor.set_use_alpha(true);
this.valueTasksBlinkAlertColor.set_rgba(rgbaBlink);
this.valueTasksBlinkAlertColor.connect('color-set', Lang.bind(this, this.changeTasksBlinkAlertColor));
this.gridTasks2.attach(this.valueTasksBlinkAlertColor, 4, 8, 1, 1);
let resetTasks2Button = new Gtk.Button({
label: _("Reset Tasks (II) Tab")
});
resetTasks2Button.connect('clicked', Lang.bind(this, this.resetTasks2));
resetTasks2Button.set_tooltip_text(_("Reset the Tasks II Tab to the Original Tasks II Settings"));
this.gridTasks2.attach(resetTasks2Button, 1, 10, 1, 1);
let labelSpaceTasks21 = new Gtk.Label({
label: "\t"
});
this.gridTasks2.attach(labelSpaceTasks21, 0, 11, 1, 1);
let labelSpaceTasks22 = new Gtk.Label({
label: "\t",
hexpand: true
});
this.gridTasks2.attach(labelSpaceTasks22, 2, 9, 1, 1);
let labelSpaceTasks23 = new Gtk.Label({
label: "\t"
});
this.gridTasks2.attach(labelSpaceTasks23, 3, 0, 1, 1);
let labelSpaceTasks24 = new Gtk.Label({
label: "<b>" + _("Tasks (II)") + "</b>",
hexpand: true
});
labelSpaceTasks24.set_use_markup(true);
this.gridTasks2.attach(labelSpaceTasks24, 0, 0, 6, 1);
let labelSpaceTasks25 = new Gtk.Label({
label: "\t"
});
this.gridTasks2.attach(labelSpaceTasks25, 5, 1, 1, 1);
//
// Tasks (III)
//
this.gridTasks3 = new Gtk.Grid();
this.gridTasks3.margin = this.gridTasks3.row_spacing = 10;
this.gridTasks3.column_spacing = 2;
let scrollWindowTasks3 = this.gridTasks3;
let labelTasks3 = new Gtk.Label({
label: _("Tasks (III)")
});
notebook.append_page(scrollWindowTasks3, labelTasks3);
let labelActiveTaskBackgroundColor = new Gtk.Label({
label: _("Active Task Background\nColor & Opacity")
});
let tooltipActiveTaskBackgroundColor = _("Active Task Background Color & Opacity\nClick the color button to set the color and opacity of the active task background. This opens a new window with a table of preset colors to choose from. Click the '+' button under 'Custom' to customize color and opacity. Clicking '+' changes the window. In the center is a color picker, the left slider changes color and the bottom slider changes opacity. At the top, a indicator and entry field displays hexadecimal values in the form: #RRGGBB, where RR (red), GG (green) and BB (blue) are values between 00 and FF. When selected, customized colors will be available in all color settings. Back on the 'Tasks (III)' tab, flip the switch next to the color button to activate/deactivate the background color.\nToggle tasks at the 'Overview' tab.");
labelActiveTaskBackgroundColor.set_tooltip_text(tooltipActiveTaskBackgroundColor);
this.gridTasks3.attach(labelActiveTaskBackgroundColor, 1, 1, 1, 1);
let activeColor = this.settings.get_string("active-task-background-color");
let rgbaActive = new Gdk.RGBA();
rgbaActive.parse(activeColor);
this.valueActiveTaskBackgroundColor = new Gtk.ColorButton({
title: "TaskBar - Set Active Task Background Color"
});
this.valueActiveTaskBackgroundColor.set_tooltip_text(tooltipActiveTaskBackgroundColor);
this.valueActiveTaskBackgroundColor.set_use_alpha(true);
this.valueActiveTaskBackgroundColor.set_rgba(rgbaActive);
this.valueActiveTaskBackgroundColor.connect('color-set', Lang.bind(this, this.changeActiveTaskBackgroundColor));
this.gridTasks3.attach(this.valueActiveTaskBackgroundColor, 3, 1, 1, 1);
this.value2ActiveTaskBackgroundColor = new Gtk.Switch({
active: this.settings.get_boolean("active-task-background-color-set")
});
this.value2ActiveTaskBackgroundColor.set_valign(Gtk.Align.CENTER);
this.value2ActiveTaskBackgroundColor.set_tooltip_text(tooltipActiveTaskBackgroundColor);