meuter / argon-one-case-ubuntu-20.04

port of the argon one case power button and fan script for Ubuntu 20.04 on rpi 4
255 stars 49 forks source link

hardcoded use lxterminal in the .desktop files. #3

Open meuter opened 3 years ago

meuter commented 3 years ago

The .desktop files generated by the script hardcode Exec='lxterminal ...; which does not work on ubuntu-mate for instance. Maybe use Terminal=true and run the script directly? to be tested...

(initially reported by Joel W.)

meuter commented 3 years ago

Hi Joel,

Glad I could help. Thanks for the report. I actually did not know the script created .desktop files to integrate with the menu. I created an issue on github to keep track of it:

https://github.com/meuter/argon-one-case-ubuntu-20.04/issues/3

I had a quick look at the section of the script that generates those desktop files:

https://github.com/meuter/argon-one-case-ubuntu-20.04/blob/master/argon1.sh#L530

And apparently, they run the script using lxterminal. Not sure why they picked that one in particular. But for portability, instead of using a specific terminal emulator (like mate-terminal in your case), I would suggest trying to use the default terminal provided by the desktop environment. I don't have my raspberry pie at hand at the moment (it's on loan at one of my colleagues) so I cannot test this, but I would try something like this: set the Terminal variable to true and change the Exec variable to execute the script directly. So for the config script, it would look like this:

echo "[Desktop Entry]" > $shortcutfile
echo "Name=Argon One Configuration" >> $shortcutfile
echo "Comment=Argon One Configuration" >> $shortcutfile
echo "Icon=/usr/share/pixmaps/ar1config.png" >> $shortcutfile
echo 'Exec=lxterminal -t "Argon One Configuration" --working-directory=/home/pi/ -e '$configscript >> $shortcutfile
echo "Type=Application" >> $shortcutfile
echo "Encoding=UTF-8" >> $shortcutfile
echo "Terminal=false" >> $shortcutfile
echo "Categories=None;" >> $shortcutfile

should be change to

echo "[Desktop Entry]" > $shortcutfile
echo "Name=Argon One Configuration" >> $shortcutfile
echo "Comment=Argon One Configuration" >> $shortcutfile
echo "Icon=/usr/share/pixmaps/ar1config.png" >> $shortcutfile
echo 'Exec='$configscript >> $shortcutfile
echo "Type=Application" >> $shortcutfile
echo "Encoding=UTF-8" >> $shortcutfile
echo "Terminal=true" >> $shortcutfile
echo "Categories=None;" >> $shortcutfile

And do a similar modification for the uninstall script. If you're willing to test this on your side, I can merge this change easily.

Thanks!

Kind regards

-Cédric

joelw135 commented 3 years ago

I am not at all a programer, so I wouldn't know where to start. I just modified the launcher, which isn't that hard.

Joel

On October 28, 2020 at 2:23:43 PM, Cédric Meuter (notifications@github.com(mailto:notifications@github.com)) wrote:

Hi Joel,

Glad I could help. Thanks for the report. I actually did not know the script created .desktop files to integrate with the menu. I created an issue on github to keep track of it:

3(https://github.com/meuter/argon-one-case-ubuntu-20.04/issues/3)

I had a quick look at the section of the script that generates those desktop files:

https://github.com/meuter/argon-one-case-ubuntu-20.04/blob/master/argon1.sh#L530

And apparently, they run the script using lxterminal. Not sure why they picked that one in particular. But for portability, instead of using a specific terminal emulator (like mate-terminal in your case), I would suggest trying to use the default terminal provided by the desktop environment. I don't have my raspberry pie at hand at the moment (it's on loan at one of my colleagues) so I cannot test this, but I would try something like this: set the Terminal variable to true and change the Exec variable to execute the script directly. So for the config script, it would look like this:

echo "[Desktop Entry]" > $shortcutfile echo "Name=Argon One Configuration" >> $shortcutfile echo "Comment=Argon One Configuration" >> $shortcutfile echo "Icon=/usr/share/pixmaps/ar1config.png" >> $shortcutfile echo 'Exec=lxterminal -t "Argon One Configuration" --working-directory=/home/pi/ -e '$configscript >> $shortcutfile echo "Type=Application" >> $shortcutfile echo "Encoding=UTF-8" >> $shortcutfile echo "Terminal=false" >> $shortcutfile echo "Categories=None;" >> $shortcutfile

should be change to

