From a7f1e587be8f5a7ed75832796e300a2cdef11f75 Mon Sep 17 00:00:00 2001 From: Max Hohlfeld Date: Fri, 26 Apr 2024 09:50:34 +0200 Subject: [PATCH] feat: add some work related config --- justfile | 4 +-- roles/scripts/files/t460p/compiledoc | 40 +++++++++++++++++++++++ roles/scripts/files/t460p/inline_code.tex | 28 ++++++++++++++++ roles/scripts/tasks/main.yml | 10 ++++++ roles/xmonad/files/mimeapps_t460p.list | 26 +++++++++++++++ roles/xmonad/files/xmonad_t460p.hs | 4 +-- roles/xmonad/tasks/main.yml | 4 +++ 7 files changed, 112 insertions(+), 4 deletions(-) create mode 100644 roles/scripts/files/t460p/compiledoc create mode 100644 roles/scripts/files/t460p/inline_code.tex create mode 100644 roles/xmonad/files/mimeapps_t460p.list diff --git a/justfile b/justfile index 90b32e2..3cce590 100644 --- a/justfile +++ b/justfile @@ -9,11 +9,11 @@ install-dependencies: alias s := setup setup tags=allTags: - just setup-{{ if hostname == "qwerty" { "qwerty" } else if hostname == "LE-ARCH-MHO" { "t460p" } else { "x220" } }} "{{ tags }}" + just setup-{{ if hostname == "qwerty" { "qwerty" } else if hostname == "LE-MHO" { "t460p" } else { "x220" } }} "{{ tags }}" alias c := config config tags=allTags: - just config-{{ if hostname == "qwerty" { "qwerty" } else if hostname == "LE-ARCH-MHO" { "t460p" } else { "x220" } }} "{{ tags }}" + just config-{{ if hostname == "qwerty" { "qwerty" } else if hostname == "LE-MHO" { "t460p" } else { "x220" } }} "{{ tags }}" setup-qwerty tags=allTags: ansible-playbook site.yml -K -t "pc,qwerty,{{tags}}" diff --git a/roles/scripts/files/t460p/compiledoc b/roles/scripts/files/t460p/compiledoc new file mode 100644 index 0000000..806830b --- /dev/null +++ b/roles/scripts/files/t460p/compiledoc @@ -0,0 +1,40 @@ +#!/usr/bin/env sh +# takes a file and compiles it into a pdf file, if possible +# inspiration from https://github.com/LukeSmithxyz/voidrice/blob/master/.local/bin/compiler + +file=$(readlink -f "$1") +dir=${file%/*} +base="${file%.*}" +ext="${file##*.}" + +cd "$dir" || exit 1 + +compile_tex() { \ + if [ -e "$dir/../Tectonic.toml" -o -e "$dir/../../Tectonic.toml" ]; then + tectonic -X build + else + params="" + ( grep -q minted $file) && params="$params -Z shell-escape-cwd=$dir" + tectonic -X compile$params $file + rm "$base.aux" "$base.bbl" "$base.bcf" "$base.blg" "$base.log" "$base.out" "$base.run.xml" "$base.toc" "$base.xdv" + fi +} + +case "$ext" in + md) pandoc -t pdf \ + --pdf-engine tectonic \ + -f gfm \ + -V linkcolor:blue \ + -V geometry:a4paper \ + -V geometry:top=2cm \ + -V geometry:right=2cm \ + -V geometry:left=2cm \ + -V geometry:bottom=3.5cm \ + -V mainfont="Liberation Sans" \ + -V monofont="Liberation Mono" \ + --highlight-style tango \ + --include-in-header ~/.local/bin/inline_code.tex \ + -o "$base".pdf "$file" ;; + tex) compile_tex ;; + puml) plantuml "$file" ;; +esac diff --git a/roles/scripts/files/t460p/inline_code.tex b/roles/scripts/files/t460p/inline_code.tex new file mode 100644 index 0000000..c9df708 --- /dev/null +++ b/roles/scripts/files/t460p/inline_code.tex @@ -0,0 +1,28 @@ +\usepackage{fancyvrb,newverbs,xcolor,lastpage,fancyhdr,sectsty,graphicx,hyperref} +\usepackage[datesep=.,style=ddmmyyyy]{datetime2} +\usepackage{fvextra} + +\DefineVerbatimEnvironment{Highlighting}{Verbatim}{breaklines,commandchars=\\\{\}} + +\pagestyle{fancy} +\fancyhf{} +\renewcommand{\headrulewidth}{0pt} +\fancyhead[R]{\includegraphics[height=0.71cm]{/home/max/bilder/logo.png}} +\fancyfoot[C]{\textbf{\thepage\ von \pageref*{LastPage}}\\\vspace{12pt}\color{Gray}it factum GmbH Landsberger Straße 94 80339 München\\ Tel: +49 89 4161221 0 | Email: \href{mailto:info@it-factum.de}{\color{Gray}info@it-factum.de} | Web: \href{https://www.it-factum.de}{\color{Gray}https://www.it-factum.de}} +\fancyfoot[R]{\today} + +\definecolor{Light}{HTML}{F8F8F8} +\definecolor{factum}{HTML}{77263C} + +\sectionfont{\color{factum}} +\subsectionfont{\color{factum}} + +\renewcommand{\labelitemi}{\color{factum}\rule[.5mm]{1.5mm}{1.5mm}} +\renewcommand{\labelitemii}{\color{factum}$\bullet$} +\renewcommand{\labelitemiii}{\color{factum}\textendash} +\renewcommand{\labelitemiv}{\color{factum}$\cdot$} + +\let\oldtexttt\texttt +\renewcommand{\texttt}[1]{ + \colorbox{Light}{\oldtexttt{#1}} +} diff --git a/roles/scripts/tasks/main.yml b/roles/scripts/tasks/main.yml index c1942bc..a86c43c 100644 --- a/roles/scripts/tasks/main.yml +++ b/roles/scripts/tasks/main.yml @@ -33,3 +33,13 @@ - { src: dmenu_kill, dest: ~/.local/bin/dmenu_kill } - { src: run_in_bash, dest: ~/.local/bin/run_in_bash } tags: pc + +- name: Overwrite t460 specific scripts + ansible.builtin.copy: + src: "t460p/{{ item.src }}" + dest: "{{ item.dest }}" + mode: '0755' + with_items: + - { src: compiledoc, dest: ~/.local/bin/compiledoc } + - { src: inline_code.tex, dest: ~/.local/bin/inline_code.tex } + tags: t460p diff --git a/roles/xmonad/files/mimeapps_t460p.list b/roles/xmonad/files/mimeapps_t460p.list new file mode 100644 index 0000000..f65a06c --- /dev/null +++ b/roles/xmonad/files/mimeapps_t460p.list @@ -0,0 +1,26 @@ +[Default Applications] +application/pdf=org.pwmt.zathura.desktop; +audio/flac=mpv.desktop; +audio/mpeg=mpv.desktop; +video/mp4=mpv.desktop; +video/mpeg=mpv.desktop; +video/x-matroska=mpv.desktop; +image/gif=feh.desktop; +image/jpeg=feh.desktop; +image/png=feh.desktop; +image/tiff=feh.desktop; +image/svg+xml=feh.desktop; +text/plain=nvim.desktop; +text/markdown=nvim.desktop; +text/html=firefox.desktop +x-scheme-handler/http=firefox.desktop +x-scheme-handler/https=firefox.desktop +x-scheme-handler/about=firefox.desktop +x-scheme-handler/unknown=firefox.desktop +x-scheme-handler/chrome=firefox.desktop +application/x-extension-htm=firefox.desktop +application/x-extension-html=firefox.desktop +application/x-extension-shtml=firefox.desktop +application/xhtml+xml=firefox.desktop +application/x-extension-xhtml=firefox.desktop +application/x-extension-xht=firefox.desktop diff --git a/roles/xmonad/files/xmonad_t460p.hs b/roles/xmonad/files/xmonad_t460p.hs index b63114e..f41359f 100644 --- a/roles/xmonad/files/xmonad_t460p.hs +++ b/roles/xmonad/files/xmonad_t460p.hs @@ -65,8 +65,8 @@ myModMask = mod4Mask myScratchpads :: [NamedScratchpad] myScratchpads = [ NS "keepassxc" "keepassxc ~/db.kdbx" (title =? "it factum Max Hohlfeld - KeePassXC" <||> title =? "db.kdbx [Gesperrt] - KeePassXC") defaultFloating - , NS "nnn" "alacritty -t nnn -e nnnwrapper" (title =? "nnn") (customFloating $ W.RationalRect (1/4) (1/6) (2/4) (4/6)) - , NS "vimwiki" "alacritty -t vimwiki -e vwwrapper" (title =? "vimwiki") (customFloating $ W.RationalRect (1/10) (1/10) (4/5) (4/5)) + , NS "nnn" "alacritty -t nnn -e run_in_bash n" (title =? "nnn") (customFloating $ W.RationalRect (1/4) (1/6) (2/4) (4/6)) + , NS "vimwiki" "alacritty -t vimwiki -e run_in_bash vw" (title =? "vimwiki") (customFloating $ W.RationalRect (1/10) (1/10) (4/5) (4/5)) , NS "pavucontrol" "pavucontrol" (title =? "Lautstärkeregler") (customFloating $ W.RationalRect (1/6) (1/6) (2/3) (2/3)) , NS "cmus" "alacritty -t 'cmus' -e cmus" (title =? "cmus") (customFloating $ W.RationalRect (1/6) (1/6) (2/3) (2/3)) , NS "qalculate" "qalculate-gtk" (title =? "Qalculate!") (customFloating $ W.RationalRect (3/6) (1/6) (1/6) (1/6)) diff --git a/roles/xmonad/tasks/main.yml b/roles/xmonad/tasks/main.yml index 535983f..aef26e1 100644 --- a/roles/xmonad/tasks/main.yml +++ b/roles/xmonad/tasks/main.yml @@ -21,6 +21,7 @@ - mpv - nsxiv - zathura + - zathura-pdf-mupdf - ttc-iosevka state: present become: true @@ -33,6 +34,7 @@ - pamixer - brightnessctl state: present + become: true tags: [t460p, x220, setup] - name: Build and install dmenu @@ -141,6 +143,7 @@ - { src: xmobarrc_t460p, dest: ~/.config/xmobar/xmobarrc } - { src: bashrc_t460p, dest: ~/.bashrc } - { src: profile_t460p, dest: ~/.profile } + - { src: mimeapps_t460p.list, dest: ~/.config/mimeapps.list } tags: t460p - name: Copy over qwerty config files @@ -181,4 +184,5 @@ name: lightdm state: started enabled: true + become: true tags: [pc, setup]