stefonarch / LXQt-Wayland-files

LXQt implementation in Wayland compositors
GNU General Public License v3.0
61 stars 0 forks source link

Question: Can Wayfire be started from inside LXQt Session? #1

Closed tsujan closed 1 year ago

tsujan commented 1 year ago

As you mentioned in your wayfire.ini, lxqt-session can be started by Wayfiire. One problem of starting it in this way is that it won't guard all user processes and won't terminate them on logging out. Can it be done conversely, by starting Wayfire with lxqt-session? If not, we might be able to modify its code.

BTW, my wayfire.ini isn't very different from yours. I just put all startup apps inside a bash script ~/bin/start-extras-wayfire, which I start under [autostart] as,

extras = env XDG_CURRENT_DESKTOP=LXQt /home/pedram/bin/start-extras-wayfire

The script is like this:

#!/bin/bash

export KRITA_NO_STYLE_OVERRIDE=1
export PATH=/home/pedram/bin:/home/pedram/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl

lxqt-policykit-agent &
pcmanfm-qt --daemon-mode &
nm-applet --indicator &
feathernotes --tray /home/pedram/Documents/FeatherNotes/Notes.fnx &
sleep 15
/usr/bin/lxqt-notificationd &

# Here come other startup apps...

exit

Setting XDG_CURRENT_DESKTOP under [autostart] and PATH inside the script is important to me; without them, various problems might happen.

stefonarch commented 1 year ago

Note that is not my actual wayfire.ini but an example. I tested once starting wayfire in lxqt-session, in several ways (command line with &; inside lxqt-session, with sleep ecc but nothing worked.

Maybe a new binarylxqt-wayland-session which reads the chosen compositor from config (as now with WM) and starts first the compositor and then the session could work. Afaik the only apps which are not closed are those opened by shortcut (from wayfire.ini). Yatbfw can be a lxqt-module too, waybar not: if tray is not present there's a huge delay until session is completely running.

I start wayfire reading ENV and other settings from LXQt settings in this way: https://github.com/stefonarch/LXQt-Wayland-files/blob/main/wayfire/startlxqtwayfire

Some of the autostart apps and modules check now first the session type and launch the compatible app (screenlocker, dimmer, clipboard) so the [autostart] and [modules] work for both session types without fiddling when switching.

tsujan commented 1 year ago

My goal was setting XDG_CURRENT_DESKTOP to LXQt everywhere with Wayfire. After writing the above comment, I found a way :) I don't know why it didn't occur to me before.

I added wf-panel and waybar to my script and removed them from Wayfire's autostart, so that the script became like this:

#!/bin/bash

export KRITA_NO_STYLE_OVERRIDE=1
export PATH=/home/pedram/bin:/home/pedram/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl

# First start Wayfire's panel and Waybar
wf-panel &
waybar &

lxqt-policykit-agent &
pcmanfm-qt --daemon-mode &
nm-applet --indicator &
feathernotes --tray /home/pedram/Documents/FeatherNotes/Notes.fnx &
sleep 15
/usr/bin/lxqt-notificationd &

# Here come other startup apps...

exit

Now, every app I start from Wayfire's menu is opened with XDG_CURRENT_DESKTOP set to LXQt (because I start my script with env XDG_CURRENT_DESKTOP=LXQt... in Wafire's autostart).

EDIT: autostart_wf_shell should be set to false under [autostart] in wayfire.ini; otherwise, there will be two instances of wf-panel.

I start wayfire reading ENV and other settings from LXQt settings in this way: https://github.com/stefonarch/LXQt-Wayland-files/blob/main/wayfire/startlxqtwayfire

Oh, that's another good workaround! You'd told me about it. Theoretically, it should work — it seems to be the best method — but, for some reason, it didn't work here; maybe I made a mistake.

stefonarch commented 1 year ago

Well, I'm sure it works, I use identical scripts for labwc and hyprland. I don't use wf-panel but yatbfw which has an quickstart section.

To logout I use a script called by an yatbfw button

#/bin/sh
lxqt-leave --logout
sleep 1 && wlogout

Fiddling for the first time with the settings of wlogout I noticed that wlogout usesloginctl terminate-user $USER" so this could be directly used by lxqt-leave --logout if it session_type is wayland.

Thanks for the pstree hint, found a double process swayidle inside and outside of lxqt-session. Only waybar and yatbfw are outside, the latter by choice. Btw also lxqt-panel (if used for systray) has to be started before lxqt-session.


├─lxqt-session─┬─Screenlocker───swayidle
        │              ├─agent───3*[{agent}]
        │              ├─clipboardmanage───wl-paste
        │              ├─cmst───3*[{cmst}]
        │              ├─com.github.sgpt───4*[{com.github.sgpt}]
        │              ├─dimmer───python3─┬─gammastep───4*[{gammastep}]
        │              │                  └─4*[{python3}]
        │              ├─feathernotes───3*[{feathernotes}]
        │              ├─firefox─┬─Isolated Web Co───26*[{Isolated Web Co}+
        │              │         ├─Privileged Cont───20*[{Privileged Cont}+
        │              │         ├─Socket Process───7*[{Socket Process}]
        │              │         ├─3*[Web Content───14*[{Web Content}]]
        │              │         ├─WebExtensions───28*[{WebExtensions}]
        │              │         ├─keepassxc-proxy───{keepassxc-proxy}
        │              │         └─111*[{firefox}]
        │              ├─lxqt-appswitche───3*[{lxqt-appswitche}]
        │              ├─lxqt-globalkeys───4*[{lxqt-globalkeys}]
        │              ├─lxqt-notificati───3*[{lxqt-notificati}]
        │              ├─lxqt-policykit-───5*[{lxqt-policykit-}]
        │              ├─lxqt-powermanag───8*[{lxqt-powermanag}]
        │              ├─lxqt-runner───7*[{lxqt-runner}]
        │              ├─meteo-qt───3*[{meteo-qt}]
        │              ├─pcmanfm-qt───11*[{pcmanfm-qt}]
        │              ├─qterminal─┬─bash───pstree
        │              │           ├─bash
        │              │           └─7*[{qterminal}]
        │              ├─quiterss───21*[{quiterss}]
        │              ├─telegram-deskto───40*[{telegram-deskto}]
        │              ├─temp-alert───sleep
        │              ├─thunderbird─┬─Web Content───18*[{Web Content}]
        │              │             ├─WebExtensions───25*[{WebExtensions}+
        │              │             └─108*[{thunderbird}]
        │              └─4*[{lxqt-session}]
tsujan commented 1 year ago

Well, I'm sure it works

Yes, and it's definitely better than my method. This repository should be consulted by anyone who wants LXQt+Wayfire.

tsujan commented 1 year ago

I think this can be closed. The short answer to the title is, "No. lxqt-session should be started by Wayfire." A little longer answer is that lxqt-session is a QApplication and so, it needs a platform, which doesn't exist before starting Wayfire. If it tries to start Wayfire (after being patched), it'll immediately crash.

stefonarch commented 1 year ago

Just a note: Some compositors accept a variable