Skip to content

Commit

Permalink
Merge pull request #15 from stevenj2019/bug-fix-12
Browse files Browse the repository at this point in the history
Bug fix for #12
  • Loading branch information
maltfield authored Sep 26, 2021
2 parents e19af70 + e3f047d commit 165ec7c
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/packages/buskill/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
File: buskill.py
Authors: Michael Altfield <michael@buskill.in>
Co-Auth: Steven Johnson <steven.j2019@protonmail.com>
Created: 2020-06-23
Updated: 2020-08-09
Updated: 2020-11-30
Version: 0.2
This is the heart of the buskill app, shared by both the cli and gui
Expand All @@ -19,6 +20,7 @@

import platform, multiprocessing, traceback, subprocess
import urllib.request, re, json, certifi, sys, os, math, shutil, tempfile, random, gnupg
import os.path
from buskill_version import BUSKILL_VERSION
from distutils.version import LooseVersion
from hashlib import sha256
Expand Down Expand Up @@ -200,6 +202,7 @@ def __init__(self):

# instantiate instance fields
self.CURRENT_PLATFORM = None
self.KERNEL_VERSION = None
self.IS_PLATFORM_SUPPORTED = False
self.OS_NAME_SHORT = None
self.ERR_PLATFORM_NOT_SUPPORTED = None
Expand Down Expand Up @@ -280,6 +283,8 @@ def __init__(self):
if CURRENT_PLATFORM.startswith( 'DARWIN' ):
self.IS_PLATFORM_SUPPORTED = True
self.OS_NAME_SHORT = 'mac'

self.KERNEL_VERSION = str(platform.release()).split('.')[0]
self.ARM_FUNCTION = self.armNix
self.TRIGGER_FUNCTION = self.triggerMac

Expand Down Expand Up @@ -658,12 +663,11 @@ def triggerWin(self):
def triggerMac(self):
msg = "DEBUG: BusKill lockscreen trigger executing now"
print( msg ); logger.info( msg )

try:
subprocess.run( ['pmset', 'displaysleepnow'] )
except FileNotFoundError as e:
subprocess.run( ['/System/Library/CoreServices/Menu Extras/user.menu/Contents/Resources/CGSession', '-suspend'] )

subprocess.call( ['/System/Library/CoreServices/Menu Extras/user.menu/Contents/Resources/CGSession', '-suspend'] )
except:
msg = "ERROR: Mac Kernel" + self.KERNEL_VERSION + "Unsupported"
print( msg ); logger.error(msg)
#####################
# UPGRADE FUNCTIONS #
#####################
Expand Down Expand Up @@ -771,7 +775,7 @@ def integrity_is_ok( self, sha256sums_filepath, local_filepaths ):

return True

def get_upgrade_status(self):
f def get_upgrade_status(self):

# is the message (upgrade_status_msg) a string that we can read from
# directly (running synchronously) or a multiprocessing.Array() because
Expand Down

0 comments on commit 165ec7c

Please sign in to comment.