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

fix: fix the issue of failing to retrieve window ID #3

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/button_center.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def window_info(self):
interrupt=False,
out_debug_flag=False,
command_log=False,
).split("\n")
).strip().split("\n")
app_id_list = [int(_id) for _id in app_id if _id]
app_id_list.sort()
logger.debug(f"app_id_list: {app_id_list}")
Expand Down Expand Up @@ -557,7 +557,7 @@ def get_windows_number(cls, name: str) -> int:
cmd = f"xdotool search --classname {name}"
app_id = CmdCtl.run_cmd(
cmd, interrupt=False, out_debug_flag=False, command_log=False
)
).strip()
return len([i for i in app_id.split("\n") if i])

@classmethod
Expand All @@ -570,7 +570,7 @@ def get_windows_id(cls, name: str) -> list:
cmd = f"xdotool search --onlyvisible --classname {name}"
app_id = CmdCtl.run_cmd(
cmd, interrupt=False, out_debug_flag=False, command_log=False
)
).strip()
if app_id:
return [i for i in app_id.split("\n") if i]
raise ApplicationStartError(app_id)
Expand Down Expand Up @@ -600,7 +600,7 @@ def get_lastest_window_id(app_name: str) -> int:
interrupt=False,
out_debug_flag=False,
command_log=False,
).split("\n")
).strip().split("\n")
app_id_list = [int(_id) for _id in app_id if _id] # to int
app_id_list.sort()
return app_id_list[-1]
Expand Down
Loading