As @joao.azevedo and @Kyle_Rankin did I just made a quick app for the Librem 5 using bash and yad.
The app ask you to choose a folder and then trough python SimpleHTTPServer it runs a server that shares that folder using your local IP as address, and using libqrencode it creates a QRCode to make it easy to other people to get access to the server.
Off course the can be improved, I’m not programmer this is just a modified version of the one that I use on my Android device.
We create the app file and give it permissions:
chmod a+x /home/purism/bin/share-it.sh
myip=$(hostname -I | cut -f 1 -d " ")
yad --title="Share it" --question \
--text="\nShare files in your network\n\nDo you wish to continue?\n"
if [ $? -eq 0 ]
sharedf=$(yad --title="Share it" \
if [ $? -eq 0 ]
sharedf=$(echo $sharedf| sed 's/[^\/]*$//')
python3 -m http.server --bind $myip --directory $sharedf $myport &
qrcode=$(qrencode $myip:$myport -o /tmp/qrcode.png -s 10)
yad --title="Share it" --info --no-wrap \
--text="Shared: $sharedf\n\nOn:\nhttp://$myip:$myport\n\n" \
notify-send -t 1000 "Share it" "Folder sharing stopped"
And we add this inside:
I don’t know which dependencies needs installing nor if the app works on a Librem 5 device because I’m still waiting for mine and I don’t have got the VM working now, but it should work.
Improvements are welcomed.
PS: The git repository is here
@uzanto This is super cool.
From a first quick look at this script I have only two comments to add:
myip=$(ip addr show wlan0
Here you are assuming that the wifi interface is called:
wlan0 when in with systemd, in several systems (but not all of them) the interface name is usually:
wlp1s0, and this is most likely the case with the Librem 5.
So maybe change the name to
wlp1s0, or change that variable to something more name agnostic that greps the correct IP.
That can be used in different systems.
2 - If you have a git repo with this to point to us, we can go there and contribute
Yes, as a said I copied this from the one I use in Android, I just checked the one in my laptop and I made some modifications like the way I get the IP,
hostname -I | cut -f 1 -d " " I also print the qrcode in the terminal doing this,
qrencode $myip:$myport -t UTF8 but I couldn’t pipe that output to yad.
Can I use https://source.puri.sm/ as git repo or it’s just for Purism team? I’ve got an account there the one that I use to translate squeekboard.
probably, let me confirm.
On older systems, it was most likely called
wlan0 but newer systems are more likely to use the ironically named ‘predictable naming’ where the name is actually unpredictable but will at least be the same every time you boot.
I think the names with a ‘p’ are PCIe cards and other naming would apply to other means of connection to the system e.g. USB, SDIO.
I would suggest that for 99.9% of Librem 5 devices, just picking any interface starting with
wl will get the right interface. However if the kill switch is in use, it may be that the interface disappears. So a script should take that into account if it applies.
Yes, everybody can use source.puri.sm. At least I could just after registering there.
Here is the repo @joao.azevedo I uploaded the code with the improved way to get the local IP, I have to add a decent readme but it can be used by the time being.
@uzanto and now I know what I am going to be doing the next few hours, testing this
Hi, very nice app ideas @uzanto. (Guess the articles from @joao.azevedo and @Kyle_Rankin served as some inspiration?)
I looked how using
source easybashgui in the script could make the script much more readable (accessible / literate) and working just as well with other UIs / DEs (and with just the command line!), but questioned whether it would be best to have the lib packaged or just shipped with the script.
Hi, if you make the script work like that you can upload it to the git repo, If the lib is in the librem 5 repositories it’s just matter of install it.