示例#1
0
 def file_manager_terminal_here():
     applescript.run(r"""
     tell application "Finder"
         set myWin to window 1
         set thePath to (quoted form of POSIX path of (target of myWin as alias))
         tell application "Terminal"
             activate
             tell window 1
                 do script "cd " & thePath
             end tell
         end tell
     end tell""")
示例#2
0
    def file_manager_terminal_here():
        """Opens terminal at current location"""
        if not is_terminal:
            if is_windows:
                actions.key("ctrl-l")
                actions.insert("cmd.exe")
                actions.key("enter")
            elif is_mac:
                from talon.mac import applescript

                applescript.run(r"""
                tell application "Finder"
                    set myWin to window 1
                    set thePath to (quoted form of POSIX path of (target of myWin as alias))
                    tell application "Terminal"
                        activate
                        tell window 1
                            do script "cd " & thePath
                        end tell
                    end tell
                end tell""")
示例#3
0
 def address() -> str:
     try:
         window = brave_app().windows()[0]
     except IndexError:
         return ''
     try:
         web_area = window.element.children.find_one(AXRole='AXWebArea')
         address = web_area.AXURL
     except (ui.UIErr, AttributeError):
         address = applescript.run('''
             tell application id "com.brave.Browser"
                 if not (exists (window 1)) then return ""
                 return window 1's active tab's URL
             end tell
         ''')
     return address
示例#4
0
 def address() -> str:
     try:
         window = safari_app().windows()[0]
     except IndexError:
         return ''
     try:
         address_field = window.element.children.find_one(
             AXRole='AXTextField', AXIdentifier='WEB_BROWSER_ADDRESS_AND_SEARCH_FIELD')
         address = address_field.AXValue
     except (ui.UIErr, AttributeError):
         address = applescript.run('''
         tell application id "com.apple.Safari"
             if not (exists (window 1)) then return ""
             return window 1's current tab's URL
         end tell
         ''')
     return address