ygrader 1.2.2__tar.gz → 1.2.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ygrader
3
- Version: 1.2.2
3
+ Version: 1.2.3
4
4
  Summary: Grading scripts used in BYU's Electrical and Computer Engineering Department
5
5
  Home-page: https://github.com/byu-cpe/ygrader
6
6
  Author: Jeff Goeders
@@ -4,7 +4,7 @@ setup(
4
4
  name="ygrader",
5
5
  packages=["ygrader"],
6
6
  package_data={"ygrader": ["*.ahk"]},
7
- version="1.2.2",
7
+ version="1.2.3",
8
8
  description="Grading scripts used in BYU's Electrical and Computer Engineering Department",
9
9
  author="Jeff Goeders",
10
10
  author_email="jeff.goeders@gmail.com",
@@ -193,7 +193,7 @@ def open_file_in_vscode(file_path):
193
193
  # Give VS Code a moment to open, then send Ctrl+` to toggle terminal focus
194
194
  time.sleep(0.5)
195
195
 
196
- # Use AutoHotkey on WSL, xdotool on Linux
196
+ # Use AutoHotkey on WSL, osascript on macOS, xdotool on Linux
197
197
  if is_wsl():
198
198
  # Get the path to the .ahk file in the package
199
199
  package_dir = pathlib.Path(__file__).parent
@@ -216,6 +216,28 @@ def open_file_in_vscode(file_path):
216
216
  f"AutoHotkey not found at {autohotkey_path}. Install AutoHotkey v2 to keep terminal focus when opening files in VS Code."
217
217
  )
218
218
  _FOCUS_WARNING_PRINTED = True
219
+ elif sys.platform == "darwin":
220
+ # macOS: Use osascript to send Ctrl+` (toggle terminal) to VS Code
221
+ applescript = """
222
+ tell application "System Events"
223
+ tell process "Code"
224
+ keystroke "`" using control down
225
+ end tell
226
+ end tell
227
+ """
228
+ result = subprocess.run(
229
+ ["osascript", "-e", applescript],
230
+ stdout=subprocess.DEVNULL,
231
+ stderr=subprocess.DEVNULL,
232
+ check=False,
233
+ )
234
+ if result.returncode != 0:
235
+ if not _FOCUS_WARNING_PRINTED:
236
+ warning(
237
+ f"osascript failed to send hotkey (exit code {result.returncode}). "
238
+ "Make sure VS Code is granted accessibility permissions in System Preferences."
239
+ )
240
+ _FOCUS_WARNING_PRINTED = True
219
241
  else:
220
242
  # Check if xdotool exists
221
243
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ygrader
3
- Version: 1.2.2
3
+ Version: 1.2.3
4
4
  Summary: Grading scripts used in BYU's Electrical and Computer Engineering Department
5
5
  Home-page: https://github.com/byu-cpe/ygrader
6
6
  Author: Jeff Goeders
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes