weird bluetooth hover thing
This commit is contained in:
@@ -182,7 +182,6 @@ Container {
|
||||
|
||||
onTriggered: {
|
||||
if (!root.hover.hovered) {
|
||||
console.log("some");
|
||||
root.state = "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,13 +10,16 @@ import "Bluetooth"
|
||||
Container {
|
||||
id: root
|
||||
|
||||
property bool hidden: true
|
||||
|
||||
animOffset: 200
|
||||
boxColor: Colors.peach
|
||||
boxHeight: 25
|
||||
boxWidth: 30
|
||||
defaultItem: icon
|
||||
exclusiveToScreen: true
|
||||
forceHidden: BluetoothManager.getConnected()
|
||||
forceHidden: (hidden == true || BluetoothManager.getConnected())
|
||||
hoverableWhenHidden: true
|
||||
state: ""
|
||||
|
||||
states: [
|
||||
@@ -31,6 +34,9 @@ Container {
|
||||
StateChangeScript {
|
||||
script: {
|
||||
root.stack.replace(icon);
|
||||
if (BluetoothManager.getConnected() == false) {
|
||||
root.hidden = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -46,20 +52,43 @@ Container {
|
||||
StateChangeScript {
|
||||
script: {
|
||||
root.stack.replace(expanded);
|
||||
root.hidden = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
hover.onHoveredChanged: hover.hovered == false ? state = "" : undefined
|
||||
hover.onHoveredChanged: {
|
||||
if (hover.hovered == false) {
|
||||
root.state = "";
|
||||
hoverIntervalTimer.start();
|
||||
} else {
|
||||
root.hidden = false;
|
||||
hoverIntervalTimer.start();
|
||||
}
|
||||
}
|
||||
tap.onTapped: state = "expanded"
|
||||
|
||||
Timer {
|
||||
id: hoverIntervalTimer
|
||||
|
||||
interval: 1000
|
||||
repeat: false
|
||||
running: false
|
||||
|
||||
onTriggered: {
|
||||
if (root.hover.hovered != true && root.state != "expanded") {
|
||||
root.hidden = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: icon
|
||||
|
||||
Item {
|
||||
CenteredText {
|
||||
text: ""
|
||||
text: BluetoothManager.getConnected() == true ? "" : ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,8 +16,9 @@ Item {
|
||||
property double boxWidth: 100
|
||||
readonly property double calculatedTopMargin: {
|
||||
if (root.exclusiveToScreen) {
|
||||
let baseMargin = hoverableWhenHidden == true ? 8 : -4;
|
||||
if (Hyprland.focusedMonitor != root.exclusiveMonitor || forceHidden == true) {
|
||||
return -4 - root.boxHeight - 5;
|
||||
return baseMargin - root.boxHeight - 5;
|
||||
} else {
|
||||
return visibleTopMargin;
|
||||
}
|
||||
@@ -30,6 +31,7 @@ Item {
|
||||
property bool exclusiveToScreen: false
|
||||
property bool forceHidden: false
|
||||
property alias hover: hoverHandler
|
||||
property bool hoverableWhenHidden: false
|
||||
property alias rect: container
|
||||
property alias stack: containerContent
|
||||
property alias tap: tapHandler
|
||||
|
||||
@@ -14,10 +14,10 @@ Singleton {
|
||||
for (let device in deviceList) {
|
||||
let currentDevice = deviceList[device];
|
||||
if (currentDevice.connected == true) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
function getDevicesList() {
|
||||
|
||||
Reference in New Issue
Block a user