mirror of
https://github.com/morgan9e/dash-to-panel
synced 2026-04-14 00:04:17 +09:00
adjust tray and leftbox content based on settings
This commit is contained in:
@@ -775,6 +775,8 @@
|
||||
<property name="round_digits">0</property>
|
||||
<property name="digits">0</property>
|
||||
<property name="value_pos">right</property>
|
||||
<signal name="format-value" handler="tray_size_scale_format_value_cb" swapped="no"/>
|
||||
<signal name="value-changed" handler="tray_size_scale_value_changed_cb" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
@@ -803,7 +805,9 @@
|
||||
<property name="adjustment">leftbox_size_adjustment</property>
|
||||
<property name="round_digits">0</property>
|
||||
<property name="digits">0</property>
|
||||
<property name="value_pos">right</property>
|
||||
<property name="value_pos">right</property>
|
||||
<signal name="format-value" handler="leftbox_size_scale_format_value_cb" swapped="no"/>
|
||||
<signal name="value-changed" handler="leftbox_size_scale_value_changed_cb" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
|
||||
21
extension.js
21
extension.js
@@ -82,6 +82,8 @@ function enable() {
|
||||
MonitorsChangedListener = global.screen.connect("monitors-changed", setPanelStyle);
|
||||
HeightNotifyListener = PanelBox.connect("notify::height", setPanelStyle);
|
||||
setPanelStyle();
|
||||
setTraySize(settings.get_int('tray-size'));
|
||||
setLeftBoxSize(settings.get_int('tray-size'));
|
||||
Main.panel.actor.add_style_class_name("popup-menu");
|
||||
|
||||
// Since Gnome 3.8 dragging an app without having opened the overview before cause the attemp to
|
||||
@@ -141,6 +143,8 @@ function disable() {
|
||||
PanelBox.set_anchor_point(0, 0);
|
||||
Main.overview._overview.remove_child(myPanelGhost);
|
||||
Main.overview._panelGhost.set_height(oldPanelHeight);
|
||||
setTraySize(0);
|
||||
setLeftBoxSize(0);
|
||||
Main.panel.actor.remove_style_class_name("popup-menu");
|
||||
|
||||
// dereference
|
||||
@@ -169,6 +173,15 @@ function setPanelStyle() {
|
||||
PanelBox.set_anchor_point(0,(-1)*(Main.layoutManager.primaryMonitor.height-PanelBox.height));
|
||||
}
|
||||
|
||||
function setTraySize(size) {
|
||||
size ? panel._centerBox.set_style("font-size: " + size + "px;") : panel._centerBox.set_style("");
|
||||
size ? panel._rightBox.set_style("font-size: " + size + "px;") : panel._rightBox.set_style("");
|
||||
}
|
||||
|
||||
function setLeftBoxSize(size) {
|
||||
size ? panel._leftBox.set_style("font-size: " + size + "px;") : panel._leftBox.set_style("");
|
||||
}
|
||||
|
||||
function bindSettingsChanges() {
|
||||
settings.connect('changed::panel-position', function() {
|
||||
setPanelStyle();
|
||||
@@ -177,6 +190,14 @@ function bindSettingsChanges() {
|
||||
settings.connect('changed::panel-size', function() {
|
||||
setPanelStyle();
|
||||
});
|
||||
|
||||
settings.connect('changed::tray-size', function() {
|
||||
setTraySize(settings.get_int('tray-size'));
|
||||
});
|
||||
|
||||
settings.connect('changed::leftbox-size', function() {
|
||||
setLeftBoxSize(settings.get_int('leftbox-size'));
|
||||
});
|
||||
}
|
||||
|
||||
function allocate(actor, box, flags) {
|
||||
|
||||
32
prefs.js
32
prefs.js
@@ -248,6 +248,38 @@ const Settings = new Lang.Class({
|
||||
this._panel_size_timeout = 0;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
},
|
||||
|
||||
tray_size_scale_format_value_cb: function(scale, value) {
|
||||
return value+ ' px';
|
||||
},
|
||||
|
||||
tray_size_scale_value_changed_cb: function(scale) {
|
||||
// Avoid settings the size consinuosly
|
||||
if (this._panel_size_timeout > 0)
|
||||
Mainloop.source_remove(this._panel_size_timeout);
|
||||
|
||||
this._panel_size_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this, function() {
|
||||
this._settings.set_int('tray-size', scale.get_value());
|
||||
this._panel_size_timeout = 0;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
},
|
||||
|
||||
leftbox_size_scale_format_value_cb: function(scale, value) {
|
||||
return value+ ' px';
|
||||
},
|
||||
|
||||
leftbox_size_scale_value_changed_cb: function(scale) {
|
||||
// Avoid settings the size consinuosly
|
||||
if (this._panel_size_timeout > 0)
|
||||
Mainloop.source_remove(this._panel_size_timeout);
|
||||
|
||||
this._panel_size_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this, function() {
|
||||
this._settings.set_int('leftbox-size', scale.get_value());
|
||||
this._panel_size_timeout = 0;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user