164 Commits

Author SHA1 Message Date
bb862e0f89 apps: add Notejot 2023-12-30 11:38:35 +00:00
92b077aa67 sxmo_open: just call xdg-open
xdg-open understands the user's mime preferences more reliably than this SXMO re-implementation
2023-12-30 11:33:48 +00:00
be5021e9d8 only alias jq=gojq if the latter is available 2023-12-30 11:33:48 +00:00
3ba6345b5a sxmo_hook_apps: launch apps via the window manager 2023-12-30 11:33:48 +00:00
12e3906e6b sxmo_migrate: add option to disable configversion checks 2023-12-30 11:33:48 +00:00
54948ab328 apps: add Lemoa 2023-12-30 11:33:48 +00:00
Willow Barraco
29ff6e270f Bump version 2023-12-28 09:10:03 +01:00
Willow Barraco
6a024f2122 sxmo_modemaudio.sh allow to brute force setup/reset
Instead, do not reset if it is already done on sxmo_modem.sh
2023-12-27 17:35:27 +01:00
Willow Barraco
5e86c77a2c sxmo_modemaudio.sh swallow if on the target mode 2023-12-27 17:32:36 +01:00
Willow Barraco
f9e8ed1667 Do not resume player before we reset the audio 2023-12-27 17:32:36 +01:00
Willow Barraco
3fe7b2bb1e Fix auto pause of active players
Do not pause_all on pickup, we already do it when rings starts.
Do resume_all on mute_ring.
2023-12-27 17:32:35 +01:00
Willow Barraco
1eb155ce47 Stop the ring before setting up the audio call mode
Trigger hooks sync to prevent noise while picking up calls.
2023-12-27 12:39:50 +01:00
Willow Barraco
2f5fae6e10 Simplify the ringing related code
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.
2023-12-27 12:39:49 +01:00
Willow Barraco
eaa596816f sxmo_hook_sms.sh: vibrate while noising 2023-12-27 12:36:15 +01:00
Willow Barraco
b62eda14d6 sxmo_modemaudio.sh: enforce speaker mode after a call
This is another try to solve this problem.
2023-12-27 12:36:15 +01:00
Willow Barraco
18d2845f78 Drop our manual quoting of sms content
ModemManager 1.22.0 just added --messaging-create-sms-with-text:

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/275

Finally we can use quotes in our sms.

We add -f in sxmo_modemsendsms.sh to give the draft file directly.
2023-12-24 15:46:42 +01:00
Willow Barraco
278d896eaa Update the proximity lock status bar icon when started/stopped 2023-12-24 15:43:27 +01:00
Willow Barraco
1522fd4128 sxmo_modemaudio.sh: fail exit if it actually failed to setup audio
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.
2023-12-24 15:43:26 +01:00
Zach DeCook
fa57046245 Statusbar: indicate when headset mic is primary
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
2023-12-24 15:43:26 +01:00
Willow Barraco
73416c9280 Simplify audio status bar icon
Unify both call and regular mode. Mostly cleanup.
2023-12-24 15:43:23 +01:00
Roberto Castagnola
5e7e07841f Fix bluetooth device list
Signed-off-by: Roberto Castagnola <roberto.castagnola@gmail.com>
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
2023-12-24 15:04:38 +01:00
Aren Moynihan
2cde05382d state: idle transitions shouldn't loop around to unlock
Previously when state=screenoff, sxmo_state.sh idle would set the state
to unlock.

Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
2023-12-24 15:04:38 +01:00
Aren Moynihan
99f01be21f sxmo_init: remove global default_hooks/<device_name>
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>
2023-12-24 15:04:36 +01:00
Willow Barraco
542d6507cf Drop obsolete proximity state handling 2023-12-17 10:16:35 +01:00
Aren Moynihan
853690a704 state: rename down to idle and up to click
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>
2023-12-17 10:16:34 +01:00
Willow Barraco
61aa02754f Fix the wake up from screenoff when manually moved here 2023-12-17 10:16:34 +01:00
Willow Barraco
0535059f7d Stop idle_locker if disabled globally 2023-12-17 10:16:33 +01:00
Willow Barraco
97447367f6 Bump version 2023-12-09 19:56:24 +01:00
21d694822a sys menu: include an entry for the WM menu
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>
2023-11-26 17:48:09 +01:00
f605068505 Apps: add gnome-2048
Gnome 2048 is a mobile-friendly implementation of the 2048 game:
<https://wiki.gnome.org/Apps/2048>

Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2023-11-26 17:45:39 +01:00
8758473866 apps: add Animatch
Animatch is a mobile-friendly "match three" game commisioned by Purism:
<https://gitlab.com/HolyPangolin/animatch/>

video: <https://social.librem.one/system/media_attachments/files/005/973/879/original/7cb0eb9fcde900fd.mp4>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2023-11-26 17:45:37 +01:00
da7e951159 apps: add Tangram
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>
2023-11-26 17:45:35 +01:00
9b0f6a3414 apps: add Librewolf
Librewolf is a privacy/security-focused Firefox fork:
<https://librewolf.net/>

Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2023-11-26 17:45:32 +01:00
a264835cdd apps: add Wike
Wike is a convergent GTK4 Wikipedia reader:
<https://github.com/hugolabe/Wike>

Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2023-11-26 17:45:30 +01:00
49aa6be220 apps: add Komikku
Komikku is a convergent GTK4 manga/comic book reader:
<https://gitlab.com/valos/Komikku>

Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2023-11-26 17:45:19 +01:00
9df61b2d32 apps: add KOReader
KOReader is an extremely lightweight, but capable, ebook reader:
<https://github.com/koreader/koreader>

Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2023-11-26 17:45:16 +01:00
b74c03d688 apps: add Gnome Weather
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2023-11-26 17:45:14 +01:00
af7890dfdf apps: add Cozy
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>
2023-11-26 17:45:12 +01:00
46b64a713a apps: add g4music
g4music is a convergent gtk4 music player:
<https://github.com/neithern/g4music>

Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2023-11-26 17:45:10 +01:00
8d92365ffb apps: add Chatty
Chatty is Purism's multi-protocol instant messaging client:
<https://gitlab.gnome.org/World/Chatty>

Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2023-11-26 17:45:06 +01:00
Willow Barraco
1654cde76d Fix truncated sms on first line return
This problem has been introduced with 05fd5112

This time, we will use the json format with -J instead of parsing
manually this key-value format.
2023-11-07 15:40:08 +01:00
Willow Barraco
824ad04d59 test: run all tests 2023-11-06 14:43:42 +01:00
ArenM
b8c42390be Add test for nerd font icons that are outside the private use areas
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
2023-11-06 14:43:42 +01:00
Willow Barraco
819c5fad58 Strip jobs.lock from sxmo_jobs.sh list output
Move this lock file from the directory where pids are stored.
2023-10-31 11:49:29 +01:00
Willow Barraco
bd6473dcfb sxmo_networks.sh: cleanup notifications
We was still using the plain stdout message from the commands.
2023-10-31 11:29:12 +01:00
Willow Barraco
582b51ccca Support for Nokia N900 2023-10-31 11:28:03 +01:00
hazardchem
e4ffce9a69 sxmo_rss.sh: Allow up to 2 http requests instead of only handling 1st
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>
2023-10-31 11:27:44 +01:00
Aren Moynihan
6638fc402b Add logging to sxmo_hook_block_suspend
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
2023-10-31 11:27:44 +01:00
Aren Moynihan
6a3269d358 sxmo_init: run cleanup when killed
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>
2023-10-31 11:27:44 +01:00
Eolien55
f24d0f7e1d sxmo_hook_tailtextlog.sh: fix timezone parsing
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>
2023-10-29 16:54:34 +01:00
Karel Balej
1b8d58e2ca deviceprofiles: add samsung,coreprimevelte
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>
2023-10-26 22:36:27 -07:00
Willow Barraco
8249219793 Add a SXMO_NO_AUDIO env variable to strip some daemons 2023-10-17 09:59:06 +02:00
Willow Barraco
0de5c282ab Use the new -s argument to help lisgd edge detection
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.
2023-10-17 09:59:05 +02:00
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
Willow Barraco
55aac86762 Work-arround the Wob crash
https://github.com/francma/wob/issues/131

This is caused by wob sandboxing, disabling it avoid the issue.
2023-09-17 09:39:12 +02:00
Willow Barraco
0766872097 Deactivate vol key custom repeat for menus
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>
2023-09-13 22:25:41 +02:00
Willow Barraco
c95f3d9e7b Fix Steam pressure-vessel missing xwayland DISPLAY
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>
2023-09-09 12:47:37 -07:00
Willow Barraco
ef8254681c Unify sxmo state switch and ensure consistency
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>
2023-09-09 12:47:04 -07:00
Willow Barraco
ee180f6e51 Drop fast wifi reconnection behavior
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>
2023-09-09 09:57:39 -05:00
Willow Barraco
e6c02e3bc3 Differenciate TERMCMD and SXMO_TERMINAL
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>
2023-09-09 00:53:01 -07:00
Willow Barraco
e2b2c510a2 sxmo_migrate.sh do not reload environment if already loaded
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Signed-off-by: Anjandev Momi <anjan@momi.ca>
2023-09-09 00:45:47 -07:00
Willow Barraco
0acdebf0a7 appscripts: add a sxmo_notes script
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Signed-off-by: Anjandev Momi <anjan@momi.ca>
2023-09-08 23:57:00 -07:00
Michael Leu
3fbcf32fee apps: add osmin and numberstation
https://github.com/janbar/osmin
https://git.sr.ht/~martijnbraam/numberstation
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2023-09-08 22:40:30 +02:00
Willow Barraco
a2d5d2ed08 sxmo_screenshot.sh allow to take all output
This is still subject to a bug with touch inputs:

https://github.com/emersion/slurp/issues/140
2023-08-31 10:57:31 +02:00
Willow Barraco
086d8de5f8 sxmo_upgrade.sh: use -a and -i
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2023-08-30 15:31:23 +02:00
Maarten van Gompel
a9c2c3b4bf integrate lf in context menu
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
2023-08-30 13:41:36 +02:00
Maarten van Gompel
86dcf85612 Apps: add portfolio
A python/gtk file manager for mobile devices, with minimalist aims

Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
2023-08-30 13:41:35 +02:00
Willow Barraco
ebe88d9ef9 sxmo_migrate.sh: fix "3 Use your [u]ser version as-is" empty configversion 2023-08-30 11:42:45 +02:00
Willow Barraco
f61bb64aca Integrate nnn
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2023-08-30 11:16:38 +02:00
Willow Barraco
ebb2c3e47e Integrate epy|epr epub readers
- 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>
2023-08-30 11:16:31 +02:00
Willow Barraco
471dce2b9e Rework terminal handlers to deal correctly with terminals with touch support
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>
2023-08-30 11:16:27 +02:00
Peter John Hartman
22c3f178cd sxiv -> nsxiv
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>
2023-08-30 08:56:29 +02:00
Raymond Hackley
788810268c Add device profile for Samsung Galaxy E5 (samsung,e5)
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
2023-08-30 08:54:56 +02:00
Willow Barraco
871caa7394 Revert "Remove dead code from setpermissions"
This reverts commit da36357b4f.
2023-08-29 23:40:27 +02:00
Willow Barraco
6ce754385c sxmo_hook_tailtextlog.sh remove leading line "no matching node" 2023-08-29 21:04:39 +02:00
Willow Barraco
4c6840b4ff apps: Add syncthing-gtk 2023-08-29 21:04:39 +02:00
Willow Barraco
56c7df703d Undocumment unknown hook 2023-08-29 20:28:54 +02:00
Willow Barraco
bd41443f55 Strip superd verbose mode by default 2023-08-29 20:27:30 +02:00
Willow Barraco
31dc146bde Simplify deviceprofile check on start hook 2023-08-29 20:27:30 +02:00
Willow Barraco
d42739d1a2 Supress noise while toggleing lisgd 2023-08-29 20:26:17 +02:00
Willow Barraco
69b16dd017 sxmo_vvm.sh: Fix sxmo_hook_smslog.sh 2023-08-29 20:25:17 +02:00
Willow Barraco
d9dd4d4ab6 Also close keyboard on bottomleft gesture 2023-08-29 20:11:39 +02:00
Willow Barraco
3abfb24924 sxmo log and debug should also output to stderr 2023-08-29 20:08:49 +02:00
Willow Barraco
3ecbf9a727 sxmo_brightness.sh quiet brightnessctl 2023-08-29 19:45:07 +02:00
Chris Talbot
4394816f16 mmsdconfig: Use correct default config
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>
2023-08-29 19:38:54 +02:00
Chris Talbot
0e39ef1c2d vvmdconfig: Change default config file
This config file allows vvmd to look up providers, and the
previous one was for T-mobile USA

Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
2023-08-29 19:38:04 +02:00
Zach DeCook
af86f64500 Apps: Add Tuba
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
2023-08-29 19:08:58 +02:00
Zach DeCook
bd9eca7dd4 Geopard: Add pipe-url to menu
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
2023-08-29 19:08:52 +02:00
Zach DeCook
700bee1659 Apps: Add Amberol
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>
2023-08-29 19:08:46 +02:00
Zach DeCook
3a70be4fd7 Device Profile: Make vibration strength configurable
Fixes vibration on OnePlus 6

Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
2023-08-29 19:06:23 +02:00
ArenM
228b936f08 Remove useless dirname calls
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>
2023-08-29 19:03:21 +02:00
ArenM
da36357b4f Remove dead code from setpermissions
/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>
2023-08-29 19:03:09 +02:00
0d56424cbc Makefile: use SYSCONFDIR instead of hardcoding /etc
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>
2023-08-29 18:57:41 +02:00
9e16a9fa47 Makefile: obey PREFIX when installing udev rules
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>
2023-08-29 18:57:41 +02:00
Hanspeter Portner
a69fbb2222 sxmo_networks.sh: support multiple VPNs
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>
2023-08-28 07:11:04 -05:00
Joshua Murphy
a63a678077 sxmo_hook_statusbar.sh: include wireguard when searching for vpn
Signed-off-by: Peter John Hartman <peterjohnhartman@gmail.com>
2023-08-28 06:59:38 -05:00
Willow Barraco
2a1782f397 Make config gesture toggle persistent
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Signed-off-by: Peter John Hartman <peterjohnhartman@gmail.com>
2023-08-28 06:41:15 -05:00
Willow Barraco
0791b182e9 sxmo_modemaudio.sh: fix speaker disabled after a call (and cleanup) 2023-08-22 15:40:42 +02:00
Willow Barraco
095678e77f Comment percentage manual computing 2023-08-11 09:28:39 +02:00
Willow Barraco
d0384a7cae Switch from light to brightnessctl
light has been flagged as orphan by its developper, and dropped from
aports.

https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/49859
https://github.com/haikarainen/light/issues/147

