fix: fix the issue of failing to retrieve window ID

Description: When using xdotool to retrieve window IDs, if there are multiple windows, the output ends with '\n'. In the original code, directly splitting the string using split("\n") can result in the last element of the resulting list being an empty string. This situation leads to errors when iterating through the window IDs and converting them to int type

Log: fix the issue of failing to retrieve window ID
This commit is contained in:
zhao-george 2023-11-15 15:14:17 +08:00
parent bc2a96002b
commit e7d5b4803c
1 changed files with 1 additions and 1 deletions

View File

@ -557,7 +557,7 @@ class ButtonCenter:
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