Remove legacy bar widget modules
This commit is contained in:
@@ -1,8 +1,6 @@
|
|||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Bluetooth
|
|
||||||
import Quickshell.Hyprland
|
import Quickshell.Hyprland
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
import Quickshell.Services.Pipewire
|
|
||||||
import Quickshell.Services.SystemTray
|
import Quickshell.Services.SystemTray
|
||||||
import Quickshell.Services.UPower
|
import Quickshell.Services.UPower
|
||||||
import Quickshell.Wayland
|
import Quickshell.Wayland
|
||||||
@@ -58,22 +56,13 @@ Item {
|
|||||||
Behavior on foreground { ColorAnimation { duration: 420; easing.type: Easing.InOutCubic } }
|
Behavior on foreground { ColorAnimation { duration: 420; easing.type: Easing.InOutCubic } }
|
||||||
Behavior on background { ColorAnimation { duration: 420; easing.type: Easing.InOutCubic } }
|
Behavior on background { ColorAnimation { duration: 420; easing.type: Easing.InOutCubic } }
|
||||||
Behavior on urgent { ColorAnimation { duration: 420; easing.type: Easing.InOutCubic } }
|
Behavior on urgent { ColorAnimation { duration: 420; easing.type: Easing.InOutCubic } }
|
||||||
property string weatherText: ""
|
|
||||||
property string weatherClass: ""
|
|
||||||
property bool updateAvailable: false
|
property bool updateAvailable: false
|
||||||
property string voxtypeIcon: ""
|
property string voxtypeIcon: ""
|
||||||
property string voxtypeClass: ""
|
property string voxtypeClass: ""
|
||||||
property string screenRecordingText: ""
|
property string screenRecordingText: ""
|
||||||
property string screenRecordingTooltip: ""
|
property string screenRecordingTooltip: ""
|
||||||
property string idleText: ""
|
|
||||||
property string idleTooltip: ""
|
|
||||||
property string notificationSilencingText: ""
|
property string notificationSilencingText: ""
|
||||||
property string notificationSilencingTooltip: ""
|
property string notificationSilencingTooltip: ""
|
||||||
property int audioVolumePercent: -1
|
|
||||||
property string networkKind: "disconnected"
|
|
||||||
property string networkLabel: ""
|
|
||||||
property int networkSignal: -1
|
|
||||||
property string networkFrequency: ""
|
|
||||||
property bool clockAlt: false
|
property bool clockAlt: false
|
||||||
property var tooltipTarget: null
|
property var tooltipTarget: null
|
||||||
property string tooltipText: ""
|
property string tooltipText: ""
|
||||||
@@ -223,20 +212,13 @@ Item {
|
|||||||
case "omarchy": return omarchyModuleComponent
|
case "omarchy": return omarchyModuleComponent
|
||||||
case "workspaces": return workspacesModuleComponent
|
case "workspaces": return workspacesModuleComponent
|
||||||
case "clock": return clockModuleComponent
|
case "clock": return clockModuleComponent
|
||||||
case "weather": return weatherModuleComponent
|
|
||||||
case "update": return updateModuleComponent
|
case "update": return updateModuleComponent
|
||||||
case "voxtype": return voxtypeModuleComponent
|
case "voxtype": return voxtypeModuleComponent
|
||||||
case "screenRecording":
|
case "screenRecording":
|
||||||
case "screenrecording": return screenRecordingModuleComponent
|
case "screenrecording": return screenRecordingModuleComponent
|
||||||
case "idle": return idleModuleComponent
|
|
||||||
case "notifications":
|
case "notifications":
|
||||||
case "notificationSilencing": return notificationsModuleComponent
|
case "notificationSilencing": return notificationsModuleComponent
|
||||||
case "tray": return trayModuleComponent
|
case "tray": return trayModuleComponent
|
||||||
case "bluetooth": return bluetoothModuleComponent
|
|
||||||
case "network": return networkModuleComponent
|
|
||||||
case "audio":
|
|
||||||
case "pulseaudio": return audioModuleComponent
|
|
||||||
case "cpu": return cpuModuleComponent
|
|
||||||
case "battery": return batteryModuleComponent
|
case "battery": return batteryModuleComponent
|
||||||
default: return null
|
default: return null
|
||||||
}
|
}
|
||||||
@@ -338,37 +320,6 @@ Item {
|
|||||||
else finalize()
|
else finalize()
|
||||||
}
|
}
|
||||||
|
|
||||||
function networkCommand() {
|
|
||||||
return [
|
|
||||||
"device=$(ip route get 1.1.1.1 2>/dev/null | awk '{ for (i = 1; i <= NF; i++) if ($i == \"dev\") { print $(i + 1); exit } }')",
|
|
||||||
"if [[ -z $device ]]; then",
|
|
||||||
" printf 'disconnected\\t\\t\\t\\n'",
|
|
||||||
" exit 0",
|
|
||||||
"fi",
|
|
||||||
"if [[ ! -d /sys/class/net/$device/wireless ]]; then",
|
|
||||||
" printf 'ethernet\\t%s\\t\\t\\n' \"$device\"",
|
|
||||||
" exit 0",
|
|
||||||
"fi",
|
|
||||||
"show=$(iwctl station \"$device\" show 2>/dev/null | sed -e 's/\\x1b\\[[0-9;]*m//g')",
|
|
||||||
"state=$(awk '/^[[:space:]]*State[[:space:]]/ { sub(/.*State[[:space:]]+/, \"\"); sub(/[[:space:]]+$/, \"\"); print; exit }' <<<\"$show\")",
|
|
||||||
"ssid=$(awk '/^[[:space:]]*Connected network[[:space:]]/ { sub(/.*Connected network[[:space:]]+/, \"\"); sub(/[[:space:]]+$/, \"\"); print; exit }' <<<\"$show\")",
|
|
||||||
"freq=$(awk '/^[[:space:]]*Frequency[[:space:]]/ { sub(/.*Frequency[[:space:]]+/, \"\"); sub(/[[:space:]]+$/, \"\"); print; exit }' <<<\"$show\")",
|
|
||||||
"rssi=$(awk '/^[[:space:]]*RSSI[[:space:]]/ { sub(/.*RSSI[[:space:]]+/, \"\"); sub(/[[:space:]]+$/, \"\"); print; exit }' <<<\"$show\")",
|
|
||||||
"dbm=${rssi%% *}",
|
|
||||||
"signal=\"\"",
|
|
||||||
"if [[ -n $dbm ]]; then",
|
|
||||||
" if (( dbm >= -50 )); then signal=100",
|
|
||||||
" elif (( dbm <= -100 )); then signal=0",
|
|
||||||
" else signal=$(( 2 * (dbm + 100) )); fi",
|
|
||||||
"fi",
|
|
||||||
"if [[ -n $state && $state != connected ]]; then",
|
|
||||||
" printf 'disconnected\\t\\t\\t\\n'",
|
|
||||||
" exit 0",
|
|
||||||
"fi",
|
|
||||||
"printf 'wifi\\t%s\\t%s\\t%s\\n' \"${ssid:-$device}\" \"$signal\" \"$freq\""
|
|
||||||
].join("\n")
|
|
||||||
}
|
|
||||||
|
|
||||||
function run(command) {
|
function run(command) {
|
||||||
if (!command) return
|
if (!command) return
|
||||||
|
|
||||||
@@ -431,12 +382,6 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateWeather(raw) {
|
|
||||||
var data = parseModuleJson(raw)
|
|
||||||
weatherText = data.text || ""
|
|
||||||
weatherClass = data.class || ""
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateIndicator(name, raw) {
|
function updateIndicator(name, raw) {
|
||||||
var data = parseModuleJson(raw)
|
var data = parseModuleJson(raw)
|
||||||
var text = data.text || ""
|
var text = data.text || ""
|
||||||
@@ -445,9 +390,6 @@ Item {
|
|||||||
if (name === "screenRecording") {
|
if (name === "screenRecording") {
|
||||||
screenRecordingText = text
|
screenRecordingText = text
|
||||||
screenRecordingTooltip = tooltip
|
screenRecordingTooltip = tooltip
|
||||||
} else if (name === "idle") {
|
|
||||||
idleText = text
|
|
||||||
idleTooltip = tooltip
|
|
||||||
} else if (name === "notifications") {
|
} else if (name === "notifications") {
|
||||||
notificationSilencingText = text
|
notificationSilencingText = text
|
||||||
notificationSilencingTooltip = tooltip
|
notificationSilencingTooltip = tooltip
|
||||||
@@ -464,18 +406,6 @@ Item {
|
|||||||
else voxtypeIcon = ""
|
else voxtypeIcon = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateNetwork(raw) {
|
|
||||||
var parts = String(raw || "disconnected\t\t\t").replace(/\r?\n+$/, "").split("\t")
|
|
||||||
networkKind = parts[0] || "disconnected"
|
|
||||||
networkLabel = parts[1] || ""
|
|
||||||
networkSignal = parts[2] ? parseInt(parts[2], 10) : -1
|
|
||||||
networkFrequency = parts[3] || ""
|
|
||||||
}
|
|
||||||
|
|
||||||
function refreshWeather() {
|
|
||||||
runProcess(weatherProc)
|
|
||||||
}
|
|
||||||
|
|
||||||
function refreshUpdate() {
|
function refreshUpdate() {
|
||||||
runProcess(updateProc)
|
runProcess(updateProc)
|
||||||
}
|
}
|
||||||
@@ -486,23 +416,9 @@ Item {
|
|||||||
|
|
||||||
function refreshIndicators() {
|
function refreshIndicators() {
|
||||||
refreshScreenRecording()
|
refreshScreenRecording()
|
||||||
runProcess(idleProc)
|
|
||||||
runProcess(notificationSilencingProc)
|
runProcess(notificationSilencingProc)
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshNetwork() {
|
|
||||||
runProcess(networkProc)
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateAudioVolume(raw) {
|
|
||||||
var volume = parseInt(String(raw || "").trim(), 10)
|
|
||||||
audioVolumePercent = isNaN(volume) ? -1 : Math.max(0, volume)
|
|
||||||
}
|
|
||||||
|
|
||||||
function refreshAudio() {
|
|
||||||
runProcess(audioProc)
|
|
||||||
}
|
|
||||||
|
|
||||||
function workspaceById(id) {
|
function workspaceById(id) {
|
||||||
var values = Hyprland.workspaces.values
|
var values = Hyprland.workspaces.values
|
||||||
for (var i = 0; i < values.length; i++) {
|
for (var i = 0; i < values.length; i++) {
|
||||||
@@ -553,95 +469,6 @@ Item {
|
|||||||
return defaultIcons[index]
|
return defaultIcons[index]
|
||||||
}
|
}
|
||||||
|
|
||||||
function audioIcon() {
|
|
||||||
var sink = Pipewire.defaultAudioSink
|
|
||||||
if (!sink || !sink.audio) return ""
|
|
||||||
if (sink.audio.muted) return ""
|
|
||||||
|
|
||||||
var props = sink.properties || {}
|
|
||||||
var sinkText = String([
|
|
||||||
sink.name,
|
|
||||||
sink.description,
|
|
||||||
sink.nickname,
|
|
||||||
props["device.icon-name"],
|
|
||||||
props["device.product.name"],
|
|
||||||
props["node.name"]
|
|
||||||
].join(" ")).toLowerCase()
|
|
||||||
|
|
||||||
if (sinkText.indexOf("headphone") !== -1 || sinkText.indexOf("headset") !== -1)
|
|
||||||
return ""
|
|
||||||
|
|
||||||
var volume = sink.audio.volume
|
|
||||||
if (!isFinite(volume) && audioVolumePercent >= 0)
|
|
||||||
volume = audioVolumePercent / 100
|
|
||||||
if (!isFinite(volume)) return ""
|
|
||||||
if (volume < 0.34) return ""
|
|
||||||
if (volume < 0.67) return ""
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
function bluetoothIcon() {
|
|
||||||
var adapter = Bluetooth.defaultAdapter
|
|
||||||
if (!adapter) return ""
|
|
||||||
if (!adapter.enabled) return ""
|
|
||||||
|
|
||||||
var devices = Bluetooth.devices.values
|
|
||||||
for (var i = 0; i < devices.length; i++) {
|
|
||||||
if (devices[i].connected)
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
function networkIcon() {
|
|
||||||
if (networkKind === "wifi") {
|
|
||||||
var icons = ["", "", "", "", ""]
|
|
||||||
var index = Math.max(0, Math.min(4, Math.ceil(networkSignal / 20) - 1))
|
|
||||||
return icons[index]
|
|
||||||
}
|
|
||||||
|
|
||||||
if (networkKind === "ethernet") return ""
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
function networkTooltip() {
|
|
||||||
if (networkKind === "wifi") {
|
|
||||||
var frequency = parseFloat(networkFrequency)
|
|
||||||
var frequencyText = frequency > 0 ? " (" + (frequency / 1000).toFixed(1) + " GHz)" : ""
|
|
||||||
return (networkLabel || "Wi-Fi") + frequencyText
|
|
||||||
}
|
|
||||||
|
|
||||||
if (networkKind === "ethernet") return "Connected"
|
|
||||||
return "Disconnected"
|
|
||||||
}
|
|
||||||
|
|
||||||
function audioTooltip() {
|
|
||||||
var sink = Pipewire.defaultAudioSink
|
|
||||||
if (sink && sink.audio) {
|
|
||||||
var volume = sink.audio.volume
|
|
||||||
if (isFinite(volume))
|
|
||||||
return "Playing at " + Math.round(volume * 100) + "%"
|
|
||||||
}
|
|
||||||
|
|
||||||
if (audioVolumePercent >= 0)
|
|
||||||
return "Playing at " + audioVolumePercent + "%"
|
|
||||||
|
|
||||||
return "Audio"
|
|
||||||
}
|
|
||||||
|
|
||||||
function bluetoothTooltip() {
|
|
||||||
var count = 0
|
|
||||||
var devices = Bluetooth.devices.values
|
|
||||||
|
|
||||||
for (var i = 0; i < devices.length; i++) {
|
|
||||||
if (devices[i].connected)
|
|
||||||
count++
|
|
||||||
}
|
|
||||||
|
|
||||||
return "Devices connected: " + count
|
|
||||||
}
|
|
||||||
|
|
||||||
function batteryTooltip() {
|
function batteryTooltip() {
|
||||||
var device = UPower.displayDevice
|
var device = UPower.displayDevice
|
||||||
if (!device || !device.isPresent) return ""
|
if (!device || !device.isPresent) return ""
|
||||||
@@ -720,23 +547,6 @@ Item {
|
|||||||
onFileChanged: barHiddenProbe.running = true
|
onFileChanged: barHiddenProbe.running = true
|
||||||
}
|
}
|
||||||
|
|
||||||
Process {
|
|
||||||
id: weatherProc
|
|
||||||
command: ["bash", "-lc", root.commandWithOmarchyPath(root.shellQuote(root.omarchyPath + "/default/quickshell/omarchy-shell/scripts/weather.sh"))]
|
|
||||||
stdout: StdioCollector {
|
|
||||||
waitForEnd: true
|
|
||||||
onStreamFinished: root.updateWeather(text)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
interval: 60000
|
|
||||||
running: true
|
|
||||||
repeat: true
|
|
||||||
triggeredOnStart: true
|
|
||||||
onTriggered: root.refreshWeather()
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
Process {
|
||||||
id: updateProc
|
id: updateProc
|
||||||
command: ["bash", "-lc", root.commandWithOmarchyPath("omarchy-update-available")]
|
command: ["bash", "-lc", root.commandWithOmarchyPath("omarchy-update-available")]
|
||||||
@@ -774,15 +584,6 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Process {
|
|
||||||
id: idleProc
|
|
||||||
command: ["bash", "-lc", root.commandWithOmarchyPath(root.shellQuote(root.omarchyPath + "/default/quickshell/omarchy-shell/scripts/indicators/idle.sh"))]
|
|
||||||
stdout: StdioCollector {
|
|
||||||
waitForEnd: true
|
|
||||||
onStreamFinished: root.updateIndicator("idle", text)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
Process {
|
||||||
id: notificationSilencingProc
|
id: notificationSilencingProc
|
||||||
command: ["bash", "-lc", root.commandWithOmarchyPath(root.shellQuote(root.omarchyPath + "/default/quickshell/omarchy-shell/scripts/indicators/notification-silencing.sh"))]
|
command: ["bash", "-lc", root.commandWithOmarchyPath(root.shellQuote(root.omarchyPath + "/default/quickshell/omarchy-shell/scripts/indicators/notification-silencing.sh"))]
|
||||||
@@ -800,40 +601,6 @@ Item {
|
|||||||
onTriggered: root.refreshIndicators()
|
onTriggered: root.refreshIndicators()
|
||||||
}
|
}
|
||||||
|
|
||||||
Process {
|
|
||||||
id: networkProc
|
|
||||||
command: ["bash", "-lc", root.commandWithOmarchyPath(root.networkCommand())]
|
|
||||||
stdout: StdioCollector {
|
|
||||||
waitForEnd: true
|
|
||||||
onStreamFinished: root.updateNetwork(text)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
interval: 3000
|
|
||||||
running: true
|
|
||||||
repeat: true
|
|
||||||
triggeredOnStart: true
|
|
||||||
onTriggered: root.refreshNetwork()
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: audioProc
|
|
||||||
command: ["bash", "-lc", "if command -v pamixer >/dev/null; then pamixer --get-volume; elif command -v wpctl >/dev/null; then wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{ print int($2 * 100) }'; fi"]
|
|
||||||
stdout: StdioCollector {
|
|
||||||
waitForEnd: true
|
|
||||||
onStreamFinished: root.updateAudioVolume(text)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
interval: 2000
|
|
||||||
running: true
|
|
||||||
repeat: true
|
|
||||||
triggeredOnStart: true
|
|
||||||
onTriggered: root.refreshAudio()
|
|
||||||
}
|
|
||||||
|
|
||||||
IpcHandler {
|
IpcHandler {
|
||||||
target: "bar"
|
target: "bar"
|
||||||
|
|
||||||
@@ -999,17 +766,11 @@ Item {
|
|||||||
Component { id: omarchyModuleComponent; OmarchyModule {} }
|
Component { id: omarchyModuleComponent; OmarchyModule {} }
|
||||||
Component { id: workspacesModuleComponent; WorkspacesModule {} }
|
Component { id: workspacesModuleComponent; WorkspacesModule {} }
|
||||||
Component { id: clockModuleComponent; ClockModule {} }
|
Component { id: clockModuleComponent; ClockModule {} }
|
||||||
Component { id: weatherModuleComponent; WeatherModule {} }
|
|
||||||
Component { id: updateModuleComponent; UpdateModule {} }
|
Component { id: updateModuleComponent; UpdateModule {} }
|
||||||
Component { id: voxtypeModuleComponent; VoxtypeModule {} }
|
Component { id: voxtypeModuleComponent; VoxtypeModule {} }
|
||||||
Component { id: screenRecordingModuleComponent; ScreenRecordingModule {} }
|
Component { id: screenRecordingModuleComponent; ScreenRecordingModule {} }
|
||||||
Component { id: idleModuleComponent; IdleModule {} }
|
|
||||||
Component { id: notificationsModuleComponent; NotificationsModule {} }
|
Component { id: notificationsModuleComponent; NotificationsModule {} }
|
||||||
Component { id: trayModuleComponent; TrayModule {} }
|
Component { id: trayModuleComponent; TrayModule {} }
|
||||||
Component { id: bluetoothModuleComponent; BluetoothModule {} }
|
|
||||||
Component { id: networkModuleComponent; NetworkModule {} }
|
|
||||||
Component { id: audioModuleComponent; AudioModule {} }
|
|
||||||
Component { id: cpuModuleComponent; CpuModule {} }
|
|
||||||
Component { id: batteryModuleComponent; BatteryModule {} }
|
Component { id: batteryModuleComponent; BatteryModule {} }
|
||||||
|
|
||||||
function findCenterAnchorEntry() {
|
function findCenterAnchorEntry() {
|
||||||
@@ -1405,14 +1166,6 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component WeatherModule: ModuleButton {
|
|
||||||
text: root.weatherText
|
|
||||||
active: root.weatherClass === "active"
|
|
||||||
keepSpace: false
|
|
||||||
horizontalMargin: 7.5
|
|
||||||
onPressed: function() { root.run("omarchy-notification-send \"$(omarchy-weather-status)\"") }
|
|
||||||
}
|
|
||||||
|
|
||||||
component UpdateModule: ModuleButton {
|
component UpdateModule: ModuleButton {
|
||||||
text: root.updateAvailable ? "" : ""
|
text: root.updateAvailable ? "" : ""
|
||||||
fontSize: 10
|
fontSize: 10
|
||||||
@@ -1437,13 +1190,6 @@ Item {
|
|||||||
onPressed: function() { root.run("omarchy-capture-screenrecording") }
|
onPressed: function() { root.run("omarchy-capture-screenrecording") }
|
||||||
}
|
}
|
||||||
|
|
||||||
component IdleModule: IndicatorModule {
|
|
||||||
text: root.idleText
|
|
||||||
active: root.idleText !== ""
|
|
||||||
tooltipText: root.idleTooltip
|
|
||||||
onPressed: function() { root.run("omarchy-toggle-idle") }
|
|
||||||
}
|
|
||||||
|
|
||||||
component NotificationsModule: IndicatorModule {
|
component NotificationsModule: IndicatorModule {
|
||||||
text: root.notificationSilencingText
|
text: root.notificationSilencingText
|
||||||
active: root.notificationSilencingText !== ""
|
active: root.notificationSilencingText !== ""
|
||||||
@@ -1876,42 +1622,6 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component BluetoothModule: ModuleButton {
|
|
||||||
text: root.bluetoothIcon()
|
|
||||||
horizontalMargin: 8.5
|
|
||||||
visible: Bluetooth.defaultAdapter !== null
|
|
||||||
onPressed: function() { root.run("omarchy-launch-bluetooth") }
|
|
||||||
}
|
|
||||||
|
|
||||||
component NetworkModule: ModuleButton {
|
|
||||||
text: root.networkIcon()
|
|
||||||
horizontalMargin: 6.5
|
|
||||||
rightExtraMargin: 2
|
|
||||||
tooltipText: root.networkTooltip()
|
|
||||||
onPressed: function() { root.run("OMARCHY_PATH=" + root.shellQuote(root.omarchyPath) + " PATH=" + root.shellQuote(root.omarchyPath + "/bin:" + (Quickshell.env("PATH") || "")) + " " + root.shellQuote(root.omarchyPath + "/bin/omarchy-launch-wifi")) }
|
|
||||||
}
|
|
||||||
|
|
||||||
component AudioModule: ModuleButton {
|
|
||||||
text: root.audioIcon()
|
|
||||||
onPressed: function(button) {
|
|
||||||
if (button === Qt.RightButton) root.run("pamixer -t")
|
|
||||||
else root.run("omarchy-launch-audio")
|
|
||||||
}
|
|
||||||
onWheelMoved: function(delta) {
|
|
||||||
if (delta > 0) root.run("pamixer -i 5")
|
|
||||||
else if (delta < 0) root.run("pamixer -d 5")
|
|
||||||
root.refreshAudio()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
component CpuModule: ModuleButton {
|
|
||||||
text: ""
|
|
||||||
onPressed: function(button) {
|
|
||||||
if (button === Qt.RightButton) root.run("alacritty")
|
|
||||||
else root.run("omarchy-launch-or-focus-tui btop")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
component BatteryModule: ModuleButton {
|
component BatteryModule: ModuleButton {
|
||||||
property var device: UPower.displayDevice
|
property var device: UPower.displayDevice
|
||||||
|
|
||||||
|
|||||||
@@ -148,9 +148,61 @@ iwctl known-networks list 2>/dev/null \\
|
|||||||
if (net && net.connected) forget(net.ssid)
|
if (net && net.connected) forget(net.ssid)
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property string kind: bar ? bar.networkKind : "disconnected"
|
// Bar pill state. Polled locally so this panel is self-contained;
|
||||||
readonly property string label: bar ? bar.networkLabel : ""
|
// populated by networkProc + networkTimer below.
|
||||||
readonly property int signalStrength: bar ? bar.networkSignal : -1
|
property string kind: "disconnected"
|
||||||
|
property string label: ""
|
||||||
|
property int signalStrength: -1
|
||||||
|
property string frequency: ""
|
||||||
|
|
||||||
|
function updateNetwork(raw) {
|
||||||
|
var parts = String(raw || "disconnected\t\t\t").replace(/\r?\n+$/, "").split("\t")
|
||||||
|
kind = parts[0] || "disconnected"
|
||||||
|
label = parts[1] || ""
|
||||||
|
signalStrength = parts[2] ? parseInt(parts[2], 10) : -1
|
||||||
|
frequency = parts[3] || ""
|
||||||
|
}
|
||||||
|
|
||||||
|
function networkTooltip() {
|
||||||
|
if (kind === "wifi") {
|
||||||
|
var f = parseFloat(frequency)
|
||||||
|
var ftext = f > 0 ? " (" + (f / 1000).toFixed(1) + " GHz)" : ""
|
||||||
|
return (label || "Wi-Fi") + ftext
|
||||||
|
}
|
||||||
|
if (kind === "ethernet") return "Connected"
|
||||||
|
return "Disconnected"
|
||||||
|
}
|
||||||
|
|
||||||
|
function networkCommand() {
|
||||||
|
return [
|
||||||
|
"device=$(ip route get 1.1.1.1 2>/dev/null | awk '{ for (i = 1; i <= NF; i++) if ($i == \"dev\") { print $(i + 1); exit } }')",
|
||||||
|
"if [[ -z $device ]]; then",
|
||||||
|
" printf 'disconnected\\t\\t\\t\\n'",
|
||||||
|
" exit 0",
|
||||||
|
"fi",
|
||||||
|
"if [[ ! -d /sys/class/net/$device/wireless ]]; then",
|
||||||
|
" printf 'ethernet\\t%s\\t\\t\\n' \"$device\"",
|
||||||
|
" exit 0",
|
||||||
|
"fi",
|
||||||
|
"show=$(iwctl station \"$device\" show 2>/dev/null | sed -e 's/\\x1b\\[[0-9;]*m//g')",
|
||||||
|
"state=$(awk '/^[[:space:]]*State[[:space:]]/ { sub(/.*State[[:space:]]+/, \"\"); sub(/[[:space:]]+$/, \"\"); print; exit }' <<<\"$show\")",
|
||||||
|
"ssid=$(awk '/^[[:space:]]*Connected network[[:space:]]/ { sub(/.*Connected network[[:space:]]+/, \"\"); sub(/[[:space:]]+$/, \"\"); print; exit }' <<<\"$show\")",
|
||||||
|
"freq=$(awk '/^[[:space:]]*Frequency[[:space:]]/ { sub(/.*Frequency[[:space:]]+/, \"\"); sub(/[[:space:]]+$/, \"\"); print; exit }' <<<\"$show\")",
|
||||||
|
"rssi=$(awk '/^[[:space:]]*RSSI[[:space:]]/ { sub(/.*RSSI[[:space:]]+/, \"\"); sub(/[[:space:]]+$/, \"\"); print; exit }' <<<\"$show\")",
|
||||||
|
"dbm=${rssi%% *}",
|
||||||
|
"signal=\"\"",
|
||||||
|
"if [[ -n $dbm ]]; then",
|
||||||
|
" if (( dbm >= -50 )); then signal=100",
|
||||||
|
" elif (( dbm <= -100 )); then signal=0",
|
||||||
|
" else signal=$(( 2 * (dbm + 100) )); fi",
|
||||||
|
"fi",
|
||||||
|
"if [[ -n $state && $state != connected ]]; then",
|
||||||
|
" printf 'disconnected\\t\\t\\t\\n'",
|
||||||
|
" exit 0",
|
||||||
|
"fi",
|
||||||
|
"printf 'wifi\\t%s\\t%s\\t%s\\n' \"${ssid:-$device}\" \"$signal\" \"$freq\""
|
||||||
|
].join("\n")
|
||||||
|
}
|
||||||
|
|
||||||
readonly property string icon: {
|
readonly property string icon: {
|
||||||
if (kind === "wifi") {
|
if (kind === "wifi") {
|
||||||
@@ -525,7 +577,7 @@ iwctl station "$station" get-networks rssi-dbms 2>/dev/null \\
|
|||||||
text: root.icon
|
text: root.icon
|
||||||
horizontalMargin: 8.5
|
horizontalMargin: 8.5
|
||||||
rightExtraMargin: 2
|
rightExtraMargin: 2
|
||||||
tooltipText: bar ? bar.networkTooltip() : ""
|
tooltipText: root.networkTooltip()
|
||||||
|
|
||||||
onPressed: function(b) {
|
onPressed: function(b) {
|
||||||
if (b === Qt.RightButton) root.launchImpala()
|
if (b === Qt.RightButton) root.launchImpala()
|
||||||
@@ -1146,4 +1198,23 @@ iwctl known-networks list 2>/dev/null \\
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Poll the wifi/ethernet pill state every 3s. Local to this panel so
|
||||||
|
// Bar.qml does not need to mirror network state.
|
||||||
|
Process {
|
||||||
|
id: networkProc
|
||||||
|
command: ["bash", "-lc", root.bar ? root.bar.commandWithOmarchyPath(root.networkCommand()) : ""]
|
||||||
|
stdout: StdioCollector {
|
||||||
|
waitForEnd: true
|
||||||
|
onStreamFinished: root.updateNetwork(text)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
interval: 3000
|
||||||
|
running: true
|
||||||
|
repeat: true
|
||||||
|
triggeredOnStart: true
|
||||||
|
onTriggered: if (!networkProc.running) networkProc.running = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,8 +30,16 @@ Item {
|
|||||||
property var dailyForecastReport: null
|
property var dailyForecastReport: null
|
||||||
property string wttrLocation: ""
|
property string wttrLocation: ""
|
||||||
|
|
||||||
readonly property string label: bar ? bar.weatherText : ""
|
// Bar pill state. Polled locally; populated by weatherProc below.
|
||||||
readonly property string klass: bar ? bar.weatherClass : ""
|
property string label: ""
|
||||||
|
property string klass: ""
|
||||||
|
|
||||||
|
function updateWeather(raw) {
|
||||||
|
var data
|
||||||
|
try { data = JSON.parse(raw || "{}") } catch (e) { data = {} }
|
||||||
|
label = data.text || ""
|
||||||
|
klass = data.class || ""
|
||||||
|
}
|
||||||
|
|
||||||
readonly property var current: report && report.current_condition && report.current_condition[0] ? report.current_condition[0] : null
|
readonly property var current: report && report.current_condition && report.current_condition[0] ? report.current_condition[0] : null
|
||||||
readonly property var areaInfo: report && report.nearest_area && report.nearest_area[0] ? report.nearest_area[0] : null
|
readonly property var areaInfo: report && report.nearest_area && report.nearest_area[0] ? report.nearest_area[0] : null
|
||||||
@@ -533,4 +541,22 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Poll the weather pill text/class every minute. Local to this widget.
|
||||||
|
Process {
|
||||||
|
id: weatherProc
|
||||||
|
command: ["bash", "-lc", root.bar ? root.bar.commandWithOmarchyPath(root.bar.shellQuote(root.bar.omarchyPath + "/default/quickshell/omarchy-shell/scripts/weather.sh")) : ""]
|
||||||
|
stdout: StdioCollector {
|
||||||
|
waitForEnd: true
|
||||||
|
onStreamFinished: root.updateWeather(text)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
interval: 60000
|
||||||
|
running: true
|
||||||
|
repeat: true
|
||||||
|
triggeredOnStart: true
|
||||||
|
onTriggered: if (!weatherProc.running) weatherProc.running = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -306,21 +306,15 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ---------------- widget catalog -----------------------------------------
|
// ---------------- widget catalog -----------------------------------------
|
||||||
readonly property var legacyWidgetMeta: ({
|
readonly property var builtinWidgetMeta: ({
|
||||||
"omarchy": { name: "Omarchy menu", description: "Launches the Omarchy menu", category: "Compositor" },
|
"omarchy": { name: "Omarchy menu", description: "Launches the Omarchy menu", category: "Compositor" },
|
||||||
"workspaces": { name: "Workspaces", description: "Workspace number indicators", category: "Compositor" },
|
"workspaces": { name: "Workspaces", description: "Workspace number indicators", category: "Compositor" },
|
||||||
"clock": { name: "Clock", description: "Date / time text", category: "Time" },
|
"clock": { name: "Clock", description: "Date / time text", category: "Time" },
|
||||||
"weather": { name: "Weather (legacy)", description: "Tiny weather pill", category: "Info" },
|
|
||||||
"update": { name: "Updates", description: "Indicates available system updates", category: "System" },
|
"update": { name: "Updates", description: "Indicates available system updates", category: "System" },
|
||||||
"voxtype": { name: "Voxtype", description: "Voxtype dictation state", category: "Status" },
|
"voxtype": { name: "Voxtype", description: "Voxtype dictation state", category: "Status" },
|
||||||
"screenRecording": { name: "Screen recording", description: "Active recording indicator", category: "Status" },
|
"screenRecording": { name: "Screen recording", description: "Active recording indicator", category: "Status" },
|
||||||
"idle": { name: "Idle (legacy)", description: "Inhibitor indicator", category: "Status" },
|
|
||||||
"notifications": { name: "DND", description: "Do-not-disturb indicator", category: "Status" },
|
"notifications": { name: "DND", description: "Do-not-disturb indicator", category: "Status" },
|
||||||
"tray": { name: "System tray", description: "Status notifier items", category: "Status" },
|
"tray": { name: "System tray", description: "Status notifier items", category: "Status" },
|
||||||
"bluetooth": { name: "Bluetooth (legacy)", description: "Bluetooth status icon", category: "Network" },
|
|
||||||
"network": { name: "Network (legacy)", description: "Wi-Fi / ethernet status", category: "Network" },
|
|
||||||
"audio": { name: "Volume (legacy)", description: "Speaker icon, scroll for volume", category: "Audio" },
|
|
||||||
"cpu": { name: "CPU (legacy)", description: "btop launcher", category: "System" },
|
|
||||||
"battery": { name: "Battery", description: "Battery percent and ETA", category: "System" }
|
"battery": { name: "Battery", description: "Battery percent and ETA", category: "System" }
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -344,7 +338,7 @@ Item {
|
|||||||
var key = String(id || "")
|
var key = String(id || "")
|
||||||
if (root.barWidgetRegistry && root.barWidgetRegistry.has(key))
|
if (root.barWidgetRegistry && root.barWidgetRegistry.has(key))
|
||||||
return root.barWidgetRegistry.metadataFor(key) || {}
|
return root.barWidgetRegistry.metadataFor(key) || {}
|
||||||
if (legacyWidgetMeta[key]) return legacyWidgetMeta[key]
|
if (builtinWidgetMeta[key]) return builtinWidgetMeta[key]
|
||||||
|
|
||||||
var manifest = root.pluginRegistry ? root.pluginRegistry.installedPlugins[key] : null
|
var manifest = root.pluginRegistry ? root.pluginRegistry.installedPlugins[key] : null
|
||||||
if (manifest) {
|
if (manifest) {
|
||||||
@@ -409,7 +403,7 @@ Item {
|
|||||||
ids[pid] = true
|
ids[pid] = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (var key in legacyWidgetMeta) ids[key] = true
|
for (var key in builtinWidgetMeta) ids[key] = true
|
||||||
return Object.keys(ids)
|
return Object.keys(ids)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -432,7 +426,7 @@ Item {
|
|||||||
var manifest = root.pluginRegistry ? root.pluginRegistry.installedPlugins[id] : null
|
var manifest = root.pluginRegistry ? root.pluginRegistry.installedPlugins[id] : null
|
||||||
var manifestIsBarWidget = manifest && Array.isArray(manifest.kinds) && manifest.kinds.indexOf("bar-widget") !== -1
|
var manifestIsBarWidget = manifest && Array.isArray(manifest.kinds) && manifest.kinds.indexOf("bar-widget") !== -1
|
||||||
var isBarWidget = !!(meta && meta.source !== "plugin") || manifestIsBarWidget
|
var isBarWidget = !!(meta && meta.source !== "plugin") || manifestIsBarWidget
|
||||||
if (!isBarWidget && !legacyWidgetMeta[id]) continue
|
if (!isBarWidget && !builtinWidgetMeta[id]) continue
|
||||||
|
|
||||||
var inSection = sectionArray(section)
|
var inSection = sectionArray(section)
|
||||||
var existsHere = false
|
var existsHere = false
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
"id": "screenRecording"
|
"id": "screenRecording"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "idle"
|
"id": "idleInhibitor"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "notifications"
|
"id": "notifications"
|
||||||
|
|||||||
Reference in New Issue
Block a user