Getting the most out of Geany: searching for files, Addons, plugins

New to Puppy and have questions? Start here

Moderator: Forum moderators

Post Reply
User avatar
wiak
Posts: 3793
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 58 times
Been thanked: 1073 times
Contact:

Getting the most out of Geany: searching for files, Addons, plugins

Post by wiak »

I stumbled across a post advocating Find -> Search in Files... function as an alternative to somewhat slow and awkward Pfind. Oddly enough, despite using Geany regularly, I also had never used that function. Having tried it, I would certainly say you can definitely throw Pfind (well, I search for files themselves in pcmanfm so not sure about Rox), that Geany text search function is far superior (and even more so since you can use ):

viewtopic.php?p=20538#p20538

In practice I more often than not simply use grep with -r (recursive) option, along with a few other options when appropriate, but that Geany function actually uses the same grep -rXXX command under the hood. It's true though that using Geany File -> Search in Files has advantages since you can not only open any file returned in search result by clicking on it, but it also has an arrow pointing to where the search string is in the file.

Whilst this is not a Help question or answer to an already asked question, and also not step-by-step explanation that was enough for a HowTo, I thought it might be useful Beginners Help to bring some more features of Geany to beginner's attention.

One thing I miss that some MS Windows text editors can do (such as Notepad++) is the ability to click on a url such as https://forum.puppylinux.com and cause a browser to open at the URL page. Certainly, the likes of Cherrytree or Notecase hierarchical note apps can do that, but Geany cannot do so out of the box. However, there are two methods that allow it to do so:

1. First method is to set up "Context Action" via Geany Edit -> Preferences -> Tools. For example, you can put "firefox %s" in there (or chromium --no-sandbox %s if using chromium browser on your system). Then if you highlight a URL in a geany text note and right-click on it with mouse you will get a drop down menu including "Context Action" in it - click that and the URL will open in firefox (or whatever browser you set).

That method isn't so great though since you manually need to highlight the whole URL first.

2. Second method is to use the geany-plugin called "Addons", which is really a small 86KiB file (addons.so) that you simply place (on my WDL_Arch64 system at least) in folder /usr/lib/geany. You need to activate with Geany menu EDIT -> Plugin Preferences -> (Addons tab) Show an Open URI. With that done, simply right-clicking on URL gives drop down menu that includes: "Open URI" and that does the job (no highlighting required).

https://plugins.geany.org/

