Commit Graph

1971 Commits

Author SHA1 Message Date
Willow Barraco
4e0715d87a Allow to disable modem related features
Usefull on desktop, and e-reader devices. Disable some daemons, status
bar icons, and error messages.
2023-10-17 09:59:05 +02:00
Willow Barraco
1caf280dd8 Support for Kobo Clara HD 2023-10-17 09:59:05 +02:00
Willow Barraco
aa56356463 Strip trailing whitespaces 2023-10-17 09:58:29 +02:00
Willow Barraco
ab79ed6f72 Rename sxmo_state.sh from sxmo_state_switch.sh 2023-10-17 09:58:29 +02:00
Willow Barraco
b09469d965 Unify per-device hooks
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).
2023-10-17 09:58:29 +02:00
Willow Barraco
b83b2e4f18 Do not worry if there is no touch input
This also notify while on desktop mode. Let's just swallow this.
2023-10-15 13:40:13 +02:00
Jan Wagemakers
7c487c3e0f add Amazfish to sxmo_hook_apps.sh
Amazfish = companion application for smartwatches.

Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2023-10-14 16:28:18 +02:00
Willow Barraco
bbec613e8a Rename sxmo_jobs.sh from sxmo_daemons.sh
A long time ago I said I should rename this. And I finally did it.
sxmo_jobs.sh is a more appropriate name for the intention behind this script.
2023-10-13 09:20:05 +02:00
Willow Barraco
f479a599f6 Unify sxmo_{w,x}init.sh 2023-10-13 09:19:22 +02:00
Willow Barraco
38e450902f Prefer /run/user instead of /var/run/user 2023-10-13 09:19:21 +02:00
Willow Barraco
e2f767bde8 Do not touch env XDG_RUNTIME_DIR if Sxmo is not running
This was causing problems if sxmo-utils was installed, but not used.
This is a revised version of Aren's patch: Clean up handling of XDG_RUNTIME_DIR
2023-10-13 09:19:21 +02:00
Willow Barraco
86555424ed sxmo_hook_screenoff.sh respect idle inhibitors
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.
2023-10-13 09:19:20 +02:00
Willow Barraco
37b50b6798 sxmo_dmenu.sh: do not set menu mode if the state isn't unlock
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.
2023-10-13 09:19:20 +02:00
Willow Barraco
598058494b Add statusbar icon when ethernet hotspoting 2023-10-13 09:18:21 +02:00
Willow Barraco
7ba7990a55 sxmo_wakelock.sh: wrap isenabled behavior 2023-10-13 09:18:20 +02:00
Willow Barraco
c1b2803fcf Cleanup SXMO_SYS_FILES
Drop completly this way of giving access to system resources.
Rely on doas to privilage escalate. This ensure the user is in wheel
group.
2023-10-13 09:18:20 +02:00
Willow Barraco
7a77851c9a Cleanup udev rules
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...
2023-10-13 09:18:19 +02:00
Willow Barraco
09a3b63b94 sxmo_bluetoothmenu.sh: fix indexes 2023-10-13 09:18:19 +02:00
Willow Barraco
d13ee22779 sxmo_bluetoothmenu.sh: add pairable toggle 2023-10-13 09:18:18 +02:00
Willow Barraco
db1614b7b7 sxmo_hook_screenoff.sh blink first
Now that blinking is fast, thanks to brightnessctl, we should blink
directly to make state switch consistent.
2023-10-13 09:18:18 +02:00
Willow Barraco
2c961c8c95 sxmo_led.sh switch to brightnessctl 2023-10-13 09:18:17 +02:00
Willow Barraco
03990468c0 sxmo_bluetoothmenu.sh trust command can also fails 2023-10-13 09:18:17 +02:00
Willow Barraco
612f053d0c sxmo_bluetoothmenu.sh full reconnection allow unsuccessfull commmands 2023-10-13 09:18:16 +02:00
Willow Barraco
5be5a97090 sxmo_bluetoothmenu.sh do not remove asynchronously 2023-10-13 09:18:16 +02:00
Willow Barraco
7710b6211f sxmo_bluetoothmenu.sh stop bluetooth_scan on window kill too
Without this, we don't stop the scan if we kill the full reconnection
window.
2023-10-13 09:18:16 +02:00
Willow Barraco
9a5babd048 sxmo_bluetoothmenu.sh full reconnect loop on connection too
We already loop on pair, we should do the same for connect.
2023-10-13 09:18:15 +02:00
Willow Barraco
2dc137ce57 Refact battery monitoring with upower 2023-10-11 14:54:08 +02:00
Willow Barraco
5b6ddc7510 Run sxmo_hook_locker.sh if available 2023-10-11 14:54:08 +02:00
Willow Barraco
e0efe35a2d sxmo_audio.sh drop alsa support
Now that we support Pipewire and Pulseaudio, and that we automatically
determine available output ports, this is useless and badly supported.
2023-10-11 14:54:08 +02:00
Willow Barraco
c33408abb5 Cleanup number on incoming call 2023-10-11 14:54:08 +02:00
pedja
e55d30d2ad Auto rotate screen on physical keyboard opened/closed
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
2023-10-11 14:54:07 +02:00
Paavo Ylönen
df539391e5 Deviceprofile for Motorola Moto G4 Play 2023-10-11 14:54:07 +02:00
b1e5d75162 autorotate: allow all four orientations
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
2023-10-11 14:54:07 +02:00
c7df343008 sxmo_hook_rotate.sh: update docs for CLI args
see `swayrotinvert()` in sxmo_rotate.sh, which calls this hook with "invert"

Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
2023-10-11 14:54:04 +02:00
Willow Barraco
2547af4cbc Use a dedicated env variable to remove volume bind
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.
2023-10-10 18:24:22 +02:00
ArenM
25c1827b5f device agnostic bindings for volume and power
- 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>
2023-10-10 18:24:21 +02:00
Zach DeCook
195f77d2cf Icons: switch magnifying glass to proper range
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
2023-10-10 18:24:21 +02:00
Zach DeCook
e1493cff6a Apps: Add Gnome Maps
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
2023-10-10 18:24:20 +02:00
Zach DeCook
0210047512 Apps: Add badwolf (webkit browser)
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
2023-10-10 18:24:20 +02:00
Jan Wagemakers
e99ef4e2e3 add SXMO_VIBRATE_DEV to SHIFT6mq deviceprofile
This makes vibrate work on the shiftphone shift6mq.

Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
2023-10-10 18:24:19 +02:00
Willow Barraco
b175f17acd Add placeholder hooks to simplify user migrations
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.
2023-10-10 17:58:13 +02:00
Aren Moynihan
a4bbfd525f Separate services that are provided by external packages
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>
2023-10-10 17:54:25 +02:00
b579015748 suspend: block if Dino is in a call
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>
2023-10-08 17:58:34 +02:00
Martin Bila
05fd5112d5 fixed escaped characters conversion from fetched sms
Changes to be committed:
	modified:   scripts/modem/sxmo_modem.sh

Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2023-10-05 20:24:14 +02:00
Jochen Sprickerhof
ae7fd89b46 Use pkill -f for $KEYBOARD
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>
2023-10-03 22:06:51 +02:00
2db9353edb sxmo_wmmenu.sh: add "Kill window" option
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>
2023-10-02 23:18:45 +02:00
Anjandev Momi
7a7188bddc xiaomi elish: set MONITOR to DSI-1
https://lists.sr.ht/~mil/sxmo-devel/%3C20230807161613.13072-2-noneofyourbusiness%40danwin1210.de%3E#%3C20230903124519.486585ca@workstation.localdomain%3E
2023-09-22 18:33:13 -07:00
Willow Barraco
d92f57f213 Revert "Work-arround the Wob crash"
This reverts commit 55aac86762.

The issue has beed fixed with Wob 0.15.1
2023-09-17 19:44:21 +02:00
Anjandev Momi
0e3315b57b add device profile for mi pad 5 pro 2023-09-17 01:30:13 -07:00
Willow Barraco
17e4e917a7 Add a desktop default device profile
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Signed-off-by: Anjandev Momi <anjan@momi.ca>
2023-09-17 01:25:16 -07:00