Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix 12 #15

Merged
merged 16 commits into from
Sep 26, 2021
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