💾 Archived View for darknesscode.xyz › gmi-crafts › microlog-dmenu.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)

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

MicroLog with dmenu script

By Achim - Sat 10 Apr 2021

I came with the idea of use dmenu to post in my nonsense microlog and push it to the server. I'm one of those that I like to use dmenu to automate some of my scripts and working with my capsule will not be an exception.

Here is my dummy script:

#!/bin/bash

font="-fn Noto-11"

feed="$(printf "%s" | dmenu $font -b -p ' New Microlog : ')" || exit 1

microblog="$HOME/Documents/websites/gemini/microlog/index.gmi"

sed -i "13i ## $(date +'%a %d %b %Y %H:%M %Z')\n$feed\n" $microblog &&

rsync -azP $microblog user@domain.xxx:/var/www/gemini/microlog/ &&

cd $HOME/Documents/websites/gemini &&

git add gemini/microlog/index.gmi &&

git commit -m "New microlog comment" &&

git push origin master &&

notify-send " $feed was posted! " || notify-send " HOLY SHITTT! you Broke The Matrix "

What you need to change

If you like to use it, you need to change.

microblog

This is the full path where you capsule live

sed

This is command that will insert the text into the index.gmi. The format of my index.gmi has a header, a dummy description and a few blank lines before the line number 13.

rsync

This command will upload/update just the microlog index to the server.

git

I use three computer, in my work, in my home and my laptop. That's why I added those git commands to push any change I do in this file.

notify

This is the notification system that I like to use, if your is a different one you have to change it.

I didn't do nothing fancy o crazy in this script, I like simple and clean. The && will prevent and terminate the script if one of the commands fail. For sure there are different ways to do it better but this one is working fine for me.

No use dmenu

If you don't use dmenu or like it. You can use it in the terminal, you need todo a few changes

#!/bin/bash

read -p "New Microlog : " feed &&

microblog="$HOME/Documents/websites/gemini/microlog/index.gmi"

sed -i "13i ## $(date +'%a %d %b %Y %H:%M %Z')\n$feed\n" $microblog &&

rsync -azP $microblog user@domain.xxx:/var/www/gemini/microlog/ &&

cd $HOME/Documents/websites/gemini &&

git add gemini/microlog/index.gmi &&

git commit -m "New microlog comment" &&

git push origin master &&

notify-send " $feed was posted! " || notify-send " HOLY SHITTT! you Broke The Matrix "

That's it.... have fun using Genimi/Capsule

----------

Home

Linux

Notes

Gemini

MicroLog

----------

© DarknessCode