We switch to brightnessctl that works the same, and that also support
flashlight and leds.
2023-08-11 08:50:57 +02:00
Willow Barraco
4a6b4f6981 Reword debug message 2023-07-31 16:41:16 +02:00
7a4ccd3ec7 sxmo_wmmenu: respect SXMO_WORKSPACE_WRAPPING
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>
2023-07-31 16:39:52 +02:00
Zach DeCook
f9605bc9c8 config: fix keyboard files location
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
2023-07-21 16:30:08 +02:00
Zach DeCook
628a5675b2 suspend toggle: silence rm failure noise
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
2023-07-21 16:30:08 +02:00
Willow Barraco
333ec06d68 Upstream some decent sway configs
- 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)
2023-07-20 10:22:19 +02:00
Willow Barraco
fc24835fd5 sxmo_screenshot.sh cleanup 2023-07-20 10:22:19 +02:00
Willow Barraco
f57a4b0985 sxmo_wmmenu.sh explicit argument can be wm agnostic 2023-07-20 10:22:18 +02:00
Willow Barraco
5508e06ffe Add mumble app 2023-07-20 10:22:18 +02:00
Willow Barraco
f4479b8d8c Add a pipewire-filter-chain service 2023-07-20 10:22:18 +02:00
Willow Barraco
e0ecf42cb7 sxmo_timer.sh prevent suspension while running 2023-07-15 13:22:34 +02:00
Willow Barraco
853ad37d23 sxmo_timer.sh decrease resource consumption
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.
2023-07-15 13:22:33 +02:00
Willow Barraco
90f00ef11a sxmo_wakelock.sh do not auto prefix with sxmo_
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.
2023-07-15 13:22:32 +02:00
Willow Barraco
f0888bbd03 sxmo_wakelock.sh simplify watch mode 2023-07-15 12:47:34 +02:00
Willow Barraco
91070791ee sxmo_wakelock.sh Do not debug if unsupported system 2023-07-15 12:47:33 +02:00
Willow Barraco
1373bc682e sxmo_wakelock.sh fix minute and hour units 2023-07-15 12:47:33 +02:00
180 changed files with 1653 additions and 1617 deletions

View File

@@ -5,15 +5,10 @@ packages:
- shellspec
- gojq
- jq
- icu-dev
sources:
- https://git.sr.ht/~mil/sxmo-utils
tasks:
- shellcheck: |
- test: |
cd sxmo-utils
find . -type f -name '*.sh' -print0 | xargs -0 shellcheck -x --shell=sh
- shellspec: |
cd sxmo-utils
shellspec
- editorconfig-check: |
cd sxmo-utils
ec
make test

View File

