~mil/f_scripts

ref: e0e641cd5ede3e4d799476bd768b455de05c50b8 f_scripts/README.md -rw-r--r-- 10.6 KiB
e0e641cdMiles Alan Regenerate documentation 9 months ago

#f_scripts

Motto: There's a script for that!

f_scripts is a collection of lightweight prompt-driven Oil OSH scripts designed to be used with fbp as a part of the framebufferphone project. Designed around frugality and maintainability, f_scripts offers a set of simple-to-understand scripts that can match much of the functionality of modern phones in an admittedly low-fidelity way. With f_scripts you can make & receive calls, send & receive text message, view and listen to youtube videos, set a cooking timer, read RSS news, browse the web, and more.

Each f_script is compatible with framebufferphone's fbp, by way of writing to fbp's FIFO. This dependency / compatiblity is optional and if no fbp FIFO is present on the system you can still use each f_script by typing into each prompt (the menus in each script just use read which is accesible over SSH, via prompt, etc.). As such, f_scripts can be used in desktop enviroments outside of the context of the framebufferphone / fbp, or within the context of alternative mobile enviroments like Sxmo, Phosh, and similar.

In terms of packaging, f_scripts are designed to each be a single subpackage and there are zero cross-dependencies (e.g. each script is standalone). Overall f_scripts aims to change the "there's an app for that mentality"; to "there's a script for that" or maybe even "you can build your own script for that".

See also:


#Documentation for each f_ script

Index:

  • f_audio: Adjust audio output devices and volume
  • f_files: Browse files on your filesystem
  • f_game: Play classic console games
  • f_maps: Browse OSM maps using mepo (via SDL directfb).
  • f_networks: Allows managing gsm/wpa connections via underlying nmcli calls
  • f_phone: Manages phone calls / text messages using modemmanager
  • f_rss: Fetches data from RSS via sfeed and allows you to view via sfeed_curses
  • f_theme: Change the framebuffer theme (font & colors)
  • f_timer: Set a countdown timer to be alerted
  • f_web: Select a website and browse via w3m
  • f_youtube: Listen or view youtube videos via mpv

#f_audio

  • Description: Adjust audio output devices and volume
  • Documentation: Allows you to adjust audio output devices and volume by using alsa-utils amixer. Enables toggling between speaker/headphone/earpiece output as well as adjusting the volume based on a step value Set the variable $F_AUDIO_STEP to modify the percentage points that volup/voldown will increment/decrement.
  • Dependencies: alsa-utils
  • Default variables: (override by setting F_AUDIO=1)
    • F_AUDIO_STEP=1
      
  • Source: f_audio

#f_files

  • Description: Browse files on your filesystem
  • Documentation: An interactive prompt-driven filebrowser. Enter the name of the folder to enter to cd or enter a file to open it. Set $F_FILES_HANDLERS to customize handlers to use to open files. Note that sequence matters. Each line in $F_FILES_HANDLERS has 4 parts seperated by the ^ character, the first field is a regex for grep, the second field is fbp fields to populate, and the third is the command to run which will be suffixed with $@. The fourth field is an optional arbitrary shell code to be eval'd after terminating the program. This can be helpful to run cleanup code for buggy applications like fbi which don't always properly on C-c or for any other terminal restoration code.
  • Dependencies: vim mpv fbdi-fbi fbdi-fbgs
  • Default variables: (override by setting F_FILES=1)
    • F_FILES_HANDLERS='
      [.](mp4|mov|avi)$ ^ 9 0 [ ] p q ^ mpv --vo=tct ^
      [.](webm|ogg|mp3|flac)$ ^ 9 0 [ ] p q ^ mpv --no-video ^
      [.](jpg|jpeg|gif|webm|png)$ ^ q j k a + - 100s 150s 200s v h i q ^ fbi ^ pkill -9 fbi
      [.](pdf)$ ^ q j k a + - 100s 150s 200s v h i q ^ fbg ^ pkill -9 fbi
      
  • ^ Z X Q :q :w :wq j k h l ^ vim ^ ' F_FILES_FBSET_FBPRATIO='2 / 3' F_FILES_FBSET_YRES='1440' ```

#f_game

  • Description: Play classic console games
  • Documentation: Launches classic console games with keybindings set in fbp. Currently supports only the game: moon-buggy!
  • Dependencies: moon-buggy
  • Source: f_game

#f_maps

  • Description: Browse OSM maps using mepo (via SDL directfb).
  • Documentation: Launches mepo to browse OSM maps in SDL / directfb mode. Has limited compatibility currently since there's nothing like dmenu on the framebuffer which mepo relies on for compatibility. Mepo should be compatible with framebuffer more fully eventually via save/restore state scripts and then running menus in CLI via slmenu or similar.
  • Dependencies: mepo
  • Source: f_maps

#f_networks

  • Description: Allows managing gsm/wpa connections via underlying nmcli calls
  • Documentation: Allows mangaging gsm/wpa connectiona via nmcli. Allows for creating, deleting, enabling, and disabling networks via prompts. Prints status of connected networks between prompts. Also allows scanning wireless networks.
  • Dependencies: networkmanager
  • Source: f_networks

