mirror of
https://github.com/morgan9e/dash-to-panel
synced 2026-04-14 00:04:17 +09:00
Merge pull request #1114 from marksvc/panel-length
Display panel along percent of screen edge
This commit is contained in:
2
Makefile
2
Makefile
@@ -2,7 +2,7 @@
|
||||
|
||||
UUID = dash-to-panel@jderose9.github.com
|
||||
BASE_MODULES = extension.js stylesheet.css metadata.json COPYING README.md
|
||||
EXTRA_MODULES = appIcons.js convenience.js panel.js panelManager.js proximity.js intellihide.js progress.js panelPositions.js panelStyle.js overview.js taskbar.js transparency.js windowPreview.js prefs.js update.js utils.js Settings.ui
|
||||
EXTRA_MODULES = appIcons.js convenience.js panel.js panelManager.js proximity.js intellihide.js progress.js panelPositions.js panelSettings.js panelStyle.js overview.js taskbar.js transparency.js windowPreview.js prefs.js update.js utils.js Settings.ui
|
||||
EXTRA_IMAGES = highlight_stacked_bg.svg highlight_stacked_bg_2.svg highlight_stacked_bg_3.svg
|
||||
|
||||
TOLOCALIZE = prefs.js appIcons.js update.js
|
||||
|
||||
459
Settings.ui
459
Settings.ui
@@ -2,6 +2,11 @@
|
||||
<!-- Generated with glade 3.36.0 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.12"/>
|
||||
<object class="GtkAdjustment" id="panel_length_adjustment">
|
||||
<property name="upper">100</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="appicon_margin_adjustment">
|
||||
<property name="lower">0.33</property>
|
||||
<property name="upper">1</property>
|
||||
@@ -2760,44 +2765,45 @@
|
||||
<property name="margin_top">12</property>
|
||||
<property name="column_spacing">32</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">8</property>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="preview_custom_icon_size_switch">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">8</property>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="preview_custom_icon_size_switch">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="preview_custom_icon_size_spinbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="width_chars">4</property>
|
||||
<property name="text">6</property>
|
||||
<property name="adjustment">preview_custom_icon_size_adjustment</property>
|
||||
<property name="numeric">True</property>
|
||||
<property name="value">6</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
</packing>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="preview_custom_icon_size_spinbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="width_chars">4</property>
|
||||
<property name="text">6</property>
|
||||
<property name="adjustment">preview_custom_icon_size_adjustment</property>
|
||||
<property name="numeric">True</property>
|
||||
<property name="value">6</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="preview_custom_icon_size_label">
|
||||
@@ -4142,9 +4148,8 @@
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
@@ -4821,124 +4826,240 @@
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="margin_start">12</property>
|
||||
<property name="margin_top">4</property>
|
||||
<property name="margin_bottom">4</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="panel_position_box">
|
||||
<object class="GtkFrame" id="panel_size_frame">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_top">18</property>
|
||||
<property name="margin_bottom">6</property>
|
||||
<property name="spacing">32</property>
|
||||
<property name="margin_top">6</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="panel_position_label">
|
||||
<object class="GtkListBox" id="panel_size_listbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">Panel screen position</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="selection_mode">none</property>
|
||||
<child>
|
||||
<object class="GtkListBoxRow" id="panel_size_listboxrow">
|
||||
<property name="width_request">100</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="panel_size_grid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_top">6</property>
|
||||
<property name="margin_bottom">6</property>
|
||||
<property name="row_spacing">12</property>
|
||||
<property name="column_spacing">32</property>
|
||||
<child>
|
||||
<object class="GtkScale" id="panel_size_scale">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="adjustment">panel_size_adjustment</property>
|
||||
<property name="round_digits">0</property>
|
||||
<property name="digits">0</property>
|
||||
<property name="value_pos">right</property>
|
||||
<signal name="format-value" handler="panel_size_scale_format_value_cb" swapped="no"/>
|
||||
<signal name="value-changed" handler="panel_size_scale_value_changed_cb" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="panel_size_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Panel thickness
|
||||
(default is 48)</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="panel_length_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Panel length (%)
|
||||
(default is 100)</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScale" id="panel_length_scale">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="adjustment">panel_length_adjustment</property>
|
||||
<property name="round_digits">0</property>
|
||||
<property name="digits">0</property>
|
||||
<property name="value_pos">right</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="panel_anchor_combo">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">center</property>
|
||||
<items>
|
||||
<item id="START" translatable="yes">Start</item>
|
||||
<item id="MIDDLE" translatable="yes">Middle</item>
|
||||
<item id="END" translatable="yes">End</item>
|
||||
</items>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="panel_anchor_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Anchor</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="panel_position_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">Panel screen position</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="panel_position_butttons_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">32</property>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="position_bottom_button">
|
||||
<property name="label" translatable="yes">Bottom</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="clicked" handler="position_bottom_button_clicked_cb" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="position_top_button">
|
||||
<property name="label" translatable="yes">Top</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="image_position">bottom</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">position_bottom_button</property>
|
||||
<signal name="clicked" handler="position_top_button_clicked_cb" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="position_left_button">
|
||||
<property name="label" translatable="yes">Left</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="image_position">bottom</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">position_bottom_button</property>
|
||||
<signal name="clicked" handler="position_left_button_clicked_cb" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="position_right_button">
|
||||
<property name="label" translatable="yes">Right</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="image_position">bottom</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">position_bottom_button</property>
|
||||
<signal name="clicked" handler="position_right_button_clicked_cb" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="panel_position_butttons_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">32</property>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="position_bottom_button">
|
||||
<property name="label" translatable="yes">Bottom</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="clicked" handler="position_bottom_button_clicked_cb" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="position_top_button">
|
||||
<property name="label" translatable="yes">Top</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="image_position">bottom</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">position_bottom_button</property>
|
||||
<signal name="clicked" handler="position_top_button_clicked_cb" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="position_left_button">
|
||||
<property name="label" translatable="yes">Left</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="image_position">bottom</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">position_bottom_button</property>
|
||||
<signal name="clicked" handler="position_left_button_clicked_cb" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="position_right_button">
|
||||
<property name="label" translatable="yes">Right</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="image_position">bottom</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">position_bottom_button</property>
|
||||
<signal name="clicked" handler="position_right_button_clicked_cb" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
<child type="label_item">
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
@@ -4947,9 +5068,6 @@
|
||||
<property name="width">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
@@ -5015,55 +5133,6 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="selection_mode">none</property>
|
||||
<child>
|
||||
<object class="GtkListBoxRow" id="panel_size_listboxrow">
|
||||
<property name="width_request">100</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="panel_size_grid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">12</property>
|
||||
<property name="margin_right">12</property>
|
||||
<property name="margin_top">6</property>
|
||||
<property name="margin_bottom">6</property>
|
||||
<property name="column_spacing">32</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="panel_size_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Panel Size
|
||||
(default is 48)</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScale" id="panel_size_scale">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="adjustment">panel_size_adjustment</property>
|
||||
<property name="round_digits">0</property>
|
||||
<property name="digits">0</property>
|
||||
<property name="value_pos">right</property>
|
||||
<signal name="format-value" handler="panel_size_scale_format_value_cb" swapped="no"/>
|
||||
<signal name="value-changed" handler="panel_size_scale_value_changed_cb" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkListBoxRow" id="margin_listboxrow">
|
||||
<property name="width_request">100</property>
|
||||
|
||||
11
appIcons.js
11
appIcons.js
@@ -47,6 +47,7 @@ const Workspace = imports.ui.workspace;
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
const Utils = Me.imports.utils;
|
||||
const Panel = Me.imports.panel;
|
||||
const PanelSettings = Me.imports.panelSettings;
|
||||
const Taskbar = Me.imports.taskbar;
|
||||
const Progress = Me.imports.progress;
|
||||
const _ = imports.gettext.domain(Utils.TRANSLATION_DOMAIN).gettext;
|
||||
@@ -573,9 +574,9 @@ var taskbarAppIcon = Utils.defineClass({
|
||||
},
|
||||
|
||||
_setAppIconPadding: function() {
|
||||
let padding = getIconPadding();
|
||||
let padding = getIconPadding(this.dtpPanel.monitor.index);
|
||||
let margin = Me.settings.get_int('appicon-margin');
|
||||
|
||||
|
||||
this.actor.set_style('padding:' + (this.dtpPanel.checkIfVertical() ? margin + 'px 0' : '0 ' + margin + 'px;'));
|
||||
this._iconContainer.set_style('padding: ' + padding + 'px;');
|
||||
},
|
||||
@@ -1369,8 +1370,8 @@ function cssHexTocssRgba(cssHex, opacity) {
|
||||
return 'rgba(' + [r, g, b].join(',') + ',' + opacity + ')';
|
||||
}
|
||||
|
||||
function getIconPadding() {
|
||||
let panelSize = Me.settings.get_int('panel-size');
|
||||
function getIconPadding(monitorIndex) {
|
||||
let panelSize = PanelSettings.getPanelSize(Me.settings, monitorIndex);
|
||||
let padding = Me.settings.get_int('appicon-padding');
|
||||
let availSize = panelSize - Taskbar.MIN_ICON_SIZE - panelSize % 2;
|
||||
|
||||
@@ -1688,7 +1689,7 @@ var ShowAppsIconWrapper = Utils.defineClass({
|
||||
},
|
||||
|
||||
setShowAppsPadding: function() {
|
||||
let padding = getIconPadding();
|
||||
let padding = getIconPadding(this.realShowAppsIcon._dtpPanel.monitor.index);
|
||||
let sidePadding = Me.settings.get_int('show-apps-icon-side-padding');
|
||||
let isVertical = this.realShowAppsIcon._dtpPanel.checkIfVertical();
|
||||
|
||||
|
||||
40
panel.js
40
panel.js
@@ -36,6 +36,7 @@ const AppIcons = Me.imports.appIcons;
|
||||
const Utils = Me.imports.utils;
|
||||
const Taskbar = Me.imports.taskbar;
|
||||
const Pos = Me.imports.panelPositions;
|
||||
const PanelSettings = Me.imports.panelSettings;
|
||||
const PanelStyle = Me.imports.panelStyle;
|
||||
const Lang = imports.lang;
|
||||
const Main = imports.ui.main;
|
||||
@@ -535,8 +536,7 @@ var dtpPanel = Utils.defineClass({
|
||||
},
|
||||
|
||||
getPosition: function() {
|
||||
//for now, use the previous "global" position setting as default. The 'panel-position' should be deleted in the future
|
||||
let position = this.panelManager.panelPositions[this.monitor.index] || Me.settings.get_string('panel-position');
|
||||
let position = PanelSettings.getPanelPosition(Me.settings, this.monitor.index);
|
||||
|
||||
if (position == Pos.TOP) {
|
||||
return St.Side.TOP;
|
||||
@@ -652,12 +652,12 @@ var dtpPanel = Utils.defineClass({
|
||||
|
||||
_bindSettingsChanges: function() {
|
||||
let isVertical = this.checkIfVertical();
|
||||
|
||||
|
||||
this._signalsHandler.add(
|
||||
[
|
||||
Me.settings,
|
||||
[
|
||||
'changed::panel-size',
|
||||
'changed::panel-sizes',
|
||||
'changed::group-apps'
|
||||
],
|
||||
() => this._resetGeometry()
|
||||
@@ -814,11 +814,15 @@ var dtpPanel = Utils.defineClass({
|
||||
let topPadding = panelBoxTheme.get_padding(St.Side.TOP);
|
||||
let tbPadding = topPadding + panelBoxTheme.get_padding(St.Side.BOTTOM);
|
||||
let position = this.getPosition();
|
||||
let length = PanelSettings.getPanelLength(Me.settings, this.monitor.index) / 100;
|
||||
let anchor = PanelSettings.getPanelAnchor(Me.settings, this.monitor.index);
|
||||
let anchorPlaceOnMonitor = 0;
|
||||
let gsTopPanelOffset = 0;
|
||||
let x = 0, y = 0;
|
||||
let w = 0, h = 0;
|
||||
|
||||
this.dtpSize = Me.settings.get_int('panel-size') * scaleFactor;
|
||||
const panelSize = PanelSettings.getPanelSize(Me.settings, this.monitor.index);
|
||||
this.dtpSize = panelSize * scaleFactor;
|
||||
|
||||
if (Me.settings.get_boolean('stockgs-keep-top-panel') && Main.layoutManager.primaryMonitor == this.monitor) {
|
||||
gsTopPanelOffset = Main.layoutManager.panelBox.height - topPadding;
|
||||
@@ -835,13 +839,13 @@ var dtpPanel = Utils.defineClass({
|
||||
this.varCoord = { c1: 'y1', c2: 'y2' };
|
||||
|
||||
w = this.dtpSize;
|
||||
h = this.monitor.height - tbPadding - gsTopPanelOffset;
|
||||
h = this.monitor.height * length - tbPadding - gsTopPanelOffset;
|
||||
} else {
|
||||
this.sizeFunc = 'get_preferred_width';
|
||||
this.fixedCoord = { c1: 'y1', c2: 'y2' };
|
||||
this.varCoord = { c1: 'x1', c2: 'x2' };
|
||||
|
||||
w = this.monitor.width - lrPadding;
|
||||
w = this.monitor.width * length - lrPadding;
|
||||
h = this.dtpSize;
|
||||
}
|
||||
|
||||
@@ -852,10 +856,30 @@ var dtpPanel = Utils.defineClass({
|
||||
x = this.monitor.x + this.monitor.width - this.dtpSize - lrPadding;
|
||||
y = this.monitor.y + gsTopPanelOffset;
|
||||
} else { //BOTTOM
|
||||
x = this.monitor.x;
|
||||
x = this.monitor.x;
|
||||
y = this.monitor.y + this.monitor.height - this.dtpSize - tbPadding;
|
||||
}
|
||||
|
||||
if (this.checkIfVertical()) {
|
||||
if (anchor === Pos.MIDDLE) {
|
||||
anchorPlaceOnMonitor = (this.monitor.height - h) / 2;
|
||||
} else if (anchor === Pos.END) {
|
||||
anchorPlaceOnMonitor = this.monitor.height - h;
|
||||
} else { // Pos.START
|
||||
anchorPlaceOnMonitor = 0;
|
||||
}
|
||||
y = y + anchorPlaceOnMonitor;
|
||||
} else {
|
||||
if (anchor === Pos.MIDDLE) {
|
||||
anchorPlaceOnMonitor = (this.monitor.width - w) / 2;
|
||||
} else if (anchor === Pos.END) {
|
||||
anchorPlaceOnMonitor = this.monitor.width - w;
|
||||
} else { // Pos.START
|
||||
anchorPlaceOnMonitor = 0;
|
||||
}
|
||||
x = x + anchorPlaceOnMonitor;
|
||||
}
|
||||
|
||||
return {
|
||||
x: x, y: y,
|
||||
w: w, h: h,
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
const Overview = Me.imports.overview;
|
||||
const Panel = Me.imports.panel;
|
||||
const Pos = Me.imports.panelPositions;
|
||||
const PanelSettings = Me.imports.panelSettings;
|
||||
const Proximity = Me.imports.proximity;
|
||||
const Taskbar = Me.imports.taskbar;
|
||||
const Utils = Me.imports.utils;
|
||||
@@ -72,8 +72,7 @@ var dtpPanelManager = Utils.defineClass({
|
||||
|
||||
enable: function(reset) {
|
||||
let dtpPrimaryIndex = Me.settings.get_int('primary-monitor');
|
||||
|
||||
this.panelPositions = Pos.getSettingsPositions(Me.settings, 'panel-positions');
|
||||
|
||||
this.dtpPrimaryMonitor = Main.layoutManager.monitors[dtpPrimaryIndex] || Main.layoutManager.primaryMonitor;
|
||||
this.proximityManager = new Proximity.ProximityManager();
|
||||
|
||||
@@ -240,6 +239,8 @@ var dtpPanelManager = Utils.defineClass({
|
||||
'changed::multi-monitors',
|
||||
'changed::isolate-monitors',
|
||||
'changed::panel-positions',
|
||||
'changed::panel-lengths',
|
||||
'changed::panel-anchors',
|
||||
'changed::stockgs-keep-top-panel'
|
||||
],
|
||||
() => this._reset()
|
||||
@@ -435,7 +436,7 @@ var dtpPanelManager = Utils.defineClass({
|
||||
},
|
||||
|
||||
_updatePanelElementPositions: function() {
|
||||
this.panelsElementPositions = Pos.getSettingsPositions(Me.settings, 'panel-element-positions');
|
||||
this.panelsElementPositions = PanelSettings.getSettingsJson(Me.settings, 'panel-element-positions');
|
||||
this.allPanels.forEach(p => p.updateElementPositions());
|
||||
},
|
||||
|
||||
|
||||
@@ -35,6 +35,10 @@ var BOTTOM = 'BOTTOM';
|
||||
var LEFT = 'LEFT';
|
||||
var RIGHT = 'RIGHT';
|
||||
|
||||
var START = 'START';
|
||||
var MIDDLE = 'MIDDLE';
|
||||
var END = 'END';
|
||||
|
||||
var defaults = [
|
||||
{ element: SHOW_APPS_BTN, visible: true, position: STACKED_TL },
|
||||
{ element: ACTIVITIES_BTN, visible: false, position: STACKED_TL },
|
||||
@@ -52,18 +56,6 @@ var optionDialogFunctions = {};
|
||||
optionDialogFunctions[SHOW_APPS_BTN] = '_showShowAppsButtonOptions';
|
||||
optionDialogFunctions[DESKTOP_BTN] = '_showDesktopButtonOptions';
|
||||
|
||||
function getSettingsPositions(settings, setting) {
|
||||
var positions = null;
|
||||
|
||||
try {
|
||||
positions = JSON.parse(settings.get_string(setting));
|
||||
} catch(e) {
|
||||
log('Error parsing positions: ' + e.message);
|
||||
}
|
||||
|
||||
return positions;
|
||||
}
|
||||
|
||||
function checkIfCentered(position) {
|
||||
return position == CENTERED || position == CENTERED_MONITOR;
|
||||
}
|
||||
112
panelSettings.js
Normal file
112
panelSettings.js
Normal file
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* This file is part of the Dash-To-Panel extension for Gnome 3
|
||||
*
|
||||
* 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 2 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
const Pos = Me.imports.panelPositions;
|
||||
|
||||
/** Return object representing a settings value that is stored as JSON. */
|
||||
function getSettingsJson(settings, setting) {
|
||||
try {
|
||||
return JSON.parse(settings.get_string(setting));
|
||||
} catch(e) {
|
||||
log('Error parsing positions: ' + e.message);
|
||||
}
|
||||
}
|
||||
/** Write value object as JSON to setting in settings. */
|
||||
function setSettingsJson(settings, setting, value) {
|
||||
try {
|
||||
const json = JSON.stringify(value);
|
||||
settings.set_string(setting, json);
|
||||
} catch(e) {
|
||||
log('Error serializing setting: ' + e.message);
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns size of panel on a specific monitor, in pixels. */
|
||||
function getPanelSize(settings, monitorIndex) {
|
||||
const sizes = getSettingsJson(settings, 'panel-sizes');
|
||||
// Pull in deprecated setting if panel-sizes does not have setting for monitor.
|
||||
const fallbackSize = settings.get_int('panel-size');
|
||||
const theDefault = 48;
|
||||
return sizes[monitorIndex] || fallbackSize || theDefault;
|
||||
}
|
||||
|
||||
function setPanelSize(settings, monitorIndex, value) {
|
||||
if (!(Number.isInteger(value) && value <= 128 && value >= 16)) {
|
||||
log(`Not setting invalid panel size: ${value}`);
|
||||
return;
|
||||
}
|
||||
let sizes = getSettingsJson(settings, 'panel-sizes');
|
||||
sizes[monitorIndex] = value;
|
||||
setSettingsJson(settings, 'panel-sizes', sizes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns length of panel on a specific monitor, as a whole number percent,
|
||||
* from settings. e.g. 100
|
||||
*/
|
||||
function getPanelLength(settings, monitorIndex) {
|
||||
const lengths = getSettingsJson(settings, 'panel-lengths');
|
||||
const theDefault = 100;
|
||||
return lengths[monitorIndex] || theDefault;
|
||||
}
|
||||
|
||||
function setPanelLength(settings, monitorIndex, value) {
|
||||
if (!(Number.isInteger(value) && value <= 100 && value >= 0)) {
|
||||
log(`Not setting invalid panel length: ${value}`);
|
||||
return;
|
||||
}
|
||||
let lengths = getSettingsJson(settings, 'panel-lengths');
|
||||
lengths[monitorIndex] = value;
|
||||
setSettingsJson(settings, 'panel-lengths', lengths);
|
||||
}
|
||||
|
||||
/** Returns position of panel on a specific monitor. */
|
||||
function getPanelPosition(settings, monitorIndex) {
|
||||
const positions = getSettingsJson(settings, 'panel-positions');
|
||||
const fallbackPosition = settings.get_string('panel-position');
|
||||
const theDefault = Pos.BOTTOM;
|
||||
return positions[monitorIndex] || fallbackPosition || theDefault;
|
||||
}
|
||||
|
||||
function setPanelPosition(settings, monitorIndex, value) {
|
||||
if (!(value === Pos.TOP || value === Pos.BOTTOM || value === Pos.LEFT
|
||||
|| value === Pos.RIGHT)) {
|
||||
log(`Not setting invalid panel position: ${value}`);
|
||||
return;
|
||||
}
|
||||
const positions = getSettingsJson(settings, 'panel-positions');
|
||||
positions[monitorIndex] = value;
|
||||
setSettingsJson(settings, 'panel-positions', positions);
|
||||
}
|
||||
|
||||
/** Returns anchor location of panel on a specific monitor. */
|
||||
function getPanelAnchor(settings, monitorIndex) {
|
||||
const anchors = getSettingsJson(settings, 'panel-anchors');
|
||||
const theDefault = Pos.MIDDLE;
|
||||
return anchors[monitorIndex] || theDefault;
|
||||
}
|
||||
|
||||
function setPanelAnchor(settings, monitorIndex, value) {
|
||||
if (!(value === Pos.START || value === Pos.MIDDLE || value === Pos.END)) {
|
||||
log(`Not setting invalid panel anchor: ${value}`);
|
||||
return;
|
||||
}
|
||||
const anchors = getSettingsJson(settings, 'panel-anchors');
|
||||
anchors[monitorIndex] = value;
|
||||
setSettingsJson(settings, 'panel-anchors', anchors);
|
||||
}
|
||||
195
prefs.js
195
prefs.js
@@ -35,6 +35,7 @@ const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
|
||||
const _ = Gettext.gettext;
|
||||
const N_ = function(e) { return e };
|
||||
const Update = Me.imports.update;
|
||||
const PanelSettings = Me.imports.panelSettings;
|
||||
const Pos = Me.imports.panelPositions;
|
||||
|
||||
const SCALE_UPDATE_TIMEOUT = 500;
|
||||
@@ -42,6 +43,8 @@ const DEFAULT_PANEL_SIZES = [ 128, 96, 64, 48, 32, 24, 16 ];
|
||||
const DEFAULT_FONT_SIZES = [ 96, 64, 48, 32, 24, 16, 0 ];
|
||||
const DEFAULT_MARGIN_SIZES = [ 32, 24, 16, 12, 8, 4, 0 ];
|
||||
const DEFAULT_PADDING_SIZES = [ 32, 24, 16, 12, 8, 4, 0, -1 ];
|
||||
// Minimum length could be 0, but a higher value may help prevent confusion about where the panel went.
|
||||
const LENGTH_MARKS = [ 100, 90, 80, 70, 60, 50, 40, 30, 20, 10 ];
|
||||
const MAX_WINDOW_INDICATOR = 4;
|
||||
|
||||
const SCHEMA_PATH = '/org/gnome/shell/extensions/dash-to-panel/';
|
||||
@@ -218,30 +221,22 @@ const Settings = new Lang.Class({
|
||||
topRadio.set_tooltip_text(!topAvailable ? _('Unavailable when gnome-shell top panel is present') : '');
|
||||
},
|
||||
|
||||
_getPanelPositions: function() {
|
||||
return Pos.getSettingsPositions(this._settings, 'panel-positions');
|
||||
},
|
||||
|
||||
_getPanelPosition: function(monitorIndex) {
|
||||
let panelPositionsSettings = this._getPanelPositions();
|
||||
|
||||
return panelPositionsSettings[monitorIndex] || this._settings.get_string('panel-position');
|
||||
return PanelSettings.getPanelPosition(this._settings, monitorIndex);
|
||||
},
|
||||
|
||||
_setPanelPosition: function(position) {
|
||||
let panelPositionsSettings = this._getPanelPositions();
|
||||
let preventTop = this._settings.get_boolean('stockgs-keep-top-panel') && position == Pos.TOP;
|
||||
let monitorSync = this._settings.get_boolean('panel-element-positions-monitors-sync');
|
||||
let monitors = monitorSync ? this.monitors : [this._currentMonitorIndex];
|
||||
|
||||
monitors.forEach(m => panelPositionsSettings[m] = preventTop && this.monitors[0] == m ? Pos.BOTTOM : position);
|
||||
|
||||
this._settings.set_string('panel-positions', JSON.stringify(panelPositionsSettings));
|
||||
const monitorSync = this._settings.get_boolean('panel-element-positions-monitors-sync');
|
||||
const monitorsToSetFor = monitorSync ? this.monitors : [this._currentMonitorIndex];
|
||||
monitorsToSetFor.forEach(monitorIndex => {
|
||||
PanelSettings.setPanelPosition(this._settings, monitorIndex, position);
|
||||
});
|
||||
this._setAnchorLabels(this._currentMonitorIndex);
|
||||
},
|
||||
|
||||
_setPositionRadios: function(position) {
|
||||
this._ignorePositionRadios = true;
|
||||
|
||||
|
||||
switch (position) {
|
||||
case Pos.BOTTOM:
|
||||
this._builder.get_object('position_bottom_button').set_active(true);
|
||||
@@ -260,15 +255,98 @@ const Settings = new Lang.Class({
|
||||
this._ignorePositionRadios = false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Set panel anchor combo labels according to whether the monitor's panel is vertical
|
||||
* or horizontal, or if all monitors' panels are being configured and they are a mix
|
||||
* of vertical and horizontal.
|
||||
*/
|
||||
_setAnchorLabels: function(currentMonitorIndex) {
|
||||
const monitorSync = this._settings.get_boolean('panel-element-positions-monitors-sync');
|
||||
const monitorsToSetFor = monitorSync ? this.monitors : [currentMonitorIndex];
|
||||
const allVertical = monitorsToSetFor.every(i => {
|
||||
const position = PanelSettings.getPanelPosition(this._settings, i);
|
||||
return position === Pos.LEFT || position === Pos.RIGHT
|
||||
});
|
||||
const allHorizontal = monitorsToSetFor.every(i => {
|
||||
const position = PanelSettings.getPanelPosition(this._settings, i);
|
||||
return position === Pos.TOP || position === Pos.BOTTOM;
|
||||
});
|
||||
|
||||
const anchor_combo = this._builder.get_object('panel_anchor_combo');
|
||||
anchor_combo.remove_all();
|
||||
|
||||
if (allHorizontal) {
|
||||
anchor_combo.append(Pos.START, _('Left'));
|
||||
anchor_combo.append(Pos.MIDDLE, _('Center'));
|
||||
anchor_combo.append(Pos.END, _('Right'));
|
||||
} else if (allVertical) {
|
||||
anchor_combo.append(Pos.START, _('Top'));
|
||||
anchor_combo.append(Pos.MIDDLE, _('Middle'));
|
||||
anchor_combo.append(Pos.END, _('Bottom'));
|
||||
} else {
|
||||
// Setting for a mix of horizontal and vertical panels on different monitors.
|
||||
anchor_combo.append(Pos.START, _('Start'));
|
||||
anchor_combo.append(Pos.MIDDLE, _('Middle'));
|
||||
anchor_combo.append(Pos.END, _('End'));
|
||||
}
|
||||
|
||||
// Set combo box after re-populating its options. But only if it's for a single-panel
|
||||
// configuration, or a multi-panel configuration where they all have the same anchor
|
||||
// setting. So don't set the combo box if there is a multi-panel configuration with
|
||||
// different anchor settings.
|
||||
const someAnchor = PanelSettings.getPanelAnchor(this._settings, currentMonitorIndex);
|
||||
if (monitorsToSetFor.every(i =>
|
||||
PanelSettings.getPanelAnchor(this._settings, i) === someAnchor)) {
|
||||
const panel_anchor = PanelSettings.getPanelAnchor(this._settings, currentMonitorIndex);
|
||||
this._builder.get_object('panel_anchor_combo').set_active_id(panel_anchor);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* When a monitor is selected, update the widgets for panel position, size, anchoring,
|
||||
* and contents so they accurately show the settings for the panel on that monitor.
|
||||
*/
|
||||
_updateWidgetSettingsForMonitor: function(monitorIndex) {
|
||||
// Update display of panel screen position setting
|
||||
this._maybeDisableTopPosition();
|
||||
const panelPosition = this._getPanelPosition(monitorIndex);
|
||||
this._setPositionRadios(panelPosition);
|
||||
|
||||
// Update display of thickness, length, and anchor settings
|
||||
const panel_size_scale = this._builder.get_object('panel_size_scale');
|
||||
const size = PanelSettings.getPanelSize(this._settings, monitorIndex);
|
||||
panel_size_scale.set_value(size);
|
||||
|
||||
const panel_length_scale = this._builder.get_object('panel_length_scale');
|
||||
const length = PanelSettings.getPanelLength(this._settings, monitorIndex);
|
||||
panel_length_scale.set_value(length);
|
||||
this._setAnchorWidgetSensitivity(length);
|
||||
|
||||
this._setAnchorLabels(monitorIndex);
|
||||
|
||||
// Update display of panel content settings
|
||||
this._displayPanelPositionsForMonitor(monitorIndex);
|
||||
},
|
||||
|
||||
/**
|
||||
* Anchor is only relevant if panel length is less than 100%. Enable or disable
|
||||
* anchor widget sensitivity accordingly.
|
||||
*/
|
||||
_setAnchorWidgetSensitivity: function(panelLength) {
|
||||
const isPartialLength = panelLength < 100;
|
||||
this._builder.get_object('panel_anchor_label').set_sensitive(isPartialLength);
|
||||
this._builder.get_object('panel_anchor_combo').set_sensitive(isPartialLength);
|
||||
},
|
||||
|
||||
_displayPanelPositionsForMonitor: function(monitorIndex) {
|
||||
let taskbarListBox = this._builder.get_object('taskbar_display_listbox');
|
||||
|
||||
|
||||
taskbarListBox.get_children().forEach(c => c.destroy());
|
||||
|
||||
let labels = {};
|
||||
let panelPosition = this._getPanelPosition(monitorIndex);
|
||||
let isVertical = panelPosition == Pos.LEFT || panelPosition == Pos.RIGHT;
|
||||
let panelElementPositionsSettings = Pos.getSettingsPositions(this._settings, 'panel-element-positions');
|
||||
let panelElementPositionsSettings = PanelSettings.getSettingsJson(this._settings, 'panel-element-positions');
|
||||
let panelElementPositions = panelElementPositionsSettings[monitorIndex] || Pos.defaults;
|
||||
let updateElementsSettings = () => {
|
||||
let newPanelElementPositions = [];
|
||||
@@ -282,14 +360,12 @@ const Settings = new Lang.Class({
|
||||
position: c.positionCombo.get_active_id()
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
monitors.forEach(m => panelElementPositionsSettings[m] = newPanelElementPositions);
|
||||
this._settings.set_string('panel-element-positions', JSON.stringify(panelElementPositionsSettings));
|
||||
};
|
||||
|
||||
this._maybeDisableTopPosition();
|
||||
this._setPositionRadios(panelPosition);
|
||||
|
||||
|
||||
labels[Pos.SHOW_APPS_BTN] = _('Show Applications button');
|
||||
labels[Pos.ACTIVITIES_BTN] = _('Activities button');
|
||||
labels[Pos.TASKBAR] = _('Taskbar');
|
||||
@@ -477,13 +553,12 @@ const Settings = new Lang.Class({
|
||||
_bindSettings: function() {
|
||||
// size options
|
||||
let panel_size_scale = this._builder.get_object('panel_size_scale');
|
||||
panel_size_scale.set_range(DEFAULT_PANEL_SIZES[DEFAULT_PANEL_SIZES.length-1], DEFAULT_PANEL_SIZES[0]);
|
||||
panel_size_scale.set_value(this._settings.get_int('panel-size'));
|
||||
panel_size_scale.set_range(DEFAULT_PANEL_SIZES[DEFAULT_PANEL_SIZES.length - 1], DEFAULT_PANEL_SIZES[0]);
|
||||
DEFAULT_PANEL_SIZES.slice(1, -1).forEach(function(val) {
|
||||
panel_size_scale.add_mark(val, Gtk.PositionType.TOP, val.toString());
|
||||
});
|
||||
|
||||
// Corrent for rtl languages
|
||||
// Correct for rtl languages
|
||||
if (this._rtl) {
|
||||
// Flip value position: this is not done automatically
|
||||
panel_size_scale.set_value_pos(Gtk.PositionType.LEFT);
|
||||
@@ -748,7 +823,11 @@ const Settings = new Lang.Class({
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.INVERT_BOOLEAN);
|
||||
|
||||
this._settings.connect('changed::panel-element-positions-monitors-sync', () => this._maybeDisableTopPosition());
|
||||
this._settings.connect('changed::panel-element-positions-monitors-sync', () => {
|
||||
this._maybeDisableTopPosition();
|
||||
// The anchor combo box may has different labels for single- or all-monitor configuration.
|
||||
this._setAnchorLabels(this._currentMonitorIndex);
|
||||
});
|
||||
|
||||
this._builder.get_object('multimon_primary_combo').connect('changed', Lang.bind (this, function(widget) {
|
||||
this._settings.set_int('primary-monitor', this.monitors[widget.get_active()]);
|
||||
@@ -756,12 +835,9 @@ const Settings = new Lang.Class({
|
||||
|
||||
this._builder.get_object('taskbar_position_monitor_combo').connect('changed', Lang.bind (this, function(widget) {
|
||||
this._currentMonitorIndex = this.monitors[widget.get_active()];
|
||||
this._displayPanelPositionsForMonitor(this._currentMonitorIndex);
|
||||
this._updateWidgetSettingsForMonitor(this._currentMonitorIndex);
|
||||
}));
|
||||
|
||||
//panel positions
|
||||
this._displayPanelPositionsForMonitor(this._currentMonitorIndex);
|
||||
|
||||
this._settings.bind('multi-monitors',
|
||||
this._builder.get_object('multimon_multi_switch'),
|
||||
'active',
|
||||
@@ -770,7 +846,33 @@ const Settings = new Lang.Class({
|
||||
if (this.monitors.length === 1) {
|
||||
this._builder.get_object('multimon_multi_switch').set_sensitive(false);
|
||||
}
|
||||
|
||||
|
||||
const panel_length_scale = this._builder.get_object('panel_length_scale');
|
||||
panel_length_scale.connect('value-changed', Lang.bind (this, function(widget) {
|
||||
const value = widget.get_value();
|
||||
const monitorSync = this._settings.get_boolean('panel-element-positions-monitors-sync');
|
||||
const monitorsToSetFor = monitorSync ? this.monitors : [this._currentMonitorIndex];
|
||||
monitorsToSetFor.forEach(monitorIndex => {
|
||||
PanelSettings.setPanelLength(this._settings, monitorIndex, value);
|
||||
});
|
||||
|
||||
this._setAnchorWidgetSensitivity(value);
|
||||
}));
|
||||
|
||||
this._builder.get_object('panel_anchor_combo').connect('changed', Lang.bind (this, function(widget) {
|
||||
const value = widget.get_active_id();
|
||||
// Value can be null while anchor labels are being swapped out
|
||||
if (value !== null) {
|
||||
const monitorSync = this._settings.get_boolean('panel-element-positions-monitors-sync');
|
||||
const monitorsToSetFor = monitorSync ? this.monitors : [this._currentMonitorIndex];
|
||||
monitorsToSetFor.forEach(monitorIndex => {
|
||||
PanelSettings.setPanelAnchor(this._settings, monitorIndex, value);
|
||||
});
|
||||
}
|
||||
}));
|
||||
|
||||
this._updateWidgetSettingsForMonitor(this._currentMonitorIndex);
|
||||
|
||||
//dynamic opacity
|
||||
this._settings.bind('trans-use-custom-bg',
|
||||
this._builder.get_object('trans_bg_switch'),
|
||||
@@ -1853,14 +1955,22 @@ const Settings = new Lang.Class({
|
||||
{objectName: 'appicon_padding_scale', valueName: 'appicon-padding', range: DEFAULT_MARGIN_SIZES },
|
||||
{objectName: 'tray_padding_scale', valueName: 'tray-padding', range: DEFAULT_PADDING_SIZES },
|
||||
{objectName: 'leftbox_padding_scale', valueName: 'leftbox-padding', range: DEFAULT_PADDING_SIZES },
|
||||
{objectName: 'statusicon_padding_scale', valueName: 'status-icon-padding', range: DEFAULT_PADDING_SIZES }
|
||||
{objectName: 'statusicon_padding_scale', valueName: 'status-icon-padding', range: DEFAULT_PADDING_SIZES },
|
||||
{objectName: 'panel_length_scale', valueName: '', range: LENGTH_MARKS }
|
||||
];
|
||||
|
||||
|
||||
for(var idx in sizeScales) {
|
||||
let size_scale = this._builder.get_object(sizeScales[idx].objectName);
|
||||
let range = sizeScales[idx].range;
|
||||
size_scale.set_range(range[range.length-1], range[0]);
|
||||
size_scale.set_value(this._settings.get_int(sizeScales[idx].valueName));
|
||||
size_scale.set_range(range[range.length - 1], range[0]);
|
||||
let value;
|
||||
if (sizeScales[idx].objectName === 'panel_length_scale') {
|
||||
value = PanelSettings.getPanelLength(this._settings, this._currentMonitorIndex);
|
||||
} else {
|
||||
value = this._settings.get_int(sizeScales[idx].valueName);
|
||||
}
|
||||
size_scale.set_value(value);
|
||||
// Add marks from range arrays, omitting the first and last values.
|
||||
range.slice(1, -1).forEach(function(val) {
|
||||
size_scale.add_mark(val, Gtk.PositionType.TOP, val.toString());
|
||||
});
|
||||
@@ -2061,17 +2171,28 @@ const Settings = new Lang.Class({
|
||||
this._settings.set_string('window-preview-title-position', 'TOP');
|
||||
},
|
||||
|
||||
|
||||
panel_length_scale_format_value_cb: function(scale, value) {
|
||||
return value+ '%';
|
||||
},
|
||||
|
||||
panel_size_scale_format_value_cb: function(scale, value) {
|
||||
return value+ ' px';
|
||||
},
|
||||
|
||||
panel_size_scale_value_changed_cb: function(scale) {
|
||||
// Avoid settings the size consinuosly
|
||||
// Avoid settings the size continuously
|
||||
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('panel-size', scale.get_value());
|
||||
const value = scale.get_value();
|
||||
const monitorSync = this._settings.get_boolean('panel-element-positions-monitors-sync');
|
||||
const monitorsToSetFor = monitorSync ? this.monitors : [this._currentMonitorIndex];
|
||||
monitorsToSetFor.forEach(monitorIndex => {
|
||||
PanelSettings.setPanelSize(this._settings, monitorIndex, value);
|
||||
});
|
||||
|
||||
this._panel_size_timeout = 0;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
</key>
|
||||
<key name="panel-position" enum="org.gnome.shell.extensions.dash-to-panel.position">
|
||||
<default>'BOTTOM'</default>
|
||||
<summary>Panel position</summary>
|
||||
<summary>Panel position (Deprecated)</summary>
|
||||
<description>Panel is shown on the Bottom or Top of the screen.</description>
|
||||
</key>
|
||||
<key name="panel-element-positions-monitors-sync" type="b">
|
||||
@@ -87,9 +87,24 @@
|
||||
<summary>Panel element positions</summary>
|
||||
<description>Panel element positions (JSON).</description>
|
||||
</key>
|
||||
<key type="s" name="panel-lengths">
|
||||
<default>'{}'</default>
|
||||
<summary>Percentages of screen edge for panel to span</summary>
|
||||
<description>Length of the panels, in percent (JSON).</description>
|
||||
</key>
|
||||
<key type="s" name="panel-anchors">
|
||||
<default>'{}'</default>
|
||||
<summary>Positions along screen edge</summary>
|
||||
<description>Where to show the panels if it is not the full length of the screen edge (JSON).</description>
|
||||
</key>
|
||||
<key type="s" name="panel-sizes">
|
||||
<default>'{}'</default>
|
||||
<summary>Panel sizes</summary>
|
||||
<description>Sizes of panels, in pixels.</description>
|
||||
</key>
|
||||
<key type="i" name="panel-size">
|
||||
<default>48</default>
|
||||
<summary>Panel size</summary>
|
||||
<summary>Panel size (Deprecated)</summary>
|
||||
<description>Set the size of the panel.</description>
|
||||
</key>
|
||||
<key type="b" name="desktop-line-use-custom-color">
|
||||
|
||||
@@ -46,6 +46,7 @@ const Workspace = imports.ui.workspace;
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
const AppIcons = Me.imports.appIcons;
|
||||
const Panel = Me.imports.panel;
|
||||
const PanelSettings = Me.imports.panelSettings;
|
||||
const Utils = Me.imports.utils;
|
||||
const WindowPreview = Me.imports.windowPreview;
|
||||
|
||||
@@ -705,7 +706,8 @@ var taskbar = Utils.defineClass({
|
||||
},
|
||||
|
||||
_adjustIconSize: function() {
|
||||
let panelSize = Me.settings.get_int('panel-size');
|
||||
const thisMonitorIndex = this.dtpPanel.monitor.index;
|
||||
let panelSize = PanelSettings.getPanelSize(Me.settings, thisMonitorIndex);
|
||||
let availSize = panelSize - Me.settings.get_int('appicon-padding') * 2;
|
||||
let minIconSize = MIN_ICON_SIZE + panelSize % 2;
|
||||
|
||||
|
||||
2
utils.js
2
utils.js
@@ -23,7 +23,7 @@
|
||||
|
||||
const Clutter = imports.gi.Clutter;
|
||||
const Config = imports.misc.config;
|
||||
const GdkPixbuf = imports.gi.GdkPixbuf
|
||||
const GdkPixbuf = imports.gi.GdkPixbuf;
|
||||
const Gi = imports._gi;
|
||||
const Gio = imports.gi.Gio;
|
||||
const GLib = imports.gi.GLib;
|
||||
|
||||
@@ -144,7 +144,7 @@ var PreviewMenu = Utils.defineClass({
|
||||
[
|
||||
Me.settings,
|
||||
[
|
||||
'changed::panel-size',
|
||||
'changed::panel-sizes',
|
||||
'changed::window-preview-size',
|
||||
'changed::window-preview-padding',
|
||||
'changed::window-preview-show-title'
|
||||
|
||||
Reference in New Issue
Block a user