Text-to-clipboard "hyperlink" in root? How?

Issues and / or general discussion relating to Puppy

Moderator: Forum moderators

User avatar
greengeek
Posts: 1383
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 534 times
Been thanked: 192 times

Re: Text-to-clipboard "hyperlink" in root? How?

Post by greengeek »

williams2 wrote: Thu Oct 07, 2021 3:07 am

i wrote a text file: bookmarks.txt
The script reads bookmarks.txt and creates the html file bookmarks.html

Thanks for this. I can combine this method with my xclip/roxapp method.

As well as having the bookmarks html file in /root I have added a roxapp (called BOOKMARKS) which if I click it loads the clipboard with the url of the bookmarks file:

file:///bookmarks.html

Then I just paste the clipboard into the browser and it displays all the hyperlinks. So that way it doesn't matter which browser I am using i can load all of the hyperlinks into it with 2 clicks. Even if I can't find the "file open" menu :-)
(Now if only I could find a way to have the browser open each link in a new tab)
.
So here is what I have in /root

RootBOOKMARKS.png
RootBOOKMARKS.png (25.85 KiB) Viewed 470 times

And here is an sfs which loads the roxapp and sample bookmarks file:

BookmarksApp_gg-0.0.sfs
(4 KiB) Downloaded 18 times

(Dependency is xclip - not included )
.
.
Also a pet form:
(Dont anyone test this if your system has a savefile. I don't want to get blamed for any badness that eventuates :-)
(It works for me because I never have a savefile and every boot is clean)

BookmarksApp_gg-0.0.pet
(2.34 KiB) Downloaded 18 times

(Dependency is xclip - not included )

williwaw
Posts: 1937
Joined: Tue Jul 14, 2020 11:24 pm
Has thanked: 170 times
Been thanked: 368 times

Re: Text-to-clipboard "hyperlink" in root? How?

Post by williwaw »

i understand now that you use a variety of unconfigured browsers. hmmm

I just dragged and dropped my bookmarks.html on to a variety of browser icons, portables etc.

they all open with my bookmarks.

(didnt have a a browser appimage to try though)

User avatar
greengeek
Posts: 1383
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 534 times
Been thanked: 192 times

Re: Text-to-clipboard "hyperlink" in root? How?

Post by greengeek »

williwaw wrote: Thu Oct 07, 2021 4:15 am

I just dragged and dropped my bookmarks.html on to a variety of browser icons, portables etc.
they all open with my bookmarks.

(didnt have a a browser appimage to try though)

How annoying - i just tried that with a slimjet appimage and it works. Way too simple. :lol:

Oh well, I'm still happy with what I'm learning. Lots of different ways to skin a cat and this has taught me heaps.

I do have other uses for my single-click-text-to-clipboard loader so this has been very helpful.

Last edited by greengeek on Thu Oct 07, 2021 4:50 am, edited 1 time in total.
User avatar
amethyst
Posts: 2414
Joined: Tue Dec 22, 2020 6:35 am
Has thanked: 57 times
Been thanked: 504 times

Re: Text-to-clipboard "hyperlink" in root? How?

Post by amethyst »

I have not been able to find the "open" menu

Try ctrl+O

User avatar
greengeek
Posts: 1383
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 534 times
Been thanked: 192 times

Re: Text-to-clipboard "hyperlink" in root? How?

Post by greengeek »

amethyst wrote: Thu Oct 07, 2021 4:49 am

I have not been able to find the "open" menu

Try ctrl+O

Yep, that works. Thanks!

User avatar
MochiMoppel
Posts: 1231
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 21 times
Been thanked: 436 times

Re: Text-to-clipboard "hyperlink" in root? How?

Post by MochiMoppel »

greengeek wrote: Thu Oct 07, 2021 3:54 am

Now if only I could find a way to have the browser open each link in a new tab

Doesn't pretty much every browser do this with Ctrl+Shift+Leftclick ?

User avatar
greengeek
Posts: 1383
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 534 times
Been thanked: 192 times

Re: Text-to-clipboard "hyperlink" in root? How?

Post by greengeek »

MochiMoppel wrote: Thu Oct 07, 2021 8:00 am

Doesn't pretty much every browser do this with Ctrl+Shift+Leftclick ?

How is this used? Haven't seen that before.

User avatar
MochiMoppel
Posts: 1231
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 21 times
Been thanked: 436 times

Re: Text-to-clipboard "hyperlink" in root? How?

Post by MochiMoppel »

greengeek wrote: Thu Oct 07, 2021 8:45 am

How is this used? Haven't seen that before.

You click on a link while keeping Ctrl+Shift pressed.
Usually Shift determines if the tab is opened in background or immediately receives focus, so you can also try Ctrl+ Leftclick.

Clicking on a link while pressing only Shift usually will open the link in a new window.

All this worked also in Opera Presto (can't remember what the default was)

User avatar
greengeek
Posts: 1383
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 534 times
Been thanked: 192 times

Re: Text-to-clipboard "hyperlink" in root? How?

Post by greengeek »

MochiMoppel wrote: Thu Oct 07, 2021 10:07 am

You click on a link while keeping Ctrl+Shift pressed.
Usually Shift determines if the tab is opened in background or immediately receives focus, so you can also try Ctrl+ Leftclick.

Ahh ok - i understand now. Good to know the shortcut, thanks. I usually just use a rightclick on a hyperlink and choose the open in new foreground or background tab option (not all choices available in all browsers of course).
I wonder if it is possible to find a way for a bunch of URLs (from the bookmarks.html) to populate individual tabs rather than just appearing as a list in one tab.

User avatar
greengeek
Posts: 1383
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 534 times
Been thanked: 192 times

Re: Text-to-clipboard "hyperlink" in root? How?

Post by greengeek »

Side note: In the bookmarks file it is possible to make sure that a link will open in a separate tab if you add the following to the url:

"target="_blank

so
<a href="http://trademe.com/">http://trademe.com/</a><br>

becomes:
<a href="http://trademe.com/"target="_blank">http://trademe.com/</a><br>

This doesn't open each of the bookmarks in a separate tab at the time the bookmarks file is dragged into the browser but it does mean that when each individual link loaded to the browser is clicked - then it will open in a separate tab.

So at least the pre-loaded links automatically carry the "load in new tab" parameter. I think I will find this helpful.

EDIT : Note-to-self: Look at the following links regarding improving security of the target=blank parameter:
https://www.freecodecamp.org/news/how-t ... n-new-tab/
https://www.thesitewizard.com/html-tuto ... -tab.shtml
https://stackoverflow.com/questions/234 ... dow-or-tab

Last edited by greengeek on Fri Oct 08, 2021 8:14 am, edited 2 times in total.
User avatar
greengeek
Posts: 1383
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 534 times
Been thanked: 192 times

Re: Text-to-clipboard "hyperlink" in root? How?

Post by greengeek »

MochiMoppel wrote: Thu Oct 07, 2021 10:07 am

You click on a link while keeping Ctrl+Shift pressed.
Usually Shift determines if the tab is opened in background or immediately receives focus, so you can also try Ctrl+ Leftclick.
Clicking on a link while pressing only Shift usually will open the link in a new window.

I also just read that doing a wheel click opens in new tab also. Seems to work with simultaneous leftclick/rightclick (ie middleclick) on my laptop.

williams2
Posts: 1062
Joined: Sat Jul 25, 2020 5:45 pm
Been thanked: 305 times

Re: Text-to-clipboard "hyperlink" in root? How?

Post by williams2 »

Pre-Chrome Opera could open all the links in a folder of bookmarks (right click and click "Open all")

Firefox can do that too. I'm using Firefox 93.0

1) show the "Manage Bookmarks" window.
2) Right click a folder at the left and click "Open All Bookmarks"
3) Close the Manage Bookmarks window to see that Firefox has opened all of the bookmarks in tabs.

You can start browsers from the command line with a url or urls.
Multiple urls will be opened in tabs. For example:

firefox /root/bookmarks.html https://www.duckduckgo.com/html https://www.bbc.com/

You can export bookmarks to html files.
You can import those files in other browsers.
Or you can view them in the browser. The exported files will have clickable links.
An html file with clickable links could have a link or links to other html files that are on your hard drive.

User avatar
greengeek
Posts: 1383
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 534 times
Been thanked: 192 times

