Skip to content

Orphaned mpvpaper instances on wallpaper change in NixOS #160

@Passeriform

Description

@Passeriform

I've got Ambxst installed as module in my NixOS installation. When switching the wallpapers, it spawns a new instance of mpvpaper (as expected) but doesn't kill the old instance. Changing it multiple times accumulates a lot of orphaned mpvpaper instances.

Relevant source:
modules/widgets/dashboard/wallpapers/mpvpaper.sh

I've narrowed it down to pkill and pgrep unable to find the mpvpaper instance to kill because of the -x flag. In NixOS, the executable is wrapped with makeWrapper giving it a different name which -x is not robust enough to handle.

❯ ps -eo pid,comm,args | grep "mpvpaper"
 116650 .mpvpaper-wrapp /nix/store/angyxynrfhkxkjfi1sh1i8ng5671s17q-Ambxst-env/bin/mpvpaper -o no-audio loop hwdec=auto scale=bilinear interpolation=no video-sync=display-resample panscan=1.0 video-scale-x=1.0 video-scale-y=1.0 load-scripts=no input-ipc-server=/tmp/ambxst_mpv_socket_eDP-2 eDP-2 /nix/store/ixv9sficcdljnv8dwq80j674bjkvk339-wallpapers/sunpixels/cafe_night.gif

Please note that the complete name for the comm is supposed to be .mpvpaper-wrapper but it gets truncated to .mpvpaper-wrapp. Since the comm name is not reliable, a better alternative would be to look into args with the -f flag.

I've tried pkill -f mpvpaper which is able to kill the mpvpaper instance and pgrep -f mpvpaper lists the PID for mpvpaper instance.

I'll raise a PR if the change request makes sense. Would love to know if that's the right way to go about and if there can be some hidden side-effects

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions