Difference between revisions of "Projects:PinePhone Daily Driver with Sway"

From Dejvino's Knowledge Base
Jump to navigation Jump to search
 
(23 intermediate revisions by the same user not shown)
Line 1: Line 1:
Implementation of [[Projects:PinePhone Daily Driver]] using [[swayWM]].
+
Implementation of [[Projects:PinePhone Daily Driver]] using [[SwayWM]].
 +
 
 +
{{warning|1='''HARDCORE'''
 +
 
 +
It is too much work to put all of the parts of the system together and maintain them on your own!
 +
 
 +
Next stop: [[Projects:PinePhone Daily Driver with Arch Linux]]}}
  
 
== Components ==
 
== Components ==
* [[postmarketOS]] with [[swayWM|postmarketos-ui-sway]]
+
* [[Arch Linux ARM]] with [[SwayWM]]
* System packages: [[bemenu]] [[networkmanager]] [[termite]] termite-terminfo [[bluez]] [[squeekboard]]
+
* [[PinePhone-Toolkit|pinephone-toolkit]]
* App packages: [[vim]] [[firefox]] [[galculator]] [[thunderbird]] [[gajim]] [[audacious]] audacious-plugins
+
* System packages: [[sddm]] [[bemenu]] [[networkmanager]] [[alacritty]] [[bluez]] [[squeekboard]]
 +
* App packages: [[vim]] [[firefox]] [[galculator]] [[thunderbird]] [[vlc]] [[birdie]] [[htop]]
  
 
== Setup ==
 
== Setup ==
 
Configs are stored in a [https://github.com/Dejvino/pinephone-sway-poc repository].
 
Configs are stored in a [https://github.com/Dejvino/pinephone-sway-poc repository].
  
{{Todo|Create a [[postmarketOS]] package? [https://wiki.postmarketos.org/wiki/Create_a_package]}}
+
{{Todo|Create a package for people to use and install easily}}
 +
 
 +
=== Power Management ===
 +
* backlight off and CPU sleep when screen is locked via power button
 +
* handled via [[PinePhone-Toolkit]]
 +
 
 +
=== [[sudo]] ===
 +
Add NOPASSWD for shutdown and reboot to wheel group:
 +
 
 +
{{codeblock|title=visudo|1=%wheel ALL=(ALL) ALL
 +
%wheel ALL=(ALL) NOPASSWD: /sbin/poweroff,/sbin/reboot}}
  
 
=== [[elogind]] ===
 
=== [[elogind]] ===
Line 19: Line 36:
 
...
 
...
 
}}
 
}}
 +
(included in the POC repository)
  
=== lisgd ===
+
=== [[SwayWM]] ===
{{codeblock|title=~/build/lisgd/lisgd.h|1=
+
(config included in the POC repository)
/* Commands to execute upon recieving a swipe gesture */
 
Gesture gestures[] = {
 
        /* fingers      start  end    command */
 
        { 1,    Left,  Right,    "swaymsg workspace prev" },
 
        { 1,    Right,  Left,    "swaymsg workspace next" },
 
  
        { 2,    Left,  Right,    "xdotool key --clearmodifiers Alt+e" },
+
=== [[waybar]] ===
        { 2,    Right,  Left,    "xdotool key --clearmodifiers Alt+r" },
+
(config included in the POC repository)
  
        { 2,    Down,  Up,      "swayphone_keyboard_show" },
+
* Pick a theme! Mine is: [https://github.com/carlosdss22/dotfiles/]
        { 2,    Up,    Down,    "swayphone_keyboard_hide" },
+
* {{IconInfo}} For '''clock''' module, don't forget to set the ''locale'' and ''timezone'' parameters, otherwise nothing will show up.
  
        { 3,    Down,  Up,      "sxmo_vol.sh up" },
+
=== lisgd ===
        { 3,    Up,    Down,    "sxmo_vol.sh down" },
+
[[sxmo#lisgd]] reconfigured through command line parameters in [[SwayWM]] config.
 
 
        { 4,    Down,  Up,      "sxmo_brightness.sh up" },
 
        { 4,    Up,    Down,    "sxmo_brightness.sh down" },
 
};}}
 
{{todo|Finish updating this}}
 
 
 
{{codeblock|1=# TODO: cloning  and building the app
 
cp ~/build/lisgd/lisgd /usr/local/bin/lisgd}}
 
 
 
=== [[swayWM]] ===
 
# Copy {{code|1=/etc/sway/config}} to {{code|1=~/.config/sway/config}}
 
# Edit:
 
{{codeblock|title=~/.config/sway/config|1=
 
# Logo key. Use Mod1 for Alt.
 
set $mod Mod1
 
[...]
 
# Your preferred terminal emulator
 
set $term termite
 
[...]
 
# Your preferred application launcher
 
set $menu bemenu-run | xargs swaymsg exec --
 
[...]
 
  # Kill focused window
 
    bindsym $mod+q kill
 
[...]
 
# Default scaling for the touchscreen
 
output DSI-1 scale 2
 
 
 
# Initial utility apps
 
exec squeekboard
 
exec lisgd
 
  
# Waybar on multiple rows
+
(config included in the POC repository)
exec "waybar -c /home/dejvino/.config/waybar/config_0 -b b0"
 
exec "waybar -c /home/dejvino/.config/waybar/config_1 -b b1"
 
exec "waybar -c /home/dejvino/.config/waybar/config_2 -b b2"
 
}}
 
  
=== [[waybar]] ===
+
=== [[PinePhone-Toolkit]] ===
* Pick a theme! Mine is: [https://github.com/carlosdss22/dotfiles/]
+
Used mainly in [[SwayWM]] config.
* {{IconInfo}} For '''clock''' module, don't forget to set the ''locale'' and ''timezone'' parameters, otherwise nothing will show up.
 
  
 
=== [[Bluetooth]] ===
 
=== [[Bluetooth]] ===
Line 89: Line 66:
 
{{todo|Complete these TODOs!}}
 
{{todo|Complete these TODOs!}}
 
# power saving (so that I can leave the battery in the device when I'm not using it)
 
# power saving (so that I can leave the battery in the device when I'm not using it)
#* hibernation / suspend command
+
## hibernation / suspend command - needs crust support in pmos: [https://gitlab.com/postmarketOS/pmaports/-/issues/550 issue 550]
#* shortcut to enter suspend
+
## shortcut to enter suspend
#* {{IconInfo}} {{code|1=rtcwake -m mem -s 10}}
+
##* {{IconInfo}} {{code|1=rtcwake -m mem -s 10}} ... {{IconFail}} does not resume operation after issuing ''s2idle''
 +
# Core UI
 +
#* Display rotation
 +
#** Vertical waybar - hide/show based on output transformation/waybar-window size [https://github.com/Alexays/Waybar/search?q=hidden&unscoped_q=hidden]
 
# Install and test essential apps & workflows
 
# Install and test essential apps & workflows
## Terminal: [[termite]]
+
## {{IconDone}} Terminal: [[termite]]
## Web browser: [[Firefox]]
+
## {{IconWip}} Web browser: [[Firefox]]
## Passwords manager: [[KeepassXC]])
+
##* Mostly works. Portrait mode doesn't fit perfectly. Clunky UI, some menus overflow.
## Personal Information Manager with [[WebDAV]] sync support for calendar, contacts
+
## {{IconWip}} Passwords manager: [[KeepassXC]])
## Email client: [[thunderbird]]
+
##* Doesn't support such a small screen. Modify and submit a PR?
## Calculator: [[galculator]]
+
## {{IconTodo}} Personal Information Manager with [[WebDAV]] sync support for calendar, contacts
## Alarm: ?
+
## {{IconTodo}} Email client: [[thunderbird]]
## IM clients
+
##* Doesn't support such a small screen. Modify and submit a PR?
 +
## {{IconDone}} Calculator: [[galculator]]
 +
## {{IconTodo}} Alarm: ?
 +
## {{IconTodo}} IM clients
 
##* XMPP: ?
 
##* XMPP: ?
 
##* Matrix: ?
 
##* Matrix: ?
 
##* Slack: ?
 
##* Slack: ?
## Music player: [[audacious]]
+
## {{IconWip}} Music player: [[audacious]]
## Camera & Video recorder: ?
+
##* A few problems with the small screen. Otherwise seems to work.
## VPN client: [[NetworkManager]]?
+
## {{IconTodo}} Camera & Video recorder: ?
 +
## {{IconTodo}} VPN client: [[NetworkManager]]?
 
# Support for non-essential apps & workflows
 
# Support for non-essential apps & workflows
#* RSS client: ?
+
#* {{IconTodo}} RSS client: ?
#* OTP generator: ?
+
#* {{IconTodo}} OTP generator: ?
#* Ebook reader: ?
+
#* {{IconTodo}} Ebook reader: ?
#* Weather forecast: ?
+
#* {{IconTodo}} Weather forecast: ?
#* Maps, navigation: ?
+
#* {{IconTodo}} Maps, navigation: ?
#* Calls & Texts: ?
+
#* {{IconTodo}} Calls & Texts: ?
# Touch gestures and controls
+
#* {{IconTodo}} Samba share mounted from NAS
#* [[sxmo#lisgd]]
+
#** CIFS is not supported by the kernel right now
#* [[twofing]]
+
# Tweaking
#* [[easystroke]] (abandoned)
 
#* [[wmctrl]], [[xdotool]], [[xte]], ...
 
#* Custom input device? [https://python-evdev.readthedocs.io/en/latest/tutorial.html]
 
# tweaking
 
 
#* Configure [[Firefox]] for touch: [https://wiki.postmarketos.org/wiki/Firefox]?
 
#* Configure [[Firefox]] for touch: [https://wiki.postmarketos.org/wiki/Firefox]?
#* ''acpi'' for battery monitoring?
 
 
#* ...
 
#* ...
 
# non-essential userspace apps
 
# non-essential userspace apps
 
#* ...
 
#* ...
 
+
# cool stuff
 +
#* presentation mode [https://github.com/Alexays/Waybar/wiki/Module:-Idle-Inhibitor]
 +
#* night mode: flux / nightlight / redshift / ...
 +
#* automated brightness based on screen content [https://github.com/maximbaz/wluma]
  
 
== Rejected solutions ==
 
== Rejected solutions ==

Latest revision as of 04:17, 23 October 2021

Implementation of Projects:PinePhone Daily Driver using SwayWM.

(!) HARDCORE

It is too much work to put all of the parts of the system together and maintain them on your own!

Next stop: Projects:PinePhone Daily Driver with Arch Linux

Components

Setup

Configs are stored in a repository.

TODO: Create a package for people to use and install easily

Power Management

  • backlight off and CPU sleep when screen is locked via power button
  • handled via PinePhone-Toolkit

sudo

Add NOPASSWD for shutdown and reboot to wheel group:

visudo%wheel ALL=(ALL) ALL %wheel ALL=(ALL) NOPASSWD: /sbin/poweroff,/sbin/reboot

elogind

Power key needs to be locked from elogind, otherwise it would shutdown the system. This way as long as the UI session is running, power button is ignored by elogind. Once the session ends and we're back in the login screen, the power button is again able to shutdown the system.

/usr/share/wayland-sessions/sway.desktop... Exec=elogind-inhibit --what=handle-power-key --mode=block dbus-run-session /usr/bin/sway ... (included in the POC repository)

SwayWM

(config included in the POC repository)

waybar

(config included in the POC repository)

  • Pick a theme! Mine is: [1]
  • [i] For clock module, don't forget to set the locale and timezone parameters, otherwise nothing will show up.

lisgd

sxmo#lisgd reconfigured through command line parameters in SwayWM config.

(config included in the POC repository)

PinePhone-Toolkit

Used mainly in SwayWM config.

Bluetooth

  • Enable the service on boot: rc-update add bluetooth
  • Enable the controller by default:

/etc/bluetooth/main.conf[Policy] AutoEnable=true

TODOs

TODO: Complete these TODOs!

  1. power saving (so that I can leave the battery in the device when I'm not using it)
    1. hibernation / suspend command - needs crust support in pmos: issue 550
    2. shortcut to enter suspend
      • [i] rtcwake -m mem -s 10 ... does not resume operation after issuing s2idle
  2. Core UI
    • Display rotation
      • Vertical waybar - hide/show based on output transformation/waybar-window size [2]
  3. Install and test essential apps & workflows
    1. Terminal: termite
    2. Web browser: Firefox
      • Mostly works. Portrait mode doesn't fit perfectly. Clunky UI, some menus overflow.
    3. Passwords manager: KeepassXC)
      • Doesn't support such a small screen. Modify and submit a PR?
    4. Personal Information Manager with WebDAV sync support for calendar, contacts
    5. Email client: thunderbird
      • Doesn't support such a small screen. Modify and submit a PR?
    6. Calculator: galculator
    7. Alarm: ?
    8. IM clients
      • XMPP: ?
      • Matrix: ?
      • Slack: ?
    9. Music player: audacious
      • A few problems with the small screen. Otherwise seems to work.
    10. Camera & Video recorder: ?
    11. VPN client: NetworkManager?
  4. Support for non-essential apps & workflows
    • RSS client: ?
    • OTP generator: ?
    • Ebook reader: ?
    • Weather forecast: ?
    • Maps, navigation: ?
    • Calls & Texts: ?
    • Samba share mounted from NAS
      • CIFS is not supported by the kernel right now
  5. Tweaking
  6. non-essential userspace apps
    • ...
  7. cool stuff
    • presentation mode [4]
    • night mode: flux / nightlight / redshift / ...
    • automated brightness based on screen content [5]

Rejected solutions

under Wayland