Simple command on wake from suspend
I am using Kubuntu 18.10 and I would like to run a simple script every time a computer wakes from suspend. The command is xdotool mousemove 850 82 click 1
and that is all. I have already checked everything I was able to find here. For example I have tried:
#!/bin/bash
case $1 in
post)
xdotool mousemove 850 82 click 1
;;
esac
script was in /lib/systemd/system-sleep/
and it did not work at all. Thanks in advance for the help.
kubuntu
add a comment |
I am using Kubuntu 18.10 and I would like to run a simple script every time a computer wakes from suspend. The command is xdotool mousemove 850 82 click 1
and that is all. I have already checked everything I was able to find here. For example I have tried:
#!/bin/bash
case $1 in
post)
xdotool mousemove 850 82 click 1
;;
esac
script was in /lib/systemd/system-sleep/
and it did not work at all. Thanks in advance for the help.
kubuntu
welcome to ask Ubuntu for this site if there is more than one line of code you should use code blocks (new line then 4 spaces in front of each line). see commonly-accepted-formatting-guidelines for more information.
– Jeff
Feb 6 at 22:13
add a comment |
I am using Kubuntu 18.10 and I would like to run a simple script every time a computer wakes from suspend. The command is xdotool mousemove 850 82 click 1
and that is all. I have already checked everything I was able to find here. For example I have tried:
#!/bin/bash
case $1 in
post)
xdotool mousemove 850 82 click 1
;;
esac
script was in /lib/systemd/system-sleep/
and it did not work at all. Thanks in advance for the help.
kubuntu
I am using Kubuntu 18.10 and I would like to run a simple script every time a computer wakes from suspend. The command is xdotool mousemove 850 82 click 1
and that is all. I have already checked everything I was able to find here. For example I have tried:
#!/bin/bash
case $1 in
post)
xdotool mousemove 850 82 click 1
;;
esac
script was in /lib/systemd/system-sleep/
and it did not work at all. Thanks in advance for the help.
kubuntu
kubuntu
edited Feb 7 at 22:07
Adrian
asked Feb 6 at 20:38
AdrianAdrian
113
113
welcome to ask Ubuntu for this site if there is more than one line of code you should use code blocks (new line then 4 spaces in front of each line). see commonly-accepted-formatting-guidelines for more information.
– Jeff
Feb 6 at 22:13
add a comment |
welcome to ask Ubuntu for this site if there is more than one line of code you should use code blocks (new line then 4 spaces in front of each line). see commonly-accepted-formatting-guidelines for more information.
– Jeff
Feb 6 at 22:13
welcome to ask Ubuntu for this site if there is more than one line of code you should use code blocks (new line then 4 spaces in front of each line). see commonly-accepted-formatting-guidelines for more information.
– Jeff
Feb 6 at 22:13
welcome to ask Ubuntu for this site if there is more than one line of code you should use code blocks (new line then 4 spaces in front of each line). see commonly-accepted-formatting-guidelines for more information.
– Jeff
Feb 6 at 22:13
add a comment |
1 Answer
1
active
oldest
votes
There are scripts that get run at Suspend/Resume/Hibernate/Wake times, but they run in a "system" context, not a "User/GUI" one. Read man pm-action
online.
You could wrap your xdotool
in a bash
script, so you can access the GUI (if you're logged in). Put the line
export DISPLAY=:0
early in your script.
NOTE: DISPLAY=:0
is what works for me, usually. Check with echo $DISPLAY
in a GUI terminal.
It did not work for me and I do not know if it is true but I have found info that in Kubuntu 18.10 start.d is no longer used so scripts there are not working that is why I am trying with /lib/systemd/system-sleep/
– Adrian
Feb 7 at 22:04
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1116203%2fsimple-command-on-wake-from-suspend%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
There are scripts that get run at Suspend/Resume/Hibernate/Wake times, but they run in a "system" context, not a "User/GUI" one. Read man pm-action
online.
You could wrap your xdotool
in a bash
script, so you can access the GUI (if you're logged in). Put the line
export DISPLAY=:0
early in your script.
NOTE: DISPLAY=:0
is what works for me, usually. Check with echo $DISPLAY
in a GUI terminal.
It did not work for me and I do not know if it is true but I have found info that in Kubuntu 18.10 start.d is no longer used so scripts there are not working that is why I am trying with /lib/systemd/system-sleep/
– Adrian
Feb 7 at 22:04
add a comment |
There are scripts that get run at Suspend/Resume/Hibernate/Wake times, but they run in a "system" context, not a "User/GUI" one. Read man pm-action
online.
You could wrap your xdotool
in a bash
script, so you can access the GUI (if you're logged in). Put the line
export DISPLAY=:0
early in your script.
NOTE: DISPLAY=:0
is what works for me, usually. Check with echo $DISPLAY
in a GUI terminal.
It did not work for me and I do not know if it is true but I have found info that in Kubuntu 18.10 start.d is no longer used so scripts there are not working that is why I am trying with /lib/systemd/system-sleep/
– Adrian
Feb 7 at 22:04
add a comment |
There are scripts that get run at Suspend/Resume/Hibernate/Wake times, but they run in a "system" context, not a "User/GUI" one. Read man pm-action
online.
You could wrap your xdotool
in a bash
script, so you can access the GUI (if you're logged in). Put the line
export DISPLAY=:0
early in your script.
NOTE: DISPLAY=:0
is what works for me, usually. Check with echo $DISPLAY
in a GUI terminal.
There are scripts that get run at Suspend/Resume/Hibernate/Wake times, but they run in a "system" context, not a "User/GUI" one. Read man pm-action
online.
You could wrap your xdotool
in a bash
script, so you can access the GUI (if you're logged in). Put the line
export DISPLAY=:0
early in your script.
NOTE: DISPLAY=:0
is what works for me, usually. Check with echo $DISPLAY
in a GUI terminal.
answered Feb 7 at 5:08
waltinatorwaltinator
22.8k74169
22.8k74169
It did not work for me and I do not know if it is true but I have found info that in Kubuntu 18.10 start.d is no longer used so scripts there are not working that is why I am trying with /lib/systemd/system-sleep/
– Adrian
Feb 7 at 22:04
add a comment |
It did not work for me and I do not know if it is true but I have found info that in Kubuntu 18.10 start.d is no longer used so scripts there are not working that is why I am trying with /lib/systemd/system-sleep/
– Adrian
Feb 7 at 22:04
It did not work for me and I do not know if it is true but I have found info that in Kubuntu 18.10 start.d is no longer used so scripts there are not working that is why I am trying with /lib/systemd/system-sleep/
– Adrian
Feb 7 at 22:04
It did not work for me and I do not know if it is true but I have found info that in Kubuntu 18.10 start.d is no longer used so scripts there are not working that is why I am trying with /lib/systemd/system-sleep/
– Adrian
Feb 7 at 22:04
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1116203%2fsimple-command-on-wake-from-suspend%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
welcome to ask Ubuntu for this site if there is more than one line of code you should use code blocks (new line then 4 spaces in front of each line). see commonly-accepted-formatting-guidelines for more information.
– Jeff
Feb 6 at 22:13