Last active
December 16, 2017 18:29
-
-
Save csm10495/d4718c9a2d284cd0da029bf8fb3008cc to your computer and use it in GitHub Desktop.
Hides the red box around a Skype screenshare
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Brief: | |
snb.py - Removes the red border Skype makes when screensharing. | |
Also sets Skype to low priority with a processor affinity to only run on one cpu/core. | |
This should help keep game/other app performance decent. | |
Description: | |
Run the script once when the border is up, and it will go away | |
(C) - MIT License - 2017 | |
Author(s): | |
Charles Machalow | |
''' | |
from ctypes import windll, c_char_p | |
import multiprocessing | |
import subprocess | |
SKYPE_LOW_PRIORITY_CMD = r'"C:\Windows\System32\wbem\WMIC.exe" process where name="skype.exe" CALL setpriority "idle"' | |
SKYPE_AFFINITY = 'PowerShell "$Process = Get-Process skype; $Process.ProcessorAffinity=%d"' | |
SW_HIDE = 0 | |
def getWindowHwnd(className, windowName=None): | |
''' | |
Brief: | |
Attempts to get an hwnd object via the FindWindow WinApi callable | |
Author(s): | |
Charles Machalow | |
''' | |
if windowName: | |
return windll.user32.FindWindowA(c_char_p(className.encode()), c_char_p(windowName.encode())) | |
return windll.user32.FindWindowA(c_char_p(className.encode()), None) | |
def setSkypeToLowestPriority(): | |
''' | |
Brief: | |
Sets the Skype application to low priority and only allows it to run on one cpu/core | |
Author(s): | |
Charles Machalow | |
''' | |
# low priority | |
subprocess.check_output(SKYPE_LOW_PRIORITY_CMD, shell=True) | |
# affinity to just last core | |
numCpu = multiprocessing.cpu_count() | |
bitMask = 1 << (numCpu - 1) | |
subprocess.check_output(SKYPE_AFFINITY % bitMask, shell=True) | |
if __name__ == '__main__': | |
# Hide all of the red-border windows | |
hwnd = getWindowHwnd('TLiveConversationWindow') | |
windll.user32.ShowWindow(hwnd, SW_HIDE) | |
hwnd = getWindowHwnd('TSimpleSelection') | |
windll.user32.ShowWindow(hwnd, SW_HIDE) | |
setSkypeToLowestPriority() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment