ln -sfT /d/p/profanity-config ~/.config/profanity
if [[ $HOSTNAME == "$HOST2" || ! -e /p/profanity-here ]]; then
systemctl --user --now enable profanity
+ systemctl --user --now enable prof-tail
fi
;;
*)
if ! pgrep "^prof$" >/dev/null; then
prof &
fi
-if ! pgrep -f '^emacs -f my-znc-all$' >/dev/null; then
- irc &
+# start emacs daemon for profanity if it doesnt exist.
+cmd="emacsclient -s profanity -nc"
+if ! pgrep -fx "$cmd" &>/dev/null; then
+ $cmd &>/dev/null
fi
+
+
+
+# tree of profanity related processes:
+
+# i3-chat (ctrl+y)
+# prof
+# export IANK_BASHRC_RUN="prof-remote $remote"
+# konsole --profile profanity
+# prof-remote $remote
+# ssh -n $remote tail -n0 -qF \
+# /home/iank/.local/share/profanity/prof-tail.log | prof-notify &
+# ssh -t $remote tmux -L profanity a ||:
+
+
+# distro_end, on $d_host
+# systemctl --user enable --now profanity.service
+# /b/ds/subdir_files/.config/systemd/user/profanity.service
+# /usr/bin/tmux -L profanity new-session -d profanity
+# systemctl --user enable --now prof-tail.service
+# note: StandardOutput=truncate:/home/iank/.local/share/profanity/prof-tail.log
+# /usr/local/bin/prof-tail
+#
+
+# /p/profanity-config/profrc & /d/p/profanity-config:
+# compose.editor=/usr/local/bin/prof-irc (alt-c)
+# exec emacsclient -s profanity -a "" "$@"
+#
+# ... (not finished documenting)
fi
-# tree of profanity related processes:
-
-# prof
-# export IANK_BASHRC_RUN="prof-remote $remote"
-# konsole --profile profanity
-# prof-remote $remote
-# ssh -n $remote prof-tail | prof-notify &
-# prof-tail
-# emacs --daemon=profanity &>/dev/null
-# ssh -t $remote tmux -L profanity a ||:
-
-
-# on $remote
-# /b/ds/subdir_files/.config/systemd/user/profanity.service
-# /usr/bin/tmux -L profanity new-session -d profanity
-
-# /p/profanity-config/profrc & /d/p/profanity-config:
-# compose.editor=/usr/local/bin/prof-irc
-# ... (not finished documenting)
# note: this is NOT in the online manual list of commands, that has got to
# be a bug.
-# This, along with changes to emacs init file and prof-remote allows us
+# This, along with changes to emacs init file in mymu4e.el and prof-remote allows us
# to press alt-c in profanity to send the current text to #fsfsys.
exec emacsclient -s profanity -a "" "$@"
set -e; . /usr/local/lib/bash-bear; set +e
+# -A = --ignore-ancestors (dont kill ourselves)
+pkill -fxA '/bin/bash /usr/local/bin/prof-notify' ||:
+
+
while read -r line; do
# check that the profanity window is not focused
if ! i3-check-profanity &>/dev/null; then
ssh -n $remote
fi
# -n or else it competes with the other ssh for reading stdin.
- ssh -n $remote prof-tail | prof-notify &
+ ssh -n $remote tail -n0 -qF /home/iank/.local/share/profanity/prof-tail.log | prof-notify &
ssh -t $remote tmux -L profanity a ||:
builtin kill %% &> /dev/null ||:
if (( EPOCHSECONDS > start + 600 )); then
# See the License for the specific language governing permissions and
# limitations under the License.
-# hacky way to kill off old leftover processes
-pkill -O 1 -x 'prof-tail'
set -e; . /usr/local/lib/bash-bear; set +e
+
# kill 0 doesn't seem to be documented in man bash, but it kills the
# background processes.
# https://unix.stackexchange.com/questions/67532/what-does-kill-0-do-actually/67552
# the connection dying or killing konsole, and this has no effect on either.
#trap "kill 0" EXIT
+## former employees
+# anoukr
+# devinu
+# miriam
+# ruben
xmpp_users=(
- anoukr
+ andrew
craigt
dawnbp
- devinu
+ ekokao
gregf
johnh
jrasata
ksiewicz
michael
- miriam
- ruben
zoe
jtuttle
- ekokao
)
-# start emacs daemon for profanity if it doesnt exist.
-if ! pgrep -f '^emacs --daemon=profanity$' &>/dev/null; then
- emacs --daemon=profanity &>/dev/null
-fi
-
+pre="^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{6}-[0-9]{2} -"
while true; do
midnight=$(date -d '00:00:00 tomorrow' +%s)
log_today=$(date '+%Y_%m_%d').log
logdir=/home/iank/.local/share/profanity/chatlogs/iank_at_fsf.org
- # when this fails, it has PIPESTATUS: 124 0 1 0 0, which seems to end up with 1 as the overall code, which is not what
- # i expected. todo: investigate if and why that is, and narrow the ||:
- # shellcheck disable=SC2046 # intentional
- timeout --foreground $secs_till_midnight tail -n0 -qF \
- $(for u in ${xmpp_users[@]}; do echo $logdir/${u}_at_fsf.org/$log_today; done) 2>/dev/null \
- | awk '$3 != "me:" {print $3; fflush()}' | sed -u 's/^/pm /;s/@.*//' ||: &
+ # example room chat log:
+ #
+ # 2025-11-25T07:56:12.307132-05 - zoe: morning here for an hour
+ #
+ # example pm chat log:
+ #
+ # 2025-11-02T16:29:27.100202-05 - me: ok. good luck
+# 2025-11-02T17:42:02.547790-05 - zoe@fsf.org: oh damn
+ # psuedocode simplified strategy:
+ # tail room_logs | grep -v '^pre iank:' | grep iank | tail - pm_logs | grep -v "^$pre me:"
+ # shellcheck disable=SC2046 # intentional
timeout --foreground $secs_till_midnight tail -n0 -qF \
$logdir/rooms/*/$log_today 2>/dev/null \
- | awk '$3 != "iank:"' | grep -i '\biank\b' | awk '{print $3; fflush()}' | sed 's/^/room /;s/@.*//' ||:
+ | sed -rn "/$pre iank: /d;s/$pre /room: /;/\biank\b/p" \
+ | tail -n0 -qF -- - $(for u in ${xmpp_users[@]}; do echo $logdir/${u}_at_fsf.org/$log_today; done) 2>/dev/null \
+ | sed -rn "s/$pre ([^@:]+)@.*/pm: \1/p;/^room: /p" || [[ ${PIPESTATUS[0]} == 124 ]]
+ # note: man timeout says 124 is when timeout times out.
- kill %
- sleep 1
+ sleep 2
done
# But if emacs ignores the signal, let it live.
pkill -xf 'emacs --daemon' ||:
-if [[ -e /p/profanity-here ]]; then
- systemctl disable --now profanity
-fi
+# iank: todo: figure this out. the only profanity service is
+# a user service, so this is wrong. commented out cuz of that.
+#if [[ -e /p/profanity-here ]]; then
+# systemctl disable --now profanity
+#fi
EOF
fi
--- /dev/null
+[Unit]
+Description=profanity log tail for notifications
+After=gpg-agent.service
+
+# This service exists because killing leftover prof-tail would still
+# leave around its subprocesses. I think its cuz the signal doesn't
+# propogate, and it would if i killed the process group, but i don't
+# know how, so just do this and have 1 process which tails a single
+# file.
+#
+#
+[Service]
+ExecStart=/usr/local/bin/prof-tail
+StandardOutput=truncate:/home/iank/.local/share/profanity/prof-tail.log
+
+[Install]
+WantedBy=default.target
[Service]
# tmux requirement
Type=forking
-
# new-session is a tmux command which allows launching profanity.
ExecStart=/usr/bin/tmux -L profanity new-session -d profanity