Refactorise to simplify wm detection

We dont use guesswm and rely on a SXMO_WM env variable. We now use
guesswm for non wm action (from ssh, console, rtc wakes, etc). It will
try to setup needed variables.

This way, we avoid to run sxmo_wm.sh and to check variables everytime.

This allow the user to manage sxmo_screenlock.sh from ssh and to run a
desktop software with "sxmo_wm.sh exec foot" by example.

We remove the "ssh" wm cause it does not really make sense anyway.

The sxmo_rtcwake.sh dont try to setup variables anymore cause the user
must use "sxmo_wm.sh exec" if they want to start a destkop software
anyway.

We remove the "xorg" check everywhere cause that make no sense. We
keep the xorg prefixed methods for common xorgs cases.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Anjandev Momi <anjan@momi.ca>
This commit is contained in:
Stacy Harper
2021-11-16 13:34:50 +01:00
committed by Anjandev Momi
parent 59e241d891
commit c446e9f23e
15 changed files with 50 additions and 73 deletions

View File

@@ -41,26 +41,26 @@ xorgscreenshot() {
}
screenshot() {
case "$WM" in
case "$SXMO_WM" in
sway)
swayscreenshot "$@"
;;
xorg|dwm)
dwm)
xorgscreenshot "$@"
;;
ssh)
exitMsg "cannot screenshot ssh"
*)
exitMsg "We dont know the WM, cannot screenshot."
;;
esac
}
filepathoutput() {
printf %s "$FILENAME"
case "$WM" in
case "$SXMO_WM" in
sway)
wl-copy "$FILENAME"
;;
xorg|dwm)
dwm)
printf %s "$FILENAME" | xsel -b -i
;;
esac
@@ -68,7 +68,5 @@ filepathoutput() {
FILENAME="${SXMO_SCREENSHOT_DIR:-$HOME/$(date +%Y-%m-%d-%T).png}"
WM="$(sxmo_wm.sh)"
screenshot "$@"
filepathoutput