Port the AGS widgets into the shell as plugins
This commit is contained in:
@@ -0,0 +1,115 @@
|
||||
import QtQuick
|
||||
import Quickshell.Io
|
||||
import qs.Commons
|
||||
import qs.Ui
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property int monthOffset: 0
|
||||
property string monthName: ""
|
||||
property string monthGrid: ""
|
||||
property bool polling: false
|
||||
|
||||
implicitHeight: layout.implicitHeight
|
||||
|
||||
function loadMonth() {
|
||||
if (monthProbe.running) return
|
||||
monthProbe.running = true
|
||||
}
|
||||
|
||||
function shiftMonth(delta) {
|
||||
root.monthOffset += delta
|
||||
root.loadMonth()
|
||||
}
|
||||
|
||||
function resetMonth() {
|
||||
root.monthOffset = 0
|
||||
root.loadMonth()
|
||||
}
|
||||
|
||||
Process {
|
||||
id: monthProbe
|
||||
command: ["bash", "-c",
|
||||
'first="$(date +%Y-%m-01) ' + root.monthOffset + ' months"; ' +
|
||||
'date -d "$first" "+%B %Y"; cal $(date -d "$first" "+%m %Y") | sed "1d"']
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
var lines = String(text).replace(/\s+$/, "").split("\n")
|
||||
root.monthName = (lines[0] || "").trim()
|
||||
root.monthGrid = lines.slice(1).join("\n")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
interval: 3600000
|
||||
running: root.polling
|
||||
repeat: true
|
||||
onTriggered: if (root.monthOffset === 0) root.loadMonth()
|
||||
}
|
||||
|
||||
Component.onCompleted: root.loadMonth()
|
||||
|
||||
WheelHandler {
|
||||
onWheel: function(event) {
|
||||
root.shiftMonth(event.angleDelta.y > 0 ? -1 : 1)
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
id: layout
|
||||
width: parent.width
|
||||
spacing: Style.spaceReal(6)
|
||||
|
||||
Item {
|
||||
width: parent.width
|
||||
implicitHeight: Math.max(monthLabel.implicitHeight, navigation.implicitHeight)
|
||||
|
||||
Text {
|
||||
id: monthLabel
|
||||
anchors.left: parent.left
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: root.monthName
|
||||
textFormat: Text.PlainText
|
||||
color: Color.foreground
|
||||
font.family: Style.font.family
|
||||
font.pixelSize: Style.font.body
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
Row {
|
||||
id: navigation
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Style.spaceReal(4)
|
||||
|
||||
CardIconButton {
|
||||
icon: "<"
|
||||
onActivated: root.shiftMonth(-1)
|
||||
}
|
||||
|
||||
CardIconButton {
|
||||
icon: "Today"
|
||||
visible: root.monthOffset !== 0
|
||||
implicitWidth: Style.spaceReal(44)
|
||||
onActivated: root.resetMonth()
|
||||
}
|
||||
|
||||
CardIconButton {
|
||||
icon: ">"
|
||||
onActivated: root.shiftMonth(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text: root.monthGrid
|
||||
textFormat: Text.PlainText
|
||||
color: Util.alpha(Color.foreground, 0.85)
|
||||
font.family: Style.font.family
|
||||
font.pixelSize: Style.font.bodySmall
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
import QtQuick
|
||||
import qs.Commons
|
||||
import qs.Ui
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property string clock: ""
|
||||
property string today: ""
|
||||
signal lockRequested()
|
||||
signal logoutRequested()
|
||||
signal closeRequested()
|
||||
|
||||
implicitHeight: Math.max(dateTime.implicitHeight, buttons.implicitHeight)
|
||||
|
||||
Column {
|
||||
id: dateTime
|
||||
anchors.left: parent.left
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Style.spaceReal(2)
|
||||
|
||||
Text {
|
||||
text: root.clock
|
||||
textFormat: Text.PlainText
|
||||
color: Color.foreground
|
||||
font.family: Style.font.family
|
||||
font.pixelSize: Style.font.heading
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
Text {
|
||||
text: root.today
|
||||
textFormat: Text.PlainText
|
||||
color: Util.alpha(Color.foreground, 0.75)
|
||||
font.family: Style.font.family
|
||||
font.pixelSize: Style.font.bodySmall
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
id: buttons
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Style.spaceReal(4)
|
||||
|
||||
CardIconButton {
|
||||
icon: ""
|
||||
onActivated: root.lockRequested()
|
||||
}
|
||||
|
||||
CardIconButton {
|
||||
icon: ""
|
||||
onActivated: root.logoutRequested()
|
||||
}
|
||||
|
||||
CardIconButton {
|
||||
icon: ""
|
||||
onActivated: root.closeRequested()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
import QtQuick
|
||||
import qs.Commons
|
||||
import qs.Ui
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property string title: ""
|
||||
property string artist: ""
|
||||
property string status: "Stopped"
|
||||
readonly property bool playing: root.status === "Playing"
|
||||
signal controlRequested(string action)
|
||||
|
||||
visible: root.title.length > 0 && root.title !== "No Media"
|
||||
implicitHeight: visible ? Math.max(info.implicitHeight, controls.implicitHeight) : 0
|
||||
|
||||
Column {
|
||||
id: info
|
||||
anchors.left: parent.left
|
||||
anchors.right: controls.left
|
||||
anchors.rightMargin: Style.spaceReal(12)
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Style.spaceReal(2)
|
||||
|
||||
Text {
|
||||
width: parent.width
|
||||
text: root.title
|
||||
textFormat: Text.PlainText
|
||||
elide: Text.ElideRight
|
||||
color: Color.foreground
|
||||
font.family: Style.font.family
|
||||
font.pixelSize: Style.font.bodySmall
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
Text {
|
||||
width: parent.width
|
||||
text: root.artist
|
||||
textFormat: Text.PlainText
|
||||
elide: Text.ElideRight
|
||||
visible: root.artist.length > 0
|
||||
color: Util.alpha(Color.foreground, 0.75)
|
||||
font.family: Style.font.family
|
||||
font.pixelSize: Style.font.bodySmall
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
id: controls
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Style.spaceReal(8)
|
||||
|
||||
CardIconButton {
|
||||
icon: "⏮"
|
||||
onActivated: root.controlRequested("previous")
|
||||
}
|
||||
|
||||
CardIconButton {
|
||||
icon: root.playing ? "⏸" : "▶"
|
||||
onActivated: root.controlRequested("play-pause")
|
||||
}
|
||||
|
||||
CardIconButton {
|
||||
icon: "⏭"
|
||||
onActivated: root.controlRequested("next")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import QtQuick
|
||||
import Quickshell.Io
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property string command: ""
|
||||
property int intervalMs: 2000
|
||||
property bool value: false
|
||||
property bool polling: false
|
||||
|
||||
function refresh() {
|
||||
if (root.command.length > 0 && !probe.running) probe.running = true
|
||||
}
|
||||
|
||||
Process {
|
||||
id: probe
|
||||
command: ["bash", "-c", root.command]
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: root.value = text.trim() === "on"
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
interval: root.intervalMs
|
||||
running: root.polling
|
||||
repeat: true
|
||||
onTriggered: root.refresh()
|
||||
}
|
||||
|
||||
onPollingChanged: if (root.polling) root.refresh()
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import QtQuick
|
||||
import Quickshell.Io
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property string command: ""
|
||||
property int intervalMs: 1000
|
||||
property string value: ""
|
||||
property bool polling: false
|
||||
|
||||
function refresh() {
|
||||
if (root.command.length > 0 && !probe.running) probe.running = true
|
||||
}
|
||||
|
||||
Process {
|
||||
id: probe
|
||||
command: ["bash", "-c", root.command]
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: root.value = text.trim()
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
interval: root.intervalMs
|
||||
running: root.polling
|
||||
repeat: true
|
||||
onTriggered: root.refresh()
|
||||
}
|
||||
|
||||
onPollingChanged: if (root.polling) root.refresh()
|
||||
}
|
||||
@@ -0,0 +1,271 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import Quickshell.Wayland
|
||||
import qs.Commons
|
||||
import qs.Ui
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property string blobPath: Quickshell.env("BLOB_PATH")
|
||||
property var shell: null
|
||||
property var manifest: null
|
||||
property bool opened: false
|
||||
|
||||
readonly property string pluginId: (manifest && manifest.id) || "blob.quick-settings"
|
||||
|
||||
function open(payloadJson) {
|
||||
root.opened = true
|
||||
}
|
||||
|
||||
function close() {
|
||||
root.opened = false
|
||||
}
|
||||
|
||||
function dismiss() {
|
||||
root.opened = false
|
||||
if (root.shell && typeof root.shell.hide === "function")
|
||||
root.shell.hide(root.pluginId)
|
||||
}
|
||||
|
||||
function run(command) {
|
||||
Quickshell.execDetached(["bash", "-c", command])
|
||||
}
|
||||
|
||||
function runAndDismiss(command) {
|
||||
root.run(command)
|
||||
root.dismiss()
|
||||
}
|
||||
|
||||
function openPanel(pluginId) {
|
||||
root.dismiss()
|
||||
if (root.shell && typeof root.shell.summon === "function") root.shell.summon(pluginId, "")
|
||||
else root.run("blob-shell shell summon " + pluginId)
|
||||
}
|
||||
|
||||
function refreshState() {
|
||||
bluetoothFlag.refresh()
|
||||
dndFlag.refresh()
|
||||
nightLightFlag.refresh()
|
||||
stayAwakeFlag.refresh()
|
||||
tabletFlag.refresh()
|
||||
recordingFlag.refresh()
|
||||
volumeValue.refresh()
|
||||
mutedFlag.refresh()
|
||||
brightnessValue.refresh()
|
||||
mediaValue.refresh()
|
||||
}
|
||||
|
||||
function toggleAndRefresh(command) {
|
||||
root.run(command)
|
||||
stateSettleTimer.restart()
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: stateSettleTimer
|
||||
interval: 250
|
||||
onTriggered: root.refreshState()
|
||||
}
|
||||
|
||||
PolledFlag {
|
||||
id: bluetoothFlag
|
||||
polling: root.opened
|
||||
command: "bluetoothctl show 2>/dev/null | grep -q 'Powered: yes' && echo on || echo off"
|
||||
}
|
||||
|
||||
PolledFlag {
|
||||
id: dndFlag
|
||||
polling: root.opened
|
||||
command: "blob-shell notifications dndState 2>/dev/null"
|
||||
}
|
||||
|
||||
PolledFlag {
|
||||
id: nightLightFlag
|
||||
polling: root.opened
|
||||
command: "blob-toggle-nightlight --status 2>/dev/null | grep -q '\"enabled\":true' && echo on || echo off"
|
||||
}
|
||||
|
||||
PolledFlag {
|
||||
id: stayAwakeFlag
|
||||
polling: root.opened
|
||||
command: "blob-toggle-idle status 2>/dev/null | grep -q '\"enabled\":true' && echo on || echo off"
|
||||
}
|
||||
|
||||
PolledFlag {
|
||||
id: tabletFlag
|
||||
polling: root.opened
|
||||
command: "blob-toggle-tablet status 2>/dev/null | grep -q '\"enabled\":true' && echo on || echo off"
|
||||
}
|
||||
|
||||
PolledFlag {
|
||||
id: recordingFlag
|
||||
polling: root.opened
|
||||
command: "pgrep -f '^gpu-screen-recorder' >/dev/null && echo on || echo off"
|
||||
}
|
||||
|
||||
PolledFlag {
|
||||
id: mutedFlag
|
||||
polling: root.opened
|
||||
intervalMs: 1000
|
||||
command: "pamixer --get-mute 2>/dev/null | grep -qx true && echo on || echo off"
|
||||
}
|
||||
|
||||
PolledText {
|
||||
id: volumeValue
|
||||
polling: root.opened
|
||||
intervalMs: 1000
|
||||
command: "pamixer --get-volume 2>/dev/null || echo 0"
|
||||
}
|
||||
|
||||
PolledText {
|
||||
id: brightnessValue
|
||||
polling: root.opened
|
||||
intervalMs: 2000
|
||||
command: "brightnessctl -m 2>/dev/null | cut -d, -f4 | tr -d '%' || echo 0"
|
||||
}
|
||||
|
||||
PolledText {
|
||||
id: clockValue
|
||||
polling: root.opened
|
||||
intervalMs: 1000
|
||||
command: "date '+%H:%M'"
|
||||
}
|
||||
|
||||
PolledText {
|
||||
id: dateValue
|
||||
polling: root.opened
|
||||
intervalMs: 10000
|
||||
command: "date '+%A, %B %-d'"
|
||||
}
|
||||
|
||||
PolledText {
|
||||
id: mediaValue
|
||||
polling: root.opened
|
||||
intervalMs: 1000
|
||||
command: "playerctl metadata -f '{{title}}|||{{artist}}|||{{status}}' 2>/dev/null || echo 'No Media||||||Stopped'"
|
||||
}
|
||||
|
||||
PolledText {
|
||||
id: weatherValue
|
||||
polling: root.opened
|
||||
intervalMs: 600000
|
||||
command: "blob-weather-card 2>/dev/null"
|
||||
}
|
||||
|
||||
readonly property var mediaParts: String(mediaValue.value).split("|||")
|
||||
|
||||
// blob-weather-card prints "<glyph> <place> . Temp <t> . Wind <w>",
|
||||
// with the separator spelled with a middle dot. Anything shorter than three
|
||||
// fields is the failure line, which the card shows as unavailable.
|
||||
readonly property var weatherFields: String(weatherValue.value).split(" \u00b7 ")
|
||||
readonly property bool weatherAvailable: weatherFields.length >= 3
|
||||
readonly property var weatherHead: weatherAvailable
|
||||
? String(weatherFields[0]).match(/^(\S+)\s*(.*)$/) : null
|
||||
readonly property string weatherGlyph: weatherHead ? weatherHead[1] : ""
|
||||
readonly property string weatherPlace: weatherHead
|
||||
? String(weatherHead[2]).trim() : (weatherValue.value.length > 0 ? weatherValue.value : "Loading...")
|
||||
readonly property string weatherTemperature: weatherAvailable
|
||||
? String(weatherFields[1]).replace(/^Temp\s*/, "") : ""
|
||||
readonly property string weatherWind: weatherAvailable
|
||||
? String(weatherFields[2]).replace(/^Wind\s*/, "") : ""
|
||||
|
||||
PanelWindow {
|
||||
id: panel
|
||||
visible: root.opened
|
||||
anchors { top: true; bottom: true; left: true; right: true }
|
||||
color: "transparent"
|
||||
WlrLayershell.namespace: "blob-quick-settings"
|
||||
WlrLayershell.layer: WlrLayer.Overlay
|
||||
WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand
|
||||
exclusionMode: ExclusionMode.Ignore
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: root.dismiss()
|
||||
}
|
||||
|
||||
Row {
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: Style.spaceReal(10)
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
spacing: Style.spaceReal(12)
|
||||
|
||||
WeatherCard {
|
||||
available: root.weatherAvailable
|
||||
glyph: root.weatherGlyph
|
||||
place: root.weatherPlace
|
||||
temperature: root.weatherTemperature
|
||||
wind: root.weatherWind
|
||||
}
|
||||
|
||||
Card {
|
||||
id: controlCentre
|
||||
implicitWidth: Style.spaceReal(400)
|
||||
fillColor: Util.alpha(Color.background, Style.panelFillAlpha)
|
||||
spacing: Style.spaceReal(12)
|
||||
|
||||
Header {
|
||||
width: parent.width
|
||||
clock: clockValue.value
|
||||
today: dateValue.value
|
||||
onLockRequested: root.runAndDismiss("blob-system-lock")
|
||||
onLogoutRequested: root.runAndDismiss("blob-system-logout")
|
||||
onCloseRequested: root.dismiss()
|
||||
}
|
||||
|
||||
Calendar {
|
||||
width: parent.width
|
||||
polling: root.opened
|
||||
}
|
||||
|
||||
Tiles {
|
||||
bluetoothOn: bluetoothFlag.value
|
||||
doNotDisturb: dndFlag.value
|
||||
nightLight: nightLightFlag.value
|
||||
recording: recordingFlag.value
|
||||
stayAwake: stayAwakeFlag.value
|
||||
tabletFollow: tabletFlag.value
|
||||
onRunRequested: function(command) { root.runAndDismiss(command) }
|
||||
onPanelRequested: function(pluginId) { root.openPanel(pluginId) }
|
||||
onToggleRequested: function(command) { root.toggleAndRefresh(command) }
|
||||
}
|
||||
|
||||
SliderRow {
|
||||
width: parent.width
|
||||
icon: mutedFlag.value ? "" : ""
|
||||
dimmed: mutedFlag.value
|
||||
value: Number(volumeValue.value) || 0
|
||||
onIconActivated: root.toggleAndRefresh("pamixer --toggle-mute")
|
||||
onValueRequested: function(next) {
|
||||
root.run("pamixer --set-volume " + next)
|
||||
volumeValue.value = String(next)
|
||||
}
|
||||
}
|
||||
|
||||
SliderRow {
|
||||
width: parent.width
|
||||
icon: ""
|
||||
value: Number(brightnessValue.value) || 0
|
||||
onValueRequested: function(next) {
|
||||
root.run("brightnessctl set " + next + "%")
|
||||
brightnessValue.value = String(next)
|
||||
}
|
||||
}
|
||||
|
||||
MediaRow {
|
||||
width: parent.width
|
||||
title: root.mediaParts.length > 0 ? root.mediaParts[0] : ""
|
||||
artist: root.mediaParts.length > 1 ? root.mediaParts[1] : ""
|
||||
status: root.mediaParts.length > 2 ? root.mediaParts[2] : "Stopped"
|
||||
onControlRequested: function(action) {
|
||||
root.run("playerctl " + action)
|
||||
stateSettleTimer.restart()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onOpenedChanged: if (root.opened) root.refreshState()
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
import QtQuick
|
||||
import qs.Commons
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property string icon: ""
|
||||
property int value: 0
|
||||
property bool dimmed: false
|
||||
signal iconActivated()
|
||||
signal valueRequested(int value)
|
||||
|
||||
implicitHeight: Style.spaceReal(24)
|
||||
|
||||
Text {
|
||||
id: iconText
|
||||
anchors.left: parent.left
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: Style.spaceReal(22)
|
||||
text: root.icon
|
||||
textFormat: Text.PlainText
|
||||
color: root.dimmed ? Util.alpha(Color.magenta, 0.5) : Color.magenta
|
||||
font.family: Style.font.family
|
||||
font.pixelSize: Style.font.body
|
||||
|
||||
TapHandler {
|
||||
onTapped: root.iconActivated()
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: trough
|
||||
anchors.left: iconText.right
|
||||
anchors.leftMargin: Style.spaceReal(10)
|
||||
anchors.right: valueText.left
|
||||
anchors.rightMargin: Style.spaceReal(10)
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
height: Style.spaceReal(8)
|
||||
radius: Style.cardRadius
|
||||
color: Util.alpha(Color.foreground, 0.2)
|
||||
|
||||
Rectangle {
|
||||
width: parent.width * Math.max(0, Math.min(100, root.value)) / 100
|
||||
height: parent.height
|
||||
radius: Style.cardRadius
|
||||
color: Color.accent
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
x: Math.max(0, Math.min(parent.width - width, parent.width * root.value / 100 - width / 2))
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: Style.spaceReal(14)
|
||||
height: width
|
||||
radius: Style.cardRadius
|
||||
color: Color.foreground
|
||||
}
|
||||
|
||||
TapHandler {
|
||||
onTapped: function(point) {
|
||||
root.valueRequested(Math.round(point.position.x / trough.width * 100))
|
||||
}
|
||||
}
|
||||
|
||||
DragHandler {
|
||||
target: null
|
||||
onCentroidChanged: {
|
||||
if (!active) return
|
||||
root.valueRequested(Math.round(centroid.position.x / trough.width * 100))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
id: valueText
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: Style.spaceReal(34)
|
||||
horizontalAlignment: Text.AlignRight
|
||||
text: root.value + "%"
|
||||
textFormat: Text.PlainText
|
||||
color: Color.foreground
|
||||
font.family: Style.font.family
|
||||
font.pixelSize: Style.font.bodySmall
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
import QtQuick
|
||||
import qs.Commons
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
property string icon: ""
|
||||
property string label: ""
|
||||
property bool active: false
|
||||
property string tooltip: ""
|
||||
signal activated()
|
||||
|
||||
implicitWidth: Style.spaceReal(96)
|
||||
implicitHeight: Style.spaceReal(58)
|
||||
radius: Style.cardRadius
|
||||
color: root.active
|
||||
? Color.accent
|
||||
: (hover.hovered ? Util.alpha(Color.blue, 0.25) : Util.alpha(Color.background, Style.cardFillAlpha))
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation { duration: 150 }
|
||||
}
|
||||
|
||||
readonly property color contentColor: root.active ? Color.background : Color.foreground
|
||||
|
||||
Column {
|
||||
anchors.centerIn: parent
|
||||
spacing: Style.spaceReal(4)
|
||||
|
||||
Text {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text: root.icon
|
||||
textFormat: Text.PlainText
|
||||
color: root.contentColor
|
||||
font.family: Style.font.family
|
||||
font.pixelSize: Style.font.body
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text: root.label
|
||||
textFormat: Text.PlainText
|
||||
color: root.contentColor
|
||||
font.family: Style.font.family
|
||||
font.pixelSize: Style.font.bodySmall
|
||||
}
|
||||
}
|
||||
|
||||
HoverHandler {
|
||||
id: hover
|
||||
}
|
||||
|
||||
TapHandler {
|
||||
onTapped: root.activated()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
import QtQuick
|
||||
import qs.Commons
|
||||
|
||||
Grid {
|
||||
id: root
|
||||
|
||||
property bool bluetoothOn: false
|
||||
property bool doNotDisturb: false
|
||||
property bool nightLight: false
|
||||
property bool recording: false
|
||||
property bool stayAwake: false
|
||||
property bool tabletFollow: false
|
||||
|
||||
signal runRequested(string command)
|
||||
signal panelRequested(string pluginId)
|
||||
signal toggleRequested(string command)
|
||||
|
||||
columns: 3
|
||||
columnSpacing: Style.spaceReal(8)
|
||||
rowSpacing: Style.spaceReal(8)
|
||||
|
||||
Tile {
|
||||
icon: ""
|
||||
label: "Wi-Fi"
|
||||
onActivated: root.panelRequested("blob.network")
|
||||
}
|
||||
|
||||
Tile {
|
||||
icon: ""
|
||||
label: "Bluetooth"
|
||||
active: root.bluetoothOn
|
||||
onActivated: root.panelRequested("blob.bluetooth")
|
||||
}
|
||||
|
||||
Tile {
|
||||
icon: ""
|
||||
label: "Wallpaper"
|
||||
onActivated: root.runRequested("blob-wallpaper-set --menu")
|
||||
}
|
||||
|
||||
Tile {
|
||||
icon: ""
|
||||
label: "Silence"
|
||||
active: root.doNotDisturb
|
||||
onActivated: root.toggleRequested("blob-shell notifications toggleDnd")
|
||||
}
|
||||
|
||||
Tile {
|
||||
icon: ""
|
||||
label: "Night Light"
|
||||
active: root.nightLight
|
||||
onActivated: root.toggleRequested("blob-toggle-nightlight")
|
||||
}
|
||||
|
||||
Tile {
|
||||
icon: ""
|
||||
label: "Record"
|
||||
active: root.recording
|
||||
tooltip: root.recording ? "Stop screen recording" : "Start a screen recording"
|
||||
onActivated: root.runRequested(root.recording
|
||||
? "blob-capture-record --stop-recording"
|
||||
: "blob-menu toggle trigger.capture.screenrecord")
|
||||
}
|
||||
|
||||
Tile {
|
||||
icon: ""
|
||||
label: "Stay Awake"
|
||||
active: root.stayAwake
|
||||
tooltip: root.stayAwake ? "Allow idle lock and screensaver" : "Keep the screen awake"
|
||||
onActivated: root.toggleRequested("blob-toggle-idle toggle")
|
||||
}
|
||||
|
||||
Tile {
|
||||
icon: ""
|
||||
label: "Pick Color"
|
||||
onActivated: root.runRequested("hyprpicker -a")
|
||||
}
|
||||
|
||||
Tile {
|
||||
icon: ""
|
||||
label: "Theme"
|
||||
onActivated: root.runRequested("blob-theme-menu")
|
||||
}
|
||||
|
||||
Tile {
|
||||
icon: ""
|
||||
label: "Tablet Lock"
|
||||
active: root.tabletFollow
|
||||
tooltip: root.tabletFollow ? "Tablet follows focused monitor" : "Tablet spans all monitors"
|
||||
onActivated: root.toggleRequested("blob-toggle-tablet toggle")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
import QtQuick
|
||||
import qs.Commons
|
||||
import qs.Ui
|
||||
|
||||
Card {
|
||||
id: root
|
||||
|
||||
property string place: "Loading..."
|
||||
property string glyph: ""
|
||||
property string temperature: ""
|
||||
property string wind: ""
|
||||
property bool available: false
|
||||
|
||||
implicitWidth: Style.spaceReal(190)
|
||||
|
||||
CardHeader {
|
||||
icon: root.available ? root.glyph : ""
|
||||
title: root.place
|
||||
}
|
||||
|
||||
Text {
|
||||
visible: !root.available
|
||||
text: "Weather unavailable"
|
||||
textFormat: Text.PlainText
|
||||
color: Util.alpha(Color.foreground, 0.7)
|
||||
font.family: Style.font.family
|
||||
font.pixelSize: Style.font.bodySmall
|
||||
}
|
||||
|
||||
StatRow {
|
||||
width: parent.width
|
||||
visible: root.available
|
||||
icon: ""
|
||||
label: "Temperature"
|
||||
value: root.temperature
|
||||
}
|
||||
|
||||
StatRow {
|
||||
width: parent.width
|
||||
visible: root.available
|
||||
icon: ""
|
||||
label: "Wind"
|
||||
value: root.wind
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"name": "Quick settings",
|
||||
"version": "1.0.0",
|
||||
"author": "Blob",
|
||||
"description": "Control centre with tiles, sliders, calendar, media, and weather",
|
||||
"id": "blob.quick-settings",
|
||||
"kinds": [
|
||||
"overlay"
|
||||
],
|
||||
"keepLoaded": true,
|
||||
"entryPoints": {
|
||||
"overlay": "QuickSettings.qml"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user