1
0
mirror of https://github.com/Swordfish90/cool-retro-term.git synced 2026-02-08 00:32:27 +00:00

Fix shortcuts on macOS.

This commit is contained in:
Filippo Scognamiglio
2026-01-22 01:20:06 +01:00
parent 29dc67d96b
commit b77a1b5962
5 changed files with 26 additions and 144 deletions

View File

@@ -140,6 +140,7 @@ Item {
Layout.fillWidth: true
Layout.fillHeight: true
onSessionFinished: tabsRoot.closeTab(index)
onTerminalSizeChanged: updateTerminalSize()
function updateTerminalSize() {
// Every tab will have the same size so we can simply take the first one.

View File

@@ -42,13 +42,7 @@ ApplicationWindow {
property bool fullscreen: false
onFullscreenChanged: visibility = (fullscreen ? Window.FullScreen : Window.Windowed)
menuBar: qtquickMenuLoader.item
Loader {
id: qtquickMenuLoader
active: appSettings.isMacOS || (appSettings.showMenubar && !fullscreen)
sourceComponent: WindowMenu { }
}
menuBar: WindowMenu { }
property real normalizedWindowScale: 1024 / ((0.5 * width + 0.5 * height))
@@ -60,7 +54,7 @@ ApplicationWindow {
id: fullscreenAction
text: qsTr("Fullscreen")
enabled: !appSettings.isMacOS
shortcut: "Alt+F11"
shortcut: StandardKey.FullScreen
onTriggered: fullscreen = !fullscreen
checkable: true
checked: fullscreen
@@ -68,14 +62,14 @@ ApplicationWindow {
Action {
id: newWindowAction
text: qsTr("New Window")
shortcut: "Ctrl+Shift+N"
shortcut: appSettings.isMacOS ? "Meta+N" : "Ctrl+Shift+N"
onTriggered: appRoot.createWindow()
}
Action {
id: quitAction
text: qsTr("Quit")
shortcut: "Ctrl+Shift+Q"
onTriggered: appSettings.close()
shortcut: appSettings.isMacOS ? StandardKey.Close : "Ctrl+Shift+Q"
onTriggered: terminalWindow.close()
}
Action {
id: showsettingsAction
@@ -89,23 +83,23 @@ ApplicationWindow {
Action {
id: copyAction
text: qsTr("Copy")
shortcut: "Ctrl+Shift+C"
shortcut: appSettings.isMacOS ? StandardKey.Copy : "Ctrl+Shift+C"
}
Action {
id: pasteAction
text: qsTr("Paste")
shortcut: "Ctrl+Shift+V"
shortcut: appSettings.isMacOS ? StandardKey.Paste : "Ctrl+Shift+V"
}
Action {
id: zoomIn
text: qsTr("Zoom In")
shortcut: "Ctrl++"
shortcut: StandardKey.ZoomIn
onTriggered: appSettings.incrementScaling()
}
Action {
id: zoomOut
text: qsTr("Zoom Out")
shortcut: "Ctrl+-"
shortcut: StandardKey.ZoomOut
onTriggered: appSettings.decrementScaling()
}
Action {
@@ -120,6 +114,7 @@ ApplicationWindow {
Action {
id: newTabAction
text: qsTr("New Tab")
shortcut: appSettings.isMacOS ? StandardKey.AddTab : "Ctrl+Shift+T"
onTriggered: terminalTabs.addTab()
}
TerminalTabs {

View File

@@ -1,99 +0,0 @@
/*******************************************************************************
* Copyright (c) 2013-2021 "Filippo Scognamiglio"
* https://github.com/Swordfish90/cool-retro-term
*
* This file is part of cool-retro-term.
*
* cool-retro-term is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
import QtQuick 2.3
import Qt.labs.platform 1.1
MenuBar {
id: defaultMenuBar
Menu {
title: qsTr("File")
MenuItem {
text: newWindowAction.text
shortcut: newWindowAction.shortcut
onTriggered: newWindowAction.trigger()
}
MenuItem {
text: newTabAction.text
shortcut: newTabAction.shortcut
onTriggered: newTabAction.trigger()
}
MenuSeparator {}
MenuItem {
text: quitAction.text
onTriggered: quitAction.trigger()
}
}
Menu {
title: qsTr("Edit")
MenuItem {
text: copyAction.text
shortcut: "Meta+C"
onTriggered: copyAction.trigger()
}
MenuItem {
text: pasteAction.text
shortcut: "Meta+V"
onTriggered: pasteAction.trigger()
}
MenuSeparator {}
MenuItem {
text: showsettingsAction.text
shortcut: showsettingsAction.shortcut
onTriggered: showsettingsAction.trigger()
}
}
Menu {
title: qsTr("View")
MenuItem {
text: zoomIn.text
shortcut: "Meta++"
onTriggered: zoomIn.trigger()
}
MenuItem {
text: zoomOut.text
shortcut: "Meta+-"
onTriggered: zoomOut.trigger()
}
}
Menu {
id: profilesMenu
title: qsTr("Profiles")
Instantiator {
model: appSettings.profilesList
delegate: MenuItem {
text: model.text
onTriggered: {
appSettings.loadProfileString(obj_string)
}
}
onObjectAdded: function(index, object) { profilesMenu.insertItem(index, object) }
onObjectRemoved: function(object) { profilesMenu.removeItem(object) }
}
}
Menu {
title: qsTr("Help")
MenuItem {
text: showAboutAction.text
onTriggered: showAboutAction.trigger()
}
}
}

View File

@@ -22,46 +22,32 @@ import QtQuick.Controls 2.3
MenuBar {
id: defaultMenuBar
visible: appSettings.showMenubar
visible: appSettings.isMacOS || appSettings.showMenubar
Menu {
title: qsTr("File")
MenuItem {
action: newWindowAction
}
MenuItem {
action: newTabAction
}
MenuSeparator {}
MenuItem {
action: quitAction
}
MenuItem { action: newWindowAction }
MenuItem { action: newTabAction }
MenuSeparator { }
MenuItem { action: quitAction }
}
Menu {
title: qsTr("Edit")
MenuItem {
action: copyAction
}
MenuItem {
action: pasteAction
}
MenuItem { action: copyAction }
MenuItem { action: pasteAction }
MenuSeparator {}
MenuItem {
action: showsettingsAction
}
MenuItem { action: showsettingsAction }
}
Menu {
title: qsTr("View")
MenuItem {
action: fullscreenAction
visible: fullscreenAction.enabled
}
MenuItem {
action: zoomIn
}
MenuItem {
action: zoomOut
Instantiator {
model: !appSettings.isMacOS ? 1 : 0
delegate: MenuItem { action: fullscreenAction }
onObjectAdded: (index, object) => menu.insertItem(index, object)
onObjectRemoved: (index, object) => menu.removeItem(object)
}
MenuItem { action: zoomIn }
MenuItem { action: zoomOut }
}
Menu {
id: profilesMenu

View File

@@ -48,7 +48,6 @@
<file>menus/WindowMenu.qml</file>
<file>menus/FullContextMenu.qml</file>
<file>menus/ShortContextMenu.qml</file>
<file>menus/OSXMenu.qml</file>
<file>../shaders/terminal_dynamic.vert.qsb</file>
<file>../shaders/terminal_static.vert.qsb</file>
<file>../shaders/terminal_frame.vert.qsb</file>