added adaptive quickshell
This commit is contained in:
1 parent
6eb56d2065
commit
5b33a73fd8
189 files changed
+8678
-15
No files matched your search
@@ -0,0 +1,46 @@
|
||||
.pragma library
|
||||
|
||||
// Pure capability-to-UI policy. Device existence and device state are different:
|
||||
// disconnected Ethernet and disabled Wi-Fi must remain discoverable.
|
||||
function networkCapabilities(devices, wifiType, wiredType) {
|
||||
const list = devices || [];
|
||||
return {
|
||||
wifi: list.some(d => d && d.type === wifiType),
|
||||
wired: list.filter(d => d && d.type === wiredType),
|
||||
hasNetworkDevices: list.length > 0
|
||||
};
|
||||
}
|
||||
|
||||
function ethernetSummary(devices) {
|
||||
const list = devices || [];
|
||||
if (list.length === 0) return "";
|
||||
const connected = list.filter(d => d && d.connected).length;
|
||||
if (list.length === 1) return connected ? "Ethernet · подключено" : "Ethernet · нет подключения";
|
||||
return "Ethernet · " + connected + "/" + list.length;
|
||||
}
|
||||
|
||||
function visibleSettingsSections(hasAudio, hasNetwork, hasBluetooth, hasModem, hasBattery) {
|
||||
const sections = [{id: "appearance", title: "Оболочка"}];
|
||||
if (hasAudio) sections.push({id: "audio", title: "Звук"});
|
||||
if (hasNetwork) sections.push({id: "network", title: "Сеть и подключения"});
|
||||
sections.push({id: "wallpaper", title: "Обои"});
|
||||
if (hasBluetooth) sections.push({id: "bluetooth", title: "Bluetooth"});
|
||||
if (hasModem) sections.push({id: "modem", title: "Мобильная сеть и SIM"});
|
||||
if (hasBattery) sections.push({id: "battery", title: "Батарея и питание"});
|
||||
sections.push({id: "display", title: "Дисплей и яркость"});
|
||||
sections.push({id: "system", title: "О системе"});
|
||||
return sections;
|
||||
}
|
||||
|
||||
// Map stable section identifiers to the fixed StackLayout pages.
|
||||
function pageIndex(id) {
|
||||
const pages = {appearance: 0, audio: 1, network: 2, wallpaper: 3, bluetooth: 4, modem: 5, system: 6, battery: 7, display: 8};
|
||||
return Object.prototype.hasOwnProperty.call(pages, id) ? pages[id] : 0;
|
||||
}
|
||||
|
||||
function sectionIndex(sections, id) {
|
||||
const list = sections || [];
|
||||
for (let i = 0; i < list.length; ++i)
|
||||
if (list[i].id === id) return i;
|
||||
return -1;
|
||||
}
|
||||
Reference in new issue
Block a user