[Xfce-bugs] [Bug 10172] run on logout feature

bugzilla-daemon at xfce.org bugzilla-daemon at xfce.org
Sat Dec 5 23:22:42 CET 2015


https://bugzilla.xfce.org/show_bug.cgi?id=10172

xyzdragon at fastmail.fm changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |xyzdragon at fastmail.fm

--- Comment #2 from xyzdragon at fastmail.fm ---
I would need this feature in order to make a workaround for this bug:
https://bugzilla.xfce.org/show_bug.cgi?id=10295
I would solve this bug by inserting the following code into
xfce4-session/xfsm-manager.c (version 4.12.1) in
xfsm_manager_save_yourself_global(..) after the call to xfsm_logout_dialog(...)


    /* Call logout scripts */
    switch ( manager->shutdown_type /* see xfsm-shutdown.h */ ) {
      case XFSM_SHUTDOWN_LOGOUT   :
        system("/bin/bash $HOME/.config/xfce4-session/hook-logout");
        break;
      case XFSM_SHUTDOWN_SHUTDOWN :
        run("/bin/bash $HOME/.config/xfce4-session/hook-shutdown");
        break;
      case XFSM_SHUTDOWN_RESTART  :
        run("/bin/bash $HOME/.config/xfce4-session/hook-restart");
        break;
      case XFSM_SHUTDOWN_SUSPEND  :
        run("/bin/bash $HOME/.config/xfce4-session/hook-suspend");
        break;
      case XFSM_SHUTDOWN_HIBERNATE:
        run("/bin/bash $HOME/.config/xfce4-session/hook-hibernate");
        break;
      default:
        break;
    }

It actually seems to work, but there may be better implementations regarding
the system call, standard search paths and security features. (E.g. I'm not
sure whether those script would be called with root privileges)

Unfortunately when I compile xfce4-session 4.12.1 from source the suspend and
hibernate buttons are not shown in the logout-dialog and the reboot and
shutdown buttons are grayed out/not clickable. So this is not really working
for me. Hoping someone implements this correctly or solves the linked bug.

The scripts hook-restart, hook-shutdown and hook-logout would then contain:

    WIN_IDs=$(wmctrl -l | grep -vwE "Desktop$|xfce4-panel$" | cut -f1 -d' ')
    for i in $WIN_IDs; do wmctrl -ic "$i"; done
    # Keep checking and waiting until all windows are closed
    while [ "$WIN_IDs" != "" ]; do
        sleep 0.1;
        WIN_IDs=$(wmctrl -l | grep -vwE "Desktop$|xfce4-panel$" | cut -f1 -d'
')
    done

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Xfce-bugs mailing list