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

[SUGGESTION] Save settings to *.desktop file #113

Closed
Thyrador opened this issue May 1, 2020 · 27 comments
Closed

[SUGGESTION] Save settings to *.desktop file #113

Thyrador opened this issue May 1, 2020 · 27 comments
Labels
feature Enhancement

Comments

@Thyrador
Copy link

Thyrador commented May 1, 2020

As per request:

Creating *.desktop-files from the settings: so you can easily create shortcuts to devices you frequently use.

This should support connections to devices connected to usb aswell as devices connected via WiFi. For example (connection via WiFi):

[Desktop Entry]
Categories=GTK;Filesystem;Network;
Name=guiscrcpy
GenericName=Android Remote Control
Comment=Display and control your Android device
Exec=sh -c "adb connect 192.168.179.171:5555 && scrcpy -m 1024 --window-title 'My awesome tablet' -S -s 192.168.179.171:5555"
Icon=guiscrcpy
Terminal=false
Type=Application
Categories=Utility;RemoteAccess;
StartupNotify=false

@srevinsaju srevinsaju added the feature Enhancement label May 1, 2020
srevinsaju added a commit that referenced this issue May 3, 2020
The UI now has
* removed notification adduitor once and for all #112 #113
* Add an extensive device selector view
* Add a refresh button to refresh the deviceview
* Downtone the buttons to darker grey for a modern touch
* Remove 'SS' branding 🎉
@srevinsaju
Copy link
Owner

@Thyrador
G' day

I have implemented the desktop file functionality you have asked for.
See #111

For prebuilt binaries, see:
https://github.com/srevinsaju/guiscrcpy/releases/tag/continuous

Please let me know if anything is not working regarding the same

@Thyrador
Copy link
Author

Thyrador commented May 4, 2020

@srevinsaju
Good day :)

Tested the AppImage and although it prints that the desktop file was created, I can nowhere seem to find it. Tried finding it via find and locate to no avail.
I saw that you will log the filepath. Wouldn't it be better to print it to the user so if someone is not that skilled with these things it actually will be possible to know where these files get saved to?

@srevinsaju
Copy link
Owner

@Thyrador try

export GUISCRCPY_DEBUG=True

It should be found on ~/Desktop under normal conditions

@Thyrador
Copy link
Author

Thyrador commented May 4, 2020

They won't get generated. Can't find an .guiscrcpy.desktop on my system.

@Thyrador
Copy link
Author

Thyrador commented May 4, 2020

This is what I get:

Creating desktop shortcut sha: 452f0f
Path to desktop file : False

@srevinsaju
Copy link
Owner

export XDG_DESKTOP_PATH to your desktop path

@srevinsaju
Copy link
Owner

srevinsaju commented May 4, 2020

@Thyrador https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

guiscrcpy respects XDG paths to find the desktop path' Export the XDG_DESKTOP_PATH for guiscrcpy to find where to save the file; export the XDG PATH and then rerun the guiscrcpy file

@Thyrador
Copy link
Author

Thyrador commented May 4, 2020

Could you give me instructions on how to do that?

@srevinsaju
Copy link
Owner

srevinsaju commented May 4, 2020

@Thyrador

export XDG_DESKTOP_DIR=/path/to/where/you/want/shortcut

@Thyrador
Copy link
Author

Thyrador commented May 4, 2020

Thanks. Tested it and it indeed get saved to the desktop. Unfortunately adb path is messed up. It will generate something like this:

Exec=/tmp/.mount_guiscr9qXqEi/usr/bin/adb connect 192.168.34.13:5555; /tmp/.mount_guiscr9qXqEi/opt/python3.8/bin/guiscrcpy

When trying to execute it it just stops with the error, that adb is not to be found on this path.

@Thyrador
Copy link
Author

Thyrador commented May 4, 2020

Also guiscrcpy should be replaced with guiscrcpy -s 192.168.34.13:5555 when connecting with ip.
Path to guiscrcpy also is not right, so it won't start (have removed the python module and running the snap), testing with the app image.

@srevinsaju
Copy link
Owner

Most probably because its an AppImage; maybe you can try the pypi wheel from the releases

pip3 install guiscrcpy*continuous*.whl

Download the wheel and then run the above command; Hope it works

@Thyrador
Copy link
Author

Thyrador commented May 4, 2020

Okay, it seem to work now. Except for the thing that I expected it to actually execute scrcpy when starting the desktop app. Otherwise it just seem to open guiscrcpy only.

EDIT: command line arguments seem not to get put into the *.desktop-file.

It may be just me, but I would find it better if the panel options would be in the same column, instead of the same row:
grafik

@srevinsaju
Copy link
Owner

Ok, I will add support for appimages, and automatically start scrcpy along with guiscrcpy so it becomes easier. Hope the current implementation is ok,

Any suggestions about the UI for Device View?

@Thyrador
Copy link
Author

Thyrador commented May 4, 2020

