Skip to content
This repository has been archived by the owner on Dec 29, 2023. It is now read-only.

Commit

Permalink
Update desktop_file creation utility (Linux OS) #113 #112
Browse files Browse the repository at this point in the history
  • Loading branch information
srevinsaju committed May 8, 2020
1 parent 4d3bcd0 commit 255d409
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions guiscrcpy/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@
action='store_true',
help="Disable the swipe panel"
)
parser.add_argument(
'--connect',
default='',
help="Disable the swipe panel"
)
parser.add_argument(
'-q',
'--noscrcpy',
Expand Down Expand Up @@ -250,6 +255,13 @@

logger.debug("Current Working Directory {}".format(os.getcwd()))

if args.connect:
adb_cnx_output = adb.command(adb.path, 'connect {}'.format(args.connect))
print(
adb_cnx_output.stdout.read().decode(),
adb_cnx_output.stderr.read().decode()
)

if args.start:
devices = adb.devices_detailed(adb.path)
logger.debug("RUNNING SCRCPY DIRECTLY")
Expand Down Expand Up @@ -439,6 +451,9 @@ def launch_usb_audio():
else:
return
Popen(path_to_usbaudio, stdout=PIPE, stderr=PIPE)
@staticmethod
def launch_web_srevinsaju():
webbrowser.open("https://srevinsaju.github.io")

@staticmethod
def launch_web_github():
Expand Down Expand Up @@ -573,13 +588,18 @@ def create_desktop_shortcut_linux_os(self):

# convert the list into a string
sys_args_desktop = ' '.join(sys_args_desktop)
auto_connect_run_command = \
"{executable} --connect={ip} " \
"--start --start-scrcpy-device-id={ip}".format(
executable=sys_args_desktop,
ip=identifier
)

# create the desktop file using linux's desktop file gen method
path_to_desktop_file = platform.System().create_desktop(
desktop_file=GUISCRCPY_DEVICE.format(
identifier=model,
command=f'{adb.path} connect {identifier}; '
f'{sys_args_desktop}',
command=auto_connect_run_command,
icon_path=path_to_image
),
desktop_file_name=f'{model}.guiscrcpy.desktop'
Expand Down

0 comments on commit 255d409

Please sign in to comment.