scratchpad: Fix lost focus when animating
This commit is contained in:
parent
04724162ac
commit
4572731b1a
1 changed files with 9 additions and 0 deletions
|
@ -114,6 +114,7 @@ class Extension(Plugin):
|
||||||
self._respawned_scratches: set[str] = set()
|
self._respawned_scratches: set[str] = set()
|
||||||
self.scratches_by_address: dict[str, Scratch] = {}
|
self.scratches_by_address: dict[str, Scratch] = {}
|
||||||
self.scratches_by_pid: dict[int, Scratch] = {}
|
self.scratches_by_pid: dict[int, Scratch] = {}
|
||||||
|
self.focused_window_tracking = dict()
|
||||||
|
|
||||||
async def exit(self) -> None:
|
async def exit(self) -> None:
|
||||||
async def die_in_piece(scratch: Scratch):
|
async def die_in_piece(scratch: Scratch):
|
||||||
|
@ -260,14 +261,22 @@ class Extension(Plugin):
|
||||||
if uid in self.transitioning_scratches:
|
if uid in self.transitioning_scratches:
|
||||||
return # abort sequence
|
return # abort sequence
|
||||||
await asyncio.sleep(0.2) # await for animation to finish
|
await asyncio.sleep(0.2) # await for animation to finish
|
||||||
|
|
||||||
if uid not in self.transitioning_scratches:
|
if uid not in self.transitioning_scratches:
|
||||||
await hyprctl(f"movetoworkspacesilent special:scratch,{pid}")
|
await hyprctl(f"movetoworkspacesilent special:scratch,{pid}")
|
||||||
|
|
||||||
|
if (
|
||||||
|
animation_type and uid in self.focused_window_tracking
|
||||||
|
): # focus got lost when animating
|
||||||
|
await hyprctl(f"focuswindow pid:{self.focused_window_tracking[uid]['pid']}")
|
||||||
|
|
||||||
async def run_show(self, uid, force=False) -> None:
|
async def run_show(self, uid, force=False) -> None:
|
||||||
"""<name> shows scratchpad "name" """
|
"""<name> shows scratchpad "name" """
|
||||||
uid = uid.strip()
|
uid = uid.strip()
|
||||||
item = self.scratches.get(uid)
|
item = self.scratches.get(uid)
|
||||||
|
|
||||||
|
self.focused_window_tracking[uid] = await hyprctlJSON("activewindow")
|
||||||
|
|
||||||
if not item:
|
if not item:
|
||||||
print(f"{uid} is not configured")
|
print(f"{uid} is not configured")
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue