-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update README.md and release_notes.rst Bump version
- Loading branch information
1 parent
44bcfbc
commit 6b7b794
Showing
5 changed files
with
46 additions
and
43 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
|
||
from .main import lock | ||
|
||
version = "0.0.4" | ||
version = "0.5" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,27 @@ | ||
import os | ||
import logging | ||
import subprocess | ||
|
||
from .module import settings | ||
|
||
|
||
def lock(): | ||
"""Locks the workstation.""" | ||
def lock(logger: logging.Logger = None) -> None: | ||
"""Locks the workstation. | ||
Args: | ||
logger: Bring your own logger. | ||
""" | ||
if settings.os == "Darwin": | ||
os.system( | ||
"""osascript -e 'tell application "System Events" to keystroke "q" using {control down, command down}'""" | ||
) | ||
cmd = """osascript -e 'tell application "System Events" to keystroke "q" using {control down, command down}'""" | ||
elif settings.os == "Windows": | ||
try: | ||
import ctypes | ||
ctypes.windll.user32.LockWorkStation() | ||
except (ImportError, AttributeError): | ||
subprocess.call('rundll32.exe user32.dll, LockWorkStation') | ||
return | ||
except (ImportError, AttributeError) as error: | ||
logger.warning(error) if logger else None | ||
cmd = "rundll32.exe user32.dll, LockWorkStation" | ||
else: | ||
os.system("gnome-screensaver-command --lock") | ||
cmd = "gnome-screensaver-command --lock" | ||
result = subprocess.run(cmd, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) | ||
if result.returncode and logger: | ||
logger.error("Command `%s` failed with error code: %d", result.args, result.returncode) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,16 @@ | ||
Release Notes | ||
============= | ||
|
||
0.5 (11/22/2023) | ||
---------------- | ||
- Includes optional logging to trace errors | ||
|
||
0.0.4 (02/22/2023) | ||
------------------ | ||
- Add an alternate to `ctypes` on `WindowsOS` | ||
- Bump to stable version | ||
- Update README.md | ||
|
||
0.0.3 (02/21/2023) | ||
------------------ | ||
0.0.0a (02/21/2023) | ||
------------------- | ||
- Add pypi requirements and GitHub actions | ||
|
||
0.0.2 (02/21/2023) | ||
------------------ | ||
- Onboard locker | ||
|
||
0.0.1 (02/21/2023) | ||
------------------ | ||
- Initial commit |