This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

2configs/desktops/sway/eww: fix tooltips on wayland

Replace GTK :tooltip property with custom hover-tip widget using
eventbox onhover/onhoverlost and in-bar overlay revealer, since GTK
native tooltip popups don't work on layer-shell surfaces.

+49 -35
+49 -35
2configs/desktops/sway/eww.nix
··· 30 30 (defpoll idle-inhibited :interval "0.5s" :initial "false" "${lib.getExe idleStatusScript}") 31 31 (deflisten workspaces :initial '[]' "${lib.getExe workspacesScript}") 32 32 33 + ; Tooltip state 34 + (defvar hover-tooltip "") 35 + 36 + ; Generic hover-tooltip wrapper: shows tooltip on hover via in-bar overlay 37 + (defwidget hover-tip [text] 38 + (eventbox :onhover {text != "" ? "''${EWW_CMD} update hover-tooltip=${"'"}''${text}${"'"}" : ""} 39 + :onhoverlost "''${EWW_CMD} update hover-tooltip=${"'"}${"'"}" 40 + (children))) 41 + 33 42 ; Widget definitions 34 43 (defwidget bar [] 35 - (centerbox :orientation "h" 36 - (left) 37 - (center) 38 - (right))) 44 + (overlay 45 + (centerbox :orientation "h" 46 + (left) 47 + (center) 48 + (right)) 49 + (revealer :reveal {hover-tooltip != ""} :transition "slidedown" :duration "150ms" :valign "end" :halign "end" 50 + (box :class "hover-tooltip" 51 + (label :text hover-tooltip))))) 39 52 40 53 (defwidget left [] 41 54 (box :class "left" :orientation "h" :space-evenly false :halign "start" ··· 67 80 {ws.name})))) 68 81 69 82 (defwidget graph-widget [value icon class unit ?tooltip] 70 - (box :class "graph-module ''${class}" :orientation "h" :space-evenly false :spacing 4 71 - :tooltip {tooltip ?: ""} 72 - (graph :class "graph" 73 - :value value 74 - :thickness 3 75 - :time-range "60s" 76 - :min 0 77 - :max 100 78 - :dynamic true 79 - :line-style "round" 80 - :width 75) 81 - (label :text "''${round(value, 0)}''${unit} ''${icon}"))) 82 - 83 - (defwidget battery-widget [] 84 - (box :class "battery" :orientation "h" :space-evenly false 85 - :tooltip "''${battery.watts}W | ''${battery.time_remaining} ''${battery.status == 'Charging' ? 'to full' : 'remaining'}" 86 - (label :text "''${battery.capacity}% ''${battery.icon}"))) 87 - 88 - (defwidget power-graph-widget [] 89 - (eventbox :onclick "${lib.getExe powerProfileCycleScript}" 90 - (box :class {power.charging ? "graph-module power charging" : "graph-module power"} :orientation "h" :space-evenly false :spacing 4 91 - :tooltip "TDP: ''${power-profile.tdp}W (''${power-profile.name}) | ''${battery.time_remaining} ''${battery.status == 'Charging' ? 'to full' : 'remaining'}" 83 + (hover-tip :text {tooltip ?: ""} 84 + (box :class "graph-module ''${class}" :orientation "h" :space-evenly false :spacing 4 92 85 (graph :class "graph" 93 - :value {power.watts} 86 + :value value 94 87 :thickness 3 95 88 :time-range "60s" 96 89 :min 0 97 - :max 45 98 - :dynamic false 90 + :max 100 91 + :dynamic true 99 92 :line-style "round" 100 93 :width 75) 101 - (label :text "''${round(power.watts, 1)}W ''${power.charging ? '󰂄' : '󰁹'}")))) 94 + (label :text "''${round(value, 0)}''${unit} ''${icon}")))) 95 + 96 + (defwidget battery-widget [] 97 + (hover-tip :text "''${battery.watts}W | ''${battery.time_remaining} ''${battery.status == 'Charging' ? 'to full' : 'remaining'}" 98 + (box :class "battery" :orientation "h" :space-evenly false 99 + (label :text "''${battery.capacity}% ''${battery.icon}")))) 100 + 101 + (defwidget power-graph-widget [] 102 + (hover-tip :text "TDP: ''${power-profile.tdp}W (''${power-profile.name}) | ''${battery.time_remaining} ''${battery.status == 'Charging' ? 'to full' : 'remaining'}" 103 + (eventbox :onclick "${lib.getExe powerProfileCycleScript}" 104 + (box :class {power.charging ? "graph-module power charging" : "graph-module power"} :orientation "h" :space-evenly false :spacing 4 105 + (graph :class "graph" 106 + :value {power.watts} 107 + :thickness 3 108 + :time-range "60s" 109 + :min 0 110 + :max 45 111 + :dynamic false 112 + :line-style "round" 113 + :width 75) 114 + (label :text "''${round(power.watts, 1)}W ''${power.charging ? '󰂄' : '󰁹'}"))))) 102 115 103 116 (defwidget volume-widget [] 104 117 (eventbox :onscroll "${lib.getExe volumeAdjustScript} {}" ··· 131 144 :exclusive true 132 145 :focusable false 133 146 (bar)) 147 + 148 + 134 149 ''; 135 150 136 151 ewwScss = pkgs.writeText "eww.scss" '' ··· 225 240 margin: 0 2px; 226 241 } 227 242 228 - tooltip { 229 - background-color: #1a1b26; 243 + .hover-tooltip { 244 + background-color: #24283b; 230 245 color: #c0caf5; 231 - border: 1px solid #414868; 232 - border-radius: 4px; 233 - padding: 4px 8px; 246 + border-bottom: 1px solid #414868; 247 + padding: 2px 12px; 234 248 } 235 249 ''; 236 250