Fedora-OSTree-Setup-dev / Fedora-OSTree-Setup

Glorified scipt that automates the setup of Fedora Silverblue/Kinoite based on given config file.
GNU General Public License v3.0
7 stars 3 forks source link

Waydroid setup #22

Open boredsquirrel opened 1 year ago

boredsquirrel commented 1 year ago

ToDo:

Waydroid starting manually commands

boredsquirrel commented 1 year ago

Create an appstarter containing

waydroid show-full-ui

as Multi-windows mode is buggy af.

printf """[Desktop Entry]
Type=Application
Name=Waydroid Fullscreen
Exec=waydroid show-full-ui
X-Purism-FormFactor=Workstation;Mobile;
Icon=/usr/lib/waydroid/data/AppIcon.png""" > ~/.local/share/applications/waydroid-fullscreen.desktop

Maybe it is already installed? That appstarter is not mine.

boredsquirrel commented 1 year ago

Waydroid delete script:

printf """#!/bin/bash

echo "- - - - - - - Stopping Waydroid - - - - - - - - "
waydroid session stop
sudo waydroid container stop

echo "- - - - - - - - uninstalling Waydroid, this will take some time - - - - - -"
rpm-ostree remove waydroid

echo "- - - - - - - Removing Waydroid files - - - - - - "
sudo rm -rf /var/lib/waydroid /var/home/.waydroid ~/waydroid ~/.share/waydroid ~/.local/share/applications/*aydroid* ~/.local/share/waydroid ~/.local/share/applications/ons/*waydroid* 

notify-send -a "Waydroid" -t 5000 "Removed" "Reboot to complete removal"
""" > ~/.local/bin/remove-waydroid

Appstarter currently doesnt work, because Kickoff cant launch sudo commands, annoying. running remove-waydroid from terminal will work though

boredsquirrel commented 1 year ago

Waydroid stop appstarter (doesnt really work normally):

printf """[Desktop Entry]
Exec='waydroid session stop'
GenericName=close running Waydroid instance
Icon=system-shutdown-symbolic
Name=Shutdown Waydroid
StartupNotify=true
Type=Application""" > ~/.local/share/applications/shutdown-waydroid.desktop
boredsquirrel commented 1 year ago

The shutdown App seems to work like that:


printf """#!/bin/sh
waydroid session stop""" > ~/.scripts/shutdown-waydroid.sh

