No Description

ohnonot 2fbb96c4b9 git-check-20220605-0747 1 year ago
config 2fbb96c4b9 git-check-20220605-0747 1 year ago
helperscripts 1fac69271f different method of determining term size 3 years ago
screenshots f11ec18c20 new screencast 3 years ago
.gitignore ade4e9f792 almost perfect 5 years ago
README.md 2fbb96c4b9 git-check-20220605-0747 1 year ago
marquee1 2fbb96c4b9 git-check-20220605-0747 1 year ago
termss 2fbb96c4b9 git-check-20220605-0747 1 year ago

README.md

termss

A terminal screensaver to replace xscreensaver & Co.
Written in bash.

Includes:

  • the termss wrapper script: It will open a fullscreen terminal window on top of everything (urxvt is a hard dependency because it has the options to make this work as desired) and execute a command given as an argument, inside that terminal. Then it starts listening to events, and will kill everything as soon as you wiggle your mouse pointer or hit a key. Just like any screensaver. No screen locking.
  • a script (marquee1) designed to run inside that window. It shows configurable command output (by default in awesome toilet fonts) in random colors and position, waits, clears the screen and starts again. It's possible to have some sort of animation ("teletype effect"), and it can be made to sprinkle the screen with stars. Enable the options in marquee1.conf.

Prerequisites

The Xorg server has a screensaver built in; its settings can be queried via xset.
Some programs have the capability to catch the Xorg server's signal that it's time, and activate a custom screensaver or any other command - in our case termss.

xss is one such program, and it is the one I'm using. See "The scripts" below for examples.

xss-lock is another, and so is xautolock (this link for FreeBSD's Freshports; look under "Master Sites" to find sources).

Essentially these three programs do the same thing: They provide a mechanism to start an external application when the X server says "no user activity, time to start the screensaver".

Configuration

Both scripts look for its config file which can be put in $XDG_CONFIG_HOME/termss/ (usually ~/.config/termss/. Config files are named after the script + .conf, so if you rename your script to e.g. my_termss, i t looks for my_termss.conf.

Two example config files with default options can be found in the config subfolder of this repository.

Dependencies

The termss script

  • Xorg
  • bash
  • urxvt terminal emulator
  • xdotool
  • xrandr, possibly part of xorg-xrandr
  • xinput, possibly part of xorg-xinput
  • sed
  • a writeable $TMPDIR (defaults to /tmp)

Optional

  • hhpc or unclutter to hide the pointer
  • (for insecure ungrabbing & pointer hiding) setxkbmap, possibly part of xorg-setxkbmap
  • (for the screencast option) imagemagick and gifsicle
  • to STOP/CONTinue processes when termss starts/stops: pidof (procps-ng)

Fonts

See man urxvt on how to formulate a font string for urxvt's "-fn" option, to be supplied as font="..." in termss.conf.

The termss script needs to detect the width & height of one monospaced cell, i.e. the space any character uses.
There is automatic detection but it is tricky: it flashes a 1x1 sized terminal for just as long as it takes to determine its actual size. To avoid doing this every time the screensaver fires up, the script modifies its config file to add two values, charwidth and charheight. Remember to remove these if you change fonts.

The marquee1 script

  • ncurses to provide tput
  • shuf and od (both coreutils)
  • grep

Optional

  • pv to slow down output (teletype effect)
  • toilet to create banners - highly recommended!
  • mpi-panel for media player info (also from here)

The scripts

It isn't hard to imagine all the programs one can run in fullscreen to make for a nice screensaver, but this repository uses a terminal emulator.

One could also run pipes for example, or asciiquarium or termsaver...

You will need a command like this in your autostart:

xss /path/to/termss /path/to/marquee1 &
# or
xss /path/to/termss asciiquarium &
# or
xss /path/to/termss sh -c 'cmatrix|lolcat'
# or
xss /path/to/termss sh -c 'tput civis; termsaver matrix'
# etc.

Other

If you use dunst as your notification daemon, termss will pause dunst while the screensaver is active. If you have dunst in your $PATH, and it is not running, it will be started first. Set dunst=0 in termss.conf to avoid this.

Disclaimers

There's not enough quality control. Set it up carefully.
But once it works, it works well enough. Stable, one could say.

There are some situations where the mouse pointer cannot be hidden because some application grabbed it, so it should be ungrabbed first. However, ungrabbing needs to be enabled first because it is potentially less secure. You can set insecure=1 inside the script, which uses an alternative method that is good enough for most cases, and ungrabbing stays disabled. But you should know that this option then stays enabled for the remainder of that X session.