Skip to content

Commit

Permalink
implement #60 as unfetch_client
Browse files Browse the repository at this point in the history
  • Loading branch information
fdev31 committed Mar 14, 2024
1 parent 2aa3716 commit 2f23afe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyprland/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ async def run_client():
manager = Pyprland()

if sys.argv[1] == "version":
print("2.0.8-17-g2d18d2a") # Automatically updated version
print("2.0.8-18-g2aa3716") # Automatically updated version
return

if sys.argv[1] in ("--help", "-h", "help"):
Expand Down
13 changes: 13 additions & 0 deletions pyprland/plugins/fetch_client_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,20 @@
class Extension(MenuMixin, Plugin):
"Shows a menu with shortcuts"

_windows_origins: dict[str, str] = {}

# Commands

async def run_unfetch_client(self):
"Returns a window back to its origin"
addr = state.active_window
try:
origin = self._windows_origins[addr]
except KeyError:
await self.notify_error("unknown window origin")
else:
await self.hyprctl(f"movetoworkspacesilent {origin},address:{addr}")

async def run_fetch_client_menu(self):
"Select a client window and move it to the active workspace"
await self.ensure_menu_configured()
Expand All @@ -25,6 +37,7 @@ async def run_fetch_client_menu(self):
if choice:
num = int(choice.split(None, 1)[0]) - 1
addr = clients[num]["address"]
self._windows_origins[addr] = clients[num]["workspace"]["name"]
await self.hyprctl(
f"movetoworkspace {state.active_workspace},address:{addr}"
)

0 comments on commit 2f23afe

Please sign in to comment.