#f_phone

  • Description: Manages phone calls / text messages using modemmanager
  • Documentation: A single interactive prompt-driven script to manage all aspect of using your phone's modem for sending & receiving text messages and placing and receiving calls. Transfers incoming text messages and logs calls and all actions to a single logfile which can be interactively filtered (per-contact etc..) via using the provided phonelog submenu. The log file used can be customized by setting $F_PHONE_MODEMHISTORYFILE. Additionally a number of hooks can be set, see variables for usable. The script in the background (via a subshell), continually monitors modemmanager (via its DBus interface via mmcli), alerts you when a new call is incoming (vibrating the phone and interrupting your current prompt to provide a pickup prompt). So in short, basically, this script allows you to use pinephone (or otherwise) as , who would have thought.. a lightweight... phone(!)
  • Dependencies: polkit modemmanager linuxconsoletools pinephone-call-audio
  • Default variables: (override by setting F_PHONE=1)
    • F_PHONE_MODEMHISTORYFILE=~/.f_phone_modemhistory
      F_PHONE_MONITORSTATEFILE=/tmp/f_phone_monitorstate
      F_PHONE_HOOKRINGSTART='yes 5 | fftest /dev/input/by-path/platform-vibrator-event'
      F_PHONE_HOOKRINGSTOP='pkill fftest'
      F_PHONE_HOOKMISSEDSTART='echo 255 > /sys/class/leds/green:indicator/brightness; { echo 5; sleep 1; echo -1; } | fftest /dev/input/by-path/platform-vibrator-event'
      F_PHONE_HOOKMISSEDSTOP='echo 0 > /sys/class/leds/green:indicator/brightness'
      
  • Source: f_phone

#f_rss

  • Description: Fetches data from RSS via sfeed and allows you to view via sfeed_curses
  • Documentation: Allows you to fetch RSS feeds via sfeed and then view via sfeed_curses with keybindings pre-setup in fbp. Use the env variable $F_SFEEDRC_DATA to customize the sfeedrc data contents.
  • Dependencies: sfeed sfeed_curses
  • Default variables: (override by setting F_RSS=1)
    • F_SFEEDRC_DATA="
      feeds() {
      feed "Tech/Pine64" "https://www.pine64.org/rss"
      feed "Tech/Slashdot" "http://feeds.feedburner.com/SlashdotSitenews"
      feed "Tech/HN" "https://news.ycombinator.com/rss"
      feed "Tech/Lobsters" "https://lobste.rs/rss"
      feed "Tech/Suckless" "http://git.suckless.org/sites/atom.xml"
      }
      "
      
  • Source: f_rss

#f_theme

  • Description: Change the framebuffer theme (font & colors)
  • Documentation: Allows customizing your framebuffer's theme by setting the font and colors. Uses the setterm and setfont command line tools - so only applicable in the TTY / framebuffer. Also uses escape codes to make colors (true black / true white). Use the variables for $F_THEME_FONT_{SM,MD,LG} to set the fonts used for {sm,md,lg}{white,dark}.
  • Dependencies: terminus-font util-linux-misc
  • Default variables: (override by setting F_THEME=1)
    • F_THEME_FONTSM="/usr/share/consolefonts/ter-114n.psf.gz"
      F_THEME_FONTMD="/usr/share/consolefonts/ter-920n.psf.gz"
      F_THEME_FONTLG="/usr/share/consolefonts/ter-v32n.psf.gz"
      
  • Source: f_theme

#f_timer

  • Description: Set a countdown timer to be alerted
  • Documentation: Set a countdown timer after which expiry you'll be alerted. Use the variable $F_TIMER_PRESETS to set a space deliniated array of strings suffixed by (h/m/s) that will prepopulate the menu with time values.
  • Dependencies: linuxconsoletools util-linux-misc
  • Default variables: (override by setting F_TIMER=1)
    • F_TIMER_PRESETS="10m 9m 8m 7m 6m 5m 4m 3m 2m 1m 30s 5s 1h"
      
  • Source: f_timer

#f_web

  • Description: Select a website and browse via w3m
  • Documentation: Browse the web via w3m (text) or netsurf (graphical) setting fbp hotkeys to helpful hotkeys. Quirks - starts w3m in mode that respects C-c. For netsurf, has to be run as root (so runs via sudo). Set $F_WEB_SITES to customize sites shown to user
  • Dependencies: w3m netsurf-framebuffer tslib
  • Default variables: (override by setting F_WEB=1)
    • F_WEB_SITES='
      npr text.npr.org
      ddg duck.com
      hn news.ycombinator.com
      lbtr lobste.rs
      cnn lite.cnn.com
      pmos postmarketos.org
      '
      F_WEB_NETSURF_FBPRATIO='2 / 3'
      F_WEB_NETSURF_YRES='1440'
      F_WEB_NETSURF_XRES='720'
      
  • Source: f_web

#f_youtube

  • Description: Listen or view youtube videos via mpv
  • Documentation: f_youtube allows you to search and playback either audio or video from youtube. It uses codemadness's youtube-cli tool to find results from youtube and allows you to either playback in the terminal the video (e.g. as low-fidelity ASCII) or allows you to just play the audio back. Set $F_YOUTUBE_SEARCHQUERIES to be a space seperated list of tokens to customize the default search queries.
  • Dependencies: codemadness-frontends mpv youtube-dl
  • Default variables: (override by setting F_YOUTUBE=1)
    • F_YOUTUBE_SEARCHQUERIES='asmr cat fail news'
      
  • Source: f_youtube