Skip to content

Commit

Permalink
✨ Display active tab url as an option
Browse files Browse the repository at this point in the history
  • Loading branch information
epilande committed Jan 21, 2021
1 parent e8a5b59 commit 843526b
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import subprocess

clip0 = os.environ['clip0']
clip1 = os.environ['clip1']
Expand All @@ -11,5 +12,21 @@
clip8 = os.environ['clip8']
clip9 = os.environ['clip9']

clipboard = filter(None, [clip0, clip1, clip2, clip3,
clip4, clip5, clip6, clip7, clip8, clip9])
result = subprocess.run(['osascript', '-e',
'if application "Google Chrome" is running then tell application "Google Chrome" to return URL of active tab of front window'
], stdout=subprocess.PIPE)
activeTabUrl = result.stdout.decode('utf-8')

clipboard = filter(None, [
activeTabUrl,
clip0,
clip1,
clip2,
clip3,
clip4,
clip5,
clip6,
clip7,
clip8,
clip9,
])

0 comments on commit 843526b

Please sign in to comment.