Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Brief background information: I just installed Fedora 18 with Gnome 3.6.3.1 on my computer. It is connected to a Windows share (CIFS) containing music, which I play using Clementine. If I suspend the computer while Clementine is playing a song from the CIFS mount, upon resuming, it (Clementine) hangs. Eventually, if I try to restart/power off, the whole computer hangs. My workaround to this is to stop playback upon suspension.

My problem: I've created a script in /usr/lib/systemd/system-sleep to stop playback (using MPRIS). The script successfully runs before suspend if I execute

systemctl suspend

However, it does not run if I click on Suspend from the User menu in Gnome3. Doing some legwork, I uncovered that Gnome3 relies on UPower, which itself, it seems, simply uses DBus to issue the "Suspend" command. I'm not savvy enough to follow the trail any further, but from what I can see, the script never gets executed.

My question: How can I make the Suspend menu item in Gnome3 use systemd to call my script?

share|improve this question
2  
Have you checked the journal for any errors ? (journalctl -b -u systemd-suspend). Also, try setting auto-suspend after 15 minutes, see if the script runs when Gnome auto-suspends. –  don_crissti Jun 1 '13 at 23:50
    
Thanks for this command! It helped a lot in my troubleshooting. –  Meta Jun 2 '13 at 4:13

1 Answer 1

up vote 2 down vote accepted

After doing some more research, it seems like UPower should indeed use systemd when it is detected. But for some reason, it does not. I am currently looking into this, but as a temporary workaround, I directly edited the relevant lines in userMenu.js and powerMenu.js as follow:

Replace (comment out) all the lines that call suspend:

this._upClient.suspend_sync(null);

By the following line:

Util.spawn(['systemctl', 'suspend']);

Also add the following line in powerMenu.js near the top:

const Util = imports.misc.util;
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.