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

Add a command to copy the url of the current page #534

Merged
merged 10 commits into from
Aug 6, 2021
7 changes: 6 additions & 1 deletion apps/chrome/chrome.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
app: chrome
"""


@ctx.action_class("user")
class user_actions:
def tab_jump(number: int):
Expand All @@ -34,6 +33,11 @@ def tab_final():
else:
actions.key("ctrl-9")

# TODO move to generic browser implementation to be shared by all browsers once we have one
def address_copy():
actions.browser.focus_address()
actions.sleep("50ms")
actions.edit.copy()

@ctx.action_class("browser")
class browser_actions:
Expand All @@ -42,3 +46,4 @@ def go(url: str):
actions.sleep("50ms")
actions.insert(url)
actions.key("enter")

1 change: 1 addition & 0 deletions apps/generic_browser.talon
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
tag: browser
-
(address bar | go address | go url): browser.focus_address()
(address copy | url copy | copy address | copy url ): user.address_copy()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quite a few different commands here as I try to stay consistent with the existing commands in the file but also meet the desired object -> verb standards

go home: browser.go_home()
[go] forward: browser.go_forward()
go (back | backward): browser.go_back()
Expand Down
8 changes: 8 additions & 0 deletions code/browser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from talon import Context, actions, ui, Module, app

mod = Module()

@mod.action_class
class tab_actions:
def address_copy():
"""Copies the address of the current page"""