User:FerassElHafidi/Dogfooding:Pocophone F1

From postmarketOS Wiki

Notes on using postmarketOS and Sxmo on my daily driver phone.

Also checkout magdesign's very extensive notes/wiki page: User:Magdesign

Here's my setup:

  • Device: Pocophone F1 (tianma)
  • postmarketOS version: Edge
  • UI: Sxmo (sway)

What I do:

  • Phone calls
  • Taking pictures sometimes
  • IRC and XMPP chatting
  • Web browsing
  • Listening to music
  • etc

Modem

Phone calls do work, but sound/microphone may be broken. To fix this we need to switch to PulseAudio:

$ sudo apk add sxmo-utils-audio-pulseaudio
$ sudo apk del sxmo-utils-audio-pipewire
$ sudo apk del pipewire-pulse
$ sudo apk del wireplumber

Then reboot.

If you're still having issues: microphone seems to be broken in the alsa-UCM, requiring pmaports!5860 (thanks to fraolt in the #postmarketos-devel chat!).

After that you should have working calls with audio and microphone!

Sadly I could not get dual SIMs to work however, but I could still use the second slot.

Audio

Works fine with PulseAudio, however headphones detection seems a bit broken. Here's a workaround (source):

  • Launch Pavucontrol
  • Set the output of the wanted app (e.g. mpv) to headphones
  • You should now have sound coming from the headphones!

Waydroid

I have to use some Android-only apps on my phone, so I have Waydroid setup. It worked out of the box, and I have installed F-Droid there. A lot of it works really well, and is smooth.

However on first startup the window size was small, so I used the following commands to resize it:

$ waydroid prop set persist.waydroid.height 835
$ waydroid prop set persist.waydroid.width 470

My sway scaling is set to 2.3 but might be different for you.

I also disabled Android's animations. You can do this in the developer options.

Note that networking may not work before doing a reboot.

I also have a small script to launch apps on Waydroid easily:

#!/bin/sh
# title="$icon_and Waydroid app launcher"
# Author: Ferass El Hafidi
# License: MIT

app_list="$(waydroid app list | grep "packageName" | sed "s/packageName: //")"
if [ ! -n "$app_list" ]; then
        sel=$(printf "Close\n" "$app_list" | sxmo_dmenu.sh -i -p "Waydroid session not running")   
else    
        sel=$(printf "%s\nClose\n" "$app_list" | sxmo_dmenu.sh -i -p Waydroid)              
        if [ "$sel" = "Close" ]; then  
                exit  
        else    
                waydroid app launch "$sel"
        fi
fi

Not perfect, but gets the job done.

Wi-Fi

Wi-Fi works fine with 2.4 GHz networks but not for 5 GHz ones yet, the latter having very poor reception and often failing to connect at all. My router is setup to have the 2.4 GHz Wi-Fi and 5 GHz Wi-Fi under the same SSID, however, which may be an issue because the phone seems to prefer 5 GHz oftentimes. To force 2.4 GHz this trick can be used:

List all available access points:

$ nmcli -f in-use,ssid,freq,bssid,bars dev wifi | cat
IN-USE  SSID              FREQ      BSSID              BARS 
        MyWiFi            2437 MHz  AB:CD:EF:12:56:1F  ▂▄▆█ 
        MyWiFi            5240 MHz  AB:CD:EF:12:56:14  ▂▄▆_ 
        MyWiFi            2412 MHz  AB:CD:EF:12:56:23  ▂▄▆█ 
        MyWiFi            5170 MHz  AB:CD:EF:12:56:58  ▂____ 
        MyWiFi            2437 MHz  AB:CD:EF:12:56:FA  ▂▄___

Choose from one of these access points (look at the FREQ column) and note the BSSID (e.g. AB:CD:EF:12:56:FA).

Now you can connect to it:

$ nmcli dev wifi connect BSSID [password <password>]

Or, if you already saved the password you can modify the existing connection:

$ nmtui

Edit a connection -> Select your Wi-Fi -> Edit -> Enter the BSSID in the "BSSID" field

Now you should be connected to your access point!

The notch

The big notch may obstruct the UI, especially when using Sxmo. I have tried adding a string to the statusbar, and moving the bar down. Both of these solutions are not perfect in my opinion:

  • The first option is hacky and breaks when there are less icons present
  • The second option renders the area with the notch unused

I wanted to make efficient use of the remaining space, so what I have done is have two sway bars: one at the top, and one at the bottom. The one at the top has the time and workspace numbers, while the bottom has the sxmobar.

So I have something similar to this in my sway config:

bar {
    position bottom

    font "Iosevka Nerd Font 16"
    height 38

    pango_markup enabled
    # When the status_command prints a new line to stdout, swaybar updates.
    # The default just shows the current date and time.
    status_command sxmo_status_watch.sh -o pango

    workspace_buttons no
    tray_output none

    workspace_min_width 35 px

    colors {
        statusline $foreground
        background $background
        focused_workspace $color1 $color1 $background
        active_workspace  $foreground $foreground $background
        inactive_workspace $background $background $color15
        # focused_workspace $color3 $color3 $background
        # active_workspace  $color14 $color14 $background
        # inactive_workspace $background $background $foreground
    }
}
bar {
    position top

    font "Iosevka Nerd Font 16"
    height 38

    # When the status_command prints a new line to stdout, swaybar updates.
    # The default just shows the current date and time.
    status_command while date +"%H:%M   "; do sleep 1; date +"%H %M   "; sleep 1; done

    binding_mode_indicator no

    workspace_min_width 30 px

    colors {
        statusline $foreground
        background $background
        focused_workspace $color1 $color1 $background
        active_workspace  $foreground $foreground $background
        inactive_workspace $background $background $color15
        # focused_workspace $color3 $color3 $background
        # active_workspace  $color14 $color14 $background
        # inactive_workspace $background $background $foreground
    }
}