move Theme, SystemStats, Modules to shell/services/
This commit is contained in:
parent
197f6976e0
commit
989182d603
59 changed files with 432 additions and 388 deletions
|
|
@ -2,11 +2,12 @@ import QtQuick
|
|||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import "." as M
|
||||
import "../services" as S
|
||||
|
||||
M.BarSection {
|
||||
id: root
|
||||
spacing: M.Theme.moduleSpacing
|
||||
opacity: M.Modules.bluetooth.enable && root.state !== "unavailable" ? 1 : 0
|
||||
spacing: S.Theme.moduleSpacing
|
||||
opacity: S.Modules.bluetooth.enable && root.state !== "unavailable" ? 1 : 0
|
||||
visible: opacity > 0
|
||||
tooltip: {
|
||||
if (root.state === "off")
|
||||
|
|
@ -35,7 +36,7 @@ M.BarSection {
|
|||
|
||||
Process {
|
||||
id: proc
|
||||
running: M.Modules.bluetooth.enable
|
||||
running: S.Modules.bluetooth.enable
|
||||
command: ["sh", "-c", "s=$(bluetoothctl show 2>/dev/null); " + "[ -z \"$s\" ] && echo unavailable && exit; " + "echo \"$s\" | grep -q 'Powered: yes' || { echo off:; exit; }; " + "info=$(bluetoothctl info 2>/dev/null); " + "d=$(echo \"$info\" | awk -F': ' '/\\tName:/{n=$2}/Connected: yes/{c=1}END{if(c)print n}'); " + "[ -n \"$d\" ] && echo \"connected:$d\" || { echo on:; exit; }; " + "bat=$(echo \"$info\" | awk -F': ' '/Battery Percentage.*\\(/{gsub(/[^0-9]/,\"\",$2);print $2}'); " + "[ -n \"$bat\" ] && echo \"bat:$bat\""]
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: root._parse(text)
|
||||
|
|
@ -44,7 +45,7 @@ M.BarSection {
|
|||
// Event-driven: watch BlueZ DBus property changes
|
||||
Process {
|
||||
id: btMonitor
|
||||
running: M.Modules.bluetooth.enable
|
||||
running: S.Modules.bluetooth.enable
|
||||
command: ["sh", "-c", "dbus-monitor --system \"interface='org.freedesktop.DBus.Properties',member='PropertiesChanged',path_namespace='/org/bluez'\" 2>/dev/null"]
|
||||
stdout: SplitParser {
|
||||
splitMarker: "\n"
|
||||
|
|
@ -58,14 +59,14 @@ M.BarSection {
|
|||
}
|
||||
Timer {
|
||||
interval: 60000
|
||||
running: M.Modules.bluetooth.enable
|
||||
running: S.Modules.bluetooth.enable
|
||||
repeat: true
|
||||
onTriggered: proc.running = true
|
||||
}
|
||||
|
||||
M.BarIcon {
|
||||
icon: "\uF294"
|
||||
color: root.state === "off" ? M.Theme.base04 : root.accentColor
|
||||
color: root.state === "off" ? S.Theme.base04 : root.accentColor
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
TapHandler {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue