Files
omarchycn/shell/plugins/bar/widgets/TrayModel.js
dc698e5df0 Suppress LocalSend's redundant tray item (#6852)
LocalSend registers an Ayatana item with no ItemIsMenu and no Activate
handler, so its primary click is a silent no-op and the menu offers only
Open and Quit. Share > Receive already opens it, so drop the item the way
Dropbox's is dropped when its dedicated widget owns the surface.

Closes #6838

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-14 08:23:45 +02:00

49 lines
1.4 KiB
JavaScript

function text(value) {
return String(value || "").toLowerCase()
}
function itemNamed(item, name) {
if (!item) return false
return text(item.id).indexOf(name) !== -1
|| text(item.title).indexOf(name) !== -1
|| text(item.tooltipTitle).indexOf(name) !== -1
}
function entryId(entry) {
if (typeof entry === "string") return entry
if (entry && typeof entry === "object") {
var id = entry.id
if (id !== undefined && id !== null && String(id) !== "") return String(id)
}
return ""
}
function layoutHasWidget(layout, id) {
var sections = ["left", "center", "right"]
for (var s = 0; s < sections.length; s++) {
var entries = layout && layout[sections[s]]
if (!Array.isArray(entries)) continue
for (var i = 0; i < entries.length; i++) {
if (entryId(entries[i]) === id) return true
}
}
return false
}
// LocalSend's item shows no state, offers only Open and Quit, and its primary
// click is a no-op, so Share > Receive is the whole surface. Hiding it by hand
// doesn't stick either: LocalSend picks a fresh tray id every launch.
function ownedByOmarchy(item, layout) {
return itemNamed(item, "localsend")
|| (layoutHasWidget(layout, "omarchy.dropbox") && itemNamed(item, "dropbox"))
}
if (typeof module !== "undefined") {
module.exports = {
itemNamed: itemNamed,
entryId: entryId,
layoutHasWidget: layoutHasWidget,
ownedByOmarchy: ownedByOmarchy
}
}