@@ -1,12 +1,20 @@
DESTDIR=
PREFIX:=/usr
SYSCONFDIR:=/etc
SHAREDIR=$(PREFIX)/share
MANDIR=$(SHAREDIR)/man
# use $(PREFIX)/lib/systemd/user for systemd integration
SERVICEDIR:=$(PREFIX)/share/superd/services
# Install services for packages outside sxmo
EXTERNAL_SERVICES:=1
SCDOC=scdoc
.PHONY: install shellcheck
.PHONY: install test shellcheck shellspec test_legacy_nerdfont
VERSION:=1.13.0
VERSION:=1.15.2
GITVERSION:=$(shell git describe --tags)
@@ -25,11 +33,20 @@ docs/%: docs/%.scd
all: $(PROGRAMS) $(DOCS)
test: shellcheck
test: shellcheck shellspec test_legacy_nerdfont
shellcheck:
find . -type f -name '*.sh' -print0 | xargs -0 shellcheck -x --shell=sh
shellspec:
shellspec
test_legacy_nerdfont: programs/test_legacy_nerdfont
programs/test_legacy_nerdfont < configs/default_hooks/sxmo_hook_icons.sh
programs/test_legacy_nerdfont: programs/test_legacy_nerdfont.c
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $< $(shell pkg-config --cflags --libs icu-io)
programs/%: programs/%.c
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $<
@@ -58,24 +75,19 @@ install-scripts: $(PROGRAMS)
cd resources && find . -type f -exec install -D -m 0644 "{}" "$(DESTDIR)$(PREFIX)/share/sxmo/{}" \; && cd ..
# Configs
if [ "$(OPENRC)" = "1" ]; then \
install -D -m 0755 -t $(DESTDIR)/etc/init.d configs/openrc/sxmo-setpermissions; \
fi
install -D -m 0644 -t $(DESTDIR)/usr/lib/udev/rules.d/ configs/udev/*.rules
install -D -m 0644 -t $(DESTDIR)$(PREFIX)/lib/udev/rules.d/ configs/udev/*.rules
install -D -m 0644 -t $(DESTDIR)$(PREFIX)/share/applications/ configs/xdg/mimeapps.list
install -D -m 0640 -t $(DESTDIR)/etc/doas.d/ configs/doas/sxmo.conf
install -D -m 0640 -t $(DESTDIR)$(SYSCONFDIR)/doas.d/ configs/doas/sxmo.conf
install -D -m 0644 -T configs/xorg/monitor.conf $(DESTDIR)$(PREFIX)/share/X11/xorg.conf.d/90-monitor.conf
mkdir -p $(DESTDIR)/etc/NetworkManager/dispatcher.d
mkdir -p $(DESTDIR)$(SYSCONFDIR)/NetworkManager/dispatcher.d
install -D -m 0644 -T configs/appcfg/mpv_input.conf $(DESTDIR)/etc/mpv/input.conf
install -D -m 0644 -T configs/appcfg/mpv_input.conf $(DESTDIR)$(SYSCONFDIR)/mpv/input.conf
install -D -m 0755 -T configs/profile.d/sxmo_init.sh $(DESTDIR)/etc/profile.d/sxmo_init.sh
install -D -m 0755 -T configs/profile.d/sxmo_init.sh $(DESTDIR)$(SYSCONFDIR)/profile.d/sxmo_init.sh
# Migrations
install -D -t $(DESTDIR)$(PREFIX)/share/sxmo/migrations migrations/*
@@ -93,9 +105,11 @@ install-scripts: $(PROGRAMS)
mkdir -p "$(DESTDIR)$(PREFIX)/share/sxmo/appscripts"
cd scripts/appscripts && find . -name 'sxmo_*.sh' | xargs -I{} ln -fs "$(PREFIX)/bin/{}" "$(DESTDIR)$(PREFIX)/share/sxmo/appscripts/{}" && cd ../..
mkdir -p "$(DESTDIR)$(PREFIX)/share/superd/services"
install -m 0644 -t $(DESTDIR)$(PREFIX)/share/superd/services configs/superd/services/*
mkdir -p "$(DESTDIR)$(SERVICEDIR)"
install -m 0644 -t "$(DESTDIR)$(SERVICEDIR)" configs/services/*
if [ "$(EXTERNAL_SERVICES)" = "1" ]; then \
install -m 0644 -t "$(DESTDIR)$(SERVICEDIR)" configs/external-services/*; \
fi
@echo "-------------------------------------------------------------------">&2
@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

View File

@@ -28,7 +28,10 @@ command -v firefox >/dev/null && export BROWSER=firefox
#export SXMO_SUBREDDITS="postmarketos pinephoneOfficial pinephone unixporn"
# Change the default terminal command
# export TERMCMD="st -e"
export TERMCMD="sxmo_terminal.sh"
# Change the used terminal command
# export SXMO_TERMINAL="st -e"
# When scrolling past the beginning or end of a menu, wrap it around:
#export DMENU_WRAP_AROUND=1

View File

@@ -20,28 +20,38 @@ set $term sxmo_terminal.sh
# on the original workspace that the command was run on.
set $menu bemenu-run
font "Sxmo 10"
font "Sxmo 11"
exec_always sxmo_swayinitconf.sh
exec_always dbus-update-activation-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
exec_always dbus-update-activation-environment WAYLAND_DISPLAY DISPLAY XDG_CURRENT_DESKTOP
mode "menu" {
bindsym --input-device=1:1:1c21800.lradc XF86AudioMute exec nothing # just a placeholder for "menu" mode
# This is slower than remapping the keys using a keymap, but we don't need
# to know the device names, so use it as a fallback so this functionality
# keeps working if a deviceprofile doesn't exist.
# TODO: the correct way to do this is to implement custom keybindings in
# bemenu
bindsym XF86PowerOff exec wtype -k Return
bindsym XF86AudioRaiseVolume exec wtype -k Up
bindsym XF86AudioLowerVolume exec wtype -k Down
}
### Key bindings
#
# Basics:
#
input * xkb_options compose:ralt
# Start a terminal
bindsym $mod+Return exec $term
# Launch appmenu
bindsym $mod+p exec sxmo_appmenu.sh
bindsym $mod+Shift+p exec sxmo_appmenu.sh sys
# Launch scripts menu
bindsym $mod+i exec sxmo_appmenu.sh scripts
# Wm menu switcher
bindsym $mod+i exec sxmo_wmmenu.sh windowswitcher
# Kill focused window
bindsym $mod+Shift+q kill
@@ -133,7 +143,7 @@ mode "menu" {
bindsym $mod+e layout toggle split
# Make the current focus fullscreen
# bindsym $mod+f fullscreen
bindsym $mod+f fullscreen
# Toggle the current focus between tiling and floating mode
bindsym $mod+Shift+space floating toggle
@@ -143,6 +153,13 @@ mode "menu" {
# Move focus to the parent container
bindsym $mod+a focus parent
# Manual locker
bindsym $mod+g exec sxmo_hook_locker.sh
# Shutdown
bindsym $mod+t exec sxmo_appmenu.sh power
#
# Scratchpad:
#
@@ -163,16 +180,16 @@ mode "resize" {
# right will grow the containers width
# up will shrink the containers height
# down will grow the containers height
bindsym $left resize shrink width 10px
bindsym $down resize grow height 10px
bindsym $up resize shrink height 10px
bindsym $right resize grow width 10px
bindsym $left resize shrink width 30px
bindsym $down resize grow height 30px
bindsym $up resize shrink height 30px
bindsym $right resize grow width 30px
# Ditto, with arrow keys
bindsym Left resize shrink width 10px
bindsym Down resize grow height 10px
bindsym Up resize shrink height 10px
bindsym Right resize grow width 10px
bindsym Left resize shrink width 30px
bindsym Down resize grow height 30px
bindsym Up resize shrink height 30px
bindsym Right resize grow width 30px
# Return to default mode
bindsym Return mode "default"
@@ -197,17 +214,35 @@ bar {
statusline #ffffff
background #323232
inactive_workspace #32323200 #32323200 #5c5c5c
font "Sxmo"
font "Sxmo 11"
}
}
for_window [app_id="pinentry-.*"] floating true
for_window [app_id="foot" title=".*sxmo/modem/.*/draft.txt.*"] resize set height 25
for_window [title="megapixels"] inhibit_idle open
for_window [title="ep[yr].*"] inhibit_idle visible
default_border pixel 3
titlebar_border_thickness 3
hide_edge_borders smart
# Need playerctl installed and running
bindsym XF86AudioPlay exec playerctl play-pause
bindsym XF86AudioStop exec playerctl stop
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous
bindsym XF86MonBrightnessUp exec sxmo_brightness.sh up
bindsym XF86MonBrightnessDown exec sxmo_brightness.sh down
bindsym Print exec sxmo_screenshot.sh
bindsym button2 kill
bindswitch lid:on exec sxmo_wm.sh dpms on
bindswitch lid:off exec sxmo_wm.sh dpms off
include /etc/sway/config.d/*
exec 'printf %s "$SWAYSOCK" > "$XDG_RUNTIME_DIR"/sxmo.swaysock'

View File

@@ -1,6 +1,6 @@
[Desktop Entry]
Name=sxiv Image Viewer
Exec=sxiv
Name=nsxiv Image Viewer
Exec=nsxiv
Terminal=false
Type=Application
MimeType=image/jpeg;image/png;image/gif

View File

@@ -1,13 +0,0 @@
#!/bin/sh
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2022 Sxmo Contributors
sxmo_wakelock.sh lock not_screenoff infinite
# Go to locker after 5 minutes of inactivity
if [ -e "$XDG_CACHE_HOME/sxmo/sxmo.noidle" ]; then
sxmo_daemons.sh stop idle_locker
else
sxmo_daemons.sh start idle_locker sxmo_idle.sh -w \
timeout 300 'sxmo_hook_locker.sh'
fi

View File

@@ -1 +0,0 @@
three_button_touchscreen

View File

@@ -1 +0,0 @@
three_button_touchscreen

View File

@@ -1,299 +0,0 @@
#!/bin/sh
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2022 Sxmo Contributors
# This script handles input actions, it is called by lisgd for gestures
# and by dwm for button presses
ACTION="$1"
# include common definitions
# shellcheck source=scripts/core/sxmo_common.sh
. sxmo_common.sh
XPROPOUT="$(sxmo_wm.sh focusedwindow)"
WMCLASS="$(printf %s "$XPROPOUT" | grep app: | cut -d" " -f2- | tr '[:upper:]' '[:lower:]')"
WMNAME="$(printf %s "$XPROPOUT" | grep title: | cut -d" " -f2- | tr '[:upper:]' '[:lower:]')"
sxmo_debug "ACTION: $ACTION WMNAME: $WMNAME WMCLASS: $WMCLASS XPROPOUT: $XPROPOUT"
#special context-sensitive handling
case "$WMCLASS" in
*"mpv"*)
case "$ACTION" in
"oneright")
sxmo_type.sh -k Left
exit 0
;;
"oneleft")
sxmo_type.sh -k Right
exit 0
;;
"oneup")
sxmo_type.sh m
exit 0
;;
"onedown")
sxmo_type.sh p
exit 0
;;
esac
;;
*"foot"*|*"st"*)
# First we try to handle the app running inside st:
case "$WMNAME" in
*"weechat"*)
case "$ACTION" in
*"oneleft")
sxmo_type.sh -M Alt -k a
exit 0
;;
*"oneright")
sxmo_type.sh -M Alt -k less
exit 0
;;
*"oneup")
sxmo_type.sh -k Page_Down
exit 0
;;
*"onedown")
sxmo_type.sh -k Page_Up
exit 0
;;
esac
;;
*" sms")
case "$ACTION" in
*"upbottomedge")
number="$(printf %s "$WMNAME" | sed -e 's|^\"||' -e 's|\"$||' | cut -f1 -d' ')"
sxmo_terminal.sh sxmo_modemtext.sh conversationloop "$number" &
exit 0
;;
esac
;;
*"tuir"*)
if [ "$ACTION" = "rightbottomedge" ]; then
sxmo_type.sh o
exit 0
elif [ "$ACTION" = "leftbottomedge" ]; then
sxmo_type.sh s
exit 0
fi
;;
*"less"*)
case "$ACTION" in
"leftbottomedge")
sxmo_type.sh q
exit 0
;;
"leftrightedge_short")
sxmo_type.sh q
exit 0
;;
*"onedown")
sxmo_type.sh u
exit 0
;;
*"oneup")
sxmo_type.sh d
exit 0
;;
*"oneleft")
sxmo_type.sh ":n" -k Return
exit 0
;;
*"oneright")
sxmo_type.sh ":p" -k Return
exit 0
;;
esac
;;
*"amfora"*)
case "$ACTION" in
"downright")
sxmo_type.sh -k Tab
exit 0
;;
"upleft")
sxmo_type.sh -M Shift -k Tab
exit 0
;;
*"onedown")
sxmo_type.sh u
exit 0
;;
*"oneup")
sxmo_type.sh d
exit 0
;;
*"oneright")
sxmo_type.sh -k Return
exit 0
;;
"upright")
sxmo_type.sh -M Ctrl t
exit 0
;;
*"oneleft")
sxmo_type.sh b
exit 0
;;
"downleft")
sxmo_type.sh -M Ctrl w
exit 0
;;
esac
;;
esac
# Now we try generic actions for terminal
case "$ACTION" in
*"onedown")
case "$WMCLASS" in
*"foot"*)
sxmo_type.sh -M Shift -k Page_Up
exit 0
;;
*"st"*)
sxmo_type.sh -M Ctrl -M Shift -k b
exit 0
;;
esac
;;
*"oneup")
case "$WMCLASS" in
*"foot"*)
sxmo_type.sh -M Shift -k Page_Down
exit 0
;;
*"st"*)
sxmo_type.sh -M Ctrl -M Shift -k f
exit 0
;;
esac
;;
esac
esac
#standard handling
case "$ACTION" in
"powerbutton_one")
if echo "$WMCLASS" | grep -i "megapixels"; then
sxmo_type.sh -k space
fi
# swallow: postwake calls sxmo_hook_unlock.sh
exit 0
;;
"powerbutton_two")
sxmo_keyboard.sh toggle
exit 0
;;
"powerbutton_three")
sxmo_killwindow.sh
exit 0
;;
"rightleftedge")
sxmo_wm.sh previousworkspace
exit 0
;;
"leftrightedge")
sxmo_wm.sh nextworkspace
exit 0
;;
"twoleft")
sxmo_wm.sh movepreviousworkspace
exit 0
;;
"tworight")
sxmo_wm.sh movenextworkspace
exit 0
;;
"righttopedge")
sxmo_brightness.sh up
exit 0
;;
"lefttopedge")
sxmo_brightness.sh down
exit 0
;;
"upleftedge")
sxmo_audio.sh vol up
exit 0
;;
"downleftedge")
sxmo_audio.sh vol down
exit 0
;;
"upbottomedge")
sxmo_keyboard.sh open
exit 0
;;
"downbottomedge")
sxmo_keyboard.sh close
exit 0
;;
"downtopedge")
sxmo_dmenu.sh isopen || sxmo_appmenu.sh &
exit 0
;;
"twodowntopedge")
sxmo_dmenu.sh isopen || sxmo_appmenu.sh sys &
exit 0
;;
"uptopedge")
sxmo_dmenu.sh close
if pgrep mako >/dev/null; then
makoctl dismiss --all
elif pgrep dunst >/dev/null; then
dunstctl close-all
fi
exit 0
;;
"twodownbottomedge")
sxmo_killwindow.sh
exit 0
;;
"uprightedge")
sxmo_type.sh -k Up
exit 0
;;
"downrightedge")
sxmo_type.sh -k Down
exit 0
;;
"leftrightedge_short")
sxmo_type.sh -k Left
exit 0
;;
"rightrightedge_short")
sxmo_type.sh -k Right
exit 0
;;
"rightbottomedge")
sxmo_type.sh -k Return
exit 0
;;
"leftbottomedge")
sxmo_type.sh -k BackSpace
exit 0
;;
"topleftcorner")
sxmo_appmenu.sh sys &
exit 0
;;
"toprightcorner")
sxmo_appmenu.sh scripts &
exit 0
;;
"bottomleftcorner")
# could go into suspend? leaving blank for now.
exit 0
;;
"bottomrightcorner")
if [ "$(sxmo_rotate.sh isrotated)" = "right" ]; then
sxmo_rotate.sh rotinvert
else
sxmo_rotate.sh rotright
fi
exit 0
;;
esac

View File

@@ -1,28 +0,0 @@
#!/bin/sh
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2022 Sxmo Contributors
# This hook is called when the system becomes unlocked again
# include common definitions
# shellcheck source=scripts/core/sxmo_common.sh
. sxmo_common.sh
sxmo_log "transitioning to stage unlock"
printf unlock > "$SXMO_STATE"
sxmo_wakelock.sh lock stay_awake "${SXMO_UNLOCK_IDLE_TIME:-120}s"
sxmo_hook_statusbar.sh state_change &
sxmo_wm.sh dpms off
sxmo_wm.sh inputevent touchscreen on
sxmo_wm.sh inputevent stylus on
superctl start sxmo_hook_lisgd
# suspend after if no activity after 120s
sxmo_daemons.sh start idle_locker sxmo_idle.sh -w \
timeout "1" '' \
resume "sxmo_wakelock.sh lock stay_awake \"${SXMO_UNLOCK_IDLE_TIME:-120}s\""
wait

View File

@@ -1 +0,0 @@
three_button_touchscreen

View File

@@ -1 +0,0 @@
three_button_touchscreen

View File

@@ -1 +0,0 @@
three_button_touchscreen/

View File

@@ -1 +0,0 @@
three_button_touchscreen

View File

@@ -1 +0,0 @@
one_button_e_reader

View File

@@ -1 +0,0 @@
three_button_touchscreen

View File

@@ -1 +0,0 @@
three_button_touchscreen

View File

@@ -1 +0,0 @@
three_button_touchscreen

View File

@@ -1 +0,0 @@
three_button_touchscreen

View File

@@ -1 +0,0 @@
three_button_touchscreen

View File

@@ -1 +0,0 @@
three_button_touchscreen

View File

@@ -1 +0,0 @@
three_button_touchscreen

View File

@@ -1 +0,0 @@
three_button_touchscreen

View File

@@ -1 +0,0 @@
three_button_touchscreen

View File

@@ -1 +0,0 @@
three_button_touchscreen/

View File

@@ -1 +0,0 @@
three_button_touchscreen

View File

@@ -1 +0,0 @@
three_button_touchscreen

View File

@@ -1 +0,0 @@
three_button_touchscreen

View File

@@ -1 +0,0 @@
three_button_touchscreen

View File

@@ -1 +0,0 @@
three_button_touchscreen

View File

@@ -1 +0,0 @@
three_button_touchscreen

View File

@@ -1 +0,0 @@
three_button_touchscreen

View File

@@ -1 +0,0 @@
three_button_touchscreen

View File

@@ -0,0 +1,5 @@
#!/bin/sh
# This script is executed after the last call finished
sxmo_playerctl.sh resume_all

View File

@@ -15,28 +15,40 @@ write_line_app() {
executable="$1"
label="$2"
command="$3"
inline="$4"
if command -v "$executable" >/dev/null; then
write_line "$label" "$command"
if [ "$inline" != "" ]; then
write_line "$label" "$command"
else
write_line "$label" "sxmo_wm.sh exec $command"
fi
fi
}
write_line_app gnome-2048 "$icon_gam 2048" "gnome-2048"
write_line_app jami-qt "$icon_msg Jami" "jami-qt"
write_line_app aerc "$icon_eml Aerc" "sxmo_terminal.sh aerc"
write_line_app geary "$icon_eml Geary" "geary"
write_line_app amberol "$icon_mus Amberol" "amberol $XDG_MUSIC_DIR"
write_line_app amfora "$icon_glb Amfora" "sxmo_terminal.sh amfora"
write_line_app animatch "$icon_gam Animatch" "animatch"
write_line_app harbour-amazfish-ui "$icon_wat Amazfish" "harbour-amazfish-ui"
write_line_app alpine "$icon_eml Alpine" "sxmo_terminal.sh alpine"
write_line_app anbox-launch "$icon_and Anbox" "anbox"
write_line_app anki "$icon_str Anki" "anki"
write_line_app audacity "$icon_mic Audacity" "audacity"
write_line_app badwolf "$icon_glb Badwolf" "badwolf"
write_line_app gnome-calculator "$icon_clc Calculator" "gnome-calculator"
write_line_app calcurse "$icon_clk Calcurse" "sxmo_terminal.sh calcurse"
write_line_app chatty "$icon_msg Chatty" "chatty"
write_line_app cmus "$icon_mus Cmus" "sxmo_terminal.sh cmus"
write_line_app com.github.geigi.cozy "$icon_mus Cozy" "com.github.geigi.cozy"
write_line_app dino "$icon_msg Dino" "GDK_SCALE=1 dino"
write_line_app dolphin "$icon_dir Dolphin" "dolphin"
write_line_app emacs "$icon_edt Emacs (Terminal)" "sxmo_terminal.sh emacs -nw"
write_line_app emacs "$icon_edt Emacs (X)" "emacs"
write_line_app epiphany "$icon_glb Epiphany" "epiphany"
write_line_app epy "$icon_bok Epy" "sxmo_terminal.sh epy"
write_line_app epr "$icon_bok Epr" "sxmo_terminal.sh epr"
write_line_app evince "$icon_bok Evince" "evince"
write_line_app falkon "$icon_flk Falkon" "falkon"
write_line_app firefox "$icon_ffx Firefox" "firefox"
@@ -45,13 +57,16 @@ write_line_app foliate "$icon_bok Foliate" "foliate"
( [ "$SXMO_WM" = sway ] && command -v foot >/dev/null) && \
write_line "$icon_trm Foot" "foot $SHELL"
write_line_app foxtrotgps "$icon_gps Foxtrotgps" "foxtrotgps"
write_line_app g4music "$icon_mus G4Music" "g4music"
write_line_app geany "$icon_eml Geany" "geany"
write_line_app geary "$icon_eml Geary" "geary"
write_line_app gedit "$icon_edt Gedit" "gedit"
write_line_app geeqie "$icon_img Geeqie" "geeqie"
write_line_app geopard "$icon_glb Geopard" "geopard"
write_line_app gerbil "$icon_glb Gerbil" "gerbil"
write_line_app giara "$icon_red Giara" "giara"
write_line_app gnome-chess "$icon_chs Gnome Chess" "gnome-chess"
write_line_app gnome-weather "$icon_wtr Gnome Weather" "gnome-weather"
write_line_app gomuks "$icon_msg Gomuks" "sxmo_terminal.sh gomuks"
write_line_app gpodder "$icon_rss gPodder" "gpodder"
write_line_app gucharmap "$icon_inf Gucharmap" "gucharmap"
@@ -62,17 +77,23 @@ write_line_app ii "$icon_msg Ii" "sxmo_terminal.sh ii"
write_line_app ipython "$icon_trm IPython" "sxmo_terminal.sh ipython"
write_line_app kasts "$icon_rss Kasts" "kasts"
write_line_app kmail "$icon_eml KMail" "kmail"
write_line_app komikku "$icon_bok Komikku" "komikku"
write_line_app kontact "$icon_msg Kontact" "kontact"
write_line_app konversation "$icon_msg Konversation" "konversation"
write_line_app koreader "$icon_bok KOReader" "koreader"
write_line_app kwrite "$icon_edt Kwrite" "kwrite"
write_line_app lagrange "$icon_glb Lagrange" "lagrange"
write_line_app lemoa "$icon_grp Lemoa" "lemoa"
write_line_app lf "$icon_dir Lf" "sxmo_terminal.sh lf"
write_line_app librewolf "$icon_glb Librewolf" "librewolf"
write_line_app lollypop "$icon_mus Lollypop" "lollypop"
write_line_app luakit "$icon_glb Luakit" "luakit"
write_line_app marble "$icon_map Marble" "marble"
write_line_app gnome-maps "$icon_map Maps" "gnome-maps"
write_line_app micro "$icon_edt Micro" "sxmo_terminal.sh micro"
write_line_app midori "$icon_glb Midori" "midori"
write_line_app mutt "$icon_eml Mutt" "sxmo_terminal.sh mutt"
write_line_app mumble "$icon_grp Mumble" mumble
write_line_app nano "$icon_edt Nano" "sxmo_terminal.sh nano"
write_line_app navit "$icon_gps Navit" "navit"
write_line_app ncmpcpp "$icon_mus Ncmpcpp" "sxmo_terminal.sh ncmpcpp"
@@ -83,11 +104,15 @@ write_line_app netsurf "$icon_glb Netsurf" "netsurf"
write_line_app newsboat "$icon_rss Newsboat" "sxmo_terminal.sh newsboat"
write_line_app com.gitlab.newsflash "$icon_rss Newsflash" com.gitlab.newsflash
write_line_app nnn "$icon_dir Nnn" "sxmo_terminal.sh nnn"
write_line_app io.github.lainsce.Notejot "$icon_drw Notejot" io.github.lainsce.Notejot
write_line_app numberstation "$icon_clc Numberstation" "numberstation"
write_line_app osmin "$icon_map Osmin" "osmin"
write_line_app pidgin "$icon_msg Pidgin" "pidgin"
write_line_app pulsemixer "$icon_mus Pulsemixer" "sxmo_terminal.sh pulsemixer"
write_line_app pure-maps "$icon_map Pure-Maps" "pure-maps"
write_line_app mepo "$icon_map mepo" "mepo"
write_line_app podboat "$icon_rss Podboat" "sxmo_terminal.sh podboat"
write_line_app dev.tchx84.Portfolio "$icon_dir Portfolio" "dev.tchx84.Portfolio"
write_line_app profanity "$icon_msg Profanity" "sxmo_terminal.sh profanity"
write_line_app qutebrowser "$icon_glb Qutebrowser" "qutebrowser"
write_line_app ranger "$icon_dir Ranger" "sxmo_terminal.sh ranger"
@@ -99,16 +124,20 @@ write_line_app sic "$icon_msg Sic" "sxmo_terminal.sh sic"
write_line "$icon_trm St" "st -e $SHELL"
write_line_app surf "$icon_glb Surf" "surf"
write_line_app syncthing "$icon_rld Syncthing" "syncthing"
write_line_app syncthing-gtk "$icon_rld Syncthing GTK" "syncthing-gtk"
write_line_app telegram-desktop "$icon_tgm Telegram" "telegram-desktop"
write_line_app termite "$icon_trm Termite" "termite -e $SHELL"
write_line_app thunar "$icon_dir Thunar" "sxmo_terminal.sh thunar"
write_line_app thunderbird "$icon_eml Thunderbird" "thunderbird"
write_line_app com.github.bleakgrey.tootle "$icon_msg Tootle" "com.github.bleakgrey.tootle"
write_line_app re.sonny.Tangram "$icon_glb Tangram" "re.sonny.Tangram"
write_line_app totem "$icon_mvi Totem" "totem"
write_line_app dev.geopjr.Tuba "$icon_msg Tuba" "dev.geopjr.Tuba"
write_line_app tuir "$icon_red Tuir" "sxmo_terminal.sh tuir"
write_line_app tut "$icon_msg Tut" "sxmo_terminal.sh tut"
write_line_app waydroid "$icon_and Waydroid" "waydroid show-full-ui"
write_line_app weechat "$icon_msg Weechat" "sxmo_terminal.sh weechat"
write_line_app wike "$icon_bok Wike" "wike"
write_line_app pavucontrol "$icon_mus Pavucontrol" "pavucontrol"
write_line_app w3m "$icon_glb W3m" "sxmo_terminal.sh w3m duck.com"
write_line_app vim "$icon_vim Vim" "sxmo_terminal.sh vim"
@@ -122,4 +151,4 @@ write_line_app vte-2.91-gtk4 "$icon_trm VTE 3 (GTK-4)" "vte-2.91-gtk4"
write_line_app xournal "$icon_bok Xournal" "xournal"
write_line_app xournalpp "$icon_bok Xournalpp" "xournalpp"
write_line_app zathura "$icon_bok Zathura" "zathura"
write_line_app j4-dmenu-desktop "$icon_grd All apps" "j4-dmenu-desktop --dmenu=sxmo_dmenu.sh --term=sxmo_terminal.sh"
write_line_app j4-dmenu-desktop "$icon_grd All apps" "j4-dmenu-desktop --dmenu=sxmo_dmenu.sh --term=sxmo_terminal.sh --wrapper='sxmo_wm.sh exec'" "inline"

View File

@@ -0,0 +1,41 @@
#!/bin/sh
load_data() {
data="$(upower -i "$1" | grep . | sed -e 's|^ \+||' -e 's|: \+|:|')"
type="$(printf "%b" "$data" | grep -m1 -v : | sed -e 's|^ \+||')"
}
data_get() {
printf "%b" "$data" | grep "^$1:" | cut -d: -f2
}
device_changed() {
name="$(data_get "native-path")"
state="$(data_get "state")"
percentage="$(data_get "percentage" | cut -d% -f1)"
if [ -z "$name" ] || [ -z "$state" ]; then
return
fi
if [ "$state" = unknown ]; then
return
fi
sxmo_hook_statusbar.sh battery "$name" "$state" "$percentage"
}
object="$1"
event="$2"
load_data "$object"
if [ "$type" != "battery" ]; then
exit
fi
case "$event" in
"device changed")
device_changed "$object"
;;
esac

View File

@@ -30,6 +30,7 @@ delay() {
wait_item() {
delay_time=1
while $1 > /dev/null 2>&1; do
sxmo_log "Blocking suspend for $1"
waited=1
${2:-delay}
done
@@ -47,6 +48,10 @@ in_call() {
pgrep -f sxmo_modemcall.sh
}
in_call_dino() {
command -v pw-link && [ -n "$(pw-link -o Dino)" ]
}
hotspot_active() {
nmcli -t c show --active | grep -q ^Hotspot
}
@@ -82,6 +87,7 @@ while [ "$waited" != "0" ]; do
waited=0
wait_item suspend_disabled
wait_item in_call
wait_item in_call_dino
wait_item hotspot_active
wait_item ssh_connected
wait_item active_mosh

View File

@@ -21,6 +21,7 @@ if [ "$1" = "enable" ]; then
# Add other things here, e.g., volume boosters
sxmo_modemaudio.sh is_disabled_speaker && sxmo_modemaudio.sh is_unmuted_mic
# Phonecall ended
elif [ "$1" = "disable" ]; then
sxmo_log "Attempting hack to get things just right."
@@ -30,4 +31,5 @@ elif [ "$1" = "disable" ]; then
# Add other things here, e.g., volume boosters
sxmo_modemaudio.sh is_enabled_speaker
fi

View File

@@ -19,7 +19,7 @@ superd_service_isrunning() {
}
sxmo_service_isrunning() {
sxmo_daemons.sh running "$1" > /dev/null
sxmo_jobs.sh running "$1" > /dev/null
}
if [ -z "$XPROPOUT" ]; then
@@ -74,7 +74,7 @@ case "$WMCLASS" in
$icon_cfg Gestures $(
superd_service_isrunning "sxmo_hook_lisgd" &&
printf "%s" "$icon_ton" || printf "%s" "$icon_tof"
) ^ 1 ^ supertoggle_daemon 'sxmo_hook_lisgd'
) ^ 1 ^ supertoggle_daemon 'sxmo_hook_lisgd' && (rm $XDG_CACHE_HOME/sxmo/sxmo.nogesture 2>/dev/null || touch $XDG_CACHE_HOME/sxmo/sxmo.nogesture)
$icon_cfg Toggle Bar ^ 0 ^ sxmo_wm.sh togglebar
$icon_bth Bluetooth $(
rfkill list bluetooth | grep -q "yes" &&
@@ -85,21 +85,25 @@ case "$WMCLASS" in
$icon_clk Change Timezone ^ 1 ^ sxmo_timezonechange.sh
$icon_zzz Auto-suspend $(
[ -e "$XDG_CACHE_HOME"/sxmo/sxmo.nosuspend ] && printf "%s" "$icon_tof" || printf "%s" "$icon_ton"
) ^ 1 ^ (rm $XDG_CACHE_HOME/sxmo/sxmo.nosuspend || touch $XDG_CACHE_HOME/sxmo/sxmo.nosuspend)
) ^ 1 ^ (rm $XDG_CACHE_HOME/sxmo/sxmo.nosuspend 2>/dev/null || touch $XDG_CACHE_HOME/sxmo/sxmo.nosuspend)
$icon_zzz Auto-screen-off $(
[ -e "$XDG_CACHE_HOME/sxmo/sxmo.noidle" ] && printf "%s" "$icon_tof" || printf "%s" "$icon_ton"
) ^ 1 ^ (rm $XDG_CACHE_HOME/sxmo/sxmo.noidle || touch $XDG_CACHE_HOME/sxmo/sxmo.noidle) && sxmo_hook_unlock.sh
) ^ 1 ^ (rm $XDG_CACHE_HOME/sxmo/sxmo.noidle 2>/dev/null || touch $XDG_CACHE_HOME/sxmo/sxmo.noidle) && sxmo_state.sh set unlock
$icon_ror Autorotate $(
sxmo_daemons.sh running autorotate -q &&
sxmo_jobs.sh running autorotate -q &&
printf "%s" "$icon_ton" || printf "%s" "$icon_tof"
) ^ 1 ^ toggle_daemon 'Autorotate' autorotate sxmo_autorotate.sh
$([ -n "$SXMO_KEYBOARD_SLIDER_EVENT_DEVICE" ] && echo "$icon_ror Autorotate on Keyboard Open/Close $(
sxmo_jobs.sh running kb_autorotate -q &&
printf "%s" "$icon_ton" || printf "%s" "$icon_tof"
) ^ 1 ^ toggle_daemon 'Keyboard Autorotate' kb_autorotate sxmo_keyboard_autorotate.sh")
$icon_ror Rotate ^ 1 ^ sxmo_rotate.sh rotate
$icon_trm Hooks ^ 0 ^ sxmo_hookmenu.sh
$icon_upc Upgrade Pkgs ^ 0 ^ sxmo_terminal.sh sxmo_upgrade.sh
$icon_sfl Migrate configuration ^ 0 ^ sxmo_terminal.sh sxmo_migrate.sh
$icon_cfg Edit configuration ^ 0 ^ sxmo_terminal.sh $EDITOR $XDG_CONFIG_HOME/sxmo/$(test "$SXMO_WM" = sway && printf sway || printf xinit)
$(command -v pmos-tweaks >/dev/null && echo "$icon_cfg PostmarketOS Tweaks ^ 0 ^ GDK_SCALE=1 pmos-tweaks")
$icon_cfg Suspend Blockers ^ 0 ^ sxmo_terminal.sh sxmo_wakelock.sh debug watch
$icon_cfg Suspend Blockers ^ 0 ^ sxmo_terminal.sh sxmo_debug_suspend.sh
$icon_inf Version ^ 0 ^ sxmo_terminal.sh sxmo_version.sh --block
"
WINNAME=Config
@@ -107,8 +111,8 @@ case "$WMCLASS" in
power)
# Power menu
CHOICES="
$icon_lck Lock ^ 0 ^ sxmo_hook_lock.sh
$icon_lck Lock (Screen off) ^ 0 ^ sxmo_hook_screenoff.sh
$icon_lck Lock ^ 0 ^ sxmo_state.sh set lock
$icon_lck Lock (Screen off) ^ 0 ^ sxmo_state.sh set screenoff
$icon_out Logout ^ 0 ^ confirm Logout && sxmo_power.sh logout
$([ -f "$(xdg_data_path xsessions/sxmo.desktop)" ] &&
[ -f "$(xdg_data_path wayland-sessions/swmo.desktop)" ] &&
@@ -136,6 +140,14 @@ case "$WMCLASS" in
"
WINNAME=Mpv
;;
io.bassi.amberol)
CHOICES="
$icon_pau Play/Pause ^ 0 ^ playerctl play-pause
$icon_prv Previous Track ^ 1 ^ playerctl previous
$icon_nxt Next Track ^ 1 ^ playerctl next
"
WINNAME=Amberol
;;
*feh*)
# Feh
CHOICES="
@@ -598,6 +610,7 @@ case "$WMCLASS" in
*geopard*)
# Geopard
CHOICES="
$icon_flt Pipe URL ^ 0 ^ sxmo_urlhandler.sh
$icon_pls New Tab ^ 0 ^ sxmo_type -M Ctrl t
$icon_cls Close Tab ^ 0 ^ sxmo_type -M Ctrl w
$icon_bok Open Bookmarks ^ 0 ^ sxmo_type -M Ctrl b
@@ -627,6 +640,19 @@ case "$WMCLASS" in
"
WINNAME=Lagrange
;;
org.gnome.maps)
CHOICES="
$icon_gps Toggle Geoclue ^ 0 ^ superctl status geoclue-agent |grep started >/dev/null && superctl stop geoclue-agent || superctl start geoclue-agent
$icon_zmi Zoom in ^ 1 ^ sxmo_type -M ctrl =
$icon_zmo Zoom out ^ 1 ^ sxmo_type -M ctrl -k minus
$icon_fnd Explore POI ^ 0 ^ sxmo_type -M ctrl -M Shift F
$icon_fnd Search ^ 0 ^ sxmo_type -M ctrl f && sxmo_keyboard.sh open
$icon_lst Show last results ^ 0 ^ sxmo_type -M ctrl r
$icon_map Toggle route planner ^ 0 ^ sxmo_type -M ctrl d
$icon_gps Show current location ^ 0 ^ sxmo_type -M ctrl l
"
WINNAME=Maps
;;
*mepo*)
# Mepo
# The choices / hotkeys for the contextmenu are generated through mepo's
@@ -671,6 +697,7 @@ case "$WMCLASS" in
$icon_net Networks ^ 0 ^ sxmo_networks.sh
$icon_mus Audio ^ 0 ^ sxmo_audio.sh
$icon_phn Modem ^ 0 ^ sxmo_appmenu.sh modem
$icon_win Windows ^ 0 ^ sxmo_wmmenu.sh
$icon_cfg Config ^ 0 ^ sxmo_appmenu.sh config
$icon_pwr Power ^ 0 ^ sxmo_appmenu.sh power
"

View File

@@ -7,10 +7,6 @@
# up the call).
# kill existing ring playback
if [ -e "$XDG_RUNTIME_DIR/sxmo.ring.pid" ]; then
MPVID="$(cat "$XDG_RUNTIME_DIR/sxmo.ring.pid")"
kill "$MPVID"
rm "$XDG_RUNTIME_DIR/sxmo.ring.pid"
fi
sxmo_jobs.sh stop ringing
sxmo_playerctl.sh resume_all

View File

@@ -1,5 +1,3 @@
#!/bin/sh
# This script is executed (asynchronously) when you hangup an incoming call
sxmo_playerctl.sh resume_all

View File

@@ -57,7 +57,7 @@ icon_fil="" #file
icon_flk="" #falkon
icon_fll="󰉄" #flashlight
icon_flt="" #filter/pipe
icon_fnd="" #search/find
icon_fnd="󰍉" #search/find
icon_gam="󰊴" # gaming controller (🎮)
icon_glb="" #globe
icon_gps='' #gps
@@ -65,6 +65,7 @@ icon_grd="󰀻"
icon_grp="" #group
icon_hdp="" #headphones
icon_hom=""
icon_hst="󰋎" #headset🗣
icon_img="󰏜"
icon_inf="" #info
icon_itm="" #item (default)
@@ -135,8 +136,8 @@ icon_wn2=""
icon_wrh=""
icon_wtr="" #weather
icon_ytb="" #youtube
icon_zmi=""
icon_zmo=""
icon_zmi="󰛭" # Zoom in/magnify
icon_zmo="󰛬" # Zoom out/demagnify
icon_zzz="" #sleep/suspend/crust
# modem states

View File

@@ -12,30 +12,7 @@ ACTION="$1"
. sxmo_common.sh
stop_proximity_lock() {
sxmo_daemons.sh stop proximity_lock
}
# this action will move the lock state $1 levels higher
lock_screen_action() {
count="${1:-1}"
state="$(cat "$SXMO_STATE")"
while [ "$count" -gt 0 ]; do
case "$state" in
unlock)
state=screenoff
;;
screenoff)
state=lock
;;
lock)
state=unlock
;;
esac
count=$((count-1))
done
sxmo_hook_"$state".sh
sxmo_jobs.sh stop proximity_lock
}
XPROPOUT="$(sxmo_wm.sh focusedwindow)"
@@ -45,19 +22,29 @@ WMNAME="$(printf %s "$XPROPOUT" | grep title: | cut -d" " -f2- | tr '[:upper:]'
sxmo_debug "STATE: $(cat "$SXMO_STATE") ACTION: $ACTION WMCLASS: $WMCLASS WMNAME: $WMNAME"
if ! grep -q unlock "$SXMO_STATE"; then
case "$WMNAME" in # Handle programs
*"epy"*|*"epr"*)
case "$ACTION" in
"voldown_one")
sxmo_type.sh l
exit 0
;;
"volup_one")
sxmo_type.sh h
exit 0
;;
esac
;;
esac
case "$ACTION" in
"powerbutton_one")
lock_screen_action
sxmo_state.sh click
;;
"powerbutton_two")
lock_screen_action 2
sxmo_state.sh click 2
;;
"powerbutton_three")
if grep -q proximity "$SXMO_STATE"; then
stop_proximity_lock
else
lock_screen_action 2
fi
sxmo_state.sh click 2
;;
"voldown_one")
sxmo_audio.sh vol down 5
@@ -110,9 +97,75 @@ case "$WMCLASS" in
;;
esac
;;
*"foot"*|*"st"*|*"vte"*|"terminal")
# First we try to handle the app running inside st:
case "$WMNAME" in
*"foot"*|*"st"*|*"vte"*|"terminal") # Terminals
case "$WMCLASS" in # Handle programs without touch support
*"st"*)
case "$WMNAME" in
*"weechat"*|*'gomuks'*)
case "$ACTION" in
*"onedown")
sxmo_type.sh -k Page_Up
exit 0
;;
*"oneup")
sxmo_type.sh -k Page_Down
exit 0
;;
esac
;;
*"less"*|*"amfora"*)
case "$ACTION" in
*"onedown")
sxmo_type.sh u
exit 0
;;
*"oneup")
sxmo_type.sh d
exit 0
;;
esac
;;
*'irssi'*)
case "$ACTION" in
"onedown")
sxmo_type.sh -M Alt p
exit 0
;;
"oneup")
sxmo_type.sh -M Alt n
exit 0
;;
esac
;;
*'epy'*|*'epr'*)
case "$ACTION" in
"onedown")
sxmo_type.sh h
exit 0
;;
"oneup")
sxmo_type.sh l
exit 0
;;
esac
;;
*'nnn'*|'lf')
case "$ACTION" in
"onedown")
sxmo_type.sh -k Down
exit 0
;;
"oneup")
sxmo_type.sh -k Up
exit 0
;;
esac
;;
esac
;;
esac
case "$WMNAME" in # Handle programs
*"weechat"*)
case "$ACTION" in
*"oneleft")
@@ -123,14 +176,6 @@ case "$WMCLASS" in
sxmo_type.sh -M Alt -k less
exit 0
;;
*"oneup")
sxmo_type.sh -k Page_Down
exit 0
;;
*"onedown")
sxmo_type.sh -k Page_Up
exit 0
;;
esac
;;
*" sms")
@@ -161,14 +206,6 @@ case "$WMCLASS" in
sxmo_type.sh q
exit 0
;;
*"onedown")
sxmo_type.sh u
exit 0
;;
*"oneup")
sxmo_type.sh d
exit 0
;;
*"oneleft")
sxmo_type.sh ":n" -k Return
exit 0
@@ -189,14 +226,6 @@ case "$WMCLASS" in
sxmo_type.sh -M Shift -k Tab
exit 0
;;
*"onedown")
sxmo_type.sh u
exit 0
;;
*"oneup")
sxmo_type.sh d
exit 0
;;
*"oneright")
sxmo_type.sh -k Return
exit 0
@@ -215,76 +244,59 @@ case "$WMCLASS" in
;;
esac
;;
*'irssi'*)
*"epy"*|*"epr"*)
case "$ACTION" in
"onedown")
sxmo_type.sh -M Alt p
*"left"|"voldown_one")
sxmo_type.sh l
exit 0
;;
"oneup")
sxmo_type.sh -M Alt n
*"right"|"volup_one")
sxmo_type.sh h
exit 0
;;
"voldown_three"|"twodownbottomedge")
sxmo_type.sh q
exit
;;
esac
;;
*'gomuks'*)
*'nnn'*|'lf')
case "$ACTION" in
*"oneup")
sxmo_type.sh -k Page_Down
*"left")
sxmo_type.sh -k Right
exit 0
;;
*"onedown")
sxmo_type.sh -k Page_Up
*"right")
sxmo_type.sh -k Left
exit 0
;;
esac
;;
esac
# Now we try generic actions for terminal
case "$ACTION" in
*"onedown")
case "$WMCLASS" in
*"foot"*)
sxmo_type.sh -M Shift -k Page_Up
exit 0
;;
*"st"*)
case "$WMCLASS" in # Handle general scrolling without touch support
*"st"*)
case "$ACTION" in
*"onedown")
sxmo_type.sh -M Ctrl -M Shift -k b
exit 0
;;
esac
;;
*"oneup")
case "$WMCLASS" in
*"foot"*)
sxmo_type.sh -M Shift -k Page_Down
exit 0
;;
*"st"*)
*"oneup")
sxmo_type.sh -M Ctrl -M Shift -k f
exit 0
;;
esac
;;
"uprightedge")
case "$WMCLASS" in
"org.gnome.vte.application"|"terminal")
# For VTE, fallback to doing nothing,
# you're probably dragging the scrollbar
exit 0
;;
esac
;;
"downrightedge")
case "$WMCLASS" in
"org.gnome.vte.application"|"terminal")
# For VTE, fallback to doing nothing,
# you're probably dragging the scrollbar
exit 0
;;
"org.gnome.vte.application"|"terminal")
case "$ACTION" in
# For VTE, fallback to doing nothing,
# you're probably dragging the scrollbar
*"uprightedge") exit 0 ;;
*"downrightedge") exit 0 ;;
esac
;;
esac
;;
esac
#standard handling
@@ -293,20 +305,16 @@ case "$ACTION" in
if echo "$WMCLASS" | grep -i "megapixels"; then
sxmo_type.sh -k space
else
lock_screen_action
sxmo_state.sh click
fi
exit 0
;;
"powerbutton_two")
lock_screen_action 2
sxmo_state.sh click 2
exit 0
;;
"powerbutton_three")
if grep -q proximity "$SXMO_STATE"; then
stop_proximity_lock
else
sxmo_terminal.sh
fi
sxmo_terminal.sh
exit 0
;;
"voldown_one")
@@ -427,14 +435,12 @@ case "$ACTION" in
exit 0
;;
"bottomleftcorner")
if grep -q proximity "$SXMO_STATE"; then
exit
fi
sxmo_dmenu.sh close
sxmo_keyboard.sh close
if [ -n "$WMCLASS" ]; then
sxmo_hook_lock.sh
sxmo_state.sh set lock
else
sxmo_hook_screenoff.sh
sxmo_state.sh set screenoff
fi
exit 0
;;

View File

@@ -8,7 +8,7 @@
LISGD_THRESHOLD="${SXMO_LISGD_THRESHOLD:-125}"
LISGD_THRESHOLD_PRESSED="${SXMO_LISGD_THRESHOLD_PRESSED:-60}"
LISGD_INPUT_DEVICE="${SXMO_LISGD_INPUT_DEVICE:-"/dev/input/touchscreen"}"
LISGD_INPUT_DEVICE="${SXMO_LISGD_INPUT_DEVICE:-"/dev/input/by-path/first-touchscreen"}"
if [ dwm = "$SXMO_WM" ]; then
case "$(xrandr | grep primary | cut -d' ' -f 5)" in
@@ -23,7 +23,7 @@ fi
# fingers,swipe,edge,distance,command
#order matters, only the first match gets executed
lisgd "$@" -d "$LISGD_INPUT_DEVICE" ${orientation:+-o $orientation} \
-t "$LISGD_THRESHOLD" -T "$LISGD_THRESHOLD_PRESSED" \
-s "${LISGD_EDGE_SIZE:-1.0}" -t "$LISGD_THRESHOLD" -T "$LISGD_THRESHOLD_PRESSED" \
-g "1,DRUL,BR,*,setsid -f sxmo_hook_inputhandler.sh bottomrightcorner" \
-g "1,DLUR,BL,*,setsid -f sxmo_hook_inputhandler.sh bottomleftcorner" \
-g "1,ULDR,TL,*,setsid -f sxmo_hook_inputhandler.sh topleftcorner" \

View File

@@ -14,30 +14,23 @@
# shellcheck source=scripts/core/sxmo_common.sh
. sxmo_common.sh
exec 3<> "$SXMO_STATE.lock"
flock -x 3
sxmo_log "transitioning to stage lock"
printf lock > "$SXMO_STATE"
sxmo_wakelock.sh lock not_screenoff infinite
# This hook is called when the system reaches a locked state
sxmo_led.sh blink blue &
sxmo_hook_statusbar.sh state_change &
[ "$SXMO_WM" = "sway" ] && swaymsg mode default
sxmo_wm.sh dpms off
sxmo_wm.sh inputevent touchscreen off
sxmo_daemons.sh stop periodic_blink
sxmo_daemons.sh stop periodic_wakelock_check
sxmo_jobs.sh stop periodic_blink
sxmo_jobs.sh stop periodic_wakelock_check
# Go to screenoff after 8 seconds of inactivity
if ! [ -e "$XDG_CACHE_HOME/sxmo/sxmo.noidle" ]; then
sxmo_daemons.sh start idle_locker sxmo_idle.sh -w \
timeout "${SXMO_LOCK_IDLE_TIME:-8}" "sxmo_hook_screenoff.sh"
# Go down after 8 seconds of inactivity
if [ -e "$XDG_CACHE_HOME/sxmo/sxmo.noidle" ]; then
sxmo_jobs.sh stop idle_locker
else
sxmo_jobs.sh start idle_locker sxmo_idle.sh -w \
timeout "${SXMO_LOCK_IDLE_TIME:-8}" "sxmo_state.sh idle"
fi
wait

View File

@@ -2,7 +2,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2022 Sxmo Contributors
sxmo_daemons.sh start idle_locker sxmo_idle.sh -w \
sxmo_jobs.sh start idle_locker sxmo_idle.sh -w \
timeout 10 'sxmo_wm.sh dpms on' \
resume 'sxmo_wm.sh dpms off'
@@ -15,4 +15,5 @@ case "$SXMO_WM" in
;;
esac
sxmo_hook_unlock.sh
# need & cause we are still holding flock
sxmo_state.sh set unlock &

View File

@@ -9,10 +9,4 @@
# $1 = Contact Name or Number (if not in contacts)
# kill existing ring playback
if [ -e "$XDG_RUNTIME_DIR/sxmo.ring.pid" ]; then
MPVID="$(cat "$XDG_RUNTIME_DIR/sxmo.ring.pid")"
kill "$MPVID"
rm "$XDG_RUNTIME_DIR/sxmo.ring.pid"
fi
sxmo_playerctl.sh resume_all
sxmo_jobs.sh stop ringing

View File

@@ -24,7 +24,6 @@ case "$newstate" in
"enabling")
sxmo_log "State is enabling. Clearing stale call files."
rm "$XDG_RUNTIME_DIR"/sxmo_calls/* 2>/dev/null
rm -f "$XDG_RUNTIME_DIR"/sxmo.ring.pid 2>/dev/null
rm -f "$SXMO_NOTIFDIR"/incomingcall* 2>/dev/null
;;
"registered")

View File

@@ -6,8 +6,6 @@
# incoming call, i.e., ignore the call ringing in.
# kill existing ring playback
if [ -e "$XDG_RUNTIME_DIR/sxmo.ring.pid" ]; then
MPVID="$(cat "$XDG_RUNTIME_DIR/sxmo.ring.pid")"
kill "$MPVID"
rm "$XDG_RUNTIME_DIR/sxmo.ring.pid"
fi
sxmo_jobs.sh stop ringing
sxmo_playerctl.sh resume_all

View File

@@ -8,9 +8,9 @@
#if [ ! -f "$XDG_CONFIG_HOME"/sxmo/.novibrate ]; then
# VIBS=5
# VIBI=0
# while [ $VIBI -lt $VIBS ]; do
# sxmo_vibrate 400 &
# while [ "$VIBI" -lt "$VIBS" ]; do
# sxmo_vibrate 400 "${SXMO_VIBRATE_STRENGTH:-1}" &
# sleep 0.5
# VIBI=$(echo $VIBI+1 | bc)
# VIBI="$(echo "$VIBI+1" | bc)"
# done
#fi

View File

@@ -5,10 +5,4 @@
# This script is executed (asynchronously) when you pick up an incoming call
# kill existing ring playback
if [ -e "$XDG_RUNTIME_DIR/sxmo.ring.pid" ]; then
xargs -r kill < "$XDG_RUNTIME_DIR/sxmo.ring.pid"
rm "$XDG_RUNTIME_DIR/sxmo.ring.pid"
fi
sxmo_playerctl.sh pause_all
sxmo_jobs.sh stop ringing

View File

@@ -6,6 +6,12 @@
# shellcheck source=scripts/core/sxmo_common.sh
. sxmo_common.sh
sxmo_wakelock.sh lock stay_awake "${SXMO_UNLOCK_IDLE_TIME:-120}s"
if [ -z "$SXMO_NO_MODEM" ]; then
MMCLI="$(mmcli -m any -J 2>/dev/null)"
if [ -z "$MMCLI" ]; then
sxmo_notify_user.sh "Modem crashed! 30s recovery."
sxmo_wakelock.sh lock sxmo_modem_crashed 30s
fi
fi
# Add here whatever you want to do

View File

@@ -0,0 +1,8 @@
#!/bin/sh
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2022 Sxmo Contributors
# This script is executed before reboot and poweroff the system
#
# The following parameters are provided:
# $1 = Action (poweroff or reboot)

View File

@@ -100,4 +100,4 @@ if ! daemon_isrunning modemmanager; then
exit 1
fi
# we want 120s before sleeping again
sxmo_wakelock.sh lock modem_manually_reset 120s
sxmo_wakelock.sh lock sxmo_modem_manually_reset 120s

View File

@@ -14,7 +14,7 @@
if sxmo_modemcall.sh list_active_calls \
| grep -v ringing-in \
| grep -q .; then
sxmo_vibrate 1500
sxmo_vibrate 1500 "${SXMO_VIBRATE_STRENGTH:-1}"
exit
fi
@@ -25,6 +25,28 @@ if ! sxmo_modemcall.sh list_active_calls \
exit
fi
finish() {
trap - INT TERM EXIT
jobs -p | xargs -r kill
exit
}
ring() {
mpv --no-resume-playback --quiet --no-video \
--loop="${SXMO_RINGNUMBER:-10}" "$SXMO_RINGTONE" >/dev/null &
}
vibrate() {
while : ; do
trap 'finish' INT TERM EXIT
sxmo_vibrate 1500 "${SXMO_VIBRATE_STRENGTH:-1}" &
wait "$!"
sleep 0.5 &
wait "$!"
done &
}
# RING & VIBRATE MODE (DEFAULT)
if [ ! -f "$XDG_CONFIG_HOME"/sxmo/.noring ] && [ ! -f "$XDG_CONFIG_HOME"/sxmo/.novibrate ]; then
sxmo_log "RING AND VIBRATE"
@@ -33,15 +55,8 @@ if [ ! -f "$XDG_CONFIG_HOME"/sxmo/.noring ] && [ ! -f "$XDG_CONFIG_HOME"/sxmo/.n
# In order for this to work with mpv, you will need to install mpv-mdis.
sxmo_playerctl.sh pause_all
timeout "$SXMO_RINGTIME" mpv --no-resume-playback --quiet --no-video \
--loop="$SXMO_RINGNUMBER" "$SXMO_RINGTONE" >/dev/null &
MPVID=$!
echo "$MPVID" > "$XDG_RUNTIME_DIR/sxmo.ring.pid"
# vibrate while mpv is running
while kill -0 $MPVID; do
sxmo_vibrate 1500
sleep 0.5
done
ring
vibrate
# RING-ONLY MODE
elif [ ! -f "$XDG_CONFIG_HOME"/sxmo/.noring ] && [ -f "$XDG_CONFIG_HOME"/sxmo/.novibrate ]; then
@@ -51,16 +66,15 @@ elif [ ! -f "$XDG_CONFIG_HOME"/sxmo/.noring ] && [ -f "$XDG_CONFIG_HOME"/sxmo/.n
# In order for this to work with mpv, you will need to install mpv-mdis.
sxmo_playerctl.sh pause_all
timeout "$SXMO_RINGTIME" mpv --no-resume-playback --quiet --no-video \
--loop="$SXMO_RINGNUMBER" "$SXMO_RINGTONE" >/dev/null &
echo "$!" > "$XDG_RUNTIME_DIR/sxmo.ring.pid"
ring
# VIBRATE-ONLY MODE
elif [ ! -f "$XDG_CONFIG_HOME"/sxmo/.novibrate ] && [ -f "$XDG_CONFIG_HOME"/sxmo/.noring ]; then
smxo_log "VIBRATE ONLY"
for _ in $(seq 5); do
sxmo_vibrate 1500
sleep 0.5
done &
echo "$!" > "$XDG_RUNTIME_DIR/sxmo.ring.pid"
vibrate
fi
trap 'finish' INT TERM EXIT
sleep "${SXMO_RINGTIME:-20}" &
wait "$!"

View File

@@ -8,4 +8,4 @@
# The following parameters are provided:
# $1 = the new orientation
# possible values are "normal", "left" and "right"
# possible values are "normal", "invert", "left" and "right"

View File

@@ -16,30 +16,24 @@
# This hook is called when the system reaches a off state (screen off)
exec 3<> "$SXMO_STATE.lock"
flock -x 3
sxmo_log "transitioning to stage off"
printf screenoff > "$SXMO_STATE"
sxmo_hook_statusbar.sh state_change &
sxmo_led.sh blink red blue &
[ "$SXMO_WM" = "sway" ] && swaymsg mode default
sxmo_wm.sh dpms on
sxmo_wm.sh inputevent touchscreen off
sxmo_daemons.sh start periodic_blink sxmo_run_periodically.sh 2 sxmo_led.sh blink red blue
sxmo_jobs.sh start periodic_blink sxmo_run_periodically.sh - 2 sxmo_led.sh blink red blue
case "$SXMO_WM" in
dwm)
# dmenu will grab input focus (i.e. power button) so kill it before going to
# screenoff unless proximity lock is running (i.e. there's a phone call).
if ! sxmo_daemons.sh running proximity_lock -q; then
if ! sxmo_jobs.sh running proximity_lock -q; then
sxmo_dmenu.sh close
fi
;;
esac
wait
sxmo_jobs.sh stop idle_locker
sxmo_wakelock.sh lock hold_a_bit 3s # avoid immediate suspension
sxmo_wakelock.sh unlock not_screenoff
wait

View File

@@ -20,11 +20,13 @@
if ! sxmo_modemcall.sh list_active_calls | grep -q active; then
if [ ! -f "$XDG_CONFIG_HOME"/sxmo/.noring ]; then
mpv --no-resume-playback --quiet --no-video "$SXMO_TEXTSOUND" >> /dev/null 2>&1
mpv --no-resume-playback --quiet --no-video "$SXMO_TEXTSOUND" >> /dev/null 2>&1 &
fi
if [ ! -f "$XDG_CONFIG_HOME"/sxmo/.novibrate ]; then
sxmo_vibrate 500
sxmo_vibrate 500 "${SXMO_VIBRATE_STRENGTH:-1}" &
fi
wait
fi

View File

@@ -3,7 +3,7 @@
# Copyright 2022 Sxmo Contributors
# Allow user to override what we log in the sms.txt file. Note if you change
# this you probably should change sxmo_hook_parselog.sh
# this you probably should change sxmo_hook_tailtextlog.sh
# include common definitions
# shellcheck source=scripts/core/sxmo_common.sh

View File

@@ -9,26 +9,38 @@
# Create xdg user directories, such as ~/Pictures
xdg-user-dirs-update
sxmo_daemons.sh start daemon_manager superd -v
sxmo_jobs.sh start daemon_manager superd
# let time to superd to start correctly
while ! superctl status > /dev/null 2>&1; do
sleep 0.5
done
# Not dangerous if "locker" isn't an available state
sxmo_state.sh set locker
if [ -n "$SXMO_ROTATE_START" ]; then
sxmo_rotate.sh
fi
# Load our sound daemons
if [ "$(command -v pulseaudio)" ]; then
superctl start pulseaudio
elif [ "$(command -v pipewire)" ]; then
# pipewire-pulse will start pipewire
superctl start pipewire-pulse
superctl start wireplumber
if [ -z "$SXMO_NO_AUDIO" ]; then
if [ "$(command -v pulseaudio)" ]; then
superctl start pulseaudio
elif [ "$(command -v pipewire)" ]; then
# pipewire-pulse will start pipewire
superctl start pipewire-pulse
superctl start wireplumber
fi
# monitor for headphone for statusbar
superctl start sxmo_soundmonitor
fi
# Periodically update some status bar components
sxmo_hook_statusbar.sh all
sxmo_daemons.sh start statusbar_periodics sxmo_run_aligned.sh 60 \
sxmo_jobs.sh start statusbar_periodics sxmo_run_aligned.sh 60 \
sxmo_hook_statusbar.sh periodics
# mako/dunst are required for warnings.
@@ -61,24 +73,27 @@ case "$SXMO_WM" in
;;
esac
# To setup initial lock state
sxmo_hook_unlock.sh
# Turn on auto-suspend
if [ -w "/sys/power/wakeup_count" ] && [ -f "/sys/power/wake_lock" ]; then
if sxmo_wakelock.sh isenabled; then
sxmo_wakelock.sh lock sxmo_not_suspendable infinite
superctl start sxmo_autosuspend
fi
# Turn on lisgd
superctl start sxmo_hook_lisgd
# To setup initial unlock state
sxmo_state.sh set unlock
if [ "$(command -v ModemManager)" ]; then
# Turn on lisgd
if [ ! -e "$XDG_CACHE_HOME"/sxmo/sxmo.nogesture ]; then
superctl start sxmo_hook_lisgd
fi
if [ -z "$SXMO_NO_MODEM" ] && command -v ModemManager > /dev/null; then
# Turn on the dbus-monitors for modem-related tasks
superctl start sxmo_modemmonitor
# place a wakelock for 120s to allow the modem to fully warm up (eg25 +
# elogind/systemd would do this for us, but we don't use those.)
sxmo_wakelock.sh lock modem_warming_up 120s
sxmo_wakelock.sh lock sxmo_modem_warming_up 120s
fi
# Start the desktop widget (e.g. clock)
@@ -93,26 +108,25 @@ superctl start sxmo_networkmonitor
# The daemon that display notifications popup messages
superctl start sxmo_notificationmonitor
# monitor for headphone for statusbar
superctl start sxmo_soundmonitor
# Play a funky startup tune if you want (disabled by default)
#mpv --quiet --no-video ~/welcome.ogg &
# mmsd and vvmd
if [ -f "${SXMO_MMS_BASE_DIR:-"$HOME"/.mms/modemmanager}/mms" ]; then
superctl start mmsd-tng
fi
if [ -z "$SXMO_NO_MODEM" ]; then
if [ -f "${SXMO_MMS_BASE_DIR:-"$HOME"/.mms/modemmanager}/mms" ]; then
superctl start mmsd-tng
fi
if [ -f "${SXMO_VVM_BASE_DIR:-"$HOME"/.vvm/modemmanager}/vvm" ]; then
superctl start vvmd
if [ -f "${SXMO_VVM_BASE_DIR:-"$HOME"/.vvm/modemmanager}/vvm" ]; then
superctl start vvmd
fi
fi
# add some warnings if things are not setup correctly
deviceprofile="$(command -v "sxmo_deviceprofile_$SXMO_DEVICE_NAME.sh")"
[ -f "$deviceprofile" ] || sxmo_notify_user.sh --urgency=critical \
"No deviceprofile found $SXMO_DEVICE_NAME. See: https://sxmo.org/deviceprofile"
if ! command -v "sxmo_deviceprofile_$SXMO_DEVICE_NAME.sh"; then
sxmo_notify_user.sh --urgency=critical \
"No deviceprofile found $SXMO_DEVICE_NAME. See: https://sxmo.org/deviceprofile"
fi
sxmo_migrate.sh state || sxmo_notify_user.sh --urgency=critical \
"Config needs migration" "$? file(s) in your sxmo configuration are out of date and disabled - using defaults until you migrate (run sxmo_migrate.sh)"

View File

@@ -27,11 +27,13 @@ set_state() {
return
fi
if sxmo_jobs.sh running proximity_lock; then
sxmobar -a -e bold -f orange state 90 "$icon_state_proximity" # circle with dot
return
fi
STATE_LABEL="$(cat "$SXMO_STATE")"
case "$STATE_LABEL" in
proximity*)
sxmobar -a -e bold -f orange state 90 "$icon_state_proximity" # circle with dot
;;
screenoff)
sxmobar -a -e bold -f red state 90 "$icon_state_screenoff" # filled circle
;;
@@ -227,7 +229,7 @@ set_wifi() {
# if they have a vpn nmcli c shown --active should also list:
# tun0 ef5fcce9-fdae-4ffe-a540-b16fc7b42852 tun tun0
if printf %b "$CONN" | cut -d':' -f3 | grep -q ^tun$; then
if printf %b "$CONN" | cut -d':' -f3 | grep -q -E "^tun$|^wireguard$"; then
wifivpn=1
else
wifivpn=0
@@ -271,87 +273,89 @@ set_wifi() {
sxmobar -a wifi-status 30 "$icon_wif"
}
# $1 = type (wifi, tun)
# $2 = interface name (wlan0, tun0)
set_ethernet() {
conname="$(nmcli -t device show "$2" | grep ^GENERAL.CONNECTION | cut -d: -f2-)"
if [ "$conname" = "--" ]; then
# not used device
sxmobar -d ethernet-status-"$2" 30
return
fi
if nmcli -t connection show "$conname" | grep ^ipv4.method | grep -q :shared; then
sxmobar -a ethernet-status-"$2" 30 "$icon_lnk"
else
sxmobar -d ethernet-status-"$2" 30
fi
}
# $1: type (reported by nmcli, e.g., wifi, tun)
# $2: interface name (reported by nmcli, e.g., wlan0, tun0)
set_network() {
case "$1" in
wifi|tun) set_wifi "$@" ;;
ethernet) set_ethernet "$@" ;;
esac
}
set_battery() {
for power_supply in /sys/class/power_supply/*; do
power_name="$(basename "$power_supply")"
fgcolor=default
bgcolor=default
style=normal
BATCMP=
name="$1"
state="$2"
percentage="$3"
if [ "$(cat "$power_supply"/type)" = "Battery" ]; then
if [ -e "$power_supply"/capacity ]; then
PCT="$(cat "$power_supply"/capacity)"
elif [ -e "$power_supply"/charge_now ]; then
CHARGE_NOW="$(cat "$power_supply"/charge_now)"
CHARGE_FULL="$(cat "$power_supply"/charge_full_design)"
PCT="$(printf "scale=2; %s / %s * 100\n" "$CHARGE_NOW" "$CHARGE_FULL" | bc | cut -d'.' -f1)"
fgcolor=default
bgcolor=default
style=normal
BATCMP=
case "$state" in
fully-charged)
BATCMP="$icon_bat_c_3"
;;
charging)
if [ "$percentage" -lt 25 ]; then
BATCMP="$icon_bat_c_0"
elif [ "$percentage" -lt 50 ]; then
BATCMP="$icon_bat_c_1"
elif [ "$percentage" -lt 75 ]; then
BATCMP="$icon_bat_c_2"
else
continue
# Treat 'Full' status as same as 'fully-charged'
BATCMP="$icon_bat_c_3"
fi
if [ -e "$power_supply"/status ]; then
# The status is not always given for the battery device.
# (sometimes it's linked to the charger device).
BATSTATUS="$(cut -c1 "$power_supply"/status)"
fi
# fixes a bug with keyboard case where
# /sys/class/power_supply/ip5xxx-charger/capacity
# exists but returns 'Not a tty'
if [ -z "$PCT" ]; then
BATCMP="ERR"
elif [ "$BATSTATUS" = "C" ] || [ "$BATSTATUS" = "F" ]; then
if [ "$PCT" -lt 25 ]; then
BATCMP="$icon_bat_c_0"
elif [ "$PCT" -lt 50 ]; then
BATCMP="$icon_bat_c_1"
elif [ "$PCT" -lt 75 ]; then
BATCMP="$icon_bat_c_2"
else
# Treat 'Full' status as same as 'Charging'
BATCMP="$icon_bat_c_3"
fi
else
if [ "$PCT" -lt 25 ]; then
fgcolor=red
if [ "$PCT" -lt 5 ]; then
BATCMP="$icon_bat_0"
elif [ "$PCT" -lt 10 ]; then
BATCMP="$icon_bat_1"
elif [ "$PCT" -lt 15 ]; then
BATCMP="$icon_bat_2"
else
BATCMP="$icon_bat_3"
fi
elif [ "$PCT" -lt 50 ]; then
fgcolor=orange
;;
discharging)
if [ "$percentage" -lt 25 ]; then
fgcolor=red
if [ "$percentage" -lt 5 ]; then
BATCMP="$icon_bat_0"
elif [ "$percentage" -lt 10 ]; then
BATCMP="$icon_bat_1"
elif [ "$PCT" -lt 75 ]; then
elif [ "$percentage" -lt 15 ]; then
BATCMP="$icon_bat_2"
else
BATCMP="$icon_bat_3"
fi
fi
sxmobar -a -t "$style" -b "$bgcolor" -f "$fgcolor" \
"battery-icon-$power_name" 40 "$BATCMP"
if [ -z "$SXMO_BAR_SHOW_BAT_PER" ]; then
sxmobar -d "battery-status-$power_name"
elif [ "$percentage" -lt 50 ]; then
fgcolor=orange
BATCMP="$icon_bat_1"
elif [ "$percentage" -lt 75 ]; then
BATCMP="$icon_bat_2"
else
sxmobar -a "battery-status-$power_name" 41 "$PCT%"
BATCMP="$icon_bat_3"
fi
fi
done
;;
esac
sxmobar -a -t "$style" -b "$bgcolor" -f "$fgcolor" \
"battery-icon-$name" 40 "$BATCMP"
if [ -z "$SXMO_BAR_SHOW_BAT_PER" ]; then
sxmobar -d "battery-status-$name"
else
sxmobar -a "battery-status-$name" 41 "$percentage%"
fi
}
set_notifications() {
@@ -367,51 +371,48 @@ set_notifications() {
set_volume() {
VOLCMP=""
if sxmo_modemaudio.sh is_call_audio_mode; then
if sxmo_modemaudio.sh is_muted_mic; then
VOLCMP="$icon_mmc"
else
VOLCMP="$icon_mic"
fi
if sxmo_modemaudio.sh is_enabled_speaker; then
VOLCMP="$VOLCMP $icon_spk"
else
VOLCMP="$VOLCMP $icon_ear"
fi
sxmobar -a -f green volume 50 "$VOLCMP"
return;
fi
if sxmo_audio.sh mic ismuted; then
VOLCMP="$icon_mmc"
else
VOLCMP="$icon_mic"
case "$(sxmo_audio.sh device getinput 2>/dev/null)" in
*Headset*)
VOLCMP="$icon_hst"
;;
*)
VOLCMP="$icon_mic"
;;
esac
fi
case "$(sxmo_audio.sh device get 2>/dev/null)" in
Speaker|"")
# nothing for default or pulse devices
;;
Headphones|Headphone)
VOLCMP="$VOLCMP $icon_hdp"
;;
Earpiece)
VOLCMP="$VOLCMP $icon_ear"
;;
esac
VOL="$(sxmo_audio.sh vol get)"
if [ -z "$VOL" ] || [ "$VOL" = "muted" ]; then
if sxmo_audio.sh vol ismuted; then
VOLCMP="$VOLCMP $icon_mut"
elif [ "$VOL" -gt 66 ]; then
VOLCMP="$VOLCMP $icon_spk"
elif [ "$VOL" -gt 33 ]; then
VOLCMP="$VOLCMP $icon_spm"
elif [ "$VOL" -ge 0 ]; then
VOLCMP="$VOLCMP $icon_spl"
else
case "$(sxmo_audio.sh device get 2>/dev/null)" in
*Speaker*|"")
# nothing for default or pulse devices
;;
*Headphone*)
VOLCMP="$VOLCMP $icon_hdp"
;;
*Earpiece*)
VOLCMP="$VOLCMP $icon_ear"
;;
esac
VOL="$(sxmo_audio.sh vol get)"
if [ "$VOL" -gt 66 ]; then
VOLCMP="$VOLCMP $icon_spk"
elif [ "$VOL" -gt 33 ]; then
VOLCMP="$VOLCMP $icon_spm"
elif [ "$VOL" -ge 0 ]; then
VOLCMP="$VOLCMP $icon_spl"
fi
fi
sxmobar -a volume 50 "$VOLCMP"
if sxmo_modemaudio.sh is_call_audio_mode; then
sxmobar -a -f green volume 50 "$VOLCMP"
else
sxmobar -a volume 50 "$VOLCMP"
fi
}
sxmo_debug "$@"
@@ -420,22 +421,30 @@ case "$1" in
shift
set_network "$@"
;;
time|modem|battery|volume|state|notifications)
battery)
shift
set_battery "$@"
;;
time|modem|volume|state|notifications)
set_"$1"
;;
periodics|state_change) # 55 s loop and screenlock triggers
set_time
set_modem
set_battery
if [ -z "$SXMO_NO_MODEM" ]; then
set_modem
fi
set_state
set_network wifi wlan0
;;
all)
sxmobar -r
set_time
set_modem
set_battery
set_volume
if [ -z "$SXMO_NO_MODEM" ]; then
set_modem
fi
if [ -z "$SXMO_NO_AUDIO" ]; then
set_volume
fi
set_state
set_notifications
set_network wifi wlan0
@@ -444,4 +453,3 @@ case "$1" in
exit # swallow it !
;;
esac

View File

@@ -15,7 +15,9 @@ export TERMNAME
# If it's already open, switch to it.
if [ "$SXMO_WM" = "sway" ] && [ -z "$SSH_CLIENT" ]; then
regesc_termname="$(echo "$TERMNAME" | sed 's|+|\\+|g')"
swaymsg "[title=\"^$regesc_termname\$\"]" focus && exit 0
if swaymsg -q "[title=\"^$regesc_termname\$\"]" focus; then
exit 0
fi
fi
mkcontactssedcmd() {
@@ -31,7 +33,7 @@ mkcontactssedcmd() {
TODAY="$(date +%F)"
YESTERDAY="$(date -d "- 1 day" +%F)"
TWO_DAYS="$(date -d "- 2 day" +%F)"
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/;"
# TODO
#ALIGNSEDCMD="s/^Sent/<right align>/;s/^Received/<left align>/;"
@@ -46,4 +48,3 @@ CONTACTSSEDCMD="$(mkcontactssedcmd)"
sxmo_terminal.sh sh -c "tail -n9999 -f \"$SXMO_LOGDIR/$LOGDIRNUM/sms.txt\" |\
sed -e \"$CONTACTSSEDCMD\" -e \"$DATESEDCMD\" -e \"$COLORSEDCMD\""
#sxmo_terminal.sh sh -c "sxmo_hook_parselog.sh \"$NUMBER\""

View File

@@ -0,0 +1,38 @@
#!/bin/sh
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2022 Sxmo Contributors
# include common definitions
# shellcheck source=scripts/core/sxmo_common.sh
. sxmo_common.sh
# This hook is called when the system becomes unlocked again
sxmo_led.sh blink red green &
sxmo_wm.sh dpms off
sxmo_wm.sh inputevent touchscreen on
sxmo_jobs.sh stop periodic_blink
sxmo_jobs.sh stop periodic_wakelock_check
# Go to the next idle state after 120 seconds of inactivity
if [ -e "$XDG_CACHE_HOME/sxmo/sxmo.noidle" ]; then
sxmo_jobs.sh stop idle_locker
else
case "$SXMO_WM" in
sway)
sxmo_jobs.sh start idle_locker sxmo_idle.sh -w \
timeout "${SXMO_UNLOCK_IDLE_TIME:-120}" 'sh -c "
swaymsg mode default;
exec sxmo_state.sh idle
"'
;;
dwm)
sxmo_jobs.sh start idle_locker sxmo_idle.sh -w \
timeout "${SXMO_UNLOCK_IDLE_TIME:-120}" "sxmo_state.sh idle"
;;
esac
fi
wait

View File

@@ -1,21 +0,0 @@
#!/bin/sh
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2022 Sxmo Contributors
# include common definitions
# shellcheck source=scripts/core/sxmo_common.sh
. sxmo_common.sh
MMCLI="$(mmcli -m any -J 2>/dev/null)"
if [ -z "$MMCLI" ]; then
sxmo_notify_user.sh "Modem crashed! 30s recovery."
sxmo_wakelock.sh lock modem_crashed 30s
fi
# see the comments in sxmo_hook_lock.sh
# and https://todo.sr.ht/~mil/sxmo-tickets/150
if [ 1 = "$SXMO_RTW_SCAN_INTERVAL" ]; then
echo 1200 > "/sys/module/$SXMO_WIFI_MODULE/parameters/rtw_scan_interval_thr"
fi
# Add here whatever you want to do

View File

@@ -1,56 +0,0 @@
#!/bin/sh
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2022 Sxmo Contributors
# include common definitions
# shellcheck source=scripts/core/sxmo_common.sh
. sxmo_common.sh
# This hook is called when the system becomes unlocked again
exec 3<> "$SXMO_STATE.lock"
flock -x 3
sxmo_log "transitioning to stage unlock"
printf unlock > "$SXMO_STATE"
sxmo_wakelock.sh lock not_screenoff infinite
sxmo_led.sh blink red green &
sxmo_hook_statusbar.sh state_change &
sxmo_wm.sh dpms off
sxmo_wm.sh inputevent touchscreen on
sxmo_daemons.sh stop periodic_blink
sxmo_daemons.sh stop periodic_wakelock_check
# see https://todo.sr.ht/~mil/sxmo-tickets/150
# We set the scan interval threshold here to
# 16000 (16s) the default, since in sxmo_hook_postwake.sh
# we set it to 1200 (.12s) so that we can reconnect to wifi
# quicker after resuming from suspend.
if [ 1 = "$SXMO_RTW_SCAN_INTERVAL" ]; then
echo 16000 > "/sys/module/$SXMO_WIFI_MODULE/parameters/rtw_scan_interval_thr"
fi
# Go to lock after 120 seconds of inactivity
if [ -e "$XDG_CACHE_HOME/sxmo/sxmo.noidle" ]; then
sxmo_daemons.sh stop idle_locker
else
case "$SXMO_WM" in
sway)
sxmo_daemons.sh start idle_locker sxmo_idle.sh -w \
timeout "${SXMO_UNLOCK_IDLE_TIME:-120}" 'sh -c "
swaymsg mode default;
exec sxmo_hook_lock.sh
"'
;;
dwm)
sxmo_daemons.sh start idle_locker sxmo_idle.sh -w \
timeout "${SXMO_UNLOCK_IDLE_TIME:-120}" "sxmo_hook_lock.sh"
;;
esac
fi
wait

View File

@@ -16,5 +16,7 @@ permit nopass :wheel as root cmd systemctl args start eg25-manager
permit nopass :wheel as root cmd systemctl args stop eg25-manager
permit nopass :wheel as root cmd systemctl args start ModemManager
permit nopass :wheel as root cmd systemctl args stop ModemManager
permit nopass :wheel as root cmd rtcwake
permit nopass :wheel as root cmd tee args -a /sys/power/wake_lock
permit nopass :wheel as root cmd tee args -a /sys/power/wake_unlock
permit nopass :wheel as root cmd tee args /sys/power/wakeup_count

View File

@@ -0,0 +1,10 @@
[Unit]
Description=Pipewire filter chain
After=pipewire
[Service]
Type=simple
Restart=always
ExecStart=/usr/bin/pipewire -c filter-chain.conf
ExecOnFailure=/usr/bin/sxmo_notify_user.sh "superd failed to start pipewire-filter-chain"
RestartSec=1s

View File

@@ -1,5 +0,0 @@
#!/sbin/openrc-run
description="Set user permissions to aspects of the hardware kernel interface"
command="/usr/bin/sxmo_setpermissions.sh"

View File

@@ -9,15 +9,18 @@
_sxmo_is_running() {
unset SXMO_WM
if [ -f "${XDG_RUNTIME_DIR}"/sxmo.swaysock ]; then
unset SWAYSOCK
if SWAYSOCK="$(cat "${XDG_RUNTIME_DIR}"/sxmo.swaysock)" \
swaymsg 2>/dev/null; then
_XDG_RUNTIME_DIR="$(_sxmo_find_runtime_dir)"
if [ -f "${_XDG_RUNTIME_DIR}"/sxmo.swaysock ]; then
if SWAYSOCK="$(cat "${_XDG_RUNTIME_DIR}"/sxmo.swaysock)" swaymsg 2>/dev/null
then
printf "Detected the Sway environment\n" >&2
export SXMO_WM=sway
unset _XDG_RUNTIME_DIR
return 0
fi
fi
unset _XDG_RUNTIME_DIR
if DISPLAY=:0 xrandr >/dev/null 2>&1; then
printf "Detected the Dwm environment\n" >&2
@@ -36,10 +39,14 @@ _sxmo_find_runtime_dir() {
return
fi
if [ -d "/var/run/user/$(id -u)" ]; then
printf "/var/run/user/%s" "$(id -u)"
return
fi
# Try something existing
for root in /run /var/run; do
path="$root/user/$(id -u)"
if [ -d "$path" ] && [ -w "$path" ]; then
printf %s "$path"
return
fi
done
# Fallback to a shared memory location
printf "/dev/shm/user/%s" "$(id -u)"
@@ -80,57 +87,49 @@ _sxmo_load_environments() {
export BROWSER="${BROWSER:-firefox}"
export SHELL="${SHELL:-/bin/sh}"
# The user can already forced a $SXMO_DEVICE_NAME value
if [ -z "$SXMO_DEVICE_NAME" ] && [ -e /proc/device-tree/compatible ]; then
SXMO_DEVICE_NAME="$(tr -c '\0[:alnum:].,-' '_' < /proc/device-tree/compatible |
tr '\0' '\n' | head -n1)"
export SXMO_DEVICE_NAME
deviceprofile="$(command -v "sxmo_deviceprofile_$SXMO_DEVICE_NAME.sh")"
# shellcheck disable=SC1090
if [ -f "$deviceprofile" ]; then
. "$deviceprofile"
printf "deviceprofile file %s loaded.\n" "$deviceprofile"
# The user can already force a $SXMO_DEVICE_NAME value in ~/.profile
if [ -z "$SXMO_DEVICE_NAME" ]; then
if [ -e /proc/device-tree/compatible ]; then
SXMO_DEVICE_NAME="$(tr -c '\0[:alnum:].,-' '_' < /proc/device-tree/compatible |
tr '\0' '\n' | head -n1)"
else
printf "WARNING: deviceprofile file not found for %s. Most device functions will not work. Please read: https://sxmo.org/deviceprofile \n" "$SXMO_DEVICE_NAME"
# on a new device, power button won't work
# so make sure we don't go into screenoff
# or suspend
touch "$XDG_CACHE_HOME"/sxmo/sxmo.nosuspend
touch "$XDG_CACHE_HOME"/sxmo/sxmo.noidle
SXMO_DEVICE_NAME=unknown
SXMO_DEVICE_NAME=desktop
fi
unset deviceprofile
fi
export SXMO_DEVICE_NAME
if [ -n "$SXMO_DEVICE_NAME" ]; then
_device_hooks_path="$(xdg_data_path "sxmo/default_hooks/$SXMO_DEVICE_NAME" 0 ':')"
if [ -z "$_device_hooks_path" ]; then
_device_hooks_path="$(xdg_data_path "sxmo/default_hooks/three_button_touchscreen" 0 ':')"
fi
deviceprofile="$(command -v "sxmo_deviceprofile_$SXMO_DEVICE_NAME.sh")"
# shellcheck disable=SC1090
if [ -f "$deviceprofile" ]; then
. "$deviceprofile"
printf "deviceprofile file %s loaded.\n" "$deviceprofile"
else
printf "WARNING: deviceprofile file not found for %s. Most device functions will not work. Please read: https://sxmo.org/deviceprofile \n" "$SXMO_DEVICE_NAME"
PATH="\
# on a new device, power button won't work
# so make sure we don't go into screenoff
# or suspend
touch "$XDG_CACHE_HOME"/sxmo/sxmo.nosuspend
touch "$XDG_CACHE_HOME"/sxmo/sxmo.noidle
fi
unset deviceprofile
PATH="\
$XDG_CONFIG_HOME/sxmo/hooks/$SXMO_DEVICE_NAME:\
$XDG_CONFIG_HOME/sxmo/hooks:\
$_device_hooks_path:\
$(xdg_data_path "sxmo/default_hooks" 0 ':'):\
$PATH"
export PATH
else
default_hooks_path=$(xdg_data_path sxmo/default_hooks 0 ':')
export PATH="$XDG_CONFIG_HOME/sxmo/hooks:$default_hooks_path:$PATH"
fi
export PATH
}
_sxmo_grab_session() {
XDG_RUNTIME_DIR="$(_sxmo_find_runtime_dir)"
export XDG_RUNTIME_DIR
if ! _sxmo_is_running; then
unset XDG_RUNTIME_DIR
return
fi
XDG_RUNTIME_DIR="$(_sxmo_find_runtime_dir)"
export XDG_RUNTIME_DIR
_sxmo_load_environments
if [ -f "$XDG_RUNTIME_DIR"/dbus.bus ]; then

View File

@@ -0,0 +1,7 @@
[Unit]
Description=Proxy location data to map applications
[Service]
Type=simple
Restart=always
ExecStart=/usr/libexec/geoclue-2.0/demos/agent

View File

@@ -1,13 +1,5 @@
# lisgd requires /dev/input/touchscreen
ACTION=="add|change", SUBSYSTEM=="input", KERNEL=="event[0-9]*", ENV{ID_INPUT_TOUCHSCREEN}=="1", MODE:="0666", SYMLINK+="input/touchscreen"
ACTION=="add", SUBSYSTEM=="input", ENV{ID_PATH}=="platform-vibrator", MODE:="0666"
# make stylus readable
ACTION=="add|change", SUBSYSTEM=="input", KERNEL=="event[0-9]*", ENV{ID_INPUT_TABLET}=="1", MODE:="0666"
# fix bug with pinenote touchscreen matrix
#ACTION=="add|change", SUBSYSTEM=="input", KERNEL=="event[0-9]*", ENV{ID_INPUT_TABLET}=="1", ENV{LIBINPUT_CALIBRATION_MATRIX}="-1 0 1 0 -1 1"
#ACTION=="add|change", SUBSYSTEM=="input", KERNEL=="event[0-9]*", ENV{ID_PATH}=="platform-fe5a0000.i2c", ENV{LIBINPUT_CALIBRATION_MATRIX}="-1 0 1 0 -1 1"
# lisgd requires /dev/input/by-path/first-touchscreen
ACTION=="add|change", SUBSYSTEM=="input", KERNEL=="event[0-9]*", ENV{ID_INPUT_TOUCHSCREEN}=="1", SYMLINK+="input/by-path/first-touchscreen"
# Proximity Sensor
## Set event thresholds
@@ -15,10 +7,4 @@ ACTION=="add", SUBSYSTEM=="iio", TEST=="in_proximity_raw" RUN+="/bin/chgrp input
ACTION=="add", SUBSYSTEM=="iio", TEST=="in_proximity_raw" RUN+="/bin/chmod g+rw /sys$devpath/events/in_proximity_thresh_falling_value /sys$devpath/events/in_proximity_thresh_rising_value"
## Read device to monitor event
ACTION=="add", SUBSYSTEM=="iio", TEST=="in_proximity_raw" RUN+="/bin/chgrp input $devnode"
ACTION=="add", SUBSYSTEM=="iio", TEST=="in_proximity_raw" RUN+="/bin/chmod g+r input $devnode"
# taken from https://github.com/haikarainen/light/blob/master/90-backlight.rules
ACTION=="add", SUBSYSTEM=="backlight", RUN+="/bin/chgrp video /sys/class/backlight/%k/brightness"
ACTION=="add", SUBSYSTEM=="backlight", RUN+="/bin/chmod g+w /sys/class/backlight/%k/brightness"
ACTION=="add", SUBSYSTEM=="leds", RUN+="/bin/chgrp video /sys/class/leds/%k/brightness"
ACTION=="add", SUBSYSTEM=="leds", RUN+="/bin/chmod g+w /sys/class/leds/%k/brightness"
ACTION=="add", SUBSYSTEM=="iio", TEST=="in_proximity_raw" RUN+="/bin/chmod g+r $devnode"

View File

@@ -1,7 +1,7 @@
[Default Applications]
image/jpeg=sxmo-sxiv.desktop
image/png=sxmo-sxiv.desktop
image/gif=sxmo-sxiv.desktop
image/jpeg=sxmo-nsxiv.desktop
image/png=sxmo-nsxiv.desktop
image/gif=sxmo-nsxiv.desktop
audio/x-m4a=sxmo-mpv-music.desktop
audio/mpeg=sxmo-mpv-music.desktop
audio/amr=sxmo-mpv-music.desktop

View File

@@ -32,9 +32,9 @@ A brief overview of sxmo's features (in order of presentation):
Menu* which allows you to browser your filesystem via _sxmo_files_(1); and
more. See MENUS.
- *Autosuspend, screen blanking, and input locking*: sxmo states allow sxmo to
automatically suspend when idle unless certain programs block it; to offer
automatically suspend when idle unless certain programs block it; to offer
protection from accidental wakeups; and to blank the screen and lock the input
while in a phone call and the phone is near your face. See STATES.
while in a phone call and the phone is near your face. See STATES AND SUSPENSION.
- *Smart cronjobs*: sxmo uses _crond_(1) to handle cronjobs and a special
program called _mnc_(1) to wake the phone up in time to execute cron jobs.
See CRONJOBS.
@@ -71,7 +71,7 @@ Sxmo 1.4.1 was presented at AlpineConf 2021, you can watch the video.
Sxmo uses _tinydm_(1) to automatically launch the window manager of your
choice (_sway_(1) or _dwm_(1)). Note: You can configure the UID in
*/etc/conf.d/tinydm*. Make sure to change this if you create a custom user.
*/etc/conf.d/tinydm*. Make sure to change this if you create a custom user.
You may switch between the two window managers in the *Power Menu*.
Once the window manager launches, it will execute _sxmo_hook_start.sh_. Sxmo
@@ -93,17 +93,17 @@ SEE ALSO: _tinydm_(1), _superd_(1), _sxmo_daemons.sh_(1)
# HOOKS
A lot of functionality is also contained in hooks (*sxmo_hook_\*.sh*). Sxmo uses
PATH to determine which hook executes. It will look first for hooks in
*~/.config/sxmo/hooks/* before it looks in */usr/share/sxmo/default_hooks/*.
For example, if you pickup
a call and *~/.config/sxmo/hooks/sxmo_hook_pickup.sh* does not exist,
PATH to determine which hook executes. It will look first for hooks in
*~/.config/sxmo/hooks/* before it looks in */usr/share/sxmo/default_hooks/*.
For example, if you pickup
a call and *~/.config/sxmo/hooks/sxmo_hook_pickup.sh* does not exist,
*/usr/share/sxmo/default_hooks/sxmo_hook_pickup.sh* will be run.
Note that some hooks are in a subdirectory under the *hooks/* main
directory which will allow you to have hooks associated with a certain
device. See DEVICES. For instance, in */usr/share/sxmo/default_hooks/* there
are several device subdirectories, one of which will be your $SXMO_DEVICE_NAME.
It should be a symlink to another subdirectory, e.g., *one_button_ereader* or
device. See DEVICES. For instance, in */usr/share/sxmo/default_hooks/* there
are several device subdirectories, one of which will be your $SXMO_DEVICE_NAME.
It should be a symlink to another subdirectory, e.g., *one_button_ereader* or
*three_button_touchscreen*. Device-specific hooks go here.
While you can manually copy and edit hooks to your liking,
@@ -118,7 +118,7 @@ After login, you will be presented the sxmo interface as follows:
https://sxmo.org/assets/screenshot.jpg
The statusbar relies upon _sxmobar_(1). It has space for the following information
The statusbar relies upon _sxmobar_(1). It has space for the following information
(from left to right) has icons for:
- The current and active workspace(s) (in the form of numbers). You can tap these to switch to them.
- The title of the active window (if any).
@@ -253,7 +253,7 @@ zoom in, zoom out, etc.).
If no application is focused, swiping down from the top of the screen, or pressing
the volume raise button once, will bring up the Main Menu. If an application is
focused, this will bring up the application's Context Menu instead. (To access the
focused, this will bring up the application's Context Menu instead. (To access the
Main Menu while an application is focussed, press the volume raise button twice.)
You can close any open menu with a gesture: swipe straight up (vertically) onto
@@ -281,7 +281,7 @@ place a shell script in the *~/.config/sxmo/userscripts/* directory.
- Option 1. Edit *~/.config/sxmo/userscripts* and write your entries in it,
following the appmenu format *<name> ^ <should-return-to-menu> ^
<script-path-or-command>* one entry per line. Example:
<script-path-or-command>* one entry per line. Example:
```
 Weather ^ 0 ^ sxmo_terminal.sh -f "Sxmo:size=5" sh -c "curl http://wttr.in/ | less -SR"
@@ -330,32 +330,46 @@ HOOKS: _sxmo_hook_apps.sh_ (control list of apps)
SEE _sxmo_files.sh_(1).
# STATES
# STATES AND SUSPENSION
Sxmo recognizes five basic states:
Sxmo recognizes three basic states:
- *unlock*: Screen is on; touchscreen is enabled.
- *lock*: Screen is on; touchscreen is disabled.
- *screenoff*: Screen is off; touchscreen is disabled. The led will also blink
purple every few seconds to indicate that you are in this state.
- *suspend or CRUST*: This is CRUST (or suspend), where the modem will still be
active and monitor for incoming calls/texts but everything else will be
suspended.
- *Proximity Mode*: This is a special state when one is in a phone call. If you
bring it close to your face, it will disable input and turn the screen off,
and if you move the phone away from your face, it will enable input and turn
the screen back on.
the screen back on. This script actually switch back and forth between *unlock*
and *screenoff*.
A diagram of the states can be found here:
There also is some dedicated workflow for some type of device.
https://sxmo.org/assets/lock-power-states.png
On desktops, which is the default mode, if no other one is recognised:
The usual workflow is this.
- *unlock*: The entry point, and default one.
- *locker*: A session locker is running, and prevent any interaction with the
environment.
On e-ink display devices, by example e-reader devices:
- *unlock*: The entry point, and only available state. The screens stay on while
the device is suspended, which means that the power button is only a refresh of
the suspension idle timeout, and a way to bring back interactivity.
Sxmo will also *suspend* on most devices, when this feature is available.
- *suspend or CRUST*: This is CRUST (or suspend), where the modem will still be
active and monitor for incoming calls/texts but everything else will be
suspended.
The usual workflow is this.
- If the phone is in the *unlock* state (default when you boot up) and you wish
to suspend it, tap the power button once. This will transition to the
*screenoff* state which will then automatically transition to the *CRUST* state
unless something is blocking it.
unless something is blocking it.
- If the phone is in the *CRUST* state (i.e., suspended) and you wish to wake it
up, tap the power button once (to transition to the *lock* state) and then tap
it once again to transition to the *unlock* state. (This prevents accidental
@@ -365,26 +379,25 @@ Sxmo also handles automatic transitions from some states to others.
- It will automatically transition from *unlock* to *screenoff* after a certain
amount of idleness (120s).
- It will automatically transition from *lock* to *screenoff* after a certain
- It will automatically transition from *lock* to *screenoff* after a certain
amount of time (8s).
- It will automatically transition from *screenoff* to *CRUST* immediately
unless something is blocking it.
You can set up suspend blockers in the wakelocks hook.
You can set up suspend blockers in the block_suspend hook.
HOOKS:
_sxmo_hook_postwake.sh_ (what to do after waking up from suspend state),
_sxmo_hook_lock.sh_ (what to do when transitioning into lock state),
_sxmo_hook_screenoff.sh_ (what to do when transitioning into screenoff state),
_sxmo_hook_unlock.sh_ (what to do when transitioning into unlock state),
_sxmo_hook_wakelocks.sh_ (set what block suspend)
# CRONJOBS
Sxmo ensures that cron jobs run and will actively wake the phone from sleep temporarily to this end.
The cron daemon is installed but not enabled in postmarketOS. Cron has to be started manually
with *rc-service crond start* and set to start on boot with *rc-update add crond
default*. We use a little program called _mnc_(1) to wake the phone up before the next
default*. We use a little program called _mnc_(1) to wake the phone up before the next
planned cron job. We also wrap some sxmo logic in _sxmo_rtcwake_(1) which
launches the cronjob and puts the phone back to sleep when finished.
@@ -479,14 +492,14 @@ HOOKS: _sxmo_hook_tailtextlog.sh_ (controls look and feel of view of message tex
A vital feature of a working phone is being able to receive new texts and
pickup calls. This functionality is made possible through a script that
monitors the modem activities and vibrates the phone, plays a notification or ringing sound,
and blinks the green LED when there is an incoming text/call.
monitors the modem activities and vibrates the phone, plays a notification or ringing sound,
and blinks the green LED when there is an incoming text/call.
While a call is incoming:
- The phone will ring and vibrate (unless you disabled these in the [Audio menu](#strongincluded-menustrong)).
- The green LED will trigger.
- A menu will appear to allow you to pickup the call. You can also discard
the call or ignore the call (mute the ring). If you missed the menu, you can also open
the call or ignore the call (mute the ring). If you missed the menu, you can also open
the [global system menu](#strongincluded-menusstrong) menu and you'll
see a menu entry to pickup the call; of course this is time-sensitive and this
menu entry will only be visible while the other party's line is ringing
@@ -532,7 +545,7 @@ easier in sxmo, we have a dedicated menu entry in *Config* called
fields one by one. The script should take care of restarting mmsd when closed.
*Note* that you likely will *not* have to configure mmsd-tng, if your settings
are already in
are already in
https://wiki.gnome.org/Projects/NetworkManager/MobileBroadband/ServiceProviders.
Consider contributing your own if it is not.
@@ -576,8 +589,8 @@ If your phone has a wifi killswitch (like the Pinephone or Librem 5), make sure
HOOKS: _sxmo_hook_network_up.sh_ (what to do when network goes up),
_sxmo_hook_network_down.sh_ (what to do when network goes down),
_sxmo_hook_network_preup.sh_,
_sxmo_hook_network_predown.sh_
_sxmo_hook_network_pre_up.sh_,
_sxmo_hook_network_pre_down.sh_
# AUDIO
@@ -612,7 +625,7 @@ apk upgrade -aiv
There is also a menu entry within the *Config Menu* to do this.
After you update the sxmo packages themselves, be sure to run
_sxmo_migrate.sh_(1) to upgrade your (local) config files.
_sxmo_migrate.sh_(1) to upgrade your (local) config files.
SEE ALSO: _sxmo_migrate.sh_(1)
@@ -688,7 +701,7 @@ missing on your system. The most relevant ones are:
When the system boots, tinydm will will run either *sxmo_xinit.sh* or
*sxmo_winit.sh* depending on if you are running Xorg (dwm) or Wayland (sway).
Each of these then will load */etc/profile.d/sxmo_init.sh* which will set the
following environmental variables. Hint: you can type *\_sxmo_grab_session*
following environmental variables. Hint: you can type *\_sxmo_grab_session*
from the commandline to reload these (e.g., if you switch window managers but
are logged into an ssh connection).

