Skip to content

Instantly share code, notes, and snippets.

@marcinwol
Last active August 29, 2015 14:26
Show Gist options
  • Save marcinwol/fc77faeb1550192ce6d7 to your computer and use it in GitHub Desktop.
Save marcinwol/fc77faeb1550192ce6d7 to your computer and use it in GitHub Desktop.
Start IrfanView in Linux with input file
#!/usr/bin/python3
#
# Put the file, for example in: /home/marcin/bin/startirfan.py
# and mark it as executable: chmod +x /home/marcin/bin/startirfan.py
#
# Make IrfanViewMine.desktop in /home/marcin/.local/share/applications that contains:
#
# [Desktop Entry]
# Encoding=UTF-8
# Name=MineIrfanView348
# Comment=IrfanView 3.48
# Exec=/home/marcin/bin/startirfan.py %u
# Terminal=false
# Type=Application
# Icon=B68D_i_view32.0
# Categories=Application;Utility;ImageEditor;
# StartupNotify=true
# MimeType=text/plain;
# NoDisplay=true
import getpass
import os
import sys
current_user = getpass.getuser();
wine_prefix = 'env WINEPREFIX="/home/{}/.wine" '.format(current_user)
wine_cmd = wine_prefix + 'wine "C:\Program Files\IrfanView\i_view32.exe" '
if len(sys.argv) == 2:
img_file = sys.argv[1]
img_file = "Z:\\" + img_file.replace('/', '\\')
wine_cmd += '"'+img_file+'"'
print(wine_cmd)
os.system(wine_cmd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment