aboutsummaryrefslogtreecommitdiff
path: root/src/widget
diff options
context:
space:
mode:
Diffstat (limited to 'src/widget')
-rw-r--r--src/widget/EmbeddedTerminal.qml191
1 files changed, 124 insertions, 67 deletions
diff --git a/src/widget/EmbeddedTerminal.qml b/src/widget/EmbeddedTerminal.qml
index 67d9a91..5e2e2df 100644
--- a/src/widget/EmbeddedTerminal.qml
+++ b/src/widget/EmbeddedTerminal.qml
@@ -19,7 +19,7 @@ Item {
function deselect() { highlighter.deselect() }
function displayOverlay() { overlay.displayBriefly() }
- height: terminal.height
+ height: terminal.parent.height
width: parent.width - settings.terminal.frameWidth
RowLayout {
@@ -39,104 +39,161 @@ Item {
Layout.fillHeight: true
}
- QMLTermWidget {
- id: terminal
+ ColumnLayout {
+ Layout.fillWidth: true
- font {
- family: settings.terminal.fontFamily
- pointSize: settings.terminal.fontSize
- }
+ spacing: 0
+
+ QMLTermWidget {
+ id: terminal
- Layout.fillWidth: true
- Layout.preferredHeight: fontMetrics.height * item.lines
+ font {
+ family: settings.terminal.fontFamily
+ pointSize: settings.terminal.fontSize
+ }
- colorScheme: settings.terminal.colorScheme
+ Layout.fillWidth: true
+ Layout.preferredHeight: fontMetrics.height * item.lines
- session: QMLTermSession {
- id: session
+ colorScheme: settings.terminal.colorScheme
- initialWorkingDirectory: settings.terminal.initialWorkingDirectory
+ session: QMLTermSession {
+ id: session
- shellProgram: settings.terminal.launcherProgram
- shellProgramArgs: [ settings.terminal.launcherArgument, program ]
+ initialWorkingDirectory: settings.terminal.initialWorkingDirectory
- onFinished: {
- clearScreen();
- item.finished();
+ shellProgram: settings.terminal.launcherProgram
+ shellProgramArgs: [ settings.terminal.launcherArgument, program ]
+
+ onFinished: {
+ clearScreen();
+ item.finished();
+ }
}
- }
- Component.onCompleted: {
- forceActiveFocus();
- highlighter.select();
- session.startShellProgram();
- overlay.enabled = true;
- }
+ Component.onCompleted: {
+ forceActiveFocus();
+ highlighter.select();
+ session.startShellProgram();
+ statusLine.update();
+ overlay.enabled = true;
+ }
+
+ onTermGetFocus: {
+ highlighter.focus();
+ statusLine.update();
+ }
- onTermGetFocus: highlighter.focus()
- onTermLostFocus: highlighter.unfocus()
- onHeightChanged: overlay.displayBriefly()
- onWidthChanged: overlay.displayBriefly()
+ onTermLostFocus: highlighter.unfocus()
+ onHeightChanged: overlay.displayBriefly()
+ onWidthChanged: overlay.displayBriefly()
- Rectangle {
- id: overlay
+ Rectangle {
+ id: overlay
- property bool enabled : false
+ property bool enabled : false
- function displayBriefly() {
- if ( enabled ) { animation.restart() }
- }
+ function displayBriefly() {
+ if ( enabled ) { animation.restart() }
+ }
+
+ anchors.fill: parent
+ opacity: 0
+ color: settings.terminal.overlayBackground
+
+ SequentialAnimation {
+ id: animation
- anchors.fill: parent
- opacity: 0
- color: settings.terminal.overlayBackground
+ ScriptAction {
+ script: overlay.opacity = 0.8
+ }
- SequentialAnimation {
- id: animation
+ PauseAnimation {
+ duration: 500
+ }
- ScriptAction {
- script: overlay.opacity = 0.8
+ NumberAnimation {
+ target: overlay
+ property: "opacity"
+
+ easing.type: Easing.InSine
+ duration: 300
+ from: 0.8
+ to: 0
+ }
}
- PauseAnimation {
- duration: 500
+ Text {
+ anchors {
+ horizontalCenter: overlay.horizontalCenter
+ verticalCenter: overlay.verticalCenter
+ }
+
+ font {
+ family: settings.terminal.fontFamily
+ pointSize: settings.terminal.fontSize * 2
+ }
+ color: settings.terminal.overlayFontColor
+
+ text: {
+ return item.lines
+ + 'x'
+ + Math.floor(terminal.width / terminal.fontMetrics.width);
+ }
}
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ acceptedButtons: Qt.NoButton
+ onWheel: { }
+ }
+ }
- NumberAnimation {
- target: overlay
- property: "opacity"
+ RowLayout {
+ id: statusLine
- easing.type: Easing.InSine
- duration: 300
- from: 0.8
- to: 0
- }
+ Layout.fillWidth: true
+ Layout.alignment: Qt.AlignRight
+
+ spacing: 5
+
+ function update() {
+ var shellPID = session.getShellPID();
+
+ pid.text = shellPID;
+ workingDirectory.text = cwd.currentOfPID(shellPID);
}
Text {
- anchors {
- horizontalCenter: overlay.horizontalCenter
- verticalCenter: overlay.verticalCenter
- }
+ id: pid
font {
family: settings.terminal.fontFamily
- pointSize: settings.terminal.fontSize * 2
+ pointSize: settings.terminal.fontSize
}
- color: settings.terminal.overlayFontColor
+ color: settings.terminal.statusFontColor
+ }
- text: {
- return item.lines
- + 'x'
- + Math.floor(terminal.width / terminal.fontMetrics.width);
+ Text {
+ font {
+ family: settings.terminal.fontFamily
+ pointSize: settings.terminal.fontSize
}
+ color: settings.terminal.statusFontColor
+
+ text: "@"
}
- }
- MouseArea {
- anchors.fill: parent
- acceptedButtons: Qt.NoButton
- onWheel: { }
+ Text {
+ id: workingDirectory
+
+ font {
+ family: settings.terminal.fontFamily
+ pointSize: settings.terminal.fontSize
+ }
+ color: settings.terminal.statusFontColor
+ }
}
}
}