191 Commits

Author SHA1 Message Date
Willow Barraco
c36ace56de update contextmenu_fallback hook trigger call 2023-02-02 00:28:21 +01:00
ArenM
380a81299f Add basic tests for the appmenu
My main motivation for writing this was as a regression test for my
recent patch "appmenu: require exact match with picked"
https://lists.sr.ht/~mil/sxmo-devel/patches/32362

Signed-off-by: Anjandev Momi <anjan@momi.ca>
2022-12-05 11:56:02 -08:00
Brecht Savelkoul
3ed7bf3661 Add fallback hook for unknown contextmenu choice
This patch adds a new hook that's called when the user submits an
unknown choice to a contextmenu. This is useful to be able to
handle arbitrary text inputs beyond the listed choices. This can
be used to search files, do a web search, run commands, etc.

The hook takes two arguments: the $WINNAME of the contextmenu that
was used and the $CHOICE typed into the menu by the user. This
should allow fine-grained control of the fallback depending on
where the choice was entered.

In my personal config I currently use a simple script just to open
URLs or search the web. You can see it here:

https://git.sr.ht/~brecht/sxmo-config/tree/master/item/hooks/contextmenu_fallback
Signed-off-by: Peter John Hartman <peterjohnhartman@gmail.com>
2022-06-30 06:20:20 -05:00
ArenM
137e9cd46e appmenu: require exact match with picked
When selecting "YouTube" from the scripts menu "YouTube (audio)" was
being selected. This happens because the audio version is first in the
choices list so it was matched first when grepping for "YouTube".

This patch solves that by requiring the name of the entry to match
exactly, not just contain the selected item.

Signed-off-by: Anjandev Momi <anjan@momi.ca>
2022-05-22 02:51:40 -04:00
Anjandev Momi
6f52863501 Switch to superd for daemons we want to monitor
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-04-16 11:11:10 +02:00
Stacy Harper
73a2813d76 Rework calls
We need the recent -S (status) command to probe the real state of
callaudiod.

- Lot of cleanup and refactorisation

Most of the code has been moved to a better place. The call audio
setups, the pickup action and the incall menu now are three different
things we can call individually.

- Handle failures individually

Every important task as the mmcli command or volume settings should warn
a urgent message to the user if they failed.

If we failed to setup audio, or to pickup the call then we dont even try
to open the incall menu.

- Made the incall_menu closeable and re-opennable

You can close the incoming call menu and the incall menu and re-open
them from any menu.

To make this possible I moved some of the responsibilities to the
modem monitor that trigger action after modem manager signals. We then
check at this point if it was the last call and do some cleanup if so.

- Initial work for concurrent calls

Added some code to the hooks and the modem checkfinished and
checkincoming calls to handle those cased. If you are in a call and someone
else try to call you, we refresh the incall menu and new entries will allow
you to switch calls.

- The incall menu isnt sticked to one call

This menu itself doesnt need a CALLID argument. It allow us to
manage every active call. We should be able to hold and hangup and
switch calls as we want.
2022-03-25 21:29:30 +01:00
Anjandev Momi
1123c0f072 Change license to AGPL-3.0-only 2022-03-15 08:00:00 -04:00
Zach DeCook
ffcfa6f6a4 icons: Change into a hook
Fixes the icons hook to be where the migration script moved it.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-02-14 18:18:55 +01:00
Stacy Harper
92c258f990 Make sxmo hooks scripts in PATH
We then add /usr/share/sxmo/default_hooks/ to the PATH (see
sxmo_init.sh)
2022-02-11 17:04:11 +01:00
Stacy Harper
4f9e89fa5e Cleanup profile.d/sxmo_init.sh
- Should only export SXMO_ prefixed variable to avoid noise
- Should not export env variable when sxmo is not running
2022-01-24 20:38:54 +01:00
Stacy Harper
af51924367 Avoid zombies process when using sxmo_appmenu.sh from ssh
In ssh, using sxmo_appmenu.sh > text > tail a conversation then Ctrl+C
will let a dangling tail -f process.

I think this is caused by this & wait. Ctrl+C was actually killing
sxmo_appmenu.sh instead of the running sxmo_modemtext.sh

I'm not sure if this was needed for some reason. I tested a little bit
without noticing a regression

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2022-01-15 12:31:51 +01:00
Stacy Harper
238aa38efc Refact: commons loading
- Move sxmo icons in sxmo_icons.sh

This script should be loaded when icons are needed

- Move init env variable setups in a /etc/profile.d/sxmo_init.sh

This script is loaded by tinydm and for ssh/tty logins.

The logged in user can re-trigger check_sxmo_wm if they toggle wm.

- sxmo_commons.sh now only load aliases. It can be loaded by scripts to
ensure busybox compatibility

