Skip to content

Commit 796c6e7

Browse files
committed
fix(hyprland-visual-editor): ajuste de última hora en la lógica de archivos
1 parent 08be0a6 commit 796c6e7

2 files changed

Lines changed: 23 additions & 18 deletions

File tree

hyprland-visual-editor/BarWidget.qml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,25 @@ import qs.Widgets
77
NIconButton {
88
id: root
99

10+
// ── Injected Properties ──────────────────────────────────────────────
1011
property var pluginApi: null
1112
property ShellScreen screen
1213
property string widgetId: ""
1314
property string section: ""
1415
property int sectionWidgetIndex: -1
1516
property int sectionWidgetsCount: 0
1617

18+
// ── Configuration Logic (Fallback Pattern) ──────────────────────────
1719
property var cfg: pluginApi?.pluginSettings || ({})
1820
property var defaults: pluginApi?.manifest?.metadata?.defaultSettings || ({})
1921

2022
readonly property string iconKey: cfg.icon ?? defaults.icon ?? "adjustments-horizontal"
2123
readonly property string iconColorKey: cfg.iconColor ?? defaults.iconColor ?? "primary"
2224

25+
// ── Visual Configuration ─────────────────────────────────────────────────
2326
icon: iconKey
27+
28+
// NIconButton already manages tooltips automatically with these two properties:
2429
tooltipText: pluginApi?.tr("widget.tooltip")
2530
tooltipDirection: BarService.getTooltipDirection(screen?.name)
2631

@@ -29,6 +34,7 @@ NIconButton {
2934

3035
colorBg: Style.capsuleColor
3136

37+
// Color resolution with transparency protection (Alpha check)
3238
colorFg: {
3339
let resolved = Color.resolveColorKeyOptional(iconColorKey);
3440
if (root.containsMouse) return Color.mOnHover;
@@ -38,27 +44,22 @@ NIconButton {
3844
border.color: Style.capsuleBorderColor
3945
border.width: Style.borderS
4046

47+
// Color transition smoothing
4148
Behavior on colorFg {
4249
ColorAnimation {
4350
duration: Style.animationFast
4451
easing.type: Easing.InOutQuad
4552
}
4653
}
4754

55+
// ── Interacciones ────────────────────────────────────────────────────────
4856
onClicked: {
4957
if (pluginApi) {
5058
pluginApi.openPanel(root.screen, this);
5159
}
5260
}
5361

54-
onEntered: {
55-
TooltipService.show(root, pluginApi?.tr("widget.tooltip"), BarService.getTooltipDirection(screen?.name))
56-
}
57-
58-
onExited: {
59-
TooltipService.hide()
60-
}
61-
62+
// Context menu (Right click)
6263
NPopupContextMenu {
6364
id: contextMenu
6465

hyprland-visual-editor/Settings.qml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,19 @@ ColumnLayout {
88
id: root
99
property var pluginApi: null
1010

11-
// 1. Local state ('edit' convention and official fallbacks)
12-
property string editOverlayPath: pluginApi?.pluginSettings?.overlayPath || pluginApi?.manifest?.metadata?.defaultSettings?.overlayPath || "~/.cache/noctalia/HVE/overlay.conf"
13-
property bool editAutoApply: pluginApi?.pluginSettings?.autoApply ?? pluginApi?.manifest?.metadata?.defaultSettings?.autoApply ?? true
14-
property string editIcon: pluginApi?.pluginSettings?.icon || pluginApi?.manifest?.metadata?.defaultSettings?.icon || "adjustments-horizontal"
15-
property string editIconColor: pluginApi?.pluginSettings?.iconColor || pluginApi?.manifest?.metadata?.defaultSettings?.iconColor || "primary"
11+
// Settings and default values (Official Noctalia pattern)
12+
readonly property var cfg: pluginApi?.pluginSettings || ({})
13+
readonly property var defaults: pluginApi?.manifest?.metadata?.defaultSettings || ({})
14+
15+
// 1. Local state ('edit' convention to avoid unnecessary disk writes)
16+
property string editOverlayPath: cfg.overlayPath ?? defaults.overlayPath ?? "~/.cache/noctalia/HVE/overlay.conf"
17+
property bool editAutoApply: cfg.autoApply ?? defaults.autoApply ?? true
18+
property string editIcon: cfg.icon ?? defaults.icon ?? "adjustments-horizontal"
19+
property string editIconColor: cfg.iconColor ?? defaults.iconColor ?? "primary"
1620

1721
spacing: Style.marginM
1822

19-
// ── Preview ────────────────────────────────────────────────────────────────
23+
// ── Preview ──────────────────────────────────────────────────────────
2024
RowLayout {
2125
spacing: Style.marginM
2226
Layout.alignment: Qt.AlignHCenter
@@ -38,7 +42,7 @@ ColumnLayout {
3842
}
3943
}
4044

41-
// ── Icon Configuration ───────────────────────────────────────────────────
45+
// ── Icon Configuration ────────────────────────────────────────────────
4246
NButton {
4347
Layout.fillWidth: true
4448
text: pluginApi?.tr("settings.change_icon_button")
@@ -58,12 +62,12 @@ ColumnLayout {
5862
label: pluginApi?.tr("settings.icon_color_label")
5963
currentKey: root.editIconColor
6064
onSelected: key => { root.editIconColor = key }
61-
defaultValue: pluginApi?.manifest?.metadata?.defaultSettings?.iconColor || "primary"
65+
defaultValue: defaults.iconColor || "primary"
6266
}
6367

6468
NDivider { Layout.fillWidth: true }
6569

66-
// ── Files and Application Configuration (Recovered Section) ────────────────
70+
// ── Files and Application Configuration ────────────────────────────────
6771
NTextInput {
6872
Layout.fillWidth: true
6973
label: pluginApi?.tr("settings.path_label")
@@ -81,7 +85,7 @@ ColumnLayout {
8185
onToggled: checked => { root.editAutoApply = checked }
8286
}
8387

84-
// ── Save Function ────────────────────────────────────────────────────────
88+
// ── Save Function (Required by the Shell) ──────────────────────────
8589
function saveSettings() {
8690
if (!pluginApi) return
8791

0 commit comments

Comments
 (0)