Actions are similar so it warranted adding to one patch.
Signed-off-by: hazardchem <hazardchem@disroot.org>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
This is needed by dwm as screen rotation and screenoff states don't work correctly.
Signed-off-by: hazardchem <hazardchem@disroot.org>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
A problem was introduced in 4562daea67
because it kind-of bypasses the state mechanism. Whenever a locker was
running the state would remain `unlock` and therefore the inputhandler
would be fully enabled and menus could still be opened with gestured
(although they wouldn't show because of the locker).
This patch solves that, it's not an ideal implementation but is
a bit of a minimal temporary patch until we revise/simplify the
entire state locking mechanism.
It also moves the burden of removing icons for peanutbutter to
sxmo_hook_statusbar instead of sxmo_hook_lockstatusbar
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
If a user swipes up, they will dismiss the notification without doing
its action, but if they touch the notification they will execute its
action.
This is useful when you get a lot of popups or if you (like me) have
your popup notifications decay only after a very very very long time.
I also thing the default delay for notifications should be extremely
long (24hrs), so you can easily see what sms messages you received.
NB: I have not tested on dwm (may need to add an on-touch option there
too).
NB2: I also think that this might all go into a hook instead so we can
let the user control what to do with popups?
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
This implements:
* use of delta instead of colordiff or diff, if installed
* a colordiff fallback if none is installed
* support for different diff order by setting SXMO_MIGRATE_ORDER to
"user:system", also included a runtime switch
* an extra explanation to interpret the diff correctly
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
This is a significant overhaul of the Sxmo documentation. I'm building
upon the work Peter (wart) started, to provide proper man pages for Sxmo.
I think man pages fit our philosophy well, and ensure that all
essential documentation is always available offline on-device.
The user can simply do `man sxmo` and get the full manual (which was
called our 'user guide' in the old setup). I favour keeping this man
page as the sole source and automatically derive things for the
sxmo-docs repo (which is rather convoluted with multiple branches now).
Storing the documentation right-alongside sxmo-utils has the big
advantage of it describing (ideally) the exact version it is stored
alongside with. Submitted patches can do both implementation and
documentation in one go.
Things in this patch:
* Sections that were missing were added
* Some new man pages dedicated to specific scripts were added (*.1.scd)
* Rewrote various parts to make the language better/clearer.
* Reordered things.
* Information that was out-of-date or incomplete has been updated (to
the best of my knowledge)
* Applied a consistent style.
* Added HTML conversions in the Makefile (via groff and some hacky
post-processing to insert decent hyperlinks, 'man' is a bit ancient)
* Added a 'Help' item in the main menu which opens the Sxmo man page in a terminal
* Updated the description of some hooks
This is not necessarily done yet (is documentation ever?), but it
provides a solid foundation I think. Some sections may need some further
work and everything should at least be checked thoroughly by others for
accuracy.
* set SXMO_NOTCH to a string to use for the notch (length determines width), do not use spaces/tabs
* optionally set SXMO_NOTCH_PRIO to a placement value (trial and error)
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
Using lswt allows us to use the context menu on any wayland compositor
that supports the wlr-foreign-toplevel-management protocol.
Signed-off-by: Aren Moynihan <aren@peacevolution.org>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
This will launch peanutbutter (if it is installed) when the screen turns
off. It also omits the locked/screen-on stage then because it has less
added value and is in the way.
I'd recommend having users explicitly install peanutbutter themselves
(and read the manual) rather than have it pulled in automatically, as
users need to know the default unlock code or they get locked out of
there session. But this way no hooks need to be adapted if it's
installed, and it will out-of-the-box show the status icons on the
lockscreen.
Signed-off-by: Aren Moynihan <aren@peacevolution.org>
iio-sensor-proxy abstracts iio (and sensors exposed in other kernel
subsystems). it can simplify the autorotate script, removing the need for
variables such as ROTATION_GRAVITY.
it also makes it possible to use the same code to support 'non-standard'
accelerometers, such as those on SDM845 devices.
prerequisites:
- `iio-sensor-proxy must` be installed and be running on the system (it
provides `monitor-sensor`)
- a PolicyKit rule to permit the regular user to claim sensors must be
installed in `/etc/polkit-1/rules.d/01-sensor-claim.rules`, containing
the following:
```
polkit.addRule(function(action, subject) {
if (action.id == "net.hadess.SensorProxy.claim-sensor" &&
subject.isInGroup("plugdev")) {
return polkit.Result.YES;
}
});
```
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
This modifies the statusbar hook so that if there is a modem state that doesn't
match failed or unknown then show used techs and signal.
Currently if there isn't a sim in the modem there will be $icon_modem_failed, $icon_modem_notech, and $icon_modem_signal_0.
After this all that shows is $icon_modem_failed.
Signed-off-by: hazardchem <hazardchem@disroot.org>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
With the recent wofi patch, we now require for the env variable to be
present (or sxmo_dmenu.sh will fails to actually start something).
With this change, we fallback to the old choice, depending on the WM.
I refactored some code to make exchanging menus a little bit easier
and I added wofi as new menu option.
The menu to use can be configured via the new environment variable
SXMO_MENU. Its value may be bemenu, dmenu, or wofi, *NOT* any arbitrary
binary. This variable will be automatically populated if not set, based on if
you're on wayland or Xorg.
setup_config_version.sh was extended to allow a configversion in CSS
comments (needed for wofi). I designed a theme that mimicks the default
style we have for bemenu/dmenu, with slightly more spacing perhaps.
Wofi can scan *.desktop files (drun mode), so I added an "All Apps" option that
makes use of that. Some further work is still required there however
to get wofi to properly launch terminal apps from there.
Wofi also has some issues positioning in landscape mode after the screen
was rotated, so my solution there is a bit hacky. May be an upstream
issue.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
To do this, we add store, restore, and flushstored to sxmo_state.sh.
store output an id that the caller have to give back to restore. This way,
multiple caller can store, and only the first one that restore actually
does so. This ensure some consistency to the end state workflow.
Any user click in between automatically flushstored, so that the end of
proximitylock will not restore to initial state.
This is a complete rewrite, and group every scripts in a single
sxmo_notifs.sh one.
Also: Replace the watch file feature with a more generic notification group
one.
This feature make the user to miss notifications if the conversation file is
already open. It also cause problems when used with Syncthing, as this cause
notifications to be dropped when it synchronise files. It is also pointless
now that opening a notification to an opened conversation just focus the
corresponding terminal.
I think that dropping this feature completly is okay, make things simple,
and simplify the code
But in the same time:
Opening a notification should close all other ones for the same
conversations. So to cover this case, we add an optional group when
creating notifications. Discarding a notification now close all related
ones from the same group.
Added tabbed to sxmo_hook_apps.sh by calling sxmo_tabbed.sh
sxmo_tabbed.sh:
This program provides a list of programs with their embedded call and
will start a tabbed session with that program inside, or nothing starts
a tabbed session with nothing inside.
Signed-off-by: hazardchem <hazardchem@disroot.org>
Signed-off-by: Aren Moynihan <aren@peacevolution.org>
Found that the mpv pseudo-gui listed its WM_CLASS as `WM_CLASS(STRING) = "gl", "mpv"`
xorgfocusedwindow was only looking at the first field for the app: rename so it
was always set to gl. This patch changes the field to the second.
Testing on my machine hasn't found any issues as everything was detected
correctly on a few different windows.
Signed-off-by: hazardchem <hazardchem@disroot.org>
Signed-off-by: Aren Moynihan <aren@peacevolution.org>
This mode disable ring and vibration from calls and messages. It is also
possible to enable this mode for a period of time.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Signed-off-by: Aren Moynihan <aren@peacevolution.org>
Some text editors, as kakoune, automatically add an ending newline while
saving buffers to files. This is because the convention on UNIX systems,
is that files ends with newline.
While sending sms using a file as resource, modem manager keep this. I
already discussed this with the maintainer:
https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/830
So we basically have to do this ourselves.
The problems appeared when we switched to this new argument
--messaging-create-sms-with-text. It fixes our quoting issues, but it
introduce this problem, when the editor does the right thing.
To solve this, we create a temporary file, without this ending newline.
The finish script trap will clean in afterward.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Signed-off-by: Aren Moynihan <aren@peacevolution.org>
Note: If you have no Android/iOS instance to link to as primary device, you
can run signal-cli (either on the same device as flare or on any
other), that also allows you to register a number.
Signed-off-by: Aren Moynihan <aren@peacevolution.org>
The build was failing with this error:
programs/sxmo_vibrate.c:16:10: fatal error: linux/input.h: No such file or directory
16 | #include <linux/input.h>
Signed-off-by: Aren Moynihan <aren@peacevolution.org>
The c compiler seems to be rather picky about the order arguments are
defined in, I was having trouble building sxmo_status_led in some
conditions because -lm was in the wrong spot.
This is the order that these are supplied in the built-in rules
documentation of the gnu make manual.
While here, make cflags include any cflags passed by environment
variable, such as from a package build script.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
The new sxmo_status_led program can tell us if it finds a suitable led
on the system. We can use this to set the SXMO_DISABLE_LEDS env
variable.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
This also support for multicolor leds which wasn't supported by
brightnessctl. And it provides a significant performance improvement.
The sxmo_led.sh script takes quite a bit of cpu power to run, which
isn't great because it runs about every 2 seconds when the system is
idle. This rewrites most of it in c which should solve help speed it up.
Before the led blink process would consume somewhere around 20% cpu
usage (0.7 seconds / 3 seconds total for a blink). After this patch it
should come down closer 10% cpu usage. This is significantly better, but
still not very good. I think most of the remaining time is being spent
in sxmo_wakelock.sh, reimplementing that and/or finding a way to not
need it will probably be necessary to get this to execute in a
reasonable amount of time.
Before:
$ sudo perf stat -r 8 ./scripts/core/sxmo_led.sh blink red blue
Performance counter stats for './scripts/core/sxmo_led.sh blink red blue' (8 runs):
796.76 msec task-clock # 0.715 CPUs utilized ( +- 1.64% )
316 context-switches # 396.604 /sec ( +- 3.77% )
35 cpu-migrations # 43.928 /sec ( +- 7.87% )
12,505 page-faults # 15.695 K/sec ( +- 0.04% )
883,688,799 cycles # 1.109 GHz ( +- 2.16% )
310,020,051 instructions # 0.35 insn per cycle ( +- 0.09% )
33,193,824 branches # 41.661 M/sec ( +- 0.09% )
5,169,519 branch-misses # 15.57% of all branches ( +- 0.19% )
1.1151 +- 0.0274 seconds time elapsed ( +- 2.46% )
$ hyperfine 'sxmo_led.sh blink red blue'
Benchmark 1: sxmo_led.sh blink red blue
Time (mean ± σ): 1.059 s ± 0.042 s [User: 0.284 s, System: 0.458 s]
Range (min … max): 1.013 s … 1.163 s 10 runs
After:
$ sudo perf stat -r 8 sxmo_led.sh blink red blue
Performance counter stats for 'sxmo_led.sh blink red blue' (8 runs):
347.50 msec task-clock # 0.337 CPUs utilized ( +- 2.25% )
176 context-switches # 506.474 /sec ( +- 8.81% )
13 cpu-migrations # 37.410 /sec ( +- 19.22% )
3,243 page-faults # 9.332 K/sec ( +- 0.05% )
383,056,720 cycles # 1.102 GHz ( +- 2.84% )
143,365,214 instructions # 0.37 insn per cycle ( +- 0.14% )
15,816,749 branches # 45.516 M/sec ( +- 0.15% )
2,520,323 branch-misses # 15.93% of all branches ( +- 0.46% )
1.0326 +- 0.0359 seconds time elapsed ( +- 3.48% )
$ hyperfine 'sxmo_led.sh blink red blue'
Benchmark 1: sxmo_led.sh blink red blue
Time (mean ± σ): 1.006 s ± 0.027 s [User: 0.128 s, System: 0.186 s]
Range (min … max): 0.963 s … 1.051 s 10 runs
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
configs/default_hooks/three_button_touchscreen has been dropped in
b09469d965.
Drop broken symbolic links to it.
Signed-off-by: Raymond Hackley <raymondhackley@protonmail.com>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
91d4319df5 ("sway: add config for Nokia N900") added a new sway mode
to cater for the limitations imposed by the Nokia N900's physical
keyboard. At least one user reported a conflict with their keybinds.
Drop the mode and its binding from the global configuration. It can be
moved to a device-specific configuration, and be stored under
/etc/sway/config.d/* per sway's default/global include directive
Fixes: 91d4319df5 ("sway: add config for Nokia N900")
Fixes: https://lists.sr.ht/~mil/sxmo-devel/patches/53195
Signed-off-by: Sicelo A. Mhlongo <absicsz@gmail.com>
Define TOUCHSCREEN_ID so the touchscreen can be reliably disabled when device
is in locked state. When undefined, in some cases it does not get disabled,
causing wakeups.
Signed-off-by: Sicelo A. Mhlongo <absicsz@gmail.com>
Signed-off-by: Anjandev Momi <anjan@momi.ca>
While the N900 has a hardware keyboard, it only has a few keys. A virtual keyboard is still very useful to have. Some symbols, especially emoji, cannot be typed easily from hardware keyboard. Hence, restore access to the virtual keyboard using the VolDown key.
Signed-off-by: Sicelo A. Mhlongo <absicsz@gmail.com>
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
default dmenu lines are too long for N900's tiny screen. reduce to fit
Signed-off-by: Sicelo A. Mhlongo <absicsz@gmail.com>
Signed-off-by: Anjandev Momi <anjan@momi.ca>
Commit 4913fac4ee ("Cleanup virtual keyboard management") introduced
SXMO_NO_KEYBOARD environment variable to disable virtual keyboard. Rename so
this purpose is clear/obvious from the name.
Drop the variable on Nokia N900, since virtual keyboard is still useful on it,
e.g. for emoji.
Signed-off-by: Sicelo A. Mhlongo <absicsz@gmail.com>
Signed-off-by: Anjandev Momi <anjan@momi.ca>
In scoprion2185's log I saw:
/usr/bin/sxmo_playerctl.sh: line 31: return: can only `return' from a function or sourced script
As far as I checked, sxmo_playerctl is indeed called normally rather
than sourced so it should be exit instead of return, this patch fixes
that.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
This adds configuration so that when "git archive" is run, it will
inject the current version into the makefile. This makes it so that we
don't have to do this manually, and packagers don't need to either.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
This drop the hardcoded VERSION, because it is so easy to forget while
releasing. This also fetch better edge tags.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
This also remove the automatic lock from the sxmo_rtcwake.sh script. The
user now have to use this cron line to do the same thing:
* * * * * sxmo_rtcwake.sh sxmo_wakelock.sh run sleep 10
This separate both behaviors, and allow more combinations.
This relies on the previous patchset that implement sxmo_sleep. It
become possible for the user to write a simple daemon that trigger
a command periodically, and waking up the device.
To do this, we implement a new sxmo_sleep program that is a sleep
but that can wake the device from suspension when the timer expires.
Also, stopwatch can perfectly survive a suspension. So we don't have to
wakelock on this.
This is necessary if you have multiple devices, and one is blocked while
the other is useable.
This still not behave correctly when there is no bluetooth device at
all.
The behavior introduced with the following commit was wrong. The
condition have to be reversed.
bccc1ab8 hook_screenoff: blink purple only when suspend is enabled
mkrundir is a simple program by whynothugo that simply create the
rundir.
This patch is enough for Sxmo to use /run/user-$uid as XDG_RUNTIME_DIR. Even if
this is still less common that /run/user/$uid, it still is preferable, and more
compatible than our /dev/shm/user/$uid (ex: flatpak refuse to bind mount /dev/
paths).
This has the potential to cause odd breakages because it doesn't require
full word matches anymore. This can be mitigated by using *" word "*
instead of *"word"*, which I have done where I expect it to be a
problem.
Not needing to fork a bunch of printf / grep processes is a significant
performance improvement. I think this is well worth the risk of breaking
things.
Before:
$ hyperfine --warmup 4 -N sxmo_hook_contextmenu.sh
Benchmark 1: sxmo_hook_contextmenu.sh
Time (mean ± σ): 421.0 ms ± 4.2 ms [User: 282.9 ms, System: 233.7 ms]
Range (min … max): 414.5 ms … 426.2 ms 10 runs
After:
$ hyperfine --warmup 4 -N sxmo_hook_contextmenu.sh
Benchmark 1: sxmo_hook_contextmenu.sh
Time (mean ± σ): 151.3 ms ± 2.4 ms [User: 118.8 ms, System: 105.1 ms]
Range (min … max): 146.7 ms … 154.8 ms 19 runs
These tests were run on a PinePhone with a foot window focused using
bash as the shell.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Simplifying this logic should help with performance, this is always
called by sxmo_hook_contextmenu.sh, so it should help make the menus a
little more responsive.
Before:
$ hyperfine --warmup 2 'sxmo_wm.sh focusedwindow'
Benchmark 1: sxmo_wm.sh focusedwindow
Time (mean ± σ): 78.8 ms ± 1.2 ms [User: 41.8 ms, System: 40.2 ms]
Range (min … max): 77.1 ms … 81.5 ms 30 runs
After:
$ hyperfine --warmup 2 'sxmo_wm.sh focusedwindow'
Benchmark 1: ./sxmo_wm.sh focusedwindow
Time (mean ± σ): 43.4 ms ± 2.0 ms [User: 27.8 ms, System: 22.1 ms]
Range (min … max): 41.4 ms … 53.0 ms 48 runs
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
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>
Signed-off-by: Aren Moynihan <aren@peacevolution.org>
This patch adds iamb to: sxmo_hook_apps.sh sxmo_hook_contextmenu.sh.
Iamb is a terminal matrix client with vim style keybindings.
Signed-off-by: hazardchem <hazardchem@disroot.org>
Signed-off-by: Aren Moynihan <aren@peacevolution.org>
st -e has been causing issues when run by sxmo_terminal.sh
Removing from profile will make the default not cause issues if people decide
to uncomment it
Signed-off-by: hazardchem <hazardchem@disroot.org>
Signed-off-by: Aren Moynihan <aren@peacevolution.org>
The Nokia N900's keyboard has very few keys, and RightAlt is already
in use. Provide an alternative binding mode that suits this constraint
while remaining as close as possible to the existing sxmo keybindings
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Also use brightnessctl directly, the flash toggle logic doesn't use any
of the features provided on top of it by sxmo_led.sh. This simplifies
the cases that sxmo_led.sh needs to support.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
When autosuspend is disabled, the purple LED blinks indefinitely, since
screenoff is the lowest idle state possible in that case. The purple LED
notification is meant to notify the user that that system is in screenoff, and
will likely suspend soon, thus for users who disable autosuspend, the blink
loses meaning. Disable it for this case.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Been noted that with update_interval set to 5 that conky consumes 10% cpu
Setting to 15 reduces it to less than 1%
Signed-off-by: hazardchem <hazardchem@disroot.org>
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
The Nokia N900's modem is not supported by ofono. Until either sxmo supports
ofono or the modem is made to work with modemmanager, disable it to save a few
cpu cycles
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Currently st -e for SXMO_TERMINAL causes st to exit with error 1
Removing the -e switch makes it so that st behaves correctly.
Signed-off-by: hazardchem <hazardchem@disroot.org>
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Recent jq version seems fast enough. We drop this proxy, and use jq
directly
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
Some devices doesn't need a virtual keyboard, aka Nokia N900, aka
Pinephone with keyboard. This give a way to disable this feature
completely.
Also, we remove the sxmo_dmenu_with_kb.sh script, cause it is poorly
used, and give inconsistent behavior between menus. The user can already open
the keyboard very easily.
For this same reason, we remove some random "sxmo_keyboards.sh open". If
this isn't necessary cause of a specific usage (aka dtmf special
layout.
I also dropped some code in sxmo_dmenu.sh that adapt the available size
depending on if the keyboard is open or not. The keyboard can be open
later, so this is dumb to rely on this, and we should alway be able to
open/close it, and to read all lines.
I adapted the inputhandler a bit when keyboard is disabled. If you guys
think about better usage of freed handler, I'm open!
When openning the conversation loop, it happens very frequently
that I see some stdouts breaking my kakoune EDITOR when I switch the
keyboard layout.
To solve this, we detach the keyboard stdout from the caller process.
Do not try to pair before connection. Let's stay consistent with how we
connect to new devices from the main loop. Also, do not trust by
default. The user have to do this themselves manually if they want to.
Add a --timeout to the scan, so that it stay scanning, even if not
in interactive mode.
Sleep 1 so that we don't spam too much the daemon.
Add a "get" command to abstract state checks, from inside of the
sxmo_state.sh script. This use the shared flock on this case.
This have to adapt the flocks management, so that the hooks can access
the "get" without staying idle, waiting for themselves to release the
exclusive flock.
This patch fixes issues with using alacritty as your terminal emulator in sxmo.
Alacritty needs to know if you are trying to exrcute a specific program or $SHELL
as setting the title even with dynamic titles set in config will make the title
permanent
That affects calling sxmo_terminal.sh with power button as the title will stay
as the path to your shell.
To test for this made a check to see if the case is calling $* as shell path or
program
Also added to sxmo_hook_apps.sh
Signed-off-by: hazardchem <hazardchem@disroot.org>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
Currently, SXMO_OS is not kept when running sxmo_bluetoothtoggle.sh
using doas. The case statement is therefore skipped entirely. This
patch preserves that var and allows SXMO_OS to be correctly checked.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
This patch replaces dunst with xob for audio and brightness levels.
Currently xob is only in alpine edge so this will be useful once it moves to
stable.
Xob behaves exactly the same as wob this the file for xob are just renamed from
wob. Alternative proposal is place a if statement in sxmo_wob.sh to start wob
or xob and then remove the $SXMO_WM check.
Signed-off-by: hazardchem <hazardchem@disroot.org>
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Copied from the Pine Phone Pro profile, but (1) removed the modem, (2)
removed wayland scaling and (3) changed the power key to 0:0:rk805_pwrkey
Signed-off-by: Anjandev Momi <anjan@momi.ca>
This add a simple hook "wallpaper" that by default grab the system
wallpaper (ex: provided by postmarketos-artwork-wallpapers). If there is
none, it fallback to the sxmo one.
Of course, the hook is customizable by the user if needed.
Ref: https://gitlab.com/postmarketOS/pmaports/-/issues/2499
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Signed-off-by: Anjandev Momi <anjan@momi.ca>
Mostly using sxmo_jobs.sh to simplify the pid management.
This also cleanup the sxmo_hook_ring.sh to correctly manage the
vibration and ringing pids.
This also prevent the phone to continue to ring a bit after the ring
stopped.
Do not fire sxmo_hook_call_audio if we fails to enable call mode correctly, and
actually exit 1 when it does.
Plus check everything is actually right at the end of the hack hook.
This folder has been removed, keeping it here results in getting "::" in
the path, which some shells interpret as $PWD. This is unexpected and
potentially hazardous.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
These match what the states are used for. These actions aren't the exact
inverse of each other, and with more states could even take different
routes through the available states.
For example if we were to dim the screen before entering lock, the idle
states would be: unlock, dim, lock, screenoff, and the click states
would be unlock, screenoff, lock. Logic would be needed to handle states
not in the click list.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
with the default keybindings, sxmo_wmmenu.sh is reachable by volup x3.
without that mapping, it's unreachable.
having it reachable from the top-level menu allows more input mappings
to be practically usable (for example: vol-up short-press for appmenu,
long-press for sys menu, no third action).
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
Tangram is a convergent GTK4 web browser built specifically for running
web-apps like the Mastodon or Lemmy web clients:
<https://github.com/sonnyp/Tangram>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
Cozy is an audiobook player:
<https://github.com/geigi/cozy>
it works well in portrait mode. in landscape mode the controls at the
bottom of the screen (play/pause/seek/speed) might not be visible on
small displays unless SXMO_SWAY_SCALE is reduced or some other mechanism
is used to avoid scaling the application.
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
This changes to sxmo_rss.sh allows up to 2 http requests to be handled as some
rss feeds provide either a link, or a link and enclosure, an example of this is
PostmarketOS Podcast, with a link to the website and a link to the content in
the same file.
When the script detects more than one it breaks them into:
Link {1st http address}
Enclosure {2nd http address}
Otherwise everything happens as per the script originally.
This change line up with how sfeed_curses presents the links.
Signed-off-by: hazardchem <hazardchem@disroot.org>
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
If system service manager stops tinydm (e.g. if someone runs service
tinydm restart) it should send sigterm to this script. If we're allowed
a chance to, we should do our best to cleanup in this case.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
This hook deletes the timezone in the logs when displaying it, for
readability purposes. But it only deletes timezones whose UTC offset
is negative. This patch fixes it, so negative and positive offsets are
recognized and deleted.
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
samsung,coreprimevelte is a smartphone with a basic work-in-progress
mainline support. The volume keys however do already work so specify
their identifier for Sxmo to use.
Signed-off-by: Karel Balej <balejk@matfyz.cz>
Signed-off-by: Anjandev Momi <anjan@momi.ca>
The Kobo Clara HD is a device with a very HiDPI screen. It have a
1448x1072 but with a 4 inches screen. Without this change, it is very
difficult to trigger some edge triggers.
The recent patch to support the Nokia N900 offered a new dedicated
inputhandler hook. This would bring the number of those scripts to
three:
- the default three button, touchscreen support one we use on Pinephone
and most of the devices
- the one button e-reader one, which behave differently cause there is a
single state for the e-ink screen devices (no screenoff or screen
locked)
- and now this third one, cause the device got a non multi-touch support
screen, and a physical keyboard
I paused while reviewing this patch cause this is becoming too much
duplication. We had to think about this script, and how to deduplicate
the code as much as possible.
While investigating, I noted that with the recent addition
of sxmo_state_switch.sh, we could probaly unify cleanly the whole
management of the Sxmo state, on every devices.
With a simple refactorisation, I was able to change the available
states with a simple environment variable $SXMO_STATES. The default value
is of course "unlock lock screenoff", but on desktop it will become
"unlock locker", and on e-ink reader just "unlock".
This unify most of the variable code from the inputhandlers, cause all of them
can now call sxmo_state_switch.sh up/down in a common way. The last
pieces of code that is still dependent on the device type was the
sxmo_wakelock.sh part:
On three state mode devices, Sxmo remove the wakelock if the state is
"screenoff" after 3s of inactivity. On Pinenote Sxmo remove it when "unlock"
after 120s of inactivity. On desktop, we currently never suspend.
I managed to unify this by extending the "transition" method from
sxmo_state_switch.sh. The environment variables is
$SXMO_SUSPENDABLE_STATES:
By default (pinephone and other), we use "screenoff 3" as value.
On pinetab "unlock 120", and on desktop nothing explicit (we
never reach screenoff in this mode anyway).
It is possible to define multiple cases, ex "lock 120 screenoff 3", which
means 120s timeout while lock, and 3s timeout while screenoff.
It is now possible for a user, or a future device, to define a brand new
workflow, with different available states, and suspending behaviors.
This change also strip the state hooks of this responsibility, and ensure we
keep control over this behavior.
With those changes, we now can remove completely the subdirectories from the
hooks \o/
The in-screen keyboard specific case will be managed by an environment
variable, to disable it on Nokia 900, or devices that have a physical
keyboard (desktops too).
Previously, this hook was just removing the wake lock that prevent the
device to suspend. This was only up to sxmo_hook_block_suspend.sh to
prevent the device to suspend if some applications are active.
With this change, we glue the idle inhibitors just before unlocking the wake
lock.
It means that the user now can move the device to screenoff, with an
idle inhibitor programs running, without needing to add a dedicated rule
to the block_suspends hook.
This also remove the need of this sxmo_hold_a_bit 3s wakelock.
If a call is incomming and the proximity doesn't unlock the screen,
cause near initial state, or because it is bugged, then we was setting
the "menu" mode while screenoff. Which means the power button was
picking the dmenu entry instead of unlocking the device.
We disable the "menu" mode if the proximity lock turns the screen off,
so we should not set this mode if the initial state is screenoff.
Main goal here is to remove obsoletes rules, and to drop our 666 chmods.
Those are serious security holes. Requiring the user to be in the "input"
group is already very weak. Let's not make this worse.
Brightnessctl embark its own rules, so we can drop our lights related
rules.
We move the touchscreen in a more common by-path folder. We are in the input
group, so lisgd have access to it.
I don't know about stylus related rules, I don't think they are
necessary. Input devices are in the "input" group by default. I don't
think those need to be 666...
Relying on SXMO_DEVICE_NAME isn't great cause some devices (ex: the
Pinebook Pro) got a device name that isn't "desktop" but are considered
by Sxmo with a desktop mode. Because of the symlink of the hook folder
to desktop.
I think a dedicated environment variable is good enough to cover this
case.
- Fallback to using wtype to convert volume / power presses into
up/down/enter int menu mode if we don't know volume key names. This
costs some performance, but is only noticeable when scrolling quickly.
- Bind to all power and volume button devices. This will make it
possible to trigger {volup,voldown,powerbutton}_one events on any
device, even without a deviceprofile. This is necessary for unlocking
without a deviceprofile, it's also a big step towards not needing
deviceprofiles at all.
Chanes from v1:
- don't use the multikey script when we can't set the repeat rate of
volume buttons.
- don't bind to anything on desktop systems
- remove default values for vol and pwr that were causing issues
- remove SXMO_VOLUME_BUTTON="none" from pinenote deviceprofile since we
check if it's empty instead now
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Without those, every sxmo_migrate.sh ask the user if they want to remove
those. Adding a placeholder make it easy to differenciate known hooks,
and hooks that has been removed.
This also cleanup, merge or fix some existing hooks.
The services for programs that aren't provided by sxmo-utils often
conflict with services provided by distributions other than alpine. This
provides a flag that package maintainers can use to easily disable them
at build time.
Signed-off-by: Aren Moynihan <aren@peacevolution.org>
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
this is technically overbroad, in that it blocks whenever Dino is
outputting audio, but in practice that's precise enough & Dino doesn't
expose any API to detect calls specifically.
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
Some pkill implementations match on /proc/pid/stat which is limited to
15 characters [1]. $KEYBOARD defaults to svkbd-mobile-intl which is more
then 15 characters, so use -f to match the full string. Note that sxmo
uses busybox pkill by default which does not have this limit.
[1] https://manpages.debian.org/buster/procps/pgrep.1.en.html (Notes)
This patch was previously applied, and then reverted by a careless
refactor, restore it.
Signed-off-by: Anjandev Momi <anjan@momi.ca>
Signed-off-by: Aren Moynihan <aren@peacevolution.org>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
right now sxmo_killwindow.sh is exposed only via the (default) sxmo
input bindings/gestures. exposing this via the menu system allows more
leeway for exploring alternative input bindings.
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
This value seems too fast and cause problems:
https://gitlab.com/postmarketOS/pmaports/-/issues/2282#note_1550179911
I'm in favor of droping this completly. I don't use this repeat behavior
cause it is not precise enough anyway. Waiting a bit longer to browser
large menus seems okay.
I moved this to the multikey_retrocompat cause this script still expect
those values.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
This cause most game to just not start. Cause the flatpak-portal doesn't
have DISPLAY.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Signed-off-by: Anjandev Momi <anjan@momi.ca>
If two power handler trigger at the same time, the current behavior is
that we switch two time to the same target state.
This move the flock to a central script that make sure only one switch
is ocurring at the same time. Concurrent switch will wait for the
previous one to finish before guessing the new target state.
This also refactorise the sxmo_proximitylock.sh to make it simple,
stripping the two related proximitylock and proximityunlock states.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Signed-off-by: Anjandev Momi <anjan@momi.ca>
As this does not works for a long time, and this is mostly Pinephone
specific, we drop this from Sxmo.
If someone want to investigate futher to keep something similar, I would
recomment to find a more global solution than this Sxmo specific trick.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Signed-off-by: Peter John Hartman <peterjohnhartman@gmail.com>
Without this, sxmo_open.sh and so sxmo_files.sh fails to setup the
correct window titles for terminal desktop programs
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Signed-off-by: Anjandev Momi <anjan@momi.ca>
- inhibit idle to leave the screen on while reading
- map vol keys to page scroll when locked
- quit using "q" to store progress
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
This is principally a refactorisation of those handlers, primarily to
strip some cases where foot handle correctly scrolling by itself now.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
Apparently in edge sxiv has been retired, but there is still nsixv.
Fortunately, our code checks for *sxiv*, so changing this was pretty
simple.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
As with vvmd, this allows mmsd-tng to look up service providers,
and does not default to T-mobile-USA
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
if XDG_MUSIC_DIR is configured, it will be opened on launch
playerctl is required for mpris controls in the menu
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
sxmo_common.sh is in $PATH so we can let the shell handle finding it.
Running a script with sh -x <scriptname> can be handy for debugging, but
doesn't work with these because $0 doesn't get set to the full path to
the script.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
/sys/class/wakeup was used when we would check active_count to guess the
wakeup reason.
/sys/power/wakeup_count was a failed attempt to avoid using doas in
sxmo_wakelock.sh.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
like PREFIX and DESTDIR, SYSCONFDIR is one of the standard GNU
installation directory variables:
<https://www.gnu.org/prep/standards/html_node/Directory-Variables.html>
this is a no-op for any package managers not explicitly setting
SYSCONFDIR, but it makes packaging for distros that don't use FHS paths
(i.e. NixOS) quite a bit easier.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
since PREFIX defaults to /usr at the top of this file, this is a no-op
for any package managers that don't explicitly set PREFIX.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Configurations with multiple VPNs currently fail to show the networks
dialog due to a failing sed invocation due to multiple lines in
VPNDEVICE env var:
$ nmcli con show --active
NAME UUID TYPE DEVICE
wired xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx ethernet eth0
mullvad-nl5 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx wireguard mullvad-nl5
lo xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx loopback lo
wg-forge xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx wireguard wg-forge
This patch adds support for arbitrary numbers of VPNs by concatenating
the VPN names with a '|' and running the latter through sed with
support for extended regexp (needed for the '|' interpreted as an or).
Signed-off-by: Peter John Hartman <peterjohnhartman@gmail.com>
sxmo_wm.sh uses the `SXMO_WORKSPACE_WRAPPING` variable to control
relative movements. for example, set this to "5" and then the "Next
Workspace" option in the switch menu will cycle WS 1 -> 2 ... -> 5 -> 1.
same for one- and two-finger left/right swipe to switch/move workspaces.
however, absolute movements (via the move menu) only allowed moving to
WS 1-4. a user with non-default `SXMO_WORKSPACE_WRAPPING` could move a
window from WS 5 to WS 4 with this menu, but not from WS 4 back to WS 5.
this patch brings consistency by using `SXMO_WORKSPACE_WRAPPING`
anywhere we would otherwise assume the number of possible workspaces.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
- compose key on ralt
- new t and g keybinds
- fix pinentry floating
- add media keybinds
- setup lid open/close
- i now use windowswitcher instead of script (easily available)
The stopwatchrun sleep was in the wrong line, and so this was very costy
to use.
Also moved to sxmo_aligned_sleep to avoid overlapping seconds, while
still being the cheapest possible.
It is inconsistent with the debug outputs, and is confusing for the
user. sxmo_wakelock.sh should be a tool to manage every lock, not
only the sxmo ones.
Instead we should prefix manually from our scripts.
@echo "NOTICE 1: Do not forget to add sxmo-setpermissions to your init system, e.g. for openrc: rc-update add sxmo-setpermissions default && rc-service sxmo-setpermissions start" >&2
@echo "NOTICE 2: After an upgrade, it is recommended you reboot and when prompted run sxmo_migrate.sh to check and upgrade your configuration files and custom hooks against the defaults (it will not make any changes unless explicitly told to)" >&2
@echo "NOTICE: After an upgrade, it is recommended you reboot and when prompted run sxmo_migrate.sh to check and upgrade your configuration files and custom hooks against the defaults (it will not make any changes unless explicitly told to)" >&2
DATESEDCMD="s/at.*${TODAY}T/today at /; s/at.*${YESTERDAY}T/yesterday at /; s/at.*${TWO_DAYS}T/two days ago at /; s/-[0-9][0-9][0-9][0-9]://; s/\(-[0-9][0-9]\)T\([0-9][0-9]\)/\1 \2/;"
DATESEDCMD="s/at${TODAY}T/today at /; s/at${YESTERDAY}T/yesterday at /; s/at${TWO_DAYS}T/two days ago at /; s/[-+][0-9][0-9][0-9][0-9]://; s/\(-[0-9][0-9]\)T\([0-9][0-9]\)/\1 \2/;"
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.