]> apps.delaporte.us Git - dotfiles.git/commitdiff
Stay Awake for Ubuntu
authorEdTheDev <edward@delaporte.us>
Sat, 6 Jan 2024 16:56:16 +0000 (10:56 -0600)
committerEdTheDev <edward@delaporte.us>
Sat, 6 Jan 2024 16:56:16 +0000 (10:56 -0600)
psmodules/file_management.psm1
psmodules/stay_awake.psm1 [deleted file]

index 3622885c75e91c9e717577a2b90f4a7adfb28135..945d484bca1b36e4f1f2218bd75f90e67f9aa90a 100644 (file)
@@ -46,7 +46,7 @@ Export-ModuleMember -Function Show-LargeFiles
 
 # Stay awake to allow large transfers to complete
 #    without permanently giving up battery saving features
 
 # Stay awake to allow large transfers to complete
 #    without permanently giving up battery saving features
-function Invoke-StayAwake() {
+function Invoke-StayAwakeWindows() {
        param($minutes=90)
        $wsh = New-Object -ComObject WScript.Shell
        do{
        param($minutes=90)
        $wsh = New-Object -ComObject WScript.Shell
        do{
@@ -59,4 +59,15 @@ function Invoke-StayAwake() {
        # Thank you to http://www.zhornsoftware.co.uk/caffeine/
 }
 
        # Thank you to http://www.zhornsoftware.co.uk/caffeine/
 }
 
-Export-ModuleMember -Function Invoke-StayAwake
\ No newline at end of file
+Export-ModuleMember -Function Invoke-StayAwake
+Export-ModuleMember -Function Invoke-StayAwakeWindows
+
+function Invoke-StayAwake() {
+       param($minutes=90)
+       do{
+               "Staying awake for $minutes minutes"
+               systemd-inhibit sleep 60
+               $minutes-=1;
+       }until($minutes -lt 0)
+}
+
diff --git a/psmodules/stay_awake.psm1 b/psmodules/stay_awake.psm1
deleted file mode 100644 (file)
index 40bc896..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-param($minutes=90)
-$wsh = New-Object -ComObject WScript.Shell
-do{
-       "Staying awake for $minutes minutes"
-  $minutes-=1;
-  # Send Shift+F15
-  $wsh.SendKeys('+{F15}')
-  Start-Sleep -seconds 59
-}until($minutes -lt 0)
-# Thank you to http://www.zhornsoftware.co.uk/caffeine/