Sxmo/Tips and Tricks

From postmarketOS
Jump to navigation Jump to search

Here is a growing list of tips, tricks and configuration snippets for using Sxmo.

This pages is intended to focus mostly on "non-core" issues, such as running apps and everyday usability. The core configuration issues should end up in sxmo doc, as discussed on https://todo.sr.ht/~mil/sxmo-tickets/275


Calls, SMS, Modem

Sometimes Modem gets stuck

Sometimes the modem does not respond, stops receiving/sending calls, etc.

Preferred solution: toggle 'Modem Daemons' in the menu under 'Config'.

Reliable solution: reboot.

Sometimes SMS dont get sent/received

The latest biktorgj firmware (0.5.3) should address this situation. Alternatively, check for stuck sms and delete them:

  1. mmcli --modem any --messaging-list-sms
    mmcli --modem 0 --sms 0
    mmcli --modem 0 --messaging-delete-sms=##
    mmcli --modem 0 -r
    The identifying number of the modem may vary, being incremented upon toggles and sometimes reboots. you probably also can use: --modem any

How to send an SMS via command line (or ssh)

cat mysupersmsfile | sxmo_modemsendsms.sh +33123123123 -

How to call from the command line

Example:

sxmo_modeldial.sh 08003301000


How to change SIM pin

From 1234 to 1010:

mmcli -i any --pin=1234 --change-pin=1010

Disabling:

mmcli -i any --pin=1010 --disable-pin

How to send USSD

Try something like:

mmcli -m any --3gpp-ussd-initiate="*100#"


How to send AT command

Directly

  1. If desired monitor output as root:
    cat /dev/ttyUSB2
  2. In another terminal, send the command, in this example to check the ADSP firmware version:
    echo -ne "AT+QGMR\r" >/dev/ttyUSB2

Through modem manager

  1. Restart modem manager in debug mode:
    sudo /sbin/rc-service modemmanager stop
    sudo /usr/sbin/ModemManager --debug
  2. In another terminal, send the command, in this example to check the ADSP firmware version:
    mmcli -m any --command="AT+QGMR"
  3. Stop modem manager in debug mode, then run:
    sudo /sbin/rc-service modemmanager start

Retrieving signal strength information

See https://wiki.postmarketos.org/wiki/Modem#ModemManager

Create contacts.tsv for Sxmo from Android data

This assumes you have developer mode enabled on your phone and usb debugging using adb.

I messed around with different API calls, I store the contacts locally on the device, what worked for me to get the full set of phone numbers was:

adb shell content query --uri content://com.android.contacts/data --projection display_name:data1:data3:data4 | grep '[0-9]\{10\}' | grep -v gprofile > raw_contacts

`create_contact_tsv.py` depends on python package `phonenumbers`, please install it.

then run on the terminal

python3 create_contacts_tsv.py raw_contacts | sort | uniq > contacts.tsv

For completeness, entire content of the python file `create_contact_tsv.py`

import csv, sys, phonenumbers as p; with open(sys.argv[1], 'r') as file:

 reader = csv.reader(file)
 for row in reader:
   name = row[0][str(row[0]).find("=") + 1:]
   for match in p.PhoneNumberMatcher(str(row), None):
     number = p.format_number(match.number, p.PhoneNumberFormat.E164)
     print(number + "\t" + name)

Create contacts.tsv for Sxmo from a vcard export ( vcf export from nextcloud for example )

We can convert an export in vcard format of a contact list to a file sxmo can work with with the following commands:

git clone https://github.com/gled-rs/cvf2csv.git && cd cvf2csv && pip install phonenumbers

Put the vcard export you downloaded in the same directory as the convert.py script, name it contacts.vcf Look at README.md if you want to change the default behaviour of the convert script.

python convert.py && cp contacts.csv ~/.config/sxmo/contacts.tsv

General configuration

How to easily change the size of the text, system-wide?

Change the value in: /usr/share/sxmo/appcfg/xresources_xft.xr (try 160!)

Xft.dpi: 192

(chaning it in ~/.Xresources works as well)


if you remove the dpi line there you can set dpi on the fly via

xrandr --dpi x