Does look okay to me, except that if I add a second device it won't show up in the list

@srevinsaju
Copy link
Owner

srevinsaju commented May 4, 2020

@Thyrador You might need to refresh then;
guiscrcpy does not implement auto refresh due to performance reasons; Now onwards; we only need to connect to the device once if it is on WiFi.
I will add a hook to refresh devices when the Wifi button is pressed on guiscrcpy too. .

Sorry for the delay

@Thyrador
Copy link
Author

Thyrador commented May 4, 2020

Doesn't seem to work either:

connected to 192.168.34.12:5555

Traceback (most recent call last):
  File "/home/user/.local/lib/python3.8/site-packages/guiscrcpy/launcher.py", line 625, in scan_devices_update_list_view
    devices = adb.devices_detailed(adb.path)
  File "/home/user/.local/lib/python3.8/site-packages/guiscrcpy/lib/check.py", line 174, in devices_detailed
    'model': device[3].split(':')[1],
IndexError: list index out of range

After closing and restarting it, guiscrcpy now won start at all:

Traceback (most recent call last):
  File "/home/user/.local/bin/guiscrcpy", line 8, in <module>
    sys.exit(bootstrap())
  File "/home/user/.local/lib/python3.8/site-packages/guiscrcpy/launcher.py", line 1109, in bootstrap
    bootstrap0()
  File "/home/user/.local/lib/python3.8/site-packages/guiscrcpy/launcher.py", line 1079, in bootstrap0
    guiscrcpy = InterfaceGuiscrcpy()
  File "/home/user/.local/lib/python3.8/site-packages/guiscrcpy/launcher.py", line 337, in __init__
    self.refresh_devices()
  File "/home/user/.local/lib/python3.8/site-packages/guiscrcpy/launcher.py", line 344, in refresh_devices
    self.scan_devices_update_list_view()
  File "/home/user/.local/lib/python3.8/site-packages/guiscrcpy/launcher.py", line 625, in scan_devices_update_list_view
    devices = adb.devices_detailed(adb.path)
  File "/home/user/.local/lib/python3.8/site-packages/guiscrcpy/lib/check.py", line 174, in devices_detailed
    'model': device[3].split(':')[1],
IndexError: list index out of range

Deleting guiscrcpy.json doesn't seem to help.

@srevinsaju
Copy link
Owner

@Thyrador

It may be just me, but I would find it better if the panel options would be in the same column, instead of the same row:

Ok; thanks for the suggesstion. I will add the auto start scrcpy argument too

@srevinsaju
Copy link
Owner

@Thyrador can you give me the output of

adb devices -l

@Thyrador
Copy link
Author

Thyrador commented May 4, 2020

Sure.

adb devices -l
List of devices attached
192.168.34.13:5555   device product:gts6leea model:SM_T865 device:gts6l transport_id:3
192.168.34.12:5555   unauthorized transport_id:1

@srevinsaju
Copy link
Owner

Thanks; I will have to add a check for unauthorized devices too. Meanwhile I fix it; you can try to authorize your device and try again; it should work
You should get a popup on your device asking for permissions

@srevinsaju
Copy link
Owner

@Thyrador
Copy link
Author

Thyrador commented May 4, 2020

Oh well, that worked. Didn't even notice the "unauthorized" attribute, lol.
Since it was connected and I didn't check the popup I thought all was okay :D

Things like this happen while answering questions while working :D

Will check it later and report back :)

@Thyrador
Copy link
Author

Thyrador commented May 4, 2020

Okay, after unauthorizing the device it seem to work (displays it as unauthorized now).

If I try to connect to the unauthorized device (which obviously won't work) guiscrcpy gets stuck at 70%, progress bar becomes red and I can't connect to another device (until I restart guiscrcpy). That's a bit inconvenient, tbh :P

@srevinsaju
Copy link
Owner

srevinsaju commented May 4, 2020

Yes, it used to prevent connecting to an unauthorized device before; I have to rewrite the previous logic to stop continuing to start scrcpy so that guiscrcpy won't crash now

I will have to test with unauthorized devices now ;) to fix it completely

If I try to connect to the unauthorized device (which obviously won't work) guiscrcpy gets stuck at 70%, progress bar becomes red and I can't connect to another device (until I restart guiscrcpy). That's a bit inconvenient, tbh :P

I will check that out; I am not sure why that happens

@srevinsaju
Copy link
Owner

@Thyrador I have added support for connection to devices and as well as AppImages I guess.
Now scrcpy runs before launching guiscrcpy; although you might feel that guiscrcpy is launched first because scrcpy takes like 1-2 seconds extra to start than guiscrcpy.

If you have time; please test it and let me know if I can add any more features

@srevinsaju
Copy link
Owner

@Thyrador I will wait another 2 days before closing this issue, in case you have time; please test

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature Enhancement
Projects
None yet
Development

No branches or pull requests

2 participants