Add script to help easily grab URLs for website posts

This commit is contained in:
Jake Howard 2021-08-22 12:05:21 +01:00
parent c901d60319
commit b29f4d00d4
Signed by: jake
GPG key ID: 57AFB45680EDD477
2 changed files with 25 additions and 0 deletions

24
files/bin/website-link Executable file
View file

@ -0,0 +1,24 @@
#!/usr/bin/env python
import json
import subprocess
import urllib.request
URL = "https://theorangeone.net/index.json"
def main():
with urllib.request.urlopen(URL) as response:
data = json.load(response)
url_mapping = {
d['title']: d['url']
for d in data
}
selected_page = subprocess.check_output(["rofi", "-dmenu", "-i", "-format", "s"], input="\n".join(url_mapping.keys()), universal_newlines=True)
selected_page = selected_page.strip()
subprocess.check_output(['xsel', '-bi'], input=url_mapping[selected_page], universal_newlines=True)
if __name__ == '__main__':
main()

View file

@ -59,6 +59,7 @@ bindsym XF86Eject exec --no-startup-id rofi-powermenu
bindsym $mod+P exec --no-startup-id rofi-screenlayout
bindsym $mod+Shift+c exec --no-startup-id vscode-project-list
bindsym $mod+period exec --no-startup-id rofimoji --action type
bindsym $mod+Shift+w exec --no-startup-id website-link
# Screenshots