Skip to content

Commit

Permalink
release: revamp the README, bump version of tessen
Browse files Browse the repository at this point in the history
There's no point replicating the information inside the man page on the
README.
  • Loading branch information
Ayush Agarwal committed Jan 16, 2022
1 parent 06d877f commit 802a640
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 141 deletions.
184 changes: 44 additions & 140 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,51 @@
## tessen

A bash script that can use [bemenu](https://github.com/Cloudef/bemenu),
[rofi](https://github.com/lbonn/rofi), or [wofi](https://hg.sr.ht/~scoopta/wofi) as an interface for
auto-typing and copying [password store](https://www.passwordstore.org/) data.
`tessen` is a bash script that can use any wayland native dmenu-like backend as an interface for
auto-typing and copying [password-store](https://git.zx2c4.com/password-store/) data. The list of
backends known to work with `tessen` are

`tessen` is written to work only on Wayland.
- [bemenu](https://github.com/Cloudef/bemenu)
- [fuzzel](https://codeberg.org/dnkl/fuzzel)
- [rofi](https://github.com/lbonn/rofi)
- [wofi](https://hg.sr.ht/~scoopta/wofi)

If you'd rather use [fzf](https://github.com/junegunn/fzf) to copy your password-store data on both
Xorg/X11 and Wayland, check out [pass-tessen](https://github.com/ayushnix/pass-tessen).
`tessen` is written to work only on wayland compositors such as [sway](https://swaywm.org/). If
you'd rather use [fzf](https://github.com/junegunn/fzf) to copy your password-store data on both
xorg/x11 and wayland, check out [pass-tessen](https://github.com/ayushnix/pass-tessen).

### Why use `tessen`?

- `tessen` can autotype or copy (or, do both at the same time!) your password store data including
all of your key-value pair data, besides the password
- `tessen` can autotype or copy (or do both at the same time!) your password store data including
all of your key-value pair data

From what I've observed as of this commit, most scripts out there do not autotype and copy all of
your key-value pair data. They also do not offer choices about autotyping or copying data with the
same flexibility as `tessen` does.

Although [rofi-pass](https://github.com/carnager/rofi-pass) is a good alternative, it only works
on Xorg/X11. `tessen` is made to work on Wayland.
on xorg/x11. `tessen` is made to work on wayland.

- `tessen` tries to minimize the number of external binaries used in the script for speed and
efficiency. Besides the dependencies mentioned above, `tessen` doesn't use programs like `sed`,
`awk`, `tr`, `cut`, `find`, `sort`, `head`, `tail`, and other GNU coreutils, often used casually
when writing shell scripts
- `tessen` does not use any external programs unless they are needed. This means that `tessen`
doesn't need programs like `sed`, `awk`, `tr`, `cut`, `find`, `sort`, `head`, `tail`. This ensures
that `tessen` isn't dependent on the subtle differences between GNU, BSD, and busybox coreutils.

- the code is linted using [shellcheck](https://github.com/koalaman/shellcheck) and formatted using
[shfmt](https://github.com/mvdan/sh)

- focuses on minimalism and security (please let me know if you have any suggestions for
improvement)
[shfmt](https://github.com/mvdan/sh). I've also tried to ensure that `tessen` doesn't leak any
sensitive data. Please raise an issue or a pull request if you can make tessen more minimalistic
or secure.

## Installation

### Dependencies

- [bash](https://www.gnu.org/software/bash/)
- [pass](https://git.zx2c4.com/password-store/)
- either one of [bemenu](https://github.com/Cloudef/bemenu), [rofi](https://github.com/lbonn/rofi),
- a wayland native dmenu-like backend such as [bemenu](https://github.com/Cloudef/bemenu),
[fuzzel](https://codeberg.org/dnkl/fuzzel), [rofi](https://github.com/lbonn/rofi),
[wofi](https://hg.sr.ht/~scoopta/wofi)
- [wtype](https://github.com/atx/wtype) (if you want to auto-type data)
- [wtype](https://github.com/atx/wtype) (optional, if you want to auto-type data)
- [wl-clipboard](https://github.com/bugaevc/wl-clipboard) or
[wl-clipboard-rs](https://github.com/YaLTeR/wl-clipboard-rs) (if you want to copy data)
[wl-clipboard-rs](https://github.com/YaLTeR/wl-clipboard-rs) (optional, if you want to copy data)
- [libnotify](https://gitlab.gnome.org/GNOME/libnotify) (optional, to send notifications about
copied data)
- [pass-otp](https://github.com/tadfisher/pass-otp) (optional, to generate OTP)
Expand All @@ -67,127 +70,25 @@ which you probably should.
### Stable Release

```
wget https://github.com/ayushnix/tessen/releases/download/v1.2.3/tessen-1.2.3.tar.gz
tar xvzf tessen-1.2.3.tar.gz
cd tessen-1.2.3
wget https://github.com/ayushnix/tessen/releases/download/v1.3.0/tessen-1.3.0.tar.gz
tar xvzf tessen-1.3.0.tar.gz
cd tessen-1.3.0
sudo make install
```

or, you know, `doas make install`.

## Usage

### Default Behavior

If a backend is not specified, tessen tries to find bemenu, rofi, and wofi in the order mentioned
here. If rofi is used, it is expected that the [Wayland fork of rofi](https://github.com/lbonn/rofi)
is being used. The [original rofi](https://github.com/davatorium/rofi) implementation made for X.Org
is NOT supported.

If an action is not specified, tessen shows an additional menu with the option to either autotype or
copy data.

The default value of the backend can also be set using the `TESSEN_BACKEND` environment variable.
The default value of the action can be set using the `TESSEN_ACTION` environment variable.

By default, tessen will keep a delay of 200 milliseconds when auto-typing data using wtype. This
can be changed using the `TESSEN_DELAY` environment variable.

### Additional Features

**tessen** assumes that the data organization format is the same as mentioned on the [home page of
password store](https://www.passwordstore.org/#organization).

The first line should always have the password, and nothing else. All other lines may have key-value
pairs like `key1: value1` or the `otpauth://` format URI. However, if a key called `password` is
present, it will be ignored.

If a key called `user` is present, it's value will be the default username instead of the basename
of the selected file. This key can be modified using the `TESSEN_USERKEY` environment variable.

If a key called `url` is present, an option to open the value of the `url` key in the default web
browser will be shown instead of auto type. This becomes the default behavior if `-a autotype`
option is provided during the execution of tessen. The `url` key can be modified using the
`TESSEN_URLKEY` environment variable.

The `otpauth://` format is supported and used if pass-otp is installed.

A value for the `autotype` key can be specified for custom auto-type behavior which overrides the
default behavior of auto-typing the username and the password. For example,

```
$ pass example/john
mypassword
key1: value1
key2: value2
key3: value3
key4: value4
otpauth://totp/ACME%20Co:[email protected]?secret=HXDMVJECJJWSRB3HWIZR4IF...
autotype: key1 :tab key2 :space key3 :enter key4 :delay :tab :otp pass :space path
```

When the default auto-type option is used, an output similar to what is shown
below will be auto-typed:

```
value1 <Tab> value2 <space> value3 <Return> value4 <delay for 1 sec> 384534 mypassword
```

When specified as a value of the `autotype` key,

- `:tab` can be used to type the Tab key
- `:space` can be used to type the Space key
- `:enter` can be used to type the Enter key
- `:delay` can be used to delay the type operation by 1 second
- `:otp` can be used to generate and type the OTP, if `otpauth://` is present
- `user`, or the value of `TESSEN_USERKEY`, can be used to type the username
- `pass` or `password` can be used to type the password
- `path`, `basename`, or `filename` can be used to type the name of the
selected file
- any other key, such as `key1`, can be specified to print its value

The value of the `autotype` key can be modified using the `TESSEN_AUTOKEY`
environment variable.

### Environment Variables

`PASSWORD_STORE_DIR`

The default location of the password store directory.

`PASSWORD_STORE_CLIP_TIME`

The number of seconds after which the clipboard will be cleared.

`TESSEN_BACKEND`

The default dmenu like backend used by tessen. Choose either `bemenu`, the wayland fork of `rofi` by
lbonn on GitHub, or `wofi`.

`TESSEN_ACTION`

The default action of tessen. Choose either `autotype`, `copy`, or `both`.

`TESSEN_USERKEY`

The key which specifies the username. By default, it is assumed to be `user`.

`TESSEN_URLKEY`

The key which specifies the URL. By default, it is assumed to be `url`.

`TESSEN_AUTOKEY`

The key which specifies the auto-type key. By default, it is assumed to be `autotype`.

`TESSEN_DELAY`

The delay in milliseconds when auto-typing is done using wtype. By default, it is 200
milliseconds.
## Features

`BROWSER`
- autotype or copy (or both at the same time!) data, including all valid key-value pairs, in pass
- generate OTPs using pass-otp
- open URLs
- use custom values for `user`, `password`, `url`, `autotype` keys
- use custom autotype operations
- use custom delay time for autotype

The default web browser to use to open URLs. If `xdg-open` is installed, this variable isn't needed.
Please read the [man page](https://github.com/ayushnix/tessen/blob/master/man/tessen.1.scd) for more
information.

## Caveats :warning:

Expand All @@ -196,12 +97,14 @@ may not always work accurately. There can be several reasons for this.

One of the reasons when autotype doesn't work is when a web page doesn't follow the standard
expectation of having a username and password text field one after the other and links are inserted
between them. In such cases, autotyping can make a real mess.
between them. A good example is Discourse forums. In such cases, autotyping can make a real mess.
This is why `tessen` also provides an option to define custom autotype operations.

Autotyping also does not work on Chromium based browsers on Wayland when using
[v0.3](https://github.com/atx/wtype/releases/tag/v0.3) release of `wtype`. However, it works fine on
I haven't been able to make autotyping work on Chromium on Wayland using
[v0.3](https://github.com/atx/wtype/releases/tag/v0.3) of `wtype`. However, it works fine on
Firefox. This issue might've been fixed in
[this](https://github.com/atx/wtype/commit/a81540b7d4920566ad271236ca88befc0002b462) commit.
[this](https://github.com/atx/wtype/commit/a81540b7d4920566ad271236ca88befc0002b462) commit but the
author hasn't released a new version yet.

## What does `tessen` mean?

Expand All @@ -210,8 +113,9 @@ Firefox. This issue might've been fixed in
## Why did you choose this weird name?

Because obvious names like pass-fzf and pass-clip are already taken by other projects? Also, for
some reason, the way how FZF's UI instantly opens up and displays relevant information reminded me
of Japanese hand fans. I guess I was thinking of some anime while coming up with this name.
some reason, the way how bemenu and fuzzel's UI instantly opens up and displays relevant information
reminded me of Japanese hand fans. I guess I was thinking of some anime while coming up with this
name.

## Contributions

Expand Down
2 changes: 1 addition & 1 deletion tessen
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ set +x

# GLOBAL VARIABLES
# variables which won't be changed and can be made readonly
readonly tsn_version="1.2.3"
readonly tsn_version="1.3.0"
readonly tsn_prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
readonly tsn_cliptime="${PASSWORD_STORE_CLIP_TIME:-15}"
readonly tsn_delay="${TESSEN_DELAY:-200}"
Expand Down

0 comments on commit 802a640

Please sign in to comment.