Fork the desktop off Omarchy as a self-contained system
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
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 ownedByBlob(item, layout) {
|
||||
return itemNamed(item, "localsend")
|
||||
}
|
||||
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = {
|
||||
itemNamed: itemNamed,
|
||||
entryId: entryId,
|
||||
layoutHasWidget: layoutHasWidget,
|
||||
ownedByBlob: ownedByBlob
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user