💾 Archived View for darknesscode.xyz › gmi-crafts › gemini-capsule.gmi captured on 2021-12-04 at 18:04:22. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-11-30)

-=-=-=-=-=-=-

How I manage my gemini capsule

By Achim - Sat 15 May 2021

One thing I like of Gemini/Capsule is that is simple and no need to render the file to another format, because is just plain text is easy to work with.

Here is my simple script to work with my capsule, nothing fancy, let's say is simple and is working just fine for what I want to do.

First here is a example of my capsule file structure

├── index.gmi
├── gmi-capsules
│   └── index.gmi
├── gmi-crafts
│   ├── gemini-and-html.gmi
│   ├── gemini-capsule.gmi
│   ├── gemini-markup.gmi
│   ├── genimi-and-html.gmi
│   ├── index.gmi
│   ├── microlog-dmenu.gmi
│   └── setup-agate-server.gmi
├── images
│   ├── dwm-arch-linux.png
│   ├── dwm-debian.png
│   ├── dwm.png
│   ├── dwm-void-linux.png
│   ├── gemini-html.png
│   ├── i3wm-a.png
│   └── xmonad.png
├── linux
│   ├── chntpw.gmi
│   ├── dmenu.gmi
│   ├── dwm.gmi
│   ├── git-server.gmi
│   ├── index.gmi
│   ├── tg-telegram.gmi
│   └── xmonad.gmi
├── microlog
│   └── index.gmi
└── notes
    ├── bootable-linux-usb-drive.gmi
    ├── cifs.gmi
    ├── crontab.gmi
    ├── datetimectl.gmi
    ├── epr-epub-reader.gmi
    ├── index.gmi
    └── network-manager.gmi

The capsule has six folders in each there is a index.gmi file, that is the index in each section of the capsule that has all the links to each post in that section. Out of all the folders there is a index.gmi this one is the index for the whole capsule.

The Script

At the beginning I did everything manually, create the file post then add the link in the index and blablabla... So because I'm lazy, i create a little scrip to do that for me!

Here is the script

#!/bin/sh

### DMENU
font="-fn Noto-13"

feed="$(printf "%s" | dmenu $font -b -p ' New Post (notes/linux/gmi-crafts) : ')" || exit 1

### TERMINAL
terminal="st"

### GEMINI CAPSULE
gmi_path="$HOME/Documents/websites/gemini/"

linkName="$(echo $feed | awk -F"/" '{print $2}')"

folder="$(echo $feed | awk -F"/" '{print $1}')"

postName="$(echo $linkName | sed -e 's/-/ /g' -e 's/\b\(.\)/\u\1/g')"

sed -i "15i \=\>\ $linkName.gmi $(date +'%b %d') - $postName" $gmi_path/$folder/index.gmi &&

touch $gmi_path/$feed.gmi &&

### OPEN FILE
exec $terminal -e vim $gmi_path/$feed.gmi || notify-send " Huston we have a problem!!! "

What the script does

I call the script with a keybinding (i use a window manager) and pip it into dmenu

The first part of the script has dmenu stuff and a variable for my terminal of choice

When i want to create a new entry, i have to follow this structure for this to work, it will be like

foldername/name-of-the-new-entry

In my case will be like

gmi-crafs/gemini-capulse

Note the dashes in the files names and folders, the extension of the file will added automatically

Notes

Problems with the scrip, ok I don't see them like a real problem, but the scrip will fail is the folder does no exist or if the file exist already

----------

Home

Linux

Notes

Gemini

MicroLog

----------

© DarknessCode