- moved some parts of ~/.config/sxmo/xinit to ~/.config/sxmo/profile

This file also is loaded just before starting sway. It goal is to setup
env variables dedicated to sxmo

~/.config/sxmo/xinit only goal is now to trigger some dwm dedicated
things (as ~/.config/sxmo/sway can start exec commands to)

To recap, loads orders are :

tinydm:
	/etc/profile.d/* # do not set SXMO_WM
	~/.profile

	sxmo_winit.sh:
		~/.config/sxmo/profile

	sxmo_xinit.sh:
		~/.config/sxmo/profile
		~/.config/sxmo/xinit # to start sxmo_hooks.sh

ssh/tty:
	/etc/profile.d/* # will set SXMO_WM
	~/.profile

- unify sxmo_winit.sh and sxmo_init.sh

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2022-01-15 11:31:00 +01:00
Stacy Harper
d32bc7e02e Refact: Daemons management
Add a sxmo_daemons to manage all sxmo daemons

$ sxmo_daemons.sh start mmsd mmsdtng
$ sxmo_daemons.sh start network_monitor sxmo_networkmonitor.sh
$ sxmo_daemons.sh start sleepy sleep 2

$ sxmo_daemons.sh start network_monitor sxmo_networkmonitor.sh
-> This will stop the old daemon and start a new one

$ sxmo_daemons.sh running network_monitor
network_monitor is still running
$ echo $?
0

$ sxmo_daemons.sh running unknown
unknown is not running
$ echo $?
1

$ sxmo_daemons.sh running sleepy
sleepy is not running anymore
$ echo $?
2

$ sxmo_daemons.sh running network_monitor -q && echo "tada !"
tada !

$ sxmo_daemons.sh stop network_monitor
$ sxmo_daemons.sh stop all # to stop every managed daemons

We can now start, stop and check daemons status with ease. When
dwm/sway shutdown, we stop all daemons. Restarting or toggleing window
manager cannot leave any dangling daemons anymore.

As you can see, all daemons now start from the start hook. We gave the
full power on the user to disable or add daemons.

This patch is painfull cause I had to make sure every daemons behave
correctly and shutdown gracefully when killed (which was definitely not
the case !).

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2022-01-15 11:30:49 +01:00
Zach DeCook
6274f1f222 shebangs: change to /bin/sh
Any sane linux system will have a posix compliant shell at /bin/sh
This change will allow us to better detect running scripts using pgrep.

Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-12-20 14:29:25 +01:00
Stacy Harper
20233bf3f9 fix a bug with a non enquoted variable usage 2021-11-29 21:06:29 +01:00
Stacy Harper
d52a901107 Fix contextual submenus 2021-11-29 20:17:15 +01:00
Stacy Harper
e3cc6c518a Simplify even more sxmo_appmenu.sh 2021-11-29 19:58:04 +01:00
Peter John Hartman
88150ae786 Added hook for contextual menu 2021-11-29 19:42:21 +01:00
Peter John Hartman
ceac383fb0 Add options for firefox
Fullscreen at least is pretty useful.  I use homepages still so I find
that useful :P

Signed-off-by: Stacy Harper <contact@stacyharper.net>
2021-11-29 19:27:52 +01:00
baroque
4c55bc9bae move "save and quit" as first entry in vi/vis contextual menu, as for it is clearly the most used option, and the one you want to have handy, especially when typing sms.
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-11-27 23:02:49 +01:00
Sam Bowlby
a9f1d5f213 add appmenu for Zathura
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-11-27 15:56:05 +01:00
Stacy Harper
59e241d891 Fix a bug when the contact name got colons
We now use a sed command instead of cut cause it cannot strip only the
last part.
2021-11-23 18:53:19 +01:00
Peter John Hartman
5d57e1e164 Suspend should off then crust, not lock then crust.
For aesthetic reasons.  Also, bizarrely, this problem:

https://todo.sr.ht/~mil/sxmo-tickets/218

is resolved by changing to off then crust rather than lock then crust.
(No idea why because on my pinephone lock then crust works fine.)

Signed-off-by: Stacy Harper <contact@stacyharper.net>
2021-11-23 18:34:13 +01:00
Stacy Harper
841b8894f2 Move defaults apps to a dedicated hook
This make it easier for user to override it with this template. Plus, it
fix a bug we had with the user hook usage (missing parenthesis).

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Anjandev Momi <anjan@momi.ca>
2021-11-20 20:33:35 -05:00
Stacy Harper
235dbc9bf6 Fix the broken apps list when using the user hook 2021-11-11 15:21:52 +01:00
Anjandev Momi
df3dc3f788 bluetooth: always show in menu item but warn users and tell them what they need to install
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-11-03 11:30:20 +01:00
Peter John Hartman
19b7815378 Only display View Attachments if dir exists and also move down a little in menu options.
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-11-01 15:29:51 +01:00
Stacy Harper
f61c5a872a Add a mms config menu 2021-10-31 17:46:25 +01:00
Stacy Harper
afe6abef8e MMS Support
In sxmo_modemmonitor.sh checkfornewtexts() we should skip MMS and SMS WAPs,
which will be SMS messages with text of "--" or no TEXTDATA at all.   Hence,
there are a couple small checks in checkfornewtexts() to do that.

As well, there is a further dbus-monitor call in sxmo_modemmonitor.sh that
monitors org.ofono.mms.Service for 'MessageAdded' to process a new MMS messages.

Most of the action happens in sxmo_modemmonitor.sh processmms().

An MMS message might be either a message with an attachment to one recipient
OR a message with multiple recipients ('Group Chat') and no attachments (or
some attachments).

Attachments get placed in ~/.local/share/sxmo/modem/$PHONENUMBER/attachments/.
They are named $PAYLOAD.jpeg, $PAYLOAD.mp3, etc., where $PAYLOAD is the unique
id that mmsd-tng assigns the mms and stores in ~/.mms/modemanager/.  (Note that
since the PAYLOAD file remains on the filesystem, we could just re-extract the
attachments whenever we want them.  This might be an improvement down the road.)

If there are multiple recipients, we will make a "unique" new phone number out
of *all* the numbers involved (to and from) for each group chat.  For instance,
if you and Bob and Suzie are on a group chat you will have a number like
+15551234567+16661234567+17771234567 in ~/.local/share/sxmo/modem. You can
treat this like a normal number (i.e., give it a contact name, reply to it,
etc.)

Once an MMS message has arrived, one notification will be made like normal.

If there are attachments, clicking on the notification will open them all using
sxmo_open.sh.

You can also go to the message (via Texts) and click View Attachments to run
sxmo_files.sh on the attachments directory.

You can also Add an attachment when you compose a message.  There is a basic
ability to Delete attachments too.

I've also reversed the contact lists so the CONTACTNAME is on the left and PHONENUMBER on
the right, otherwise with large phonenumbers it was hard to see who the CONTACTNAME is.

=== MMSD-TNG CONFIGURATION TIPS AND TRIPS ===

sxmo's mms requires mmsd-tng that includes the mmsctl program.  Right now, this is
in the latest git head.  See https://gitlab.com/kop316/mmsd/-/merge_requests/52.
To compile with this on edit meson_options.txt and set mmsctl to true.  Then build as normal
via mmsd-tng's README.  (We can also just do: gcc -o mmsctl mmsctl.c -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -ldbus-1 -ljson-c)

sxmo's mms does not require any configuration on top of what is needed to get mmsd-tng to work.
However, mmsd-tng can be a bit of a tricky thing to confugre, so here are some tips:

1. mmsd-tng includes example configurations in its README. A helpful list is here:
https://gitlab.gnome.org/GNOME/mobile-broadband-provider-info

Here is an example (works with "Mint Mobile" which uses T-Mobile):

~/.mms/modemmanager/mms

[Modem Manager]
CarrierMMSC=http://wholesale.mmsmvno.com/mms/wapenc
MMS_APN=Ultra
CarrierMMSProxy=NULL
DefaultModemNumber=NULL
AutoProcessOnConnection=true
AutoProcessSMSWAP=true

[Settings]
UseDeliveryReports=false
AutoCreateSMIL=false
ForceCAres=false
TotalMaxAttachmentSize=1100000
MaxAttachments=25

2. mmsd-tng must use the *modem's* dns to resolve mms files.  Since
NetworkManager rewrites /etc/resolv.conf with both wifi and modem active, I
found it easiest to have a static /etc/resolv.conf and to set
/etc/NetworkManager/NetworkManager.conf dns=none.
2021-10-31 10:57:13 +01:00
Zach DeCook
3155edded2 SMS: Fix unquoted grep input
Signed-off-by: Anjandev Momi <anjan@momi.ca>
2021-10-24 01:38:08 -04:00
Peter John Hartman
ed1ff12a5f update icon in contact add
oops forgot the icon!

Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-10-22 19:12:13 +02:00
Peter John Hartman
9c86b7a0a7 contact add
allow us to add to contacts

Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-10-22 19:12:00 +02:00
Zach DeCook
576550451d Screenshot: Copy path to clipboard in wayland, rework script for better error detection
also, ostensibly fix clipboard copying for x

Signed-off-by: Stacy Harper <contact@stacyharper.net>
2021-10-21 11:54:45 +02:00
Anjandev Momi
78b2f1773d drop sudo for doas
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-10-20 23:10:21 +02:00
Stacy Harper
07445f3d03 Rework screen lock
The main goal of this patch is to simplify the locking and unlocking
flow in sxmo.

The idea is to manage effectively and with ease the screenlock state
with only one button.

Pressing power button will rotate the screen lock from

unlock -> off -> lock -> unlock -> …

You can also double power button to jump in the target state
faster. Example :

unlock -> [double power] -> lock
off -> [double power] -> unlock
lock -> [double power] -> off

In short, this is the same circle in reverse order.

Some of the other inputs has been changed to make this coherent.

in short:

VOLUP: 1 = menu; 2 = sysmenu; 3 = list all windows;
VOLDOWN: 1 = keyboard; 2 = change window; layout 3 = close/kill windows;
POWER: 1 = deeper lock; 2 = higher lock; 3 = open a terminal

As you can see, we cannot suspend with only the power button.

To access suspension, we rely on swayidle/xprintidle to rotate the
screen lock from

lock -> off -> crust (8 seconds the first step, then 8 seconds for the
second)

So buttons will wake the phone up and idle will make the phone to sleep,
step by step.

With this behavior, you can run a video with mpv then double power to
lock the screen (blue led). Swayidle will not off then suspend cause mpv
is an idle inhibitor by itself.

While in crust, the powerbutton will then "uncrust" and the action will
still be handled by sxmo to move you back to "lock". Waiting 8 seconds
will move you to "off" then 8 additional seconds to go back to "crust".

I also added a hook to detect and disable the idle daemon in some cases
(mpc playing, proximity lock on, ssh session active). It is a hook the
user can override and extends.

I added a simple script to have some sort of swayidle on xorg for
backward compatibility.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-10-20 23:09:06 +02:00
Nathaniel Barragan
d8b64fd6aa Fix looping behavior
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2021-10-18 08:27:49 +02:00
Maarten van Gompel
3a4c07aadd Added a "version" entry to the config menu to show the sxmo version
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2021-10-17 16:07:19 +02:00
Stacy Harper
7509fcf2ce Allow the userscripts to be a file instead of a folder
At this moment, we list the files in .config/sxmo/userscripts/ to add
entries on the Userscripts submenu.

This way we cannot customize the entry label cause the script filename
will be the displayed entry. So we cannot use icons or emojies in the
label.

With this patch, we can use a plain text file located at
~/.config/sxmo/userscripts as appmenu entries, instead of a directory at
this same location.

This file can be formated like this:

 AddEvent ^ 0 ^ ~/bin/add_event
 Mail     ^ 0 ^ ~/bin/mail
 Weather  ^ 0 ^ sxmo_terminal.sh -f "monospace:size=5" sh -c "curl http://wttr.in/ | less -SR"

This allow the entry name to be different from the command it runs.
This also allow icons in the entries.
This also allow single line little scripts.

This patch still allow the current behavior with directory listing. The
location can be either a file, or a folder.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-10-08 21:32:08 +02:00
baroque
9b2494c6ae Added delay in vi/vis/vim menu commands in appmenu
adding -s 300 after -k Escape seems to give vis/vim/vi time to enter
command mode and be able to receive the commands (wq, etc.) otherwise
it didnt work.

Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-10-08 21:29:30 +02:00
Stacy Harper
30bc339420 Add a conversation loop to convers with contact by sms
Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-10-08 21:23:29 +02:00
git@jonathanh.co.uk
c33e54e0b0 Fixes the Modem Reset / Restart in config menu
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2021-09-30 15:55:42 +02:00
Anjandev Momi
0faa65d5be sxmo_appmenu.sh: add pulsemixer to app menu
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-09-19 13:14:45 +02:00
Anjandev Momi
d66e57384b sxmo_appmenu: add gnome chess
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-09-19 13:12:53 +02:00
baroque
8f900c29f8 moved flashlight to main menu, out of "configuration" (that is crowded already)
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-08-30 22:26:13 +02:00
baroque
80c656f3ad added Marble in the apps.
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-08-30 22:25:58 +02:00
baroque
9e058e546d added || pkill sway after pkill dwm in "logout"
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-08-30 22:25:53 +02:00
Sam Bowlby
657fbd85ba added new appmenu items; tests for wm for some apps
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2021-08-30 08:04:20 +02:00
Sam Bowlby
ac34711bc3 fixed appmenu for Foot shortcuts
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2021-08-29 15:06:34 +02:00
Stacy Harper
9f6af8abcc Fix appmenu.sh in ssh mode
We had issue in ssh mode and this new bemenu curses mode.

No issue on other sxmo menu that use successive bemnu but this appmenu
loop displaying some ~F char when you select a subentry.

I refactorised a little bit this script and now it works well. I'm not
stil not sure of what was causing this.

By the way I changed some echo for printf. I also added the wrap
argument for bemenu in ssh mode.
2021-08-25 13:29:59 +02:00
Maarten van Gompel
64e7140501 shellcheck fixes 2021-08-25 13:01:24 +02:00