You are not logged in.

#1 2022-09-25 11:13:34

m2arch
Member
Registered: 2022-08-28
Posts: 23

[SOLVED]Monitor going off after suspend.

I writed a basic command and this solved my problem:

#!/bin/sh

#If [--output DP-1 = off]; then
#sleep 1
xrandr --output DP-1 --off &&
#elif [ output DP-1 = on] then
xrandr --output DP-1 --primary --mode 1920x1080 --pos 0x0 --rotate normal --output HDMI-1 --mode 1366x768 --pos 1920x0 --rotate normal --output DP-2 --off --output DP-3 --off
#fi 

"If commands" didn't work because I don't know how to know monitor on or off. If I execute this file, It's totaly solving my problem.(xrandr commands only.)

How can be handled automatically when computer wake up?

Last edited by m2arch (2022-09-25 18:00:09)


English is not my native language. Please excuse my typing errors. You free to correct me.

Offline

#2 2022-09-25 12:28:58

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [SOLVED]Monitor going off after suspend.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#3 2022-09-25 13:24:04

m2arch
Member
Registered: 2022-08-28
Posts: 23

Re: [SOLVED]Monitor going off after suspend.

Thanks. I tried to add this:

[Unit]
Description=Local system resume actions
After=suspend.target

[Service]
Type=simple
ExecStartPost=/usr/bin/sleep 1
ExecStart=~/Desktop/hdmi_right-upper.sh

[Install]
WantedBy=suspend.target

Nothing changed. Also, I haven't screensaver for lock my screen after suspend. I  tried to install If solve this issue but It didn't and I deleted screensaver.


English is not my native language. Please excuse my typing errors. You free to correct me.

Offline

#4 2022-09-25 14:46:52

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,223

Re: [SOLVED]Monitor going off after suspend.

As per linked wiki, "Environment=DISPLAY=:0" is gonna be REALLY important here.
So will mostl likely be "User=%I" (and the "@" thing)…
And also see https://gist.github.com/AladW/de1c5676d93d05a5a0e1

Offline

#5 2022-09-25 15:32:34

m2arch
Member
Registered: 2022-08-28
Posts: 23

Re: [SOLVED]Monitor going off after suspend.

seth wrote:

As per linked wiki, "Environment=DISPLAY=:0" is gonna be REALLY important here.
So will mostl likely be "User=%I" (and the "@" thing)…
And also see https://gist.github.com/AladW/de1c5676d93d05a5a0e1

Nope, noting worked;

[Unit]
Description=Local system resume actions
After=suspend.target

[Service]
Type=simple
User=%I
Environment=DISPLAY=:0
ExecStartPost=/usr/bin/sleep 1
ExecStart=/home/arch/Desktop/hdmi_right-upper.sh

[Install]
WantedBy=suspend.target
 

Also, I didn't understand what you were talking about for @thing.

Is there any problem solve documentation for my issue? Maybe, I am taking this issue for my setup because I installed and uninstalled so much de,wm -kde,xfce,qtile,dwm,awesome-. I am deleted all of that except xfce but some .config file and some packages still on my system but I didn't found how to clean my arch.

Last edited by m2arch (2022-09-25 15:33:22)


English is not my native language. Please excuse my typing errors. You free to correct me.

Offline

#6 2022-09-25 15:49:33

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,223

Re: [SOLVED]Monitor going off after suspend.

Also, I didn't understand what you were talking about for @thing.

The wiki wrote:

Enable the suspend@user

/etc/systemd/system/suspend@.service
[Unit]
Description=User suspend actions
Before=sleep.target

[Service]
User=%I
Type=forking
Environment=DISPLAY=:0
ExecStartPre= -/usr/bin/pkill -u %u unison ; /usr/local/bin/music.sh stop
ExecStart=/usr/bin/sflock
ExecStartPost=/usr/bin/sleep 1

[Install]
WantedBy=sleep.target

Edit: though of course for the resume action.
You may also have to "ExecStartPre=sleep whatever" in case there's a race condition.

Last edited by seth (2022-09-25 15:52:34)

Offline

#7 2022-09-25 17:59:53

m2arch
Member
Registered: 2022-08-28
Posts: 23

Re: [SOLVED]Monitor going off after suspend.

seth wrote:

Also, I didn't understand what you were talking about for @thing.

The wiki wrote:

Enable the suspend@user

/etc/systemd/system/suspend@.service
[Unit]
Description=User suspend actions
Before=sleep.target

[Service]
User=%I
Type=forking
Environment=DISPLAY=:0
ExecStartPre= -/usr/bin/pkill -u %u unison ; /usr/local/bin/music.sh stop
ExecStart=/usr/bin/sflock
ExecStartPost=/usr/bin/sleep 1

[Install]
WantedBy=sleep.target

Edit: though of course for the resume action.
You may also have to "ExecStartPre=sleep whatever" in case there's a race condition.

Thank you. I appreciate it.
If someone need to do this to:
Do not forget to add +x execute permission and enabling via systemctl.


English is not my native language. Please excuse my typing errors. You free to correct me.

Offline

Board footer

Powered by FluxBB