User:Fdelamotte/dogfooding
I'd like to share on this page my workarounds configurations in using sxmo on the pinephone, the oneplus6 and oneplus6t
Screen Scaling
My own personal taste : I prefer using native resolution on my devices, setting SXMO_SWAY_SCALE to 1 in my profile.
I then configure my apps individually (or the toolkits) to show correctly on my phone.
It works well with SDL and QT, which provides an environment variable to set things up. As well as terminal applications. It is more painfull with GTK/Gnome apps, as a result, I currently have a preference for QT apps (I still love eog and evince).
As a workaround to be able to click on buttons, I have set min-width and min-height to 64px in gtk.css ...
I am thinking about patching cage to support scaling and launch the apps inside of a cage ;)
Keyboard
See Lateral Keyboard
Attachment preview in sms log
Yes, images you receive in MMS can be showed directly into the log thanks to sixels, which are supported in foot.
Just add this code in your sxmo_hook_smslog.sh, this calls img2sixel on images to draw them, see my own hook[1]. You'll need img2sixel installed on your phone.
# print any attachments for attachment in "$SXMO_LOGDIR/$LOGDIRNUM/attachments/${MMSID}".*; do if [ -f "$attachment" ]; then printf "%s %s\n" "$icon_att" "$(basename "$attachment")" if command -v img2sixel > /dev/null && file "$attachment" | grep -q "image data"; then img2sixel -w 200 "$attachment" echo -ne '\n\n' fi fi done
Gestures
I have configured lots of gestures (using lisgd) for the programs I use. First I've added some gestures to the vocabulary (mainly swiping out from the corners). I have then heavily modified sxmo_hooks_inputhandler.sh.
One the oneplus6, I also found a need to increase edgesize (by recompiling lisgd). Because of the rounded corners, corner swipes were difficult to trigger.
New gestures
$ diff /usr/share/sxmo/default_hooks/sxmo_hook_lisgdstart.sh sxmo_hook_lisgdstart.sh 31a35,38 > -g "1,DRUL,TL,*,setsid -f sxmo_hook_inputhandler.sh topleftout" \ > -g "1,DLUR,TR,*,setsid -f sxmo_hook_inputhandler.sh toprightout" \ > -g "1,ULDR,BR,*,setsid -f sxmo_hook_inputhandler.sh bottomrightout" \ > -g "1,URDL,BL,*,setsid -f sxmo_hook_inputhandler.sh bottomleftout" \ 44a52 > -g "2,DU,T,*,setsid -f sxmo_hook_inputhandler.sh twouptopedge" \ 45a54 > -g "2,DU,B,*,setsid -f sxmo_hook_inputhandler.sh twoupbottomedge" \
My entries in inputhandler
Global actions
Swipe left to adjust volume has been disabled.
"upleftedge") # sxmo_audio.sh vol up & exit 0 ;; "downleftedge") # sxmo_audio.sh vol down & exit 0 ;;
Swipes in from top show up menus :
- top-left brings system menu
- top-right brings apps menu
- top-center brings application menu (menu for the current application)
- two-fingers top-center brings the notification menu if there are pending notifications
"topleftcorner") sxmo_appmenu.sh sys & exit 0 ;; "toprightcorner") sxmo_appmenu.sh applications & exit 0 ;; "twodowntopedge") NNOTIFICATIONS="$(find "$SXMO_NOTIFDIR" -type f | wc -l)" if [ "$NNOTIFICATIONS" -gt 0 ]; then sxmo_notificationsmenu.sh & else sxmo_dmenu.sh isopen || sxmo_appmenu.sh sys & fi exit 0 ;; "downtopedge") sxmo_dmenu.sh isopen || sxmo_appmenu.sh & exit 0 ;;
Swipe in from bottom left toggles fullscreen, swipe in from bottom right changes screen orientation :
"bottomleftcorner") swaymsg fullscreen exit 0 ;; "bottomrightcorner") sxmo_rotate.sh & exit 0 ;;
Power button triggers terminal with a smaller font (80 char width) and the keyboard (launching the terminal from the appmenu triggers it with default font size, which on my setup is set to 26).
"powerbutton_three") sxmo_keyboard.sh open sxmo_terminal.sh -f 'dejavu sans mono:size=16' exit 0 ;;
Closing via VolumeDown also closes the keyboard
"voldown_three") sxmo_killwindow.sh sxmo_keyboard.sh close exit ;;
Generic actions for terminal
Generic actions have been modified, mainly for zooming and scrolling.
Zoom is performed with a swipe (up/down) on the left border, and scroll on the right border.
When scrolling is possible in a text program (gomuks, aerc, less) the action will be overriden.
Up and Down keys have been remapped to up and down swipes.
I also swipe out to top and corner to send CTRL+D and CTRL+C.
# Now we try generic actions for terminal case "$ACTION" in *"onedown") sxmo_type.sh -k Down exit 0 ;; *"oneup") sxmo_type.sh -k Up exit 0 ;; "uprightedge") sxmo_type.sh -M Shift -k Page_Up exit 0 ;; "downrightedge") sxmo_type.sh -M Shift -k Page_Down exit 0 ;; "uptopedge") sxmo_type.sh -M ctrl d -m ctrl exit 0 ;; "bottomrightout") sxmo_type.sh -k Return exit 0 ;; "bottomleftout") sxmo_type.sh -k Backspace exit 0 ;; "topleftout") sxmo_type.sh -M Ctrl c -m Ctrl exit 0 ;; "downleftedge") sxmo_type.sh -M Ctrl -k Minus exit 0 ;; "upleftedge") sxmo_type.sh -M Ctrl -k Plus exit 0 ;; esac
Configuration for TUI apps
TUI applications have their own gestures. But to be correctly identified, they must be launched with $WMNAME correctly set, I do that using an alias for the applications that calls a script called tname.
#!/bin/sh echo -en "\033]0;$1\a"
I've started contextualizing application menu from the curent workspace (and the behaviour of the power button).
To get the curent workspace I ask swaymsg :
WORKSPACE=$(swaymsg -t get_outputs |jq -r ".[]|select(.focused==true).current_workspace")
And then I call the corresponding application menu
case "$WMCLASS" in scripts) # Scripts menu CHOICES="$(sxmo_hook_scripts.sh)" WINNAME=Scripts ;; applications) # Apps menu case $WORKSPACE in 2) CHOICES="$(sxmo_apps_web.sh)" WINNAME="Web Apps" ;; 3) CHOICES="$(sxmo_apps_tools.sh)" WINNAME="Tools" ;; 4) CHOICES="$(sxmo_apps_maps.sh)" WINNAME="Map Apps" ;; *) CHOICES="$(sxmo_hook_apps.sh)" WINNAME=Apps ;; esac ;;
Sometimes, when opening the application menu you are not in the workspace you thought you were. In this case you would normally have to close the menu, change workspace and open the menu back.
As it happened a lot to me after customizing menus for each workspace I came with a solution ...
I modified the gesture to change workspace, so that, if a menu is open while changing workspace, I close it and open appmenu ... I thought it would lag, but it works surprisingly well (even by using the bottom swipe gestures !). Now I can easily review what is in each worspace appmenu ;)
Here is how it is implemented in sxmo_hook_inputhandler.sh :
"leftrightedge") sxmo_wm.sh nextworkspace if sxmo_dmenu.sh isopen; then sxmo_dmenu.sh close sxmo_appmenu.sh applications & fi exit 0 ;;
To facilitate the inclusion of flatpak apps, I've set up a small function similar to write_line_app
write_line_flatpak() { prog="$1" label="$2" if flatpak list | grep -q "$prog" ; then write_line "$label" "flatpak run $prog" fi }
To run the Satellite program that only comes as flatpak, I add the following entry :
write_line_flatpak page.codeberg.tpikonen.satellite "$icon_gps Satellite"
Applications
I'll try to cover applications I use and how I've configured and use them.
First let's introduce my appmenu, since it shows the apps I call frequently, here is a dump of sxmo_hook_apps.sh.
write_line_app bemenu-run "$icon_cfg Run" "sxmo_keyboard.sh open & bemenu-run -p run" write_line_app foot "$icon_trm Terminal" "sxmo_keyboard.sh open;foot $SHELL" write_line_app index "$icon_dir Files" "index" write_line_app aerc "$icon_eml Mail" "sxmo_keyboard.sh open;sxmo_terminal.sh -T aerc -f 'DejaVuSansMono:size=14' aerc" write_line_app nheko "$icon_msg Matrix" "nheko" write_line_app qutebrowser "$icon_glb Web browser" "qutebrowser" write_line_app mepo "$icon_map Maps" "mepo" write_line_app buho "$icon_edt Notes" "buho" write_line_app speedcrunch "$icon_clc Calculator" "speedcrunch" write_line_app sxmo_wttr.sh "$icon_wtr Forecast" "sxmo_wttr.sh" write_line_app sxmo_khal.sh "$icon_cal Calendar" "sxmo_khal.sh" write_line_app vvave "$icon_mus Music Player" "vvave" write_line_app pavucontrol "$icon_spk Mixer" "pavucontrol" write_line_app gnome-sound-recorder "$icon_mic Recorder" "gnome-sound-recorder" write_line_app vlc "$icon_mvi Media Player" "vlc" write_line_app kasts "$icon_rss Podcasts" "kasts" write_line_app waydroid "$icon_and Waydroid" "sxmo_keyboard.sh close; waydroid show-full-ui"
While some TUI apps are called from the menu (aerc for mails), I sometimes prefer launching some programs directly from the terminal.
Web browsing
Gestures
I have both firefox and qutebrowser installed. But my main browser is qutebrowser, I find it efficient and to get it better I use custom gestures with it.
- a swipe out from the top (uptopedge) closes current tab with d
- a swipe out from the top left corner (topleftout) sends q to close the window
- a swipe out from the top right corner asks for an url to open in a new window (and opens keyboard)
- a swipe out from the bottom right corner asks for an url to open in current window (and opens keyboard)
- swipe out left goes back in history
- swipe out bottom-left goes forth (because I've remaped swipe right and didn't use it too much)
- swipe out right is used to send enter and close keyboard at the same time (saves some moves ...)
- swipes up/down on the left edge zooms in and out
Key bindings have been set-up accordingly in qutebrowser (which configuration is shared with my laptop) so < > and q are defined keys.
*qutebrowser*) case "$ACTION" in "uptopedge") sxmo_type.sh -k Escape -s 300 'd' exit 0 ;; "uprightedge") exit 0 ;; "downrightedge") exit 0 ;; "toprightout") sxmo_type.sh -k Escape -s 300 'wo' sxmo_keyboard.sh open exit 0 ;; "topleftout") sxmo_type.sh -k Escape -s 300 'q' exit 0 ;; "bottomleftout") sxmo_type.sh -k Escape -s 300 '>' exit 0 ;; "bottomrightout") sxmo_type.sh -k Escape -s 300 'o' sxmo_keyboard.sh open exit 0 ;; "leftrightedge_short") sxmo_type.sh -k Escape -s 300 '<' exit 0 ;; "rightrightedge_short") sxmo_type.sh -k Return sxmo_keyboard.sh close exit 0 ;; "leftbottomedge") sxmo_type.sh -k Minus exit 0 ;; "rightbottomedge") sxmo_type.sh -k Plus exit 0 ;; "upleftedge") sxmo_type.sh -k Plus exit 0 ;; "downleftedge") sxmo_type.sh -k Minus exit 0 ;; "bottomleftcorner") sxmo_type.sh -k F11 exit 0 ;; esac ;;
Bookmarks
Since I have a web menu for workspace 2, I've decided adding the bookmarks for qutebrowser, here is a little helper function :
write_line_bookmark() { address="$1" label=$(echo $@ | cut -d ' ' -f 2-) write_line "$icon_bok $label" "qutebrowser --nowindow ':open -w '$address" }
And I call it from all the lines of the bookmark files of qutebrowser :
cat ~/.config/qutebrowser/bookmarks/urls | while read -r line ; do write_line_bookmark $line done
For reading and writing mails I use aerc, with a small font.
Some gestures have been configured in lisgd :
*aerc*) case "$ACTION" in "toprightout") sxmo_type.sh t exit 0 ;; "uptopedge") sxmo_type.sh q exit 0 ;; "uprightedge") sxmo_type.sh -k Page_Up exit 0 ;; "downrightedge") sxmo_type.sh -k Page_Down exit 0 ;; esac ;;
Matrix client
I use Nheko and gomuks.
Nheko already has settings for touch use and I enable them.
I have only assigned a swipe out from top edge to quit the program throug CTRL+Q
*nheko*) case "$ACTION" in "uptopedge") sxmo_type.sh -M Ctrl -k q -m Ctrl exit 0 ;; esac ;;
I launch gomuks from the terminal using the gmk alias : alias gmk='tname gomuks;gomuks', then I have the following gestures configured in lisgd :
*gomuks*) case "$ACTION" in "uptopedge") sxmo_type.sh '/quit' -k Return exit 0 ;; *"oneleft") sxmo_type.sh -M Ctrl -k Up exit 0 ;; *"oneright") sxmo_type.sh -M Ctrl -k Down exit 0 ;; "leftrightedge_short") sxmo_type.sh '/toggle rooms' -k Return exit 0 ;; "rightrightedge_short") sxmo_type.sh '/toggle users' -k Return exit 0 ;; "bottomleftout") sxmo_type.sh -M Ctrl k exit 0 ;; "uprightedge") sxmo_type.sh -k Page_Up exit 0 ;; "downrightedge") sxmo_type.sh -k Page_Down exit 0 ;; esac ;;
Main gestures are :
- swipe out from top left corner quits gomuks
- swipe left and right change room
- swipe out from left and write toggles the rooms and users lists
Calculator
I do use bc a lot, but also speedcrunch. I had to disable completion because it doesn't work well with the onscreen keyboard and defined a gesture to bring in/out the application own keyboard (with two finger swipes).
*speedcrunch*) case "$ACTION" in "twodownbottomedge") sxmo_type.sh -M Ctrl -k k -m Ctrl exit 0 ;; "twoupbottomedge") sxmo_type.sh -M Ctrl -k k -m Ctrl exit 0 ;; "uptopedge") sxmo_type.sh -M Ctrl -k q -m Ctrl exit 0 ;; esac ;;
Waydroid
I currently don't have it installed (as I didn't really find applications I miss from Android). But I tested it and kept some configurations.
Waydroid was set to add some vertical padding using this command : waydroid prop set persist.waydroid.height_padding 80 (think it was 80) Pixel density was set to 320 in waydroid_base.prop : ro.sf.lcd_density=320
I also had some convenient gestures to close the window or terminate the session :
*waydroid*) case "$ACTION" in "bottomrightout") sxmo_killwindow.sh exit 0 ;; "bottomleftout") sxmo_killwindow.sh exit 0 ;; "uptopedge") waydroid session stop exit 0 ;; esac ;;