mirror of
https://github.com/morgan9e/dash-to-panel
synced 2026-04-14 00:04:17 +09:00
Add dynamic transparency and panel opacity/color options
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 panelStyle.js overview.js taskbar.js windowPreview.js prefs.js utils.js Settings.ui
|
||||
EXTRA_MODULES = appIcons.js convenience.js panel.js panelManager.js proximity.js intellihide.js panelStyle.js overview.js taskbar.js transparency.js windowPreview.js prefs.js utils.js Settings.ui
|
||||
EXTRA_IMAGES = highlight_stacked_bg.svg
|
||||
TOLOCALIZE = prefs.js appIcons.js
|
||||
MSGSRC = $(wildcard po/*.po)
|
||||
|
||||
510
Settings.ui
510
Settings.ui
@@ -1674,7 +1674,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">Require pressure at the edge of the screen to reveal the panel</property>
|
||||
<property name="label" translatable="yes">Require pressure at the edge of the screen to reveal the panel</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
@@ -2984,6 +2984,188 @@
|
||||
<property name="step_increment">0.01</property>
|
||||
<property name="page_increment">0.10000000000000001</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="trans_anim_time_adjustment">
|
||||
<property name="upper">2000</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="trans_distance_adjustment">
|
||||
<property name="upper">200</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="trans_opacity_adjustment">
|
||||
<property name="upper">1</property>
|
||||
<property name="step_increment">0.01</property>
|
||||
<property name="page_increment">0.10000000000000001</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="trans_opacity_min_adjustment">
|
||||
<property name="upper">1</property>
|
||||
<property name="step_increment">0.01</property>
|
||||
<property name="page_increment">0.10000000000000001</property>
|
||||
</object>
|
||||
<object class="GtkBox" id="box_dynamic_opacity_options">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkListBox" id="trans_options_listbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="selection_mode">none</property>
|
||||
<child>
|
||||
<object class="GtkListBoxRow" id="listbox_trans_options_distance">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid_trans_options_distance">
|
||||
<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">12</property>
|
||||
<property name="margin_bottom">12</property>
|
||||
<property name="column_spacing">32</property>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="trans_options_distance_spinbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="width_chars">4</property>
|
||||
<property name="text">50</property>
|
||||
<property name="adjustment">trans_distance_adjustment</property>
|
||||
<property name="numeric">True</property>
|
||||
<property name="value">50</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="trans_options_distance_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">Change panel opacity when a window gets closer than (px)</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkListBoxRow" id="listboxrow_trans_options_min_opacity">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="trans_options_min_opacity_box">
|
||||
<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">12</property>
|
||||
<property name="margin_bottom">12</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="trans_options_min_opacity_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_right">12</property>
|
||||
<property name="label" translatable="yes">Change opacity to</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScale" id="trans_options_min_opacity_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">trans_opacity_min_adjustment</property>
|
||||
<property name="lower_stepper_sensitivity">on</property>
|
||||
<property name="restrict_to_fill_level">False</property>
|
||||
<property name="fill_level">0</property>
|
||||
<property name="round_digits">2</property>
|
||||
<property name="digits">2</property>
|
||||
<property name="value_pos">right</property>
|
||||
<signal name="format-value" handler="trans_opacity_min_scale_format_value_cb" swapped="no"/>
|
||||
<signal name="value-changed" handler="trans_opacity_min_scale_value_changed_cb" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkListBoxRow" id="listbox_trans_options_anim_time">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid_trans_options_anim_time">
|
||||
<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">12</property>
|
||||
<property name="margin_bottom">12</property>
|
||||
<property name="column_spacing">32</property>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="trans_options_anim_time_spinbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="width_chars">4</property>
|
||||
<property name="text">50</property>
|
||||
<property name="adjustment">trans_anim_time_adjustment</property>
|
||||
<property name="numeric">True</property>
|
||||
<property name="value">50</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="trans_options_anim_time_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">Opacity change animation duration (ms)</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</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>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="tray_padding_adjustment">
|
||||
<property name="lower">0.33000000000000002</property>
|
||||
<property name="upper">1</property>
|
||||
@@ -3957,10 +4139,334 @@
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<child>
|
||||
<object class="GtkListBox" id="dynamic_trans_box">
|
||||
<object class="GtkListBox" id="dynamic_trans_listbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="selection_mode">none</property>
|
||||
<child>
|
||||
<object class="GtkListBoxRow" id="trans_bg_row">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="trans_bg_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">12</property>
|
||||
<property name="margin_bottom">12</property>
|
||||
<property name="column_spacing">32</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="trans_bg_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">Override theme background color </property>
|
||||
<property name="use_markup">True</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="trans_bg_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkColorButton" id="trans_bg_color_colorbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="halign">end</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="trans_bg_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>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="height">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="trans_bg_description">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">Define a custom background color for the panel</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="max_width_chars">40</property>
|
||||
<property name="xalign">0</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkListBoxRow" id="listbox_preview_show_title1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="trans_opacity_main_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="trans_opacity_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">12</property>
|
||||
<property name="margin_bottom">12</property>
|
||||
<property name="column_spacing">32</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="trans_opacity_override_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">Override theme opacity</property>
|
||||
<property name="use_markup">True</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="GtkSwitch" id="trans_opacity_override_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="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="height">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="trans_opacity_override_description">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">Define custom opacity options for the panel </property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="max_width_chars">40</property>
|
||||
<property name="xalign">0</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</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="trans_opacity_box">
|
||||
<property name="name">trans_custom_opacity_box</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="trans_opacity_select_box">
|
||||
<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">12</property>
|
||||
<property name="margin_bottom">12</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="trans_opacity_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_right">12</property>
|
||||
<property name="label" translatable="yes">Panel opacity</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScale" id="trans_opacity_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">trans_opacity_adjustment</property>
|
||||
<property name="lower_stepper_sensitivity">on</property>
|
||||
<property name="restrict_to_fill_level">False</property>
|
||||
<property name="fill_level">0</property>
|
||||
<property name="round_digits">0</property>
|
||||
<property name="digits">2</property>
|
||||
<property name="value_pos">right</property>
|
||||
<signal name="format-value" handler="trans_opacity_scale_format_value_cb" swapped="no"/>
|
||||
<signal name="value-changed" handler="trans_opacity_scale_value_changed_cb" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid" id="trans_dyn_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">12</property>
|
||||
<property name="margin_bottom">12</property>
|
||||
<property name="column_spacing">32</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="trans_dyn_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">Dynamic opacity</property>
|
||||
<property name="use_markup">True</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="trans_dyn_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="trans_dyn_options_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="xalign">0.46000000834465027</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="image_trans_dyn_options">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">emblem-system-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
<style>
|
||||
<class name="circular"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="trans_dyn_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>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="height">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="trans_dyn_description">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">Change opacity when a window gets close to the panel</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="max_width_chars">40</property>
|
||||
<property name="xalign">0</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label_item">
|
||||
|
||||
@@ -84,7 +84,7 @@ var Intellihide = new Lang.Class({
|
||||
this._proximityWatchId = this._proximityManager.createWatch(
|
||||
this._panelBox,
|
||||
Proximity.Mode[this._dtpSettings.get_string('intellihide-behaviour')],
|
||||
0,
|
||||
0, 0,
|
||||
overlap => {
|
||||
this._windowOverlap = overlap;
|
||||
this._queueUpdatePanelPosition();
|
||||
|
||||
94
panel.js
94
panel.js
@@ -52,6 +52,7 @@ const ViewSelector = imports.ui.viewSelector;
|
||||
const DateMenu = imports.ui.dateMenu;
|
||||
|
||||
const Intellihide = Me.imports.intellihide;
|
||||
const Transparency = Me.imports.transparency;
|
||||
|
||||
let tracker = Shell.WindowTracker.get_default();
|
||||
|
||||
@@ -165,6 +166,8 @@ var dtpPanelWrapper = new Lang.Class({
|
||||
this.intellihide = new Intellihide.Intellihide(this);
|
||||
});
|
||||
|
||||
this.dynamicTransparency = new Transparency.DynamicTransparency(this);
|
||||
|
||||
this._signalsHandler = new Utils.GlobalSignalsHandler();
|
||||
this._signalsHandler.add(
|
||||
// Keep dragged icon consistent in size with this dash
|
||||
@@ -197,8 +200,6 @@ var dtpPanelWrapper = new Lang.Class({
|
||||
Main.overview,
|
||||
'hidden',
|
||||
() => {
|
||||
this.panel._updateSolidStyle ? this.panel._updateSolidStyle() : null;
|
||||
|
||||
if (this._myPanelGhost.get_parent()) {
|
||||
Main.overview._overview.remove_actor(this._myPanelGhost);
|
||||
}
|
||||
@@ -255,15 +256,11 @@ var dtpPanelWrapper = new Lang.Class({
|
||||
// Dynamic transparency is available on Gnome 3.26
|
||||
if (this.panel._updateSolidStyle) {
|
||||
this._injectionsHandler = new Utils.InjectionsHandler();
|
||||
this.panel._dtpPosition = this._dtpSettings.get_string('panel-position');
|
||||
this.panel._dtpRemoveSolidStyleId = 0;
|
||||
this._injectionsHandler.addWithLabel('transparency', [
|
||||
this.panel,
|
||||
'_updateSolidStyle',
|
||||
Lang.bind(this.panel, this._dtpUpdateSolidStyle)
|
||||
() => {}
|
||||
]);
|
||||
|
||||
this.panel._updateSolidStyle();
|
||||
}
|
||||
},
|
||||
|
||||
@@ -290,6 +287,8 @@ var dtpPanelWrapper = new Lang.Class({
|
||||
this.intellihide.destroy();
|
||||
}
|
||||
|
||||
this.dynamicTransparency.destroy();
|
||||
|
||||
// reset stored icon size to the default dash
|
||||
Main.overview.dashIconSize = Main.overview._controls.dash.iconSize;
|
||||
|
||||
@@ -316,9 +315,6 @@ var dtpPanelWrapper = new Lang.Class({
|
||||
|
||||
this._injectionsHandler.removeWithLabel('transparency');
|
||||
this._injectionsHandler.destroy();
|
||||
|
||||
delete this.panel._dtpPosition;
|
||||
delete this.panel._dtpRemoveSolidStyleId;
|
||||
}
|
||||
|
||||
if (!this.isSecondary) {
|
||||
@@ -677,50 +673,50 @@ var dtpPanelWrapper = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_dtpUpdateSolidStyle: function() {
|
||||
let removeSolidStyle = function(solid) {
|
||||
this._dtpRemoveSolidStyleId = Mainloop.timeout_add(0, () => {
|
||||
this._dtpRemoveSolidStyleId = 0;
|
||||
this._removeStyleClassName('solid');
|
||||
});
|
||||
};
|
||||
// _dtpUpdateSolidStyle: function() {
|
||||
// let removeSolidStyle = function(solid) {
|
||||
// this._dtpRemoveSolidStyleId = Mainloop.timeout_add(0, () => {
|
||||
// this._dtpRemoveSolidStyleId = 0;
|
||||
// this._removeStyleClassName('solid');
|
||||
// });
|
||||
// };
|
||||
|
||||
if (this.actor.has_style_pseudo_class('overview') || !Main.sessionMode.hasWindows) {
|
||||
removeSolidStyle.call(this);
|
||||
return;
|
||||
}
|
||||
// if (this.actor.has_style_pseudo_class('overview') || !Main.sessionMode.hasWindows) {
|
||||
// removeSolidStyle.call(this);
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (!Main.layoutManager.primaryMonitor)
|
||||
return;
|
||||
// if (!Main.layoutManager.primaryMonitor)
|
||||
// return;
|
||||
|
||||
/* Get all the windows in the active workspace that are in the primary monitor and visible */
|
||||
let activeWorkspace = Utils.DisplayWrapper.getWorkspaceManager().get_active_workspace();
|
||||
let windows = activeWorkspace.list_windows().filter(function(metaWindow) {
|
||||
return metaWindow.is_on_primary_monitor() &&
|
||||
metaWindow.showing_on_its_workspace() &&
|
||||
metaWindow.get_window_type() != Meta.WindowType.DESKTOP;
|
||||
});
|
||||
// /* Get all the windows in the active workspace that are in the primary monitor and visible */
|
||||
// let activeWorkspace = Utils.DisplayWrapper.getWorkspaceManager().get_active_workspace();
|
||||
// let windows = activeWorkspace.list_windows().filter(function(metaWindow) {
|
||||
// return metaWindow.is_on_primary_monitor() &&
|
||||
// metaWindow.showing_on_its_workspace() &&
|
||||
// metaWindow.get_window_type() != Meta.WindowType.DESKTOP;
|
||||
// });
|
||||
|
||||
/* Check if at least one window is near enough to the panel */
|
||||
let [, panelTop] = this.actor.get_transformed_position();
|
||||
let panelBottom = panelTop + this.actor.get_height();
|
||||
let scale = St.ThemeContext.get_for_stage(global.stage).scale_factor;
|
||||
let isNearEnough = windows.some(Lang.bind(this, function(metaWindow) {
|
||||
if (this.hasOwnProperty('_dtpPosition') && this._dtpPosition === 'TOP') {
|
||||
let verticalPosition = metaWindow.get_frame_rect().y;
|
||||
return verticalPosition < panelBottom + 5 * scale;
|
||||
} else {
|
||||
let verticalPosition = metaWindow.get_frame_rect().y + metaWindow.get_frame_rect().height;
|
||||
return verticalPosition > panelTop - 5 * scale;
|
||||
}
|
||||
}));
|
||||
// /* Check if at least one window is near enough to the panel */
|
||||
// let [, panelTop] = this.actor.get_transformed_position();
|
||||
// let panelBottom = panelTop + this.actor.get_height();
|
||||
// let scale = St.ThemeContext.get_for_stage(global.stage).scale_factor;
|
||||
// let isNearEnough = windows.some(Lang.bind(this, function(metaWindow) {
|
||||
// if (this.hasOwnProperty('_dtpPosition') && this._dtpPosition === 'TOP') {
|
||||
// let verticalPosition = metaWindow.get_frame_rect().y;
|
||||
// return verticalPosition < panelBottom + 5 * scale;
|
||||
// } else {
|
||||
// let verticalPosition = metaWindow.get_frame_rect().y + metaWindow.get_frame_rect().height;
|
||||
// return verticalPosition > panelTop - 5 * scale;
|
||||
// }
|
||||
// }));
|
||||
|
||||
if (isNearEnough) {
|
||||
this._addStyleClassName('solid');
|
||||
} else {
|
||||
removeSolidStyle.call(this);
|
||||
}
|
||||
}
|
||||
// if (isNearEnough) {
|
||||
// this._addStyleClassName('solid');
|
||||
// } else {
|
||||
// removeSolidStyle.call(this);
|
||||
// }
|
||||
// }
|
||||
});
|
||||
|
||||
|
||||
|
||||
131
prefs.js
131
prefs.js
@@ -167,6 +167,7 @@ const Settings = new Lang.Class({
|
||||
this._leftbox_size_timeout = 0;
|
||||
this._appicon_margin_timeout = 0;
|
||||
this._appicon_padding_timeout = 0;
|
||||
this._opacity_timeout = 0;
|
||||
this._tray_padding_timeout = 0;
|
||||
this._statusicon_padding_timeout = 0;
|
||||
this._leftbox_padding_timeout = 0;
|
||||
@@ -486,6 +487,104 @@ const Settings = new Lang.Class({
|
||||
dialog.show_all();
|
||||
}));
|
||||
|
||||
//dynamic opacity
|
||||
this._settings.bind('trans-use-custom-bg',
|
||||
this._builder.get_object('trans_bg_switch'),
|
||||
'active',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
|
||||
this._settings.bind('trans-use-custom-bg',
|
||||
this._builder.get_object('trans_bg_color_colorbutton'),
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
|
||||
let rgba = new Gdk.RGBA();
|
||||
rgba.parse(this._settings.get_string('trans-bg-color'));
|
||||
this._builder.get_object('trans_bg_color_colorbutton').set_rgba(rgba);
|
||||
|
||||
this._builder.get_object('trans_bg_color_colorbutton').connect('notify::color', Lang.bind(this, function (button) {
|
||||
let rgba = button.get_rgba();
|
||||
let css = rgba.to_string();
|
||||
let hexString = cssHexString(css);
|
||||
this._settings.set_string('trans-bg-color', hexString);
|
||||
}));
|
||||
|
||||
this._settings.bind('trans-use-custom-opacity',
|
||||
this._builder.get_object('trans_opacity_override_switch'),
|
||||
'active',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
|
||||
this._settings.bind('trans-use-custom-opacity',
|
||||
this._builder.get_object('trans_opacity_box'),
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
|
||||
this._builder.get_object('trans_opacity_override_switch').connect('notify::active', (widget) => {
|
||||
if (!widget.get_active())
|
||||
this._builder.get_object('trans_dyn_switch').set_active(false);
|
||||
});
|
||||
|
||||
this._builder.get_object('trans_opacity_scale').set_value(this._settings.get_double('trans-panel-opacity'));
|
||||
|
||||
this._settings.bind('trans-use-dynamic-opacity',
|
||||
this._builder.get_object('trans_dyn_switch'),
|
||||
'active',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
|
||||
this._settings.bind('trans-use-dynamic-opacity',
|
||||
this._builder.get_object('trans_dyn_options_button'),
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
|
||||
this._builder.get_object('trans_options_distance_spinbutton').set_value(this._settings.get_int('trans-dynamic-distance'));
|
||||
this._builder.get_object('trans_options_distance_spinbutton').connect('value-changed', Lang.bind(this, function (widget) {
|
||||
this._settings.set_int('trans-dynamic-distance', widget.get_value());
|
||||
}));
|
||||
|
||||
this._builder.get_object('trans_options_min_opacity_scale').set_value(this._settings.get_double('trans-dynamic-anim-target'));
|
||||
|
||||
this._builder.get_object('trans_options_anim_time_spinbutton').set_value(this._settings.get_int('trans-dynamic-anim-time'));
|
||||
this._builder.get_object('trans_options_anim_time_spinbutton').connect('value-changed', Lang.bind(this, function (widget) {
|
||||
this._settings.set_int('trans-dynamic-anim-time', widget.get_value());
|
||||
}));
|
||||
|
||||
this._builder.get_object('trans_dyn_options_button').connect('clicked', Lang.bind(this, function() {
|
||||
let dialog = new Gtk.Dialog({ title: _('Dynamic opacity options'),
|
||||
transient_for: this.widget.get_toplevel(),
|
||||
use_header_bar: true,
|
||||
modal: true });
|
||||
|
||||
// GTK+ leaves positive values for application-defined response ids.
|
||||
// Use +1 for the reset action
|
||||
dialog.add_button(_('Reset to defaults'), 1);
|
||||
|
||||
let box = this._builder.get_object('box_dynamic_opacity_options');
|
||||
dialog.get_content_area().add(box);
|
||||
|
||||
dialog.connect('response', Lang.bind(this, function(dialog, id) {
|
||||
if (id == 1) {
|
||||
// restore default settings
|
||||
this._settings.set_value('trans-dynamic-distance', this._settings.get_default_value('trans-dynamic-distance'));
|
||||
this._builder.get_object('trans_options_distance_spinbutton').set_value(this._settings.get_int('trans-dynamic-distance'));
|
||||
|
||||
this._settings.set_value('trans-dynamic-anim-target', this._settings.get_default_value('trans-dynamic-anim-target'));
|
||||
this._builder.get_object('trans_options_min_opacity_scale').set_value(this._settings.get_double('trans-dynamic-anim-target'));
|
||||
|
||||
this._settings.set_value('trans-dynamic-anim-time', this._settings.get_default_value('trans-dynamic-anim-time'));
|
||||
this._builder.get_object('trans_options_anim_time_spinbutton').set_value(this._settings.get_int('trans-dynamic-anim-time'));
|
||||
} else {
|
||||
// remove the settings box so it doesn't get destroyed;
|
||||
dialog.get_content_area().remove(box);
|
||||
dialog.destroy();
|
||||
}
|
||||
return;
|
||||
}));
|
||||
|
||||
dialog.show_all();
|
||||
|
||||
}));
|
||||
|
||||
|
||||
this._settings.bind('intellihide',
|
||||
this._builder.get_object('intellihide_switch'),
|
||||
'active',
|
||||
@@ -1329,6 +1428,38 @@ const Settings = new Lang.Class({
|
||||
}));
|
||||
},
|
||||
|
||||
trans_opacity_scale_format_value_cb: function(scale, value) {
|
||||
return Math.round(value * 100) + ' %';
|
||||
},
|
||||
|
||||
trans_opacity_scale_value_changed_cb: function(scale) {
|
||||
// Avoid settings the opacity consinuosly
|
||||
if (this._opacity_timeout > 0)
|
||||
Mainloop.source_remove(this._opacity_timeout);
|
||||
|
||||
this._opacity_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this, function() {
|
||||
this._settings.set_double('trans-panel-opacity', scale.get_value());
|
||||
this._opacity_timeout = 0;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
},
|
||||
|
||||
trans_opacity_min_scale_format_value_cb: function(scale, value) {
|
||||
return Math.round(value * 100) + ' %';
|
||||
},
|
||||
|
||||
trans_opacity_min_scale_value_changed_cb: function(scale) {
|
||||
// Avoid settings the opacity consinuosly
|
||||
if (this._opacity_timeout > 0)
|
||||
Mainloop.source_remove(this._opacity_timeout);
|
||||
|
||||
this._opacity_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this, function() {
|
||||
this._settings.set_double('trans-dynamic-anim-target', scale.get_value());
|
||||
this._opacity_timeout = 0;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
},
|
||||
|
||||
tray_padding_scale_format_value_cb: function(scale, value) {
|
||||
return value+ ' px';
|
||||
},
|
||||
|
||||
16
proximity.js
16
proximity.js
@@ -39,10 +39,10 @@ var Mode = {
|
||||
var ProximityWatch = new Lang.Class({
|
||||
Name: 'DashToPanel.ProximityWatch',
|
||||
|
||||
_init: function(actor, mode, threshold, handler) {
|
||||
_init: function(actor, mode, xThreshold, yThreshold, handler) {
|
||||
this.actor = actor;
|
||||
this.mode = mode;
|
||||
this.threshold = threshold;
|
||||
this.threshold = [xThreshold, yThreshold];
|
||||
this.handler = handler;
|
||||
|
||||
this._allocationChangedId = actor.connect('allocation-changed', () => this._update());
|
||||
@@ -64,10 +64,10 @@ var ProximityWatch = new Lang.Class({
|
||||
let [actorX, actorY] = this.actor.get_position();
|
||||
|
||||
this.rect = new Meta.Rectangle({
|
||||
x: actorX - this.threshold,
|
||||
y: actorY - this.threshold,
|
||||
width: this.actor.width + this.threshold * 2,
|
||||
height: this.actor.height + this.threshold * 2
|
||||
x: actorX - this.threshold[0],
|
||||
y: actorY - this.threshold[1],
|
||||
width: this.actor.width + this.threshold[0] * 2,
|
||||
height: this.actor.height + this.threshold[1] * 2
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -87,8 +87,8 @@ var ProximityManager = new Lang.Class({
|
||||
this._setFocusedWindow();
|
||||
},
|
||||
|
||||
createWatch: function(actor, mode, threshold, handler) {
|
||||
let watch = new ProximityWatch(actor, mode, threshold, handler);
|
||||
createWatch: function(actor, mode, xThreshold, yThreshold, handler) {
|
||||
let watch = new ProximityWatch(actor, mode, xThreshold, yThreshold, handler);
|
||||
|
||||
this._watches[this._counter] = watch;
|
||||
this.update();
|
||||
|
||||
@@ -169,6 +169,46 @@
|
||||
<summary>Position of the taskbar</summary>
|
||||
<description>Set the position of the taskbar on the panel</description>
|
||||
</key>
|
||||
<key type="b" name="trans-use-custom-bg">
|
||||
<default>false</default>
|
||||
<summary>Override theme background color</summary>
|
||||
<description>Replace current theme background color for the panel</description>
|
||||
</key>
|
||||
<key type="s" name="trans-bg-color">
|
||||
<default>"#000"</default>
|
||||
<summary>Custom background color</summary>
|
||||
<description>Custom background color for the panel</description>
|
||||
</key>
|
||||
<key type="b" name="trans-use-custom-opacity">
|
||||
<default>false</default>
|
||||
<summary>Custom background color</summary>
|
||||
<description>Replace current theme background color for the panel</description>
|
||||
</key>
|
||||
<key type="b" name="trans-use-dynamic-opacity">
|
||||
<default>false</default>
|
||||
<summary>Dynamic opacity</summary>
|
||||
<description>Enable dynamic opacity</description>
|
||||
</key>
|
||||
<key type="d" name="trans-panel-opacity">
|
||||
<default>0.4</default>
|
||||
<summary>Panel opacity</summary>
|
||||
<description>Custom opacity for the panel</description>
|
||||
</key>
|
||||
<key type="i" name="trans-dynamic-distance">
|
||||
<default>20</default>
|
||||
<summary>Distance to change opacity</summary>
|
||||
<description>The distance a window needs to be from the panel to change opacity</description>
|
||||
</key>
|
||||
<key type="d" name="trans-dynamic-anim-target">
|
||||
<default>0.8</default>
|
||||
<summary>Modified panel opacity</summary>
|
||||
<description>Modified opacity for the panel when a window is near</description>
|
||||
</key>
|
||||
<key type="i" name="trans-dynamic-anim-time">
|
||||
<default>300</default>
|
||||
<summary>Opacity change duration</summary>
|
||||
<description>The duration of the animation when the opacity changes</description>
|
||||
</key>
|
||||
<key type="b" name="intellihide">
|
||||
<default>false</default>
|
||||
<summary>Intellihide</summary>
|
||||
|
||||
198
transparency.js
Normal file
198
transparency.js
Normal file
@@ -0,0 +1,198 @@
|
||||
/*
|
||||
* 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 Clutter = imports.gi.Clutter;
|
||||
const GdkPixbuf = imports.gi.GdkPixbuf;
|
||||
const Lang = imports.lang;
|
||||
const Main = imports.ui.main;
|
||||
const Meta = imports.gi.Meta;
|
||||
const St = imports.gi.St;
|
||||
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
const Proximity = Me.imports.proximity;
|
||||
const Utils = Me.imports.utils;
|
||||
|
||||
var DynamicTransparency = new Lang.Class({
|
||||
Name: 'DashToPanel.DynamicTransparency',
|
||||
|
||||
_init: function(dtpPanel) {
|
||||
this._dtpPanel = dtpPanel;
|
||||
this._dtpSettings = dtpPanel._dtpSettings;
|
||||
this._proximityManager = dtpPanel.panelManager.proximityManager;
|
||||
this._proximityWatchId = 0;
|
||||
this._initialPanelStyle = dtpPanel.panel.actor.get_style();
|
||||
this._windowOverlap = false;
|
||||
|
||||
this._signalsHandler = new Utils.GlobalSignalsHandler();
|
||||
this._bindSignals();
|
||||
|
||||
this._updateAnimationDuration();
|
||||
this._updateAllAndSet();
|
||||
this._updateProximityWatch();
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
this._signalsHandler.destroy();
|
||||
this._proximityManager.removeWatch(this._proximityWatchId);
|
||||
this._dtpPanel.panel.actor.set_style(this._initialPanelStyle);
|
||||
},
|
||||
|
||||
_bindSignals: function() {
|
||||
this._signalsHandler.add(
|
||||
[
|
||||
St.ThemeContext.get_for_stage(global.stage),
|
||||
'changed',
|
||||
() => this._updateAllAndSet()
|
||||
],
|
||||
[
|
||||
Main.overview,
|
||||
[
|
||||
'showing',
|
||||
'hiding'
|
||||
],
|
||||
() => this._updateAlphaAndSet()
|
||||
],
|
||||
[
|
||||
this._dtpSettings,
|
||||
[
|
||||
'changed::trans-use-custom-bg',
|
||||
'changed::trans-bg-color'
|
||||
],
|
||||
() => this._updateColorAndSet()
|
||||
],
|
||||
[
|
||||
this._dtpSettings,
|
||||
[
|
||||
'changed::trans-use-custom-opacity',
|
||||
'changed::trans-panel-opacity',
|
||||
'changed::trans-bg-color',
|
||||
'changed::trans-dynamic-anim-target',
|
||||
'changed::trans-use-dynamic-opacity',
|
||||
],
|
||||
() => this._updateAlphaAndSet()
|
||||
],
|
||||
[
|
||||
this._dtpSettings,
|
||||
[
|
||||
'changed::trans-use-dynamic-opacity',
|
||||
'changed::trans-dynamic-distance'
|
||||
],
|
||||
() => this._updateProximityWatch()
|
||||
],
|
||||
[
|
||||
this._dtpSettings,
|
||||
'changed::trans-dynamic-anim-time',
|
||||
() => this._updateAnimationDuration()
|
||||
]
|
||||
);
|
||||
},
|
||||
|
||||
_updateProximityWatch: function() {
|
||||
this._proximityManager.removeWatch(this._proximityWatchId);
|
||||
|
||||
if (this._dtpSettings.get_boolean('trans-use-dynamic-opacity')) {
|
||||
this._proximityWatchId = this._proximityManager.createWatch(
|
||||
this._dtpPanel.panelBox,
|
||||
Proximity.Mode.ALL_WINDOWS,
|
||||
0, this._dtpSettings.get_int('trans-dynamic-distance'),
|
||||
overlap => {
|
||||
this._windowOverlap = overlap;
|
||||
this._updateAlphaAndSet();
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
_updateAnimationDuration: function() {
|
||||
this._animationDuration = this._dtpSettings.get_int('trans-dynamic-anim-time') * 0.001;
|
||||
},
|
||||
|
||||
_updateAllAndSet: function() {
|
||||
let themeBackground = this._getThemeBackground(true);
|
||||
|
||||
this._updateColor(themeBackground);
|
||||
this._updateAlpha(themeBackground);
|
||||
this._setBackground();
|
||||
},
|
||||
|
||||
_updateColorAndSet: function() {
|
||||
this._updateColor();
|
||||
this._setBackground();
|
||||
},
|
||||
|
||||
_updateAlphaAndSet: function() {
|
||||
this._updateAlpha();
|
||||
this._setBackground();
|
||||
},
|
||||
|
||||
_updateColor: function(themeBackground) {
|
||||
this._backgroundColor = this._dtpSettings.get_boolean('trans-use-custom-bg') ?
|
||||
Clutter.color_from_string(this._dtpSettings.get_string('trans-bg-color'))[1] :
|
||||
(themeBackground || this._getThemeBackground());
|
||||
},
|
||||
|
||||
_updateAlpha: function(themeBackground) {
|
||||
if (this._windowOverlap && !Main.overview.visibleTarget && this._dtpSettings.get_boolean('trans-use-dynamic-opacity')) {
|
||||
this._alpha = this._dtpSettings.get_double('trans-dynamic-anim-target');
|
||||
} else {
|
||||
this._alpha = this._dtpSettings.get_boolean('trans-use-custom-opacity') ?
|
||||
this._dtpSettings.get_double('trans-panel-opacity') :
|
||||
(themeBackground || this._getThemeBackground()).alpha * 0.003921569; // 1 / 255 = 0.003921569
|
||||
}
|
||||
},
|
||||
|
||||
_setBackground: function() {
|
||||
this._dtpPanel.panel.actor.set_style(
|
||||
'background-color: rgba(' +
|
||||
this._backgroundColor.red + ',' +
|
||||
this._backgroundColor.green + ',' +
|
||||
this._backgroundColor.blue + ',' +
|
||||
this._alpha + '); ' +
|
||||
'border-image: none; background-image: none; ' +
|
||||
'transition-duration:' + this._animationDuration + 's'
|
||||
);
|
||||
},
|
||||
|
||||
_getThemeBackground: function(reload) {
|
||||
if (reload || !this._themeBackground) {
|
||||
let fakePanel = new St.Bin({ name: 'panel' });
|
||||
Main.uiGroup.add_child(fakePanel);
|
||||
let fakeTheme = fakePanel.get_theme_node()
|
||||
this._themeBackground = this._getBackgroundImageColor(fakeTheme) || fakeTheme.get_background_color();
|
||||
Main.uiGroup.remove_child(fakePanel);
|
||||
}
|
||||
|
||||
return this._themeBackground;
|
||||
},
|
||||
|
||||
_getBackgroundImageColor: function(theme) {
|
||||
let bg = null;
|
||||
|
||||
try {
|
||||
let imageFile = theme.get_background_image() || theme.get_border_image().get_file();
|
||||
|
||||
if (imageFile) {
|
||||
let imageBuf = GdkPixbuf.Pixbuf.new_from_file(imageFile.get_path());
|
||||
let pixels = imageBuf.get_pixels();
|
||||
|
||||
bg = { red: pixels[0], green: pixels[1], blue: pixels[2], alpha: pixels[3] };
|
||||
}
|
||||
} catch (error) {}
|
||||
|
||||
return bg;
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user