chmod +x ~/.scripts/*

printf """[Desktop Entry]
Exec=sh ~/.scripts/shutdown-waydroid.sh
GenericName=close running Waydroid instance
Icon=system-shutdown-symbolic
Name=Shutdown Waydroid
StartupNotify=true
Type=Application""" > ~/.local/share/applications/shutdown-waydroid.desktop
boredsquirrel commented 1 year ago

Does GNOME Allow desktop files? My experience was they are not shown. On Kubuntu with GNOME installed it was very messy too.

iaacornus commented 1 year ago

Does GNOME Allow desktop files? My experience was they are not shown. On Kubuntu with GNOME installed it was very messy too.

yes in $HOME/.local/share/applications/ you create a .desktop file

https://wiki.archlinux.org/title/desktop_entries

iaacornus commented 1 year ago

do we really need waydroid? it seems to be only for specific strata of population, not for general one.

boredsquirrel commented 1 year ago

I mean Waydroid is the only Wayland Android emulator there is. Its very hacky, getting to run aarch64 Apps on it even more, but possible. Use cases for example:

boredsquirrel commented 1 year ago

But no problem I will handle that all, as I nearly got all configs for setting it up. Waydroid is also in the main repo now, so even better!

iaacornus commented 1 year ago

I mean Waydroid is the only Wayland Android emulator there is. Its very hacky, getting to run aarch64 Apps on it even more, but possible. Use cases for example:

* banking app as second factor (as we all know our LUKS encrypted computer is safer than a phone)

* Netflix app for downloading DRM videos on Linux

* games, some people use an extra package to assign keyboard shortcuts. Not as powerful as Proton maybe but an easy and mostly free fix for gaming on Linux

* some proprietary software

* stupid software like Telegram allowing encryption only on Android, or Signal to setup an Account

* tons of FOSS Android apps from F-Droid

well then, i'll put it in recommendation. Also to mention, all the things are features/tasks in the program are optional that will only be done if the user agreed to it

iaacornus commented 1 year ago

although perhaps this can be installed in toolbox/distrobox? so the base system image is not really cluttered? i think it's nice if the things layered in the base image is limited as much as possible to only drivers or codecs or applications that really need high level of permission and accesses. although not sure in case of virtualization

boredsquirrel commented 1 year ago

although perhaps this can be installed in toolbox/distrobox? so the base system image is not really cluttered? i think it's nice if the things layered in the base image is limited as much as possible to only drivers or codecs or applications that really need high level of permission and accesses. although not sure in case of virtualization

I dont know if Waydroid runs through toolbox, but I can try. Launching it requires extra appstarters anyways, might be a good idea. But the folders are in seperate directories, and atm they are in system dirs that can be accessed through a root File manager at least. So I dont know if running through Distrobox/Toolbox would make that more complicated.

boredsquirrel commented 1 year ago

Waydroid start appstarter

printf """[Desktop Entry]
Type=Application
Name=Start Waydroid
Exec=waydroid session start
X-Purism-FormFactor=Workstation;Mobile;
Icon=/usr/lib/waydroid/data/AppIcon.png""" > ~/.local/share/applications/waydroid-start.desktop

Problem: fullscreen and start have same icon. Another problem: maybe this appstarter already exists, have to test.

boredsquirrel commented 1 year ago

Install waydroid extras:

mkdir Waydroid
cd Waydroid

git clone https://github.com/casualsnek/waydroid_script
cd waydroid_script
python3 -m pip install -r requirements.txt
cp main.py ~/.local/bin/waydroid_extras.py

notify-send -a "Waydroid-extras" -t 30000 "How to use" "Open the Terminal and run 'sudo python3 ~/Waydroid/waydroid_script/main.py' [-i/-g/-n/-h] . See description of arguments here: https://themagisk.com/waydroid-extras-script/ . The Additions are neededed to run many ARM apps, Netflix DRM content, as well as installing Magisk and rooting the container. You could also install Google Apps, therefor an Android ID is required. It is mostly not recommended for privacy reasons."

Comment: do you know any better way of opening the python script? Moving it to ~/.local/bin didnt work for me for some reason.

boredsquirrel commented 1 year ago

Waydroid initial setup

# 1. add it to install command (rest is in reboot script somehow, maybe manual? Handling sudo commands)

# 2. init

sudo waydroid init -c https://ota.waydro.id/system -v https://ota.waydro.id/vendor

# 3. Create shared folders
mkdir -p ~/Waydroid/Shared
sudo mount --bind ~/Waydroid/Shared ~/.local/share/waydroid/data/media/0/Documents

# sudo mount --bind ~/Downloads ~/.local/share/waydroid/data/media/0/Download
# sudo mount --bind ~/Images ~/.local/share/waydroid/data/media/0/DCIM/Camera

# 4. Link directory folder to user Waydroid folder (logs etc.)
ln -s /var/lib/waydroid ~/Waydroid/directory

# 5. Create Appstarters

cd  ~/.local/share/applications

printf """[Desktop Entry]
Type=Application
Name=Start Waydroid
GenericName=Starts Waydroid in Background
GenericName[de_DE]=Startet Waydroid im Hintergrund
Exec=waydroid session start
X-Purism-FormFactor=Workstation;Mobile;
Icon=/usr/lib/waydroid/data/AppIcon.png""" > waydroid-start.desktop

printf """[Desktop Entry]
Type=Application
Name=Waydroid Fullscreen
GenericName=Shows the Waydroid screen
GenericName[de_DE]=Zeigt den Waydroid Bildschirm
Exec=waydroid show-full-ui
X-Purism-FormFactor=Workstation;Mobile;
Icon=/usr/lib/waydroid/data/AppIcon.png""" > waydroid-fullscreen.desktop

printf """[Desktop Entry]
Exec='waydroid session stop'
GenericName=close running Waydroid instance
GenericName[de_DE]=Schließt laufende Waydroid Instanz
Name=Shutdown Waydroid
X-Purism-FormFactor=Workstation;Mobile;
Icon=system-shutdown-symbolic
Type=Application""" > shutdown-waydroid.desktop

printf """[Desktop Entry]
Exec=waydroid app install
GenericName=Installs Apps to the Waydroid container
GenericName[de_DE]=Installiert eine App in den Waydroid Container
Icon=install
Name=Waydroid install
MimeType=application/vnd.android.package-archive;
Type=Application""" > install-waydroid-app.desktop

# 6. create a remove script
printf """#!/bin/bash

echo "- - - - - - - Stopping Waydroid - - - - - - - - "
waydroid session stop
sudo waydroid container stop

echo "- - - - - - - - uninstalling Waydroid, this will take some time - - - - - -"
rpm-ostree remove waydroid

echo "- - - - - - - Removing Waydroid files - - - - - - "
sudo rm -rf /var/lib/waydroid /var/home/.waydroid ~/waydroid ~/.share/waydroid ~/.local/share/applications/*aydroid* ~/.local/share/waydroid ~/.local/share/applications/ons/*waydroid* 

notify-send -a "Waydroid" -t 5000 "Removed" "Reboot to complete removal"
""" > ~/.local/bin/remove-waydroid

notify-send -a "Waydroid remove tool" "How To" "To remove Waydroid, execute 'sudo remove-waydroid' in Terminal."

# 7. Install extra packages

cd Waydroid

git clone https://github.com/casualsnek/waydroid_script
cd waydroid_script
python3 -m pip install -r requirements.txt
cp main.py ~/.local/bin/waydroid_extras.py

notify-send -a "Waydroid-extras" -t 30000 "How to use" "Open the Terminal and run 'sudo python3 ~/Waydroid/waydroid_script/main.py' [-i/-g/-n/-h] . See description of arguments here: https://themagisk.com/waydroid-extras-script/ . The Additions are neededed to run many ARM apps, Netflix DRM content, as well as installing Magisk and rooting the container. You could also install Google Apps, therefor an Android ID is required. It is mostly not recommended for privacy reasons."

# 8. Enable Clipboard

pip3 install pyclip

# 9. Open F-Droid.org

xdg-open https://f-droid.org/en/packages/com.aurora.store
xdg-openhttps://f-droid.org/en/packages/com.looker.droidify

notify-send -a "Waydroid setup" -t 30000 "Apps" "You can install apps easily from your Desktop or in Waydroid itself. It is recommended to use the F-Droid App or a similar one like Droid-ify to keep them up-to-date. For Google Play Apps you can use AuroraStore. Some Issues like changing the Keyboard layout or having banking apps run still persist."

# 10. Enable autostart with system login

# ln -s ~/.local/share/applications/waydroid-start.desktop ~/.config/autostart/
boredsquirrel commented 1 year ago

It seems the waydroid folder location has changed, it works now, binding it to a good location!

mkdir -p ~/Waydroid/Data
sudo mount --bind ~/.local/share/waydroid/data/media/0/ ~/Waydroid/Shared
boredsquirrel commented 1 year ago

also keyboard layout seems to work. Somehow it broke my local layout, all Flatpak apps use QWERTY now which is awful.