diff --git a/activate_gnome@isjerryxiao/extension.js b/activate_gnome@isjerryxiao/extension.js
index 755f6f4..7724282 100644
--- a/activate_gnome@isjerryxiao/extension.js
+++ b/activate_gnome@isjerryxiao/extension.js
@@ -35,12 +35,16 @@ class Extension {
let text2 = this.settings_get('get_string', 'text-l2')
let vl2 = this.settings_get('get_double', 'l2-vertical')
let hl2 = this.settings_get('get_double', 'l2-horizontal')
+ let size1 = parseInt(this.settings_get('get_double', 'size-l1'))
+ let size2 = parseInt(this.settings_get('get_double', 'size-l2'))
let opacity = this.settings_get('get_double', 'opacity')
this.cleanup()
for (let monitor of Main.layoutManager.monitors) {
let label_1 = new St.Label({style_class: 'label-1', text: text1, opacity})
let label_2 = new St.Label({style_class: 'label-2', text: text2, opacity})
+ label_1.set_style(`font-size: ${size1}px`)
+ label_2.set_style(`font-size: ${size2}px`)
Main.layoutManager.uiGroup.add_actor(label_2, {"trackFullscreen": false})
Main.layoutManager.uiGroup.add_actor(label_1, {"trackFullscreen": false})
this.labels.push(label_1)
diff --git a/activate_gnome@isjerryxiao/prefs.js b/activate_gnome@isjerryxiao/prefs.js
index 7483c7b..3edd95f 100644
--- a/activate_gnome@isjerryxiao/prefs.js
+++ b/activate_gnome@isjerryxiao/prefs.js
@@ -21,102 +21,138 @@ function buildPrefsWidget() {
})
// line 1
- let l1label = new Gtk.Label({
+ let label_line_1 = new Gtk.Label({
label: 'Line 1',
margin_top: 6,
use_markup: true,
})
- prefsWidget.append(l1label)
+ prefsWidget.append(label_line_1)
- let l1entry = new Gtk.Entry({
+ let entry_line_1 = new Gtk.Entry({
margin_top: 6,
hexpand: true,
})
- l1entry.set_width_chars(30)
- prefsWidget.append(l1entry)
+ entry_line_1.set_width_chars(30)
+ prefsWidget.append(entry_line_1)
// line 2
- let l2label = new Gtk.Label({
+ let label_line_2 = new Gtk.Label({
label: 'Line 2',
margin_top: 6,
use_markup: true,
})
- prefsWidget.append(l2label)
+ prefsWidget.append(label_line_2)
- let l2entry = new Gtk.Entry({
+ let entry_line_2 = new Gtk.Entry({
margin_top: 6,
hexpand: true,
})
- l2entry.set_width_chars(30)
- prefsWidget.append(l2entry)
+ entry_line_2.set_width_chars(30)
+ prefsWidget.append(entry_line_2)
- // l2-vertical
- let vlabel = new Gtk.Label({
+ // line 2 vertical position
+ let label_line_2_vertical_position = new Gtk.Label({
label: 'Vertical Position',
margin_top: 12,
use_markup: true,
})
- prefsWidget.append(vlabel)
+ prefsWidget.append(label_line_2_vertical_position)
- let ventry = new Gtk.SpinButton({
+ let scale_line_2_vertical_position = new Gtk.Scale({
adjustment: new Gtk.Adjustment({lower: 0.01, upper: 1.0, step_increment: 0.01, page_increment: 0.1}),
margin_top: 6,
- numeric: true,
+ draw_value: false,
digits: 4,
})
- prefsWidget.append(ventry)
+ prefsWidget.append(scale_line_2_vertical_position)
- // l2-horizontal
- let hlabel = new Gtk.Label({
+ // line 2 horizontal position
+ let label_line_2_horizontal_position = new Gtk.Label({
label: 'Horizontal Position',
margin_top: 6,
use_markup: true,
})
- prefsWidget.append(hlabel)
+ prefsWidget.append(label_line_2_horizontal_position)
- let hentry = new Gtk.SpinButton({
+ let scale_line_2_horizontal_position = new Gtk.Scale({
adjustment: new Gtk.Adjustment({lower: 0.01, upper: 1.0, step_increment: 0.01, page_increment: 0.1}),
margin_top: 6,
- numeric: true,
+ draw_value: false,
digits: 4,
})
- prefsWidget.append(hentry)
+ prefsWidget.append(scale_line_2_horizontal_position)
+
+ // line 1 text size
+ let label_line_1_text_size = new Gtk.Label({
+ label: 'Line 1 Text Size',
+ margin_top: 12,
+ use_markup: true,
+ })
+ prefsWidget.append(label_line_1_text_size)
+
+ let spinbutton_line_1_text_size = new Gtk.SpinButton({
+ adjustment: new Gtk.Adjustment({lower: 1.0, upper: 65535.0, step_increment: 1.0, page_increment: 10.0}),
+ margin_top: 6,
+ numeric: true,
+ digits: 1,
+ })
+ prefsWidget.append(spinbutton_line_1_text_size)
+
+ // line 2 text size
+ let label_line_2_text_size = new Gtk.Label({
+ label: 'Line 2 Text Size',
+ margin_top: 6,
+ use_markup: true,
+ })
+ prefsWidget.append(label_line_2_text_size)
+
+ let spinbutton_line_2_text_size = new Gtk.SpinButton({
+ adjustment: new Gtk.Adjustment({lower: 1.0, upper: 65535.0, step_increment: 1.0, page_increment: 10.0}),
+ margin_top: 6,
+ numeric: true,
+ digits: 1,
+ })
+ prefsWidget.append(spinbutton_line_2_text_size)
// opacity
- let olabel = new Gtk.Label({
+ let label_opacity = new Gtk.Label({
label: 'Opacity',
margin_top: 6,
use_markup: true,
})
- prefsWidget.append(olabel)
+ prefsWidget.append(label_opacity)
- let oentry = new Gtk.Scale({
+ let scale_opacity = new Gtk.Scale({
adjustment: new Gtk.Adjustment({lower: 0.1, upper: 255, step_increment: 0.1, page_increment: 1}),
margin_top: 6,
draw_value: false,
digits: 1,
})
- prefsWidget.append(oentry)
+ prefsWidget.append(scale_opacity)
- let resetbtn = new Gtk.Button({
+ let button_reset = new Gtk.Button({
label: 'reset',
margin_top: 12,
margin_bottom: 6,
})
- resetbtn.connect('clicked', () => {
+ button_reset.connect('clicked', () => {
this.settings.reset('text-l1')
this.settings.reset('text-l2')
this.settings.reset('l2-vertical')
this.settings.reset('l2-horizontal')
+ this.settings.reset('size-l1')
+ this.settings.reset('size-l2')
this.settings.reset('opacity')
})
- prefsWidget.append(resetbtn)
+ prefsWidget.append(button_reset)
- this.settings.bind('text-l1', l1entry, 'text', Gio.SettingsBindFlags.DEFAULT)
- this.settings.bind('text-l2', l2entry, 'text', Gio.SettingsBindFlags.DEFAULT)
- this.settings.bind('l2-vertical', ventry.adjustment, 'value', Gio.SettingsBindFlags.DEFAULT)
- this.settings.bind('l2-horizontal', hentry.adjustment, 'value', Gio.SettingsBindFlags.DEFAULT)
- this.settings.bind('opacity', oentry.adjustment, 'value', Gio.SettingsBindFlags.DEFAULT)
+ this.settings.bind('text-l1', entry_line_1, 'text', Gio.SettingsBindFlags.DEFAULT)
+ this.settings.bind('text-l2', entry_line_2, 'text', Gio.SettingsBindFlags.DEFAULT)
+ this.settings.bind('l2-vertical', scale_line_2_vertical_position.adjustment, 'value', Gio.SettingsBindFlags.DEFAULT)
+ this.settings.bind('l2-horizontal', scale_line_2_horizontal_position.adjustment, 'value', Gio.SettingsBindFlags.DEFAULT)
+ this.settings.bind('size-l1', spinbutton_line_1_text_size.adjustment, 'value', Gio.SettingsBindFlags.DEFAULT)
+ this.settings.bind('size-l2', spinbutton_line_2_text_size.adjustment, 'value', Gio.SettingsBindFlags.DEFAULT)
+ this.settings.bind('opacity', scale_opacity.adjustment, 'value', Gio.SettingsBindFlags.DEFAULT)
return prefsWidget
}
diff --git a/activate_gnome@isjerryxiao/schemas/org.gnome.shell.extensions.activate_gnome.gschema.xml b/activate_gnome@isjerryxiao/schemas/org.gnome.shell.extensions.activate_gnome.gschema.xml
index 1bfd775..3c792fc 100644
--- a/activate_gnome@isjerryxiao/schemas/org.gnome.shell.extensions.activate_gnome.gschema.xml
+++ b/activate_gnome@isjerryxiao/schemas/org.gnome.shell.extensions.activate_gnome.gschema.xml
@@ -22,5 +22,13 @@
102
Opacity
+
+ 36
+ Text size of line 1 (px)
+
+
+ 26
+ Text size of line 2 (px)
+
diff --git a/activate_gnome@isjerryxiao/stylesheet.css b/activate_gnome@isjerryxiao/stylesheet.css
index b35cc42..c73d3d7 100644
--- a/activate_gnome@isjerryxiao/stylesheet.css
+++ b/activate_gnome@isjerryxiao/stylesheet.css
@@ -1,13 +1,11 @@
/* Add your custom extension styling here */
.label-1 {
- font-size: 36px;
font-weight: normal;
color: rgba(255, 255, 255, 1);
background-color: rgba(0, 0, 0, 0);
border-radius: 5px;
}
.label-2 {
- font-size: 26px;
font-weight: normal;
color: rgba(255, 255, 255, 1);
background-color: rgba(0, 0, 0, 0);