LukeSmithxyz / dwm

Luke's build of dwm
MIT License
818 stars 545 forks source link

Systemd Taking too long to Restart or Shutdown when using Display manager eg. lightdm #106

Closed goldcoders closed 4 years ago

goldcoders commented 4 years ago

Hi, Recently Ive notice some Timeout in Systemd It took me too long to Restart or Shutdown...

before i was running all auto start script at .xprofile

its ok but when U have implemented Something like

optimus-manager , where its managing also your script.

I found out that Intel Video card got stuck,

And it will took more than 1 minute before you can shutdown and restart....

So what I did was add this patch https://dwm.suckless.org/patches/cool_autostart/

so now i have this on config.h

static const char *const autostart[] = {
    "remaps", NULL,
    "setbg", NULL,
    "dwmblocks", NULL,
    "dunst", NULL,
    "xset r rate 300 50", NULL,
    "fusuma", NULL,
    "matebook-applet", NULL,
    "unclutter", NULL,
    "compton", NULL,
    "sh", "-c", "/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1", NULL,
    "clipmenud", NULL,
    "optimus-manager-qt", NULL,
    NULL /* terminate */
};

Its good coz everytime you logout or leave dwm it just take care of stopping those background task/scripts.

Also on the patch make sure you dont remove the restart , or everytime you press super +f2 to refresh dwm it would just quit

void
quit(const Arg *arg)
{
    if(arg->i) restart = 1; // Maintain this line of code
    size_t i;

    /* kill child processes */
    for (i = 0; i < autostart_len; i++) {
        if (0 < autostart_pids[i]) {
            kill(autostart_pids[i], SIGTERM);
            waitpid(autostart_pids[i], NULL, 0);
        }
    }

    running = 0;
}

I just share this coz it might be useful to others if not useful for the maintainer

drake-newell commented 4 years ago

All these non-issue issues are making me think Luke needs to make a new forum.

goldcoders commented 4 years ago

Ive put the wrong title lol, changed it ...

Yeah this might be an issue for users who is not using display manager... but as more and more users uses dwm

i dont think majority would use without a display manager, me at first i didnt used it, but at later point in time

when i need display manager ive installed it...

the issue is when you have a background task running... and systemd cant really shut it forcefully

Ive saw many issue and not one good fix to it... but all issue is the same...

as a developer i narrow than the point where u can faced this issue.... and i found out that dwm has patch cool autostart

that patch not only auto start any script or background task but it shut it off when you log out session or shutdown or reboot...

which systemd cant kill

Now if you think this is still non issue yeah, your right...

but the likelyhood that the users will face this issue is 90%

coz sooner or later you will uses a display manager

coz other packages required it...