Skip to content

Commit

Permalink
feat: option for persistent highlight effect
Browse files Browse the repository at this point in the history
refs: #57
  • Loading branch information
luisbocanegra committed Jan 20, 2025
1 parent 2b90001 commit 977ec65
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 16 deletions.
3 changes: 3 additions & 0 deletions package/contents/config/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@
<entry name="scrollSensitivity" type="Int">
<default>120</default>
</entry>
<entry name="alwaysHighlighted" type="Bool">
<default>false</default>
</entry>
</group>

</kcfg>
38 changes: 24 additions & 14 deletions package/contents/ui/configAppearance.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ KCM.SimpleKCM {
property alias cfg_hoverBgRadius: hoverBgRadius.value
property alias cfg_bgFillPanel: bgFillPanel.checked
property alias cfg_length: fixedLength.value
property alias cfg_alwaysHighlighted: alwaysHighlighted.checked
property int cfg_screenWidth

signal configurationChanged
Expand All @@ -20,23 +21,42 @@ KCM.SimpleKCM {

Kirigami.Separator {
Kirigami.FormData.isSection: true
Kirigami.FormData.label: "Hover effet"
Kirigami.FormData.label: "Highlight"
}

CheckBox {
id: alwaysHighlighted
Kirigami.FormData.label: i18n("Always:")
checked: cfg_alwaysHighlighted

onCheckedChanged: {
cfg_alwaysHighlighted = checked
}
}

CheckBox {
id: showHoverBg
Kirigami.FormData.label: i18n("Highlight spacer background:")
// text: "Highlight spacer background when hovering it"
Kirigami.FormData.label: alwaysHighlighted.checked ? i18n("Increase on hover:") : i18n("On hover:")
checked: cfg_showHoverBg

onCheckedChanged: {
cfg_showHoverBg = checked
}
}

CheckBox {
id: bgFillPanel
Kirigami.FormData.label: i18n("Fill panel thickness:")
checked: cfg_bgFillPanel
enabled: showHoverBg.checked
onCheckedChanged: {
cfg_bgFillPanel = checked
}
}

SpinBox {
id: hoverBgRadius
Kirigami.FormData.label: i18n("Highlight radius:")
Kirigami.FormData.label: i18n("Radius:")
value: cfg_hoverBgRadius
from: 0
to: 99
Expand All @@ -47,16 +67,6 @@ KCM.SimpleKCM {
}
}

CheckBox {
id: bgFillPanel
Kirigami.FormData.label: i18n("Highlight fills panel:")
checked: cfg_bgFillPanel
enabled: showHoverBg.checked
onCheckedChanged: {
cfg_bgFillPanel = checked
}
}

Kirigami.Separator {
Kirigami.FormData.isSection: true
Kirigami.FormData.label: "Fixed size mode"
Expand Down
15 changes: 13 additions & 2 deletions package/contents/ui/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,19 @@ PlasmoidItem {
Rectangle {
anchors.fill: parent
color: Kirigami.Theme.highlightColor
opacity: Plasmoid.containment.corona?.editMode || (pressed && showHoverBg && overPanel) ? 0.6 : 0.2
visible: (Plasmoid.containment.corona?.editMode || animator.running || (hoverHandler.hovered && showHoverBg) || Plasmoid.userConfiguring)
opacity: {
if (Plasmoid.containment.corona?.editMode) {
return 1
} else if (pressed && showHoverBg && overPanel) {
return 0.6
} else if (showHoverBg && hoverHandler.hovered) {
return 0.3
} else if (plasmoid.configuration.alwaysHighlighted) {
return 0.15
} else {
return 0
}
}
radius: hoverBgRadius

Behavior on opacity {
Expand Down

0 comments on commit 977ec65

Please sign in to comment.