diff --git a/Settings.ui b/Settings.ui index d2f1a41..f777454 100644 --- a/Settings.ui +++ b/Settings.ui @@ -17,6 +17,16 @@ 0.01 0.10000000000000001 + + 1 + 0.01 + 0.10000000000000001 + + + 1 + 0.01 + 0.10000000000000001 + 0.33000000000000002 1 @@ -746,6 +756,190 @@ + + True + False + 12 + 12 + 12 + 12 + vertical + + + True + False + 0 + in + + + True + False + none + + + 100 + 80 + True + True + + + True + False + 12 + 12 + 12 + 12 + vertical + 12 + + + True + False + 32 + + + True + True + + + 1 + 0 + + + + + True + False + True + Customize minimum and maximum opacity values + fill + 0 + + + 0 + 0 + + + + + False + True + 0 + + + + + True + False + 12 + 12 + 12 + 12 + 32 + + + True + False + Minimum opacity + + + False + True + 0 + + + + + True + True + min_opacity_adjustement + on + False + 0 + 0 + 2 + right + + + + + True + True + 1 + + + + + False + True + 1 + + + + + True + False + 12 + 12 + 12 + 12 + 32 + + + True + False + Maximum opacity + + + False + True + 0 + + + + + True + True + max_opacity_adjustement + on + False + 0 + 0 + 2 + right + + + + + True + True + 1 + + + + + False + True + 1 + + + + + + + + + + + + + + False + True + 0 + + + 1 0.050000000000000003 @@ -2264,19 +2458,6 @@ 12 12 32 - - - True - True - end - center - - - 1 - 0 - 2 - - True @@ -2306,6 +2487,58 @@ 0 + + + True + False + 6 + + + True + True + True + center + center + + + True + False + emblem-system-symbolic + + + + + + False + True + 0 + + + + + True + False + center + + Default + Fixed + Adaptive + Dynamic + + + + 1 + 0 + 2 + + + + + 2 + + False diff --git a/appIcons.js b/appIcons.js index 29285b1..d412ebe 100644 --- a/appIcons.js +++ b/appIcons.js @@ -71,7 +71,7 @@ let recentlyClickedAppMonitor = -1; * - Update minimization animation target * - Update menu if open on windows change */ -const MyAppIcon = new Lang.Class({ +var MyAppIcon = new Lang.Class({ Name: 'DashToDock.AppIcon', Extends: AppDisplay.AppIcon, diff --git a/dash.js b/dash.js index 593185a..7da8d4f 100644 --- a/dash.js +++ b/dash.js @@ -175,7 +175,7 @@ const baseIconSizes = [16, 22, 24, 32, 48, 64, 96, 128]; * - sync minimization application target position. * - keep running apps ordered. */ -const MyDash = new Lang.Class({ +var MyDash = new Lang.Class({ Name: 'DashToDock.MyDash', _init: function(settings, monitorIndex) { diff --git a/debian/changelog b/debian/changelog index 088b6e9..ee6b952 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,27 @@ +gnome-shell-extension-ubuntu-dock (0.5) UNRELEASED; urgency=medium + + * Cherry-pick dynamic and adaptive transparency feature to look and behave + better with GNOME Shell 3.26. We only enable adaptive transparency. + (LP: #1717509). + * Rationalize some keyboard and key + mouse shortcuts: + - Click is focus or showing up window previews. Same than Super + number + (was already the default) + - Shift + click launch a new instance. Same than Super + Shift + number + - Middle click cycles launch a new instance as well. This is to be + consistent when middle clicking a link in a web browser opening a new + tab. + - Shift + middle click minimize the last focused window from the selected + application. + * Cherry-pick some fixes from dash to dock branch (without taking the other + new features): + - Hotkeys: remove keypad hotkeys + - Define externally accessible classes and constants with 'var' + * Fix uninitialized value for dock disabled by default + (LP: #1712698, #1714219) + * updated translations + + -- Didier Roche Fri, 15 Sep 2017 14:29:42 +0200 + gnome-shell-extension-ubuntu-dock (0.4) artful; urgency=medium * Switch click-action to previews multiple window instances by default. diff --git a/docking.js b/docking.js index 32822c9..af7f597 100644 --- a/docking.js +++ b/docking.js @@ -350,7 +350,7 @@ const DockedDash = new Lang.Class({ ]); this._injectionsHandler = new Utils.InjectionsHandler(); - this._themeManager = new Theming.ThemeManager(this._settings, this.actor, this.dash); + this._themeManager = new Theming.ThemeManager(this._settings, this); // Since the actor is not a topLevel child and its parent is now not added to the Chrome, // the allocation change of the parent container (slide in and slideout) doesn't trigger @@ -696,6 +696,10 @@ const DockedDash = new Lang.Class({ } }, + getDockState: function() { + return this._dockState; + }, + _show: function() { if ((this._dockState == State.HIDDEN) || (this._dockState == State.HIDING)) { if (this._dockState == State.HIDING) @@ -1409,8 +1413,7 @@ const KeyboardShortcuts = new Lang.Class({ return; // Setup keyboard bindings for dash elements - let keys = ['app-hotkey-', 'app-shift-hotkey-', 'app-ctrl-hotkey-', // Regular numbers - 'app-hotkey-kp-', 'app-shift-hotkey-kp-', 'app-ctrl-hotkey-kp-']; // Key-pad numbers + let keys = ['app-hotkey-', 'app-shift-hotkey-', 'app-ctrl-hotkey-']; keys.forEach( function(key) { for (let i = 0; i < this._numHotkeys; i++) { let appNum = i; @@ -1431,8 +1434,7 @@ const KeyboardShortcuts = new Lang.Class({ if (!this._hotKeysEnabled) return; - let keys = ['app-hotkey-', 'app-shift-hotkey-', 'app-ctrl-hotkey-', // Regular numbers - 'app-hotkey-kp-', 'app-shift-hotkey-kp-', 'app-ctrl-hotkey-kp-']; // Key-pad numbers + let keys = ['app-hotkey-', 'app-shift-hotkey-', 'app-ctrl-hotkey-']; keys.forEach( function(key) { for (let i = 0; i < this._numHotkeys; i++) Main.wm.removeKeybinding(key + (i + 1)); @@ -1634,7 +1636,7 @@ const WorkspaceIsolation = new Lang.Class({ }); -const DockManager = new Lang.Class({ +var DockManager = new Lang.Class({ Name: 'DashToDock.DockManager', _init: function() { diff --git a/extension.js b/extension.js index 92493d8..771513a 100644 --- a/extension.js +++ b/extension.js @@ -20,6 +20,7 @@ function enable() { * Listen to enabled extension, if Dash to Dock is on the list or become active, * we disable this dock. */ + dockManager=null; // even if declared, we need to initialize it to not trigger a referenceError. _enabledextensionsettings = new Gio.Settings({ schema_id: 'org.gnome.shell' }); _extensionlistenerId = _enabledextensionsettings.connect( 'changed::enabled-extensions', diff --git a/intellihide.js b/intellihide.js index 0d9fabd..1fd2699 100644 --- a/intellihide.js +++ b/intellihide.js @@ -45,7 +45,7 @@ const handledWindowTypes = [ * Intallihide object: emit 'status-changed' signal when the overlap of windows * with the provided targetBoxClutter.ActorBox changes; */ -const Intellihide = new Lang.Class({ +var Intellihide = new Lang.Class({ Name: 'DashToDock.Intellihide', _init: function(settings, monitorIndex) { diff --git a/metadata.json b/metadata.json index a73da2b..f74f5ba 100644 --- a/metadata.json +++ b/metadata.json @@ -1,5 +1,5 @@ { -"shell-version": ["3.18", "3.20", "3.22", "3.24"], +"shell-version": ["3.18", "3.20", "3.22", "3.24", "3.26"], "uuid": "ubuntu-dock@ubuntu.com", "name": "Ubuntu Dock", "description": "A dock for the Gnome Shell, default Ubuntu experience. This extension is a modified version of Dash To Dock with different defaults. Dash To Dock can be installed to replace it and give more (but unsupported) configuration options.", diff --git a/po/es.po b/po/es.po index c2766cd..f8eee30 100644 --- a/po/es.po +++ b/po/es.po @@ -7,23 +7,23 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-30 17:27-0400\n" -"PO-Revision-Date: 2017-02-17 12:11+0100\n" -"Last-Translator: Hugo Olabera \n" +"PO-Revision-Date: 2017-08-23 19:42-0500\n" +"Last-Translator: Adolfo Jayme Barrientos \n" "Language-Team: \n" "Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 1.8.11\n" +"X-Generator: Poedit 2.0.3\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: prefs.js:113 msgid "Primary monitor" -msgstr "Pantalla principal" +msgstr "Monitor principal" #: prefs.js:122 prefs.js:129 msgid "Secondary monitor " -msgstr "Pantalla secundaria" +msgstr "Monitor secundario" #: prefs.js:154 Settings.ui.h:29 msgid "Right" @@ -35,15 +35,15 @@ msgstr "Izquierda" #: prefs.js:205 msgid "Intelligent autohide customization" -msgstr "Opciones de auto ocultado" +msgstr "Personalización de ocultamiento inteligente" #: prefs.js:212 prefs.js:393 prefs.js:450 msgid "Reset to defaults" -msgstr "Restaurar" +msgstr "Restablecer la configuración predeterminada" #: prefs.js:386 msgid "Show dock and application numbers" -msgstr "Mostrar el dock y el número de aplicación" +msgstr "Mostrar dock y números de aplicación" #: prefs.js:443 msgid "Customize middle-click behavior" @@ -83,7 +83,7 @@ msgid "" "the shortcut." msgstr "" "Al usar atajos, mostrar momentáneamente el número de aplicación sobre los " -"íconos." +"iconos." #: Settings.ui.h:7 msgid "Show the dock if it is hidden" @@ -94,12 +94,12 @@ msgid "" "If using autohide, the dock will appear for a short time when triggering the " "shortcut." msgstr "" -"Si auto-ocultar está activado, el dock aparecerá momentáneamente al usar el " -"atajo." +"Si se activa el ocultamiento automático, el dock aparecerá momentáneamente " +"al usar el atajo." #: Settings.ui.h:9 msgid "Shortcut for the options above" -msgstr "Atajo para las opciones de arriba" +msgstr "Atajo para las opciones anteriores" #: Settings.ui.h:10 msgid "Syntax: , , , " @@ -114,12 +114,12 @@ msgid "" "When set to minimize, double clicking minimizes all the windows of the " "application." msgstr "" -"Cuando está seleccionado minimizar, doble click minimiza todas las ventanas " -"de la aplicación." +"Cuando se selecciona minimizar, una pulsación doble minimiza todas las " +"ventanas de la aplicación." #: Settings.ui.h:13 msgid "Shift+Click action" -msgstr "Acción de Mayúsculas+Click" +msgstr "Acción de Mayús + pulsación" #: Settings.ui.h:14 msgid "Raise window" @@ -131,7 +131,7 @@ msgstr "Minimizar ventana" #: Settings.ui.h:16 msgid "Launch new instance" -msgstr "Lanzar una nueva instancia" +msgstr "Iniciar una instancia nueva" #: Settings.ui.h:17 msgid "Cycle through windows" @@ -151,11 +151,11 @@ msgstr "Acción del botón central" #: Settings.ui.h:21 msgid "Behavior for Shift+Middle-Click." -msgstr "Comportamiento para Mayúsculas+Botón-Central" +msgstr "Comportamiento de Mayús + botón central" #: Settings.ui.h:22 msgid "Shift+Middle-Click action" -msgstr "Acción de Mayúsculas+Botón-Central" +msgstr "Acción de Mayús + botón central" #: Settings.ui.h:23 msgid "Show the dock on" @@ -163,7 +163,7 @@ msgstr "Mostrar el dock en" #: Settings.ui.h:24 msgid "Show on all monitors." -msgstr "Mostrar en todas las pantallas." +msgstr "Mostrar en todos los monitores." #: Settings.ui.h:25 msgid "Position on screen" @@ -171,11 +171,11 @@ msgstr "Posición en pantalla" #: Settings.ui.h:27 msgid "Bottom" -msgstr "Abajo" +msgstr "Inferior" #: Settings.ui.h:28 msgid "Top" -msgstr "Arriba" +msgstr "Superior" #: Settings.ui.h:30 msgid "" @@ -187,7 +187,7 @@ msgstr "" #: Settings.ui.h:31 msgid "Intelligent autohide" -msgstr "Auto ocultado inteligente" +msgstr "Ocultamiento automático inteligente" #: Settings.ui.h:32 msgid "Dock size limit" @@ -235,7 +235,7 @@ msgstr "" #: Settings.ui.h:42 msgid "Show Applications icon" -msgstr "Mostrar el icono Mostrar aplicaciones" +msgstr "Mostrar el icono Aplicaciones" #: Settings.ui.h:43 msgid "Move the applications button at the beginning of the dock." @@ -267,7 +267,7 @@ msgstr "Comportamiento al pulsar el icono de una aplicación en ejecución" #: Settings.ui.h:49 msgid "Click action" -msgstr "Acción del Click" +msgstr "Acción de pulsación" #: Settings.ui.h:50 msgid "Minimize" @@ -279,11 +279,11 @@ msgstr "Minimizar o vista de actividades" #: Settings.ui.h:52 msgid "Behaviour when scrolling on the icon of an application." -msgstr "Comportamiento al usar scroll sobre el icono de una aplicación." +msgstr "Comportamiento al usar la rueda sobre el icono de una aplicación." #: Settings.ui.h:53 msgid "Scroll action" -msgstr "Acción de scroll" +msgstr "Acción de desplazamiento" #: Settings.ui.h:54 msgid "Do nothing" @@ -307,7 +307,7 @@ msgstr "" #: Settings.ui.h:58 msgid "Use built-in theme" -msgstr "Utilizar el tema por defecto" +msgstr "Utilizar el tema incorporado" #: Settings.ui.h:59 msgid "Save space reducing padding and border radius." @@ -315,7 +315,7 @@ msgstr "Reducir los márgenes para ganar espacio" #: Settings.ui.h:60 msgid "Shrink the dash" -msgstr "Encoger el dock" +msgstr "Encoger el tablero" #: Settings.ui.h:61 msgid "Show a dot for each windows of the application." @@ -391,7 +391,7 @@ msgstr "Mostrar el dock al mover el puntero al borde de la pantalla" #: Settings.ui.h:79 msgid "Autohide" -msgstr "Auto ocultar" +msgstr "Ocultar automáticamente" #: Settings.ui.h:80 msgid "Push to show: require pressure to show the dock" @@ -399,7 +399,7 @@ msgstr "Empujar para mostrar: requiere hacer presión para mostrar el dock" #: Settings.ui.h:81 msgid "Enable in fullscreen mode" -msgstr "Habilitar en modo pantalla completa" +msgstr "Activar en modo de pantalla completa" #: Settings.ui.h:82 msgid "Show the dock when it doesn't obstruct application windows." @@ -407,7 +407,7 @@ msgstr "Mostrar el dock cuando no cubra otras ventanas de aplicaciones" #: Settings.ui.h:83 msgid "Dodge windows" -msgstr "Auto ocultado inteligente" +msgstr "Esquivar las ventanas" #: Settings.ui.h:84 msgid "All windows" @@ -415,11 +415,11 @@ msgstr "Todas las ventanas" #: Settings.ui.h:85 msgid "Only focused application's windows" -msgstr "Sólo las ventanas de la aplicación activa" +msgstr "Solo las ventanas de la aplicación activa" #: Settings.ui.h:86 msgid "Only maximized windows" -msgstr "Sólo las ventanas maximizadas" +msgstr "Solo las ventanas maximizadas" #: Settings.ui.h:87 msgid "Animation duration (s)" diff --git a/po/ru.po b/po/ru.po index cd946d2..b0fd14d 100644 --- a/po/ru.po +++ b/po/ru.po @@ -5,8 +5,8 @@ msgid "" msgstr "" "Project-Id-Version: dash-to-dock\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-07-12 08:31+0300\n" -"PO-Revision-Date: 2017-07-12 08:37+0300\n" +"POT-Creation-Date: 2017-08-28 10:52+0300\n" +"PO-Revision-Date: 2017-08-28 10:56+0300\n" "Last-Translator: Ivan Komaritsyn \n" "Language-Team: \n" "Language: ru\n" @@ -53,13 +53,13 @@ msgstr "Настройка действий для средней кнопки msgid "Customize running indicators" msgstr "Настройка индикаторов запуска" -#: appIcons.js:878 +#: appIcons.js:1131 msgid "All Windows" msgstr "Все окна" #. Translators: %s is "Settings", which is automatically translated. You #. can also translate the full message if this fits better your language. -#: appIcons.js:1176 +#: appIcons.js:1429 #, javascript-format msgid "Dash to Dock %s" msgstr "" @@ -365,30 +365,34 @@ msgid "Opacity" msgstr "Непрозрачность" #: Settings.ui.h:70 +msgid "Enable Unity7 like glossy backlit items" +msgstr "Включить подсветку элементов как в Unity7" + +#: Settings.ui.h:71 msgid "Force straight corner\n" msgstr "Не скруглять углы\n" -#: Settings.ui.h:72 +#: Settings.ui.h:73 msgid "Appearance" msgstr "Внешний вид" -#: Settings.ui.h:73 +#: Settings.ui.h:74 msgid "version: " msgstr "версия: " -#: Settings.ui.h:74 +#: Settings.ui.h:75 msgid "Moves the dash out of the overview transforming it in a dock" msgstr "Показывает панель из режима «Обзор» в виде дока" -#: Settings.ui.h:75 +#: Settings.ui.h:76 msgid "Created by" msgstr "Автор" -#: Settings.ui.h:76 +#: Settings.ui.h:77 msgid "Webpage" msgstr "Домашняя страница" -#: Settings.ui.h:77 +#: Settings.ui.h:78 msgid "" "This program comes with ABSOLUTELY NO WARRANTY.\n" "See the GNU General Public License, версия 2 или позднее для информации." -#: Settings.ui.h:79 +#: Settings.ui.h:80 msgid "About" msgstr "О дополнении" -#: Settings.ui.h:80 +#: Settings.ui.h:81 msgid "Show the dock by mouse hover on the screen edge." msgstr "Показывать Док при подведении мыши к стороне экрана." -#: Settings.ui.h:81 +#: Settings.ui.h:82 msgid "Autohide" msgstr "Автоматическое скрытие" -#: Settings.ui.h:82 +#: Settings.ui.h:83 msgid "Push to show: require pressure to show the dock" msgstr "Давление для появления: требуется давление для открытия Дока" -#: Settings.ui.h:83 +#: Settings.ui.h:84 msgid "Enable in fullscreen mode" msgstr "Включить для полноэкранного режима" -#: Settings.ui.h:84 +#: Settings.ui.h:85 msgid "Show the dock when it doesn't obstruct application windows." msgstr "Скрывать Док, когда он перекрыт окнами приложений" -#: Settings.ui.h:85 +#: Settings.ui.h:86 msgid "Dodge windows" msgstr "Перекрытие окнами" -#: Settings.ui.h:86 +#: Settings.ui.h:87 msgid "All windows" msgstr "Все окна" -#: Settings.ui.h:87 +#: Settings.ui.h:88 msgid "Only focused application's windows" msgstr "Только активное окно приложения" -#: Settings.ui.h:88 +#: Settings.ui.h:89 msgid "Only maximized windows" msgstr "Только развёрнутые окна" -#: Settings.ui.h:89 +#: Settings.ui.h:90 msgid "Animation duration (s)" msgstr "Время анимации (сек.)" -#: Settings.ui.h:90 +#: Settings.ui.h:91 msgid "Show timeout (s)" msgstr "Задержка открытия (сек.)" -#: Settings.ui.h:91 +#: Settings.ui.h:92 msgid "Pressure threshold" msgstr "Порог давления" diff --git a/prefs.js b/prefs.js deleted file mode 100644 index 5f1f378..0000000 --- a/prefs.js +++ /dev/null @@ -1,705 +0,0 @@ -// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- - -const Gio = imports.gi.Gio; -const GLib = imports.gi.GLib; -const GObject = imports.gi.GObject; -const Gtk = imports.gi.Gtk; -const Gdk = imports.gi.Gdk; -const Lang = imports.lang; -const Mainloop = imports.mainloop; - -// Use __ () and N__() for the extension gettext domain, and reuse -// the shell domain with the default _() and N_() -const Gettext = imports.gettext.domain('dashtodock'); -const __ = Gettext.gettext; -const N__ = function(e) { return e }; - -const ExtensionUtils = imports.misc.extensionUtils; -const Me = ExtensionUtils.getCurrentExtension(); -const Convenience = Me.imports.convenience; - -const SCALE_UPDATE_TIMEOUT = 500; -const DEFAULT_ICONS_SIZES = [ 128, 96, 64, 48, 32, 24, 16 ]; - -/** - * This function was copied from the activities-config extension - * https://github.com/nls1729/acme-code/tree/master/activities-config - * by Norman L. Smith. - */ -function cssHexString(css) { - let rrggbb = '#'; - let start; - for (let loop = 0; loop < 3; loop++) { - let end = 0; - let xx = ''; - for (let loop = 0; loop < 2; loop++) { - while (true) { - let x = css.slice(end, end + 1); - if ((x == '(') || (x == ',') || (x == ')')) - break; - end++; - } - if (loop == 0) { - end++; - start = end; - } - } - xx = parseInt(css.slice(start, end)).toString(16); - if (xx.length == 1) - xx = '0' + xx; - rrggbb += xx; - css = css.slice(end); - } - return rrggbb; -} - -function setShortcut(settings) { - let shortcut_text = settings.get_string('shortcut-text'); - let [key, mods] = Gtk.accelerator_parse(shortcut_text); - - if (Gtk.accelerator_valid(key, mods)) { - let shortcut = Gtk.accelerator_name(key, mods); - settings.set_strv('shortcut', [shortcut]); - } - else { - settings.set_strv('shortcut', []); - } -} - -const Settings = new Lang.Class({ - Name: 'DashToDock.Settings', - - _init: function() { - this._settings = Convenience.getSettings('org.gnome.shell.extensions.dash-to-dock'); - - this._rtl = (Gtk.Widget.get_default_direction() == Gtk.TextDirection.RTL); - - this._builder = new Gtk.Builder(); - this._builder.set_translation_domain(Me.metadata['gettext-domain']); - this._builder.add_from_file(Me.path + '/Settings.ui'); - - this.widget = this._builder.get_object('settings_notebook'); - - // Timeout to delay the update of the settings - this._dock_size_timeout = 0; - this._icon_size_timeout = 0; - this._opacity_timeout = 0; - - this._bindSettings(); - - this._builder.connect_signals_full(Lang.bind(this, this._connector)); - }, - - /** - * Connect signals - */ - _connector: function(builder, object, signal, handler) { - object.connect(signal, Lang.bind(this, this._SignalHandler[handler])); - }, - - _bindSettings: function() { - // Position and size panel - - // Monitor options - - this._monitors = []; - // Build options based on the number of monitors and the current settings. - let n_monitors = Gdk.Screen.get_default().get_n_monitors(); - let primary_monitor = Gdk.Screen.get_default().get_primary_monitor(); - - let monitor = this._settings.get_int('preferred-monitor'); - - // Add primary monitor with index 0, because in GNOME Shell the primary monitor is always 0 - this._builder.get_object('dock_monitor_combo').append_text(__('Primary monitor')); - this._monitors.push(0); - - // Add connected monitors - let ctr = 0; - for (let i = 0; i < n_monitors; i++) { - if (i !== primary_monitor) { - ctr++; - this._monitors.push(ctr); - this._builder.get_object('dock_monitor_combo').append_text(__('Secondary monitor ') + ctr); - } - } - - // If one of the external monitor is set as preferred, show it even if not attached - if ((monitor >= n_monitors) && (monitor !== primary_monitor)) { - this._monitors.push(monitor) - this._builder.get_object('dock_monitor_combo').append_text(__('Secondary monitor ') + ++ctr); - } - - this._builder.get_object('dock_monitor_combo').set_active(this._monitors.indexOf(monitor)); - - // Position option - let position = this._settings.get_enum('dock-position'); - - switch (position) { - case 0: - this._builder.get_object('position_top_button').set_active(true); - break; - case 1: - this._builder.get_object('position_right_button').set_active(true); - break; - case 2: - this._builder.get_object('position_bottom_button').set_active(true); - break; - case 3: - this._builder.get_object('position_left_button').set_active(true); - break; - } - - if (this._rtl) { - /* Left is Right in rtl as a setting */ - this._builder.get_object('position_left_button').set_label(__('Right')); - this._builder.get_object('position_right_button').set_label(__('Left')); - } - - // Intelligent autohide options - this._settings.bind('dock-fixed', - this._builder.get_object('intelligent_autohide_switch'), - 'active', - Gio.SettingsBindFlags.INVERT_BOOLEAN); - this._settings.bind('dock-fixed', - this._builder.get_object('intelligent_autohide_button'), - 'sensitive', - Gio.SettingsBindFlags.INVERT_BOOLEAN); - this._settings.bind('autohide', - this._builder.get_object('autohide_switch'), - 'active', - Gio.SettingsBindFlags.DEFAULT); - this._settings.bind('autohide-in-fullscreen', - this._builder.get_object('autohide_enable_in_fullscreen_checkbutton'), - 'active', - Gio.SettingsBindFlags.DEFAULT); - this._settings.bind('require-pressure-to-show', - this._builder.get_object('require_pressure_checkbutton'), - 'active', - Gio.SettingsBindFlags.DEFAULT); - this._settings.bind('intellihide', - this._builder.get_object('intellihide_switch'), - 'active', - Gio.SettingsBindFlags.DEFAULT); - this._settings.bind('animation-time', - this._builder.get_object('animation_duration_spinbutton'), - 'value', - Gio.SettingsBindFlags.DEFAULT); - this._settings.bind('hide-delay', - this._builder.get_object('hide_timeout_spinbutton'), - 'value', - Gio.SettingsBindFlags.DEFAULT); - this._settings.bind('show-delay', - this._builder.get_object('show_timeout_spinbutton'), - 'value', - Gio.SettingsBindFlags.DEFAULT); - this._settings.bind('pressure-threshold', - this._builder.get_object('pressure_threshold_spinbutton'), - 'value', - Gio.SettingsBindFlags.DEFAULT); - - //this._builder.get_object('animation_duration_spinbutton').set_value(this._settings.get_double('animation-time')); - - // Create dialog for intelligent autohide advanced settings - this._builder.get_object('intelligent_autohide_button').connect('clicked', Lang.bind(this, function() { - - let dialog = new Gtk.Dialog({ title: __('Intelligent autohide customization'), - 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('intelligent_autohide_advanced_settings_box'); - dialog.get_content_area().add(box); - - this._settings.bind('intellihide', - this._builder.get_object('intellihide_mode_box'), - 'sensitive', - Gio.SettingsBindFlags.GET); - - // intellihide mode - - let intellihideModeRadioButtons = [ - this._builder.get_object('all_windows_radio_button'), - this._builder.get_object('focus_application_windows_radio_button'), - this._builder.get_object('maximized_windows_radio_button') - ]; - - intellihideModeRadioButtons[this._settings.get_enum('intellihide-mode')].set_active(true); - - this._settings.bind('autohide', - this._builder.get_object('require_pressure_checkbutton'), - 'sensitive', - Gio.SettingsBindFlags.GET); - - this._settings.bind('autohide', - this._builder.get_object('autohide_enable_in_fullscreen_checkbutton'), - 'sensitive', - Gio.SettingsBindFlags.GET); - - this._settings.bind('require-pressure-to-show', - this._builder.get_object('show_timeout_spinbutton'), - 'sensitive', - Gio.SettingsBindFlags.INVERT_BOOLEAN); - this._settings.bind('require-pressure-to-show', - this._builder.get_object('show_timeout_label'), - 'sensitive', - Gio.SettingsBindFlags.INVERT_BOOLEAN); - this._settings.bind('require-pressure-to-show', - this._builder.get_object('pressure_threshold_spinbutton'), - 'sensitive', - Gio.SettingsBindFlags.DEFAULT); - this._settings.bind('require-pressure-to-show', - this._builder.get_object('pressure_threshold_label'), - 'sensitive', - Gio.SettingsBindFlags.DEFAULT); - - dialog.connect('response', Lang.bind(this, function(dialog, id) { - if (id == 1) { - // restore default settings for the relevant keys - let keys = ['intellihide', 'autohide', 'intellihide-mode', 'autohide-in-fullscreen', 'require-pressure-to-show', - 'animation-time', 'show-delay', 'hide-delay', 'pressure-threshold']; - keys.forEach(function(val) { - this._settings.set_value(val, this._settings.get_default_value(val)); - }, this); - intellihideModeRadioButtons[this._settings.get_enum('intellihide-mode')].set_active(true); - } else { - // remove the settings box so it doesn't get destroyed; - dialog.get_content_area().remove(box); - dialog.destroy(); - } - return; - })); - - dialog.show_all(); - - })); - - // size options - this._builder.get_object('dock_size_scale').set_value(this._settings.get_double('height-fraction')); - this._builder.get_object('dock_size_scale').add_mark(0.9, Gtk.PositionType.TOP, null); - let icon_size_scale = this._builder.get_object('icon_size_scale'); - icon_size_scale.set_range(8, DEFAULT_ICONS_SIZES[0]); - icon_size_scale.set_value(this._settings.get_int('dash-max-icon-size')); - DEFAULT_ICONS_SIZES.forEach(function(val) { - icon_size_scale.add_mark(val, Gtk.PositionType.TOP, val.toString()); - }); - - // Corrent for rtl languages - if (this._rtl) { - // Flip value position: this is not done automatically - this._builder.get_object('dock_size_scale').set_value_pos(Gtk.PositionType.LEFT); - icon_size_scale.set_value_pos(Gtk.PositionType.LEFT); - // I suppose due to a bug, having a more than one mark and one above a value of 100 - // makes the rendering of the marks wrong in rtl. This doesn't happen setting the scale as not flippable - // and then manually inverting it - icon_size_scale.set_flippable(false); - icon_size_scale.set_inverted(true); - } - - this._settings.bind('icon-size-fixed', this._builder.get_object('icon_size_fixed_checkbutton'), 'active', Gio.SettingsBindFlags.DEFAULT); - this._settings.bind('extend-height', this._builder.get_object('dock_size_extend_checkbutton'), 'active', Gio.SettingsBindFlags.DEFAULT); - this._settings.bind('extend-height', this._builder.get_object('dock_size_scale'), 'sensitive', Gio.SettingsBindFlags.INVERT_BOOLEAN); - - - // Apps panel - - this._settings.bind('show-running', - this._builder.get_object('show_running_switch'), - 'active', - Gio.SettingsBindFlags.DEFAULT); - this._settings.bind('isolate-workspaces', - this._builder.get_object('application_button_isolation_button'), - 'active', - Gio.SettingsBindFlags.DEFAULT); - this._settings.bind('isolate-monitors', - this._builder.get_object('application_button_monitor_isolation_button'), - 'active', - Gio.SettingsBindFlags.DEFAULT); - this._settings.bind('show-windows-preview', - this._builder.get_object('windows_preview_button'), - 'active', - Gio.SettingsBindFlags.DEFAULT); - this._settings.bind('multi-monitor', - this._builder.get_object('multi_monitor_button'), - 'active', - Gio.SettingsBindFlags.DEFAULT); - this._settings.bind('show-favorites', - this._builder.get_object('show_favorite_switch'), - 'active', - Gio.SettingsBindFlags.DEFAULT); - this._settings.bind('show-show-apps-button', - this._builder.get_object('show_applications_button_switch'), - 'active', - Gio.SettingsBindFlags.DEFAULT); - this._settings.bind('show-apps-at-top', - this._builder.get_object('application_button_first_button'), - 'active', - Gio.SettingsBindFlags.DEFAULT); - this._settings.bind('show-show-apps-button', - this._builder.get_object('application_button_first_button'), - 'sensitive', - Gio.SettingsBindFlags.DEFAULT); - this._settings.bind('animate-show-apps', - this._builder.get_object('application_button_animation_button'), - 'active', - Gio.SettingsBindFlags.DEFAULT); - this._settings.bind('show-show-apps-button', - this._builder.get_object('application_button_animation_button'), - 'sensitive', - Gio.SettingsBindFlags.DEFAULT); - - - // Behavior panel - - this._settings.bind('hot-keys', - this._builder.get_object('hot_keys_switch'), - 'active', - Gio.SettingsBindFlags.DEFAULT); - this._settings.bind('hot-keys', - this._builder.get_object('overlay_button'), - 'sensitive', - Gio.SettingsBindFlags.DEFAULT); - - this._builder.get_object('click_action_combo').set_active(this._settings.get_enum('click-action')); - this._builder.get_object('click_action_combo').connect('changed', Lang.bind (this, function(widget) { - this._settings.set_enum('click-action', widget.get_active()); - })); - - this._builder.get_object('scroll_action_combo').set_active(this._settings.get_enum('scroll-action')); - this._builder.get_object('scroll_action_combo').connect('changed', Lang.bind (this, function(widget) { - this._settings.set_enum('scroll-action', widget.get_active()); - })); - - this._builder.get_object('shift_click_action_combo').connect('changed', Lang.bind (this, function(widget) { - this._settings.set_enum('shift-click-action', widget.get_active()); - })); - - this._builder.get_object('middle_click_action_combo').connect('changed', Lang.bind (this, function(widget) { - this._settings.set_enum('middle-click-action', widget.get_active()); - })); - this._builder.get_object('shift_middle_click_action_combo').connect('changed', Lang.bind (this, function(widget) { - this._settings.set_enum('shift-middle-click-action', widget.get_active()); - })); - - // Create dialog for number overlay options - this._builder.get_object('overlay_button').connect('clicked', Lang.bind(this, function() { - - let dialog = new Gtk.Dialog({ title: __('Show dock and application numbers'), - 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_overlay_shortcut'); - dialog.get_content_area().add(box); - - this._builder.get_object('overlay_switch').set_active(this._settings.get_boolean('hotkeys-overlay')); - this._builder.get_object('show_dock_switch').set_active(this._settings.get_boolean('hotkeys-show-dock')); - - // We need to update the shortcut 'strv' when the text is modified - this._settings.connect('changed::shortcut-text', Lang.bind(this, function() {setShortcut(this._settings);})); - this._settings.bind('shortcut-text', - this._builder.get_object('shortcut_entry'), - 'text', - Gio.SettingsBindFlags.DEFAULT); - - this._settings.bind('hotkeys-overlay', - this._builder.get_object('overlay_switch'), - 'active', - Gio.SettingsBindFlags.DEFAULT); - this._settings.bind('hotkeys-show-dock', - this._builder.get_object('show_dock_switch'), - 'active', - Gio.SettingsBindFlags.DEFAULT); - this._settings.bind('shortcut-timeout', - this._builder.get_object('timeout_spinbutton'), - 'value', - Gio.SettingsBindFlags.DEFAULT); - - dialog.connect('response', Lang.bind(this, function(dialog, id) { - if (id == 1) { - // restore default settings for the relevant keys - let keys = ['shortcut-text', 'hotkeys-overlay', 'hotkeys-show-dock', 'shortcut-timeout']; - keys.forEach(function(val) { - this._settings.set_value(val, this._settings.get_default_value(val)); - }, this); - } else { - // remove the settings box so it doesn't get destroyed; - dialog.get_content_area().remove(box); - dialog.destroy(); - } - return; - })); - - dialog.show_all(); - - })); - - // Create dialog for middle-click options - this._builder.get_object('middle_click_options_button').connect('clicked', Lang.bind(this, function() { - - let dialog = new Gtk.Dialog({ title: __('Customize middle-click behavior'), - 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_middle_click_options'); - dialog.get_content_area().add(box); - - this._builder.get_object('shift_click_action_combo').set_active(this._settings.get_enum('shift-click-action')); - - this._builder.get_object('middle_click_action_combo').set_active(this._settings.get_enum('middle-click-action')); - - this._builder.get_object('shift_middle_click_action_combo').set_active(this._settings.get_enum('shift-middle-click-action')); - - this._settings.bind('shift-click-action', - this._builder.get_object('shift_click_action_combo'), - 'active-id', - Gio.SettingsBindFlags.DEFAULT); - this._settings.bind('middle-click-action', - this._builder.get_object('middle_click_action_combo'), - 'active-id', - Gio.SettingsBindFlags.DEFAULT); - this._settings.bind('shift-middle-click-action', - this._builder.get_object('shift_middle_click_action_combo'), - 'active-id', - Gio.SettingsBindFlags.DEFAULT); - - dialog.connect('response', Lang.bind(this, function(dialog, id) { - if (id == 1) { - // restore default settings for the relevant keys - let keys = ['shift-click-action', 'middle-click-action', 'shift-middle-click-action']; - keys.forEach(function(val) { - this._settings.set_value(val, this._settings.get_default_value(val)); - }, this); - this._builder.get_object('shift_click_action_combo').set_active(this._settings.get_enum('shift-click-action')); - this._builder.get_object('middle_click_action_combo').set_active(this._settings.get_enum('middle-click-action')); - this._builder.get_object('shift_middle_click_action_combo').set_active(this._settings.get_enum('shift-middle-click-action')); - } else { - // remove the settings box so it doesn't get destroyed; - dialog.get_content_area().remove(box); - dialog.destroy(); - } - return; - })); - - dialog.show_all(); - - })); - - // Appearance Panel - - this._settings.bind('apply-custom-theme', this._builder.get_object('customize_theme'), 'sensitive', Gio.SettingsBindFlags.INVERT_BOOLEAN | Gio.SettingsBindFlags.GET); - this._settings.bind('apply-custom-theme', this._builder.get_object('builtin_theme_switch'), 'active', Gio.SettingsBindFlags.DEFAULT); - this._settings.bind('custom-theme-shrink', this._builder.get_object('shrink_dash_switch'), 'active', Gio.SettingsBindFlags.DEFAULT); - - this._settings.bind('custom-theme-running-dots', - this._builder.get_object('running_dots_switch'), - 'active', - Gio.SettingsBindFlags.DEFAULT); - this._settings.bind('custom-theme-running-dots', - this._builder.get_object('running_dots_advance_settings_button'), - 'sensitive', - Gio.SettingsBindFlags.DEFAULT); - - // Create dialog for running dots advanced settings - this._builder.get_object('running_dots_advance_settings_button').connect('clicked', Lang.bind(this, function() { - - let dialog = new Gtk.Dialog({ title: __('Customize running indicators'), - transient_for: this.widget.get_toplevel(), - use_header_bar: true, - modal: true }); - - let box = this._builder.get_object('running_dots_advance_settings_box'); - dialog.get_content_area().add(box); - - this._settings.bind('custom-theme-customize-running-dots', - this._builder.get_object('dot_style_switch'), - 'active', - Gio.SettingsBindFlags.DEFAULT); - this._settings.bind('custom-theme-customize-running-dots', - this._builder.get_object('dot_style_settings_box'), - 'sensitive', Gio.SettingsBindFlags.DEFAULT); - - let rgba = new Gdk.RGBA(); - rgba.parse(this._settings.get_string('custom-theme-running-dots-color')); - this._builder.get_object('dot_color_colorbutton').set_rgba(rgba); - - this._builder.get_object('dot_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('custom-theme-running-dots-color', hexString); - })); - - rgba.parse(this._settings.get_string('custom-theme-running-dots-border-color')); - this._builder.get_object('dot_border_color_colorbutton').set_rgba(rgba); - - this._builder.get_object('dot_border_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('custom-theme-running-dots-border-color', hexString); - })); - - this._settings.bind('custom-theme-running-dots-border-width', - this._builder.get_object('dot_border_width_spin_button'), - 'value', - Gio.SettingsBindFlags.DEFAULT); - - - dialog.connect('response', Lang.bind(this, function(dialog, id) { - // 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('custom-background-color', this._builder.get_object('custom_background_color_switch'), 'active', Gio.SettingsBindFlags.DEFAULT); - this._settings.bind('custom-background-color', this._builder.get_object('custom_background_color'), 'sensitive', Gio.SettingsBindFlags.DEFAULT); - - let rgba = new Gdk.RGBA(); - rgba.parse(this._settings.get_string('background-color')); - this._builder.get_object('custom_background_color').set_rgba(rgba); - - this._builder.get_object('custom_background_color').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('background-color', hexString); - })); - - this._settings.bind('opaque-background', this._builder.get_object('customize_opacity_switch'), 'active', Gio.SettingsBindFlags.DEFAULT); - this._builder.get_object('custom_opacity_scale').set_value(this._settings.get_double('background-opacity')); - this._settings.bind('opaque-background', this._builder.get_object('custom_opacity'), 'sensitive', Gio.SettingsBindFlags.DEFAULT); - - this._settings.bind('force-straight-corner', - this._builder.get_object('force_straight_corner_switch'), - 'active', Gio.SettingsBindFlags.DEFAULT); - - // About Panel - - this._builder.get_object('extension_version').set_label(Me.metadata.version.toString()); - }, - - /** - * Object containing all signals defined in the glade file - */ - _SignalHandler: { - dock_display_combo_changed_cb: function(combo) { - this._settings.set_int('preferred-monitor', this._monitors[combo.get_active()]); - }, - - position_top_button_toggled_cb: function(button) { - if (button.get_active()) - this._settings.set_enum('dock-position', 0); - }, - - position_right_button_toggled_cb: function(button) { - if (button.get_active()) - this._settings.set_enum('dock-position', 1); - }, - - position_bottom_button_toggled_cb: function(button) { - if (button.get_active()) - this._settings.set_enum('dock-position', 2); - }, - - position_left_button_toggled_cb: function(button) { - if (button.get_active()) - this._settings.set_enum('dock-position', 3); - }, - - icon_size_combo_changed_cb: function(combo) { - this._settings.set_int('dash-max-icon-size', this._allIconSizes[combo.get_active()]); - }, - - dock_size_scale_format_value_cb: function(scale, value) { - return Math.round(value*100)+ ' %'; - }, - - dock_size_scale_value_changed_cb: function(scale) { - // Avoid settings the size consinuosly - if (this._dock_size_timeout > 0) - Mainloop.source_remove(this._dock_size_timeout); - - this._dock_size_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this, function() { - this._settings.set_double('height-fraction', scale.get_value()); - this._dock_size_timeout = 0; - return GLib.SOURCE_REMOVE; - })); - }, - - icon_size_scale_format_value_cb: function(scale, value) { - return value+ ' px'; - }, - - icon_size_scale_value_changed_cb: function(scale) { - // Avoid settings the size consinuosly - if (this._icon_size_timeout > 0) - Mainloop.source_remove(this._icon_size_timeout); - - this._icon_size_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this, function() { - this._settings.set_int('dash-max-icon-size', scale.get_value()); - this._icon_size_timeout = 0; - return GLib.SOURCE_REMOVE; - })); - }, - - custom_opacity_scale_value_changed_cb: function(scale) { - // Avoid settings the opacity consinuosly as it's change is animated - 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('background-opacity', scale.get_value()); - this._opacity_timeout = 0; - return GLib.SOURCE_REMOVE; - })); - }, - - custom_opacity_scale_format_value_cb: function(scale, value) { - return Math.round(value*100) + ' %'; - }, - - all_windows_radio_button_toggled_cb: function(button) { - if (button.get_active()) - this._settings.set_enum('intellihide-mode', 0); - }, - - focus_application_windows_radio_button_toggled_cb: function(button) { - if (button.get_active()) - this._settings.set_enum('intellihide-mode', 1); - }, - - maximized_windows_radio_button_toggled_cb: function(button) { - if (button.get_active()) - this._settings.set_enum('intellihide-mode', 2); - } - } -}); - -function init() { - Convenience.initTranslations(); -} - -function buildPrefsWidget() { - let settings = new Settings(); - let widget = settings.widget; - widget.show_all(); - return widget; -} diff --git a/schemas/10_ubuntu-dock.gschema.override b/schemas/10_ubuntu-dock.gschema.override index 0776531..f1a6878 100644 --- a/schemas/10_ubuntu-dock.gschema.override +++ b/schemas/10_ubuntu-dock.gschema.override @@ -8,7 +8,9 @@ custom-theme-running-dots=true custom-theme-running-dots-color='#e95420' custom-theme-running-dots-border-color='#e95420' extend-height=true -opaque-background=true -background-opacity=0.70 +transparency-mode='ADAPTIVE' scroll-action='switch-workspace' click-action='previews' +shift-click-action='launch' +middle-click-action='launch' +shift-middle-click-action='minimize' diff --git a/schemas/org.gnome.shell.extensions.dash-to-dock.gschema.xml b/schemas/org.gnome.shell.extensions.dash-to-dock.gschema.xml index f99f9a5..7ce0eab 100644 --- a/schemas/org.gnome.shell.extensions.dash-to-dock.gschema.xml +++ b/schemas/org.gnome.shell.extensions.dash-to-dock.gschema.xml @@ -27,6 +27,12 @@ + + + + + + 'LEFT' @@ -58,10 +64,25 @@ Dash background color. Customize the background color of the dash. - + + 'DEFAULT' + Transparency mode for the dock + FIXED: constant transparency. ADAPTIVE: lock state with the top panel. DYNAMIC: dock takes the opaque style only when windows are close to it. + + false - Dash background is opaque - Makes the background of the dash opaque improving readability when in autohide mode. + Manually set the min and max opacity + For Adaptive and Dynamic modes, the min/max opacity values will be given by 'min-alpha' and 'max-alpha'. + + + 0.2 + Opacity of the dash background when free-floating + Sets the opacity of the dash background when no windows are close. + + + 0.8 + Opacity of the dash background when windows are close. + Sets the opacity of the dash background when windows are close. 0.8 @@ -489,216 +510,6 @@ Keybinding to either show or launch the 10th application in the dash. - - KP_1']]]> - Keybinding to launch 1st dash app - - Keybinding to launch 1st app. - - - - KP_2']]]> - Keybinding to launch 2nd dash app - - Keybinding to launch 2nd app. - - - - KP_3']]]> - Keybinding to launch 3rd dash app - - Keybinding to launch 3rd app. - - - - KP_4']]]> - Keybinding to launch 4th dash app - - Keybinding to launch 4th app. - - - - KP_5']]]> - Keybinding to launch 5th dash app - - Keybinding to launch 5th app. - - - - KP_6']]]> - Keybinding to launch 6th dash app - - Keybinding to launch 6th app. - - - - KP_7']]]> - Keybinding to launch 7th dash app - - Keybinding to launch 7th app. - - - - KP_8']]]> - Keybinding to launch 8th dash app - - Keybinding to launch 8th app. - - - - KP_9']]]> - Keybinding to launch 9th dash app - - Keybinding to launch 9th app. - - - - KP_0']]]> - Keybinding to launch 10th dash app - - Keybinding to launch 10th app. - - - - KP_1']]]> - Keybinding to trigger 1st dash app with shift behavior - - Keybinding to trigger 1st app with shift behavior. - - - - KP_2']]]> - Keybinding to trigger 2nd dash app with shift behavior - - Keybinding to trigger 2nd app with shift behavior. - - - - KP_3']]]> - Keybinding to trigger 3rd dash app with shift behavior - - Keybinding to trigger 3rd app with shift behavior. - - - - KP_4']]]> - Keybinding to trigger 4th dash app with shift behavior - - Keybinding to trigger 4th app with shift behavior. - - - - KP_5']]]> - Keybinding to trigger 5th dash app with shift behavior - - Keybinding to trigger 5th app with shift behavior. - - - - KP_6']]]> - Keybinding to trigger 6th dash app with shift behavior - - Keybinding to trigger 6th app with shift behavior. - - - - KP_7']]]> - Keybinding to trigger 7th dash app with shift behavior - - Keybinding to trigger 7th app with shift behavior. - - - - KP_8']]]> - Keybinding to trigger 8th dash app with shift behavior - - Keybinding to trigger 8th app with shift behavior. - - - - KP_9']]]> - Keybinding to trigger 9th dash app with shift behavior - - Keybinding to trigger 9th app with shift behavior. - - - - KP_0']]]> - Keybinding to trigger 10th dash app with shift behavior - - Keybinding to trigger 10th app with shift behavior. - - - - KP_1']]]> - Keybinding to trigger 1st dash app - - Keybinding to either show or launch the 1st application in the dash. - - - - KP_2']]]> - Keybinding to trigger 2nd dash app - - Keybinding to either show or launch the 2nd application in the dash. - - - - KP_3']]]> - Keybinding to trigger 3rd dash app - - Keybinding to either show or launch the 3rd application in the dash. - - - - KP_4']]]> - Keybinding to trigger 4th dash app - - Keybinding to either show or launch the 4th application in the dash. - - - - KP_5']]]> - Keybinding to trigger 5th dash app - - Keybinding to either show or launch the 5th application in the dash. - - - - KP_6']]]> - Keybinding to trigger 6th dash app - - Keybinding to either show or launch the 6th application in the dash. - - - - KP_7']]]> - Keybinding to trigger 7th dash app - - Keybinding to either show or launch the 7th application in the dash. - - - - KP_8']]]> - Keybinding to trigger 8th dash app - - Keybinding to either show or launch the 8th application in the dash. - - - - KP_9']]]> - Keybinding to trigger 9th dash app - - Keybinding to either show or launch the 9th application in the dash. - - - - KP_0']]]> - Keybinding to trigger 10th dash app - - Keybinding to either show or launch the 10th application in the dash. - - false Force straight corners in dash diff --git a/stylesheet.css b/stylesheet.css index 6e9bf38..742ae52 100644 --- a/stylesheet.css +++ b/stylesheet.css @@ -95,6 +95,20 @@ background: #2e3436; } +/* Only alpha value is used */ +#dashtodockContainer.opaque { + background-color: rgba(0, 0, 0, 0.8); + border-color: rgba(0, 0, 0, 0.4); + transition-duration: 300ms; +} + +/* Only alpha value is used */ +#dashtodockContainer.transparent { + background-color: rgba(0, 0, 0, 0.2); + border-color: rgba(0, 0, 0, 0.1); + transition-duration: 500ms; +} + #dashtodockContainer .number-overlay { color: rgba(255,255,255,1); background-color: rgba(0,0,0,0.8); diff --git a/theming.js b/theming.js index 0a306b4..35921bd 100644 --- a/theming.js +++ b/theming.js @@ -23,24 +23,40 @@ const Util = imports.misc.util; const Workspace = imports.ui.workspace; const Me = imports.misc.extensionUtils.getCurrentExtension(); +const Dock = Me.imports.docking; const Utils = Me.imports.utils; +/* + * DEFAULT: transparency given by theme + * FIXED: constant transparency chosen by user + * ADAPTIVE: apply 'transparent' style to dock AND panel when + * no windows are close to the dock OR panel + * DYNAMIC: apply 'transparent' style when no windows are close to the dock + * */ +const TransparencyMode = { + DEFAULT: 0, + FIXED: 1, + ADAPTIVE: 2, + DYNAMIC: 3 +}; + /** * Manage theme customization and custom theme support */ -const ThemeManager = new Lang.Class({ +var ThemeManager = new Lang.Class({ Name: 'DashToDock.ThemeManager', - _init: function(settings, actor, dash) { + _init: function(settings, dock) { this._settings = settings; this._signalsHandler = new Utils.GlobalSignalsHandler(); this._bindSettingsChanges(); - this._actor = actor; - this._dash = dash; + this._actor = dock.actor; + this._dash = dock.dash; // initialize colors with generic values this._customizedBackground = {red: 0, green: 0, blue: 0, alpha: 0}; this._customizedBorder = {red: 0, green: 0, blue: 0, alpha: 0}; + this._transparency = new Transparency(this._settings, dock); this._signalsHandler.add([ // When theme changes re-obtain default background color @@ -68,6 +84,7 @@ const ThemeManager = new Lang.Class({ destroy: function() { this._signalsHandler.destroy(); + this._transparency.destroy(); }, _onOverviewShowing: function() { @@ -139,25 +156,32 @@ const ThemeManager = new Lang.Class({ }, _updateDashColor: function() { - if (this._settings.get_boolean('custom-background-color')) { - let [backgroundColor, borderColor] = this._getDefaultColors(); + // Retrieve the color. If needed we will adjust it before passing it to + // this._transparency. + let [backgroundColor, borderColor] = this._getDefaultColors(); - if (backgroundColor==null) - return; + if (backgroundColor==null) + return; + if (this._settings.get_boolean('custom-background-color')) { + // When applying a custom color, we need to check the alpha value, + // if not the opacity will always be overridden by the color below. + // Note that if using 'adaptive' or 'dynamic' transparency modes, + // the opacity will be set by the opaque/transparent styles anyway. let newAlpha = Math.round(backgroundColor.alpha/2.55)/100; - if (this._settings.get_boolean('opaque-background')) + if (this._settings.get_enum('transparency-mode') == TransparencyMode.FIXED) newAlpha = this._settings.get_double('background-opacity'); - let newColor = Clutter.color_from_string(this._settings.get_string('background-color'))[1]; + backgroundColor = Clutter.color_from_string(this._settings.get_string('background-color'))[1]; this._customizedBackground = 'rgba(' + - newColor.red + ',' + - newColor.green + ',' + - newColor.blue + ',' + + backgroundColor.red + ',' + + backgroundColor.green + ',' + + backgroundColor.blue + ',' + newAlpha + ')'; this._customizedBorder = this._customizedBackground; } + this._transparency.setColor(backgroundColor); }, _updateCustomStyleClasses: function() { @@ -206,6 +230,7 @@ const ThemeManager = new Lang.Class({ // Remove prior style edits this._dash._container.set_style(null); + this._transparency.disable(); // If built-in theme is enabled do nothing else if (this._settings.get_boolean('apply-custom-theme')) @@ -263,7 +288,12 @@ const ThemeManager = new Lang.Class({ } // Customize background - if (this._settings.get_boolean('opaque-background') || this._settings.get_boolean('custom-background-color')) { + let fixedTransparency = this._settings.get_enum('transparency-mode') == TransparencyMode.FIXED; + let defaultTransparency = this._settings.get_enum('transparency-mode') == TransparencyMode.DEFAULT; + if (!defaultTransparency && !fixedTransparency) { + this._transparency.enable(); + } + else if (!defaultTransparency || this._settings.get_boolean('custom-background-color')) { newStyle = newStyle + 'background-color:'+ this._customizedBackground + '; ' + 'border-color:'+ this._customizedBorder + '; ' + 'transition-delay: 0s; transition-duration: 0.250s;'; @@ -272,7 +302,10 @@ const ThemeManager = new Lang.Class({ }, _bindSettingsChanges: function() { - let keys = ['opaque-background', + let keys = ['transparency-mode', + 'customize-alphas', + 'min-alpha', + 'max-alpha', 'background-opacity', 'custom-background-color', 'background-color', @@ -291,3 +324,329 @@ const ThemeManager = new Lang.Class({ }, this); } }); + +/** + * The following class is based on the following upstream commit: + * https://git.gnome.org/browse/gnome-shell/commit/?id=447bf55e45b00426ed908b1b1035f472c2466956 + * Transparency when free-floating + */ +const Transparency = new Lang.Class({ + Name: 'DashToDock.Transparency', + + _init: function(settings, dock) { + this._settings = settings; + this._dash = dock.dash; + this._actor = this._dash._container; + this._dockActor = dock.actor; + this._dock = dock; + this._panel = Main.panel; + this._position = Utils.getPosition(this._settings); + + this._backgroundColor = '0,0,0'; + this._transparentAlpha = '0.2'; + this._opaqueAlpha = '1'; + this._transparentAlphaBorder = '0.1'; + this._opaqueAlphaBorder = '0.5'; + this._transparentTransition = '0ms'; + this._opaqueTransition = '0ms'; + + this._updateStyles(); + + this._signalsHandler = new Utils.GlobalSignalsHandler(); + this._injectionsHandler = new Utils.InjectionsHandler(); + this._trackedWindows = new Map(); + }, + + enable: function() { + // ensure I never double-register/inject + // although it should never happen + this.disable(); + + this._signalsHandler.addWithLabel('transparency', [ + global.window_group, + 'actor-added', + Lang.bind(this, this._onWindowActorAdded) + ], [ + global.window_group, + 'actor-removed', + Lang.bind(this, this._onWindowActorRemoved) + ], [ + global.window_manager, + 'switch-workspace', + Lang.bind(this, this._updateSolidStyle) + ],[ + Main.overview, + 'hiding', + Lang.bind(this, this._updateSolidStyle) + ]); + + // Window signals + global.get_window_actors().forEach(function(win) { + // An irrelevant window actor ('Gnome-shell') produces an error when the signals are + // disconnected, therefore do not add signals to it. + if (win.get_meta_window().get_wm_class() !== 'Gnome-shell') + this._onWindowActorAdded(null, win); + }, this); + + if (this._settings.get_enum('transparency-mode') === TransparencyMode.ADAPTIVE) + this._enableAdaptive(); + + if (this._actor.get_stage()) + this._updateSolidStyle(); + }, + + disable: function() { + this._disableAdaptive(); + + // ensure I never double-register/inject + // although it should never happen + this._signalsHandler.removeWithLabel('transparency'); + + for (let key of this._trackedWindows.keys()) + this._trackedWindows.get(key).forEach(id => { + key.disconnect(id); + }); + this._trackedWindows.clear(); + }, + + destroy: function() { + this.disable(); + this._signalsHandler.destroy(); + this._injectionsHandler.destroy(); + }, + + _onWindowActorAdded: function(container, metaWindowActor) { + let signalIds = []; + ['allocation-changed', 'notify::visible'].forEach(s => { + signalIds.push(metaWindowActor.connect(s, Lang.bind(this, this._updateSolidStyle))); + }); + this._trackedWindows.set(metaWindowActor, signalIds); + }, + + _onWindowActorRemoved: function(container, metaWindowActor) { + if (!this._trackedWindows.get(metaWindowActor)) + return; + + this._trackedWindows.get(metaWindowActor).forEach(id => { + metaWindowActor.disconnect(id); + }); + this._trackedWindows.delete(metaWindowActor); + this._updateSolidStyle(); + }, + + _updateSolidStyle: function() { + if (this._dockIsNear() || this._panelIsNear()) { + this._actor.set_style(this._opaque_style); + if (this._panel._updateSolidStyle && this._adaptiveEnabled) + this._panel._addStyleClassName('solid'); + } + else { + this._actor.set_style(this._transparent_style); + if (this._panel._updateSolidStyle && this._adaptiveEnabled) + this._panel._removeStyleClassName('solid'); + } + }, + + _dockIsNear: function() { + if (this._dockActor.has_style_pseudo_class('overview')) + return false; + /* Get all the windows in the active workspace that are in the primary monitor and visible */ + let activeWorkspace = global.screen.get_active_workspace(); + let dash = this._dash; + let windows = activeWorkspace.list_windows().filter(function(metaWindow) { + return metaWindow.get_monitor() === dash._monitorIndex && + metaWindow.showing_on_its_workspace() && + metaWindow.get_window_type() != Meta.WindowType.DESKTOP; + }); + + /* Check if at least one window is near enough to the panel. + * If the dock is hidden, we need to account for the space it would take + * up when it slides out. This is avoid an ugly transition. + * */ + let factor = 0; + if (!this._settings.get_boolean('dock-fixed') && + this._dock.getDockState() == Dock.State.HIDDEN) + factor = 1; + let [leftCoord, topCoord] = this._actor.get_transformed_position(); + let threshold; + if (this._position === St.Side.LEFT) + threshold = leftCoord + this._actor.get_width() * (factor + 1); + else if (this._position === St.Side.RIGHT) + threshold = leftCoord - this._actor.get_width() * factor; + else if (this._position === St.Side.TOP) + threshold = topCoord + this._actor.get_height() * (factor + 1); + else + threshold = topCoord - this._actor.get_height() * factor; + + let scale = St.ThemeContext.get_for_stage(global.stage).scale_factor; + let isNearEnough = windows.some(Lang.bind(this, function(metaWindow) { + let coord; + if (this._position === St.Side.LEFT) { + coord = metaWindow.get_frame_rect().x; + return coord < threshold + 5 * scale; + } + else if (this._position === St.Side.RIGHT) { + coord = metaWindow.get_frame_rect().x + metaWindow.get_frame_rect().width; + return coord > threshold - 5 * scale; + } + else if (this._position === St.Side.TOP) { + coord = metaWindow.get_frame_rect().y; + return coord < threshold + 5 * scale; + } + else { + coord = metaWindow.get_frame_rect().y + metaWindow.get_frame_rect().height; + return coord > threshold - 5 * scale; + } + })); + + return isNearEnough; + }, + + _panelIsNear: function() { + if (!this._panel._updateSolidStyle || + this._settings.get_enum('transparency-mode') !== TransparencyMode.ADAPTIVE) + return false; + + if (this._panel.actor.has_style_pseudo_class('overview') || !Main.sessionMode.hasWindows) { + this._panel._removeStyleClassName('solid'); + return false; + } + + /* Get all the windows in the active workspace that are in the + * primary monitor and visible */ + let activeWorkspace = global.screen.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._panel.actor.get_transformed_position(); + let panelBottom = panelTop + this._panel.actor.get_height(); + let scale = St.ThemeContext.get_for_stage(global.stage).scale_factor; + let isNearEnough = windows.some(Lang.bind(this._panel, function(metaWindow) { + let verticalPosition = metaWindow.get_frame_rect().y; + return verticalPosition < panelBottom + 5 * scale; + })); + + return isNearEnough; + }, + + _updateStyles: function() { + this._getAlphas(); + + this._transparent_style = + 'background-color: rgba(' + + this._backgroundColor + ', ' + this._transparentAlpha + ');' + + 'border-color: rgba(' + + this._backgroundColor + ', ' + this._transparentAlphaBorder + ');' + + 'transition-duration: ' + this._transparentTransition + 'ms;'; + + this._opaque_style = + 'background-color: rgba(' + + this._backgroundColor + ', ' + this._opaqueAlpha + ');' + + 'border-color: rgba(' + + this._backgroundColor + ',' + this._opaqueAlphaBorder + ');' + + 'transition-duration: ' + this._opaqueTransition + 'ms;'; + }, + + setColor: function(color) { + this._backgroundColor = color.red + ',' + color.green + ',' + color.blue; + this._updateStyles(); + }, + + _getAlphas: function() { + // Create dummy object and add to the uiGroup to get it to the stage + let dummyObject = new St.Bin({ + name: 'dashtodockContainer', + }); + Main.uiGroup.add_child(dummyObject); + + dummyObject.add_style_class_name('opaque'); + let themeNode = dummyObject.get_theme_node(); + this._opaqueAlpha = themeNode.get_background_color().alpha / 255; + this._opaqueAlphaBorder = themeNode.get_border_color(0).alpha / 255; + this._opaqueTransition = themeNode.get_transition_duration(); + + dummyObject.add_style_class_name('transparent'); + themeNode = dummyObject.get_theme_node(); + this._transparentAlpha = themeNode.get_background_color().alpha / 255; + this._transparentAlphaBorder = themeNode.get_border_color(0).alpha / 255; + this._transparentTransition = themeNode.get_transition_duration(); + + Main.uiGroup.remove_child(dummyObject); + + if (this._settings.get_boolean('customize-alphas')) { + this._opaqueAlpha = this._settings.get_double('max-alpha'); + this._opaqueAlphaBorder = this._opaqueAlpha / 2; + this._transparentAlpha = this._settings.get_double('min-alpha'); + this._transparentAlphaBorder = this._transparentAlpha / 2; + } + + if (this._settings.get_enum('transparency-mode') === TransparencyMode.ADAPTIVE && + this._panel._updateSolidStyle) { + themeNode = this._panel.actor.get_theme_node(); + if (this._panel.actor.has_style_class_name('solid')) { + this._opaqueTransition = themeNode.get_transition_duration(); + this._panel._removeStyleClassName('solid'); + themeNode = this._panel.actor.get_theme_node(); + this._transparentTransition = themeNode.get_transition_duration(); + this._panel._addStyleClassName('solid'); + } + else { + this._transparentTransition = themeNode.get_transition_duration(); + this._panel._addStyleClassName('solid'); + themeNode = this._panel.actor.get_theme_node(); + this._opaqueTransition = themeNode.get_transition_duration(); + this._panel._removeStyleClassName('solid'); + } + } + }, + + _enableAdaptive: function() { + if (!this._panel._updateSolidStyle || + this._dash._monitorIndex !== Main.layoutManager.primaryIndex) + return; + + this._adaptiveEnabled = true; + + function UpdateSolidStyle() { + return; + } + + this._injectionsHandler.addWithLabel('adaptive', [ + this._panel, + '_updateSolidStyle', + UpdateSolidStyle + ]); + + // Once we injected the new function, we need to disconnect and + // reconnect all window signals. + for (let key of this._panel._trackedWindows.keys()) + this._panel._trackedWindows.get(key).forEach(id => { + key.disconnect(id); + }); + + for (let win of this._panel._trackedWindows.keys()) + this._panel._onWindowActorAdded(null, win); + }, + + _disableAdaptive: function() { + if (!this._adaptiveEnabled) + return; + + this._injectionsHandler.removeWithLabel('adaptive'); + this._adaptiveEnabled = false; + + // Once we removed the injection, we need to disconnect and + // reconnect all window signals. + for (let key of this._panel._trackedWindows.keys()) + this._panel._trackedWindows.get(key).forEach(id => { + key.disconnect(id); + }); + + for (let win of this._panel._trackedWindows.keys()) + this._panel._onWindowActorAdded(null, win); + } +}); diff --git a/utils.js b/utils.js index b98fe45..9f881b7 100644 --- a/utils.js +++ b/utils.js @@ -64,7 +64,7 @@ const BasicHandler = new Lang.Class({ /** * Manage global signals */ -const GlobalSignalsHandler = new Lang.Class({ +var GlobalSignalsHandler = new Lang.Class({ Name: 'DashToDock.GlobalSignalHandler', Extends: BasicHandler, @@ -86,7 +86,7 @@ const GlobalSignalsHandler = new Lang.Class({ * Manage function injection: both instances and prototype can be overridden * and restored */ -const InjectionsHandler = new Lang.Class({ +var InjectionsHandler = new Lang.Class({ Name: 'DashToDock.InjectionsHandler', Extends: BasicHandler,