View File

@@ -0,0 +1,32 @@
#include <unicode/ustdio.h>
#include <unicode/ubidi.h>
int main() {
UFILE *in = u_finit(stdin, NULL, NULL);
int line = 1;
int err = 0;
bool comment = false;
while (true) {
UChar chr = u_fgetc(in);
if (chr == U_EOF) {
break;
} if (chr == '\n') {
line++;
comment = false;
continue;
} if (chr == '#') {
comment = true;
}
if (comment)
continue;
if (chr >= 0xF900 && chr <= 0xFDFF) {
u_printf("ERROR: detected legacy nerd font icon in wrong characer range: \"%C\" 0x%x on line %d\n", chr, chr, line);
err = 1;
}
}
return err;
}

View File

@@ -0,0 +1,43 @@
#!/bin/sh -e
# title="󰎞 Notes"
# shellcheck source=configs/default_hooks/sxmo_hook_icons.sh
. sxmo_hook_icons.sh
DIR="${XDG_DATA_HOME:-$HOME/.local/share}/sxmo.notes"
mkdir -p "$DIR"
_listnotes() {
( cd "$DIR" && find ./ -maxdepth 1 ) | cut -d/ -f2- | grep .
}
while : ; do
ENTRIES="$(cat <<EOF
$icon_cls Close Menu
$icon_trh Delete
$(_listnotes)
EOF
)"
PICKED="$(printf %b "$ENTRIES" | sxmo_dmenu.sh -p "Notes")" || break
case "$PICKED" in
"$icon_cls Close Menu"|"")
break
;;
"$icon_trh Delete")
ENTRIES="$(cat <<EOF
$icon_ret Cancel
$(_listnotes)
EOF
)"
PICKED="$(printf %b "$ENTRIES" | sxmo_dmenu.sh -p "Notes - Delete")" || break
if [ "$icon_ret Cancel" != "$PICKED" ]; then
rm -f "$DIR"/"$PICKED"
fi
;;
*)
# shellcheck disable=SC2086
sxmo_terminal.sh $EDITOR "$DIR"/"$PICKED"
;;
esac
done

Some files were not shown because too many files have changed in this diff Show More