From 65fa152b9d17d1e07a8097e256bdad23ddf36cf3 Mon Sep 17 00:00:00 2001 From: Pavel Shabardin Date: Sat, 4 Jan 2020 17:51:35 +0400 Subject: [PATCH] [dist] --- dist/extension.js | 133 +++++++++++------- dist/gschemas.compiled | Bin 2508 -> 2620 bytes dist/prefs.gtkbuilder | 95 +++++++++++++ dist/prefs.gtkbuilder~ | 97 ++++++++++++- dist/prefsWindow.js | 125 ++++++++-------- ...pro.bigbn.drop-down-terminal-x.gschema.xml | 8 ++ dist/terminal.js | 99 +++++++------ 7 files changed, 402 insertions(+), 155 deletions(-) diff --git a/dist/extension.js b/dist/extension.js index 9db07d4..4a638df 100644 --- a/dist/extension.js +++ b/dist/extension.js @@ -76,14 +76,26 @@ const NEXT_TAB_SHORTCUT_SETTING_KEY = 'next-tab-shortcut'; const CLOSE_TAB_SHORTCUT_SETTING_KEY = 'close-tab-shortcut'; const INCREASE_TEXT_SHORTCUT_SETTING_KEY = 'increase-text-shortcut'; const DECREASE_TEXT_SHORTCUT_SETTING_KEY = 'decrease-text-shortcut'; +const FULLSCREEN_SHORTCUT_SETTING_KEY = 'toggle-fullscreen-shortcut'; const PRIMARY_MONITOR_SETTING_KEY = 'primary-monitor'; const TOP_EDGE = 0; const LEFT_EDGE = 1; const RIGHT_EDGE = 2; const BOTTOM_EDGE = 3; -const SHELL_VERSION = 10 * parseFloat('0.' + Config.PACKAGE_VERSION.split('.').join('')).toFixed(10); // dbus interface +const SHELL_VERSION = 10 * parseFloat('0.' + Config.PACKAGE_VERSION.split('.').join('')).toFixed(10); +const console = { + log: function () { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + print(args.map(function (msg) { + return String(msg); + }).join('\t')); + } // dbus interface -const DropDownTerminalXIface = " \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n "; // helper to only log in debug mode +}; +const DropDownTerminalXIface = " \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n "; // helper to only log in debug mode function debug(text) { DEBUG && log('[DDT] ' + text); @@ -185,8 +197,7 @@ const DropDownTerminalXExtension = new Lang.Class({ var _this = this; // initializes the child pid and bus proxy members early as it used to know if it has been spawn already - this._childPid = null; - log(_('Tabs') + '@'); // initializes other members used to toggle the terminal + this._childPid = null; // initializes other members used to toggle the terminal this._busProxy = null; this._windowActor = null; @@ -210,7 +221,13 @@ const DropDownTerminalXExtension = new Lang.Class({ this._panelScrollEventHandlerId = Main.panel.actor.connect('scroll-event', Lang.bind(this, this._panelScrolled)); const busRun = function (actionName) { - return _this._busProxy && _this._busProxy[actionName](); + var _this$_busProxy; + + for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { + args[_key2 - 1] = arguments[_key2]; + } + + return _this._busProxy && (_this$_busProxy = _this._busProxy)[actionName].apply(_this$_busProxy, args); }; this.bindings = [[TOGGLE_SHORTCUT_SETTING_KEY, this._toggle, true], [NEW_TAB_SHORTCUT_SETTING_KEY, function () { @@ -225,6 +242,12 @@ const DropDownTerminalXExtension = new Lang.Class({ return busRun('IncreaseFontSizeRemote'); }], [DECREASE_TEXT_SHORTCUT_SETTING_KEY, function () { return busRun('DecreaseFontSizeRemote'); + }], [FULLSCREEN_SHORTCUT_SETTING_KEY, function () { + _this.fullscreenEnabled = !_this.fullscreenEnabled; + + _this._updateWindowGeometry(_this.fullscreenEnabled); + + busRun('ToggleFullscreenRemote', _this.fullscreenEnabled); }]]; // honours setting changes this._settingChangedHandlerIds = [this._settings.connect('changed::' + ENABLE_TOGGLE_ON_SCROLL_SETTING_KEY, Lang.bind(this, this._updateToggleOnScroll))].concat(_toConsumableArray([ENABLE_ANIMATION_SETTING_KEY, OPENING_ANIMATION_TIME_SETTING_KEY, CLOSING_ANIMATION_TIME_SETTING_KEY].map(function (key) { @@ -236,11 +259,8 @@ const DropDownTerminalXExtension = new Lang.Class({ key = _ref2[0], message = _ref2[1]; - log(key, message); return _this._settings.connect('changed::' + key, function () { if (_this._windowActor !== null) { - log(message); - _this._windowActor.remove_clip(); Convenience.throttle(100, _this, _this._updateWindowGeometry); // throttles at 10Hz (it's an "heavy weight" setting) @@ -300,7 +320,7 @@ const DropDownTerminalXExtension = new Lang.Class({ this._display.get_tab_list = Lang.bind(this, function (type, screen, workspace) { let windows = Lang.bind(this._display, oldGetTabList)(type, screen, workspace); windows = windows.filter(function (win) { - return win.get_wm_class() != TERMINAL_WINDOW_WM_CLASS; + return win.get_wm_class() !== TERMINAL_WINDOW_WM_CLASS; }); return windows; }); @@ -314,7 +334,7 @@ const DropDownTerminalXExtension = new Lang.Class({ const windowActors = global.get_window_actors(); for (const i in windowActors) { - if (windowActors[i].get_meta_window().get_wm_class() == TERMINAL_WINDOW_WM_CLASS) { + if (windowActors[i].get_meta_window().get_wm_class() === TERMINAL_WINDOW_WM_CLASS) { this._setWindowActor(windowActors[i]); break; @@ -350,17 +370,14 @@ const DropDownTerminalXExtension = new Lang.Class({ // the extension already rebinds with the terminal on enable, so we just need not to quit the terminal // if the screen is getting locked - const lockingScreen = Main.sessionMode.currentMode == 'unlock-dialog' || // unlock-dialog == shield/curtain (before lock-screen w/ gdm) - Main.sessionMode.currentMode == 'lock-screen'; // lock-screen == lock screen (after unlock-dialog or w/o gdm) + const lockingScreen = Main.sessionMode.currentMode === 'unlock-dialog' || // unlock-dialog == shield/curtain (before lock-screen w/ gdm) + Main.sessionMode.currentMode === 'lock-screen'; // lock-screen == lock screen (after unlock-dialog or w/o gdm) // checks if there is not an instance of a previous child, mainly because it survived a shell restart // (the shell reexec itself thus not letting the extensions a chance to properly shut down) - if (this._childPid === null && this._busProxy !== null) { - this._childPid = this._busProxy.Pid; - } // quit and/or kill the child process if it exists, except if we are going to the lock + if (this._childPid === null && this._busProxy !== null) this._childPid = this._busProxy.Pid; // quit and/or kill the child process if it exists, except if we are going to the lock // screen, as the user will obviously unlock and he expects his terminal back - if (!lockingScreen && this._childPid !== null) { try { // starts by asking to quit gracefully @@ -371,7 +388,7 @@ const DropDownTerminalXExtension = new Lang.Class({ this._childPid = null; } catch (e) { - debug('error asking the terminal to quit gracefully (cause: ' + e.name + ' - ' + e.message + ')'); // quiting failed, so mark it and kills the process + console.log('error asking the terminal to quit gracefully (cause: ' + e.name + ' - ' + e.message + ')'); // quiting failed, so mark it and kills the process this._quitingChild = false; @@ -405,7 +422,7 @@ const DropDownTerminalXExtension = new Lang.Class({ this._display = null; }, _toggle: function () { - debug('asked to toggle'); // checks if there is not an instance of a previous child, mainly because it survived a shell restart + console.log('Asked to toggle'); // checks if there is not an instance of a previous child, mainly because it survived a shell restart // (the shell reexec itself thus not letting the extensions a chance to properly shut down) if (this._childPid === null && this._busProxy !== null) { @@ -414,7 +431,7 @@ const DropDownTerminalXExtension = new Lang.Class({ if (this._childPid === null) { - debug('forking and connecting to the terminal dbus interface'); + console.log('forking and connecting to the terminal dbus interface'); this._toggleOnBusNameAppearance = true; this._forkChild(); @@ -422,7 +439,7 @@ const DropDownTerminalXExtension = new Lang.Class({ // the "monitors-changed" signal - this._updateWindowGeometry(); // the bus proxy might not be ready, in this case we will be called later once the bus name appears + this._updateWindowGeometry(this.fullscreenEnabled); // the bus proxy might not be ready, in this case we will be called later once the bus name appears if (this._busProxy !== null) { @@ -433,7 +450,6 @@ const DropDownTerminalXExtension = new Lang.Class({ let targetY = this._windowY; let targetX = this._windowX; const animationTime = this._shouldAnimateWindow() ? this._closingAnimationTimeMillis / 1000.0 : 0; - const scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor; switch (terminalPosition) { case LEFT_EDGE: @@ -497,16 +513,14 @@ const DropDownTerminalXExtension = new Lang.Class({ if (monitorIndex === -1) monitorIndex = screenProxy.get_primary_monitor(); return Main.layoutManager.monitors[monitorIndex] || Main.layoutManager.primaryMonitor; }, - _updateWindowGeometry: function () { - const screenProxy = global.screen || global.display; + _updateWindowGeometry: function (fullscreen) { + console.log('Updating window geometry', fullscreen); const terminalPosition = this._settings.get_enum(TERMINAL_POSITION_SETTING_KEY); const monitor = this._getCurrentMonitor(); // computes the window geometry except the height - const panelBox = Main.layoutManager.panelBox; - const sizeSpec = this._settings.get_string(TERMINAL_SIZE_SETTING_KEY); const leftPaddingSpec = this._settings.get_string(TERMINAL_LEFT_PADDING_SETTING_KEY); @@ -517,7 +531,6 @@ const DropDownTerminalXExtension = new Lang.Class({ const bottomPaddingSpec = this._settings.get_string(TERMINAL_BOTTOM_PADDING_SETTING_KEY); - const panelHeight = panelBox.anchor_y === 0 ? Main.layoutManager.panelBox.height : 0; const scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor; const workarea = Main.layoutManager.getWorkAreaForMonitor(monitor.index); const x1 = workarea.x / scaleFactor; @@ -537,29 +550,35 @@ const DropDownTerminalXExtension = new Lang.Class({ switch (terminalPosition) { case LEFT_EDGE: - this._windowX = x1; - this._windowY = y1; - this._windowWidth = this._evaluateSizeSpec(monitor, sizeSpec, false); - this._windowHeight = screenHeight; - break; + { + this._windowX = x1; + this._windowY = y1; + this._windowWidth = this._evaluateSizeSpec(monitor, sizeSpec, false); + this._windowHeight = screenHeight; + break; + } case RIGHT_EDGE: - const width = this._evaluateSizeSpec(monitor, sizeSpec, false); - - this._windowX = x2 - width; - this._windowY = y1; - this._windowWidth = width; - this._windowHeight = screenHeight; - break; + { + const width = this._evaluateSizeSpec(monitor, sizeSpec, false); + + this._windowX = x2 - width; + this._windowY = y1; + this._windowWidth = width; + this._windowHeight = screenHeight; + break; + } case BOTTOM_EDGE: - const height = this._evaluateSizeSpec(monitor, sizeSpec, true); - - this._windowX = x1; - this._windowY = y2 - height; - this._windowWidth = screenWidth; - this._windowHeight = height; - break; + { + const height = this._evaluateSizeSpec(monitor, sizeSpec, true); + + this._windowX = x1; + this._windowY = y2 - height; + this._windowWidth = screenWidth; + this._windowHeight = height; + break; + } default: case TOP_EDGE: @@ -573,13 +592,19 @@ const DropDownTerminalXExtension = new Lang.Class({ this._windowX = this._windowX + leftPadding; this._windowY = this._windowY + topPadding; this._windowWidth = this._windowWidth - leftPadding - rightPadding; - this._windowHeight = this._windowHeight - topPadding - bottomPadding; // applies the change dynamically if the terminal is already spawn + this._windowHeight = this._windowHeight - topPadding - bottomPadding; + + if (fullscreen) { + this._windowX = 0; + this._windowY = 0; + this._windowWidth = screenWidth; + this._windowHeight = screenHeight; + } // applies the change dynamically if the terminal is already spawn + if (this._busProxy !== null && this._windowHeight !== null) { this._busProxy.SetGeometryRemote(this._windowX, this._windowY, this._windowWidth, this._windowHeight); - } else if (this._windowActor != null) { - this._windowActor.set_position(this._windowX, this._windowY); - } + } else if (this._windowActor != null) this._windowActor.set_position(this._windowX, this._windowY); return false; }, @@ -687,7 +712,7 @@ const DropDownTerminalXExtension = new Lang.Class({ const args = ['gjs', GLib.build_filenamev([Me.path, 'terminal.js']), Me.path]; // forks the process - debug("forking '" + args.join(' ') + "'"); + console.log("forking '" + args.join(' ') + "'"); let success, pid; try { @@ -706,7 +731,7 @@ const DropDownTerminalXExtension = new Lang.Class({ err.message = _('gjs not found in PATH'); } - debug('failed to fork the terminal script (' + err.code + ', ' + err.message + ')'); // The exception from gjs contains an error string like: + console.log('failed to fork the terminal script (' + err.code + ', ' + err.message + ')'); // The exception from gjs contains an error string like: // Error invoking GLib.spawn_command_line_async: Failed to // execute child process "foo" (No such file or directory) // We are only interested in the part in the parentheses. (And @@ -741,7 +766,7 @@ const DropDownTerminalXExtension = new Lang.Class({ GLib.spawn_close_pid(pid); // check the exit status if (!this._quitingChild && !this._killingChild) { - debug('terminal exited abruptly with status ' + status); + console.log('terminal exited abruptly with status ' + status); Main.notifyError(_('Drop Down Terminal ended abruptly'), _('You can activate the debug mode to nail down the issue')); } // forgets the child and the bus proxy @@ -760,7 +785,7 @@ const DropDownTerminalXExtension = new Lang.Class({ name = _ref14[0], cause = _ref14[1]; - debug('failure reported by the terminal: ' + cause); + console.log('failure reported by the terminal: ' + cause); if (name === 'ForkUserShellFailed') { Main.notifyError(_('Drop Down Terminal failed to start'), _('The user shell could not be spawn in the terminal.') + '\n\n' + _('You can activate the debug mode to nail down the issue')); @@ -783,6 +808,8 @@ const DropDownTerminalXExtension = new Lang.Class({ return _this3._bindShortcut(key, action); }); + + _this3._busProxy && _this3._busProxy.ToggleFullscreenRemote(_this3.fullscreenEnabled); } else { _this3.temporaryBindings.forEach(function (_ref19) { let _ref20 = _slicedToArray(_ref19, 2), diff --git a/dist/gschemas.compiled b/dist/gschemas.compiled index 68583a3d827c070d07c75bf86ea5dd6e90908c2d..9c6137bbbd6e067380079437113e7d6501a92919 100644 GIT binary patch literal 2620 zcmai0TWl0n7(NwRg#s;?mKFg)F4;9qFMtUorD_dYwGWMgsYXm^cTRT)X6KA&W=bnc z>V+5;9yB}Wn zyMREewwznY`E8C?f#sQNgWjlT9X80}Gs?LssX4wEJO~ta{C<)? z^>X+l;4z?K+Y58(Q*%AXz~ey8KSy%(sX2ZEd=@x(Pu~&x)D7^@gMS3XU#~n#pL!Ym zOW-TOr>$>Xq))vBej|e41WY`Cu%6$Sx)%N#@cqE(snefxJT=!p0Nw*U-TuX1`qbR- z2zU%=+&wc*pLzxS=~Hu_3GkP|2mPOD`qW(KPvB`_&%1T!=~Fks7q=ou zfL^tCK7HzX_$}a7z)M@6>!D9gKLfUaGkup|rBBWH+zZ|bbo~19XY{GL{y}gN@L!vn zpij;CjDZgU{ZD=MCw*$>!!hvt!1$Z3hv`#u{AuvlK;^tp^Spcm9z>EKUUcSrj;H2& z0`N)T;pV!2`qW&{B={E~zk1it^r@K-m%!cgg!uczw_52_FNEI@9ss)D-sjM#W}J)Q z67XH=fXO%N1@Onfhk&W0k8I_5YQFb4cpPxfop_x-HTN|Eo&+xZvHm^!)aG1(r+`!2 zFZ@QIn(Lea*Wf_U+wjCr`qW%!BX|XHVEWq^=~FL--vMTA3G-TcUe4Cmup7ELPhw1R zWpdek97d{SVU+%XeJ9pFZj}_gas5?S*IJ#Q%aw_5)1KV+2 zzaTmT6hW*Z&~o?&(+Tt1J~!cU5&n^d0W=#)n2D4}KVh^na*jpC^ z?5pg%>jCy-_Gk809Cc9*O+MBkQnSZX`F-${EWmGv#3*yE<%fEtT@q#f9w_hj9jQIn zm!ga)gqcx0&SqWzW+!%bJmfR6?WO0nx`IH3ZZ$u5so?4w_zzxb)?m(Dx`s#jIYpT< zEccl63nj|P$81W8BGfOb!^$Z!gTpL8@c*5Y>Oszr zTAm!19-l?O)2tr PwQ|zqE6us!J8}I7g-<@x literal 2508 zcmZuzYiJx*7`?GgY?C(GK9V+CV``eRE1f)Sg%r|=0kPHm2-->%EzZtNcBh${JKmYe z!`f0GMbs3k2o_sJe~3X*6HsiyAEBV;hk;TMgHllt+v0<$e@a2tb7p5ZNt=PgIeYG7 zzI*R?zu5;L)0M4zp-7(1;DMq}-;#J0;O^tvRWjR}#9lE99$zU$WxWsuJYTJbA^OA& z_*=kNvMp=pvR<31q_3HB#M44cxwfY}8V3uJZjDI@zGnr1>0(rYiCY0qTS7H-%_6LU zUJIlWtOKtHHUbDsYzA&ma0j@ACg?kXW?(CD7toS`F`c=%b9XJ6>uV6hVgh^~_`yB= z34Q7{@GpSB19E$QkA3P*@aMtTfV!^dSFk_zI{2wdyc6g?J!I0SPQmX0-wRaydm>Ap zn)CF74**{@zJ8TH^?LYuunUY$o&B0VHRm}7J`Vi-!P|}Wsn^0k1%4N}^yb66=u>lD zXTj6JLk(5^^r`93f&T$6|FP{o`qZ`Xc_@{@i#wm|rB7W0KLxG__R2%m^r`7LgIj@8 zj!-j4(%{bk@6}7w>`%>g&46bCqiO#y^r^XTKZCa;8K!n${*690{Vwo6V0G)`574LP zdI!K+;Hh`2=IB$`!yg4719tp3e-C|X?%PT58DMJ9M${{tEk3*TJ6ze-6C#Q|EU2)ZCvL@GNk!{hLGdsd>Iv!1F-Iub-Z$ zPfdRnE?Np0uRZr8eQM6%3_b{mzg~WVJ~h`n3O)iHy|3>CeQNeU34ROMv2|vEJ~h`h z0sa^`eC7KW=u>ZiKMiL6FfBt_dSIbYjD}i}mnt-(q%w8)E8Er8SWox;PS}Go5(S7M ztp^!bhDsZ@RA5UFlZteZDHoco3`6N^zHXYfmt$+EkK%(azOsh3P|x1*8WB(5XAOp; zI-Wf+lyn?TdYX(vpV6eV8OzhN4#JeV90+a2UYtK}cOxgXHCK9eC>7YWiheRq_pp?( z7;XjULmYwT%fL=d^kzL2=_q43u)UmC9;1b}i|MW>?Y6i4o-N%k>zPP*lKsltW*oB> z7`l&{7Oe+i#J>k^72p6uU4?Occvq>O;+W!E$=4&j#WsL-7$qXE#jL%o(OUr4Yko6u zeMKX{`pnvU8^HCk?$!Y)k8y2A8phv(X7C1pb)9vZHGLD%0I*)G$kU7{;K>@&b#>2# z8Si811GBJ~`=u|q`+N%g0b)#r_>4t?-=4xFb}k=^0%I!l#wi0O3M-K)=`lUZWIQJ1 zl5C0dq&Ti7PLy)a1@^Oe;jWI3B-6?b4zjA8ilsapl*-B}8F?nw;z-q^#}AehWU{(3 zw788ywRFT!+#V|33w&K!o-w95*0AN^Zn6{dru^0rU*Bc&pLvB0zUcxi&6`o20q>Y+ zjoi?8q2Hr60WUW97X-yneB!l_~{&tusE_ Xo70;KQK}!2$wg~f%W+EglVkq}O + + + + + + + + @@ -1053,6 +1061,93 @@ 1 + + + True + False + 0 + in + + + True + False + 12 + 12 + 12 + 12 + + + True + False + True + True + + + True + False + Toggle + 0.89999997615814209 + + + 0 + 0 + + + + + True + False + + + True + True + fullscreen-shortcut-liststore + False + 0 + + + + + + + + 1 + 0 + + + + + True + False + + + 2 + 0 + + + + + + + + + True + False + 6 + 6 + Maximize + + + + + + + + False + True + 2 + + 1 diff --git a/dist/prefs.gtkbuilder~ b/dist/prefs.gtkbuilder~ index 31efc6f..f11a330 100644 --- a/dist/prefs.gtkbuilder~ +++ b/dist/prefs.gtkbuilder~ @@ -46,6 +46,14 @@ + + + + + + + + @@ -526,7 +534,7 @@ - + Scroll on output True True @@ -1053,6 +1061,93 @@ 1 + + + True + False + 0 + in + + + True + False + 12 + 12 + 12 + 12 + + + True + False + True + True + + + True + False + Toggle + 0.89999997615814209 + + + 0 + 0 + + + + + True + False + + + True + True + fullscreen-shortcut-liststore + False + 0 + + + + + + + + 1 + 0 + + + + + True + False + + + 2 + 0 + + + + + + + + + True + False + 6 + 6 + Fullscreen + + + + + + + + False + True + 2 + + 1 diff --git a/dist/prefsWindow.js b/dist/prefsWindow.js index e8be2e2..9b0b008 100644 --- a/dist/prefsWindow.js +++ b/dist/prefsWindow.js @@ -61,6 +61,8 @@ const CLOSE_TAB_SHORTCUT_SETTING_KEY = 'close-tab-shortcut' const INCREASE_TEXT_SHORTCUT_SETTING_KEY = 'increase-text-shortcut' const DECREASE_TEXT_SHORTCUT_SETTING_KEY = 'decrease-text-shortcut' +const FULLSCREEN_SHORTCUT_SETTING_KEY = 'toggle-fullscreen-shortcut' + const PRIMARY_MONITOR_SETTING_KEY = 'primary-monitor' const MULTI_MONITOR_MODE_SETTING_KEY = 'multi-monitor-mode' @@ -90,13 +92,13 @@ var DropDownTerminalSettingsWidget = new GObject.Class({ this._settings = this._convenience.getSettings(path, metadata.id) // creates the ui builder and add the main resource file - let uiFilePath = path + '/prefs.gtkbuilder' - let builder = this.builder = new Gtk.Builder() + const uiFilePath = path + '/prefs.gtkbuilder' + const builder = this.builder = new Gtk.Builder() if (builder.add_from_file(uiFilePath) === 0) { log('could not load the ui file: %s'.format(uiFilePath)) - let label = new Gtk.Label({ + const label = new Gtk.Label({ label: _('Could not load the preferences UI file'), vexpand: true }) @@ -104,33 +106,33 @@ var DropDownTerminalSettingsWidget = new GObject.Class({ this.pack_start(label, true, true, 0) } else { // gets the interesting builder objects - let mainNotebook = builder.get_object('main-notebook') - let enableAnimationCheckButton = builder.get_object('enable-animation-checkbutton') - let openingAnimationTimeSpinButton = builder.get_object('opening-animation-time-spinbutton') - let closingAnimationTimeSpinButton = builder.get_object('closing-animation-time-spinbutton') - let transparentTerminalCheckButton = builder.get_object('transparent-terminal-checkbutton') - let scrollbarVisibleCheckButton = builder.get_object('scrollbar-visible-checkbutton') - let scrollOnOutputCheckButton = builder.get_object('scroll-on-output-checkbutton') - let terminalSizeEntry = builder.get_object('terminal-size-entry') - let terminalSizeResetButton = builder.get_object('terminal-size-reset-button') - let terminalLeftPaddingEntry = builder.get_object('terminal-left-padding-entry') - let terminalLeftPaddingResetButton = builder.get_object('terminal-left-padding-reset-button') - let terminalRightPaddingEntry = builder.get_object('terminal-right-padding-entry') - let terminalRightPaddingResetButton = builder.get_object('terminal-right-padding-reset-button') - let terminalTopPaddingEntry = builder.get_object('terminal-top-padding-entry') - let terminalTopPaddingResetButton = builder.get_object('terminal-top-padding-reset-button') - let terminalBottomPaddingEntry = builder.get_object('terminal-bottom-padding-entry') - let terminalBottomPaddingResetButton = builder.get_object('terminal-bottom-padding-reset-button') - let transparencyLevelSpinButton = builder.get_object('transparency-level-spinbutton') - let enableToggleOnScrollCheckButton = builder.get_object('enable-toggle-on-scroll-checkbutton') - let foregroundColorResetButton = builder.get_object('foreground-color-reset-button') - let backgroundColorResetButton = builder.get_object('background-color-reset-button') - let positionComboBox = builder.get_object('position-combobox') - let cursorComboBox = builder.get_object('cursor-combobox') - let enableAudibleBellCheckButton = builder.get_object('enable-audible-bell-checkbutton') - let enableTabsCheckButton = builder.get_object('enable-tabs-checkbutton') - let enableHideOnUnfocusButton = builder.get_object('hide-on-unfocus-checkbutton') - let enableHideOnEscapeButton = builder.get_object('hide-on-escape-checkbutton') + const mainNotebook = builder.get_object('main-notebook') + const enableAnimationCheckButton = builder.get_object('enable-animation-checkbutton') + const openingAnimationTimeSpinButton = builder.get_object('opening-animation-time-spinbutton') + const closingAnimationTimeSpinButton = builder.get_object('closing-animation-time-spinbutton') + const transparentTerminalCheckButton = builder.get_object('transparent-terminal-checkbutton') + const scrollbarVisibleCheckButton = builder.get_object('scrollbar-visible-checkbutton') + const scrollOnOutputCheckButton = builder.get_object('scroll-on-output-checkbutton') + const terminalSizeEntry = builder.get_object('terminal-size-entry') + const terminalSizeResetButton = builder.get_object('terminal-size-reset-button') + const terminalLeftPaddingEntry = builder.get_object('terminal-left-padding-entry') + const terminalLeftPaddingResetButton = builder.get_object('terminal-left-padding-reset-button') + const terminalRightPaddingEntry = builder.get_object('terminal-right-padding-entry') + const terminalRightPaddingResetButton = builder.get_object('terminal-right-padding-reset-button') + const terminalTopPaddingEntry = builder.get_object('terminal-top-padding-entry') + const terminalTopPaddingResetButton = builder.get_object('terminal-top-padding-reset-button') + const terminalBottomPaddingEntry = builder.get_object('terminal-bottom-padding-entry') + const terminalBottomPaddingResetButton = builder.get_object('terminal-bottom-padding-reset-button') + const transparencyLevelSpinButton = builder.get_object('transparency-level-spinbutton') + const enableToggleOnScrollCheckButton = builder.get_object('enable-toggle-on-scroll-checkbutton') + const foregroundColorResetButton = builder.get_object('foreground-color-reset-button') + const backgroundColorResetButton = builder.get_object('background-color-reset-button') + const positionComboBox = builder.get_object('position-combobox') + const cursorComboBox = builder.get_object('cursor-combobox') + const enableAudibleBellCheckButton = builder.get_object('enable-audible-bell-checkbutton') + const enableTabsCheckButton = builder.get_object('enable-tabs-checkbutton') + const enableHideOnUnfocusButton = builder.get_object('hide-on-unfocus-checkbutton') + const enableHideOnEscapeButton = builder.get_object('hide-on-escape-checkbutton') this._foregroundColorButton = builder.get_object('foreground-color-button') this._backgroundColorButton = builder.get_object('background-color-button') @@ -142,6 +144,7 @@ var DropDownTerminalSettingsWidget = new GObject.Class({ this._makeShortcutEdit('close-tab-shortcut-treeview', 'close-tab-shortcut-liststore', CLOSE_TAB_SHORTCUT_SETTING_KEY) this._makeShortcutEdit('increase-text-shortcut-treeview', 'increase-text-shortcut-liststore', INCREASE_TEXT_SHORTCUT_SETTING_KEY) this._makeShortcutEdit('decrease-text-shortcut-treeview', 'decrease-text-shortcut-liststore', DECREASE_TEXT_SHORTCUT_SETTING_KEY) + this._makeShortcutEdit('fullscreen-shortcut-treeview', 'fullscreen-shortcut-liststore', FULLSCREEN_SHORTCUT_SETTING_KEY) this._initMonitorWidgets() this._initTabsPositionWidgets() @@ -155,7 +158,7 @@ var DropDownTerminalSettingsWidget = new GObject.Class({ // gives a hint on invalid window height input (does not prevent from writing a wrong value) terminalSizeEntry.connect('changed', () => this._validatePaddingValue(terminalSizeEntry, true)); - [ terminalLeftPaddingEntry, + [terminalLeftPaddingEntry, terminalRightPaddingEntry, terminalTopPaddingEntry, terminalBottomPaddingEntry @@ -182,7 +185,7 @@ var DropDownTerminalSettingsWidget = new GObject.Class({ this._settings.bind(SCROLLBAR_VISIBLE_SETTING_KEY, scrollbarVisibleCheckButton, 'active', Gio.SettingsBindFlags.DEFAULT) this._settings.bind(SCROLL_ON_OUTPUT_SETTING_KEY, scrollOnOutputCheckButton, 'active', Gio.SettingsBindFlags.DEFAULT) - + // binds the tabs state setting this._settings.bind(ENABLE_TABS_SETTING_KEY, enableTabsCheckButton, 'active', Gio.SettingsBindFlags.DEFAULT) @@ -275,19 +278,19 @@ var DropDownTerminalSettingsWidget = new GObject.Class({ }, _makeShortcutEdit (widgetId, storeId, settingKey, defaultValue) { - let view = this.builder.get_object(widgetId) - let store = this.builder.get_object(storeId) - let renderer = new Gtk.CellRendererAccel({ editable: true }) - let column = new Gtk.TreeViewColumn() - let iter = store.append() - - let updateShortcutRow = (accel) => { - let [key, mods] = accel ? Gtk.accelerator_parse(accel) : [0, 0] + const view = this.builder.get_object(widgetId) + const store = this.builder.get_object(storeId) + const renderer = new Gtk.CellRendererAccel({ editable: true }) + const column = new Gtk.TreeViewColumn() + const iter = store.append() + + const updateShortcutRow = (accel) => { + const [key, mods] = accel ? Gtk.accelerator_parse(accel) : [0, 0] store.set(iter, [COLUMN_KEY, COLUMN_MODS], [key, mods]) } renderer.connect('accel-edited', (renderer, path, key, mods, hwCode) => { - let accel = Gtk.accelerator_name(key, mods) + const accel = Gtk.accelerator_name(key, mods) updateShortcutRow(accel) this._settings.set_strv(settingKey, [accel]) }) @@ -310,12 +313,12 @@ var DropDownTerminalSettingsWidget = new GObject.Class({ }, _validatePaddingValue (view, strictMode) { - let match = view.get_text().trim().match(/^([0-9]\d*)\s*(px|%)$/i) + const match = view.get_text().trim().match(/^([0-9]\d*)\s*(px|%)$/i) let valid = (match !== null) if (valid) { - let value = parseInt(match[1]) - let type = match[2] + const value = parseInt(match[1]) + const type = match[2] if (type.toLowerCase() === 'px') { valid = strictMode ? (value > 0) : (value >= 0) @@ -342,14 +345,14 @@ var DropDownTerminalSettingsWidget = new GObject.Class({ }, _checkCustomCommandEntry: function () { - let runCustomCommand = this._runCustomCommandCheckButton.get_active() + const runCustomCommand = this._runCustomCommandCheckButton.get_active() let error = null if (runCustomCommand) { - let customCommand = this._customCommandEntry.get_text().trim() + const customCommand = this._customCommandEntry.get_text().trim() try { - let [parsed, args] = GLib.shell_parse_argv(customCommand) + const [parsed, args] = GLib.shell_parse_argv(customCommand) if (!parsed) { error = _('no argument found') } @@ -363,11 +366,11 @@ var DropDownTerminalSettingsWidget = new GObject.Class({ }, _initMonitorWidgets () { - let monitorComboxbox = this.builder.get_object('monitor-combobox') - let monitorListstore = this.builder.get_object('monitors-liststore') - let multyMonitorCheckbox = this.builder.get_object('multi-monitor-checkbox') - let primaryMonitorIndex = this._settings.get_string(PRIMARY_MONITOR_SETTING_KEY) - let monitors = [] + const monitorComboxbox = this.builder.get_object('monitor-combobox') + const monitorListstore = this.builder.get_object('monitors-liststore') + const multyMonitorCheckbox = this.builder.get_object('multi-monitor-checkbox') + const primaryMonitorIndex = this._settings.get_string(PRIMARY_MONITOR_SETTING_KEY) + const monitors = [] monitorListstore.set(monitorListstore.append(), [0, 1], ['-1', _('Default (Primary monitor)')]) for (let i = 0, monitorNum = Gdk.Screen.get_default().get_n_monitors(); i < monitorNum; ++i) { @@ -383,9 +386,9 @@ var DropDownTerminalSettingsWidget = new GObject.Class({ monitorComboxbox.set_active_id(primaryMonitorIndex) monitorComboxbox.connect('changed', (entry) => { - let [success, iter] = monitorComboxbox.get_active_iter() + const [success, iter] = monitorComboxbox.get_active_iter() if (!success) return - let monitorIndex = monitorListstore.get_value(iter, 0) + const monitorIndex = monitorListstore.get_value(iter, 0) this._settings.set_string(PRIMARY_MONITOR_SETTING_KEY, monitorIndex) }) @@ -396,7 +399,7 @@ var DropDownTerminalSettingsWidget = new GObject.Class({ } */ - let renderer = new Gtk.CellRendererText() + const renderer = new Gtk.CellRendererText() monitorComboxbox.pack_start(renderer, true) monitorComboxbox.add_attribute(renderer, 'text', 1) @@ -404,22 +407,22 @@ var DropDownTerminalSettingsWidget = new GObject.Class({ }, _initTabsPositionWidgets () { - let comboBox = this.builder.get_object('tabs-position') - let listStore = this.builder.get_object('tabs-position-store') + const comboBox = this.builder.get_object('tabs-position') + const listStore = this.builder.get_object('tabs-position-store') - let currentPosition = this._settings.get_uint(TABS_POSITION_SETTING_KEY) + const currentPosition = this._settings.get_uint(TABS_POSITION_SETTING_KEY) comboBox.set_id_column(1) comboBox.set_active_id(String(currentPosition)) comboBox.connect('changed', (entry) => { - let [success, iter] = comboBox.get_active_iter() + const [success, iter] = comboBox.get_active_iter() if (!success) return - let index = listStore.get_value(iter, 1) + const index = listStore.get_value(iter, 1) this._settings.set_uint(TABS_POSITION_SETTING_KEY, index) }) - let renderer = new Gtk.CellRendererText() + const renderer = new Gtk.CellRendererText() comboBox.pack_start(renderer, true) comboBox.add_attribute(renderer, 'text', 0) } diff --git a/dist/pro.bigbn.drop-down-terminal-x.gschema.xml b/dist/pro.bigbn.drop-down-terminal-x.gschema.xml index ab45b89..43daa79 100644 --- a/dist/pro.bigbn.drop-down-terminal-x.gschema.xml +++ b/dist/pro.bigbn.drop-down-terminal-x.gschema.xml @@ -299,5 +299,13 @@ + + + Shortcut used to toggle fullscreen + + Shortcut used to toggle fullscreen + + + diff --git a/dist/terminal.js b/dist/terminal.js index 139f6d3..321f9fe 100644 --- a/dist/terminal.js +++ b/dist/terminal.js @@ -44,7 +44,7 @@ const Gtk = imports.gi.Gtk; const Vte = imports.gi.Vte; const Convenience = imports.convenience; // dbus interface -const DropDownTerminalXIface = " \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n "; // uimanager popup information +const DropDownTerminalXIface = " \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n "; // uimanager popup information const PopupUi = " \n \n \n \n \n \n "; // constants for the location of the extension @@ -597,6 +597,8 @@ const DropDownTerminalX = new Lang.Class({ }; }, SetGeometry: function (x, y, width, height) { + var _this6 = this; + const _this$_window$get_pos = this._window.get_position(), _this$_window$get_pos2 = _slicedToArray(_this$_window$get_pos, 2), currentX = _this$_window$get_pos2[0], @@ -607,15 +609,10 @@ const DropDownTerminalX = new Lang.Class({ currentWidth = _this$_window$get_siz6[0], currentHeight = _this$_window$get_siz6[1]; - Convenience.runInGdk(Lang.bind(this, function () { - if (x != currentX || y != currentY) { - this._window.move(x, y); - } - - if (width != currentWidth || height != currentHeight) { - this._window.resize(width, height); - } - })); + Convenience.runInGdk(function () { + if (x !== currentX || y !== currentY) _this6._window.move(x, y); + if (width !== currentWidth || height !== currentHeight) _this6._window.resize(width, height); + }); }, NewTab: function () { if (!this._window.visible) return; @@ -654,23 +651,36 @@ const DropDownTerminalX = new Lang.Class({ terminal.set_font_scale(terminal.get_font_scale() - 0.1); }, Toggle: function () { - var _this6 = this; + var _this7 = this; // update the window visibility in the UI thread since this callback happens in the gdbus thread Convenience.runInGdk(function () { - if (_this6._window.visible) { - _this6._window.hide(); + if (_this7._window.visible) { + _this7._window.hide(); - _this6._bus.emit_signal('VisibilityStateChanged', GLib.Variant.new('(b)', [_this6._window.visible])); + _this7._window.unfullscreen(); + + _this7._bus.emit_signal('VisibilityStateChanged', GLib.Variant.new('(b)', [_this7._window.visible])); } else { - _this6._window.show(); + _this7._window.show(); - _this6._bus.emit_signal('VisibilityStateChanged', GLib.Variant.new('(b)', [_this6._window.visible])); + _this7._bus.emit_signal('VisibilityStateChanged', GLib.Variant.new('(b)', [_this7._window.visible])); } return false; }); }, + // I'm unable to implement fullscreen without issues, so this option called 'maximize' in UI + // This is not full screen but anyway better than nothing + ToggleFullscreen: function (enable) { + var _this8 = this; + + if (this._window.visible) { + Convenience.runInGdk(function () { + if (enable) _this8._window.fullscreen();else _this8._window.unfullscreen(); + }); + } + }, GetVisibilityState: function () { return this._window.visible; }, @@ -760,7 +770,7 @@ const DropDownTerminalX = new Lang.Class({ return removedTab; }, _createWindow: function () { - var _this7 = this; + var _this9 = this; const screen = Gdk.Screen.get_default(); const window = new Gtk.Window({ @@ -783,17 +793,28 @@ const DropDownTerminalX = new Lang.Class({ window.connect('delete-event', function () { window.hide(); - _this7._bus.emit_signal('VisibilityStateChanged', GLib.Variant.new('(b)', [window.visible])); + _this9._bus.emit_signal('VisibilityStateChanged', GLib.Variant.new('(b)', [window.visible])); return true; }); window.connect('destroy', Gtk.main_quit); window.connect('focus-out-event', function () { - if (_this7._isHideOnUnfocusEnabled) _this7._jentlyHide(); + if (_this9._isHideOnUnfocusEnabled) _this9._jentlyHide(); return true; - }); + }); // window.connect('window-state-event', (widget, event) => { + // log('-------') + // log(event.changed_mask) + // log(event.new_window_state) + // log(widget.get_state()) + // log(Gdk.WindowState.FULLSCREEN) + // if (event.changed_mask & Gdk.WindowState.FULLSCREEN) { + // log('FIULALSI') + // this._window.inFullscreen = true + // } else this._window.inFullscreen = false + // }) + window.connect('key-press-event', function (widget, event, user_data) { - if (_this7._isHideOnEscapeEnabled) { + if (_this9._isHideOnEscapeEnabled) { const _event$get_keyval = event.get_keyval(), _event$get_keyval2 = _slicedToArray(_event$get_keyval, 2), success = _event$get_keyval2[0], @@ -802,35 +823,35 @@ const DropDownTerminalX = new Lang.Class({ const keyname = Gdk.keyval_name(keyval); // string keyname - if (keyname === 'Escape') _this7._jentlyHide(); + if (keyname === 'Escape') _this9._jentlyHide(); } }); return window; }, _createPopupAndActions: function (tab) { - var _this8 = this; + var _this10 = this; // get some shortcuts const group = tab.actionGroup; // creates the actions and fills the action group this._createAction('Copy', 'Copy', Gtk.STOCK_COPY, 'C', group, function () { - const terminal = _this8._getCurrentTerminal(); + const terminal = _this10._getCurrentTerminal(); terminal.copy_clipboard(); }); this._createAction('Paste', 'Paste', Gtk.STOCK_PASTE, 'V', group, function () { - const terminal = _this8._getCurrentTerminal(); + const terminal = _this10._getCurrentTerminal(); terminal.paste_clipboard(); }); this._createAction('Close', 'Close', Gtk.STOCK_STOP, 'D', group, function () { - if (_this8.notebook.get_n_pages() === 1) return _this8._forkUserShell(tab.terminal); + if (_this10.notebook.get_n_pages() === 1) return _this10._forkUserShell(tab.terminal); - const pageNum = _this8.notebook.page_num(tab.container); + const pageNum = _this10.notebook.page_num(tab.container); - _this8._removeTab(pageNum); + _this10._removeTab(pageNum); }); // creates the UI manager @@ -897,28 +918,26 @@ const DropDownTerminalX = new Lang.Class({ } }, showMOTR: function (terminal) { - const currentVersion = '1.3.0'; + const currentVersion = '1.4.0'; const lastVersion = this._settings.get_string(MOTR_VERSION_SETTING_KEY).trim(); if (lastVersion !== currentVersion) { terminal.feed('\n\r'); - terminal.feed(' ▒█▄░▒█ █▀▀█ ▀█░█▀ █▀▀ █▀▄▀█ █▀▀▄ █▀▀ █▀▀█   █▀█ █▀▀█ ▄█░ ▄▀▀▄ \n\r'); - terminal.feed(' ▒█▒█▒█ █░░█ ░█▄█░ █▀▀ █░▀░█ █▀▀▄ █▀▀ █▄▄▀   ░▄▀ █▄▀█ ░█░ ▀▄▄█ \n\r'); - terminal.feed(' ▒█░░▀█ ▀▀▀▀ ░░▀░░ ▀▀▀ ▀░░░▀ ▀▀▀░ ▀▀▀ ▀░▀▀   █▄▄ █▄▄█ ▄█▄ ░▄▄▀ \n\r'); + terminal.feed('░░░▒█ █▀▀█ █▀▀▄ █░░█ █▀▀█ █▀▀█ █░░█   █▀█ █▀▀█ █▀█ █▀▀█ \n\r'); + terminal.feed('░▄░▒█ █▄▄█ █░░█ █░░█ █▄▄█ █▄▄▀ █▄▄█   ░▄▀ █▄▀█ ░▄▀ █▄▀█ \n\r'); + terminal.feed('▒█▄▄█ ▀░░▀ ▀░░▀ ░▀▀▀ ▀░░▀ ▀░▀▀ ▄▄▄█   █▄▄ █▄▄█ █▄▄ █▄▄█ \n\r'); terminal.feed('\n\r'); - terminal.feed(' Release notes for 1.3.0\n\r'); + terminal.feed(' Release notes for 1.4.0\n\r'); terminal.feed('\n\r'); - terminal.feed(' - Added support for the ~/.ssh/config file.\n\r'); - terminal.feed(' Now you can get quick access to any your ssh host in one click; \n\r'); + terminal.feed(' - Fixed fullscreen window priority \n\r'); + terminal.feed(' Terminal will not lose its visibility even you watch youtube in full screen; \n\r'); terminal.feed('\n\r'); - terminal.feed(' - Added support for ~/.config/drop-down-terminal-x/shortcuts file \n\r'); - terminal.feed(' Now you can define any action that will become available in a special drop-down list for quick launch. \n\r'); - terminal.feed(' This small improvement can improve your productivity \n\r'); - terminal.feed(' See file format at https://github.com/bigbn/drop-down-terminal-x'); + terminal.feed(' - Maximize mode \n\r'); + terminal.feed(' ... \n\r'); terminal.feed('\n\r'); terminal.feed('\n\r'); - terminal.feed(' Thank you for choosing drop-down-terminal-x! \n\r'); + terminal.feed(' Thank you for using Drop-down-terminal-x! Enjoy the future! \n\r'); terminal.feed('\n\r'); terminal.feed('\n\r');