Skip to content

Commit

Permalink
Delete dead Windows-specific code (talonhub#1441)
Browse files Browse the repository at this point in the history
  • Loading branch information
auscompgeek authored Jun 2, 2024
1 parent 879ab2c commit 71ab00a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
11 changes: 2 additions & 9 deletions apps/wsl/wsl.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@
# note: this context match is intentionally made more complex so that it is more specific
# than the context defined in apps/win/windows_terminal/windows_terminal.py (and thereby
# takes precedence).
ctx.matches = rf"""
ctx.matches = """
app: windows_terminal
and tag: user.wsl
tag: user.wsl
"""

if app.platform == "windows":
import atexit
import platform

import win32api
Expand Down Expand Up @@ -67,10 +66,6 @@ def _close_key():
win32api.RegCloseKey(registry_key_handle)
registry_key_handle = None

# make sure registry is closed on exit
def atexit():
_close_key()

# open the registry key containing the list of installed wsl distros
def _initialize_key():
global key_event, registry_key_handle, registry_access_flags
Expand Down Expand Up @@ -152,7 +147,7 @@ def _update_wsl_distros():
error = win32api.GetLastError()
_close_key()
raise Exception(
"failed while checking for wsl registry updates: {result=}: {error=}"
f"failed while checking for wsl registry updates: {result=}: {error=}"
)
except OSError:
if distro_handle:
Expand Down Expand Up @@ -254,7 +249,6 @@ def _disable_path_detection(notify=True):


def run_wslpath(args, in_path, in_distro=None):
global path_detection_disabled
path = ""

if not path_detection_disabled:
Expand Down Expand Up @@ -420,7 +414,6 @@ def file_manager_open_parent():
actions.key("enter")

def file_manager_current_path():
global path_detection_disabled
if path_detection_disabled:
logging.warning(
'Skipping WSL path detection - try "weasel reset path detection"'
Expand Down
12 changes: 1 addition & 11 deletions core/app_switcher/app_switcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,9 @@
if app.platform == "windows":
import ctypes
import os

import pywintypes

try:
pass
except ImportError:
# Python 2
pass

bytes = lambda x: str(buffer(x))

from ctypes import wintypes

import pywintypes
from win32com.propsys import propsys, pscon
from win32com.shell import shell, shellcon

Expand Down

0 comments on commit 71ab00a

Please sign in to comment.