Re: Text-to-clipboard "hyperlink" in root? How?

Post by greengeek »

Just for the sake of experimentation I have made a couple of roxapps that sit in /root - the first one loads to clipboard the url hyperlink for a site that allows opening of a bunch of urls in separate tabs:

https://url-opener.com/

While that website is loading I can click on the second roxapp in /root and it loads to clipboard the contents of a basic text file holding my list of favourite websites - and I paste that into https://url-opener.com/ and it opens each bookmark in a new tab.

The sfs loads the two roxapps into /root.

BookmarkOnlineOpener_gg-0.0.sfs
(4 KiB) Downloaded 20 times

(Dependency=xclip)
.

OnlineOpener.png
OnlineOpener.png (117.74 KiB) Viewed 423 times
User avatar
greengeek
Posts: 1383
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 534 times
Been thanked: 192 times

Re: Text-to-clipboard "hyperlink" in root? How?

Post by greengeek »

williams2 wrote: Fri Oct 08, 2021 9:40 pm

You can start browsers from the command line with a url or urls.
Multiple urls will be opened in tabs. For example:

firefox /root/bookmarks.html https://www.duckduckgo.com/html https://www.bbc.com/

I guess I could build such a function into a desktop file if I had a bookmarks file kept in a specific location. I could manually change the bookmark file content without ever having to alter the desktop file. Although might need a launcher script to handle the cat of the bookmarks file perhaps.

I will also see if I can find a way to add that sort of functionality into a rightclick "Open with" menu. ie: rightclick on a browser icon and have the rightclick menu throw the bookmarks file at it without me having to drag/drop.

williams2
Posts: 1062
Joined: Sat Jul 25, 2020 5:45 pm
Been thanked: 305 times

Re: Text-to-clipboard "hyperlink" in root? How?

Post by williams2 »

firefox $(cat bookmarks.txt | tr "\n" " ")

User avatar
greengeek
Posts: 1383
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 534 times
Been thanked: 192 times

Re: Text-to-clipboard "hyperlink" in root? How?

Post by greengeek »

williams2 wrote: Sun Oct 10, 2021 4:46 am

firefox $(cat bookmarks.txt | tr "\n" " ")

Interesting, thanks.
I tried this against the basic bookmarks .txt file you offered before (had to use slimjet as I did not have firefox installed at the moment) and the following tabs opened up:
http://%3Ctitle%3Ebookmarks%3C/TITLE%3E [Site can't be reached ERROR]
http://puppy/ [Site can't be reached ERROR]
http://linux/ [Site can't be reached ERROR]
https://rockedge.org/psearch/
https://www.youtube.com/
https://www.ebay.com/
http://www1.trademe.com/

Obviously just minor issues with the extra titles etc in that bookmarks file. Which was:

Code: Select all

<TITLE>Bookmarks</TITLE>
Puppy Linux forum:
https://forum.puppylinux.com/
Puppy Search:
https://rockedge.org/psearch/
Youtube:
https://www.youtube.com/
Ebay:
https://www.ebay.com/
Trademe:
http://trademe.com/

Looks like that will work if I remove the extraneous data and just leave the urls.
Going to see if I can build that cat into my roxapps method.
cheers!

EDIT: yep, tried again with a new bookmarks file with no extra stuff - only pure urls and it was perfect.
I think i will make a roxapp using that code for each of the browsers I have on test. That will complement the other methods.
thx

Last edited by greengeek on Sun Oct 10, 2021 7:45 am, edited 1 time in total.
User avatar
greengeek
Posts: 1383
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 534 times
Been thanked: 192 times

Re: Text-to-clipboard "hyperlink" in root? How?

Post by greengeek »

williams2 wrote: Sun Oct 10, 2021 4:46 am

firefox $(cat bookmarks.txt | tr "\n" " ")

So I have used this syntax in a single-click roxapp to launch Slimjet with all of the bookmarks (ex /root/bookmarks.txt) that I want opened in my browser.

(It is not a complete answer to what I originally wanted but it is certainly useful for my main browsing sessions. [Some sites need different browsers - especially when using aged 32bit systems])

Here is the sfs I am using to test this method:

SLIMJET-BOOKMARKTABS_gg-0.0.sfs
(4 KiB) Downloaded 13 times

