From ca4a20a8f46ae4b39516b5fe87f1b26643e02943 Mon Sep 17 00:00:00 2001
From: tavo-wasd <gustavo@gustavocalvo.xyz>
Date: Sun, 1 Oct 2023 18:30:13 -0600
Subject: [PATCH] epic letter.tmac macro, remove newline char from
 menu-bookmarks

---
 groff/letter.tmac           | 13 +++++++++++++
 groff/math.tmac             |  4 ++--
 groff/md.tmac               | 12 ++++++------
 groff/toc.tmac              | 18 +++++++++---------
 groff/utils.tmac            | 16 ++++++++++++++++
 scripts/menu/menu-bookmarks |  3 ++-
 6 files changed, 48 insertions(+), 18 deletions(-)
 create mode 100644 groff/letter.tmac

diff --git a/groff/letter.tmac b/groff/letter.tmac
new file mode 100644
index 0000000..d7d2c0a
--- /dev/null
+++ b/groff/letter.tmac
@@ -0,0 +1,13 @@
+.\" US letter dimensions
+.device papersize=8.5i,11i
+.
+.\" Calculate line length with PO
+.de CALCLL
+.if (\\n[PO] == 0) \{\
+.   \" If PO not defined, set to 1i
+.   nr PO 1i
+.\}
+.nr LL \\n[PO]*-2+8.5i
+.nr LT \\n[PO]*-2+8.5i
+..
+.CALCLL
diff --git a/groff/math.tmac b/groff/math.tmac
index 7882c76..cff0b50 100644
--- a/groff/math.tmac
+++ b/groff/math.tmac
@@ -1,5 +1,5 @@
-\" Quality of life utilities
-\" for easier eqn usage.
+.\" Quality of life utilities
+.\" for easier eqn usage.
 .
 .EQ
 delim $$
diff --git a/groff/md.tmac b/groff/md.tmac
index d093a90..11f5bf9 100644
--- a/groff/md.tmac
+++ b/groff/md.tmac
@@ -1,7 +1,7 @@
-\" Markdown-like syntax for custom headings
-\" and other text formatting options.
+.\" Markdown-like syntax for custom headings
+.\" and other text formatting options.
 .
-\" --- Headings ---
+.\" --- Headings ---
 .de #
 .   nf
 .   NH
@@ -66,7 +66,7 @@
 .   fi
 ..
 .
-\" --- Lists ---
+.\" --- Lists ---
 .de *
 .   IP \(bu 2
 \\$1
@@ -80,14 +80,14 @@
 \\$1
 ..
 .
-\" --- Block quotes ---
+.\" --- Block quotes ---
 .de >
 .   QP
 .   I
 .   ad b
 ..
 .
-\" --- Horizontal rule ---
+.\" --- Horizontal rule ---
 .de ---
 \l'\\n(.lu\(ul'
 ..
diff --git a/groff/toc.tmac b/groff/toc.tmac
index 943946f..2b7d2f5 100644
--- a/groff/toc.tmac
+++ b/groff/toc.tmac
@@ -1,12 +1,12 @@
-\" Borrowed from Sudarson Nantha
-\" github.com/SudarsonNantha
-\" ---
-\" Relocate .TC at the end of the document to either 
-\" 'before' or 'after' (by giving those arguments)
-\" the page where this macro was sourced.
-\" ---
-\" Requires -mspdf macros
-
+.\" Borrowed from Sudarson Nantha
+.\" github.com/SudarsonNantha
+.\" ---
+.\" Relocate .TC at the end of the document to either 
+.\" 'before' or 'after' (by giving those arguments)
+.\" the page where this macro was sourced.
+.\" ---
+.\" Requires -mspdf macros
+.
 .if '\*[.T]'pdf' \X'pdf: pagename here'
 .rn TC TCold
 .de TC
diff --git a/groff/utils.tmac b/groff/utils.tmac
index 90ad720..54385d8 100644
--- a/groff/utils.tmac
+++ b/groff/utils.tmac
@@ -20,3 +20,19 @@
 .\" Auto-numbered tables: \\n+[tblnum]
 .\" Current table:        \\n[tblnum]
 .nr tblnum 0 1
+.
+.\" Begin code block
+.de CS
+.sp 1
+.B1
+.sp 0.5
+.ft CW
+..
+.
+.\" End code block
+.de CE
+.sp 1
+.B2
+.ft
+.sp 1
+..
diff --git a/scripts/menu/menu-bookmarks b/scripts/menu/menu-bookmarks
index c41f44e..fc3b334 100755
--- a/scripts/menu/menu-bookmarks
+++ b/scripts/menu/menu-bookmarks
@@ -5,4 +5,5 @@
 name=$(cut -d '-' -f 1 $HOME/Documents/bookmarks | grep -v '^#' | sed '/^\s*$/d' | menu "Site:")
 [ -z "$name" ] && exit
 
-grep "$name" $HOME/Documents/bookmarks | cut -d '-' -f 2- | xsel -ib && notify-send "󰃀 Bookmarks" "'$name' copied to clipboard"
+grep "$name" $HOME/Documents/bookmarks | cut -d '-' -f 2- | tr -d '\n' |
+    xsel -ib && notify-send "󰃀 Bookmarks" "'$name' copied to clipboard"