mirror of
https://github.com/kossLAN/dots.git
synced 2025-11-05 06:59:50 -05:00
52 lines
1.3 KiB
QML
52 lines
1.3 KiB
QML
import QtQuick
|
|
import Quickshell.Widgets
|
|
import Qt5Compat.GraphicalEffects
|
|
import ".."
|
|
|
|
Item {
|
|
id: root
|
|
property string source
|
|
property var implicitSize: 24
|
|
property var padding: 0
|
|
property var radius: 20
|
|
property var activeRectangle: true
|
|
property var color: ShellSettings.settings.colors["inverse_surface"]
|
|
property var activeColor: ShellSettings.settings.colors["inverse_primary"]
|
|
signal clicked
|
|
|
|
implicitWidth: implicitSize
|
|
implicitHeight: implicitSize
|
|
|
|
Rectangle {
|
|
id: iconBackground
|
|
color: ShellSettings.settings.colors["primary"]
|
|
radius: root.radius
|
|
visible: iconButton.containsMouse && root.activeRectangle
|
|
anchors.fill: parent
|
|
}
|
|
|
|
// Figure out a way to color images better
|
|
IconImage {
|
|
id: iconImage
|
|
source: root.source
|
|
visible: true
|
|
// color: {
|
|
// if (!activeRectangle)
|
|
// return root.color;
|
|
//
|
|
// return iconButton.containsMouse ? root.activeColor : root.color;
|
|
// }
|
|
|
|
anchors {
|
|
fill: parent
|
|
margins: root.padding
|
|
}
|
|
}
|
|
|
|
MouseArea {
|
|
id: iconButton
|
|
hoverEnabled: true
|
|
anchors.fill: parent
|
|
onPressed: root.clicked()
|
|
}
|
|
}
|