Compare commits
2 Commits
8c7ecc1b14
...
7a324e6119
| Author | SHA1 | Date | |
|---|---|---|---|
| 7a324e6119 | |||
| 8abc848325 |
@@ -182,7 +182,6 @@ Container {
|
|||||||
|
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
if (!root.hover.hovered) {
|
if (!root.hover.hovered) {
|
||||||
console.log("some");
|
|
||||||
root.state = "";
|
root.state = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,13 +10,16 @@ import "Bluetooth"
|
|||||||
Container {
|
Container {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
property bool shown: false
|
||||||
|
|
||||||
animOffset: 200
|
animOffset: 200
|
||||||
boxColor: Colors.peach
|
boxColor: Colors.peach
|
||||||
boxHeight: 25
|
boxHeight: 25
|
||||||
boxWidth: 30
|
boxWidth: 30
|
||||||
defaultItem: icon
|
defaultItem: icon
|
||||||
exclusiveToScreen: true
|
exclusiveToScreen: true
|
||||||
forceHidden: BluetoothManager.getConnected()
|
forceHidden: !(root.shown || BluetoothManager.getConnected())
|
||||||
|
hoverableWhenHidden: true
|
||||||
state: ""
|
state: ""
|
||||||
|
|
||||||
states: [
|
states: [
|
||||||
@@ -46,20 +49,43 @@ Container {
|
|||||||
StateChangeScript {
|
StateChangeScript {
|
||||||
script: {
|
script: {
|
||||||
root.stack.replace(expanded);
|
root.stack.replace(expanded);
|
||||||
|
root.shown = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
hover.onHoveredChanged: hover.hovered == false ? state = "" : undefined
|
hover.onHoveredChanged: {
|
||||||
|
if (hover.hovered == false) {
|
||||||
|
root.state = "";
|
||||||
|
hoverIntervalTimer.start();
|
||||||
|
} else {
|
||||||
|
root.shown = true;
|
||||||
|
hoverIntervalTimer.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
tap.onTapped: state = "expanded"
|
tap.onTapped: state = "expanded"
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: hoverIntervalTimer
|
||||||
|
|
||||||
|
interval: 500
|
||||||
|
repeat: false
|
||||||
|
running: false
|
||||||
|
|
||||||
|
onTriggered: {
|
||||||
|
if (root.hover.hovered == false) {
|
||||||
|
root.shown = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: icon
|
id: icon
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
CenteredText {
|
CenteredText {
|
||||||
text: ""
|
text: BluetoothManager.getConnected() == true ? "" : ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,21 +15,26 @@ Item {
|
|||||||
property double boxRadius: 9
|
property double boxRadius: 9
|
||||||
property double boxWidth: 100
|
property double boxWidth: 100
|
||||||
readonly property double calculatedTopMargin: {
|
readonly property double calculatedTopMargin: {
|
||||||
if (root.exclusiveToScreen) {
|
if (!root.exclusiveToScreen) {
|
||||||
if (Hyprland.focusedMonitor != root.exclusiveMonitor || forceHidden == true) {
|
return visibleTopMargin;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Hyprland.focusedMonitor == root.exclusiveMonitor) {
|
||||||
|
if (!root.forceHidden) {
|
||||||
|
return visibleTopMargin;
|
||||||
|
} else if (root.hoverableWhenHidden) {
|
||||||
|
return 7 - root.boxHeight - 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return -4 - root.boxHeight - 5;
|
return -4 - root.boxHeight - 5;
|
||||||
} else {
|
|
||||||
return visibleTopMargin;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return visibleTopMargin;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
property Component defaultItem
|
property Component defaultItem
|
||||||
required property HyprlandMonitor exclusiveMonitor
|
required property HyprlandMonitor exclusiveMonitor
|
||||||
property bool exclusiveToScreen: false
|
property bool exclusiveToScreen: false
|
||||||
property bool forceHidden: false
|
property bool forceHidden: false
|
||||||
property alias hover: hoverHandler
|
property alias hover: hoverHandler
|
||||||
|
property bool hoverableWhenHidden: false
|
||||||
property alias rect: container
|
property alias rect: container
|
||||||
property alias stack: containerContent
|
property alias stack: containerContent
|
||||||
property alias tap: tapHandler
|
property alias tap: tapHandler
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ Singleton {
|
|||||||
for (let device in deviceList) {
|
for (let device in deviceList) {
|
||||||
let currentDevice = deviceList[device];
|
let currentDevice = deviceList[device];
|
||||||
if (currentDevice.connected == true) {
|
if (currentDevice.connected == true) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function getDevicesList() {
|
function getDevicesList() {
|
||||||
return root.defaultAdapter.devices.values;
|
return root.defaultAdapter.devices.values;
|
||||||
|
|||||||
Reference in New Issue
Block a user