tabby-glass-menu 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/index.js +70 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,8 +13,8 @@ the menu too.
|
|
|
13
13
|
Every context menu opened by Tabby or by other plugins goes through the same
|
|
14
14
|
place, so all of them are replaced, with the same items and actions:
|
|
15
15
|
checkboxes, radio items, disabled items and submenus. Separators are left
|
|
16
|
-
out, and the menu uses the
|
|
17
|
-
|
|
16
|
+
out, and the menu uses the system UI font, so it follows it when you change
|
|
17
|
+
it.
|
|
18
18
|
|
|
19
19
|
## Install
|
|
20
20
|
|
|
@@ -36,6 +36,8 @@ It's plain JavaScript, there is nothing to build.
|
|
|
36
36
|
- background opacity (default 0.55)
|
|
37
37
|
- blur of the window content behind the menu (default 12 px)
|
|
38
38
|
- corner radius (default 20 px)
|
|
39
|
+
- border: width (default 1 px, 0 for none), style (solid, dashed, dotted,
|
|
40
|
+
double), color and opacity (default white at 0.06)
|
|
39
41
|
- show a sample menu to try the settings
|
|
40
42
|
|
|
41
43
|
The background takes the color of the Tabby theme.
|
package/index.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* Every menu built by Tabby or by other plugins goes through the same method,
|
|
13
13
|
* so all of them are covered. Same items, same actions: labels,
|
|
14
14
|
* checkboxes, radio items, disabled items, submenus, keyboard navigation.
|
|
15
|
-
* Separators are left out, and the menu uses the
|
|
15
|
+
* Separators are left out, and the menu uses the system UI font.
|
|
16
16
|
* The menu is part of the window, so it can't extend past its edges: near an
|
|
17
17
|
* edge it opens towards the inside.
|
|
18
18
|
*
|
|
@@ -44,8 +44,15 @@ const DEFAULTS = {
|
|
|
44
44
|
blur: 12,
|
|
45
45
|
// corner radius, px
|
|
46
46
|
radius: 20,
|
|
47
|
+
// border: width in px (0 for none), CSS style, color and its opacity
|
|
48
|
+
borderWidth: 1,
|
|
49
|
+
borderStyle: 'solid',
|
|
50
|
+
borderColor: '#ffffff',
|
|
51
|
+
borderOpacity: 0.06,
|
|
47
52
|
}
|
|
48
53
|
|
|
54
|
+
const BORDER_STYLES = ['solid', 'dashed', 'dotted', 'double']
|
|
55
|
+
|
|
49
56
|
const FALLBACK_BG = '#1d201e'
|
|
50
57
|
const FALLBACK_FG = '#e3e2be'
|
|
51
58
|
|
|
@@ -69,11 +76,12 @@ const CSS = `
|
|
|
69
76
|
-webkit-backdrop-filter: blur(var(--tgm-blur));
|
|
70
77
|
backdrop-filter: blur(var(--tgm-blur));
|
|
71
78
|
color: var(--tgm-fg);
|
|
72
|
-
/* the system UI font
|
|
73
|
-
|
|
79
|
+
/* the system UI font (Chromium reads it from the GTK settings on Linux),
|
|
80
|
+
so the menu follows it when it changes */
|
|
81
|
+
font-family: system-ui, sans-serif;
|
|
74
82
|
font-size: 13px;
|
|
75
83
|
line-height: 1.35;
|
|
76
|
-
border:
|
|
84
|
+
border: var(--tgm-border-width) var(--tgm-border-style) var(--tgm-border-color);
|
|
77
85
|
box-shadow: 0 2px 3px -1px rgba(0, 0, 0, 0.15), 0 4px 3px 0 rgba(0, 0, 0, 0.18),
|
|
78
86
|
0 1px 6px 0 rgba(0, 0, 0, 0.12);
|
|
79
87
|
user-select: none;
|
|
@@ -288,6 +296,14 @@ class GlassMenu {
|
|
|
288
296
|
el.style.setProperty('--tgm-fg', fg)
|
|
289
297
|
el.style.setProperty('--tgm-blur', `${clamp(num(s.blur, DEFAULTS.blur), 0, 100)}px`)
|
|
290
298
|
el.style.setProperty('--tgm-radius', `${clamp(num(s.radius, DEFAULTS.radius), 0, 40)}px`)
|
|
299
|
+
const borderColor = /^#[0-9a-f]{3}([0-9a-f]{3})?$/i.test(s.borderColor)
|
|
300
|
+
? s.borderColor : DEFAULTS.borderColor
|
|
301
|
+
const borderPct = Math.round(clamp(num(s.borderOpacity, DEFAULTS.borderOpacity), 0, 1) * 100)
|
|
302
|
+
el.style.setProperty('--tgm-border-width', `${clamp(num(s.borderWidth, DEFAULTS.borderWidth), 0, 8)}px`)
|
|
303
|
+
el.style.setProperty('--tgm-border-style',
|
|
304
|
+
BORDER_STYLES.includes(s.borderStyle) ? s.borderStyle : DEFAULTS.borderStyle)
|
|
305
|
+
el.style.setProperty('--tgm-border-color',
|
|
306
|
+
`color-mix(in srgb, ${borderColor} ${borderPct}%, transparent)`)
|
|
291
307
|
}
|
|
292
308
|
|
|
293
309
|
viewport () {
|
|
@@ -641,11 +657,58 @@ const SETTINGS_TEMPLATE = `
|
|
|
641
657
|
</div>
|
|
642
658
|
</div>
|
|
643
659
|
|
|
660
|
+
<h4 class="tgm-section">Border</h4>
|
|
661
|
+
|
|
662
|
+
<div class="form-line">
|
|
663
|
+
<div class="header">
|
|
664
|
+
<div class="title">Width</div>
|
|
665
|
+
<div class="description">In pixels, 0 for no border</div>
|
|
666
|
+
</div>
|
|
667
|
+
<div class="tgm-range">
|
|
668
|
+
<input type="range" class="form-range" min="0" max="8" step="1"
|
|
669
|
+
[(ngModel)]="config.store.glassMenu.borderWidth" (ngModelChange)="save()">
|
|
670
|
+
<span>{{ config.store.glassMenu.borderWidth }} px</span>
|
|
671
|
+
</div>
|
|
672
|
+
</div>
|
|
673
|
+
|
|
674
|
+
<div class="form-line">
|
|
675
|
+
<div class="header">
|
|
676
|
+
<div class="title">Style</div>
|
|
677
|
+
</div>
|
|
678
|
+
<select class="form-control tgm-select"
|
|
679
|
+
[(ngModel)]="config.store.glassMenu.borderStyle" (ngModelChange)="save()">
|
|
680
|
+
<option *ngFor="let style of borderStyles" [ngValue]="style">{{ style }}</option>
|
|
681
|
+
</select>
|
|
682
|
+
</div>
|
|
683
|
+
|
|
684
|
+
<div class="form-line">
|
|
685
|
+
<div class="header">
|
|
686
|
+
<div class="title">Color</div>
|
|
687
|
+
</div>
|
|
688
|
+
<input type="color" class="tgm-color"
|
|
689
|
+
[(ngModel)]="config.store.glassMenu.borderColor" (ngModelChange)="save()">
|
|
690
|
+
</div>
|
|
691
|
+
|
|
692
|
+
<div class="form-line">
|
|
693
|
+
<div class="header">
|
|
694
|
+
<div class="title">Opacity</div>
|
|
695
|
+
<div class="description">0 is invisible, 1 is the full color</div>
|
|
696
|
+
</div>
|
|
697
|
+
<div class="tgm-range">
|
|
698
|
+
<input type="range" class="form-range" min="0" max="1" step="0.01"
|
|
699
|
+
[(ngModel)]="config.store.glassMenu.borderOpacity" (ngModelChange)="save()">
|
|
700
|
+
<span>{{ config.store.glassMenu.borderOpacity | number:'1.2-2' }}</span>
|
|
701
|
+
</div>
|
|
702
|
+
</div>
|
|
703
|
+
|
|
644
704
|
<button class="btn btn-secondary" (click)="preview($event)">Show a sample menu</button>
|
|
645
705
|
`
|
|
646
706
|
|
|
647
707
|
const SETTINGS_STYLES = [`
|
|
648
708
|
.tgm-intro { opacity: 0.8; }
|
|
709
|
+
.tgm-section { margin-top: 1.5rem; }
|
|
710
|
+
.tgm-select { width: auto; min-width: 140px; }
|
|
711
|
+
.tgm-color { width: 48px; height: 32px; padding: 0; border: none; background: none; cursor: pointer; }
|
|
649
712
|
.tgm-range { display: flex; align-items: center; gap: 12px; min-width: 260px; }
|
|
650
713
|
.tgm-range input { flex: 1; }
|
|
651
714
|
.tgm-range span { min-width: 3.5em; text-align: right; font-variant-numeric: tabular-nums; }
|
|
@@ -655,6 +718,7 @@ class GlassMenuSettingsComponent {
|
|
|
655
718
|
constructor (config, menu) {
|
|
656
719
|
this.config = config
|
|
657
720
|
this.menu = menu
|
|
721
|
+
this.borderStyles = BORDER_STYLES
|
|
658
722
|
}
|
|
659
723
|
|
|
660
724
|
save () {
|
|
@@ -662,6 +726,8 @@ class GlassMenuSettingsComponent {
|
|
|
662
726
|
s.opacity = num(s.opacity, DEFAULTS.opacity)
|
|
663
727
|
s.blur = num(s.blur, DEFAULTS.blur)
|
|
664
728
|
s.radius = num(s.radius, DEFAULTS.radius)
|
|
729
|
+
s.borderWidth = num(s.borderWidth, DEFAULTS.borderWidth)
|
|
730
|
+
s.borderOpacity = num(s.borderOpacity, DEFAULTS.borderOpacity)
|
|
665
731
|
this.config.save()
|
|
666
732
|
}
|
|
667
733
|
|