Skip to content

Commit

Permalink
fullscreen mode (fixes #283)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugeny committed Feb 12, 2018
1 parent fde16b8 commit e68cafd
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 6 deletions.
13 changes: 7 additions & 6 deletions terminus-core/src/components/appRoot.component.pug
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -20,17 +21,17 @@ title-bar(
@animateTab,
(click)='app.selectTab(tab)',
)

.btn-group
button.btn.btn-secondary.btn-tab-bar(
*ngFor='let button of leftToolbarButtons',
[title]='button.title',
(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',
Expand All @@ -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',
Expand Down
3 changes: 3 additions & 0 deletions terminus-core/src/components/appRoot.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ export class AppRootComponent {
this.app.previousTab()
}
}
if (hotkey === 'toggle-fullscreen') {
this.hostApp.toggleFullscreen()
}
})

this.docking.dock()
Expand Down
2 changes: 2 additions & 0 deletions terminus-core/src/configDefaults.linux.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
hotkeys:
toggle-window:
- 'Ctrl+Space'
toggle-fullscreen:
- 'F11'
close-tab:
- 'Ctrl-Shift-W'
- ['Ctrl-A', 'K']
Expand Down
2 changes: 2 additions & 0 deletions terminus-core/src/configDefaults.macos.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
hotkeys:
toggle-window:
- 'Ctrl+Space'
toggle-fullscreen:
- 'Ctrl+⌘+F'
close-tab:
- '⌘-W'
toggle-last-tab: []
Expand Down
2 changes: 2 additions & 0 deletions terminus-core/src/configDefaults.windows.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
hotkeys:
toggle-window:
- 'Ctrl+Space'
toggle-fullscreen:
- 'F11'
close-tab:
- 'Ctrl-Shift-W'
- ['Ctrl-A', 'K']
Expand Down
5 changes: 5 additions & 0 deletions terminus-core/src/services/hostApp.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' })
}
Expand Down
4 changes: 4 additions & 0 deletions terminus-core/src/services/hotkeys.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit e68cafd

Please sign in to comment.