diff --git a/NEWS b/NEWS index 45b7873..e6c6a38 100644 --- a/NEWS +++ b/NEWS @@ -19,4 +19,5 @@ v3 (2012-10-06) this simplifies shell restart survival a lot v4 (????-??-??) -- feature: always open on the primary monitor on multihead (this is where the panelBox is) +- feature: always open on the primary monitor on multihead (this is where the panelBox is) (github #1) +- bugfix: use the system monospace font (github #3) diff --git a/ROADMAP b/ROADMAP index 3bc8f57..56db325 100644 --- a/ROADMAP +++ b/ROADMAP @@ -4,9 +4,9 @@ v4 - feature: copy/paste via popupmenu + shortcuts (ctrl-shift'ed) + dnd - feature: multi tabs - feature: open prefs on first start -- feature: use the system monospace font - feature: check for dependencies at startup (asked by l300lvl -- Debian distributes gir files in their own packages) - feature: detect active pid and ask before exiting the shell? (or detach it?) +- bugfix: ZSH (github #2) - code: switch to window-manager for window handling? - code: investigate if the inner-border can be retrieved diff --git a/drop-down-terminal@gs-extensions.zzrough.org/extension.js b/drop-down-terminal@gs-extensions.zzrough.org/extension.js index 0d9ebf6..d891720 100644 --- a/drop-down-terminal@gs-extensions.zzrough.org/extension.js +++ b/drop-down-terminal@gs-extensions.zzrough.org/extension.js @@ -49,6 +49,7 @@ const ANIMATION_TIME_IN_MS = 0.25; const ENABLE_ANIMATION_SETTING_KEY = "enable-animation"; const WINDOW_HEIGHT_SETTING_KEY = "window-height"; const REAL_SHORTCUT_SETTING_KEY = "real-shortcut"; +const FONT_NAME_SETTING_KEY = "monospace-font-name"; const DEBUG = false; @@ -60,6 +61,7 @@ const DropDownTerminalIface = + @@ -101,6 +103,9 @@ const DropDownTerminalExtension = new Lang.Class({ _init: function() { // retrieves the settings this._settings = Convenience.getSettings(Me.path, Me.metadata.id); + this._interfaceSettings = new Gio.Settings({ + settings_schema: Gio.SettingsSchemaSource.get_default().lookup("org.gnome.desktop.interface", false) + }); // initializes the child pid and bus proxy members early as it used to know if it has been spawn already this._childPid = null; @@ -112,9 +117,6 @@ const DropDownTerminalExtension = new Lang.Class({ // initializes if we should toggle on bus name appearance this._toggleOnBusNameAppearance = false; - - // id of the timeout used to delay the window height setting application - this._windowHeightDelayTimeoutId = null; }, enable: function() { @@ -126,6 +128,7 @@ const DropDownTerminalExtension = new Lang.Class({ // applies the settings initially this._animationEnabledSettingChanged(); this._updateWindowSize(); + this._updateFont(); this._bindShortcut(); // honours setting changes @@ -133,12 +136,16 @@ const DropDownTerminalExtension = new Lang.Class({ this._settings.connect("changed::" + ENABLE_ANIMATION_SETTING_KEY, Lang.bind(this, this._animationEnabledSettingChanged)), this._settings.connect("changed::" + WINDOW_HEIGHT_SETTING_KEY, Lang.bind(this, function() { - Convenience.throttle(250, this._updateWindowSize, this); // throttles 1s (it's an "heavy weight" setting) + Convenience.throttle(200, this._updateWindowSize, this); // throttles 200ms (it's an "heavy weight" setting) })), this._settings.connect("changed::" + REAL_SHORTCUT_SETTING_KEY, Lang.bind(this, function() { this._unbindShortcut(); this._bindShortcut(); + })), + + this._interfaceSettings.connect("changed::" + FONT_NAME_SETTING_KEY, Lang.bind(this, function() { + Convenience.throttle(200, this._updateFont, this); // throttles 200ms (it's an "heavy weight" setting) })) ]; @@ -248,6 +255,17 @@ const DropDownTerminalExtension = new Lang.Class({ return false; }, + _updateFont: function() { + this._fontName = this._interfaceSettings.get_string(FONT_NAME_SETTING_KEY); + + // applies the change dynamically if the terminal is already spawn + if (this._busProxy !== null && this._fontName !== null) { + this._busProxy.SetFontRemote(this._fontName); + } + + return false; + }, + _bindShortcut: function() { global.display.add_keybinding(REAL_SHORTCUT_SETTING_KEY, this._settings, Meta.KeyBindingFlags.NONE, Lang.bind(this, this._toggle)); @@ -390,11 +408,16 @@ const DropDownTerminalExtension = new Lang.Class({ } })); - // applies the eventual window height change + // applies the possible window height change if (this._windowHeight !== null) { this._busProxy.SetSizeSync(Main.layoutManager.primaryMonitor.width, this._windowHeight); } + // applies the possible font name + if (this._fontName !== null) { + this._busProxy.SetFontSync(this._fontName); + } + // initial toggling if explicitely asked to, since we we can also be called on a shell restart // (the shell reexec itself thus not letting the extensions a chance to properly shut down) if (this._toggleOnBusNameAppearance) { diff --git a/drop-down-terminal@gs-extensions.zzrough.org/terminal.js b/drop-down-terminal@gs-extensions.zzrough.org/terminal.js index 05f68a0..f9d0542 100644 --- a/drop-down-terminal@gs-extensions.zzrough.org/terminal.js +++ b/drop-down-terminal@gs-extensions.zzrough.org/terminal.js @@ -30,9 +30,10 @@ const DropDownTerminalIface = - - - + + + + @@ -148,10 +149,21 @@ const DropDownTerminal = new Lang.Class({ }, SetSize: function(width, height) { - // update the window height in the UI thread since this callback happens in the gdbus thread - Gdk.threads_add_idle(GLib.PRIORITY_DEFAULT_IDLE, Lang.bind(this, function() { - this._window.resize(width, height); - })); + let [currentWidth, currentHeight] = this._window.get_size(); + + if (width != currentWidth || height != currentHeight) { + Gdk.threads_add_idle(GLib.PRIORITY_DEFAULT_IDLE, Lang.bind(this, function() { + this._window.resize(width, height); + })); + } + }, + + SetFont: function(font) { + if (font != this._terminal.get_font().to_string()) { + Gdk.threads_add_idle(GLib.PRIORITY_DEFAULT_IDLE, Lang.bind(this, function() { + this._terminal.set_font_from_string(font); + })); + } }, IsOpened: function() {