Last active
December 11, 2021 11:41
-
-
Save R3tr0BoiDX/bbe044e0ec1c07a8fbe650923413df21 to your computer and use it in GitHub Desktop.
Opens .desktop files in webbrowser. They are created by Cinnamon, when dropping a link from your webbrowser on the desktop. Windows (and often Cinnamon itself) can't open them. Open a .desktop file with this tool and it will open the URL in your default webbrowser.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import webbrowser | |
searchFor = "URL" | |
file = open(sys.argv[1]) | |
for line in file: | |
if searchFor in line: | |
url = line[4:] | |
webbrowser.open(url) | |
print(url) | |
file.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Known bug: I don't know which character encoding Python is using, but it has problems parsing files with Cyrillic, Chinese, Greek, Japanese,... characters.