Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve detection of launched applications #2

Open
alebastr opened this issue Feb 20, 2021 · 5 comments
Open

Improve detection of launched applications #2

alebastr opened this issue Feb 20, 2021 · 5 comments
Labels
cgroups Cgroups assignment script enhancement New feature or request

Comments

@alebastr
Copy link
Owner

Detection of apps for assign-cgroups script is currently completely reliant on an i3 IPC interface provided by the compositor/window manager. That is fine and it should cover most of resource intensive applications.

Assuming that the autostart is already handled by systemd-xdg-autostart-generator, there are still a few things I'd like to put into cgroups:

  • special applications (layer-shell)
  • apps that are started minimized to tray (i.e. some heavy background process with a tray icon to control).
  • ...?
@alebastr alebastr added enhancement New feature or request cgroups Cgroups assignment script labels Feb 20, 2021
@VannTen
Copy link

VannTen commented Jul 7, 2022

What are you thoughts on using systemd-run for launching applications and
ensuring they end up in the correct cgroups ? Ie implement the "XDG
standardization for applications" in https://systemd.io/DESKTOP_ENVIRONMENTS/ by
using a wrapper around systemd-run --unit=${app_id}@${RANDOM} -- ${cmd} ?

Downside is that this requires the launcher / context be aware of that app_id.

(AFAICT the "ApplicationID" should roughly map to the desktop file name).

@alebastr
Copy link
Owner Author

alebastr commented Jul 7, 2022

I stopped looking into that direction when I found that none of the launchers I'm aware of can provide app_id. I.e. if you take rofi -show drun, wofi, fuzzel, nwg-anything, etc, you won't be able to pass the selected .desktop file name to an arbitrary wrapper command.

It is possible to take a command name instead of app_id, and here's a script that I use to start CLI apps this way. I just don't want to resort to that for GUI apps.

BTW, if you have a .desktop file name and your glib2 package is built with https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1596 (I know that at least Fedora applies that patch), gtk-launch will spawn the process in the correct scope.

@VannTen
Copy link

VannTen commented Oct 11, 2022 via email

@VannTen
Copy link

VannTen commented Jul 12, 2023

So I implemented this in fuzzel : https://codeberg.org/dnkl/fuzzel/pulls/145
I now use this script as the launch-prefix for fuzzel :

systemd-run-desktop-id

#!/bin/bash
systemd-run --user \
    --unit=app-fuzzel-${FUZZEL_DESKTOP_FILE_ID%.desktop}@${RANDOM} \
    --slice=app-${FUZZEL_DESKTOP_FILE_ID%.desktop}-${RANDOM} \
    -- $@

I'm not really sure what should be in (as proposed in https://systemd.io/DESKTOP_ENVIRONMENTS/ ) though. Maybe rather $XDG_CURRENT_DESKTOP than "fuzzel" ?
Any thoughts ?

@VannTen
Copy link

VannTen commented Jul 12, 2023

I'm also wondering if this could help with #6 , by using the launcher to set environment variable 🤔 ...
It will still only works in fuzzel (yet) ofc...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cgroups Cgroups assignment script enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants