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
See this writeup to understand how calling works.
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 send an SMS via command line (or ssh)
cat mysupersmsfile | sxmo_modemsendsms.sh +33123123123 -
Where to Delete SMS
.local/share/sxmo/modem/<sender>/sms.txt
How to call from the command line
Example:
sxmo_modemdial.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 activate data
In menu under Networks select Add a GSM. Enter the APN settings for your carrier.
find a list here.
How to find Operator Name and other Infos
mmcli -m any
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 its 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 modem manager
- Restart modem manager 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 modem manager in debug mode, then run:
sudo /sbin/rc-service modemmanager start
Retrieving signal strength information
See here.
Block Numbers
create:
~/.config/sxmo/block.tsv
and add the numbers to block: blockedcontactnumber TAB blockedcontactname
there will be no notifications
Create 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 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 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 with the following commands:
git clone https://github.com/gled-rs/cvf2csv.git && cd cvf2csv && pip install 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
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.
Move it to where it belongs:
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 with your time in seconds:
export SXMO_UNLOCK_IDLE_TIME="30"
in
~/.config/sxmo/profile
How to display the percentage of battery
along with the icon in the status bar, add:
export SXMO_BAR_SHOW_BAT_PER=1
in ~/.config/sxmo/profile
on the homescreen, add:
${alignc}${font goto:size=22:style=Bold}${exec echo "Power: "}${exec upower -d | grep -m1 'percentage:' | awk '{print $2}'}
in ~/.config/sxmo/conky.conf
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'"
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 & Special Keys
Umlauts: Cmp
followed by the according letter.
e.g.
ä => AGr
+ a
F keys with AGr-N
e.g.
F10
=> AGr
+ 0
(F11 + F12 don't exist)
€ => AGr
+ -
£ => AGr
+ =
How to change 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.
How to launch programms on startup?
If you run dwm, edit:
~/.config/sxmo/xinit
If you run sway, edit:
~/.config/sxmo/sway
Instead, you can also copy
cp /usr/share/sxmo/default_hooks/start ~/.config/sxmo/hooks/start
and edit that file.
NOTE:
Make sure to make it executable
chmod +x ~/.config/smxo/hooks/start
How to set screen brightness on start
add:
/usr/bin/sxmo_brightness.sh setvalue 50
to the bottom of:
/usr/share/sxmo/default_hooks/s
xmo_hook_start.sh
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
- 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 pmOS 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 pmOS device's address). If you're running DNSmasq, you may also use that for DNS server, otherwise set DNS server to your favorite server.
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
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 https://todo.sr.ht/~mil/sxmo-tickets/494 and https://man.archlinux.org/man/sway-bar.5.en
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 file /etc/udev/rules.d/99-sxmo-led.rules
with the following contents:
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 this mr https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/4758 and there were not any ideal solutions discovered.
Applications 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 you create a desktopfile for loupe in:
nano ~/.local/share/applications/loupe.desktop
containing:
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 &
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 sim.
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.
See https://wiki.postmarketos.org/wiki/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
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 the 'bottomleftcorner' swipe 'set lock' screen gesture in sxmo_hook_inputhandler.sh to prevent locking while unlocking....
If you use the x11 version you can use https://codeberg.org/jackc/smlock instead.
It should be started in sxmo_hook_unlock.sh hook because it will take input and therefore you cannot exit screenoff state (no touchscreen).
Make sure to have https://pkgs.alpinelinux.org/package/edge/main/x86_64/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 sxmo_notificationwrite.sh random nheko none "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
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/sxmo_hook_apps.sh
to
~/.config/sxmo/hooks/sxmo_hook_apps.sh
and edit that file.
List all available icons for the hook entry
cat /usr/share/sxmo/default_hooks/sxmo_hook_icons.sh
Customize Gestures
Mdify gestures/swipes and button presses in:
~/.config/sxmo/hooks/sxmo_hook_lisgdstart.sh
more details about this topic here.
Errors
after an upgrade
if something is not working anymore after you updated the system, for example errors like:
Error: Connection activation
failed: No suitable device found
for this connection (device usb0
not available because profile is n..
try:
sudo apk fix
and then reboot.