mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-06 20:28:23 +02:00
Introduces a widgets/ directory of first-party QML modules and a common/ helpers library. Widgets auto-load by name from default/quickshell/bar/widgets/<name>.qml — no edits to shell.qml needed for additions beyond the firstPartyWidgets registry. New widgets (all orientation-aware, top/bottom/left/right): - media: MPRIS now-playing with scrolling label, cover art popup, play/pause/skip controls - audioPanel: master volume slider, output device picker, per-app mixer - networkPanel: Wi-Fi scan + connect, current connection details - bluetoothPanel: paired device list, connect/disconnect, battery - calendar: month grid popup keyed to today - notificationCenter: live notification feed, DND toggle, clear all - brightness: slider popup with scroll-to-adjust - powerProfile: power-saver/balanced/performance picker (UPower) - systemStats: inline CPU + RAM sparklines, expanded popup with btop - weatherFlyout: weather popup with refresh and full report - workspacesPro: animated focus indicator that slides between workspaces - powerMenu: lock/suspend/log out/reboot/shutdown popup - idleInhibitor: coffee-cup toggle wired to omarchy-toggle-idle - microphone: mic state + mute toggle + scroll volume Common helpers (default/quickshell/bar/common/): - WidgetButton: hover/press scale animation, tooltip integration - PopupCard: orientation-aware anchor + slide-in opacity transition - Slider: drag/wheel-able linear slider with knob hover bump - PillButton: rounded action button with icon + label Bar root gains requestPopout/releasePopout so only one popup is open at a time across widgets. Updates bar-defaults.json to ship the new widgets out of the box while keeping the legacy modules available.
70 lines
2.2 KiB
QML
70 lines
2.2 KiB
QML
import QtQuick
|
|
|
|
Item {
|
|
id: root
|
|
|
|
property var bar: null
|
|
property string text: ""
|
|
property string fontFamily: bar ? bar.fontFamily : "JetBrainsMono Nerd Font"
|
|
property real fontSize: 12
|
|
property color foreground: bar ? bar.foreground : "#cacccc"
|
|
property color activeColor: bar ? bar.urgent : "#a55555"
|
|
property bool active: false
|
|
property real horizontalMargin: 7.5
|
|
property real verticalPadding: 6
|
|
property real fixedWidth: -1
|
|
property real fixedHeight: -1
|
|
property real textRotation: 0
|
|
property bool keepSpace: false
|
|
property string tooltipText: ""
|
|
property real hoverScale: 1.0
|
|
property real pressScale: 0.92
|
|
|
|
signal pressed(int button)
|
|
signal wheelMoved(int delta)
|
|
|
|
readonly property bool vertical: bar ? bar.vertical : false
|
|
readonly property int barSize: bar ? bar.barSize : 26
|
|
|
|
visible: text !== "" || keepSpace
|
|
opacity: text === "" ? 0 : 1
|
|
implicitWidth: fixedWidth > 0 ? fixedWidth : (vertical ? barSize : Math.max(12, label.implicitWidth + horizontalMargin * 2))
|
|
implicitHeight: fixedHeight > 0 ? fixedHeight : (vertical ? Math.max(12, label.implicitHeight + verticalPadding * 2) : barSize)
|
|
|
|
Behavior on opacity {
|
|
NumberAnimation { duration: 140; easing.type: Easing.OutCubic }
|
|
}
|
|
|
|
Text {
|
|
id: label
|
|
anchors.centerIn: parent
|
|
text: root.text
|
|
color: root.active ? root.activeColor : root.foreground
|
|
font.family: root.fontFamily
|
|
font.pixelSize: root.fontSize
|
|
rotation: root.textRotation
|
|
horizontalAlignment: Text.AlignHCenter
|
|
verticalAlignment: Text.AlignVCenter
|
|
scale: mouseArea.pressed ? root.pressScale : (mouseArea.containsMouse ? root.hoverScale : 1.0)
|
|
|
|
Behavior on color {
|
|
ColorAnimation { duration: 160 }
|
|
}
|
|
|
|
Behavior on scale {
|
|
NumberAnimation { duration: 110; easing.type: Easing.OutCubic }
|
|
}
|
|
}
|
|
|
|
MouseArea {
|
|
id: mouseArea
|
|
anchors.fill: parent
|
|
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
|
|
hoverEnabled: true
|
|
onEntered: if (root.bar) root.bar.showTooltip(root, root.tooltipText)
|
|
onExited: if (root.bar) root.bar.hideTooltip(root)
|
|
onClicked: function(mouse) { root.pressed(mouse.button) }
|
|
onWheel: function(wheel) { root.wheelMoved(wheel.angleDelta.y) }
|
|
}
|
|
}
|