Sxmo/Tips and Tricks
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
- To send an SMS via command line (or SSH)
$ cat mysupersmsfile | sxmo_modemsendsms.sh +33123123123 -
- SMS messages are stored in
.local/share/sxmo/modem/<sender>/sms.txt - To call from the command line, run
$ sxmo_modemdial.sh <number> - To change the SIM pin (in this example from 1234 to 1010): Then disable the old pin with
$ mmcli -i any --pin=1234 --change-pin=1010
$ mmcli -i any --pin=1010 --disable-pin
- To find the name of the Operator and other details, run
$ mmcli -m any.
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 messages aren't sent/received
The latest biktorgj firmware (0.5.3) should address this situation. Alternatively, check for stuck SMS and delete them:
$ 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 activate data
In the menu under Networks, select Add a GSM. Enter the APN settings for your carrier. A list is available in the PINE64 Wiki.
How to enable Roaming
This is not clear yet. Test if roaming is enabled with:
$ mmcli --modem=0 --bearer=0
Edit the .connection file and add: allow-roaming=true
Since v1.20 it's called MMBearerRoamingAllowance, see more info here. We should really solve this puzzle.
How to send USSD
Try something like:
$ mmcli -m any --3gpp-ussd-initiate="*100#"
How to send AT command
Directly
- If desired monitor output as root:
$ cat /dev/ttyUSB2
- In another terminal, send the command, in this example to check the ADSP firmware version:
$ echo -ne "AT+QGMR\r" >/dev/ttyUSB2
Through ModemManager
- Restart ModemManager in debug mode:
$ sudo /sbin/rc-service modemmanager stop $ sudo /usr/sbin/ModemManager --debug
- In another terminal, send the command, in this example to check the ADSP firmware version:
$ mmcli -m any --command="AT+QGMR"
- Stop ModemManager in debug mode, then run:
$ sudo /sbin/rc-service modemmanager start
Retrieving signal strength information
Block Numbers
Create a block.tsv file in the following directory:
$ touch ~/.config/sxmo/block.tsv
Then add the numbers to block: blockedcontactnumber TAB blockedcontactname
There will be no notifications.
Creating contacts.tsv
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 the Python package phonenumbers, please install it.
Then run
$ python3 create_contacts_tsv.py raw_contacts | sort | uniq > contacts.tsv
For completeness, below is the 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)
From vCard export (e.g. vcf export from Nextcloud)
We can convert an export in vCard format of a contact list to a file, work with the following commands:
$ git clone https://github.com/gled-rs/cvf2csv.git
$ cd cvf2csv
$ pip install phonenumbers
Or install the package from the repo:
$ apk add py3-phonenumbers
Put the downloaded vCard export into the same directory as the convert.py script and name it contacts.vcf.
See README.md to change the default behaviour of the convert script.
$ python convert.py
$ cp contacts.csv ~/.config/sxmo/contacts.tsv
General configuration
- Sxmo logs are stored in
/home/user/.local/state/tinydm.log. Some daemon information is also available inlogread -f.
Set Darkmode
For GNOME apps:
$ gsettings set org.gnome.desktop.interface color-scheme prefer-dark
For KDE Plasma Mobile apps:
$ sudo apk add plasma-integration
$ sudo apk add qqc2-breeze-style
Get the style file here, and move it with
$ mv kdeglobals ~/.config.
Now we need to set the environment variables (not sure if we need this, pasted once into terminal):
QT_QUICK_CONTROLS_STYLE=org.kde.breeze
QT_QPA_PLATFORMTHEME=kde
For Flatpaks
some flatpaks just refuse to run in dark mode, edit the launcher of each flatpak to contain the dark theme like this:
flatpak run --env=GTK_THEME=Adwaita-dark org.gnome.Fractal
GTK Apps can be forced with a prefix:
GTK_THEME=Adwaita:dark application
How change idle/suspend time
Add the following line in ~/.config/sxmo/profile: (in this example, it's set to 30 seconds)
export SXMO_UNLOCK_IDLE_TIME="30"
How to display the battery percentage
Along with the icon in the status bar, add the following in ~/.config/sxmo/profile:
export SXMO_BAR_SHOW_BAT_PER=1
For the homescreen, add the following in ~/.config/sxmo/conky.conf:
${alignc}${font goto:size=22:style=Bold}${exec echo "Power: "}${exec upower -d | grep -m1 'percentage:' | awk '{print $2}'}
Changing the system-wide text size
Change the value in /usr/share/sxmo/appcfg/xresources_xft.xr: (try 160!)
Xft.dpi: 192
Changing 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'"
To see a list of possible options for KEYBOARD_ARGS, enter:
$ wvkbd-mobintl --help
Possible keyboard layouts for option -l are: Full, Special, Emoji, Simple, SimpleGrid, Nav, Dialer, Cyrillic, Arabic, Persian, Greek, and Georgian.
How to type Umlauts and special characters
- Umlaut → + Corresponding letter
- e.g. Ä → →
- Function keys → +
- e.g. → + ( and don't exist)
- € → +
- £ → +
Changing the size of the virtual keyboard
Edit KEYBOARD_ARGS in your ~/.config/sxmo/profile and add -H <height> to change the portrait height, -L <height> to change the landscape height.
Launching programms on startup
- If you run dwm, edit
~/.config/sxmo/xinit. - If you run sway, edit
~/.config/sxmo/sway.
You can also copy and edit the following file:
$ cp /usr/share/sxmo/default_hooks/start ~/.config/sxmo/hooks/start
$ nano ~/.config/sxmo/hooks/start
$ chmod +x ~/.config/smxo/hooks/start
How to set screen brightness on start
Add the following line to the bottom of /usr/share/sxmo/default_hooks/sxmo_hook_start.sh:
/usr/bin/sxmo_brightness.sh setvalue 50
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. 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
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
- In depth guide on editing colors in Sway, bemenu, Foot, and wvkbd with all color options detailed. At the bottom of the guide is the link to a script which will do it all for you once you set the colors.
Some notifications stay stuck on the screen!
- If in dwm:
pkill dunst - If in sway:
pkill mako
Select 'Networks' in the menu and add a USB hotspot.
On your connecting device, you may need to configure IPv4 configuration manually, as your Nura device is not going to act as a DHCP server by default.
Set "Addresses" to 10.42.0.2/24, and set Gateway to 10.42.0.1 (which is your Nura device's address). If you're running dnsmasq, you may also use that for DNS server, otherwise set the DNS server to your favorite server.
Move sxmo's bar below your phone's notch
Find the bar entry in ~/.config/sxmo/sway and add a gaps configuration to it:
bar { gaps 42 0 }
See ~mil/sxmo-tickets#494 and Sway's man pages.
Working around the Notch
By filling in some useless items in the notch area. If not already done,
$ cp /usr/share/sxmo/default_hooks/sxmo_hook_statusbar.sh ~/.config/sxmo/hooks/
Then add a few ooooo between the battery and the wifi symbol just above the line containing
sxmobar -a -f "$fgcolor" -b "$bgcolor" -t "$style" \
with adding this line to the hook:
sxmobar -a notch 22 oooooooooo
Then disable tray icons in swaybar:
$ nano ~/.config/sxmo/sway
Scroll down to the Status Bar: section and just below position top add:
tray_output none
Then reboot and enjoy.
LED blinking not working with feedbackd
When postmarketos-default-camera is installed, it adds a udev rule that changes ownership of the LED devices to the feedbackd group. This means the default user won't have permissions to use the LEDs on a clean install. This only occurs on devices with a working camera (i.e. PinePhone).
The simplest workaround is to add your user to the feedbackd group:
$ sudo adduser $(whoami) feedbackd
An alternative option is to add a udev rule to override this behavior.
Create the following file:
/etc/udev/rules.d/99-sxmo-led.rules
ACTION=="add|change", SUBSYSTEM=="leds", DEVPATH=="*/*:status", RUN+="/bin/chgrp input /sys$devpath/brightness /sys$devpath/pattern /sys$devpath/repeat" ACTION=="add|change", SUBSYSTEM=="leds", DEVPATH=="*/*:indicator", RUN+="/bin/chgrp input /sys$devpath/brightness /sys$devpath/pattern /sys$devpath/repeat"
This was discussed in pmaports!4758 and no ideal solutions were discovered.
Application-specific
Set default applications
e.g. Define which app opens images:
sudo nano mimeapps.list
edit:
image/png=loupe.desktop
image/jpg=loupe.desktop
Make sure to create a desktop file for Loupe in .local:
~/.local/share/applications/loupe.desktop
[Desktop Entry] Type=Application Terminal=false Exec=/usr/bin/loupe Name=loupe MimeType=image/png;image/jpg
Osmin, Pure-Maps, Mepo
To use navigation properly, first enable GPS:
$ mmcli -m any --location-enable-gps-nmea
$ mmcli -m any --location-enable-gps-raw
$ mmcli -m any --location-get
$ /usr/libexec/geoclue-2.0/demos/agent > /dev/null 2>&1 &
Get the userscript here.
In the time of writing, you need to have a SIM card inserted, but you can manually compile a newer ModemManager and enable GNSS to have GPS without a SIM card.
Get launchscripts for Osmin and Pure-Maps here.
Pure-Maps comes with osmscout-server. After install, execute osmscout-server-gui and download some maps.
In Pure-Maps you need to get API-keys by registering on all the map provider services and enter them in settings, it takes a moment, but is easy. For Offline Navigation, first launch osmscout-server, wait a few seconds, then launch Pure-Maps.
Also see the Documentation.
See Applications by category#Geography for geography applications.
Mepo also needs mepo-scripts to be installed, otherwhise menu will not work. To make the menu bigger, rotate 3 fingers on the screen.
Krita
Works very well for image editing.
Load this custom workspace to ~/.local/share/krita/workspaces/ and select in krita in landscape view: Windows => Workspaces => krita_phone.kws
Launch krita without splash krita --nosplash
if you customized an even nicer workspace, please contribute.
Kdenlive
When it is not availiable via repo, install it via flathub!
For video editing in portrait mode, you need to do following modifications:
Go to View => Manage Layouts and import the phn layout.
Make sure to delete all other layouts to get space for the menu.
Turn your phone layout to landscape (you might prior switch scaling to 2) and go to:
Settings => Configure Toolbars => TimelineToolbar
In the right window, remove:
- Track Menu
- Timeline Edit Menu
- Separator
Remove everything after the Timecode 00:00:00:00
After the Spacer Tool, add:
- Favorite Effects
- Delete Selected Item
- Insert Track...
Under the View menu, enable only:
- Media Browser
- Clip Monitor
- Project Monitor
- Project Bin
- Timeline
Now give it a try. The File => New dialog is still challenging and might need scaling:
QT app doesn't fit the screen (scaling)
With sway, scaling can be achieved via cmd line:
swaymsg output \"DSI-1\" scale 2
or 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)
You can also copy https://git.sr.ht/~anjan/sxmo-userscripts/tree/master/item/scripts/scale_display.sh to ~/.config/sxmo/userscripts/scale_display.sh
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
Flatpak File Permissions
Fractal and others can not save any content to the device until you give it permission:
flatpak override org.gnome.Fractal --filesystem=/home/me/
Foliate
Tab top edge to make the menubar visible,
Telegram Desktop
The onscreen keyboard may overlap the text input field on Wayland. See https://github.com/telegramdesktop/tdesktop/issues/3274 . As a workaround set the scaling to 1.75 or less via SXMO_SWAY_SCALE in $HOME/.config/sxmo/profile.
Additionally the window decorations can be removed via Telegram Settings > Advanced > System Integration > Use System Window Frame > Enable (restart required).
Extra features, advanced tweaking
Background
To change background wallpaper, add the path in
.config/sxmo/profile
export SXMO_BG_IMG="path"
you can also use this fancy script (default path is /usr/share/wallpapers/
Lockscreen / Screenlock
By default there is no lockscreen, you can manually add Peanutbutter.
To set your custom passcode for example to "1234" (TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT):
export PEANUTBUTTER_PASSCODE="1234"
It is highly recommended to disable inputhandler until we are unlocked. Add the following lines to the following hook, just below the variables:
/usr/share/sxmo/default_hooks/sxmo_hook_inputhandler.sh
# Check for 'peanutbutter' if pgrep -x "peanutbutter" > /dev/null; then sxmo_state.sh click 2 exit 0 fi
If you use the X11 version you can use https://codeberg.org/jackc/smlock instead.
It should be started in the sxmo_hook_unlock.sh hook because it will take input and therefore you cannot exit screenoff state (no touchscreen).
Make sure to have
mkfontscale installed.
Notifications can be displayed above and you can use the gesture to open the OSK.
Notification for all apps
You can have notification in menu with the green LED as for texts/calls. For example using a simple script you can have matrix notifications:
#!/bin/sh
# before sxmo version 1.17.0/1 you can use this
#sxmo_notificationwrite.sh random nheko none "New matrix message"
sxmo_notifs.sh new nheko "New matrix message"
Replace nheko with your client.
You need to trigger it with something, I used dunst. This is the section that I added to ~/.config/dunst/dunstrc:
[mtx_message]
appname = nheko
summary = "*"
format = ""
script = matrix_message.sh
Wayland is now the default for Sxmo. Use WM Toggle in the menu under 'Power' to toggle between dwm and sway.
Adding apps to the list
$ cp /usr/share/sxmo/default_hooks/sxmo_hook_apps.sh ~/.config/sxmo/hooks/sxmo_hook_apps.sh
Then edit the applications in the new file.
List all available icons for the hook entry
cat /usr/share/sxmo/default_hooks/sxmo_hook_icons.sh
change filechooser / filepicker
see here.
Customize Gestures
Mdify gestures/swipes and button presses in:
~/.config/sxmo/hooks/sxmo_hook_lisgdstart.sh
Errors
After an upgrade
If something is not working anymore after you updated the system, such as the following error:
Error: Connection activation failed: No suitable device found for this connection (device usb0 not available because profile is not compatible with device
Try running sudo apk fix and then reboot.