43 lines
1.3 KiB
QML
43 lines
1.3 KiB
QML
import QtQuick
|
|
import Quickshell
|
|
import Quickshell.Hyprland
|
|
import Quickshell.Io
|
|
import "../../../config"
|
|
import "../states/Idle"
|
|
|
|
MouseArea {
|
|
id: idleButton
|
|
width: Math.max(idleText.width + Config.bar_spacing_fun(height)*2, height)
|
|
height: bar.height
|
|
hoverEnabled: true
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
onClicked: {
|
|
IdleState.idle = !IdleState.idle
|
|
console.log("[IdleButton] Toggling idle: " + (IdleState.idle ? "enabled" : "disabled"))
|
|
}
|
|
|
|
Rectangle {
|
|
anchors.fill: parent
|
|
color: idleButton.containsMouse ? Colors.tertiary : IdleState.isIdle ? Qt.alpha(Colors.secondary, 0.25) : Qt.alpha(Colors.tertiaryContainer, 0.25)
|
|
radius: Config.radius_fun(idleButton.height)
|
|
border.width: Config.border_width
|
|
border.color: (
|
|
idleButton.containsMouse ? Colors.tertiaryContainer_fg :
|
|
Colors.secondaryContainer_fg
|
|
)
|
|
|
|
Text {
|
|
id: idleText
|
|
anchors.centerIn: parent
|
|
text: IdleState.idle ? "" : ""
|
|
font.pixelSize: Config.iconSize(idleButton.height)
|
|
font.family: Config.font
|
|
color: (
|
|
idleButton.containsMouse ? Colors.tertiary_fg :
|
|
IdleState.idle ? Colors.tertiary
|
|
: Colors.primary
|
|
)
|
|
}
|
|
}
|
|
} |