As acme is a mouse heavy program it needs input from middle and right clicks.
As such this requires xdotool to simulate mouse button clicks.
To make it work I have bound volume up to right click and volume down to middle
click.
There is also options in context menu as backup if the device doesn't have volume
controls.
If the mouse 2 and 3 aren't clear they require you to reselect the spot in less
than 2 seconds for the mouse click to occur at that location.
Signed-off-by: hazardchem <hazardchem@disroot.org>
---
configs/default_hooks/sxmo_hook_apps.sh | 1 +configs/default_hooks/sxmo_hook_contextmenu.sh | 13 +++++++++++++configs/default_hooks/sxmo_hook_inputhandler.sh | 12 ++++++++++++
3 files changed, 26 insertions(+)
diff --git a/configs/default_hooks/sxmo_hook_apps.sh b/configs/default_hooks/sxmo_hook_apps.sh
index ed3834d..43acd2b 100755
--- a/configs/default_hooks/sxmo_hook_apps.sh+++ b/configs/default_hooks/sxmo_hook_apps.sh
@@ -22,6 +22,7 @@ write_line_app() {
write_line_app gnome-2048 "$icon_gam 2048" "gnome-2048"
write_line_app jami-qt "$icon_msg Jami" "jami-qt"
+write_line_app acme "$icon_edt Acme" "acme -c 1 -f /usr/lib/plan9/font/pelm/ascii.16.font"write_line_app aerc "$icon_eml Aerc" "sxmo_terminal.sh aerc"
write_line_app alacritty "icon_trm Alacritty" "alacritty"
write_line_app amberol "$icon_mus Amberol" "amberol $XDG_MUSIC_DIR"
diff --git a/configs/default_hooks/sxmo_hook_contextmenu.sh b/configs/default_hooks/sxmo_hook_contextmenu.sh
index 5d23054..2675863 100755
--- a/configs/default_hooks/sxmo_hook_contextmenu.sh+++ b/configs/default_hooks/sxmo_hook_contextmenu.sh
@@ -725,6 +725,19 @@ case "$WMCLASS" in
"
WINNAME=Badwolf
;;
+ *acme*)+ # Acme+ CHOICES="+ $icon_mse 2 (2s delay to select) ^ 0 ^ sleep 2 && xdotool click 3+ $icon_mse 3 (2s delay to select) ^ 0 ^ sleep 2 && xdotool click 2+ $icon_itm Autocomplete ^ 0 ^ sxmo_type.sh -M Ctrl -k f+ $icon_exp Select Last Typed Text ^ 0 ^ sxmo_type.sh -M Escape+ $icon_del Delete To Start Of Line ^ 0 ^ sxmo_type.sh -M Ctrl -k U+ $icon_arl Move To Start Of Line ^ 0 ^ sxmo_type.sh -M Ctrl -k A+ $icon_arr Move To End Of Line ^ 0 ^ sxmo_type.sh -M Ctrl -k E+ "+ WINNAME=Acme+ ;; *)
# Default system menu (no matches)
CHOICES="
diff --git a/configs/default_hooks/sxmo_hook_inputhandler.sh b/configs/default_hooks/sxmo_hook_inputhandler.sh
index 848fecf..b0bba6d 100755
--- a/configs/default_hooks/sxmo_hook_inputhandler.sh+++ b/configs/default_hooks/sxmo_hook_inputhandler.sh
@@ -97,6 +97,18 @@ case "$WMCLASS" in
;;
esac
;;
+ *"acme"*)+ case "$ACTION" in+ "volup_one")+ xdotool click 3+ exit 0+ ;;+ "voldown_one")+ xdotool click 2+ exit 0+ ;;+ esac+ ;; *"foot"*|*"st"*|*"vte"*|"terminal") # Terminals
case "$WMCLASS" in # Handle programs without touch support
*"st"*)
--
2.44.0
On Fri, Apr 19, 2024 at 11:37:22PM +1000, hazardchem wrote:
> As acme is a mouse heavy program it needs input from middle and right clicks.> As such this requires xdotool to simulate mouse button clicks.> > To make it work I have bound volume up to right click and volume down to middle> click.> > There is also options in context menu as backup if the device doesn't have volume> controls.> > If the mouse 2 and 3 aren't clear they require you to reselect the spot in less> than 2 seconds for the mouse click to occur at that location.> > Signed-off-by: hazardchem <hazardchem@disroot.org>> ---> configs/default_hooks/sxmo_hook_apps.sh | 1 +> configs/default_hooks/sxmo_hook_contextmenu.sh | 13 +++++++++++++> configs/default_hooks/sxmo_hook_inputhandler.sh | 12 ++++++++++++> 3 files changed, 26 insertions(+)> > diff --git a/configs/default_hooks/sxmo_hook_apps.sh b/configs/default_hooks/sxmo_hook_apps.sh> index ed3834d..43acd2b 100755> --- a/configs/default_hooks/sxmo_hook_apps.sh> +++ b/configs/default_hooks/sxmo_hook_apps.sh> @@ -22,6 +22,7 @@ write_line_app() {> > write_line_app gnome-2048 "$icon_gam 2048" "gnome-2048"> write_line_app jami-qt "$icon_msg Jami" "jami-qt"> +write_line_app acme "$icon_edt Acme" "acme -c 1 -f /usr/lib/plan9/font/pelm/ascii.16.font"
Would it be possible to avoid hard-coding this path? Sometimes
installation paths vary, so this could cause issues. Perhaps the package
for acme could provide a wrapper that points to the right file?
Besides that it would be nice to avoid calling xdotool directly for
wayland compatibility, but I don't think we have a good alternative on
wayland, so that's not really feasible yet.
> write_line_app aerc "$icon_eml Aerc" "sxmo_terminal.sh aerc"> write_line_app alacritty "icon_trm Alacritty" "alacritty"> write_line_app amberol "$icon_mus Amberol" "amberol $XDG_MUSIC_DIR"> diff --git a/configs/default_hooks/sxmo_hook_contextmenu.sh b/configs/default_hooks/sxmo_hook_contextmenu.sh> index 5d23054..2675863 100755> --- a/configs/default_hooks/sxmo_hook_contextmenu.sh> +++ b/configs/default_hooks/sxmo_hook_contextmenu.sh> @@ -725,6 +725,19 @@ case "$WMCLASS" in> "> WINNAME=Badwolf> ;;> + *acme*)> + # Acme> + CHOICES="> + $icon_mse 2 (2s delay to select) ^ 0 ^ sleep 2 && xdotool click 3> + $icon_mse 3 (2s delay to select) ^ 0 ^ sleep 2 && xdotool click 2
nit: sometimes icons are unclear, perhaps this could be something like
"$icon_mse Middle click (2s delay)", does acme have specific terms it
uses for the mouse buttons?
> Would it be possible to avoid hard-coding this path? Sometimes> installation paths vary, so this could cause issues. Perhaps the package> for acme could provide a wrapper that points to the right file?>> Besides that it would be nice to avoid calling xdotool directly for> wayland compatibility, but I don't think we have a good alternative on> wayland, so that's not really feasible yet.
Not sure what other distros do apart from alpine and ive tried to set the fonts
with linux fonts but it is specifically looking for Plan9 fonts.
Unless we have a section in profile that sets the path to the install location
depending on the OS as an ENV variable then we could remove the hard coded path
> > + $icon_mse 2 (2s delay to select) ^ 0 ^ sleep 2 && xdotool click 3> > + $icon_mse 3 (2s delay to select) ^ 0 ^ sleep 2 && xdotool click 2
Yeah these buttons have specific uses and this was set up so that the cursor
could be set back to where it needs to be as touchibg the menu moves the mouse
> nit: sometimes icons are unclear, perhaps this could be something like> "$icon_mse Middle click (2s delay)", does acme have specific terms it> uses for the mouse buttons?
Only thing is that Plan9 calls these buttons as:
- Left: 1
- Middle: 3 (as it was built before there was a scroll wheel)
- Right: 2
So I'm happy to change it for clarity sake if you would rather tht.
When I say Plan9 that includes Acme as well since it was made for it.
On Sun, Apr 28, 2024 at 02:30:32PM +1000, hazardchem wrote:
> > Would it be possible to avoid hard-coding this path? Sometimes> > installation paths vary, so this could cause issues. Perhaps the package> > for acme could provide a wrapper that points to the right file?> >> > Besides that it would be nice to avoid calling xdotool directly for> > wayland compatibility, but I don't think we have a good alternative on> > wayland, so that's not really feasible yet.> > Not sure what other distros do apart from alpine and ive tried to set the fonts> with linux fonts but it is specifically looking for Plan9 fonts.> > Unless we have a section in profile that sets the path to the install location> depending on the OS as an ENV variable then we could remove the hard coded path
It looks like the plan9port packages on arch and alpine install a file
to /etc/profile.d to set PLAN9=<install path>. Based on that would this
work?
[ -n "$PLAN9" ] && write_line_app acme "$icon_edt Acme" "acme -c 1 -f $PLAN9/font/pelm/ascii.16.font
Nix has a wrapper script that knows that path, but it looks like they
don't set the environment variable, so it probably won't work there. I
think that might need something changed on the packaging side to work.
> > > + $icon_mse 2 (2s delay to select) ^ 0 ^ sleep 2 && xdotool click 3> > > + $icon_mse 3 (2s delay to select) ^ 0 ^ sleep 2 && xdotool click 2> > Yeah these buttons have specific uses and this was set up so that the cursor> could be set back to where it needs to be as touchibg the menu moves the mouse> > > nit: sometimes icons are unclear, perhaps this could be something like> > "$icon_mse Middle click (2s delay)", does acme have specific terms it> > uses for the mouse buttons?> > Only thing is that Plan9 calls these buttons as:> - Left: 1> - Middle: 3 (as it was built before there was a scroll wheel)> - Right: 2> > So I'm happy to change it for clarity sake if you would rather tht.
If that's what the documentation for acme / plan9 calls it, then it
should be fine. If you think it makes it more clear, go for it, but I
I'll merge this either way.
> When I say Plan9 that includes Acme as well since it was made for it.
> If that's what the documentation for acme / plan9 calls it, then it> should be fine. If you think it makes it more clear, go for it, but I> I'll merge this either way.
I've made a common ground I believe on this and used both.
Also submitted v2 of this patch.