~mil/sxmo-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
3 2

[PATCH] lets add this super useful script by default to userscripts

Details
Message ID
<20240615173401.20288-1-hallo@magdesign.ch>
DKIM signature
permerror
Download raw message
Patch: +34 -0
---
 scripts/appscripts/sxmo_scaledisplay.sh | 34 +++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100755 scripts/appscripts/sxmo_scaledisplay.sh

diff --git a/scripts/appscripts/sxmo_scaledisplay.sh b/scripts/appscripts/sxmo_scaledisplay.sh
new file mode 100755
index 0000000..0b1c52d
--- /dev/null
+++ b/scripts/appscripts/sxmo_scaledisplay.sh
@@ -0,0 +1,34 @@
#!/bin/sh
# title="$icon_fnd Scale Display"
# Description: select display scale factor
# Note: v0.2
menu() {
	# TODO: export WVKBD_LAYERS to a number layout when one exists.
	SCALEINPUT="$(
	echo "
		4
		3.5
		3
		2.5
		2
		1.75
		1.5
		1.25
		1
		Close Menu
	" | awk 'NF' | awk '{$1=$1};1' | sxmo_dmenu.sh -p Select scale factor
	)"
	[ "Close Menu" = "$SCALEINPUT" ] && exit 0

	case "$SXMO_WM" in
		sway)
			swaymsg "output \"DSI-1\" scale $SCALEINPUT"
			;;
		*)
			notify-send "Scale Display only supports sway."
			exit 1
			;;
	esac
}

menu
-- 
2.45.2
Details
Message ID
<t5hvr3ocnvhrdf72xhg7g3nti3d3sbz3kt72ocl4niwp5jygcr@2ln72p3gatu3>
In-Reply-To
<20240615173401.20288-1-hallo@magdesign.ch> (view parent)
DKIM signature
pass
Download raw message
This seems like a good idea, but I'm not sure appscripts are the right
place for it. This seems better suited to be part of sxmo_wmmenu.sh.

Also that commit message doesn't describe at all what this patch does,
something like this would be a lot more useful:

```
appscripts: add scaledisplay script to adjust screen scale

It is sometimes necessary to adjust the screen scale in order to fit
applications that aren't optimized for small screens. Add a menu entry
to make this easier.
```

On Sat, Jun 15, 2024 at 08:34:01PM GMT, magdesign wrote:
> ---
>  scripts/appscripts/sxmo_scaledisplay.sh | 34 +++++++++++++++++++++++++
>  1 file changed, 34 insertions(+)
>  create mode 100755 scripts/appscripts/sxmo_scaledisplay.sh
> 
> diff --git a/scripts/appscripts/sxmo_scaledisplay.sh b/scripts/appscripts/sxmo_scaledisplay.sh
> new file mode 100755
> index 0000000..0b1c52d
> --- /dev/null
> +++ b/scripts/appscripts/sxmo_scaledisplay.sh
> @@ -0,0 +1,34 @@
> +#!/bin/sh
> +# title="$icon_fnd Scale Display"
> +# Description: select display scale factor
> +# Note: v0.2

No need for version information, git tracks that for us.

> +menu() {
> +	# TODO: export WVKBD_LAYERS to a number layout when one exists.

wvkbd should never be started from this script, there's not much we can
do besides having bemenu report a numeric field via the input method
protocol, which is totally unimplemented.

> +	SCALEINPUT="$(
> +	echo "
> +		4
> +		3.5
> +		3
> +		2.5
> +		2
> +		1.75
> +		1.5
> +		1.25
> +		1
> +		Close Menu
> +	" | awk 'NF' | awk '{$1=$1};1' | sxmo_dmenu.sh -p Select scale factor
> +	)"
> +	[ "Close Menu" = "$SCALEINPUT" ] && exit 0

prefer an if / case statement here, if we add `set -e` to this script,
this statement will always exit.

> +	case "$SXMO_WM" in
> +		sway)
> +			swaymsg "output \"DSI-1\" scale $SCALEINPUT"
> +			;;
> +		*)
> +			notify-send "Scale Display only supports sway."
> +			exit 1
> +			;;
> +	esac

If this is included in sxmo_wmmenu as a submenu, we can hide it if we
don't support the environment, then we wouldn't need any of this logic.

> +}
> +
> +menu
> -- 
> 2.45.2
> 
Details
Message ID
<59022131-9200-4c74-83b2-9ca45409701d@asgard.ch>
In-Reply-To
<t5hvr3ocnvhrdf72xhg7g3nti3d3sbz3kt72ocl4niwp5jygcr@2ln72p3gatu3> (view parent)
DKIM signature
pass
Download raw message
For context this is from Anjan's sxmo-userscripts: 
https://git.sr.ht/~anjan/sxmo-userscripts/tree/master/item/scripts/scale_display.sh

Additionally here is a small improvement which makes the current scale 
preselected: https://lists.sr.ht/~anjan/public-inbox/patches/35282
Details
Message ID
<q5btgvwgidduja2xzjrggzlno2yurrqkbzutbpkc2s72gfbyv4@6x2qspqwodw5>
In-Reply-To
<20240615173401.20288-1-hallo@magdesign.ch> (view parent)
DKIM signature
pass
Download raw message
Marking as needs revision due to a lack of response to my earlier
feedback. Please either explain why this should be in the scripts menu
instead of the windows menu, or send a new version that moves it there.
Reply to thread Export thread (mbox)