Autoformating
This commit is contained in:
parent
18484f6686
commit
cb554f106b
15 changed files with 170 additions and 103 deletions
|
|
@ -43,9 +43,11 @@ Loader {
|
||||||
}
|
}
|
||||||
|
|
||||||
margins {
|
margins {
|
||||||
top: ((modelData && Settings.data.bar.monitors.includes(modelData.name)) || (Settings.data.bar.monitors.length === 0))
|
top: ((modelData && Settings.data.bar.monitors.includes(modelData.name))
|
||||||
|
|| (Settings.data.bar.monitors.length === 0))
|
||||||
&& Settings.data.bar.position === "top" ? Math.floor(Style.barHeight * scaling) : 0
|
&& Settings.data.bar.position === "top" ? Math.floor(Style.barHeight * scaling) : 0
|
||||||
bottom: ((modelData && Settings.data.bar.monitors.includes(modelData.name)) || (Settings.data.bar.monitors.length === 0))
|
bottom: ((modelData && Settings.data.bar.monitors.includes(modelData.name))
|
||||||
|
|| (Settings.data.bar.monitors.length === 0))
|
||||||
&& Settings.data.bar.position === "bottom" ? Math.floor(Style.barHeight * scaling) : 0
|
&& Settings.data.bar.position === "bottom" ? Math.floor(Style.barHeight * scaling) : 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,8 @@ NPill {
|
||||||
if (root.battery.changeRate !== undefined) {
|
if (root.battery.changeRate !== undefined) {
|
||||||
const rate = root.battery.changeRate
|
const rate = root.battery.changeRate
|
||||||
if (rate > 0) {
|
if (rate > 0) {
|
||||||
lines.push(root.charging ? "Charging rate: " + rate.toFixed(2) + " W" : "Discharging rate: " + rate.toFixed(2) + " W")
|
lines.push(root.charging ? "Charging rate: " + rate.toFixed(2) + " W" : "Discharging rate: " + rate.toFixed(
|
||||||
|
2) + " W")
|
||||||
} else if (rate < 0) {
|
} else if (rate < 0) {
|
||||||
lines.push("Discharging rate: " + Math.abs(rate).toFixed(2) + " W")
|
lines.push("Discharging rate: " + Math.abs(rate).toFixed(2) + " W")
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,8 @@ Item {
|
||||||
function getIcon() {
|
function getIcon() {
|
||||||
var monitor = getMonitor()
|
var monitor = getMonitor()
|
||||||
var brightness = monitor ? monitor.brightness : 0
|
var brightness = monitor ? monitor.brightness : 0
|
||||||
return brightness <= 0 ? "brightness_1" : brightness < 0.33 ? "brightness_low" : brightness < 0.66 ? "brightness_medium" : "brightness_high"
|
return brightness <= 0 ? "brightness_1" : brightness < 0.33 ? "brightness_low" : brightness
|
||||||
|
< 0.66 ? "brightness_medium" : "brightness_high"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connection used to open the pill when brightness changes
|
// Connection used to open the pill when brightness changes
|
||||||
|
|
@ -64,13 +65,16 @@ Item {
|
||||||
}
|
}
|
||||||
tooltipText: {
|
tooltipText: {
|
||||||
var monitor = getMonitor()
|
var monitor = getMonitor()
|
||||||
if (!monitor) return ""
|
if (!monitor)
|
||||||
return "Brightness: " + Math.round(monitor.brightness * 100) + "%\nMethod: " + monitor.method + "\nLeft click for advanced settings.\nScroll up/down to change brightness."
|
return ""
|
||||||
|
return "Brightness: " + Math.round(monitor.brightness * 100) + "%\nMethod: " + monitor.method
|
||||||
|
+ "\nLeft click for advanced settings.\nScroll up/down to change brightness."
|
||||||
}
|
}
|
||||||
|
|
||||||
onWheel: function (angle) {
|
onWheel: function (angle) {
|
||||||
var monitor = getMonitor()
|
var monitor = getMonitor()
|
||||||
if (!monitor) return
|
if (!monitor)
|
||||||
|
return
|
||||||
if (angle > 0) {
|
if (angle > 0) {
|
||||||
monitor.increaseBrightness()
|
monitor.increaseBrightness()
|
||||||
} else if (angle < 0) {
|
} else if (angle < 0) {
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,14 @@ QtObject {
|
||||||
function parseImageMeta(preview) {
|
function parseImageMeta(preview) {
|
||||||
const re = /\[\[\s*binary data\s+([\d\.]+\s*(?:KiB|MiB|GiB|B))\s+(\w+)\s+(\d+)x(\d+)\s*\]\]/i
|
const re = /\[\[\s*binary data\s+([\d\.]+\s*(?:KiB|MiB|GiB|B))\s+(\w+)\s+(\d+)x(\d+)\s*\]\]/i
|
||||||
const m = (preview || "").match(re)
|
const m = (preview || "").match(re)
|
||||||
if (!m) return null
|
if (!m)
|
||||||
return { size: m[1], fmt: (m[2] || "").toUpperCase(), w: Number(m[3]), h: Number(m[4]) }
|
return null
|
||||||
|
return {
|
||||||
|
"size": m[1],
|
||||||
|
"fmt": (m[2] || "").toUpperCase(),
|
||||||
|
"w": Number(m[3]),
|
||||||
|
"h": Number(m[4])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatTextPreview(preview) {
|
function formatTextPreview(preview) {
|
||||||
|
|
@ -23,7 +29,10 @@ QtObject {
|
||||||
} else {
|
} else {
|
||||||
subtitle = `${normalized.length} chars`
|
subtitle = `${normalized.length} chars`
|
||||||
}
|
}
|
||||||
return { title, subtitle }
|
return {
|
||||||
|
"title": title,
|
||||||
|
"subtitle": subtitle
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function createClipboardEntry(item) {
|
function createClipboardEntry(item) {
|
||||||
|
|
|
||||||
|
|
@ -305,7 +305,7 @@ Loader {
|
||||||
border.width: Math.max(1, Style.borderL * scaling)
|
border.width: Math.max(1, Style.borderL * scaling)
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
// Circular audio visualizer when music is playing
|
// Circular audio visualizer when music is playing
|
||||||
Loader {
|
Loader {
|
||||||
active: MediaService.isPlaying && Settings.data.audio.visualizerType == "linear"
|
active: MediaService.isPlaying && Settings.data.audio.visualizerType == "linear"
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
|
@ -351,10 +351,12 @@ Loader {
|
||||||
model: CavaService.values.length * 2
|
model: CavaService.values.length * 2
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
property int mirroredValueIndex: index < CavaService.values.length ? index : (CavaService.values.length * 2 - 1 - index)
|
property int mirroredValueIndex: index < CavaService.values.length ? index : (CavaService.values.length
|
||||||
|
* 2 - 1 - index)
|
||||||
property real mirroredAngle: (index / (CavaService.values.length * 2)) * 2 * Math.PI
|
property real mirroredAngle: (index / (CavaService.values.length * 2)) * 2 * Math.PI
|
||||||
property real mirroredRadius: 70 * scaling
|
property real mirroredRadius: 70 * scaling
|
||||||
property real mirroredBarLength: Math.max(2, CavaService.values[mirroredValueIndex] * 30 * scaling)
|
property real mirroredBarLength: Math.max(2,
|
||||||
|
CavaService.values[mirroredValueIndex] * 30 * scaling)
|
||||||
property real mirroredBarWidth: 3 * scaling
|
property real mirroredBarWidth: 3 * scaling
|
||||||
|
|
||||||
width: mirroredBarWidth
|
width: mirroredBarWidth
|
||||||
|
|
|
||||||
|
|
@ -176,8 +176,6 @@ NPanel {
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -305,8 +305,8 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
currentKey: Settings.data.audio.visualizerType
|
currentKey: Settings.data.audio.visualizerType
|
||||||
onSelected: key => {
|
onSelected: key => {
|
||||||
Settings.data.audio.visualizerType = key
|
Settings.data.audio.visualizerType = key
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,8 +73,8 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
currentKey: Settings.data.bar.position
|
currentKey: Settings.data.bar.position
|
||||||
onSelected: key => {
|
onSelected: key => {
|
||||||
Settings.data.bar.position = key
|
Settings.data.bar.position = key
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,11 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NDivider { Layout.fillWidth: true; Layout.topMargin: Style.marginL * scaling; Layout.bottomMargin: Style.marginS * scaling }
|
NDivider {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: Style.marginL * scaling
|
||||||
|
Layout.bottomMargin: Style.marginS * scaling
|
||||||
|
}
|
||||||
|
|
||||||
NText {
|
NText {
|
||||||
text: "Launcher Position"
|
text: "Launcher Position"
|
||||||
|
|
@ -65,21 +69,33 @@ ColumnLayout {
|
||||||
description: "Choose where the Launcher panel appears."
|
description: "Choose where the Launcher panel appears."
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
model: ListModel {
|
model: ListModel {
|
||||||
ListElement { key: "center"; name: "Center (default)" }
|
ListElement {
|
||||||
ListElement { key: "top_left"; name: "Top Left" }
|
key: "center"
|
||||||
ListElement { key: "top_right"; name: "Top Right" }
|
name: "Center (default)"
|
||||||
ListElement { key: "bottom_left"; name: "Bottom Left" }
|
}
|
||||||
ListElement { key: "bottom_right"; name: "Bottom Right" }
|
ListElement {
|
||||||
|
key: "top_left"
|
||||||
|
name: "Top Left"
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
key: "top_right"
|
||||||
|
name: "Top Right"
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
key: "bottom_left"
|
||||||
|
name: "Bottom Left"
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
key: "bottom_right"
|
||||||
|
name: "Bottom Right"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
currentKey: Settings.data.appLauncher.position
|
currentKey: Settings.data.appLauncher.position
|
||||||
onSelected: function(key) {
|
onSelected: function (key) {
|
||||||
Settings.data.appLauncher.position = key
|
Settings.data.appLauncher.position = key
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -108,8 +108,8 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
currentKey: Settings.data.screenRecorder.videoSource
|
currentKey: Settings.data.screenRecorder.videoSource
|
||||||
onSelected: key => {
|
onSelected: key => {
|
||||||
Settings.data.screenRecorder.videoSource = key
|
Settings.data.screenRecorder.videoSource = key
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Frame Rate
|
// Frame Rate
|
||||||
|
|
@ -136,8 +136,8 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
currentKey: Settings.data.screenRecorder.frameRate
|
currentKey: Settings.data.screenRecorder.frameRate
|
||||||
onSelected: key => {
|
onSelected: key => {
|
||||||
Settings.data.screenRecorder.frameRate = key
|
Settings.data.screenRecorder.frameRate = key
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Video Quality
|
// Video Quality
|
||||||
|
|
@ -164,8 +164,8 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
currentKey: Settings.data.screenRecorder.quality
|
currentKey: Settings.data.screenRecorder.quality
|
||||||
onSelected: key => {
|
onSelected: key => {
|
||||||
Settings.data.screenRecorder.quality = key
|
Settings.data.screenRecorder.quality = key
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Video Codec
|
// Video Codec
|
||||||
|
|
@ -196,8 +196,8 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
currentKey: Settings.data.screenRecorder.videoCodec
|
currentKey: Settings.data.screenRecorder.videoCodec
|
||||||
onSelected: key => {
|
onSelected: key => {
|
||||||
Settings.data.screenRecorder.videoCodec = key
|
Settings.data.screenRecorder.videoCodec = key
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Color Range
|
// Color Range
|
||||||
|
|
@ -216,8 +216,8 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
currentKey: Settings.data.screenRecorder.colorRange
|
currentKey: Settings.data.screenRecorder.colorRange
|
||||||
onSelected: key => {
|
onSelected: key => {
|
||||||
Settings.data.screenRecorder.colorRange = key
|
Settings.data.screenRecorder.colorRange = key
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -260,8 +260,8 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
currentKey: Settings.data.screenRecorder.audioSource
|
currentKey: Settings.data.screenRecorder.audioSource
|
||||||
onSelected: key => {
|
onSelected: key => {
|
||||||
Settings.data.screenRecorder.audioSource = key
|
Settings.data.screenRecorder.audioSource = key
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Audio Codec
|
// Audio Codec
|
||||||
|
|
@ -280,8 +280,8 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
currentKey: Settings.data.screenRecorder.audioCodec
|
currentKey: Settings.data.screenRecorder.audioCodec
|
||||||
onSelected: key => {
|
onSelected: key => {
|
||||||
Settings.data.screenRecorder.audioCodec = key
|
Settings.data.screenRecorder.audioCodec = key
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -189,8 +189,8 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
currentKey: Settings.data.wallpaper.swww.resizeMethod
|
currentKey: Settings.data.wallpaper.swww.resizeMethod
|
||||||
onSelected: key => {
|
onSelected: key => {
|
||||||
Settings.data.wallpaper.swww.resizeMethod = key
|
Settings.data.wallpaper.swww.resizeMethod = key
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transition Type
|
// Transition Type
|
||||||
|
|
@ -257,8 +257,8 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
currentKey: Settings.data.wallpaper.swww.transitionType
|
currentKey: Settings.data.wallpaper.swww.transitionType
|
||||||
onSelected: key => {
|
onSelected: key => {
|
||||||
Settings.data.wallpaper.swww.transitionType = key
|
Settings.data.wallpaper.swww.transitionType = key
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transition FPS
|
// Transition FPS
|
||||||
|
|
|
||||||
|
|
@ -37,9 +37,9 @@ Singleton {
|
||||||
Process {
|
Process {
|
||||||
id: process
|
id: process
|
||||||
stdinEnabled: true
|
stdinEnabled: true
|
||||||
running: (Settings.data.audio.visualizerType !== "none") && (PanelService.sidePanel.active
|
running: (Settings.data.audio.visualizerType !== "none")
|
||||||
|| Settings.data.audio.showMiniplayerCava
|
&& (PanelService.sidePanel.active || Settings.data.audio.showMiniplayerCava
|
||||||
|| (PanelService.lockScreen && PanelService.lockScreen.active))
|
|| (PanelService.lockScreen && PanelService.lockScreen.active))
|
||||||
command: ["cava", "-p", "/dev/stdin"]
|
command: ["cava", "-p", "/dev/stdin"]
|
||||||
onExited: {
|
onExited: {
|
||||||
stdinEnabled = true
|
stdinEnabled = true
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,8 @@ Singleton {
|
||||||
|
|
||||||
// Start/stop watchers when enabled changes
|
// Start/stop watchers when enabled changes
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if (root.active) startWatchers()
|
if (root.active)
|
||||||
|
startWatchers()
|
||||||
}
|
}
|
||||||
onActiveChanged: {
|
onActiveChanged: {
|
||||||
if (root.active) {
|
if (root.active) {
|
||||||
|
|
@ -64,30 +65,40 @@ Singleton {
|
||||||
const lines = out.split('\n').filter(l => l.length > 0)
|
const lines = out.split('\n').filter(l => l.length > 0)
|
||||||
// cliphist list default format: "<id> <preview>" or "<id>\t<preview>"
|
// cliphist list default format: "<id> <preview>" or "<id>\t<preview>"
|
||||||
const parsed = lines.map(l => {
|
const parsed = lines.map(l => {
|
||||||
let id = ""
|
let id = ""
|
||||||
let preview = ""
|
let preview = ""
|
||||||
const m = l.match(/^(\d+)\s+(.+)$/)
|
const m = l.match(/^(\d+)\s+(.+)$/)
|
||||||
if (m) {
|
if (m) {
|
||||||
id = m[1]
|
id = m[1]
|
||||||
preview = m[2]
|
preview = m[2]
|
||||||
} else {
|
} else {
|
||||||
const tab = l.indexOf('\t')
|
const tab = l.indexOf('\t')
|
||||||
id = tab > -1 ? l.slice(0, tab) : l
|
id = tab > -1 ? l.slice(0, tab) : l
|
||||||
preview = tab > -1 ? l.slice(tab + 1) : ""
|
preview = tab > -1 ? l.slice(tab + 1) : ""
|
||||||
}
|
}
|
||||||
const lower = preview.toLowerCase()
|
const lower = preview.toLowerCase()
|
||||||
const isImage = lower.startsWith("[image]") || lower.includes(" binary data ")
|
const isImage = lower.startsWith("[image]") || lower.includes(" binary data ")
|
||||||
// Best-effort mime guess from preview
|
// Best-effort mime guess from preview
|
||||||
var mime = "text/plain"
|
var mime = "text/plain"
|
||||||
if (isImage) {
|
if (isImage) {
|
||||||
if (lower.includes(" png")) mime = "image/png"
|
if (lower.includes(" png"))
|
||||||
else if (lower.includes(" jpg") || lower.includes(" jpeg")) mime = "image/jpeg"
|
mime = "image/png"
|
||||||
else if (lower.includes(" webp")) mime = "image/webp"
|
else if (lower.includes(" jpg") || lower.includes(" jpeg"))
|
||||||
else if (lower.includes(" gif")) mime = "image/gif"
|
mime = "image/jpeg"
|
||||||
else mime = "image/*"
|
else if (lower.includes(" webp"))
|
||||||
}
|
mime = "image/webp"
|
||||||
return { id, preview, isImage, mime }
|
else if (lower.includes(" gif"))
|
||||||
})
|
mime = "image/gif"
|
||||||
|
else
|
||||||
|
mime = "image/*"
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
"id": id,
|
||||||
|
"preview": preview,
|
||||||
|
"isImage": isImage,
|
||||||
|
"mime": mime
|
||||||
|
}
|
||||||
|
})
|
||||||
items = parsed
|
items = parsed
|
||||||
loading = false
|
loading = false
|
||||||
}
|
}
|
||||||
|
|
@ -99,7 +110,11 @@ Singleton {
|
||||||
onExited: (exitCode, exitStatus) => {
|
onExited: (exitCode, exitStatus) => {
|
||||||
const out = String(stdout.text)
|
const out = String(stdout.text)
|
||||||
if (root._decodeCallback) {
|
if (root._decodeCallback) {
|
||||||
try { root._decodeCallback(out) } finally { root._decodeCallback = null }
|
try {
|
||||||
|
root._decodeCallback(out)
|
||||||
|
} finally {
|
||||||
|
root._decodeCallback = null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -117,7 +132,11 @@ Singleton {
|
||||||
const b64 = String(stdout.text).trim()
|
const b64 = String(stdout.text).trim()
|
||||||
if (root._b64CurrentCb) {
|
if (root._b64CurrentCb) {
|
||||||
const url = `data:${root._b64CurrentMime};base64,${b64}`
|
const url = `data:${root._b64CurrentMime};base64,${b64}`
|
||||||
try { root._b64CurrentCb(url) } finally { /* noop */ }
|
try {
|
||||||
|
root._b64CurrentCb(url)
|
||||||
|
} finally {
|
||||||
|
|
||||||
|
/* noop */ }
|
||||||
}
|
}
|
||||||
if (root._b64CurrentId !== "") {
|
if (root._b64CurrentId !== "") {
|
||||||
root.imageDataById[root._b64CurrentId] = `data:${root._b64CurrentMime};base64,${b64}`
|
root.imageDataById[root._b64CurrentId] = `data:${root._b64CurrentMime};base64,${b64}`
|
||||||
|
|
@ -136,19 +155,26 @@ Singleton {
|
||||||
stdout: StdioCollector {}
|
stdout: StdioCollector {}
|
||||||
onExited: (exitCode, exitStatus) => {
|
onExited: (exitCode, exitStatus) => {
|
||||||
// Auto-restart if watcher dies
|
// Auto-restart if watcher dies
|
||||||
if (root.autoWatch) Qt.callLater(() => { running = true })
|
if (root.autoWatch)
|
||||||
|
Qt.callLater(() => {
|
||||||
|
running = true
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Process {
|
Process {
|
||||||
id: watchImage
|
id: watchImage
|
||||||
stdout: StdioCollector {}
|
stdout: StdioCollector {}
|
||||||
onExited: (exitCode, exitStatus) => {
|
onExited: (exitCode, exitStatus) => {
|
||||||
if (root.autoWatch) Qt.callLater(() => { running = true })
|
if (root.autoWatch)
|
||||||
|
Qt.callLater(() => {
|
||||||
|
running = true
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function startWatchers() {
|
function startWatchers() {
|
||||||
if (!root.active || !autoWatch || watchersStarted) return
|
if (!root.active || !autoWatch || watchersStarted)
|
||||||
|
return
|
||||||
watchersStarted = true
|
watchersStarted = true
|
||||||
// Start text watcher
|
// Start text watcher
|
||||||
watchText.command = ["wl-paste", "--type", "text", "--watch", "cliphist", "store"]
|
watchText.command = ["wl-paste", "--type", "text", "--watch", "cliphist", "store"]
|
||||||
|
|
@ -159,15 +185,19 @@ Singleton {
|
||||||
}
|
}
|
||||||
|
|
||||||
function stopWatchers() {
|
function stopWatchers() {
|
||||||
if (!watchersStarted) return
|
if (!watchersStarted)
|
||||||
|
return
|
||||||
watchText.running = false
|
watchText.running = false
|
||||||
watchImage.running = false
|
watchImage.running = false
|
||||||
watchersStarted = false
|
watchersStarted = false
|
||||||
}
|
}
|
||||||
|
|
||||||
function list(maxPreviewWidth) {
|
function list(maxPreviewWidth) {
|
||||||
if (!root.active) { return }
|
if (!root.active) {
|
||||||
if (listProc.running) return
|
return
|
||||||
|
}
|
||||||
|
if (listProc.running)
|
||||||
|
return
|
||||||
loading = true
|
loading = true
|
||||||
const width = maxPreviewWidth || 100
|
const width = maxPreviewWidth || 100
|
||||||
listProc.command = ["cliphist", "list", "-preview-width", String(width)]
|
listProc.command = ["cliphist", "list", "-preview-width", String(width)]
|
||||||
|
|
@ -183,18 +213,24 @@ Singleton {
|
||||||
function decodeToDataUrl(id, mime, cb) {
|
function decodeToDataUrl(id, mime, cb) {
|
||||||
// If cached, return immediately
|
// If cached, return immediately
|
||||||
if (root.imageDataById[id]) {
|
if (root.imageDataById[id]) {
|
||||||
if (cb) cb(root.imageDataById[id])
|
if (cb)
|
||||||
|
cb(root.imageDataById[id])
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Queue request; ensures single process handles sequentially
|
// Queue request; ensures single process handles sequentially
|
||||||
root._b64Queue.push({ id, mime: mime || "image/*", cb })
|
root._b64Queue.push({
|
||||||
|
"id": id,
|
||||||
|
"mime": mime || "image/*",
|
||||||
|
"cb": cb
|
||||||
|
})
|
||||||
if (!decodeB64Proc.running && root._b64CurrentCb === null) {
|
if (!decodeB64Proc.running && root._b64CurrentCb === null) {
|
||||||
_startNextB64()
|
_startNextB64()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function _startNextB64() {
|
function _startNextB64() {
|
||||||
if (root._b64Queue.length === 0) return
|
if (root._b64Queue.length === 0)
|
||||||
|
return
|
||||||
const job = root._b64Queue.shift()
|
const job = root._b64Queue.shift()
|
||||||
root._b64CurrentCb = job.cb
|
root._b64CurrentCb = job.cb
|
||||||
root._b64CurrentMime = job.mime
|
root._b64CurrentMime = job.mime
|
||||||
|
|
@ -219,5 +255,3 @@ Singleton {
|
||||||
Qt.callLater(() => list())
|
Qt.callLater(() => list())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -131,6 +131,7 @@ Singleton {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e2) {
|
} catch (e2) {
|
||||||
|
|
||||||
// ignore occupancy errors; fall back to false
|
// ignore occupancy errors; fall back to false
|
||||||
}
|
}
|
||||||
for (var i = 0; i < hlWorkspaces.length; i++) {
|
for (var i = 0; i < hlWorkspaces.length; i++) {
|
||||||
|
|
@ -284,10 +285,10 @@ Singleton {
|
||||||
} else if (event.WindowOpenedOrChanged) {
|
} else if (event.WindowOpenedOrChanged) {
|
||||||
try {
|
try {
|
||||||
const windowData = event.WindowOpenedOrChanged.window
|
const windowData = event.WindowOpenedOrChanged.window
|
||||||
|
|
||||||
// Find if this window already exists
|
// Find if this window already exists
|
||||||
const existingIndex = windows.findIndex(w => w.id === windowData.id)
|
const existingIndex = windows.findIndex(w => w.id === windowData.id)
|
||||||
|
|
||||||
const newWindow = {
|
const newWindow = {
|
||||||
"id": windowData.id,
|
"id": windowData.id,
|
||||||
"title": windowData.title || "",
|
"title": windowData.title || "",
|
||||||
|
|
@ -295,7 +296,7 @@ Singleton {
|
||||||
"workspaceId": windowData.workspace_id || null,
|
"workspaceId": windowData.workspace_id || null,
|
||||||
"isFocused": windowData.is_focused === true
|
"isFocused": windowData.is_focused === true
|
||||||
}
|
}
|
||||||
|
|
||||||
if (existingIndex >= 0) {
|
if (existingIndex >= 0) {
|
||||||
// Update existing window
|
// Update existing window
|
||||||
windows[existingIndex] = newWindow
|
windows[existingIndex] = newWindow
|
||||||
|
|
@ -304,14 +305,14 @@ Singleton {
|
||||||
windows.push(newWindow)
|
windows.push(newWindow)
|
||||||
windows.sort((a, b) => a.id - b.id)
|
windows.sort((a, b) => a.id - b.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update focused window index if this window is focused
|
// Update focused window index if this window is focused
|
||||||
if (newWindow.isFocused) {
|
if (newWindow.isFocused) {
|
||||||
focusedWindowIndex = windows.findIndex(w => w.id === windowData.id)
|
focusedWindowIndex = windows.findIndex(w => w.id === windowData.id)
|
||||||
updateFocusedWindowTitle()
|
updateFocusedWindowTitle()
|
||||||
activeWindowChanged()
|
activeWindowChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
windowListChanged()
|
windowListChanged()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Logger.error("Compositor", "Error parsing WindowOpenedOrChanged event:", e)
|
Logger.error("Compositor", "Error parsing WindowOpenedOrChanged event:", e)
|
||||||
|
|
@ -319,7 +320,7 @@ Singleton {
|
||||||
} else if (event.WindowClosed) {
|
} else if (event.WindowClosed) {
|
||||||
try {
|
try {
|
||||||
const windowId = event.WindowClosed.id
|
const windowId = event.WindowClosed.id
|
||||||
|
|
||||||
// Remove the window from the list
|
// Remove the window from the list
|
||||||
const windowIndex = windows.findIndex(w => w.id === windowId)
|
const windowIndex = windows.findIndex(w => w.id === windowId)
|
||||||
if (windowIndex >= 0) {
|
if (windowIndex >= 0) {
|
||||||
|
|
@ -329,15 +330,15 @@ Singleton {
|
||||||
updateFocusedWindowTitle()
|
updateFocusedWindowTitle()
|
||||||
activeWindowChanged()
|
activeWindowChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the window
|
// Remove the window
|
||||||
windows.splice(windowIndex, 1)
|
windows.splice(windowIndex, 1)
|
||||||
|
|
||||||
// Adjust focused window index if needed
|
// Adjust focused window index if needed
|
||||||
if (focusedWindowIndex > windowIndex) {
|
if (focusedWindowIndex > windowIndex) {
|
||||||
focusedWindowIndex--
|
focusedWindowIndex--
|
||||||
}
|
}
|
||||||
|
|
||||||
windowListChanged()
|
windowListChanged()
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
||||||
|
|
@ -84,12 +84,12 @@ RowLayout {
|
||||||
root.exited()
|
root.exited()
|
||||||
}
|
}
|
||||||
onWheel: wheel => {
|
onWheel: wheel => {
|
||||||
if (wheel.angleDelta.y > 0 && spinBox.value < spinBox.to) {
|
if (wheel.angleDelta.y > 0 && spinBox.value < spinBox.to) {
|
||||||
spinBox.increase()
|
spinBox.increase()
|
||||||
} else if (wheel.angleDelta.y < 0 && spinBox.value > spinBox.from) {
|
} else if (wheel.angleDelta.y < 0 && spinBox.value > spinBox.from) {
|
||||||
spinBox.decrease()
|
spinBox.decrease()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decrease button (left)
|
// Decrease button (left)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue