aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: 27298877cd46b5f24341bfb4801b05fdb9955dcd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
jumper.sh: A roundabout way of managing and launching bookmarks

# Why?
I sometimes feel like a bookmark hoarder. I have hundreds of bookmarks of random odds and ends, but they are beholden to whatever browser im using. They cannot be easily shared, must be exported/imported, and are hard to navigate. `jumper.sh` attempts to be a tool to wrangle your bookmarks in a simpler fashion.

In terms of speed, this script isn't that much better than the autofill results in your browser, but it has 3 main advantages.
1. Plaintext Storage
    - To import/export Chrome or Firefox bookmarks, you need to do so in `.html` or `.json` format. 
    - `jumper.sh` simply takes in plaintext files that are readable by themselves.
2. Scriptable 
    - Because `jumper.sh` works in the terminal, the data it outputs can be chopped, analyzed, or used however one likes.
    - Ex. Share list of websites on the internet, curl them, open whichever one you like, etc.
3. Browser Agnostic
    - You can launch the same exact bookmarks in chrome, firefox, `w3m(1)`, `lynx(1)`, etc. without much hassle.

# Install
- Note: There is probably a better way to install than this way.
```shell
git clone https://git.foswret.com/jumper
cd jumper
chmod +x jumper.sh
doas cp jumper.sh /usr/local/bin
```

# "Importing Bookmarks"
Easiest way to do this is open the browser you're already using and right clicking on a folder and select "copy". Paste the contents into a file. There may be folder titles, which should be deleted or commented out with "#". jumper.sh ignores any empty lines, but they can be removed with `vim` by typing `:g/^$/d`.

Comments about entries should come after their link and should preferably be enclosed in double quotes, but this isn't a hard requirement. 

# Usage
```shell
# List all bookmarks in a file and their position
./jumper.sh [BOOKMARK_FILE]

# Launch bookmark [NUM] from [BOOKMARK_FILE]
./jumper.sh [BOOKMARK_FILE] [NUM]
```

`jumper.sh` truly shines when used in combination with `fzf` for easier bookmark opening. An example of such a script is illustrated below.

```shell
#!/bin/sh

bookmark_dir=$HOME/.config/bookmarks
bookmark_file=bookmarks

launch=$(exec jumper.sh "$bookmark_dir"/"$bookmark_file" | fzf)
num=$(echo "$launch" | cut -d " " -f 1 | grep -o -E "[0-9]+")
if [ "$num" ]; then
   jumper.sh "$bookmark_file" "$num"
fi
```

# Example
Lets say I have a bookmark file called `games` with the following contents: 
```
# games
https://lichess.org/ "Lichess.org"
https://www.chess.com/home "Chess.com"
https://www.nytimes.com/games/wordle/index.html "Word Game"
https://www.myabandonware.com/game/chessmaster-10th-edition-gr8 "Old chess game for Windows"
https://www.pagat.com/ "Extensive and simple card game rule database"
```

Each entry consists of the link and a short comment about it. Each entry only takes up one line. I can list all of these bookmarks with `jumper.sh`:

```shell
./jumper.sh games

(1) "Lichess.org": https://lichess.org/
(2) "Chess.com": https://www.chess.com/home
(3) "Word Game": https://www.nytimes.com/games/wordle/index.html
(4) "Old chess game for Windows": https://www.myabandonware.com/game/chessmaster-10th-edition-gr8
(5) "Extensive and simple card game rule database": https://www.pagat.com/
```

Each entry has a number corresponding to its position in the list. this isn't alphabetized, but is based on the order in which they appear in the text file. Bookmarks can be launched in the browser defined in `$browser`. 

```shell
# Launches "https://chess.com" in your browser.
./jumper.sh games.txt 2
```

# Contact
[foswret.com/about](https://foswret.com/about)