From b0a2c1c5800c30ecf37311885ce11f244102873e Mon Sep 17 00:00:00 2001 From: Sam Chudnick Date: Sat, 12 Feb 2022 17:54:06 -0500 Subject: Bunch of changes --- .config/abook/abookrc | 7 ++ .config/firejail/neomutt.profile | 93 +++++++++++++++++++++ .config/fontconfig/fonts.conf | 28 +++++++ .config/mutt/mailcap | 4 + .config/mutt/muttrc | 171 +++++++++++++++++++++++++++++++++++++++ .config/shell/aliasrc | 3 + .config/shell/shortcutsrc | 1 + .config/sxhkd/sxhkdrc | 2 +- .config/zsh/.zprofile | 1 + .local/bin/check-repos | 10 +++ .local/bin/kill-libvirtd | 22 +++++ .local/bin/start-vm | 9 +++ .local/bin/stop-vm | 21 +++++ 13 files changed, 371 insertions(+), 1 deletion(-) create mode 100644 .config/abook/abookrc create mode 100644 .config/firejail/neomutt.profile create mode 100644 .config/fontconfig/fonts.conf create mode 100644 .config/mutt/mailcap create mode 100644 .config/mutt/muttrc create mode 100755 .local/bin/check-repos create mode 100755 .local/bin/kill-libvirtd create mode 100755 .local/bin/start-vm create mode 100755 .local/bin/stop-vm diff --git a/.config/abook/abookrc b/.config/abook/abookrc new file mode 100644 index 0000000..0d6c033 --- /dev/null +++ b/.config/abook/abookrc @@ -0,0 +1,7 @@ +set autosave=true +set show_all_emails=true +set mutt_command="firejail neomutt" +set www_command=w3m +set address_style=us +set add_email_prevent_duplicates=true +set show_cursor=false diff --git a/.config/firejail/neomutt.profile b/.config/firejail/neomutt.profile new file mode 100644 index 0000000..0a43c6f --- /dev/null +++ b/.config/firejail/neomutt.profile @@ -0,0 +1,93 @@ +# Local firejail profile for neomutt +name neomutt +quiet + +whitelist ${HOME}/.Mail +whitelist ${HOME}/.cache/mutt +whitelist ${HOME}/.mail +whitelist ${HOME}/.msmtprc +whitelist ${HOME}/.signature +whitelist ${HOME}/.vim +whitelist ${HOME}/.viminfo +whitelist ${HOME}/.vimrc +whitelist ${HOME}/.local/share/mail/ +whitelist ${HOME}/.config/mutt/ +whitelist ${HOME}/.mbsyncrc +whitelist ${HOME}/.config/mbsync +whitelist ${HOME}/.config/msmtp +whitelist ${HOME}/.w3m + +noblacklist ${HOME}/.Mail +noblacklist ${HOME}/.cache/mutt +noblacklist ${HOME}/.mail +noblacklist ${HOME}/.msmtprc +noblacklist ${HOME}/.signature +noblacklist ${HOME}/.vim +noblacklist ${HOME}/.viminfo +noblacklist ${HOME}/.vimrc +noblacklist ${HOME}/.local/share/mail/ +noblacklist ${HOME}/.config/mutt/ +noblacklist ${HOME}/.mbsyncrc +noblacklist ${HOME}/.config/mbsync +noblacklist ${HOME}/.config/msmtp +noblacklist ${HOME}/.w3m + +# Access to GPG for encrypting/decrypting/signing mail and passwords with pass +whitelist ${HOME}/.gnupg +noblacklist ${HOME}/.gnupg +whitelist ${RUNUSER}/gnupg + +# This assumes you keep mail account passwords under a separate directory named mail +# This to avoid exposing all passwords to the sandbox, only necessary ones +whitelist ${HOME}/.local/share/password-store/mail +noblacklist ${HOME}/.local/share/password-store/mail + +# abook +whitelist ${HOME}/.config/abook +whitelist ${HOME}/.local/share/abook + +#include whitelist-runuser-common.inc +writable-run-user +blacklist /tmp/.X11-unix +blacklist ${RUNUSER}/wayland-* + +include disable-common.inc +include disable-devel.inc +include disable-interpreters.inc +include disable-passwdmgr.inc +include disable-programs.inc + +# Required for using msmtp with passwordeval +apparmor +caps.drop all +netfilter +no3d +nodvd +nogroups +nonewprivs +noroot +nosound +notv +nou2f +novideo +protocol unix,inet,inet6 +seccomp +shell none +disable-mnt +machine-id + +whitelist /dev/mapper +whitelist /dev/fd +whitelist /dev/full +whitelist /dev/log +whitelist /dev/null +whitelist /dev/ptmx +whitelist /dev/pts +whitelist /dev/random +whitelist /dev/shm +whitelist /dev/stderr +whitelist /dev/stdin +whitelist /dev/stdout +whitelist /dev/tty +whitelist /dev/urandom +whitelist /dev/zero diff --git a/.config/fontconfig/fonts.conf b/.config/fontconfig/fonts.conf new file mode 100644 index 0000000..7512ee5 --- /dev/null +++ b/.config/fontconfig/fonts.conf @@ -0,0 +1,28 @@ + + + + + serif + + Liberation Serif + DejaVu Serif + Noto Color Emoji + + + + sans + + Liberation Sans + DejaVu Sans + Noto Color Emoji + + + + monospace + + Liberation Mono + DejaVu Sans Mono + Inconsolata + + + diff --git a/.config/mutt/mailcap b/.config/mutt/mailcap new file mode 100644 index 0000000..21cd88b --- /dev/null +++ b/.config/mutt/mailcap @@ -0,0 +1,4 @@ +text/plain; $EDITOR ; +text/html; w3m %s ; +image/*; feh %s; +application/pdf; zathura %s; diff --git a/.config/mutt/muttrc b/.config/mutt/muttrc new file mode 100644 index 0000000..c429fed --- /dev/null +++ b/.config/mutt/muttrc @@ -0,0 +1,171 @@ +### General Variables +set editor = "vim -i NONE" +set signature = "~/.config/mutt/signature" +#set index_format = "%2C %Z - %D - %a - %s (%-4.4c)" +folder-hook . 'set index_format = "%2C %Z - %D - %a - %s (%-4.4c)"' +folder-hook Sent 'set index_format = "%2C %Z - %D - %F - %s (%-4.4c)"' +set date_format = "%m/%d/%y %I:%M %p" +set mailcap_path = "~/.config/mutt/mailcap" +set query_command = "abook --config ~/.config/abook/abookrc --datafile ~/.local/share/abook/addressbook --mutt-query '%s'" +set sort = "reverse-date" +set sleep_time = 0 +set markers = no +set mark_old = no +set wait_key = no +set fast_reply +set include +set reverse_name +set delete = yes +set confirmappend = no +set ssl_force_tls = yes +set ssl_starttls = no +set ssl_use_sslv3 = no +set ssl_use_tlsv1 = no +set ssl_use_tlsv1_1 = no +set ssl_use_tlsv1_2 = yes +set ssl_use_tlsv1_3 = yes +set ssl_verify_dates = yes +set ssl_verify_host = yes + +### Sidebar +set sidebar_visible +set mail_check_stats +set sidebar_format = "%B%* %?N?%N/?%?S?%S?" +set sidebar_short_path = yes +set sidebar_folder_indent = yes +set sidebar_indent_string = " " +bind index,pager V sidebar-toggle-visible + +### Keybindings +bind index u noop +bind index U noop +bind index g noop +bind index h noop +bind index,pager v noop +bind index,pager i noop +bind index,pager d noop +bind index,pager y noop +bind index,pager m noop +bind index,pager c noop + +bind generic / search +bind generic n search-next +bind generic N search-opposite +bind generic H top-page +bind generic M middle-page +bind generic L bottom-page +bind generic ? help +bind generic select-entry +bind generic select-entry + +bind index gg first-entry +bind index G last-entry +bind index j next-entry +bind index k previous-entry +bind index \Cu previous-unread +bind index \Cd next-unread +bind index l display-message +bind index L limit +bind index Q query +bind index a create-alias +bind index tag-entry +bind index n mail + +bind pager h exit +bind pager j next-line +bind pager k previous-line +bind pager l view-attachments +bind pager { previous-page +bind pager } next-page +bind pager f display-toggle-weed +bind pager \Cu half-up +bind pager \Cd half-down + +bind index,pager r reply +bind index,pager R group-reply +bind index,pager s sort-mailbox +bind index,pager S sort-reverse + +bind editor complete-query + +bind attach * noop +bind attach h exit + +### Macros +macro index,pager D ";" "send to trash (delete)" +macro index P ";" "permanently delete message" +macro index U ";" "undelete message" +macro index,pager mi ";=Inbox" "move to inbox" +macro index,pager ms ";=Sent" "move to sent" +macro index,pager mj ";=Spam" "move to spam" + +macro index,pager yi ";=Inbox" "copy to inbox" +macro index,pager ys ";=Sent" "copy to sent" +macro index,pager yj ";=Spam" "copy to spam" + +macro index,pager ci ";=Inbox" "cd to inbox" +macro index,pager cs ";=Sent" "cd to sent" +macro index,pager cd ";=Drafts" "cd to drafts" +macro index,pager ct ";=Trash" "cd to trash" +macro index,pager cj ";=Spam" "cd to spam" +macro index,pager ca ";=Archive" "cd to archive" + +macro index,pager J "" "next mailbox" +macro index,pager K "" "previous mailbox" + +macro index,pager A "|abook --config ~/.config/abook/abookrc --datafile ~/.local/share/abook/addressbook --add-email\n" "add address to abook" + +### Headers +ignore * +unignore from date subject to cc +unignore Authentication-Results +unhdr_order * +hdr_order Authentication-Results: From: To: Subject: Date: + +### Colors +mono bold bold +mono underline underline +mono indicator reverse +mono error bold +### Index +color index white default "~A" +color index_number blue default +color index_author blue default "~A" +color index_subject blue default "~A" +# New +color index brightyellow default "~N" +color index_author underline brightblue default "~N" +color index_subject underline brightblue default "~N" +# Tagged +color index brightwhite blue "~T" +color index_author brightwhite blue "~T" +color index_subject brightwhite blue "~T" +### Header +color hdrdefault blue default +color header brightred default "^From:" +color header brightred default "^Subject:" +# highlight authentication headers based on pass/fail/none +color header green default "dkim=pass" +color header green default "spf=pass" +color header green default "dmarc=pass" +color header yellow default "dkim=none" +color header yellow default "spf=none" +color header yellow default "dmarc=none" +color header brightred default "dkim=fail" +color header brightred default "spf=fail" +color header brightred default "dmarc=fail" +### Body +color body default default ".*" +### Sidebar + +### Other +color normal default default +color tilde default default +color status default black +color signature default default +color attachment default default +color message default default +color quoted green default +color search brightred default + +source ~/.config/mutt/accounts/testing diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc index 66b7f75..a393bea 100644 --- a/.config/shell/aliasrc +++ b/.config/shell/aliasrc @@ -42,10 +42,13 @@ alias \ # Start commands with specific options always alias \ + abook="abook --config ~/.config/abook/abookrc --datafile ~/.local/share/abook/addressbook" \ calcurse="calcurse -D ~/.config/calcurse" \ cp="cp -iv" \ ffmpeg="ffmpeg -hide_banner" \ mv="mv -iv" \ + mutt="firejail neomutt" + neomutt="firejail neomutt" \ rm="rm -Iv" source $XDG_CONFIG_HOME/shell/private-aliasrc diff --git a/.config/shell/shortcutsrc b/.config/shell/shortcutsrc index b288c61..b8727ae 100644 --- a/.config/shell/shortcutsrc +++ b/.config/shell/shortcutsrc @@ -9,6 +9,7 @@ alias \ cfs='vim $HOME/.config/shell/shortcutsrc' \ dat='cd $HOME/.local/share' \ dbc='cd $HOME/.local/src/dwmblocks; vim ~/.local/src/dwmblocks/blocks.h' \ + doc='/usr/share/doc/' \ dwc='cd $HOME/.local/src/dwm; vim ~/.local/src/dwm/config.h' \ dws='cd $HOME/.local/src/dwm' \ gms='cd $HOME/.steam/debian-installation/steamapps/common' \ diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc index 3263859..bf155cf 100644 --- a/.config/sxhkd/sxhkdrc +++ b/.config/sxhkd/sxhkdrc @@ -38,7 +38,7 @@ super + q super + w wireshark super + e - urxvt -e vim + urxvt -e firejail neomutt super + r urxvt -e ranger super + a diff --git a/.config/zsh/.zprofile b/.config/zsh/.zprofile index 127c867..3453af6 100644 --- a/.config/zsh/.zprofile +++ b/.config/zsh/.zprofile @@ -17,6 +17,7 @@ export TERMINAL="urxvt" # Other vars export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' export LESSHISTFILE='-' +export LIBVIRT_DEFAULT_URI="qemu:///system" export PASSWORD_STORE_DIR="$XDG_DATA_HOME/password-store" export XINITRC="$XDG_CONFIG_HOME/x11/xinitrc" export WGETRC="$XDG_CONFIG_HOME/wget/wgetrc" diff --git a/.local/bin/check-repos b/.local/bin/check-repos new file mode 100755 index 0000000..d528ce6 --- /dev/null +++ b/.local/bin/check-repos @@ -0,0 +1,10 @@ +#!/bin/sh + +cd $HOME/repos +for repo in $(ls) +do + [ -d $repo/.git ] && echo $repo && \ + echo "------------------------------------------------------" && \ + git --git-dir=$repo/.git --work-tree=$repo status 2>/dev/null && \ + echo "------------------------------------------------------" +done diff --git a/.local/bin/kill-libvirtd b/.local/bin/kill-libvirtd new file mode 100755 index 0000000..2ea802d --- /dev/null +++ b/.local/bin/kill-libvirtd @@ -0,0 +1,22 @@ +#!/bin/sh +# Stop all running domains and networks, and then stop all libvirtd daemons + +# Save running domains +rundoms="$(virsh list | grep running | awk '{print $2}')" +for dom in $rundoms +do + virsh managedsave $dom +done + +# Stop network +virsh net-destroy default + +# Stop libvirtd +sudo systemctl stop libvirtd >/dev/null +sudo systemctl stop libvirtd-ro.socket >/dev/null +sudo systemctl stop libvirtd-admin.socket >/dev/null +sudo systemctl stop libvirtd.socket >/dev/null +sudo systemctl stop virtlogd >/dev/null +sudo systemctl stop virtlogd-admin.socket >/dev/null +sudo systemctl stop virtlogd.socket >/dev/null +sudo systemctl stop systemd-machined >/dev/null diff --git a/.local/bin/start-vm b/.local/bin/start-vm new file mode 100755 index 0000000..5ffea03 --- /dev/null +++ b/.local/bin/start-vm @@ -0,0 +1,9 @@ +#!/bin/sh +# Starts libvirtd, default network, and optionally any domains given as arguments + +pgrep libvirtd >/dev/null || sudo systemctl start libvirtd +virsh net-start default +for domain in "$@" +do + virsh start $domain +done diff --git a/.local/bin/stop-vm b/.local/bin/stop-vm new file mode 100755 index 0000000..6c92250 --- /dev/null +++ b/.local/bin/stop-vm @@ -0,0 +1,21 @@ +#!/bin/sh +# Stops domains given as arguments + +opts=$(getopt -o 'as' -l 'all,save' -- "$@") +eval set -- "$opts" +all=0 +save=0 +while true +do + case $1 in + '-a'|'--all') all=1; shift; continue ;; + '-s'|'--save') save=1; shift; continue ;; + '--') shift; break;; + esac +done + +[ $all -eq 1 ] && domains="$(virsh list | grep running | awk '{print $2}')" || domains="$@" +for domain in $domains +do + [ $save -eq 1 ] && virsh managedsave $domain || virsh shutdown $domain +done -- cgit v1.2.3