Shell scripts minimizing machine time, maximizing tao time.

git clone git://watertao.xyz/programs/tao_shells.git

README (17267B)


      1 tao_shells
      2 ----------
      3 Text user interface(TUI) for everyday computer/device tasks.
      4 
      5 
      6 Usage
      7 -----
      8 
      9     $ tao_bluetooth_connect # Connect to bt device
     10     $ tao_copy.sh $1        # Yank $1
     11     $ tao_copy.sh -         # Yank stdin
     12     $ tao_notes.sh          # Notes
     13     $ tao_pactl_setsink.sh  # Set audio output device
     14     $ tao_url.sh            # Open url
     15     $ tao_url.sh -q         # Internet query
     16     $ tao_url.sh -y         # Download and play youtube video
     17     $ tao_youtube_query.sh  # Youtube videos from listed channels
     18 
     19 
     20 Base Requirements
     21 ------------
     22 - your-favorite-terminal-emulator
     23 - your-favorite-text-editor
     24 - dmenu (or bemenu/rofi)
     25 - wget
     26 
     27 
     28 Youtube Requirements
     29 --------------------
     30 - yt-dlp
     31 - mediaplayer
     32 
     33 
     34 Turn Key Out of the Box Requirements / Default Opener Options
     35 ---------------------------------------------------------------
     36 - st
     37 - dmenu
     38 - wget
     39 - mpv
     40 - yt-dlp
     41 - Gui browsers (qutebrowser, firefox, surf)
     42 - Tui browsers (w3m, links)
     43 - nsxiv (images)
     44 - zathura (pdfs)
     45 
     46 
     47 Description
     48 -----------
     49 Shell scripts minimizing machine time, maximizing tao time.
     50 
     51 This is for the CLI and TUI folks in the crowd. If you are already a
     52 unix-based/linux user and live in the GUI, I encourage you to explore
     53 the command line and become familiar with the terminal environment. To
     54 get started, using a terminal text editor (e.g. vim) is a great way to
     55 get your hands dirty. You'll be searching for files cli style and
     56 editing them all in the terminal. Maybe start a journal this way.
     57 
     58 The tao_url.sh is a core utility that has undergone maybe 6 rewrites. I
     59 learn something new and then all of a sudden, everything needs to be
     60 rewritten. And I do enjoy the process. It is a hobby of mine. And I feel
     61 these scripts are in a good enough place to be shared. So here we are.
     62 Welcome the tao shells.
     63 
     64 The purpose of these programs, particularly tao_url, is to minimize
     65 distraction in our lives. The internet is a massive distraction
     66 downpour. The tao_url.sh is not an umbrella, it removes you from the
     67 storm and keeps you above it, as much as it can. The idea is to pull
     68 things out of the storm, into your the light of your home, for
     69 intentional purposes. tao_url.sh is there to help users take control and
     70 hone their relationship with the internet. So how does it work. The
     71 primary interface is suckless.org's wonderful dmenu. If you are an X11
     72 user, please install dmenu ( See dmenu below ). If you are running a
     73 Wayland environment, you'll want to install bemenu. Rofi will also work.
     74 But one of the three are required to use the tao shells. How each tao
     75 shell program works is outlined below.
     76 
     77 
     78 Install
     79 -------
     80 Clone the git repo.
     81 
     82     $ git clone git://watertao.xyz/programs/tao_shells.git
     83 
     84 cd into tao_shells directory.
     85 
     86     $ cd tao_shells
     87 
     88 cp the files into your user's local bin. Assuming ~/.local/bin it your
     89 user executable directory, following should do it:
     90 
     91     $ a=~/.local/bin/; for i in *.sh; do cp $i $a$i; chmod a+x $a$i; done
     92 
     93 Check that ~/.local/bin is in your PATH env. If you already are setup
     94 with a user local executable path, just be sure to install the shells
     95 respectively.
     96 
     97 Also, see TERMINAL in the Environment Variables section below.
     98 
     99 Based on the requirements that suit your need, install any programs
    100 and/or configure the tao_opener.conf file accordingly. See
    101 tao_opener.conf section below.
    102 
    103 
    104 ### Rofi
    105 If using rofi, you'll need to set some flags for rofi to work well.
    106 After your initial run of tao_url.sh which will have created the tao
    107 config directory, the following command should do the trick:
    108 
    109 Likely most window tiling manager environments:
    110 
    111     printf "%s\n" "-dmenu" > ~/.config/tao/tao_dmenu.conf
    112 
    113 Deeply GUI environments (ie Ubuntu Gnome):
    114 
    115     printf "%s\n" "-dmenu -normal-window" > ~/.config/tao/tao_dmenu.conf
    116 
    117 
    118 Environment Variables
    119 ---------------------
    120 A word regarding env vars first. Although not required, you may set the
    121 following to the programs you run on your local system:
    122 
    123 - TERMINAL
    124 - DMENU
    125 - EDITOR
    126 
    127 For the unlettered, please refer to your shell's man page for further
    128 reading on environment variables.
    129 
    130 If unset, tao shells will try to discover each for the following programs:
    131 
    132 - TERMINAL=st,urxvt,xterm
    133 - DMENU=dmenu,rofi,bemenu
    134 
    135 The tao shells do no work whatsoever in the search for an EDITOR. This
    136 invaluable antique is entirely on you and absolutely a necessity.
    137 
    138 
    139 tao_url.sh
    140 ----------
    141 There is a lot going on here with such a simple utility, so get a cup
    142 coffee or tea or water, get your cozy's on, and let's get into it.
    143 
    144 First, the flow of what happens when this program runs.
    145 
    146 
    147 ### Url mode:
    148 
    149 01
    150 
    151 You are prompted to enter a url. The dmenu list will be populated with
    152 history and bookmarks below the prompt. As you type, the fuzzy find
    153 reduces the list accordingly. You can quickly find history urls and
    154 bookmarks this way, or simply enter a fresh url to do something with.
    155 And because dmenu is amazing, it's fast.
    156 
    157 02
    158 
    159 After url selection, you are prompted with a list of programs.  How will
    160 you be opening or using this url? Web browsers of course are a natural
    161 method. Defaults are qutebrowser, firefox, w3m, and links (See Text
    162 Browsers below on why w3m and links are important). You can also
    163 bookmark or yank(copy) the url from this menu. More on those tasks
    164 below. If the url is an image file, you can run by default nsxiv to view
    165 it. If an a/v url, mpv is there as an option. With images and video
    166 urls, by selecting their respective openers, you'll be asked first if
    167 you'd like to download the file first. In most case, unless it's a/v,
    168 downloading first is and excellent idea. More on that later.
    169 
    170 03
    171 
    172 If you're opening the url with a browser, you'll be off and running. If
    173 downloading first, you'll see a terminal open running wget to download
    174 the file, then once completed, the respective opener will launch and
    175 you'll be greeted with the content requested.
    176 
    177 
    178 ### Query mode:
    179 You are afforded the same steps as above, with a few important
    180 differences.
    181 
    182 01
    183 
    184 You are prompted initally for query/search terms instead of a url
    185 address. The history of your searches will be at your disposal as you
    186 type.
    187 
    188 02
    189 
    190 Once your query is ready, you can select any browser to open it, and the
    191 default duckduckgo will provide the results. If it is a youtube video,
    192 you can ytdlp/mpv option is there to download first, then mpv play the
    193 video locally.
    194 
    195 
    196 ### Youtube:
    197 See Youtube Videos below.
    198 
    199 
    200 ### Local mode:
    201 I'd avoid using this for now. It's well overdue for some tuning. I
    202 never use it anymore, I don't recommend it, and as such may be
    203 removed entirely in the unforseeable future.
    204 
    205 
    206 So why is this important. Why inject all these questions and steps into
    207 simply opening a url. Please see Ethos below.
    208 
    209 
    210 dmenu
    211 -----
    212 I will be writing more about dmenu in the future, quite likely when I've
    213 uploaded my dmenu configurations to the git server here, maybe never,
    214 who knows. For now my recommendation is to first download it from your
    215 distro's repo and explore it's usage a bit. Once your hooked, you'll
    216 want to customize the aesthetic, in which case I recommend cloning the
    217 git repo from suckless.org along with relevant patches, get all that
    218 building without error, sort out your config.def.h, and you'll be a
    219 happier dmenu user on the other side.
    220 
    221 
    222 Text Browsers
    223 -------------
    224 I will save the ethos of text browsers for the Ethos section below.
    225 Briefly, text browsing is a valuable and important step in taking
    226 control of your relationship with the internet. Text browsing is exactly
    227 as it sounds. A web page is requested from its server, and the content
    228 is returned to your client, as usual. The only difference is your client
    229 runs in a terminal window, and that's a big difference. Javascript is
    230 supported in some text browsers, but style sheets and images are all
    231 stripped. Image placeholders are often used for awareness of the
    232 material and in the case you wish to view it, options are available for
    233 media consumption.
    234 
    235 In using a text browser, you laser focus your usage of content retrieved
    236 from the internet. More on that in Ethos below. The learning curve and
    237 comfort acclimation are very real here. Out of the gates, parsing lines
    238 of text visually is an entirely different and an uncomfortable
    239 experience. It was worth the struggle for me. It may be for you too. It
    240 may not. Whatever it is. It's ok.
    241 
    242 
    243 Youtube Videos
    244 --------------
    245 For the ethos portion of this discussion, see Ethos. This section
    246 focuses on the usage of youtube content using tao_url.sh and
    247 tao_youtube_query.sh.
    248 
    249 
    250 ### Download and view:
    251 Running 'tao_url.sh -r', type or paste the youtube video link, hit
    252 Enter, then you are prompted as usual with a list of opener options.
    253 Select 'yt/mpv' to download first, then play locally using mpv.
    254 
    255     tao_url.sh -r; [enter link]; yt/mpv;
    256 
    257 
    258 ### Streaming video:
    259 Same process as 'Download and view' above, except instead of 'yt/mpv',
    260 simply open with 'mpv' instead. You'll be prompted to 'Download first?',
    261 whereupon you'll answer no, and mpv will begin streaming the video.
    262 
    263     tao_url.sh -r; [enter link]; mpv; n;
    264 
    265 
    266 ### Search:
    267 tao_url.sh -q as usual for internet searching, including youtube.  After
    268 entering/selecting keywords to search, in the opener prompt, select 'yt
    269 search'. You are then presented with a list of youtube videos. Once a
    270 video is selected, you'll be prompted with opener options, 'yt/mpv' to
    271 download then view, or 'mpv' for streaming.
    272 
    273     tao_url.sh -q; [enter search words]; yt search;
    274 
    275 
    276 ### Channel videos:
    277 Same process as above for download/view/streaming, except for the url,
    278 you enter a youtube channel's url, then select either of the two 'yt
    279 channel...' options. The first limits the video list to 50 for speed of
    280 service purposes. The other gets fetches everything, takes a little
    281 longer, but worth it if you're digging into history.
    282 
    283     tao_url.sh -r; [enter yt channel address]; yt channel; [select video]; ...
    284 
    285 
    286 ### Fetching latest videos from a list of channels:
    287 With a populated tao_channel_fetch_latest.sites config file, running
    288 tao_youtube_query.sh fetches a list of latest videos from every listed
    289 channel, sorts in date order, and offers this list for your perusal and
    290 selection, dmenu style. As many videos as you like can be launched using
    291 yt/mpv opener option, as each video will download in its own terminal
    292 window and play automatically once respective download completes. A nice
    293 way to catch up very quickly with channels of interest.
    294 
    295     tao_youtube_query.sh;
    296 
    297 
    298 ### Recommended keybinds for your window manager:
    299     tao_url.sh -r
    300     tao_url.sh -q
    301     tao_youtube_query.sh
    302 
    303 
    304 Files
    305 -----
    306 ```
    307 ~/.local/share/tao/
    308     url/
    309         bookmark
    310         history
    311         query
    312 
    313 ~/.config/tao/
    314     tao_channel_fetch_latest.sites
    315     tao_dmenu.conf
    316     tao_openers.conf
    317     tao_url.conf
    318 
    319 tao_url.conf optional variables:
    320     TAO_QUERY_ENG
    321     TAO_EXEC_IN_TERM
    322     TAO_DL_THEN_OPEN
    323 ```
    324 
    325 
    326 tao_url.conf
    327 ------------
    328 ### TAO_QUERY_ENG
    329 Set the query url for search engine in tao_url.conf. Default:
    330 
    331     TAO_QUERY_ENG="https://ddg.gg?q="
    332 
    333 
    334 tao_opener.conf
    335 ---------------
    336 Upon initial use of tao_url.sh, ~/.config/tao/tao_opener.conf is auto
    337 generated if not already exists. It contains a default opener/program
    338 list, the tao_url.sh task menu for urls. See Turn-key Out of the Box
    339 Requirements for the default list. The format for program entries is as
    340 follows:
    341 
    342 menu name (optional) %% program :: tags (optional)
    343 
    344 Examples:
    345 
    346     w3m :: TERM
    347     firefox
    348     mpv %% mpv --msg-level=ffmpeg/video=error :: DL_OPT MEDIA_PLAYER TERM
    349     nsxiv :: DL
    350 
    351 
    352 ### yt/* and ytdlp/mpv
    353 
    354 Embedded tao_url.sh Commands:
    355     ytdlp/mpv
    356     yt/channel[/[0-9]+]
    357     yt/query[/[0-9]+]
    358 
    359 Although a ytdlp/mpv and yt/* names can be customized for the menu, the
    360 command names cannot be changed. And tags do not apply and if added, will
    361 break the command.
    362 
    363 All yt/* commands can take a results limit, which takes the format of a
    364 number tacked onto the end of the command. Without an assigned limit,
    365 all is fetched. See "Acceptable" examples below.
    366 
    367 Acceptable:
    368 
    369     ytdlp/mpv
    370     ytdlp custom menu name %% ytdlp/mpv
    371     yt channel limit 10 custom name %% yt/channel/10
    372     yt/channel
    373     yt search %% yt/query
    374     yt search limit 80 results %% yt/query/80
    375 
    376 Unacceptable:
    377 
    378     ytdlp/mpv :: tags that should not be here
    379     yt custom menu name %% yt-wrong-name-for-ytdlp/mpv-command
    380     yt custom menu name %% ytdlp/mpv :: tags that should not be here
    381 
    382 
    383 ### Opener Tags
    384 
    385 DL
    386 
    387 wget downloads url first, then program selected opens it.
    388 
    389 DL_OPT
    390 
    391 Same as DL, but offered as an interactive option. This is useful with
    392 mpv for example, where you can opt to not download and just run the url
    393 with mpv, whereupon the video is streamed. Or you can choose to download
    394 first then play locally. Each has their advantages.
    395 
    396 MEDIA_PLAYER
    397 
    398 Sets the program as the yt/mpv media player where the entire program
    399 call including options and flags is used to run the downloaded youtube
    400 video. Only one program is used with this tag, if multiple programs are
    401 tagged with this, the first in the list is used. If the tag isn't used,
    402 the default player is mpv.
    403 
    404 TERM
    405 
    406 Launch the program in a terminal. Text browsers such as w3m are fine
    407 candidates of this tag. If you wish to monitor the stdout/err msgs from
    408 any program, this tag is useful.
    409 
    410 
    411 Ethos: Computers and our Relationship with the Internet
    412 -------------------------------------------------------
    413 What's the point of all of this? I happen to be a shell scripting
    414 hobbyist. So crafting these ui scripts is actually enjoyable.  That's
    415 really important. I live by few rules. One of them is to die smiling, at
    416 any point. Life takes its turns and it's not always easy to say that. I
    417 know I need to make moves if it is untrue. And so my engagement shifts.
    418 This is the wildness of wind in a creature that normally strongly
    419 associates with the stillness of trees.
    420 
    421 Crafting a user interface layer between me and the system, including the
    422 internet not only keeps me above the mess but allows me to use a system
    423 in an aesthetic that very much resonates, as so much of one's self
    424 reflects in the end product. That's an element, and also important.
    425 
    426 So there's the personal gain for me. But what about beyond that? Is
    427 there any gain for you or I to actually use these things?
    428 
    429 The full story of what's happening in our devices every time we use
    430 them, actually even while they sit idly in our pockets, is a story
    431 extraordinarily outside the scope of this writing. So we will focus for
    432 a moment only on the internet. Spoiler and tldr;, the internet sucks.
    433 
    434 Something I appreciate deeply about suckless.org is their name. The
    435 acknowledgement is inherent. Software sucks. All of it. They attempt to
    436 provide software that merely sucks less. This is especially true
    437 regarding the internet. Web browsers are terrible. All of them. The best
    438 can be found in text browsers. I love every one of them, even with all
    439 their sucktitude. So lets speak softly for a moment on the merits and
    440 ethos of using text browsers instead of gui.
    441 
    442 The internet lure is strong. It doesn't take much to keep a user simply
    443 connected to and aimlessly using the internet. A web page with nicely
    444 aligned and admirably spaced, sized and fonted text, featuring a simple
    445 yet pleasant color palette is all it takes. We are attracted to design.
    446 Design is art and art is emotional. I'm not talking about crying over
    447 page layout, I speaking to that thing that happens in us when something
    448 feels good.  Even subtly so.  When information becomes entertaining, we
    449 are roughly one click away from falling deeper into the digital world of
    450 our devices. Pure distraction awaits. The astronomical level of life
    451 distraction is merely one problem among many. The social, physical,
    452 religious and political...  in a word, mass cultural effect of the
    453 internet alone is something else entirely. I say all of this not to
    454 completely overshadow any benefit that may be gleaned from this monster.
    455 Communication is critical to understanding the world of humanity at the
    456 very least. So to harness the communicative power of interconnected
    457 devices simultaneously mitigating the damage is something I attribute
    458 likely too much thought too entirely. But here we are. I'm going to cut
    459 off all these half thoughts to end what is really only a README file for
    460 some shell scripts.
    461 
    462 The bottom line is to maximize our time alive, with life itself. Our
    463 actual, analog, very real bodies, minds, souls and hearts. Our own, and
    464 the others in our company. The internet is intended to be a trustless
    465 system, and we ought to use it as such, and use it far far less. Less
    466 endless scrolling, "screen time" of digital consumption. Less
    467 surveillance of our lives by strangers we do not know and ought not
    468 trust. The internet has it's uses, and the tao shells exist to leverage
    469 the positives and diminish the spell. These tools and so many others
    470 alike in the wild are here to help humanity return to humanity.
    471 
    472 
    473 Notes
    474 -----
    475 Every idea introduced in this file can be grossly expanded upon, and
    476 most certainly has been done so by many others. These are mere notes to
    477 a handful of utilities for the unix/linux user. There exist other tao
    478 shells for a myriad of other tasks, and when the time comes that they
    479 find comfort within themselves, they will walk out the front door as
    480 these shells have done and join the world of open source.