Script to execute specifically on login from suspend on 16.04

Clash Royale CLAN TAG#URR8PPP up vote
2
down vote
favorite
I have a script that sets up my mouse preferences and itâÂÂs placed in Startup applications. It runs on startup, but when the lid is closed or the computer manually put in suspend (same thing really), the settings get removed. I have it so Ubuntu requires my password on return from suspend, but this login doesnâÂÂt seem to be the same as a regular login, as it doesnâÂÂt execute .profile or .bashrc.
I tried placing my script in /lib/systemd/system-sleep/ but this executes before entering my password and it doesnâÂÂt seem that xinput commands work at that point in the wake up cycle because the changes donâÂÂt take effect.
So IâÂÂm either looking for a way to make every suspend also execute a lock or log off cycle (as locking manually executes .profile) or find a way to execute a script specifically on the password entry on resume from suspend.
scripts login mouse suspend
add a comment |Â
up vote
2
down vote
favorite
I have a script that sets up my mouse preferences and itâÂÂs placed in Startup applications. It runs on startup, but when the lid is closed or the computer manually put in suspend (same thing really), the settings get removed. I have it so Ubuntu requires my password on return from suspend, but this login doesnâÂÂt seem to be the same as a regular login, as it doesnâÂÂt execute .profile or .bashrc.
I tried placing my script in /lib/systemd/system-sleep/ but this executes before entering my password and it doesnâÂÂt seem that xinput commands work at that point in the wake up cycle because the changes donâÂÂt take effect.
So IâÂÂm either looking for a way to make every suspend also execute a lock or log off cycle (as locking manually executes .profile) or find a way to execute a script specifically on the password entry on resume from suspend.
scripts login mouse suspend
Can you give example of his you are using xinput command?
â WinEunuuchs2Unix
May 18 at 21:20
Yeah, one of the lines in the script is "xinput --set-prop 12 291 -1". This sets the acceleration (option 291) of the trackpad (input 12) to -1 (so no acceleration). I had a script in /lib/systemd/system-sleep/ that would print text to a file on wakeup. It would work fine, but as soon as I added the xinput commands, the script would crash and not finish (I had two echo "text" >> test.txt commands sandwiching the xinput commands. The second wouldn't complete when the xinput commnds were added to the script).
â Sam Thibodeau
May 22 at 18:17
You should post the script into your question. Then people answering can use your script setup rather than their own. For example mine would be with WiFi or Ethernet kernel modules reloading after sleep.
â WinEunuuchs2Unix
May 22 at 18:36
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I have a script that sets up my mouse preferences and itâÂÂs placed in Startup applications. It runs on startup, but when the lid is closed or the computer manually put in suspend (same thing really), the settings get removed. I have it so Ubuntu requires my password on return from suspend, but this login doesnâÂÂt seem to be the same as a regular login, as it doesnâÂÂt execute .profile or .bashrc.
I tried placing my script in /lib/systemd/system-sleep/ but this executes before entering my password and it doesnâÂÂt seem that xinput commands work at that point in the wake up cycle because the changes donâÂÂt take effect.
So IâÂÂm either looking for a way to make every suspend also execute a lock or log off cycle (as locking manually executes .profile) or find a way to execute a script specifically on the password entry on resume from suspend.
scripts login mouse suspend
I have a script that sets up my mouse preferences and itâÂÂs placed in Startup applications. It runs on startup, but when the lid is closed or the computer manually put in suspend (same thing really), the settings get removed. I have it so Ubuntu requires my password on return from suspend, but this login doesnâÂÂt seem to be the same as a regular login, as it doesnâÂÂt execute .profile or .bashrc.
I tried placing my script in /lib/systemd/system-sleep/ but this executes before entering my password and it doesnâÂÂt seem that xinput commands work at that point in the wake up cycle because the changes donâÂÂt take effect.
So IâÂÂm either looking for a way to make every suspend also execute a lock or log off cycle (as locking manually executes .profile) or find a way to execute a script specifically on the password entry on resume from suspend.
scripts login mouse suspend
edited May 18 at 15:48
Zanna
47.9k13117227
47.9k13117227
asked May 18 at 15:29
Sam Thibodeau
111
111
Can you give example of his you are using xinput command?
â WinEunuuchs2Unix
May 18 at 21:20
Yeah, one of the lines in the script is "xinput --set-prop 12 291 -1". This sets the acceleration (option 291) of the trackpad (input 12) to -1 (so no acceleration). I had a script in /lib/systemd/system-sleep/ that would print text to a file on wakeup. It would work fine, but as soon as I added the xinput commands, the script would crash and not finish (I had two echo "text" >> test.txt commands sandwiching the xinput commands. The second wouldn't complete when the xinput commnds were added to the script).
â Sam Thibodeau
May 22 at 18:17
You should post the script into your question. Then people answering can use your script setup rather than their own. For example mine would be with WiFi or Ethernet kernel modules reloading after sleep.
â WinEunuuchs2Unix
May 22 at 18:36
add a comment |Â
Can you give example of his you are using xinput command?
â WinEunuuchs2Unix
May 18 at 21:20
Yeah, one of the lines in the script is "xinput --set-prop 12 291 -1". This sets the acceleration (option 291) of the trackpad (input 12) to -1 (so no acceleration). I had a script in /lib/systemd/system-sleep/ that would print text to a file on wakeup. It would work fine, but as soon as I added the xinput commands, the script would crash and not finish (I had two echo "text" >> test.txt commands sandwiching the xinput commands. The second wouldn't complete when the xinput commnds were added to the script).
â Sam Thibodeau
May 22 at 18:17
You should post the script into your question. Then people answering can use your script setup rather than their own. For example mine would be with WiFi or Ethernet kernel modules reloading after sleep.
â WinEunuuchs2Unix
May 22 at 18:36
Can you give example of his you are using xinput command?
â WinEunuuchs2Unix
May 18 at 21:20
Can you give example of his you are using xinput command?
â WinEunuuchs2Unix
May 18 at 21:20
Yeah, one of the lines in the script is "xinput --set-prop 12 291 -1". This sets the acceleration (option 291) of the trackpad (input 12) to -1 (so no acceleration). I had a script in /lib/systemd/system-sleep/ that would print text to a file on wakeup. It would work fine, but as soon as I added the xinput commands, the script would crash and not finish (I had two echo "text" >> test.txt commands sandwiching the xinput commands. The second wouldn't complete when the xinput commnds were added to the script).
â Sam Thibodeau
May 22 at 18:17
Yeah, one of the lines in the script is "xinput --set-prop 12 291 -1". This sets the acceleration (option 291) of the trackpad (input 12) to -1 (so no acceleration). I had a script in /lib/systemd/system-sleep/ that would print text to a file on wakeup. It would work fine, but as soon as I added the xinput commands, the script would crash and not finish (I had two echo "text" >> test.txt commands sandwiching the xinput commands. The second wouldn't complete when the xinput commnds were added to the script).
â Sam Thibodeau
May 22 at 18:17
You should post the script into your question. Then people answering can use your script setup rather than their own. For example mine would be with WiFi or Ethernet kernel modules reloading after sleep.
â WinEunuuchs2Unix
May 22 at 18:36
You should post the script into your question. Then people answering can use your script setup rather than their own. For example mine would be with WiFi or Ethernet kernel modules reloading after sleep.
â WinEunuuchs2Unix
May 22 at 18:36
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1037812%2fscript-to-execute-specifically-on-login-from-suspend-on-16-04%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
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
Can you give example of his you are using xinput command?
â WinEunuuchs2Unix
May 18 at 21:20
Yeah, one of the lines in the script is "xinput --set-prop 12 291 -1". This sets the acceleration (option 291) of the trackpad (input 12) to -1 (so no acceleration). I had a script in /lib/systemd/system-sleep/ that would print text to a file on wakeup. It would work fine, but as soon as I added the xinput commands, the script would crash and not finish (I had two echo "text" >> test.txt commands sandwiching the xinput commands. The second wouldn't complete when the xinput commnds were added to the script).
â Sam Thibodeau
May 22 at 18:17
You should post the script into your question. Then people answering can use your script setup rather than their own. For example mine would be with WiFi or Ethernet kernel modules reloading after sleep.
â WinEunuuchs2Unix
May 22 at 18:36