How to change the keyboard layouts? (wvkbd/wayland)?

edit your .config/sxmo/profile and add default command lines options for wvkbd like this:

export KEYBOARD_ARGS="-l full,special -H 200 -fn 'Hack 11'"


How to activate data

In menu under Networks select 'Add a GSM'.

How to launch programms on startup?

If you run dwm, then edit ~/.config/sxmo/xinit. If you run sway, then edit ~/.config/sxmo/sway. In either case, you can also copy over /usr/share/sxmo/default_hooks/start to ~/.config/sxmo/hooks/start and edit that file. NOTE: Make sure you chmod +x ~/.config/smxo/hooks/start.

mount /tmp/ in RAM, to save write cycles on storage device

add the following in /etc/fstab

tmpfs /tmp tmpfs rw,nodev 0 0

Help with adding cronjobs

You can edit your crontab via

crontab -e

This website https://crontab.guru/ has proven useful in making cronjobs.

If using mnc, make sure that commands run via sxmo_rtcwake.sh.

Example:

55-59/2 7 * * 1-5 sxmo_rtcwake.sh /home/user/script

How to customize the colours/fonts of the interface?

xorg/dwm

Get example in the alpine blooms theme by Tetrakist, as entries to add in /home/user/.Xresources

wayland/sway

  • .config/sxmo/sway
  • bemenu parameters through BEMENU_OPTS env variable. for instance in .profile:

export BEMENU_OPTS="--fn 'FiraMono Nerd Font 13' --tf '$MYCOLOR' --tb '#00000090' --nb '#00000090' --nf '$MYCOLOR' --hb '$MYCOLOR' --hf '#000000' --sb '$MYCOLOR' --sf '$MYCOLOR' --scb '#000000' --scf '$MYCOLOR' "

  • mako config in .config/mako/config

Some notifications stay stuck on the screen!

If in dwm:

pkill dunst

If in sway:

pkill mako


A simple way to share sxmo's connection through USB (aka "USB tethering")

Select 'Networks' in the menu and add a USB hotspot.

Where can i read logs for sxmo?

try less /home/user/.local/state/tinydm.log or tail -f /home/user/.local/state/tinydm.log

or logread -f for the generic pmOS log, that also displays some of sxmo deamons (modemmanager, etc.) information

Applications specific

What to use for cartography/navigation?

Pure-maps sort of works (using OpenTopo or Sputnik tiles), as well as Marble (QT/KDE, heavy...). Unsure yet how to make the GPS work for both of these, but it has reported being feasible...

Apparently a good start to enable GPS should be:

sudo /etc/gpsd/device-hook "" ACTIVATE

Also, Mepo, under heavy development, seems promising, and seems already packaged for alpine/postmarketOs in its alpha versions.

See https://wiki.postmarketos.org/wiki/Applications_by_category#Geography for geography applications.

QT app (vlc-qt, etc.) doesnt fit the screen!

try adding the following in your .config/sxmo/xinit

export QT_AUTO_SCREEN_SCALE_FACTOR=1 export QT_SCALE_FACTOR=0.7

(change the factor until it suits your need)

Cmus: the application related bemenu is not loaded as soon as a song is played.

change the title of the terminal in the cmus config file $XDG_CONFIG_HOME/cmus/rc to contain the string "cmus":

echo "set format_title= %a %t %c cmus" >> .config/cmus/rc

Flatpak

If you use Flatpak apps, you probably will have problems with sound. That is because Flatpak requires a PulseAudio-compatible sound server, but SXMO uses by default only ALSA. To install and setup PipeWire as well as its PulseAudio implementation, please refer to SXMO's documentation.

NB: it seems that as of latest (1.8.2 at time of writing), pipewire now comes as default in sxmo

Extra features, advanced tweaking

A Wayland version of Sxmo, really??

Yes. Really! It's the default now. Use WM Toggle in the menu under 'Power' to toggle between dwm and sway.

How to Add Apps to the List?

Copy /usr/share/sxmo/default_hooks/apps ~/.config/sxmo/hooks/apps and edit that file. NOTE: make sure you chmod +x ~/.config/sxmo/hooks/apps