• 0
Votes
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 195

Backtrace:

File: /home/u125378470/domains/lawhelpguru.org/public_html/application/views/question.php
Line: 195
Function: _error_handler

File: /home/u125378470/domains/lawhelpguru.org/public_html/application/controllers/Questions.php
Line: 416
Function: view

File: /home/u125378470/domains/lawhelpguru.org/public_html/index.php
Line: 315
Function: require_once

To begin with, I'm running Ubuntu 20.04. I've created a suspend@.service that hooks into sleep.target of systemd referring this guide. My goal is to display a GTK dialog before the system sleeps and here's what my config looks like -

[Unit]
Description=User suspend actions
Before=sleep.target

[Service]
User=%I
Type=notify
Environment=DISPLAY=:0
ExecStartPre=bash /home/user/myscript.sh
ExecStart=/usr/bin/sflock
ExecStartPost=/usr/bin/sleep 1

[Install]
WantedBy=sleep.target

Unfortunately, triggering suspend immediately turns off the screen though my dialog box is actually fired and shown in the background thereby holding up the system from sleeping. Pressing a button or two prompts me to login and there ... my dialog box is sitting right there. Dismissing it now immediately puts the system to sleep.

My question is, is there a way to prevent the display from going off and GDM from screen locking while hooking into sleep.target? I mean, is there a way to prioritise which suspend hook is executed first or something? Clearly GNOME is doing its thing and shutting of the screen and probably my hook is getting executed the last. Can I change this order?