Skip to content

Commit b77a1b5

Browse files
committed
Fix shortcuts on macOS.
1 parent 29dc67d commit b77a1b5

5 files changed

Lines changed: 26 additions & 144 deletions

File tree

app/qml/TerminalTabs.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ Item {
140140
Layout.fillWidth: true
141141
Layout.fillHeight: true
142142
onSessionFinished: tabsRoot.closeTab(index)
143+
onTerminalSizeChanged: updateTerminalSize()
143144

144145
function updateTerminalSize() {
145146
// Every tab will have the same size so we can simply take the first one.

app/qml/TerminalWindow.qml

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,7 @@ ApplicationWindow {
4242
property bool fullscreen: false
4343
onFullscreenChanged: visibility = (fullscreen ? Window.FullScreen : Window.Windowed)
4444

45-
menuBar: qtquickMenuLoader.item
46-
47-
Loader {
48-
id: qtquickMenuLoader
49-
active: appSettings.isMacOS || (appSettings.showMenubar && !fullscreen)
50-
sourceComponent: WindowMenu { }
51-
}
45+
menuBar: WindowMenu { }
5246

5347
property real normalizedWindowScale: 1024 / ((0.5 * width + 0.5 * height))
5448

@@ -60,22 +54,22 @@ ApplicationWindow {
6054
id: fullscreenAction
6155
text: qsTr("Fullscreen")
6256
enabled: !appSettings.isMacOS
63-
shortcut: "Alt+F11"
57+
shortcut: StandardKey.FullScreen
6458
onTriggered: fullscreen = !fullscreen
6559
checkable: true
6660
checked: fullscreen
6761
}
6862
Action {
6963
id: newWindowAction
7064
text: qsTr("New Window")
71-
shortcut: "Ctrl+Shift+N"
65+
shortcut: appSettings.isMacOS ? "Meta+N" : "Ctrl+Shift+N"
7266
onTriggered: appRoot.createWindow()
7367
}
7468
Action {
7569
id: quitAction
7670
text: qsTr("Quit")
77-
shortcut: "Ctrl+Shift+Q"
78-
onTriggered: appSettings.close()
71+
shortcut: appSettings.isMacOS ? StandardKey.Close : "Ctrl+Shift+Q"
72+
onTriggered: terminalWindow.close()
7973
}
8074
Action {
8175
id: showsettingsAction
@@ -89,23 +83,23 @@ ApplicationWindow {
8983
Action {
9084
id: copyAction
9185
text: qsTr("Copy")
92-
shortcut: "Ctrl+Shift+C"
86+
shortcut: appSettings.isMacOS ? StandardKey.Copy : "Ctrl+Shift+C"
9387
}
9488
Action {
9589
id: pasteAction
9690
text: qsTr("Paste")
97-
shortcut: "Ctrl+Shift+V"
91+
shortcut: appSettings.isMacOS ? StandardKey.Paste : "Ctrl+Shift+V"
9892
}
9993
Action {
10094
id: zoomIn
10195
text: qsTr("Zoom In")
102-
shortcut: "Ctrl++"
96+
shortcut: StandardKey.ZoomIn
10397
onTriggered: appSettings.incrementScaling()
10498
}
10599
Action {
106100
id: zoomOut
107101
text: qsTr("Zoom Out")
108-
shortcut: "Ctrl+-"
102+
shortcut: StandardKey.ZoomOut
109103
onTriggered: appSettings.decrementScaling()
110104
}
111105
Action {
@@ -120,6 +114,7 @@ ApplicationWindow {
120114
Action {
121115
id: newTabAction
122116
text: qsTr("New Tab")
117+
shortcut: appSettings.isMacOS ? StandardKey.AddTab : "Ctrl+Shift+T"
123118
onTriggered: terminalTabs.addTab()
124119
}
125120
TerminalTabs {

app/qml/menus/OSXMenu.qml

Lines changed: 0 additions & 99 deletions
This file was deleted.

app/qml/menus/WindowMenu.qml

Lines changed: 15 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -22,46 +22,32 @@ import QtQuick.Controls 2.3
2222

2323
MenuBar {
2424
id: defaultMenuBar
25-
visible: appSettings.showMenubar
25+
visible: appSettings.isMacOS || appSettings.showMenubar
2626

2727
Menu {
2828
title: qsTr("File")
29-
MenuItem {
30-
action: newWindowAction
31-
}
32-
MenuItem {
33-
action: newTabAction
34-
}
35-
MenuSeparator {}
36-
MenuItem {
37-
action: quitAction
38-
}
29+
MenuItem { action: newWindowAction }
30+
MenuItem { action: newTabAction }
31+
MenuSeparator { }
32+
MenuItem { action: quitAction }
3933
}
4034
Menu {
4135
title: qsTr("Edit")
42-
MenuItem {
43-
action: copyAction
44-
}
45-
MenuItem {
46-
action: pasteAction
47-
}
36+
MenuItem { action: copyAction }
37+
MenuItem { action: pasteAction }
4838
MenuSeparator {}
49-
MenuItem {
50-
action: showsettingsAction
51-
}
39+
MenuItem { action: showsettingsAction }
5240
}
5341
Menu {
5442
title: qsTr("View")
55-
MenuItem {
56-
action: fullscreenAction
57-
visible: fullscreenAction.enabled
58-
}
59-
MenuItem {
60-
action: zoomIn
61-
}
62-
MenuItem {
63-
action: zoomOut
43+
Instantiator {
44+
model: !appSettings.isMacOS ? 1 : 0
45+
delegate: MenuItem { action: fullscreenAction }
46+
onObjectAdded: (index, object) => menu.insertItem(index, object)
47+
onObjectRemoved: (index, object) => menu.removeItem(object)
6448
}
49+
MenuItem { action: zoomIn }
50+
MenuItem { action: zoomOut }
6551
}
6652
Menu {
6753
id: profilesMenu

app/qml/resources.qrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
<file>menus/WindowMenu.qml</file>
4949
<file>menus/FullContextMenu.qml</file>
5050
<file>menus/ShortContextMenu.qml</file>
51-
<file>menus/OSXMenu.qml</file>
5251
<file>../shaders/terminal_dynamic.vert.qsb</file>
5352
<file>../shaders/terminal_static.vert.qsb</file>
5453
<file>../shaders/terminal_frame.vert.qsb</file>

0 commit comments

Comments
 (0)