echo "[Desktop Entry]" > $shortcutfile echo "Name=Argon One Configuration" >> $shortcutfile echo "Comment=Argon One Configuration" >> $shortcutfile echo "Icon=/usr/share/pixmaps/ar1config.png" >> $shortcutfile echo 'Exec='$configscript >> $shortcutfile echo "Type=Application" >> $shortcutfile echo "Encoding=UTF-8" >> $shortcutfile echo "Terminal=true" >> $shortcutfile echo "Categories=None;" >> $shortcutfile

And do a similar modification for the uninstall script. If you're willing to test this on your side, I can merge this change easily.

Thanks!

Kind regards

-Cédric

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub(https://github.com/meuter/argon-one-case-ubuntu-20.04/issues/3#issuecomment-718123170), or unsubscribe(https://github.com/notifications/unsubscribe-auth/AAW323LX5PEZ5IIBWLQSHP3SNBOS7ANCNFSM4TCWGAJA).

meuter commented 3 years ago

@joelw135 no worries, I'll take a look when I have my rpi4 back.

joelw135 commented 3 years ago

I edited the script, and ran it in terminal it didn’t install properly or add the desktop icons. If you want to make the corrections and send them to me I will try again. Thanks.

Joel

On October 28, 2020 at 2:30:07 PM, Joel Waxman (joel@waxman.org) wrote:

'Exec='$configscript >> $shortcutfile

meuter commented 3 years ago

@joelw135 I just got my RPI4 back from my colleague. So I'll take care of this over the week-end.

joelw135 commented 3 years ago

Thank you it is appreciated.

meuter commented 3 years ago

Fixed in 3eda093b61dcc1edf751359975e2df1a7e417c28

joelw135 commented 3 years ago

Thank you so very much. I just ordered the M.2 case from them. And I am hoping I will still be able to boot from the SSD. Thanks again.

joelw135 commented 3 years ago

I tried the script and it doesn't create the desktop icons. I have tried it using ssh and directly from terminal.

meuter commented 3 years ago

That's rather strange. On my end, the two desktop shortcuts are created and they both work with the default terminal provided by the desktop environment as mentioned above. In order to investigate why it does not work on your side, could you try running the script using bash -ex argon1.sh and send me the output? I'll see if I can spot the error on your side.

Regarding the icons, they are downloaded from argon40's website and copied to /usr/share/pixmaps/ by the script itself. The icons are then referenced in the two .desktop file. Here's where one of the .destop file is generated in the script:

https://github.com/meuter/argon-one-case-ubuntu-20.04/blob/3eda093b61dcc1edf751359975e2df1a7e417c28/argon1.sh#L541-L561

These two lines download the icons:

sudo wget http://download.argon40.com/ar1config.png -O /usr/share/pixmaps/ar1config.png 
sudo wget http://download.argon40.com/ar1uninstall.png -O /usr/share/pixmaps/ar1uninstall.png 

In a .desktop file, the path to the icon is specified in Icon variable:

Icon=/usr/share/pixmaps/ar1config.png
joelw135 commented 3 years ago

Hi, thanks for getting back to me.  I tried running  " bash -ex argon1.sh” And received the error no such file or directory. The other info was helpful, as I found the icons needed.

Joel

On November 25, 2020 at 3:54:58 AM, Cédric Meuter (notifications@github.com) wrote:

bash -ex argon1.sh

joelw135 commented 3 years ago

Hi Cedric!  By any chance have you been able to figure out why desktop icons are not created? I have tried the script on two different systems same result. Again it could be my Ubuntu 20.04 and 20.10 installs, but I don’t think so. If I don’t hear from you have a very healthy and happy holiday.

Joel

On November 25, 2020 at 3:54:58 AM, Cédric Meuter (notifications@github.com) wrote:

That's rather strange. On my end, the two desktop shortcuts are created and they both work with the default terminal provided by the desktop environment as mentioned above. In order to investigate why it does not work on your side, could you try running the script using bash -ex argon1.sh and send me the output? I'll see if I can spot the error on your side.

Regarding the icons, they are downloaded from argon40's website and copied to /usr/share/pixmaps/ by the script itself. The icons are then referenced in the two .desktop file. Here's where one of the .destop file is generated in the script:

https://github.com/meuter/argon-one-case-ubuntu-20.04/blob/3eda093b61dcc1edf751359975e2df1a7e417c28/argon1.sh#L541-L561

These two lines download the icons:

sudo wget http://download.argon40.com/ar1config.png -O /usr/share/pixmaps/ar1config.png
sudo wget http://download.argon40.com/ar1uninstall.png -O /usr/share/pixmaps/ar1uninstall.png
In a .desktop file, the path to the icon is specified in Icon variable:

Icon=/usr/share/pixmaps/ar1config.png — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.