From e68cafdb70857f55842b93c54787a4c462d38c54 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Mon, 12 Feb 2018 17:04:49 +0100 Subject: [PATCH] fullscreen mode (fixes #283) --- terminus-core/src/components/appRoot.component.pug | 13 +++++++------ terminus-core/src/components/appRoot.component.ts | 3 +++ terminus-core/src/configDefaults.linux.yaml | 2 ++ terminus-core/src/configDefaults.macos.yaml | 2 ++ terminus-core/src/configDefaults.windows.yaml | 2 ++ terminus-core/src/services/hostApp.service.ts | 5 +++++ terminus-core/src/services/hotkeys.service.ts | 4 ++++ 7 files changed, 25 insertions(+), 6 deletions(-) diff --git a/terminus-core/src/components/appRoot.component.pug b/terminus-core/src/components/appRoot.component.pug index a2f9d5c1..52b11e61 100644 --- a/terminus-core/src/components/appRoot.component.pug +++ b/terminus-core/src/components/appRoot.component.pug @@ -1,12 +1,13 @@ title-bar( - *ngIf='config.store.appearance.frame == "full" && config.store.appearance.dock == "off"', + *ngIf='!hostApp.getWindow().isFullScreen() && config.store.appearance.frame == "full" && config.store.appearance.dock == "off"', [class.inset]='hostApp.platform == Platform.macOS' ) .content( - [class.tabs-on-top]='config.store.appearance.tabsLocation == "top"' + [class.tabs-on-top]='config.store.appearance.tabsLocation == "top"' ) .tab-bar( + *ngIf='!hostApp.getWindow().isFullScreen()', [class.inset]='hostApp.platform == Platform.macOS && config.store.appearance.frame == "thin" && config.store.appearance.tabsLocation == "top"' ) .tabs @@ -20,7 +21,7 @@ title-bar( @animateTab, (click)='app.selectTab(tab)', ) - + .btn-group button.btn.btn-secondary.btn-tab-bar( *ngFor='let button of leftToolbarButtons', @@ -28,9 +29,9 @@ title-bar( (click)='button.click()', ) i.fa([class]='"fa fa-" + button.icon') - + .drag-space([class.persistent]='config.store.appearance.frame == "thin" && hostApp.platform != Platform.macOS') - + .btn-group button.btn.btn-secondary.btn-tab-bar( *ngFor='let button of rightToolbarButtons', @@ -53,7 +54,7 @@ title-bar( start-page(*ngIf='ready && app.tabs.length == 0') tab-body( - *ngFor='let tab of app.tabs; trackBy: tab?.id', + *ngFor='let tab of app.tabs; trackBy: tab?.id', [active]='tab == app.activeTab', [tab]='tab', [scrollable]='tab.scrollable', diff --git a/terminus-core/src/components/appRoot.component.ts b/terminus-core/src/components/appRoot.component.ts index 3df7403e..ab3f15fc 100644 --- a/terminus-core/src/components/appRoot.component.ts +++ b/terminus-core/src/components/appRoot.component.ts @@ -97,6 +97,9 @@ export class AppRootComponent { this.app.previousTab() } } + if (hotkey === 'toggle-fullscreen') { + this.hostApp.toggleFullscreen() + } }) this.docking.dock() diff --git a/terminus-core/src/configDefaults.linux.yaml b/terminus-core/src/configDefaults.linux.yaml index 09d1993b..01042767 100644 --- a/terminus-core/src/configDefaults.linux.yaml +++ b/terminus-core/src/configDefaults.linux.yaml @@ -1,6 +1,8 @@ hotkeys: toggle-window: - 'Ctrl+Space' + toggle-fullscreen: + - 'F11' close-tab: - 'Ctrl-Shift-W' - ['Ctrl-A', 'K'] diff --git a/terminus-core/src/configDefaults.macos.yaml b/terminus-core/src/configDefaults.macos.yaml index e38d54c9..a37ef6a9 100644 --- a/terminus-core/src/configDefaults.macos.yaml +++ b/terminus-core/src/configDefaults.macos.yaml @@ -1,6 +1,8 @@ hotkeys: toggle-window: - 'Ctrl+Space' + toggle-fullscreen: + - 'Ctrl+⌘+F' close-tab: - '⌘-W' toggle-last-tab: [] diff --git a/terminus-core/src/configDefaults.windows.yaml b/terminus-core/src/configDefaults.windows.yaml index 8ebe593d..7b0fbf9c 100644 --- a/terminus-core/src/configDefaults.windows.yaml +++ b/terminus-core/src/configDefaults.windows.yaml @@ -1,6 +1,8 @@ hotkeys: toggle-window: - 'Ctrl+Space' + toggle-fullscreen: + - 'F11' close-tab: - 'Ctrl-Shift-W' - ['Ctrl-A', 'K'] diff --git a/terminus-core/src/services/hostApp.service.ts b/terminus-core/src/services/hostApp.service.ts index d7164b1c..0956f644 100644 --- a/terminus-core/src/services/hostApp.service.ts +++ b/terminus-core/src/services/hostApp.service.ts @@ -73,6 +73,11 @@ export class HostAppService { return this.electron.app.getPath(type) } + toggleFullscreen () { + let window = this.getWindow() + window.setFullScreen(!window.isFullScreen()) + } + openDevTools () { this.getWindow().webContents.openDevTools({ mode: 'undocked' }) } diff --git a/terminus-core/src/services/hotkeys.service.ts b/terminus-core/src/services/hotkeys.service.ts index 0a7a655e..43830229 100644 --- a/terminus-core/src/services/hotkeys.service.ts +++ b/terminus-core/src/services/hotkeys.service.ts @@ -178,6 +178,10 @@ export class AppHotkeyProvider extends HotkeyProvider { id: 'toggle-window', name: 'Toggle terminal window', }, + { + id: 'toggle-fullscreen', + name: 'Toggle fullscreen mode', + }, { id: 'close-tab', name: 'Close tab',