Sticky notes / Post-it’s in a one liner script

Forum Forums General Tips and Tricks Sticky notes / Post-it’s in a one liner script

  • This topic has 15 replies, 7 voices, and was last updated Apr 18-11:27 pm by rokytnji.
Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #135283
    Member
    PPC

      One of my first scripts, back when I was learning to use yad to generate simple GUIs was adapting on-line examples to have a nice, simple to use “Post-it” in antiX.
      The updated code is simple, and you can run it from the terminal:

      touch ~/.antix-post-it.txt && yad --width=300 --height=300 --fixed --title=$"aPost-it" --window-icon="/usr/share/icons/papirus-antix/48x48/categories/sticky-notes.png" --text-info --editable --fontname=Monospace --back=yellow --fore=black < ~/.antix-post-it.txt > /tmp/post-it.txt && cp /tmp/post-it.txt ~/.antix-post-it.txt

      The text in the “post-it” is always saved in the hidden .antix-post-it.txt file, in your home. To close it (saving what you wrote there) simply click “OK”.
      It’s like a sometimes handy way of copying links from web sites, to read later, jot down ideas, etc…

      P.

      • This topic was modified 2 months, 2 weeks ago by PPC.
      #135284
      Member
      ProwlerGr

        This is gold! Thank you @PPC you are a champ!

        Attachments:
        #135327
        Member
        tequila

          Hello, congratulations to the developers for the operating system, I really like it.I changed a little Sticky notes, it creates a new txt, it doesn’t overwrite it.
          #!/bin/bash
          touch /tmp/post-it.txt && yad –geometry=800×200+40+0 –fixed –title=$”aPost-it” –window-icon=”/usr/share/icons/papirus-antix/48×48/categories/sticky-notes.png” –text-info –editable –back=yellow –fore=black < /tmp/post-it.txt –fontname=Monospace > /tmp/post-it.txt && cp /tmp/post-it.txt ~/Dokuments/”antix-post-it $(date +%d-%m-%Y_%H:%M:%S).txt”

          rm -f /tmp/post-it.txt
          exit 0

          #135331
          Member
          PPC

            @ProwlerGr – many thanks!

            .I changed a little Sticky notes, it creates a new txt, it doesn’t overwrite it.

            Hum… and how does the script display the newly created files? I meant to create a simple script that does not require users to select where they want to save the “notes”, and does not require the user to load notes. It basically works like an electronic writing board, where you can write what you want…
            But, hey, I’m happy you liked the idea and decided to adapt it for your own taste!

            Also, if you just want to always open an empty “post-it” and always save what you write with a time stamp (that you can open with a text editor, for example), there’s no need to use the temporary file, like so:

            yad --width=300 --height=300 --fixed --title=$"aPost-it" --window-icon="/usr/share/icons/papirus-antix/48x48/categories/sticky-notes.png" --text-info --editable --back=yellow --fore=black --fontname=Monospace > ~/Dokuments/antix-post-it$(date +%d-%m-%Y_%H:%M:%S).txt

            P.

            #135334
            Member
            Robin

              $ lang=en; string=””; entry=””; while read line; do if ! [[ “$line” =~ ^[[:digit:]][[:digit:]]:[[:digit:]][[:digit:]]:[[:digit:]][[:digit:]],[[:digit:]][[:digit:]][[:digit:]][[:blank:]]”–>”[[:blank:]][[:digit:]][[:digit:]]:[[:digit:]][[:digit:]]:[[:digit:]][[:digit:]],[[:digit:]][[:digit:]][[:digit:]]$ ]]; then if [[ “$line” == “” ]]; then entry=false; sleep 2; trans -s de -t $lang -b –show-original n –show-languages n –show-original-dictionary n –show-dictionary n –show-alternatives n –show-prompt-message n –show-original-phonetics n –show-translation-phonetics n –show-translation y –no-ansi –no-browser –no-view — “$string”; echo “”; elif [[ “$line” =~ ^[[:digit:]] ]]; then echo “$line”; else if $entry; then string=”$string $line”; fi; fi; else entry=true; string=””; echo “$line”; fi; done < subtitle_stripped_de.srt > $lang.srt

              This one blends in here I guess. It’s pretty old meanwhile and already posted in another thread, and it translates properly formatted .srt subtitle files from and to any language you want. Just replace the “en” in the beginning by your target language, and if the source language is not German, replace the “de” behind trans -s somewhere in the middle by the language identifier of the source language. Syntax is either two/three characters, e.g. fr, en or fil, or non-debian style, 4 to 6 characters in two groups, separated by a default dash: en-gb, fil-fil pt-br …
              The input filename is expected to be subtitle_stripped_de.srt, but you may change it on your own to whatever you like, it’s positioned shortly before the end of the command string.

              P.S.: I know, the regex can be written more compact and elegant, but as said, this is an old one 🙂 You may compress and polish it on your own.

              Oh, not to forget: you need translate-shell package to be installed before this can work. sudo apt-get … you know how this works.
              And then you may try to play with the sleep value somewhere near the trans command in the middle. If you notice some translations not comming back from the service, just elongate this time.

              • This reply was modified 2 months, 2 weeks ago by Robin. Reason: not to forget

              Windows is like a submarine. Open a window and serious problems will start.

              #135409
              Member
              PPC

                Nice, one-liner, Robin! I’ll have to test that out!

                Back to the “post-it” script, I forgot to mention: if you really, really want to use it like a post-it is stuck on your screen, and make it appear on top of windows, right after where it says “yad” add this flag:

                --on-top

                • This reply was modified 2 months, 2 weeks ago by PPC.
                #135448
                Member
                Robin

                  Back to the “post-it”

                  Oh, only now I get the meaning of the thread headline properly… This thread is not about posting one-liners in general, as I had taken from reading the words »Post-it’s in a one liner script«, assuming you wanted to have collected notes on one liners of all kind to be posted in a sticky thread (the latter was what I made from the leading sticky notes). Searched the web for this expression now, and there seems to exist some commercial product called ›Post-it‹ by 3M, which is kind of a sticker you can write notes on (this would make then another kind of sticky notes and explain that you have not used the short dash by mistake: I made »Post — it’s in a one liner« from it, meaning something like Post all kind of your one liners in here, instead of ›Post-it‹ stickers or ›sticky notes‹ (only), put in a one liner) which is what you obviously had intended. Sorry, maybe a mod can single out or remove my wrongly placed entry, polluting your thread. Sorry @PPC, wasn’t meant. Just a translation mistake on my side.

                  Windows is like a submarine. Open a window and serious problems will start.

                  #135455
                  Member
                  PPC

                    maybe a mod can single out or remove my wrongly placed entry,

                    No!
                    I liked your script and I’ve not yet copied it! 🙂

                    EDIT: the idea of a thread to share tiny or one-liner scripts is great!!!

                    P.

                    • This reply was modified 2 months, 2 weeks ago by PPC.
                    #135474
                    Member
                    techore

                      + thumbsup

                      #135481
                      Member
                      ile

                        Hello PPC And Everyone
                        me="$(basename "$0")";running=$(ps h -C "${me}" | grep -wv $$ | wc -l);[[ $running > 1 ]] &&wmctrl -R "aPost-it" && exit;touch ~/.antix-post-it.txt && yad --width=300 --height=300 --fixed --title=$"aPost-it" --window-icon="/usr/share/icons/papirus-antix/48x48/categories/sticky-notes.png" --text-info --image="/usr/share/antiX/FAQ/images/icons/note2.png" --editable --show-uri --uri-color="#3F0000" --wrap --back=yellow --fore=black < ~/.antix-post-it.txt > /tmp/post-it.txt && cp /tmp/post-it.txt ~/.antix-post-it.txt;rm -f /tmp/post-it.txt

                        #135492
                        Member
                        ile

                          Hello PPC And Everyone
                          thizzz note
                          me="$(basename "$0")";running=$(ps h -C "${me}" | grep -wv $$ | wc -l);[[ $running > 1 ]] &&wmctrl -R "zPoztn" && exit;touch ~/zzznote &&zzzfm -g --editor ~/zzznote ~/zzznote --button ok --window-size 276x332 --title $"zPoztn" --window-icon sticky-notes --image /usr/share/antiX/FAQ/images/icons/note2.png
                          i was preparing to make a joke that window-size 4×400 would be a note pad for narrow-minded people; (, but width does not go below 190.)

                          #135537
                          Member
                          tequila

                            thizzz note
                            Thank you, very good, that’s what I wanted.

                            #135564
                            Member
                            ile

                              tiny invited. tiny tune one station.
                              radio station is the type number 1-826.
                              sample is 252; fill-in favorite.
                              urxvt -e tinyradio& sleep 1.4s; xdotool type 252; xdotool key Return
                              PPC
                              I am a beginner.
                              My sample scripting
                              Comes from somewhere below the status bar.

                              #135584
                              Member
                              ile

                                Hello PPC and Everyone
                                System information is hardware related.
                                This sample is an in-terminal start.
                                For the soft report, <env-info>
                                urxvt -hold -e env-info &

                                #139722
                                Member
                                ile

                                  Hello PPC and Everyone
                                  Placing a shebang on it has it be a one liner in a one liner in a one liner (?)

                                  An approach to screenshot quality from scrot;
                                  dialog when click OK Proceed Now.
                                  The dialog and shebang and “-s ” and .desktop are optional.
                                  Launch it how you like best.
                                  For this /zzscrrezshot sample command,
                                  the package <farbfeld> is required (126 kB); to the antiX session install farbfeld.

                                  #!/bin/bash
                                  # zzz ff, scrot rules, to current directory. screenshot zzscreez
                                  zzzfm -g --title zzscrrezshot \
                                  --window-icon zzzfm-48-folder-blue \
                                  --label "select screen for /zzscreez " \
                                  --icon draw-cross \
                                  --button ok \
                                  scrot -s -d 2 zzscreez.ff -e 'ff2png < $f > $n.png | ff2jpg < $f > $n.jpg' -- close
                                Viewing 15 posts - 1 through 15 (of 16 total)
                                • You must be logged in to reply to this topic.