lxqt / lxqt-config

Tools to configure LXQt and the underlying operating system
https://lxqt.github.io
GNU Lesser General Public License v2.1
79 stars 60 forks source link

[Feature request] Allow more complex commands in Autostart #922

Closed ceever closed 1 year ago

ceever commented 1 year ago

Whenever adding a autostart command via the "LXQt Session Settings", it will only allow simple types of commands such that everything more complex must be put into some script stored somewhere else and then the script needs to be provided as command in the autostart command.

Autostart will fail on complex comnands like:

dbus-monitor --session "type=signal,interface=org.gtk.Actions" | while read i; do [[ -n "$(echo "$i" | grep libreoffice)" ]] && sleep 5 && touch ~/libre.chk; done

or even

bash -c 'dbus-monitor --session "type=signal,interface=org.gtk.Actions" | while read i; do [[ -n "$(echo "$i" | grep libreoffice)" ]] && sleep 5 && touch ~/libre.chk; done'
Expected Behavior

Accept any command that would also execute in the terminal.

Current Behavior

Autostart will not execute such a complex command as above.

Steps to Reproduce (for bugs)
  1. Create a more complex autostart command with pipes, quotes, semicolons and &s
  2. Log off, log on
  3. Check whether the command was executed
Context

Due to this limitation, users will often have to come up with additional places to store such scripts with more complex commands. This kind of diminishes the usefulness of the Autostart settings GUI/tool.

System Information
stefonarch commented 1 year ago

Afaik what is forbidden is && in .desktop files , commands like Exec=bash -c "if [ $wayland_compositor = "wayfire" ];then /home/stef/bin/alpha-script.py;fi" do work.

ceever commented 1 year ago

🤔 Mhhh, but why base the whole thing onto .desktop files? This way one carries along the shortcoming of the .desktop specification.

stefonarch commented 1 year ago

I maybe wrong, the specs are here: https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#exec-variables

Mhhh, but why base the whole thing onto .desktop files?

Autostart feature is shared between DE's, it's not our invention.

ceever commented 1 year ago

🤷🙏

tsujan commented 1 year ago

but why base the whole thing onto .desktop files?

Auto-start is nothing but a desktop file inside ~/.config/autostart/.