changes to config plugin, reduce file amount + code, fix greeter
This commit is contained in:
+1
-1
@@ -74,7 +74,7 @@ RowLayout {
|
||||
id: repeater
|
||||
|
||||
model: ScriptModel {
|
||||
values: Config.bar.entries.filter(e => e.enabled)
|
||||
values: Config.bar.entries.values.filter(e => e.enabled)
|
||||
}
|
||||
|
||||
DelegateChooser {
|
||||
|
||||
@@ -20,7 +20,7 @@ Searcher {
|
||||
Variants {
|
||||
id: variants
|
||||
|
||||
model: Config.launcher.actions.filter(a => (a.enabled ?? true) && (Config.launcher.enableDangerousActions || !(a.dangerous ?? false)))
|
||||
model: Config.launcher.actions.values.filter(a => (a.enabled ?? true) && (Config.launcher.enableDangerousActions || !(a.dangerous ?? false)))
|
||||
|
||||
Action {
|
||||
}
|
||||
|
||||
@@ -1,162 +0,0 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import Quickshell.Services.UPower
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import qs.Modules
|
||||
import qs.Components
|
||||
import qs.Helpers
|
||||
import ZShell.Config
|
||||
import qs.Services
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
|
||||
anchors.fill: parent
|
||||
anchors.margins: Tokens.padding.large * 2
|
||||
anchors.topMargin: Tokens.padding.large
|
||||
spacing: Tokens.spacing.small
|
||||
|
||||
RowLayout {
|
||||
Layout.fillHeight: false
|
||||
Layout.fillWidth: true
|
||||
spacing: Tokens.spacing.normal
|
||||
|
||||
CustomRect {
|
||||
color: Colors.palette.m3primary
|
||||
implicitHeight: prompt.implicitHeight + Tokens.padding.normal * 2
|
||||
implicitWidth: prompt.implicitWidth + Tokens.padding.normal * 2
|
||||
radius: Tokens.rounding.small
|
||||
|
||||
MonoText {
|
||||
id: prompt
|
||||
|
||||
anchors.centerIn: parent
|
||||
color: Colors.palette.m3onPrimary
|
||||
font.pointSize: root.width > 400 ? Tokens.font.size.larger : Tokens.font.size.normal
|
||||
text: ">"
|
||||
}
|
||||
}
|
||||
|
||||
MonoText {
|
||||
Layout.fillWidth: true
|
||||
elide: Text.ElideRight
|
||||
font.pointSize: root.width > 400 ? Tokens.font.size.larger : Tokens.font.size.normal
|
||||
text: "caelestiafetch.sh"
|
||||
}
|
||||
|
||||
WrappedLoader {
|
||||
Layout.fillHeight: true
|
||||
active: !iconLoader.active
|
||||
|
||||
sourceComponent: OsLogo {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillHeight: false
|
||||
Layout.fillWidth: true
|
||||
spacing: height * 0.15
|
||||
|
||||
WrappedLoader {
|
||||
id: iconLoader
|
||||
|
||||
Layout.fillHeight: true
|
||||
active: root.width > 320
|
||||
|
||||
sourceComponent: OsLogo {
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Layout.bottomMargin: Tokens.padding.normal
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: iconLoader.active ? 0 : width * 0.1
|
||||
Layout.topMargin: Tokens.padding.normal
|
||||
spacing: Tokens.spacing.normal
|
||||
|
||||
WrappedLoader {
|
||||
Layout.fillWidth: true
|
||||
active: !batLoader.active && root.height > 200
|
||||
|
||||
sourceComponent: FetchText {
|
||||
text: `OS : ${SystemInfo.osPrettyName || SysInfo.osName}`
|
||||
}
|
||||
}
|
||||
|
||||
WrappedLoader {
|
||||
Layout.fillWidth: true
|
||||
active: root.height > (batLoader.active ? 200 : 110)
|
||||
|
||||
sourceComponent: FetchText {
|
||||
text: `WM : ${SystemInfo.wm}`
|
||||
}
|
||||
}
|
||||
|
||||
WrappedLoader {
|
||||
Layout.fillWidth: true
|
||||
active: !batLoader.active || root.height > 110
|
||||
|
||||
sourceComponent: FetchText {
|
||||
text: `USER: ${SystemInfo.user}`
|
||||
}
|
||||
}
|
||||
|
||||
FetchText {
|
||||
text: `UP : ${SystemInfo.uptime}`
|
||||
}
|
||||
|
||||
WrappedLoader {
|
||||
id: batLoader
|
||||
|
||||
Layout.fillWidth: true
|
||||
active: UPower.displayDevice.isLaptopBattery
|
||||
|
||||
sourceComponent: FetchText {
|
||||
text: `BATT: ${[UPowerDeviceState.Charging, UPowerDeviceState.FullyCharged, UPowerDeviceState.PendingCharge].includes(UPower.displayDevice.state) ? "(+) " : ""}${Math.round(UPower.displayDevice.percentage * 100)}%`
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WrappedLoader {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
active: root.height > 180
|
||||
|
||||
sourceComponent: RowLayout {
|
||||
spacing: Tokens.spacing.large
|
||||
|
||||
Repeater {
|
||||
model: Math.max(0, Math.min(8, root.width / (Tokens.font.size.larger * 2 + Tokens.spacing.large)))
|
||||
|
||||
CustomRect {
|
||||
required property int index
|
||||
|
||||
color: Colors.palette[`term${index}`]
|
||||
implicitHeight: Tokens.font.size.larger * 2
|
||||
implicitWidth: implicitHeight
|
||||
radius: Tokens.rounding.small
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
component FetchText: MonoText {
|
||||
Layout.fillWidth: true
|
||||
elide: Text.ElideRight
|
||||
font.pointSize: root.width > 400 ? Tokens.font.size.larger : Tokens.font.size.normal
|
||||
}
|
||||
component MonoText: CustomText {
|
||||
font.family: Appearance.font.family.mono
|
||||
}
|
||||
component OsLogo: ColoredIcon {
|
||||
color: Colors.palette.m3primary
|
||||
implicitSize: height
|
||||
layer.enabled: Config.lock.recolorLogo || SystemInfo.isDefaultLogo
|
||||
source: SystemInfo.osLogo
|
||||
}
|
||||
component WrappedLoader: Loader {
|
||||
visible: active
|
||||
}
|
||||
}
|
||||
@@ -171,10 +171,11 @@ ListView {
|
||||
item.held = true;
|
||||
|
||||
itemContent.x = Qt.binding(() => {
|
||||
if (!root)
|
||||
if (!root) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const maxOvershoot = Tokens.padding.extraExtraLarge;
|
||||
const maxOvershoot = Tokens.padding.extraLargeIncreased;
|
||||
const x = mouse.mouseX - item.pressPos.x;
|
||||
return root.dampOvershoot(Math.abs(x), maxOvershoot) * Math.sign(x);
|
||||
});
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick.Layouts
|
||||
import ZShell.Config
|
||||
import qs.Modules.Settings.Common
|
||||
@@ -42,42 +40,24 @@ PageBase {
|
||||
}
|
||||
|
||||
first: true
|
||||
values: Config.bar.tray.statusIcons
|
||||
values: Config.bar.tray.statusIcons.values
|
||||
z: 1
|
||||
|
||||
onItemMoved: (from, to) => {
|
||||
const icons = Config.bar.tray.statusIcons.slice();
|
||||
const [moved] = icons.splice(from, 1);
|
||||
icons.splice(to, 0, moved);
|
||||
Config.bar.tray.statusIcons = icons;
|
||||
}
|
||||
onItemRemoved: index => {
|
||||
const icons = Config.bar.tray.statusIcons.slice();
|
||||
icons.splice(index, 1);
|
||||
Config.bar.tray.statusIcons = icons;
|
||||
}
|
||||
onItemToggled: (index, checked) => {
|
||||
const icons = Config.bar.tray.statusIcons.slice();
|
||||
icons[index] = Object.assign({}, icons[index], {
|
||||
enabled: checked
|
||||
});
|
||||
Config.bar.tray.statusIcons = icons;
|
||||
}
|
||||
onItemMoved: (from, to) => Config.bar.tray.statusIcons.move(from, to)
|
||||
onItemRemoved: index => Config.bar.tray.statusIcons.remove(index)
|
||||
onItemToggled: (index, checked) => Config.bar.tray.statusIcons.at(index).enabled = checked
|
||||
}
|
||||
|
||||
DialogSelectButton {
|
||||
id: addItemContainer
|
||||
|
||||
acceptLabel: qsTr("Add")
|
||||
enabled: {
|
||||
console.log(Object.keys(model).length);
|
||||
return Object.keys(model).length > 0;
|
||||
}
|
||||
enabled: Object.keys(model).length > 0
|
||||
header: qsTr("Add new entry")
|
||||
icon: "add"
|
||||
label: qsTr("Add entry")
|
||||
model: {
|
||||
const present = new Set(Config.bar.tray.statusIcons.map(item => item.id));
|
||||
const present = new Set(Config.bar.tray.statusIcons.values.map(item => item.id));
|
||||
return Object.keys(root.builtinIcons).filter(id => !present.has(id)).map(id => ({
|
||||
id: id,
|
||||
label: root.builtinIcons[id]
|
||||
@@ -89,12 +69,10 @@ PageBase {
|
||||
if (!selectedItem)
|
||||
return;
|
||||
|
||||
const icons = Config.bar.tray.statusIcons.slice();
|
||||
icons.push({
|
||||
Config.bar.tray.statusIcons.insert({
|
||||
id: selectedItem,
|
||||
enabled: true
|
||||
});
|
||||
Config.bar.tray.statusIcons = icons;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,6 +84,7 @@ PageBase {
|
||||
ToggleRow {
|
||||
checked: Config.bar.popouts.statusIcons
|
||||
first: true
|
||||
last: true
|
||||
settingAnchor: "bar-status-popout-on-hover"
|
||||
subtext: qsTr("Show a details popout when hovering the status icons")
|
||||
text: qsTr("Popout on hover")
|
||||
|
||||
@@ -56,7 +56,7 @@ CustomClippingRect {
|
||||
model: ScriptModel {
|
||||
id: model
|
||||
|
||||
values: Config.bar.tray.statusIcons.filter(e => e.enabled)
|
||||
values: Config.bar.tray.statusIcons.values.filter(e => e.enabled)
|
||||
}
|
||||
|
||||
DelegateChooser {
|
||||
|
||||
Reference in New Issue
Block a user