Compare commits

..

2 Commits

Author SHA1 Message Date
7a324e6119 fixed forceHide logic so that the bluetooth menu works 2026-06-30 12:03:18 +01:00
8abc848325 weird bluetooth hover thing 2026-06-29 18:57:03 +01:00
4 changed files with 43 additions and 13 deletions

View File

@@ -182,7 +182,6 @@ Container {
onTriggered: { onTriggered: {
if (!root.hover.hovered) { if (!root.hover.hovered) {
console.log("some");
root.state = ""; root.state = "";
} }
} }

View File

@@ -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 ? "󰂱" : "󰂲"
} }
} }
} }

View File

@@ -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 -4 - root.boxHeight - 5;
} else {
return visibleTopMargin;
}
} else {
return visibleTopMargin; 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;
} }
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

View File

@@ -14,10 +14,10 @@ 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() {