Loads sample bookmarks.txt and Slimjet-portable starter roxapp to /root. (As long as Slimjet-portable32 appimage is in /opt)
Click SLIMJET-BOOKMARKTABS and it will open /opt/Slimjet-Portable32 with a separate tab for each bookmark url.

Very helpful for some of my purposes - thanks!

ps: Using this method I will be making individual roxapps for slimjet (for most of my sites including banking and Trademe), Palemoon (for puppylinux and general Googling use) and Vivaldi (for facebook and other) - with a specific bookmarks list for each browser.

(Sadly this level of intricacy is necessary when running on a 32bit Puppy these days)
cheers!

Last edited by greengeek on Sun Oct 10, 2021 8:02 am, edited 1 time in total.
williams2
Posts: 1062
Joined: Sat Jul 25, 2020 5:45 pm
Been thanked: 305 times

Re: Text-to-clipboard "hyperlink" in root? How?

Post by williams2 »

firefox $(cat bookmarks.txt | tr "\n" " ") expects pure text urls one url per line.

This will filter out lines which are not urls:

firefox $(cat bookmarks.txt | grep ^http | tr "\n" " ")

The following allows http, https, ftp, ftps, and file urls:
It still assumes that for lines that have urls, that
1) only 1 url per line
2) each url is at the beginning of the line, no other text on that line
3) other lines that do not begin with a url can have anything, they will be ignored

firefox $(cat bookmarks.txt | egrep -i '^http://|^https://|^ftp://|^ftps://|^file://' | tr "\n" " ")

The script could be written to deal with more complicated cases, but the script would need to be bigger and much more complex.

User avatar
greengeek
Posts: 1383
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 534 times
Been thanked: 192 times

Re: Text-to-clipboard "hyperlink" in root? How?

Post by greengeek »

williams2 wrote: Sun Oct 10, 2021 8:01 am

The following allows http, https, ftp, ftps, and file urls:
It still assumes that for lines that have urls, that
1) only 1 url per line
2) each url is at the beginning of the line, no other text on that line
3) other lines that do not begin with a url can have anything, they will be ignored

firefox $(cat bookmarks.txt | egrep -i '^http://|^https://|^ftp://|^ftps://|^file://' | tr "\n" " ")

The script could be written to deal with more complicated cases, but the script would need to be bigger and much more complex.

Thats very clever - thanks.
You may not have seen my edit of my post just above. I have used your previous syntax with a cleaned bookmarks file and got great results that allow me to home in on the final solution i need.
(Had to use Slimjet rather than firefox)

(Will still test this latest syntax as that could be a great way to use a standard format of bookmarks file for different uses. - thanks for this)

User avatar
greengeek
Posts: 1383
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 534 times
Been thanked: 192 times

Re: Text-to-clipboard "hyperlink" in root? How?

Post by greengeek »

williams2 wrote: Sun Oct 10, 2021 4:46 am

firefox $(cat bookmarks.txt | tr "\n" " ")

I have been able to extend this syntax and use it within a roxapp so that now I can click the roxapp and it will open 3 browsers - palemoon, vivaldi, and slimjet-portable32 - and will open a bunch of tabs in each browser.

By using 3 different bookmarks files it ensures that each browser is used for the websites it is capable of handling (and not the ones it can't handle).
(In my case I have to use vivaldi for facebook, palemoon for puppylinux and fastmail, and slimjet for BNZ banking).

The syntax I put into the roxapp AppRun is:

Code: Select all

/opt/petstore/Slimjet-Portable32 $(cat slimjetbookmarks.txt | tr "\n" " ") & /usr/local/palemoon/palemoon $(cat palemoonbookmarks.txt | tr "\n" " ") & vivaldi $(cat palemoonbookmarks.txt | tr "\n" " ") | xclip -in -selection clipboard

Here is the test sfs:

ALLBROWSER-BOOKMARKTABS_gg-0.0.sfs
(4 KiB) Downloaded 20 times

It places 3 different bookmarks files in /root and also the ALLBROWSER-BOOKMARKTABS roxapp to click.

It is a good timesaver for me.

More fine-tuning to come...

Post Reply

Return to “Users”