Mes marque-pages Firefox avec yad

Forum Forums General Other Languages French Mes marque-pages Firefox avec yad

  • This topic has 18 replies, 3 voices, and was last updated Feb 6-2:57 pm by Rantanplan.
Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • #94871
    Member
    Rantanplan

      Bonjour,

      J’utilise antiX 21 32-bit full en Live-USB sans persistance et sans vouloir remastériser : c’est un choix délibéré et pleinement assumé.

      Ma bécane :

      CPU: Single Core Intel Celeron M 410 (-MCP-) speed: 1467 MHz
      Kernel: 4.9.0-279-antix.1-486-smp i686 Up: 41m Mem: 514.6/872.4 MiB (59.0%)

      Donc relativement peu de RAM et un CPU poussif.

      Comme alternative aux marque-pages de Firefox, je me suis écrit un script dans lequel mes sites favoris sont enregistrés avec leur adresse.
      Puis, après avoir sélectionné un site et confirmé mon choix, l’ouvre dans un nouvel onglet du navigateur Firefox.

      Ceux qui utilisent un navigateur différent adapteront la 3ème ligne en partant de la fin du script.

      Pour ajouter des sites :
      – éditer le fichier,
      – insérer autant de lignes que nécessaire après la ligne 7 et avant la 14,
      – respecter la syntaxe : “nom du site” “url” \
      – renvoyer à la ligne,
      – enregistrer.

      Avant de l’utiliser, si ça intéresse quelqu’un, peut-être faudra-t-il définir les permissions.

      Le script est dans le conteneur .zip joint.

      Amitiés.

      Vive antiX !
      Vive le Groland !

      #94891
      Member
      oops
        Helpful
        Up
        0
        ::

        … Nice idea, and it will be interesting to have tha ability to open in a single mouse clic a set of www links.

        (… Bonne idée, il serait aussi interessant de pouvoir ouvrir tout un jeu de liens internet en un seul clique souris.)

        #94929
        Member
        Rantanplan
          Helpful
          Up
          0
          ::

          oops,

          je pense que ça doit pouvoir se faire avec l’option –multiple.
          Il faut alors combiner les touches Shift ou Ctrl et clic gauche pour sélectionner plusieurs sites.
          Puis, mettre en forme la variable.
          Ce que je ne sais pas : Firefox ouvrira–t-il bien un nouvel onglet pour chaque site
          ou ouvrira-t-il une nouvelle fenêtre ?

          Pour le simple clic, je ne sais pour où faut-il chercher, paramétrer.

          Je regarderai à temps perdu.

          Amitiés.

          • This reply was modified 4 months, 4 weeks ago by Rantanplan.

          Vive antiX !
          Vive le Groland !

          #94931
          Member
          oops
            Helpful
            Up
            0
            ::

            Bonjour,

            Oui, peut-être. (maybe)
            Ca peut probablement aussi se faire plus simplement par contournement en 1 ligne (maybe easier as workaround with one line like:):

            set1 "https://www.antixforum.com/ --new-tab https://transifex.com --new-tab https://archive.org/details/@marcelocripe --new-tab https://7zip.fr/lignes-commande-7zip/"

            Au lieu de (instead)

            ...
            antiX "https://www.antixforum.com/" \
            "Traduction antiX" https://transifex.com \
            "Marcelo-Cripe" https://archive.org/details/@marcelocripe \
            ...)
            #94934
            Member
            PPC
              Helpful
              Up
              0
              ::

              Hi, sorry for writing in English here:

              Great idea! Xecure and me worked, for a while on a similar GUI script, for badwolf browser, because that browser lacked bookmarks, and was extremely light…
              Some suggestions, to make using the script even easier – load the list of Favorites from an external text file- that way you can edit the list without editing the script itself
              And yes, it would be great, for people that require this script, to be able to “tick” all the URLs they would like to start.

              Another suggestion – a small edition to this script could make it a nice GUI to launch favorites in very basic browsers, like links2 – making them a tiny bit more usable than they are already, specially in extremely old devices.

              A last suggestion – you can, say, for example, make something similar to this script, straight from IceWM’s menu – creating a new menu that reads the list of favorite URLS and then launches them using the default web browser- that way, you can do it even without using a script, just the menu’s config file! Fast and efficient (but adds a tiny bit of more work for each Favorite you want to add, that fallow this syntax: prog “[name_of_favorite]” – [browser_with_flags]

              menu "Mes sites" /usr/share/icons/papirus-antix/48x48/places/folder.png {
                prog "antiX" - firefox --new-tab  https://www.antixforum.com/
                prog "Traduction antiX" - firefox --new-tab https://transifex.com 
                prog "Marcelo-Cripe" firefox --new-tab https://archive.org/details/@marcelocripe
                prog "7z - Aide" - firefox --new-tab https://7zip.fr/lignes-commande-7zip
                prog "Ordi d'occaz" - firefox --new-tab https://www.ordinateur-occasion.com/
                prog "Self défense courriel" - firefox --new-tab https://emailselfdefense.fsf.org/fr/index.html
                prog "Démarches administratives" - firefox --new-tab service-public.fr
              }

              And yes, you can make it so the menu entry loads the list from a text file, that you can edit without having to edit the menu config file (but that file still has to follow the menu’s syntax…).

              I think there was a script somewhere that directly added all of Firefox’s favorites to the menu, making this process automatic…

              P.

              #94939
              Member
              oops
                Helpful
                Up
                0
                ::

                @PPC … Good ideas too.

                #94942
                Member
                PPC
                  Helpful
                  Up
                  0
                  ::

                  Comme alternative aux marque-pages de Firefox

                  Sorry for hijacking your thread a little bit, but it was such a good idea, I can help but think of ways to make it even more usable (Ex: launching FirefoX bookmarks from the script/Icewm menu).

                  I found my old script and cleaned it up a bit: for it only lists Firefox’s bookmarks in the terminal – you can click and run any URL from there, or even output the results to a text file and use the yad script to select the URL you want to go to (or, with a little more work, use my suggestion and have a “Live” IceWM menu that reads all your Firefox bookmarks and allows you to launch the selected one.
                  If anyone (hi there @Bobc ! ) wants, with a bit of work, this could be the basis of a nice script to open Firefox bookmarks from a yad menu or from the menu…

                  #!/bin/bash
                  #List (and open) all Firefox's bookmarks from the terminal, requires the package lz4json, to decompress the bookmark's file
                  #Created, from several on-line examples, by PPC, for use with antiX linux, 5/12/2022
                  #GPL v3 license. Use this script as you wish, please keep the Credit's line.
                  
                  #Make sure the dependecy is installed, if not, try to install it:
                  if ! [ -x "$(command -v lz4jsoncat)" ]; then
                    echo 'Dependency not installed. Trying to install it...' >&2
                    sudo apt update && sudo apt install lz4json
                  fi
                  
                  #Find the latest copy of the file that contains your Firefox bookmarks:
                  for bmdir in $(find ~/.mozilla/firefox -name bookmarkbackups); do
                                  bmfile=${bmdir}/$(ls -rt ${bmdir} | tail -1)
                           done 
                           
                  #Send bookmarks to a file
                  lz4jsoncat $bmfile > /tmp/ffbookmarks.json
                  
                  #Convert bookmarks file to simple text
                  cat /tmp/ffbookmarks.json | jq . > /tmp/ffbookmarks.txt
                  
                  #Display only lines containing "title" and "uri", inside the file
                  file="/tmp/ffbookmarks.txt"
                  
                  while read -r line; do
                  
                  check_for='title'
                  if [[ "$line" == *"$check_for"* ]]; then
                    echo -e "$line\n" | cut -d ':' -f2
                  fi
                  
                  check_for='"uri"'
                  if [[ "$line" == *"$check_for"* ]]; then
                    #remove the first 6 charaters from each line, that are «"uri":»
                    line="${line:6}"
                    echo -e "$line\n"
                  fi
                      
                  done <$file 
                     

                  Edit: I realized I posted an old (and not fully working version of the script, so I replaced the code a more recent and fully working one – it still needs much improvement…

                  • This reply was modified 4 months, 4 weeks ago by PPC.
                  #95021
                  Member
                  Rantanplan
                    Helpful
                    Up
                    0
                    ::

                    @PPC et @oops,

                    Bien, j’ai repris mon script afin de permettre de cocher plusieurs sites et ainsi les ouvrir d’un coup.
                    De plus, la liste des sites préférés devient un document .txt
                    A savoir :
                    1°) IL ne faut pas de ‘ ou de ” dans le nom des sites ni de caractères espace.
                    2°) l’ouverture de plusieurs sites peut occasionner l’ouverture de plusieurs fenêtres du navigateur : je ne sais pas régler ce point.

                    Dans le .zip joint, il y a le script (probablement faudra-t-il le traiter avec chmod a+x avant usage) et le fichier des sites.
                    Dans le script, ce fichier est en variable, comme le navigateur.

                    @PPC,

                    Je n’ai pas encore lu ta dernière contribution, mais je le ferai.

                    Amitiés.

                    Vive antiX !
                    Vive le Groland !

                    #95025
                    Member
                    Rantanplan
                      Helpful
                      Up
                      0
                      ::

                      @PPC,

                      c’est un script de geek 🙂 ce que je ne suis pas (encore), même si je crois comprendre le cheminement…

                      C’est encore (un peu) compliqué pour une tête de Rantanplan pleine de courants d’air 😀

                      Mais un jour (je peux rêver un peu), je serai aussi fort que PPC. 😉

                      Amitiés.

                      • This reply was modified 4 months, 3 weeks ago by Rantanplan.

                      Vive antiX !
                      Vive le Groland !

                      #95027
                      Member
                      PPC
                        Helpful
                        Up
                        0
                        ::

                        It’s nice seeing how your script is progressing, reading from it’s “config file” and also allowing for multiple selections- true that it failed to work with the current config file.
                        Also, the path to the file is for your system only (or anyone that is running live and has the config file in that folder).

                        I remembered I did something similar with my News script for FT10 – I adapted it to use to open anything that is recognized as a web address (it fails in the last link, that has no http on it’s address). This opens, on my computer, any link I click from the list in a new Firefox tab. The yad window remains open until the user clicks it. You may not believe it, but it’s a one-liner script (please adjust the path for your config file, in this example it searches for the config file in the home folder for the current user…
                        this works with any text file containing web links, no matter it’s format.

                        yad --title="Mes sites" --center --width=600 --height=550 --text-info < $HOME/liste_sites_preferes.txt --show-uri --no-buttons

                        PS: I see the value of your script: it allows users to access their favorite links from the web browser, on a live system without persistence – very nice idea- I never thought about that one before – I simply used a text file and copied and pasted the links, when I was using a live system!!!

                        PS2: you can use my previous idea to save all the favorites of an installed firefox to a text file and use that text file as the source for your Favorites, using your script (or my “oneliner”). Anyway – great , great idea!

                        edit: I almost forgot about this- when I was running live I noticed that I could “cat” my text file that stored my favorites, and click the links in the terminal, and they would open in the browser- yes the Terminal is that powerful!

                        Using your default “config file” as an example:
                        antiX menu > Terminal
                        cat /home/demo/Live-usb-storage/liste_sites_preferes.txt
                        …and click any link!

                        Not so pretty as using yad, but useful, particulary for folks running a live system, without any script installed to use as a GUI for the favorites.

                        Edit:

                        For an even better way to both search for (using F7 or clicking the “7” field on the last line of the window) and launch favorites AND be able to add new ones (or delete or change current ones):

                        mcedit /home/demo/Live-usb-storage/liste_sites_preferes.txt

                        …You can use the mouse in this text editor- it’s a nice GUI, with some old fonts and strange mouse cursor, that’s all. Yeah, what some consider antiX’s “bloat” is simply gold, to people that know how to use these default tools.

                        I’m sorry for offering suggestions that are way off the scope of this thread, but I do this because they all are ways to access a list of favorite links for Firefox, when using a live system (and that’s what you want to implement).

                        P.

                        • This reply was modified 4 months, 3 weeks ago by PPC.
                        • This reply was modified 4 months, 3 weeks ago by PPC.
                        • This reply was modified 4 months, 3 weeks ago by PPC.
                        #95086
                        Member
                        Rantanplan
                          Helpful
                          Up
                          0
                          ::

                          Bonsoir PPC,

                          merci pour la simplification à apporter ($HOME) : je corrigerai et déposerai bientôt une nouvelle version.

                          Pour les autres solutions que tu proposes, elles entrent bien dans l’esprit de ce fil puisqu’il s’agit d’économiser les faibles ressources à disposition.

                          Je ne connaissais pas mecedit et j’irai voir à quoi ça ressemble.
                          Oui, le terminal et la ligne de commande sont des outils puissants qui ne consomment pas grand chose en ressources (sauf à écrire des boucles infinies et autres farces dont je ne suis à l’abri).

                          Amitiés.

                          Vive antiX !
                          Vive le Groland !

                          #95229
                          Member
                          Rantanplan
                            Helpful
                            Up
                            0
                            ::

                            Bonjour,

                            suite à l’observation de @PPC, le script a été modifié en conséquence.

                            Pour ceux qui ne sont pas en Live…, le fichier “liste_sites_preferes.txt” doit être rangé sous /home/[nom_utilisateur].
                            Le script peut être stocké n’importe où.
                            Avant de l’utiliser, vérifiez que les permissions sont à jour : sinon “chmod a+x mes-sites-multi-antiX-V3.sh”.

                            Pour ceux qui sont en Live… sans persistance, préférez le rangement du fichier texte sous Live-usb-storage (pour les utilisateurs d’une clé),
                            ou quelque part où il ne disparaîtra pas à la fermeture de session.
                            IL faudra éditer le script et modifier la ligne 6 pour mettre à jour le chemin.
                            Profitez-en pour mettre à jour le navigateur à la ligne 5 si vous en utilisez autre que firefox.

                            Rappel :
                            Pour ajouter un site, éditez le fichier texte avec l’éditeur de votre choix et respectez la syntaxe suivante :
                            false [nom_sans_’_ni_”_ni_espace] url
                            puis enregistez.

                            Hors sujet :
                            @PPC
                            Vu l’éditeur mcedit qui me rappelle un peu MP.
                            J’aime bien le minimalisme de ces éditeurs.
                            Il y a aussi la série des éditeurs e3 (e3vi e3ws e3ne et e3pi) tout aussi minimaliste et qui éditent presque tout et n’importe quoi (j’exagère probablement). 🙂

                            Amitiés.

                            Vive antiX !
                            Vive le Groland !

                            #95231
                            Member
                            PPC
                              Helpful
                              Up
                              0
                              ::

                              Pour ceux qui sont en Live… sans persistance, préférez le rangement du fichier texte sous Live-usb-storage (pour les utilisateurs d’une clé),

                              Your script is progressing great. One further suggestion, that just came to me: you can use the script, without altering it, making it search first for the list of favorites in the home folder but also searching for it inside $HOME/Live-usb-storage/. If the script finds the list of files there, then it will use that “Live” version. Just add something like this (adapt as you need), after your line 6:

                              test -f $HOME/Live-usb-storage/liste_sites_preferes.txt && liste=$(cat $HOME/Live-usb-storage/liste_sites_preferes.txt)

                              You are getting “sucked” into making scripts the same way I was, some 6 years ago! 🙂

                              P.

                              #95234
                              Member
                              Rantanplan
                                Helpful
                                Up
                                0
                                ::

                                Merci @PPC.

                                Je comprends ceci :
                                si le script n’a pas trouvé le fichier “liste_sites_preferes.txt” dans $HOME
                                alors il vérifie que le fichier se trouve dans “$HOME/Live-usb-storage/liste_sites_preferes.txt”
                                et si le test est bon la variable “liste” prend la valeur “$HOME/Live-usb-storage/liste_sites_preferes.txt”

                                Ai-je compris correctement ?

                                Le “problème” avec les scripts est qu’on a toujours une nouvelle idée pour l’améliorer. 🙂
                                C’est comme ça qu’on progresse.

                                Amitiés.

                                Vive antiX !
                                Vive le Groland !

                                #95236
                                Member
                                PPC
                                  Helpful
                                  Up
                                  0
                                  ::

                                  Ai-je compris correctement ?

                                  Oui! 🙂

                                  Edit: More correctly: the script always reads the text file that is in the home folder… But after that, it checks if the file exists in the usb folder and uses it instead (it replaces the text it go from the home folder). If No file exists in the usb folder, the script just keeps the contents of the file that’s in the home folder. It’s quite a task, for just one command. Type “man test” on the terminal, to see how powerful that command is!

                                  P.

                                  • This reply was modified 4 months, 3 weeks ago by PPC.
                                Viewing 15 posts - 1 through 15 (of 19 total)
                                • You must be logged in to reply to this topic.