% arara: pdflatex
% arara: makeglossaries if found("aux", "@istfilename")
% arara: pdflatex
\documentclass[12pt]{book}

\usepackage[T1]{fontenc}
\usepackage{tgtermes}
\usepackage[dvipsnames]{xcolor}
\usepackage{pifont}
\usepackage{tikz}

\usepackage[colorlinks]{hyperref}
\usepackage[stylemods=tree,style=alttree,savenumberlist]{glossaries-extra}

\makeglossaries

\loadglsentries{example-glossaries-multipar}

\glssetcategoryattribute{general}{glossname}{firstuc}

\renewcommand*{\GlsXtrFormatLocationList}[1]{%
 {%
  \hypersetup{hidelinks}%
  \textcolor{Plum}{\ding{230}}~\textbf{#1}%
 }%
}

% Suppress hanging paragraphs:
%\renewcommand*{\glsxtrAltTreeSetHangIndent}{}

\newlength\maxlocwidth

\renewcommand*{\glsxtralttreeInit}{%
% setup lengths
  \glsFindWidestAnyNameLocation[\currentglossary]%
    {\maxlocwidth}%
  \settowidth
    {\glsxtrtreetopindent}%
    {\glstreenamefmt{\glsgetwidestname}}%
  \addtolength{\glsxtrtreetopindent}%
   {\dimexpr1em+2\nameinnersep+2\nameoutersep}%
  \addtolength{\maxlocwidth}{1em}%
  \glsxtrAltTreeIndent=\parindent
}

\newlength\nameinnersep
\nameinnersep=4pt
\newlength\nameoutersep
\nameoutersep=2pt

\renewcommand*{\glstreenamebox}[2]{%
  \makebox[#1][l]%
  {%
    \begin{tikzpicture}[baseline=(X.base)]
    \node[fill=Orchid,
          align=center,
          text width=\dimexpr#1-2\nameinnersep-2\nameoutersep,
          inner sep=\nameinnersep,
          outer sep=\nameoutersep
         ] (X) {#2};
    \end{tikzpicture}%
  }%
}

\newcommand*{\locbox}[1]{%
 \begin{tikzpicture}[baseline=(X.base)]
 \node[text width=\maxlocwidth,
       draw=CadetBlue,
       fill=CornflowerBlue,
       double,
       thick,
       align=center,
       rounded corners] 
  (X) {#1};
 \end{tikzpicture}%
}

\renewcommand{\glsxtralttreeSymbolDescLocation}[2]{%
  \marginpar[\hfill\locbox{#2}]{\locbox{#2}}%
  % scope \par change
  {%
    \let\par\glsxtrAltTreePar
    \glossentrydesc{#1}\glspostdescription\par
  }%
}

\begin{document}

\frontmatter
\chapter{Front Matter Test}
\forallglsentries{\thislabel}{\gls{\thislabel}.\newpage}

\mainmatter

\chapter{Main Matter Test}
\forallglsentries{\thislabel}{\gls{\thislabel}.\newpage}

\printglossaries

\end{document}
