Last active
June 27, 2019 20:00
-
-
Save davebrny/9850223119c4ee55485dfae1fcbb8488 to your computer and use it in GitHub Desktop.
(autokey) - select a file to run in Wine
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 getpass | |
import os.path | |
import subprocess | |
keyboard.send_keys("<ctrl>+c") | |
time.sleep(0.2) | |
str = clipboard.get_clipboard() | |
if "/.wine/" not in str: # if path is a native linux folder | |
user = getpass.getuser() | |
root = "/home/" + user | |
wine = root + "/.wine/drive_c/users/" + user | |
if root + "/Desktop/" in str: | |
str.replace(root + "/Desktop" , wine + "/Desktop") | |
elif root + "/Documents" in str: | |
str.replace(root + "/Documents", wine + "/My Documents") | |
elif root + "/Pictures" in str: | |
str.replace(root + "/Pictures" , wine + "/My Pictures") | |
elif root + "/Music" in str: | |
str.replace(root + "/Music" , wine + "/My Music") | |
elif root + "/Videos" in str: | |
str.replace(root + "/Videos" , wine + "/My Videos") | |
if os.path.isfile(str): | |
if str[-3:] == 'ahk': | |
ahk_path = "/home/dave/.wine/drive_c/users/dave/My Documents/autohotkey portable/AutoHotkeyU32.exe" | |
subprocess.Popen(["wine", ahk_path, str]) | |
else: | |
subprocess.Popen(["wine", str]) | |
''' | |
[script info] | |
version = 0.1 | |
description = run a program in Wine | |
author = davebrny | |
source = https://gist.github.com/davebrny/9850223119c4ee55485dfae1fcbb8488 | |
software = AutoKey 0.90.4 (Pop_OS 18.10) | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
usage
normally you can only run programs that are somewhere in Wine's
drive_c
folder but with this script you can also run from the following native Linux folders and the paths will be swapped out so it runs the files in Wine's corresponding folders