forked from Shinonome/dots-hyprland
Added proposed fixes and implemented some animations+error text
This commit is contained in:
@@ -47,12 +47,23 @@ Scope {
|
|||||||
id: grab
|
id: grab
|
||||||
windows: [overlayWindow]
|
windows: [overlayWindow]
|
||||||
active: GlobalStates.overlayOpen
|
active: GlobalStates.overlayOpen
|
||||||
|
onActiveChanged: {
|
||||||
|
if (active) {
|
||||||
|
// Quick workspace flick to unlock cursor from game's relative mode
|
||||||
|
cursorUnlockProcess.running = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
onCleared: () => {
|
onCleared: () => {
|
||||||
if (!active)
|
if (!active)
|
||||||
GlobalStates.overlayOpen = false;
|
GlobalStates.overlayOpen = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: cursorUnlockProcess
|
||||||
|
command: ["bash", "-c", "ws=$(hyprctl activeworkspace -j | jq -r '.id'); hyprctl --batch \"keyword animations:enabled 0 ; dispatch workspace empty ; dispatch workspace $ws ; keyword animations:enabled 1\""]
|
||||||
|
}
|
||||||
|
|
||||||
OverlayContent {
|
OverlayContent {
|
||||||
id: overlayContent
|
id: overlayContent
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ Singleton {
|
|||||||
|
|
||||||
readonly property list<var> availableWidgets: [
|
readonly property list<var> availableWidgets: [
|
||||||
{ identifier: "crosshair", materialSymbol: "point_scan" },
|
{ identifier: "crosshair", materialSymbol: "point_scan" },
|
||||||
{ identifier: "fpsLimiter", materialSymbol: "speed" },
|
{ identifier: "fpsLimiter", materialSymbol: "animation" },
|
||||||
{ identifier: "volumeMixer", materialSymbol: "volume_up" }
|
{ identifier: "volumeMixer", materialSymbol: "volume_up" }
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,6 @@ import qs.modules.overlay
|
|||||||
|
|
||||||
StyledOverlayWidget {
|
StyledOverlayWidget {
|
||||||
id: root
|
id: root
|
||||||
title: "FPS Limiter"
|
title: "MangoHud FPS"
|
||||||
contentItem: FpsLimiterContent {}
|
contentItem: FpsLimiterContent {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import qs.services
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
@@ -10,12 +11,33 @@ Rectangle {
|
|||||||
id: root
|
id: root
|
||||||
color: Appearance.m3colors.m3surfaceContainer
|
color: Appearance.m3colors.m3surfaceContainer
|
||||||
property real padding: 20
|
property real padding: 20
|
||||||
|
property bool showCheckIcon: false
|
||||||
|
property bool showError: false
|
||||||
implicitWidth: contentColumn.implicitWidth + padding * 2
|
implicitWidth: contentColumn.implicitWidth + padding * 2
|
||||||
implicitHeight: contentColumn.implicitHeight + padding * 2
|
implicitHeight: contentColumn.implicitHeight + padding * 2
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: iconResetTimer
|
||||||
|
interval: 1000
|
||||||
|
onTriggered: {
|
||||||
|
root.showCheckIcon = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: errorResetTimer
|
||||||
|
interval: 1000
|
||||||
|
onTriggered: {
|
||||||
|
root.showError = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function applyLimit() {
|
function applyLimit() {
|
||||||
var fpsValue = parseInt(fpsField.text);
|
var fpsValue = parseInt(fpsField.text);
|
||||||
if (isNaN(fpsValue) || fpsValue < 0) {
|
if (isNaN(fpsValue) || fpsValue < 0) {
|
||||||
|
root.showError = true;
|
||||||
|
errorResetTimer.restart();
|
||||||
|
fpsField.text = "";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,6 +56,9 @@ Rectangle {
|
|||||||
fpsSetter.command = ["bash", "-c", cmd];
|
fpsSetter.command = ["bash", "-c", cmd];
|
||||||
fpsSetter.startDetached();
|
fpsSetter.startDetached();
|
||||||
|
|
||||||
|
root.showCheckIcon = true;
|
||||||
|
iconResetTimer.restart();
|
||||||
|
|
||||||
// Clear the field after applying
|
// Clear the field after applying
|
||||||
fpsField.text = "";
|
fpsField.text = "";
|
||||||
}
|
}
|
||||||
@@ -41,7 +66,7 @@ Rectangle {
|
|||||||
Keys.onPressed: event => {
|
Keys.onPressed: event => {
|
||||||
if (event.key === Qt.Key_Escape) {
|
if (event.key === Qt.Key_Escape) {
|
||||||
fpsField.text = "";
|
fpsField.text = "";
|
||||||
event.accepted = true;
|
event.onAccepted();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,13 +83,13 @@ Rectangle {
|
|||||||
id: fpsField
|
id: fpsField
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredWidth: 200
|
Layout.preferredWidth: 200
|
||||||
placeholderText: qsTr("Set FPS limit (e.g. 80)")
|
placeholderText: root.showError ? Translation.tr("Insert a valid number!") : Translation.tr("Set FPS limit (e.g. 80)")
|
||||||
inputMethodHints: Qt.ImhDigitsOnly
|
inputMethodHints: Qt.ImhDigitsOnly
|
||||||
focus: true
|
focus: true
|
||||||
|
|
||||||
Keys.onReturnPressed: {
|
Keys.onReturnPressed: {
|
||||||
root.applyLimit();
|
root.applyLimit();
|
||||||
event.accepted = true;
|
event.onAccepted();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,7 +105,22 @@ Rectangle {
|
|||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
font.pixelSize: Appearance.font.pixelSize.title
|
font.pixelSize: Appearance.font.pixelSize.title
|
||||||
text: "keyboard_return"
|
text: root.showError ? "close" : (root.showCheckIcon ? "check" : "save")
|
||||||
|
rotation: (root.showCheckIcon || root.showError) ? 360 : 0
|
||||||
|
color: root.showError ? "#ef5350" : (root.showCheckIcon ? Appearance.m3colors.m3primary : Appearance.m3colors.m3onSurface)
|
||||||
|
|
||||||
|
Behavior on rotation {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: 200
|
||||||
|
easing.type: Easing.OutCubic
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on color {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: 200
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user