Normal way to install that addon (to the appropriate directory) is to install the package geany-plugins (for all plugins) or geany-plugins-addons (for just that one) from your package manager (maybe Puppy has it pre-installed - I haven't checked).

Activate the plugin via Geany menu Tools -> Plugin Manager

I first used full geany-plugins package, however, contains lots of other plugins as well, so is relatively large at around 7MB download. However, you can delete all the ones you don't want (in my case on WDL_Arch64 from /usr/lib/geany). The other equally small geany plugins I use are Line Operations and Split-Window (from Tools menu) - the File Browser plugin can be useful too (though more powerful Treebrowser from the geany-plugins package seems to freeze now and then on my system.

I'll update this post once I try in FossaPup64 (to see where geany stores its plugins there - if not in /usr/lib/geany), but that will have to wait till I reboot since no virtual machine here...

Anyway, that's all I was wanting to post about - geany is pretty good (with such tools can almost use it like a pseudo notecase, including, apparently, use as an app launcher - see oldforum thread below for details) - there seems to be quite a bit about using it on old forum thread here:

http://oldforum.puppylinux.com/puppy/vi ... 967#834182

though I haven't had time to read that yet.

So if anyone has more interesting examples/ideas regarding Geany use, I look forward to hearing of them here.

wiak

EDIT: Location of plugins in FossaPup64 is to be /usr/lib/x86_64-lib-gnu/geany (though you don't need to know that to get addons working). For right-click loading of URLs/URIs, I just needed to install geany-plugins-addons from Puppy Package Manager and use EDIT -> Plugin Preferences - Show an Open URI item

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

User avatar
wiak
Posts: 3793
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 58 times
Been thanked: 1073 times
Contact:

Re: help getting the most out of Geany

Post by wiak »

Okay, I tried again and worked fine. Not sure what my earlier mistake was.

Per my updated post above:

Location of plugins in FossaPup64 is to be /usr/lib/x86_64-lib-gnu/geany (though you don't need to know that to get addons working).

For right-click loading of URLs/URIs, I just needed to install geany-plugins-addons from Puppy Package Manager and use EDIT -> Plugin Preferences - Show an Open URI item...

Didn't need to update geany at all. Was late last night so I probably just made a mess of it. No problem trying on pristine FossaPup64 this morning.

So Geany real useful. However, for link handling and ability to simply cut and past straight from browser into your notes, nothing I know of beats cherrytree hierarchical notetaker, which is now GTK3-capable so back into Ubuntu and Arch official repos. The older GTK2 version of cherrytree is still available to compile - and remained available, in that manner, from Arch Linux AUR (which I used in WDL_Arch64) but no need now since GTK3 version 0.9xxx long since released.

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

User avatar
mikeslr
Posts: 2859
Joined: Mon Jul 13, 2020 11:08 pm
Has thanked: 174 times
Been thanked: 869 times

Re: Getting the most out of Geany: URL launcher

Post by mikeslr »

Hi wiak,

Thanks for the post. It solved the larger portion of a 'To Do' I had on an actual list: figure out how to get geany to "open URLs".

There are three Puppys I use on a regular basis and 6 others I can boot-up if necessary to answer someone's question. And you may have noticed that I've recently been exploring Web-browsers. With both 32-and-64 bit OSes, even using portables, there are about 20. So if I wanted them to sport bookmarks it would be a PITA, even if I didn't try to keep all bookmarks in all web-browser up to date.

But I've more-or-less given up keeping bookmarks: reduced them to the few Front-Pages of those sites I frequent often. What does come in handy is a list of web-pages I often refer to in posts or may want to examine again the next time I explore a particular subject. I had been copy-and-pasting URLs into named 'odt' documents: store the document in a directory relating to the subject matter, open the document in Libre-or-OpenOffice writer, scroll down, place the cursor at beginning of the URL and ctl-click. But that's like using a sledge-hammer with thumb-tacks. Figured there must be a way to use geany. Your post answered that question and the first method you mentioned works fine especially when the document records several URLs.

Occasionally, however, I have a note just recording ONE URL. It would be handy if a web-browser could be induced to open that URL without first having to open the document recording it. Grep?

User avatar
Wiz57
Moderator
Posts: 507
Joined: Fri Dec 13, 2019 3:54 pm
Location: Chickasha, OK USA
Has thanked: 77 times
Been thanked: 83 times

Re: Getting the most out of Geany: searching for files; Addons; plugins

Post by Wiz57 »

One method I've found is using the "Run" command from the start menu, type (include quotes)
"defaultbrowser" then the URL desired. Example, in Run command text entry box,
"defaultbrowser" https://forum.puppylinux.com
then press Enter or click OK.
If all goes according to plan, the index page for the forum will be displayed in your systems
default web browser. I don't know how to get a different browser to do this, unless it will launch
from the Run command, followed by the URL, may have to put quotes around the URL??
Wiz ;)

Edit to add:
Just tried it with ScPup 32 LXDE, typed in Light (for light web browser, so as not to induce my
default Palemoon) then quoted the forum URL...IT WORKED! :lol:

Signature available upon request

User avatar
mikeslr
Posts: 2859
Joined: Mon Jul 13, 2020 11:08 pm
Has thanked: 174 times
Been thanked: 869 times

Re: Getting the most out of Geany: searching for files; Addons; plugins

Post by mikeslr »

Hi Wiz57,

The 'catch' is knowing/remembering the URL exactly. I have the memory of a sieve. When I'm lucky, I remember where I put it. :roll: Multiple meanings intended. :lol:

User avatar
mikeslr
Posts: 2859
Joined: Mon Jul 13, 2020 11:08 pm
Has thanked: 174 times
Been thanked: 869 times

Re: Getting the most out of Geany: URL launcher

Post by mikeslr »

mikeslr wrote: Wed Mar 24, 2021 12:26 am

...
Occasionally, however, I have a note just recording ONE URL. It would be handy if a web-browser could be induced to open that URL without first having to open the document recording it. Grep?

Not Grep? cat.

Jrb --thanks, jrb :thumbup: -- just published a YouTube no ads pet, viewtopic.php?p=20979#p20979 which can "copy URL's to the clipboard and launch them from there" with the objective of playing embedded Youtubes. His operative bash script is:

#!/bin/sh
BROWSER=defaultbrowser
xclip -o > /tmp/YTnoad.txt
URL=`cat /tmp/YTnoad.txt`
echo "$URL"

YTURL=`echo "$URL" | grep "youtube"`
if [[ ! $YTURL == "" ]]
then
case "$YTURL" in
*youtube.com*v%3D*) VIDID=${URL#*v%3D};;
*youtube.com*v=*) VIDID=${URL#*v=};;
*youtu.be* ) VIDID=${URL#*.be/};;
* ) $BROWSER "$URL"; exit;;
esac
VIDID=${VIDID::11}
$BROWSER "https://www.youtube.com/embed/$VIDID?autoplay=1"
else
$BROWSER "$URL"
fi

I suspect the above contains more instructions than would be needed just to open to one url in a text file. Right now I'm foggy headed. So will revisit this later. But the bash command which reads the contents of the text file is cat.

The final script --whatever it is-- can be added to the Right-Click menu. Then, all that would be necessary would be to select the text file, Right-Click it, Select the script and the default (or your choice of) web-browser would open to the url recorded in the text file.

User avatar
wiak
Posts: 3793
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 58 times
Been thanked: 1073 times
Contact:

Re: Getting the most out of Geany: searching for files, Addons, plugins

Post by wiak »

Not sure if I am understanding your question correctly, but, yes, cat to read file contents, so, is this what you want(?):

(Per the last example, you can replace filename with "$1" and make filename first argument to the script).

Call the following script gobrowse or whatever you want, and make it executable with chmod +x gobrowse

Code: Select all

#!/bin/sh
defaultbrowser "`cat filename`"

Or with commandline arg (for use with ./gobrowse <any_filename> or arranged for right-click operation in filemanager):

Code: Select all

#!/bin/sh
defaultbrowser "`cat $1`"

Other alternatives:

(below one maybe a bashism, I haven't actually checked which work with just POSIX shell):

Code: Select all

#!/bin/sh
defaultbrowser "$(<filename)"

or (this variant can do single or multiple URLs):
This could be useful to automatically load up a selections of webpages into your browser

Code: Select all

#!/bin/sh
# first argument should be name of file containing list of URLs
while read url
do
    defaultbrowser "$url"
done < "$1"

where for last example above, the text file (first argument to the script) simply contains a list of URLs, such as:

Code: Select all

https://forum.puppylinux.com
https://puppylinux.com
https://bbc.co.uk/news

Note: make sure you don't put any extra lines at the end or will fail (end of text return key press fine and good though).

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

Post Reply

Return to “Beginners Help”