[sway/toggle_touchpad] Show wl-overlay message

This commit is contained in:
Midgard 2024-07-03 15:26:02 +02:00
parent 04965032ac
commit 7b077eb1b0
Signed by untrusted user who does not match committer: midgard
GPG key ID: 511C112F1331BBB4
5 changed files with 151 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View file

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="200"
height="150"
viewBox="0 0 52.916666 39.6875"
version="1.1"
id="svg5"
inkscape:export-filename="./touchpad_disabled.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
sodipodi:docname="touchpad_disabled.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#000000"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:document-units="mm"
showgrid="false"
width="200px"
inkscape:zoom="4.2581185"
inkscape:cx="88.889025"
inkscape:cy="71.510457"
inkscape:window-width="1920"
inkscape:window-height="1059"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="layer1"
units="px"
inkscape:snap-global="false" />
<defs
id="defs2" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<path
id="path1706"
style="color:#000000;fill:#ffffff;fill-opacity:0.0647133;stroke-width:7.261;stroke-linecap:round;-inkscape-stroke:none"
d="M 36.683594 37.916016 C 35.358287 37.916016 34.291016 38.983287 34.291016 40.308594 L 34.291016 112.88867 L 163.98047 38.011719 C 163.76944 37.95117 163.54741 37.916016 163.31641 37.916016 L 36.683594 37.916016 z M 165.70898 48.560547 L 34.291016 124.43359 L 34.291016 139.42969 C 34.291016 140.75499 35.358287 141.82227 36.683594 141.82227 L 163.31641 141.82227 C 164.64171 141.82227 165.70898 140.75499 165.70898 139.42969 L 165.70898 48.560547 z "
transform="scale(0.26458333)" />
<path
id="path1708"
style="color:#000000;fill:#b3b3b3;stroke-width:3.77953;stroke-linecap:round;-inkscape-stroke:none"
d="M 36.679688 34.28125 C 33.405885 34.28125 30.664063 37.030883 30.664062 40.304688 L 30.664062 114.98242 L 37.919922 110.79297 L 37.919922 41.544922 L 157.86133 41.544922 L 167.47656 35.994141 C 166.38691 34.941532 164.91539 34.28125 163.31641 34.28125 L 36.679688 34.28125 z M 169.33984 46.464844 L 162.07617 50.658203 L 162.07617 138.18945 L 37.919922 138.18945 L 37.919922 122.33984 L 30.664062 126.52734 L 30.664062 139.42969 C 30.664062 142.70349 33.405885 145.45312 36.679688 145.45312 L 163.31641 145.45312 C 166.59021 145.45312 169.33984 142.70349 169.33984 139.42969 L 169.33984 46.464844 z "
transform="scale(0.26458333)" />
<path
style="fill:none;stroke:#b3b3b3;stroke-width:0.960568;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 13.230251,32.135917 29.867588,0"
id="path1012"
inkscape:export-filename="./touchpad_enabled.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
sodipodi:nodetypes="cc" />
<path
style="fill:none;stroke:#b3b3b3;stroke-width:0.960568;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 26.458333,32.058022 v 5.080393"
id="path1317"
inkscape:export-filename="./touchpad_enabled.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96" />
<path
style="fill:none;stroke:#ffffff;stroke-width:2.64583;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 5.1333902,36.448342 48.18191,11.594268"
id="path1484" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 902 B

View file

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="200"
height="150"
viewBox="0 0 52.916666 39.6875"
version="1.1"
id="svg5"
inkscape:export-filename="./touchpad_enabled.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
sodipodi:docname="touchpad_enabled.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#000000"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:document-units="mm"
showgrid="false"
width="200px"
inkscape:zoom="2.9944426"
inkscape:cx="179.83314"
inkscape:cy="79.313593"
inkscape:window-width="1920"
inkscape:window-height="1059"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="layer1"
units="px" />
<defs
id="defs2" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="fill:#ffffff;fill-opacity:0.0647133;stroke:#ffffff;stroke-width:1.92114;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none"
id="rect846"
width="34.77084"
height="27.491816"
x="9.0729132"
y="10.031795"
rx="0.63294947"
ry="0.63294947" />
<path
style="fill:none;stroke:#ffffff;stroke-width:0.960568;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 9.8188279,32.135917 H 43.097839"
id="path1012" />
<path
style="fill:none;stroke:#ffffff;stroke-width:0.960568;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 26.458333,32.058022 v 5.080393"
id="path1317" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

View file

@ -1,5 +1,7 @@
#!/bin/sh
cd "$(dirname "$0")"
current_state() {
swaymsg -t get_inputs | jq -r 'map(select(.type == "touchpad")) | .[0].libinput.send_events'
}
@ -12,3 +14,11 @@ if [ "$(current_state)" == disabled_on_external_mouse ]; then
else
set_state toggle enabled disabled
fi
state=$(current_state)
case $state in
enabled) image=icons/touchpad_enabled.png; ;;
disabled) image=icons/touchpad_disabled.png; ;;
*) image=""; ;;
esac
wl-overlay --time=1000 "$image" "Touchpad $state"