summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore4
-rw-r--r--Makefile37
-rw-r--r--README.org195
-rw-r--r--gnuplot.org215
-rw-r--r--gpg-agent.org51
-rw-r--r--ledgerrc.org32
-rw-r--r--mail.org472
-rw-r--r--rc.org1391
-rw-r--r--redshift.org66
-rw-r--r--rofi.org141
-rw-r--r--ssh_config.org.gpgbin0 -> 1003 bytes
-rw-r--r--tex.org64
12 files changed, 2667 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index 12e29f7..0aca97e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,3 @@
-tangle/* \ No newline at end of file
+tangle/*
+hash/*
+*.patch \ No newline at end of file
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..0eb9bc8
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,37 @@
+dst_readme := tangle.sh merge.sh pull.sh link.sh dots.sh
+
+.PHONY: update merge dev install link tangle fetch pull clean
+
+update: pull merge dev
+ git rebase dev+ work+
+
+merge: tangle/merge.sh
+ tangle/merge.sh
+
+dev:
+ git fetch
+ git rebase origin/dev+ dev+
+ git rebase master dev+
+ git push --force origin dev+
+
+install: tangle link
+
+tangle: tangle/tangle.sh
+ tangle/tangle.sh
+
+clean:
+ rm hash/*
+
+link: tangle/link.sh
+ tangle/link.sh
+
+fetch:
+ git fetch
+
+pull: tangle/pull.sh
+ tangle/pull.sh
+
+.SILENT: $(addprefix tangle/,$(dst_readme))
+$(addprefix tangle/,$(dst_readme)) &: README.org
+ mkdir -p tangle
+ emacs --batch --eval "(and (require 'org) (org-babel-tangle-file \"README.org\"))" &> /dev/null
diff --git a/README.org b/README.org
new file mode 100644
index 0000000..f336ad0
--- /dev/null
+++ b/README.org
@@ -0,0 +1,195 @@
+#+PROPERTY: header-args:shell :noweb yes :tangle-mode (identity #o555)
+* Contents :QUOTE:TOC_2_gh:
+#+BEGIN_QUOTE
+- [[#my-dotfiles][My dotfiles]]
+ - [[#initial-setup][Initial setup]]
+ - [[#git-setup][Git setup]]
+ - [[#updating-all-tangled-files][Updating all tangled files]]
+ - [[#creating-symlinks][Creating symlinks]]
+ - [[#dots-script][=dots= script]]
+#+END_QUOTE
+
+* My dotfiles
+The config files are organized in [[https://www.gnu.org/software/emacs/][emacs]] [[https://orgmode.org/][org mode]] files. They are tangled
+and symlinked to the appropriate directories.
+
+[[file:emacs-init.org::tangle-hook][A hook]] tangles all files automatically on each save. In addition there
+are shell scripts that tangle all =.org= files at once.
+
+The symlinks can be created by manually running the appropriate [[https://orgmode.org/worg/org-contrib/babel/][babel]]
+source block in each configuration file or by running the scripts
+below.
+
+** Initial setup
+After cloning this repository run
+
+#+begin_example shell
+make install
+#+end_example
+
+to setup the tangled config files and create the necessary symlinks.
+
+** Git setup
+This repository somewhat abuses git branches. Every program's
+configuration lives in its own separate branch. All branches are then
+merged into =master= using an [[https://git-scm.com/docs/merge-strategies#Documentation/merge-strategies.txt-octopus][octopus merge]]. To keep the git history
+clean I reset =master= for every merge. Here is a small script to do
+that and push the changes. I mark branches, which I want to keep local
+only, with a trailing =+= and then exclude them with the ~+$~ pattern
+in grep.
+
+#+begin_src shell :shebang "#!/bin/bash" :tangle tangle/merge.sh
+git checkout master
+git reset --hard init
+git branch -a | grep -v -e +$ -e master | sed "s/[ *] //" | xargs git merge
+git push --force origin master
+#+end_src
+
+To integrate changes from =origin= perform a rebase instead of merge
+to loose the old merge commit but keep any local changes.
+
+#+begin_src shell :shebang "#!/bin/bash" :tangle tangle/pull.sh
+git fetch
+git rebase origin/master master
+#+end_src
+
+** Updating all tangled files
+This script (re-)tangles all =.org= and =.org.gpg= files in the
+current directory. Run this in case the org files were updated outside
+of your local emacs (e.g. after pulling from a remote). Make sure to
+run it from the dotfiles directory.
+
+#+begin_src shell :shebang "#!/bin/bash" :tangle no
+emacs --batch --eval="\
+ (progn (require 'org)
+ (let ((org-confirm-babel-evaluate nil))
+ (mapc 'org-babel-tangle-file (split-string \"$(ls *.org *.org.gpg)\"))))"
+#+end_src
+
+The above won't quite work for me as I use [[https://orgmode.org/worg/org-tutorials/encrypting-files.html#org697961a][org-crypt]] in some
+configuration files and it also needs to be loaded & setup. For
+details see [[file:emacs-init.org::org-crypt-tangle-setup][emacs-init.org]].
+
+#+begin_src shell :shebang "#!/bin/bash" :tangle tangle/tangle.sh
+files=$(ls *.org *.org.gpg)
+
+<<checkhashes>>
+
+echo "Tangling files:$tanglefiles ..."
+
+emacs --batch --eval="\
+ (progn (require 'org)
+ (require 'org-crypt)
+ (org-crypt-use-before-save-magic)
+ (setq org-tags-exclude-from-inheritance '(\"crypt\"))
+ (setq org-crypt-key \"F1EF502F9E81D81381B1679AF973BBEA6994521B\")
+ (defun save-without-hook ()
+ (let ((before-save-hook nil))
+ (save-buffer)))
+ (setq org-babel-pre-tangle-hook '(org-decrypt-entries save-without-hook))
+ (advice-add 'org-babel-tangle :after '(lambda (&rest r)
+ (org-encrypt-entries)
+ (save-without-hook)))
+ (let ((org-confirm-babel-evaluate nil))
+ (mapc 'org-babel-tangle-file (split-string \"$tanglefiles\"))))"
+#+end_src
+
+*** Saving commit hashes to reduce tangling
+To reduce the amount of unnecessary tangling, save the commit hash
+upon tangling and check it before tangling again.
+
+Get the commit hash of a file using ~git log~.
+
+#+NAME: gethash
+#+begin_src shell
+function gethash {
+ git log -n 1 --pretty=format:%H -- $1
+}
+#+end_src
+
+We can save all commit hashes by looping over all files.
+
+#+NAME: savehashes
+#+begin_src shell
+HASHDIR="hash"
+<<gethash>>
+for file in $files
+do
+ gethash $file > $HASHDIR/$file
+done
+#+end_src
+
+But we really want to check the saved hash against the current hash
+first. If they do not match keep the file for tangling.
+
+#+NAME: checkhashes
+#+begin_src shell
+HASHDIR="hash"
+mkdir -p $HASHDIR
+tanglefiles=""
+<<gethash>>
+
+exec 3>&2
+exec 2> /dev/null # disable stderr
+
+for file in $files
+do
+ if [ $(cat $HASHDIR/$file) == $(gethash $file) ]
+ then
+ : # noop
+ else # if strings not equal or ~cat~ fails
+ tanglefiles="$tanglefiles $file"
+ gethash $file > $HASHDIR/$file # save hash
+ fi
+done
+
+exec 2>&3 #reset stderr
+#+end_src
+
+** Creating symlinks
+Each config files contains a source block which creates symlinks of
+the tangled configurations to their respective target locations. These
+blocks all have the ~:tangle tangle/symlink.sh~ and ~:shebang
+#!/bin/bash~ header arguments. The symlinks are created with ~ln -siv~
+to list created symlinks (~-v~) and to ask when overwriting existing
+files (~-i~). To always replace all symlinks you can pipe ~yes~ into
+the ~ln -siv~ calls: ~yes | tangle/link.sh~. Make sure to run it from
+the dotfiles directory.
+
+As the symlink shell source blocks are scattered in all configuration
+files, all files are collected together using ~cat~ and then all blocks
+with the correct ~:tangle~ target are tangled. Unfortunately there is
+no function to directly only tangle blocks with a certain target, so
+this is not straightforward.
+#+begin_src shell :shebang "#!/bin/bash" :tangle tangle/link.sh
+catFile="concat.org"
+symlinkFile="tangle/symlink.sh"
+
+cat <(cat *.org) <(ls *.org.gpg | xargs gpg --decrypt) > $catFile
+
+emacs --batch --eval="\
+ (progn (require 'org)
+ (let ((org-confirm-babel-evaluate nil))
+ (find-file \"$catFile\")
+ (search-forward \":tangle $symlinkFile\")
+ (org-babel-tangle '(16))))"
+
+rm $catFile
+
+$symlinkFile
+#+end_src
+
+** =dots= script
+I place this script in my =PATH= to execute commands in the dotfiles
+directory from anywhere.
+
+#+begin_src shell :shebang "#!/bin/bash" :tangle tangle/dots.sh
+cd ~/git/projects/dotfiles
+$@
+#+end_src
+
+Create a symlink for this script.
+
+#+BEGIN_SRC sh :tangle tangle/symlink.sh :results silent :shebang "#!/bin/bash"
+ln -siv $(pwd)/tangle/dots.sh ~/.local/bin/dots
+#+END_SRC
diff --git a/gnuplot.org b/gnuplot.org
new file mode 100644
index 0000000..a9ec9f4
--- /dev/null
+++ b/gnuplot.org
@@ -0,0 +1,215 @@
+# -*- coding: utf-8-unix -*-
+#+PROPERTY: header-args:gnuplot :tangle tangle/.gnuplot :eval query :tangle-mode (identity #o444)
+* Symlink
+First create a symlink to the desired config location.
+#+begin_src shell :results silent :tangle tangle/symlink.sh :shebang "#!/bin/bash"
+ln -siv $(pwd)/tangle/.gnuplot ~/
+#+end_src
+* General Configuration
+Start off by resetting most settings.
+#+begin_src gnuplot
+reset
+#+end_src
+
+Plot data using linepoints and make solid regions transparent.
+#+begin_src gnuplot
+set style data lp
+set style fill transparent solid 0.4 noborder
+#+end_src
+
+Enable macros and make gnuplot interpret =NaN= as missing data.
+#+begin_src gnuplot
+set macros
+set datafile missing NaN
+#+end_src
+
+A macro to easily reset gnuplot and also reload my settings.
+#+begin_src gnuplot
+init="load '~/.gnuplot'"
+before_refresh="" # Commands to eval before each refresh
+r="@before_refresh;refresh"
+#+end_src
+
+Here is a handy function to define colors with individual rgb integers instead of the hex notation. Example usage: ~plot x w l lc rgb rgb(255,80,0)~. Alternatively gnuplot also supports hsv colors with ~hsv2rgb(h,s,v)~.
+#+begin_src gnuplot
+rgb(r,g,b) = 65536 * int(r) + 256 * int(g) + int(b)
+#+end_src
+
+When setting the column using a variable you can not use the shorthand syntax ~$2~. Instead setup a function so I only have to write ~c(i)~ instead of ~column(i)~.
+#+begin_src gnuplot
+c(a)=column(a)
+#+end_src
+* Mathematical functions
+A collection of functions that can calculate a running average.
+#+begin_src gnuplot
+# running averages
+samples(x,n) = $0>(n-1) ? n : ($0+1)
+init(x)=(back1=back2=back3=back4=back5=back6=back7=back8=back9=back10=back11=back12=sum=0)
+if(init(0)){} # what is the best way to run functions without showing output?
+avg1(x)=(back1=x,back1)
+avg2(x)=(back2=back1,(avg1(x)+back2)/samples($0,2))
+avg3(x)=(back3=back2,(samples($0,2)*avg2(x)+back3)/samples($0,3))
+avg4(x)=(back4=back3,(samples($0,3)*avg3(x)+back4)/samples($0,4))
+avg5(x)=(back5=back4,(samples($0,4)*avg4(x)+back5)/samples($0,5))
+avg6(x)=(back6=back5,(samples($0,5)*avg5(x)+back6)/samples($0,6))
+avg7(x)=(back7=back6,(samples($0,6)*avg6(x)+back7)/samples($0,7))
+avg8(x)=(back8=back7,(samples($0,7)*avg7(x)+back8)/samples($0,8))
+avg9(x)=(back9=back8,(samples($0,8)*avg8(x)+back9)/samples($0,9))
+avg10(x)=(back10=back9,(samples($0,9)*avg9(x)+back10)/samples($0,10))
+avg11(x)=(back11=back10,(samples($0,10)*avg10(x)+back11)/samples($0,11))
+avg12(x)=(back12=back11,(samples($0,11)*avg11(x)+back12)/samples($0,12))
+#+end_src
+
+And some derivatives functions.
+#+begin_src gnuplot
+d(y) = ($0 == 0) ? (y1 = y, 1/0) : (y2 = y1, y1 = y, y1-y2)
+d2(x,y) = ($0 == 0) ? (x1 = x, y1 = y, 1/0) : (x2 = x1, x1 = x, y2 = y1, y1 = y, (y1-y2)/(x1-x2))
+#+end_src
+
+Functions to convert between radians and degrees.
+#+begin_src gnuplot
+rad(deg)=deg/180*pi
+deg(rad)=rad/pi*180
+#+end_src
+* Colors
+=podo= is a good standard colorblind friendly colorsequence.
+#+begin_src gnuplot
+# use colorblind friendly colorsequence
+set colorsequence podo
+#+end_src
+
+I just reorder the =podo= colors, mainly to make black not the default color.
+#+begin_src gnuplot
+# use colorsequence podo but reorder some colors
+set linetype 1 lc rgb "#0072b2" lw 2 pt 1 ps default
+set linetype 2 lc rgb "#d55e00" lw 2 pt 2 ps default
+set linetype 3 lc rgb "#009e73" lw 2 pt 3 ps default
+set linetype 4 lc rgb "#cc79a7" lw 2 pt 4 ps default
+set linetype 5 lc rgb "#56b4e9" lw 2 pt 5 ps default
+set linetype 6 lc rgb "#e69f00" lw 2 pt 6 ps default
+set linetype 7 lc rgb "#f0e442" lw 2 pt 7 ps default
+set linetype 8 lc rgb "black" lw 2 pt 8 ps default
+#+end_src
+* Grid, Border, Tics
+I store the default grid, border and tics settings in the =gbt= variable. So I can easily reset these with the macro call ~@gbt~. The =gbt(col)= function also allows setting grid and border to some other color, but needs to be called using eval, e.g. ~eval(gbt("black"))~.
+#+begin_src gnuplot
+# grid border tics settings
+# call @gbt for defaults
+# call eval(gbt("color")) to use color instead of default
+gbt(col)=sprintf("set tics nomirror; set border 3 back lc '%s'; set grid back lw 1 lc '%s'",col,col)
+gbt="set tics nomirror; set border 3 back lc 'gray50'; set grid back lw 1 lc 'gray50'"
+@gbt
+#+end_src
+
+Support function to set x/y tic formatting with ~set format x formatter(".0","m")~.
+#+begin_src gnuplot
+formatter(prec,unit)=sprintf("%%%ss %%c%s", prec, unit)
+#+end_src
+* A4 plots
+See [[https://milianw.de/blog/how-to-generate-proper-din-a4-sized-plots-with-gnuplot.html][How to generate proper DIN A4 sized plots with Gnuplot - Milian Wolff]].
+
+#+begin_src gnuplot
+a4="set size ratio 0.71; set terminal postscript enhanced landscape;"
+#+end_src
+Also set output to a =.ps= file. After that:
+#+begin_src bash :eval never
+ps2ps -sPAGESIZE=a4 yourfilename.ps new_dina4_file.ps
+#+end_src
+To finish either use something like =ps2pdf= or view the =.ps= file with =ghostview=.
+* Interactive Label Placement
+[[http://www.gnuplotting.org/interactive-label-placing/][Source]]. I adapted the =label_loop= function to newer gnuplot syntax &
+added functionality for multiple arguments. The function call to
+=label_loop= is stored inside a string and can then be executed as a
+macro like this: ~@iLabel "label1" "label2"~
+
+#+begin_src gnuplot
+iLabel = "call '~/git/projects/dotfiles/tangle/label_loop.gp' "
+#+end_src
+
+#+begin_src gnuplot :tangle tangle/label_loop.gp
+# label_loop
+# This loop adds a label to a plot by pressing the left mouse key.
+# If you are not convinced with your chosen position, just klick the mouse key
+# again and it will be positioned at another place. If you are finished, just
+# press another key.
+#
+# Original AUTHOR: Hagen Wierstorf
+
+# Initialize a label number
+if (!exists("label_number")) { label_number = 1 }
+
+do for [ELEMENT in ARG1." ".ARG2." ".ARG3." ".ARG4." ".ARG5] {
+ while (1) {
+ # Waiting for the key press
+ pause mouse any ELEMENT
+
+ # Check if the left mouse key is pressed and add the given label to the plot.
+ # Otherwise stop the loop and count the added label
+ if( MOUSE_BUTTON==1 ) {
+ set label label_number ELEMENT at MOUSE_X,MOUSE_Y textcolor ls 1
+ print " at ",MOUSE_X,MOUSE_Y
+ replot
+ } else {
+ label_number = label_number+1
+ print "\n"
+ break
+ }
+ }
+}
+#+end_src
+
+We can also interactively place rotated labels. Getting the label rotation correct is somewhat tricky and heavily relies on macros. Also the use of ~refresh~ limits the usefulness of this for multiplots.
+#+begin_src gnuplot :tangle tangle/label.gp
+# label
+# Script to interactively position a rotated label.
+#
+# To update after changing graph size rotation angles are scaled with
+# the scaling() function. List of useful macros you should define:
+# scaling(_)= (1.0*(GPVAL_TERM_YMAX-GPVAL_TERM_YMIN)/(GPVAL_TERM_XMAX-GPVAL_TERM_XMIN))/((GPVAL_Y_MAX-GPVAL_Y_MIN)/(GPVAL_X_MAX-GPVAL_X_MIN))
+# label_reset= "@label_unset;@label_labels;replot;"
+# label_init= "undefine label_labels label_unset"
+
+if (!exists("label_number")) {label_number = 1}
+if (!exists("label_labels")) {label_labels = ""}
+if (!exists("label_unset")) {label_unset = ""}
+
+do for [ELEMENT in ARG1." ".ARG2." ".ARG3." ".ARG4." ".ARG5] {
+ print(ELEMENT)
+ while (1) {
+ next=0
+
+ array pointsX[2]; array pointsY[2]
+ do for [point=1:2]{
+ pause mouse any
+ if( MOUSE_BUTTON==1 ) {
+ pointsX[point]=MOUSE_X
+ pointsY[point]=MOUSE_Y
+ } else { next=1;break }
+ }
+ if(next){break}
+ if (pointsX[2] == pointsX[1]){ dx = 1e-20 }
+ else { dx = pointsX[2] - pointsX[1] }
+ dy = pointsY[2] - pointsY[1]
+
+ cmd=sprintf("set label %i \"%s\" at %f,%f rotate by deg(atan(%f*scaling(NaN)));",\
+ label_number, ELEMENT, pointsX[1], pointsY[1],dy/dx)
+ eval(cmd); refresh
+ }
+ print cmd
+ label_labels = label_labels.cmd
+ label_unset = label_unset.sprintf("unset label %i;", label_number)
+ label_number=label_number+1
+}
+refresh
+#+end_src
+
+To make using the script easier define a few macros/functions.
+#+begin_src gnuplot
+scaling(_)= (1.0*(GPVAL_TERM_YMAX-GPVAL_TERM_YMIN)/(GPVAL_TERM_XMAX-GPVAL_TERM_XMIN))/((GPVAL_Y_MAX-GPVAL_Y_MIN)/(GPVAL_X_MAX-GPVAL_X_MIN)) # functions need to have at least one argument
+label="call '~/git/projects/dotfiles/tangle/label.gp' "
+
+label_reset= "@label_unset;@label_labels;refresh;"
+before_refresh = before_refresh."set output GPVAL_OUTPUT;@label_unset;@label_labels;"
+label_init= "@label_unset;label_labels='';label_unset=''"
+@label_init # clear labels each @init
+#+end_src
diff --git a/gpg-agent.org b/gpg-agent.org
new file mode 100644
index 0000000..1db4895
--- /dev/null
+++ b/gpg-agent.org
@@ -0,0 +1,51 @@
+#+PROPERTY: header-args:conf :tangle tangle/gpg-agent.conf :comments org :tangle-mode (identity #o444)
+
+#+BEGIN_SRC sh :tangle tangle/symlink.sh :results silent :shebang "#!/bin/bash"
+ln -siv $(pwd)/tangle/gpg-agent.conf ~/.gnupg/gpg-agent.conf
+ln -siv $(pwd)/tangle/sshcontrol ~/.gnupg/sshcontrol
+ln -siv $(pwd)/tangle/pam-gnupg ~/.config/pam-gnupg
+#+END_SRC
+
+
+#+BEGIN_SRC conf
+default-cache-ttl 10800
+max-cache-ttl 172800
+#+END_SRC
+* ssh password caching
+#+BEGIN_SRC conf
+default-cache-ttl-ssh 10800
+max-cache-ttl-ssh 172800
+#+END_SRC
+* Emacs pinentry
+#+BEGIN_SRC conf
+allow-emacs-pinentry
+allow-loopback-pinentry
+#+END_SRC
+* Enable use as ssh keys
+#+begin_src conf
+enable-ssh-support
+#+end_src
+
+#+begin_src conf :tangle tangle/sshcontrol :comments no
+4AFDEF6B35160F892F61666CE891B2456D755807
+#+end_src
+* Unlocking upon login
+
+[[https://github.com/cruegge/pam-gnupg][pam-gnupg]] is an alternative to =gnome-keyring= to unlock gpg keys upon login. This only works when user and gpg key share the same passphrase.
+
+Start it by adding this to the relevant login pam files (in =/etc/pam.d=).
+#+begin_src conf :tangle no
+auth optional pam_gnupg.so store-only
+session optional pam_gnupg.so
+#+end_src
+Allow preset passphrases for =pam-gnupg=.
+#+begin_src conf
+allow-preset-passphrase
+#+end_src
+
+
+The =pam-gnupg= config file only contains a list of keygrips of keys you want to unlock upon login. It works for both gpg and ssh keys.
+#+begin_src conf :tangle tangle/pam-gnupg :comments no
+DE37E13DE16DB3219D74410F4C20021624CC19E3
+4AFDEF6B35160F892F61666CE891B2456D755807
+#+end_src
diff --git a/ledgerrc.org b/ledgerrc.org
new file mode 100644
index 0000000..78b9f31
--- /dev/null
+++ b/ledgerrc.org
@@ -0,0 +1,32 @@
+#+PROPERTY: header-args:conf :tangle tangle/.ledgerrc :results silent :tangle-mode (identity #o444)
+
+#+begin_src conf
+--file ~/git/projects/ledger/main.ledger
+#+end_src
+#+begin_src shell :tangle tangle/symlink.sh :shebang "#!/bin/bash" :results silent
+ln -siv $(pwd)/tangle/.ledgerrc ~/
+ln -siv $(pwd)/tangle/report ~/.local/bin/
+#+end_src
+
+The =report= script can be used for simple plotting of ledger output using gnuplot. This is taken directly from the ledger git repo.
+#+begin_src shell :tangle tangle/report :shebang "#!/usr/bin/env sh" :tangle-mode (identity #o555)
+# This script facilities plotting of a ledger register report. If you
+# use OS/X, and have AquaTerm installed, you will probably want to set
+# LEDGER_TERM to "aqua".
+#
+# Examples of use:
+#
+# report -j -M reg food # plot monthly food costs
+# report -J reg checking # plot checking account balance
+
+if [ -z "$LEDGER_TERM" ]; then
+ LEDGER_TERM="wxt persist"
+fi
+
+(cat <<EOF; ledger "$@") | gnuplot
+ set terminal $LEDGER_TERM
+ set xdata time
+ set timefmt "%Y-%m-%d"
+ plot "-" using 1:2 with linespoints
+EOF
+#+end_src
diff --git a/mail.org b/mail.org
new file mode 100644
index 0000000..e56ce6c
--- /dev/null
+++ b/mail.org
@@ -0,0 +1,472 @@
+# -*- buffer-auto-save-file-name: nil; -*-
+#+PROPERTY: header-args:conf :tangle-mode (identity #o444)
+* Intro
+
+This file describes my mail setup using
+- =mbsync= (isync) to get mail from the mail server and save it
+ locally
+- =notmuch= for tagging-based mail searching and organization
+ integrated into emacs
+- =afew= to provide initial tagging for new mail to notmuch
+- =msmtp= to actually send the mail written in emacs
+
+* mbsync
+:PROPERTIES:
+:header-args: :tangle tangle/.mbsyncrc :eval never :exports code :results silent
+:END:
+
+The config for mbsync is described in =~/.mbsyncrc=.
+#+BEGIN_SRC conf
+# IMAP keeps an "internaldate" attribute for messages, which is separate
+# from the date given in the message header, set based upon when the
+# message was first received. Fastmail's webmail interface at least
+# uses this attribute to properly order messages chronologically.
+# The CopyArrivalDate option isn't well documented but it seems that when
+# synchronising a new message it uses the Maildir file's Modify date as the
+# IMAP internaldate attribute and vice versa. Otherwise it seemed the
+# synchronisation time was being used instead. By setting the option here it's
+# enabled by default for all Channels.
+#+END_SRC
+
+#+BEGIN_SRC conf
+# 1st Account GMX
+IMAPAccount gmx
+# Address to connect to
+Host imap.gmx.net
+#+end_src
+** My mail address :crypt:
+-----BEGIN PGP MESSAGE-----
+
+hQGMA/lzu+pplFIbAQv6Ap/2jmc78BmLzE/M/u/8kMyiBmXuGY6p2S92aRXi2A5a
+RzZgox9A3hs1OtUlrFS3n+/qGJu6ufzHFU+NC/xblDCPHJakn8LHiGufqG09B5v5
+F1iDYO7x8+ehcNvfjqBjsrOdqJfkpq57yyzKgO0EwZ65tP+OxOcunINfyOmzDXId
+K6Y+ZTVLYKVHpGhdC52t8jXmFCEZyatBlMKMUizVBrGUoHjKXpwbU3D5OyJoSqA7
+QidGC6XNxlGQNjtJLMapSBrNy3srWkprZDhXFersxDNIpfY1+HWAGmnhUbp/1XI8
+rH86gtzZ1xeaVAC7Q0ZUssQ23naIdRlxDM7zMpeH0LXkvC2ElT7JpK1H8XuVe0eH
+PBPGleotvWXG6/DT/WLkHvNE/vHXOa4QhJCa2xaEWQP+n1REIXiSuM8YhoM90tY9
+++Xiux4APeeHKGds3Z8FxDS1TxKQ2ijZOXHLXJAcYKdIFBlA+voN79H2IzVz6k1l
+TW2HS1eDpVImUrAkKs2Z0pwBcRFcsiTG6FQxJ0Y4qJGjsZK2llwDqptlDApshg7x
+13f9wpJnm3qBHQT13sNhzz1Dy4AQsZXj3QEz+u00NqRWy6oVmwKTLQ5W0cXimLn5
+rOfIyOw2zAU9ZLP9yS8/KdONFgrv17bDcToYfjZFeJipHF4b/K0Uk2NSqoX6Hxtd
+D9OhyiSwxcYYpY1+0OGQoYcKyAqS3fSu+0vgS48=
+=ktHf
+-----END PGP MESSAGE-----
+** Rest of the configuration
+#+begin_src conf :padline no
+# Use SSL
+SSLType IMAPS
+# The following line should work. If get certificate errors, uncomment the two following lines and read the "Troubleshooting" section.
+CertificateFile /etc/ssl/certs/ca-certificates.crt
+#CertificateFile ~/.cert/imap.gmail.com.pem
+#CertificateFile ~/.cert/Equifax_Secure_CA.pem
+
+IMAPStore gmx-remote
+Account gmx
+
+MaildirStore gmx-local
+# The trailing "/" is important
+Path ~/Maildir/gmx/
+Inbox ~/Maildir/gmx/INBOX
+Flatten .
+SubFolders Verbatim
+
+Channel gmx
+Master :gmx-remote:
+Slave :gmx-local:
+# Exclude everything under the internal [Gmail] folder, except the interesting folders
+#Patterns * ![Gmail]* "[Gmail]/Sent Mail" "[Gmail]/Starred" "[Gmail]/All Mail"
+# Or include everything
+Patterns *
+# Automatically create missing mailboxes, both locally and on the server
+Create Both
+# Save the synchronization state files in the relevant directory
+SyncState *
+# Remove messages on master marked for deletion
+Expunge Master
+
+Channel gmx-quick
+Master :gmx-remote:
+Slave :gmx-local:
+Patterns INBOX
+SyncState *
+Sync Pull New
+
+##########################################################
+#+END_SRC
+
+** More mail accounts :crypt:
+-----BEGIN PGP MESSAGE-----
+
+hQGMA/lzu+pplFIbAQv/VIvFz9ywYSXo4DJPC0AoRgjUGTs/ECam7bosV+QAo8JA
+4S+AlonfxROa+tuqC7Sd3GrK4BngJhf+lf7BqmJPr7/yjEAW/SA2IWxOypem3/6o
+C62fhqtxAw2b6WT+zCpeCzG95zDIXJNxgqe2fATVpMtno3odV5NkinFxj3AQ20yw
+80PIAxOGzPf4xtWmvAcNGD0jwKT8DYHo7Yexr78JYgp3cZNYs3jmO8NYfKoNFzV1
+fSBb07XYz/4v07alP4kwQETOg+ssGflGRknxk6W65XgQO2nm9QTtMhoGcVJtstpG
+PYF8UUmg71mJv2GZb2+SxC7IFYbwLOJaYBVCOsZqwxKzy1EBmyhuIzgaJKZbB8EM
+yMGKP6pJPoy6BKskALbsptF1cNrDVLWxdrOny3OcK+8JfhfH5MPGiV/u2xMa9sig
+ERz6Hy1VY0S/MYt2P+m73G1AMTbN+Qiqp+/023cc3J5ZxaY0R+eZcd785mRQMh+O
+fjLU+tlhx0xUUxoRLAT80ukB1sAqaJnn345dR1KMklHC5TFr81wp3zMu+2JoKnqu
+/K8SCTo+1t/QkOaf51uGEa9uQ57mqTf9vQdXnQ/gdPGM59K/r75lR/ehVmus9rUW
+qeOtBKSRdqTGVHVqLAK9aJ6blNpINSXWWQts0vsZistMpXrhQ5QSK1qIyHBa04Vj
+tjzGHtNvRRSkj+eCKQynJDzxVFpw1ElyoHxs0lPItDOSLV3r9HQ9fCCD5e9hoRBm
+zzkp4BCBc8WyB1kIUnz/TQvsTCNacbFxume6arysNzMWzQNNHusx/L/83AbTyJ28
+UK26CHvbSkKGYrxKHt5IEenrZFNr7gYNKMhYc/PH3+1hANA7kUXdasFQuIT7Ij1u
+fHl7egsKI/k7wyKfKmgKa/FVT5MJ4V7fO3YX2oGAhuH704fhmG4mCMrot4Nz7Gq0
+uzAI7I2eayXQ2ZS83aE0FUhdk2BFCfR4R282PN/1uadAp/8MFDjIW7dhoktMDtST
+JeODbnIrqD0kfnq+cCLTSqlHi06v1TeJvB0CS7AugsE4rgiitkN6ELUzKMZsruBx
+hQom2CHPKQ7ZSa8tQnLNePIySWy9QO5KNT15ZuScRvXsxUU0awsQExk7asTpawHD
+gdZE/n3ekRq9QAnsv0EmCITzGVBy573JCwNDNUwbGseLVeoW5sYJNDXtilRrXhdY
+icCbQge6rn7fHqAnBWnxgvDKVcBFZJpVYa//6tIzSHLGDmYi3Kt0HXkf6PwYIvjz
+jRHf1Xpy7VRNOA9JTCV5cw6khvpU2u8p+j90f68fsIDqMiLdlgsZSoSwLf2hvjqU
+ZgB9W87oQr7yCEuVI41esNF0IhykxlAiJnSfEb8YYnp3DxDvwRF5SLyQCwuFOUpO
+sf3KVSye/78roQRIkGLJXp5tdelOPAw+fJi7hv90o29xcieoEoPuwNDhCps4vylH
+qPVtv0fcMBZEC1HQwSrrrmBUf0U4kTJntrs/YHAJcEdtGFry5Y7O9eWYX1IKnu2H
+q/oq9Qp6mtv66nn61KEYfxx6Jc2dYwo6D+CVEHlLtICqqfPMLZi/toGaz7KPlPTq
+/gYSbqIGwzKF6SvLy4vD84we3u65u+fcTnb9uqiLq/oUE83CP6sFapphARl6No9A
+zLgC9FzBj5hqh3g2Kg4=
+=q0eG
+-----END PGP MESSAGE-----
+* afew
+:PROPERTIES:
+:header-args: :tangle tangle/afew.config :eval never :exports code :results silent
+:END:
+
+Config expected to be in =~/.config/afew/config=.
+
+~ArchiveSentMailsFilter~ entfernt den /new/ tag und danach werden keine
+CustomFilter mehr angewendet. Um auch gesendete Mails richtig zu
+taggen, wird ~ArchiveSentMailsFilter~ erst am Ende aufgerufen.
+#+BEGIN_SRC conf
+#default filter chain
+[SpamFilter]
+[KillThreadsFilter]
+[ListMailsFilter]
+[SentMailsFilter]
+sent_tag = sent
+#+end_src
+** custom filters :crypt:
+-----BEGIN PGP MESSAGE-----
+
+hQGMA/lzu+pplFIbAQv+LYa99pjG6frcwF8PbG43jAbZobloStIR4LrIwxMaZtYw
+1mvUyZKG2L6VHRQaN2h8SiTzhnojw0iaT8Q0AyJTBiCaL6uJx+A5JNPrhC6vWLnK
+MSBA4Bj8WTQrLstsl0FBu6az25QM0AE9RObqWeO3E+cym4x9ZpIKA8RXMqd6tIx6
+tsGE2XGCCm7N7pPoRmSnZS1/UmFD69zgSqG/DX0UdFA2I44kERSzQjTdFVxEmc+U
+0RVtK3ykeQfmqv1gxBCp96jXzjhHkt0UeiHmsjUQfQA5SSAKY0kMODGh789P6uVa
+tfUs7TnrnQJAsEm+Wa+y4ffr+7zoyCyVsupE/EXRf84sXHs34gReh2AJy7mx138I
+x1hdEG+eO0xnByxvkcOdGs4CeyuXp46nHEHSzOuwX0tJ2BrGvV5lDYCVjuYQPQsi
+gGhickbpzARIrQp767oKNMkIca67VsOoRKf2h4bogI01997e3bR/rIsL+Fco9JOd
+o6SXcZm9Twrip3s+MP2G0ukBkXs0lxDQw/2zQWXjjRBUqAeb+kYCGCNVpRRoBWZK
+OK09HRuAtgwGQh+B1+JeXhCGoK+JB0EIChIbSJj9NypfTxCe8Iqm9iV8aXfbboK8
+dTGONnltE7PXT/4piF13zZiDkPEHWU7wgIXKcIjtblqYPakkXD26IveZZtaPEJdR
+uKuCU6WtgPc28gt5vokzny59kQPJVAWQKY9zTiQGkUz1tWhJCh+KR3sjp/zgYPXb
+Mze40oi+LRpEAgDhu+J8zztnXQgfQuFqjO+erW4qTkoxaw11d/IbGFUIdf4EcZF7
+S8eJKUAksNUqUxvMSKkG5dJqr/ApcBEfNtZjuBorphm9VSimWcQblpc4jy8rS0lq
+ZeGHkzW2b5Oni6dp0VX+86gp7eHrxLoIQAec6IbD58r+uZfucC4mcdFI4D9+WeSV
+ZmT9KwnY5xvQBW3RYVF+LhqQfEvYedlq+Y8Infpm2YgzhkskTO4vEHoLB3DNIAcf
+nsR+tyuF0XxamWHaz8QorIIgQlxJ+RKrcJsAS8eiaGhMm0GnVFvazt8zIDruSf3e
+GsgCHlUjvz+u8bIBNEIzif5nxv3DTjaSq3bYrQFIkWieGwzBOnyEUil0NV5NKxrb
+Xpzkgp64TIGQJSqBrM1Fx7rlMXRJp+XxhWgv1sfprk9uDnzS1N8F8wI+bvQXBC0I
+InbYkw69UuTAFhLf2M/JCf87dyo6Ve7jRI3ujJoMW/i65MjVijhVz/ddfBGmg5MP
+yXdYe/VIdiugbjSWGapmYiWwN6zjf00MzY41K9XLvQtX8BMmX1QgYiOEDEsZqhTB
+h9GxlPTuH9OkgVDpKs+/vNKUrUhdWnpK
+=guIu
+-----END PGP MESSAGE-----
+** more stuff
+#+begin_src conf
+[Filter.1]
+message = "Get mailing lists out"
+query = tag:lists and tag:new
+tags = -new;
+
+[ArchiveSentMailsFilter]
+
+[InboxFilter]
+#+END_SRC
+Move archived messages from inbox to remote Archive. Archived Messages older
+than 1 year are moved to local Archive.
+
+#+begin_src conf :tangle no
+[MailMover]
+folders = Inbox Sent Spam
+rename = true
+
+# rules
+Inbox = 'date:-1800d..-60d':archive 'tag:spam':Spam
+#+end_src
+** MailMover section :crypt:
+-----BEGIN PGP MESSAGE-----
+
+hQGMA/lzu+pplFIbAQv/Y9HmsMJS6hVR+LJtOJgL/uDTQv8mMKp1yKg9o5iX1oro
+Gs/aaJcy8HpjsYnZd7Yx3PpuFh/yfM4XmNRhE68K2MtljTxrLmhm9oScQNv8QlFK
+PwQbN9gKydrYbkxRrpNgbGBSFkrXd7uQ7NAyyvPdHY1Z0w/rDM4LZZKCTx9/1S1Q
+3OZniVklBO94fIaPRDXcZK0dhuvXuOYFY6pSnByRJHzK/y0JzU6j50ZoEPre9frb
+L/OiQLbsCwOZGXu96uHD6IN1YoTg+y3wSHUt+/rQyBIt9wH65oR2UJzQGiBevWoy
+ZB/roXHFUA3qWBtye2zwUUgn9zwfHhxpVXh/CUF+H/nJpu4onr2NFZpVQBjTv3PM
+LfS3QFRzArCSwFxAWpwzk8LHAeFTMoL5Ojz5bHGsrJbq3+WO2LPepN0Mb6HJbL+T
+p1dYEfdIWLTVOJ+h+OGKg2FhHuN9+sEamrW1MhBqpgiTLN+RcxYLdqzUUYkX5y2l
+R3rwiARy20KmQdvPDkgi0sCbAXh3Qkm2FP+naUkpMG8hygfDAIvlKzPPNrfQIF+c
+K0sgSSHg6zDY8WD5O+jgsJMb+MDFVVavmy7evA+w5lPXToVrVNItz5iVvXjAY74k
+4mUSKkY7RTRDpHihNYNKZ/7iz5QqpCCdAPiZt9neZ/2TR8zD8ESkxFRHt296Tw+Z
+U9A5+cmTq05c7KoVsp4S1DADL0V4w5ELbXEAkeZ+fJoYMjTLJ9QxH9FGHduxN161
+uEED+B2SztY/8YWHGk+C6JtRgFqlCIdcshJVRWTlJg36R9jzXKuxhM+GJ4FQ+BSV
+GhhV58pAPg/OzvR2o8TmlYm2QUhufZY08PH1HqJWu/GQigpHQlM5sXZgDRlu5ovv
+f+hcnYxlWVjh6tquhT4uHo6uVwh//SaOPpYmEVAe9O9PdwL47pFJu6k0MMkH4qrK
+7zUsvb+IgDtvGL3JLgMP7+qEF5NhrjoQVowImx8=
+=oUMI
+-----END PGP MESSAGE-----
+* notmuch
+:PROPERTIES:
+:header-args: :tangle tangle/.notmuch-config :eval never :exports code :results silent
+:END:
+
+Config in =~/.notmuch-config=.
+#+BEGIN_SRC conf
+# .notmuch-config - Configuration file for the notmuch mail system
+#
+# For more information about notmuch, see https://notmuchmail.org
+
+# Database configuration
+#
+# The only value supported here is 'path' which should be the top-level
+# directory where your mail currently exists and to where mail will be
+# delivered in the future. Files should be individual email messages.
+# Notmuch will store its database within a sub-directory of the path
+# configured here named ".notmuch".
+#
+[database]
+path=/home/fpi/Maildir
+#+end_src
+** User configuration :crypt:
+-----BEGIN PGP MESSAGE-----
+
+hQGMA/lzu+pplFIbAQwAyADHr9/dxo+qBiAnayNbHLRsCOZlRI/LdY8zL9AUN2Dm
+V3RvD9vgJAg/FQR3Q3/St+EWrYd8ktPshr/54zE9EpqbQf/iZf1nHx8hQdyZLmFQ
+teYuX+d4+r65LV6dwMKc3IYRNVefy0qMYYJcGxisgvg2FmJbZw5pInEfRjlu3e7c
+yuiYPfbE1JfbF5Q+UK+jnq1MA/12XRYB+vSaEz+oYAY1B8L/oIifTFTBM2LlSYrs
+e1oR1oYcEqZ6/NNcM8oFJV8mKo3ppvLQT3T9mIZinq9wdBssqSm7JjCghh+rBjrA
+ZCk9+7n4WgsBIzclKXLPUpQrNt7i/j2o/lJZMe1X6uhwEvY4k2Ef/URRd5T3L0lz
+XXHIkcNZQGfko+AnwSIeG2fsDA9h5HOx5t/9gQX5JqVXHNxUomyaumxafEkAw51N
+hWN78JIZNTTIeNdlbKs+7tPqc/0Pg5KQsBrOIjsI8Q0/xy0U6ggNflce3jRXQ8b1
+ugcZK5XwVXVChho2w5340sEtAY7o7yrPPB0guACFB6T+pddMGlR2KRFqkL7n3UTt
+R0BuuPcAaYwu4NA0dGG3HWEsHHnrCjADQNRimM5vxa2yl74YDBa/sA+eZ48ee3oV
+bHXerSuERu0TZd/PxcFGyHLjbe6CR26a+q6O87pYbmlzCANddGSFmhInFv9dzpi9
+1EnTRr8KS2t+KPOAOYGnyuJD/gBsPuA43DAfZG+CFDIve4593QadyovvntJMgb2v
+p1P899T9n76zuLd+kpi0vE/1U2XZkJQfp6eZh/1KiP5tnSAQfFaPBICg412vAg/D
+7EbWn4xav4MQA7BPz2WWVuIktsJ/22ZhX+EmIB2pKSqad6q0mGt8/nu4ZzUY3HLb
+fZA1qaBdSkIZIef4mNkiT2Sl+sbwzv/M8Lg0BZAPAS6hCrt4kNOeRhpcJNTlSaOD
+mVq6dwrfvvPiY3tFMkbCLVT+4OztYsgHg+D+e4eGnA6geVCCvVtb79pK1tQKcAED
+Y20tp9QZ7jVAP1zOVTZn8x9fe2VTa6+oyAayWtvgxQbSLhfmKc7et0LCngtTaasT
+mHQXwQ7r0EIVyrkrhC0/Dlo7pgyoQ9spaBpCPg8hszDoNTJ0gunf2NxYBjjyO5hI
+Zxz8+V8+wgKl/CfIoX0EoF3VcOs0EL+GvqFqcM9tsg==
+=H1dY
+-----END PGP MESSAGE-----
+** More configuration
+#+begin_src conf
+# Configuration for "notmuch new"
+#
+# The following options are supported here:
+#
+# tags A list (separated by ';') of the tags that will be
+# added to all messages incorporated by "notmuch new".
+#
+# ignore A list (separated by ';') of file and directory names
+# that will not be searched for messages by "notmuch new".
+#
+# NOTE: *Every* file/directory that goes by one of those
+# names will be ignored, independent of its depth/location
+# in the mail store.
+#
+[new]
+tags=new
+ignore=.mbsyncstate;.uidvalidity
+
+# Search configuration
+#
+# The following option is supported here:
+#
+# exclude_tags
+# A ;-separated list of tags that will be excluded from
+# search results by default. Using an excluded tag in a
+# query will override that exclusion.
+#
+[search]
+exclude_tags=deleted;spam;
+
+# Maildir compatibility configuration
+#
+# The following option is supported here:
+#
+# synchronize_flags Valid values are true and false.
+#
+# If true, then the following maildir flags (in message filenames)
+# will be synchronized with the corresponding notmuch tags:
+#
+# Flag Tag
+# ---- -------
+# D draft
+# F flagged
+# P passed
+# R replied
+# S unread (added when 'S' flag is not present)
+#
+# The "notmuch new" command will notice flag changes in filenames
+# and update tags, while the "notmuch tag" and "notmuch restore"
+# commands will notice tag changes and update flags in filenames
+#
+[maildir]
+synchronize_flags=true
+
+# Cryptography related configuration
+#
+# The following *deprecated* option is currently supported:
+#
+# gpg_path
+# binary name or full path to invoke gpg.
+# NOTE: In a future build, this option will be ignored.
+# Setting $PATH is a better approach.
+#
+[crypto]
+gpg_path=gpg
+#+END_SRC
+* msmtp
+:PROPERTIES:
+:header-args: :tangle tangle/.msmtprc :eval never :exports code :results silent
+:END:
+
+Config in =~/.msmtprc=.
+#+BEGIN_SRC conf
+# Set default values for all following accounts.
+defaults
+# Use the mail submission port 587 instead of the SMTP port 25.
+port 587
+# Always use TLS.
+tls on
+# don't use auto_from
+auto_from off
+
+# Log to syslog/systemd
+syslog on
+
+tls_trust_file /etc/ssl/certs/ca-certificates.crt
+
+# Additionally, you should use the tls_crl_file command to check for revoked
+# certificates, but unfortunately getting revocation lists and keeping them
+# up to date is not straightforward.
+#tls_crl_file ~/.tls-crls
+
+#+end_src
+** Account configuration :crypt:
+-----BEGIN PGP MESSAGE-----
+
+hQGMA/lzu+pplFIbAQv/Z+gf1HDfl3ujUmWlhnNSgtDYvJ0p1F5ocDQFbycYcMnK
+y0pgNbBHTt4EnpyBzcO4fJeWnytd8VWivcNyie36fwInOfZGDWwGGbg6mbDSTZ7R
+TE6oGnUIJZGZGi3Tc48Pfi2/dnLFaqIFjpCBHoF3SJt35HlHCaH5fo1VCym0WRW/
+zCXZUbbLgncDYnzb1TLvMZcDTqPiIKsMkqXiO2tf/P9WJTqk0gZBPvMWTQKqrjtm
+tj5+PAUCG2YATra5MBGeQED7DflV9UMyxcP8pHGV8HStoih0xTQ72X0N0mL5JquK
+A0LW4p0jGNig0v5EdgP8yZtygv2Rx+3IRJzuedubM37dnRF+jzAfkmC1ALY5zEfW
+8l//9iwcARtEde8AS2vAoPVXlS0xIEF12d6VzkWWzncZmcXIHyXDrFY1+z3tEe0V
+e8fBSx4LsBfCTJineSCcDkh+AuGr2JyvM71b8eX3BE1FqrfNppV2pqXlkVIL19R8
+/kr4nDHmtG+59+lmbzyD0ukB0OUbXqHJMnnMbJRjHsEbuQUAazGfOZDUyjd4zJx2
+2fNFuPEPkKiiJUWOFeYqnbG12e+sl0LP2CMTGNdd4aT51IDrWXlSxbkwxBiK3spt
+n2LhqzZs0xK0ZGkSiH+7BnxtVgkzBIbF4sGmhq696gWyGuY3EfmIBSNRidlpCGtC
+iJwK29G9DUKX7s6cR3+n7A2wWK47fQazRN/lcUQ7XD0JOhsasR0SMUQvQRwnfR9e
+ft8romZ4uGBeRhm7n2cA7d5CJJPVJfsq5QdZFLewPmQPDbH4Fkeg8i4Oeh7Lu2fs
+EOLOhao5ejocKlY9ZdGpNzhDxHLkZJ4ShX9+OoV9Uz3Sf2rmtz8r94pkNDmaaQ8c
+990I3/caiy4PpsWTp1QJ4EUvhT3EWUsE2EYvM3SQSGpF+HOT0j6vrIaoecMCqoLX
+WkUvZap6obg3KiSqodGn007iiqQ8pwJZl76FZMbse0jei0XcyiHt+hY2EO1FhMyv
+pKRiHcwx8rICoiw2oGn13Zb9UbVmXU5SMeurE59C/0PFUC6SzafMnPTJXUQ7NlUq
+ne9se0qmT7JoqHXshuotRSsYRVpxns2JZuE7tqHA7/Ud5hVPLy3ZOl+Zk6ddagc9
+lPhqal3qX0U9nSWQsCXBa8+MhduFG4hYuNj9X5uviTNK2q3wLgRUCo2gRXK2cp+k
+FMBa71Nk8D4/EBU9giq5FAPG91uer+UcmSZVknLncY0pd1uAdtBsIUT/+zZvIJMJ
+8FNjguacnEefSewhLAcMVrKOQ2WYOvOP5nLr9TaKnJ5nS5GSRXVJy9nBKFtEAZf+
+2wmHTkmFSwP3lqi1ZaIxovF3rs2lHc5Y+l2TYUMpZ7IoENt3mHV5NpMf8n9YMXvH
+iml2sfR/j4AwOMKGoq4kd/+X5T3+YDXceV9Na5dVS8Gi988FYJ7mUQgpQEBh97PF
+Rfk0cIaKPIfioUlzYQqH1j2iJJ3oR1cY7zOaPZiWsvbIthhMLOFfkHh70Ohcu/b+
+/gV5ByyC9yQDRuyjleeUMuWjQP8rr9eA2ieri6QajNz1xDuf2VwB13NhMAWx
+=wmLO
+-----END PGP MESSAGE-----
+* Checkmail.sh
+:PROPERTIES:
+:header-args: :tangle tangle/checkmail.sh :exports code
+:END:
+
+This script calls everything necessary to receive mail. An optional 'quick'
+argument can be supplied to only sync the inbox.
+
+#+BEGIN_SRC shell :shebang "#!/bin/sh" :results silent
+STATE=`nmcli networking connectivity`
+run=$1
+
+# no of old unread mails
+OLD_UNREAD=`notmuch count "tag:unread and tag:inbox"`
+
+# Delete deleted mails
+COUNT=`notmuch count "tag:deleted and (tag:spam or not tag:spam)"`
+if [ $COUNT != 0 ]
+then
+ echo "- deleting $COUNT messages ..."
+ notmuch search --format=text0 --output=files "tag:deleted and (tag:spam or not tag:spam)" | xargs -0 --no-run-if-empty rm
+fi
+
+if [ $STATE = 'full' ]
+then
+ #~/.local/bin/msmtp-runqueue.sh
+ if [ $run = 'quick' ]
+ then
+ # echo 'Quick Sync'
+ mbsync gmx-quick
+ else
+ # echo 'Normal Sync'
+ mbsync all
+ fi
+ notmuch new
+ # tag mail
+ afew -tn
+ # move mail
+ # all mail to move archived messages
+ afew -ma
+ #notmuch tag -inbox tag:inbox AND tag:lists
+
+ NEW_UNREAD=`notmuch count "tag:unread and tag:inbox"`
+ if (( $NEW_UNREAD > $OLD_UNREAD ))
+ then
+ msgs=( $(notmuch search --output=threads 'tag:unread and tag:inbox'))
+ for i in $(seq 0 $(($NEW_UNREAD - $OLD_UNREAD -1)))
+ do
+ subject=$(notmuch search ${msgs[i]}|grep -oP "(?<=\] ).*(?=( \())")
+ emacsclient -e "(sauron-add-event 'mail 3 \"$subject\" '(lambda () (other-window 1) (notmuch-show \"${msgs[i]}\" nil nil \"tag:unread and tag:inbox\")))"
+ notify-send -u low "New mail:" "$subject"
+ done
+ fi
+
+ exit 0
+fi
+# echo "No Internets!"
+exit 0
+#+END_SRC
+
+A simple cronjob then regulary calls this script. Setup like this it
+performs a quick sync every minute and a full sync every ten minutes
+and also logs stdout to systemd.
+#+BEGIN_SRC conf :eval never :tangle no
+,* * * * * systemd-cat /home/fpi/.checkmail.sh quick
+,*/10 * * * * systemd-cat /home/fpi/.checkmail.sh full
+#+END_SRC
+* Emacs setup
+:PROPERTIES:
+:header-args: :tangle tangle/emacs-mail.el :eval never :exports code :results silent
+:END:
+
+See [[id:1e1d7ae0-3e88-4e14-b67f-72c6be66e565][emacs init file]].
+* Create symlinks
+
+Finally symbolic links to the desired locations are created for all
+the tangled files.
+
+#+BEGIN_SRC shell :tangle tangle/symlink.sh :shebang "#!/bin/bash" :shebang "#!/bin/bash"
+ln -siv $(pwd)/tangle/.mbsyncrc ~/
+ln -siv $(pwd)/tangle/afew.config ~/.config/afew/config
+ln -siv $(pwd)/tangle/.notmuch-config ~/
+ln -siv $(pwd)/tangle/.msmtprc ~/
+ln -siv $(pwd)/tangle/checkmail.sh ~/
+#+END_SRC
diff --git a/rc.org b/rc.org
new file mode 100644
index 0000000..5b98c2e
--- /dev/null
+++ b/rc.org
@@ -0,0 +1,1391 @@
+Tangle this to rc.lua for awesome to use it.
+
+#+BEGIN_SRC shell :results silent :tangle tangle/symlink.sh :shebang "#!/bin/bash"
+ln -siv $(pwd)/tangle/rc.lua ~/.config/awesome/
+#+END_SRC
+* External packages
+I make use of these external awesome libraries/packages
+- [[https://github.com/lcpz/lain][lain]]
+- eminent to hide unused tags?
+- [[https://github.com/pltanton/net_widgets][net_widgets]]
+- [[https://github.com/deficient/battery-widget][battery_widget]]
+- email & spotify widget from [[https://github.com/streetturtle/awesome-wm-widgets][awesome-wm-widgets]]
+* General Tips (no code to tangle here)
+ :PROPERTIES:
+ :header-args:lua: :tangle no
+ :END:
+ To set wallpaper without restart:
+ #+BEGIN_SRC lua :tangle no
+ r=require("gears")
+ r.wallpaper.set(r.color.create_png_pattern("/home/fpi/Pictures/wallpaper/w"))
+ require("gears").wallpaper.centered("…")
+ #+END_SRC
+
+* Improvements to work on
+ :PROPERTIES:
+ :header-args:lua: :tangle no
+ :END:
+** Overview & Reorganization of Keyboard layout
+ :PROPERTIES:
+ :header-args:ruby: :var t=kb_layout
+ :END:
+
+ TODO: Easy accessible key to show spotify song!
+ #+NAME: kb_layout
+ #+CAPTION: Alle Tasten der QWERTY-Tastatur mit neo2 Belegung
+ | ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | Home | End | Ins | Del |
+ | | ^ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | ` | BCK | | |
+ | | TAB | x | v | l | c | w | k | h | g | f | q | ß | ´ | M3 | | |
+ | | M3 | u | i | a | e | o | s | n | r | t | d | y | ent | | | |
+ | | Sh | ü | ö | ä | p | z | b | m | , | . | j | Sh | | | | |
+ | | Fn | Ctrl | Sup | Alt | Spc | Spc | Spc | Alt | Druck | Ctrl | PgUp | Up | PgDn | | | |
+ | | | | | | | | | | | | Left | Dn | Right | | | |
+*** Current Awesome Key Setup (5.1.2018)
+ - =Super+Mod5+Key=: start program
+ - =Super+Shift+Mod5+Key=: Switch to tag #α (Greek keys)
+ - =Super+Ctrl+Shift+Mod5+Key=: Tag menu of tag #α (Greek keys)
+**** Super+Key
+ | l,h | in-/decrease master width |
+ | j,k | focus next/previous client |
+ | s | help |
+ | w | main menu |
+ | x | execute Lua |
+ | r | execute bash |
+ | TAB | go back (client level) |
+ | f | toggle fullscreen |
+ | m | t maximize |
+ | n | minimize |
+ | o | move to other screen |
+ | u | jump to urgent |
+ | p | run rofi |
+ | 1-9 | view tag #i |
+ | Esc | go back (tag level) |
+ | a | next non-empty tag |
+ | i | first empty tag |
+ | v | next empty tag |
+ | b | move window to (current) tag |
+ | d | temporary tag |
+ | →,← | next/prev non-empty tag |
+ | SPC | select next layout |
+**** Super+Ctrl+Key
+ | r | reload awesome |
+ | Enter | move to master |
+ | l | toggle sticky |
+ | m | maximize vertically |
+ | n | restore minimized |
+ | SPC | toggle floating |
+ | l,h | de-/increase no of columns |
+ | j,k | focus next/prev screen |
+ | 1-9 | toggle tag #i |
+ | c | compact clients over all tags |
+ | s | spread clients of current tag |
+ | v | move client to next nonempty and follow |
+ | →,← | view next/prev tag |
+**** Super+Shift+Key
+ | q | quit awesome |
+ | c | close |
+ | j,k | swap with next/prev client |
+ | m | maximize horizontally |
+ | u | toggle keep on top |
+ | x | repair no tiling window |
+ | l,h | de-/increase no of master clients |
+ | SPC | select prev layout |
+ | p | screen manager |
+ | 1-9 | move client to tag #i |
+ | →,← | move client to next/prev tag |
+**** Super+Ctrl+Shift+Key
+ | 1-9 | toggle client on tag #i |
+
+*** New layout
+ hjkl replaced by nrtd. Other command organized mnemonically if
+ possible or grouped up.\\
+ Abbrevs: c=client, t=tag, n=next, p=previous, m=master, w=width, n-e=non-empty, f=floating
+ |-----+-----+------+-----+-----+-----+-----+-----+-----+-------+------+------+-----+-------+-----+-----+-----|
+ | ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | Home | End | Ins | Del |
+ | | ^ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | ` | BCK | | |
+ | | TAB | x | v | l | c | w | k | h | g | f | q | ß | ´ | M3 | | |
+ | | M3 | u | i | a | e | o | s | n | r | t | d | y | ent | | | |
+ | | Sh | ü | ö | ä | p | z | b | m | , | . | j | Sh | | | | |
+ | | Fn | Ctrl | Sup | Alt | Spc | Spc | Spc | Alt | Druck | Ctrl | PgUp | Up | PgDn | | | |
+ | | | | | | | | | | | | Left | Dn | Right | | | |
+**** Super+Key
+ | t bck | - | - | - | - | - | - | - | - | - | - | - | - | | | | |
+ | | [^] | view | t | #i | " | " | " | " | " | " | [0] | [-] | [`] | {BCK} | | |
+ | | c back | [x] | f e t | n e t | n ne t | [w] | [k] | run lua | /bash | fullscr | [q] | [ß] | [´] | {M3} | | |
+ | | {M3} | urgent | f c to cursor | emacs | quake | oth scr | help | de- | focus | n/p c | inc m w | [y] | open term | | | |
+ | | {Sh} | t back | c back | [ä] | rofi | minmize | [b] | t max | [,] | temp t | [j] | {Sh} | | | | |
+ | | {Fn} | {Ctrl} | {Sup} | {Alt} | next | lay- | out | {Alt} | {Druck} | {Ctrl} | [PgUp] | [Up] | [PgDn] | | | |
+ | | | | | | | | | | | | p/n n-e | [Dn] | tag | | | |
+**** Super+Ctrl+Key
+ : Operations on tag level
+ | ESC | | | | | | | | | | | | | | | | |
+ | | | toggle | tag | #i | " | " | " | " | " | " | [0] | | | {BCK} | | |
+ | | {TAB} | [x] | [v] | mv c ne t+f | [c] | [w] | [k] | [h] | [g] | [f] | [q] | [ß] | | {M3} | | |
+ | | {M3} | [u] | [i] | [a] | [e] | [o] | [s] | in- | focus | n/p scr | dec col no | [y] | move m | | | |
+ | | {Sh} | [ü] | [ö] | [ä] | [p] | res min | [b] | m vert | [,] | [.] | [j] | {Sh} | | | | |
+ | | {Fn} | {Ctrl} | {Sup} | {Alt} | t | floa- | ting | {Alt} | {Druck} | {Ctrl} | [PgUp] | [Up] | [PgDn] | | | |
+ | | | | | | | | | | | | view p/n | [Dn] | t | | | |
+
+**** Super+Shift+Key
+ : Operations on client level
+ | ESC | | | | | | | | | | | | | | | | |
+ | | | move | c | to | tag | #i | " | " | " | " | [0] | | | {BCK} | | |
+ | | {TAB} | [x] | [v] | l | close c | | | | spread c | compact c | | | | {M3} | | |
+ | | {M3} | t on top | t sticky | | | | | in-/dec | swap w | n/p c | no master c | | | | | |
+ | | {Sh} | | | | | | | m hor | | | | {Sh} | | | | |
+ | | {Fn} | {Ctrl} | {Sup} | {Alt} | select | prev | " | {Alt} | {Druck} | {Ctrl} | | | | | | |
+ | | | | | | | | | | | | move c to | | p/n t | | | |
+**** Super+Ctrl+Shift+Key
+ | ESC | | | | | | | | | | | | | | | | |
+ | | | toggle | c | on | tag | #i | " | " | " | " | [0] | | | {BCK} | | |
+ | | {TAB} | {dbg} | {dbg} | {dbg} | fix no tiling c | | | | | | quit aws | | | {M3} | | |
+ | | {M3} | {dbg} | {dbg} | {dbg} | | | | main menu | reload aws | | | | | | | |
+ | | {Sh} | {dbg} | {dbg} | {dbg} | | | | menu bar | | | | {Sh} | | | | |
+ | | {Fn} | {Ctrl} | {Sup} | {Alt} | Spc | Spc | Spc | {Alt} | {Druck} | {Ctrl} | | | | | | |
+ | | | | | | | | | | | | | | | | | |
+*** Empty dummy
+ | ESC | | | | | | | | | | | | | | | | |
+ | | | | | | | | | | | | | | | {BCK} | | |
+ | | {TAB} | | | | | | | | | | | | | {M3} | | |
+ | | {M3} | | | | | | | | | | | | | | | |
+ | | {Sh} | | | | | | | | | | | {Sh} | | | | |
+ | | {Fn} | {Ctrl} | {Sup} | {Alt} | Spc | Spc | Spc | {Alt} | {Druck} | {Ctrl} | | | | | | |
+ | | | | | | | | | | | | | | | | | |
+** TODO [#A] Key to create floating emacsclient
+ \to use =emacsclient -t= ?
+for proper client.name:
+
+(make-frame
+ '((name . "FRAMEY")))
+
+** [#D] "empty client" which acts like a normal client but doesn't actually contain anything
+ (best see-trough, click-trough), to help limit screen space when wanted
+** move all clients on current tag to a selected (empty?) tag
+** swap the current tag with another selected tag
+** DONE Key/Script to toggle wibar display
+- State "DONE" from [2019-07-21 Sun 16:54]
+* make more use of rofi
+ - +select any window and move it to current tag using rofi window manager+
+ -window-command "..."
+ - select any tag and move all their clients to active tag → combi mode: windows+tags
+ - +use rofi to select tag?+
+ - show all available layouts and change to any. Images in rofi? or better
+ way to make spread view of layouts
+** 2nd monitor setup
+ - commands to move all clients of current tag to current tag on other screen,
+ toggle all clients of current tag on current tag of other screen (mirror
+ mode), if already mirrored only place them on screen 1
+ - tags and clients can't be displayed on two screens at once
+ - update screenmenu keyboard shortcut when connected screens change
+** calender popup
+** nm-applet icons
+** DONE way to select all 25 tags individually instead of only 1-9
+ - can't remember all tag numbers → possible to use keys of neo layout αβγ…?
+** DONE on screen disconnect mark all tags of destroyed screen as volatile
+ they will be moved to another screen but destroyed as soon as all of their
+ clients have been moved to another tag+
+
+* Config
+ :PROPERTIES:
+ :header-args:lua: :tangle tangle/rc.lua
+ :END:
+** Libraries
+
+ Debug_flag enables some debug functions, e.g. Super-Shift-s
+ #+BEGIN_SRC lua
+ debug_flag = true
+ #+END_SRC
+ General libraries:
+ #+BEGIN_SRC lua
+ -- Standard awesome library
+ local gears = require("gears")
+ local awful = require("awful")
+ require("awful.autofocus")
+ -- Widget and layout library
+ local wibox = require("wibox")
+ -- Theme handling library
+ local beautiful = require("beautiful")
+ -- Notification library
+ local naughty = require("naughty")
+ local menubar = require("menubar")
+ local hotkeys_popup = require("awful.hotkeys_popup").widget
+ #+END_SRC
+ Some custom ones I use:
+ #+BEGIN_SRC lua
+ local lain = require("lain")
+ local eminent = require("eminent")
+ --local shifty = require("shifty") -- don't use shifty, use tyrannical
+ --local tyrannical = require("tyrannical")
+ --tyrannical.settings.default_layout = awful.layout.suit.tile
+ -- Enable VIM help for hotkeys widget when client with matching name is opened:
+ require("awful.hotkeys_popup.keys.vim")
+ #+END_SRC
+** Basic Error handling
+ #+BEGIN_SRC lua
+ -- {{{ Error handling
+ -- Check if awesome encountered an error during startup and fell back to
+ -- another config (This code will only ever execute for the fallback config)
+ if awesome.startup_errors then
+ naughty.notify({ preset = naughty.config.presets.critical,
+ title = "Oops, there were errors during startup!",
+ text = awesome.startup_errors })
+ end
+
+ -- Handle runtime errors after startup
+ do
+ local in_error = false
+ awesome.connect_signal("debug::error", function (err)
+ -- Make sure we don't go into an endless error loop
+ if in_error then return end
+ in_error = true
+
+ naughty.notify({ preset = naughty.config.presets.critical,
+ title = "Oops, an error happened!",
+ text = tostring(err) })
+ in_error = false
+ end)
+ end
+ -- }}}
+ #+END_SRC
+** Custom scripts
+ These are executed upon startup and function independent of
+ awesome.
+ #+BEGIN_SRC lua
+ -- {{{ Autorun && screen lock
+ awful.util.spawn_with_shell("~/.config/awesome/autorun.sh")
+ awful.util.spawn_with_shell('~/.config/awesome/locker')
+ -- }}}
+ #+END_SRC
+** Tyrannical Tag setup
+ This is no longer tangled, as Tyrannical settings seemed to provide
+ no benefit with the way I use tags and it did not work nicely with
+ screenful and creating and moving when adding/removing screens.
+ #+BEGIN_SRC lua :tangle no
+ --[[tyrannical.tags = {
+ {
+ name = "α", -- Call the tag "α"
+ init = true, -- Load the tag on startup
+ exclusive = false, -- Refuse any other type of clients (by classes)
+ screen = {1,2}, -- Create this tag on screen 1 and screen 2
+ layout = awful.layout.suit.tile, -- Use the tile layout
+ selected = true,
+ -- class = { --Accept the following classes, refuse everything else (because of "exclusive=true")
+ -- "xterm" , "urxvt" , "aterm","URxvt","XTerm","konsole","terminator","gnome-terminal"
+ -- }
+ --screen = screen.count()>1 and 2 or 1,-- Setup on screen 2 if there is more than 1 screen, else on screen 1
+ --exec_once = {"dolphin"}, --When the tag is accessed for the first time, execute this command
+ } ,
+ {
+ name = "β",
+ init = true, screen = {1,2}},
+ { name = "γ",
+ init = true, screen = {1,2}},
+ { name = "δ",
+ init = true, screen = {1,2}},
+ { name = "ε" ,
+ init = true, screen = {1,2}},
+ { name = "♫",
+ init = true, screen = {1,2},
+ class = { "spotify" }
+ },
+ { name = "ζ",
+ init = true, screen = {1,2}},
+ { name = "η",
+ init = true, screen = {1,2}},
+ { name = "θ",
+ init = true, screen = {1,2},
+ fallback = true},
+ { name = "ι",
+ init = true, screen = {1,2}},
+ { name = "κ",
+ init = true, screen = {1,2}},
+ { name = "λ",
+ init = true, screen = {1,2}},
+ { name = "μ",
+ init = true, screen = {1,2}},
+ { name = "ν",
+ init = true, screen = {1,2}},
+ { name = "ξ",
+ init = true, screen = {1,2}},
+ { name = "ο",
+ init = true, screen = {1,2}},
+ { name = "π",
+ init = true, screen = {1,2}},
+ { name = "ρ",
+ init = true, screen = {1,2}},
+ { name = "σ",
+ init = true, screen = {1,2}},
+ { name = "τ",
+ init = true, screen = {1,2}},
+ { name = "υ",
+ init = true, screen = {1,2}},
+ { name = "φ",
+ init = true, screen = {1,2}},
+ { name = "χ",
+ init = true, screen = {1,2}},
+ { name = "ψ",
+ init = true, screen = {1,2}},
+ { name = "Ω",
+ init = true, screen = {1,2}}
+ }
+ --]]
+ #+END_SRC
+** Some Variables
+ Set the theme, terminal, modkey and layouts to use.
+ #+BEGIN_SRC lua
+ -- {{{ Variable definitions
+ local theme = "~/.config/awesome/themes/mine/"
+ beautiful.init(theme.."theme.lua")
+
+ -- This is used later as the default terminal and editor to run.
+ terminal = "tilix"
+ editor = os.getenv("EDITOR") or "nano"
+ editor_cmd = terminal .. " -e " .. editor
+ #+END_SRC
+ From the default rc.lua:
+ #+BEGIN_QUOTE
+ Default modkey.\\
+ Usually, Mod4 is the key with a logo between Control and Alt. If
+ you do not like this or do not have such a key, I suggest you to
+ remap Mod4 to another key using xmodmap or other tools. However,
+ you can use another modifier like Mod1, but it may interact with
+ others.
+ #+END_QUOTE
+ #+BEGIN_SRC lua
+ modkey = "Mod4"
+ #+END_SRC
+ Table of layouts to cover with awful.layout.inc, order matters.
+ #+BEGIN_SRC lua
+ awful.layout.layouts = {
+ awful.layout.suit.tile,
+ awful.layout.suit.tile.left,
+ awful.layout.suit.tile.bottom,
+ --awful.layout.suit.tile.top,
+ awful.layout.suit.fair,
+ awful.layout.suit.fair.horizontal,
+ awful.layout.suit.spiral,
+ --awful.layout.suit.spiral.dwindle,
+ --awful.layout.suit.max,
+ awful.layout.suit.max.fullscreen,
+ awful.layout.suit.magnifier,
+ awful.layout.suit.corner.nw,
+ -- awful.layout.suit.corner.ne,
+ -- awful.layout.suit.corner.sw,
+ -- awful.layout.suit.corner.se,
+ lain.layout.termfair,
+ lain.layout.centerwork.horizontal,
+ lain.layout.centerwork,
+
+ awful.layout.suit.floating,
+ }
+ -- }}}
+ #+END_SRC
+** Helper Functions
+ #+BEGIN_SRC lua
+ -- {{{ Helper functions
+ local function client_menu_toggle_fn()
+ local instance = nil
+
+ return function ()
+ if instance and instance.wibox.visible then
+ instance:hide()
+ instance = nil
+ else
+ instance = awful.menu.clients({ theme = { width = 250 } })
+ end
+ end
+ end
+ -- }}}
+ #+END_SRC
+** Menu
+ #+BEGIN_SRC lua
+ -- {{{ Menu
+ -- Create a launcher widget and a main menu
+ myawesomemenu = {
+ { "hotkeys", function() return false, hotkeys_popup.show_help end},
+ { "manual", terminal .. " -e man awesome" },
+ { "edit config", editor_cmd .. " " .. awesome.conffile },
+ { "restart", awesome.restart },
+ { "quit", function() awesome.quit() end}
+ }
+
+ mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
+ { "open terminal", terminal }
+ }
+ })
+
+ mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
+ menu = mymainmenu })
+
+ -- Menubar configuration
+ menubar.utils.terminal = terminal -- Set the terminal for applications that require it
+ -- }}}
+ #+END_SRC
+** TODO Wibar & boxes
+*** Widgets
+#+BEGIN_SRC lua
+ -- Keyboard map indicator and switcher
+ mykeyboardlayout = awful.widget.keyboardlayout()
+
+ -- {{{ Wibar
+ -- Create a textclock widget
+ mytextclock = wibox.widget.textclock()
+
+ -- load battery widget
+ local battery_widget = require("battery-widget")
+ -- define
+ --local baticon = wibox.widget.imagebox("/home/fpi/.config/awesome/themes/mine/ac.png")
+ battery = battery_widget({adapter="BAT0"})
+ -- network widget
+ local net_widgets = require("net_widgets")
+ net_wireless = net_widgets.wireless({interface = "wlp4s0",
+ timeout = 5
+ })
+ -- lain widgets
+ local separators = lain.util.separators
+ local cpuicon = wibox.widget.imagebox("/home/fpi/.config/awesome/themes/mine/cpu.png")
+ --local cpu = lain.widget.cpu {
+ -- settings = function()
+ -- widget:set_markup(cpu_now.usage)
+ -- end
+ --}
+ local myredshift = wibox.widget{
+ checked = false,
+ check_color = "#EB8F8F",
+ border_color = "#EB8F8F",
+ border_width = 1.2,
+ shape = function(cr, width, height)
+ gears.shape.rounded_bar(cr, width, 0.4*height)
+ end,
+ widget = wibox.widget.checkbox
+ }
+ lain.widget.contrib.redshift:attach(
+ myredshift,
+ function (active)
+ myredshift.checked = active
+ end
+ )
+ --local cpu = awful.widget.watch('bash -c \"uptime|cut -d\\" \\" -f12,13,14\"', 3)
+ local cpu = awful.widget.watch('bash -c \"cat /proc/loadavg|cut -d\\" \\" -f1-3\"', 3)
+
+ local volume = lain.widget.alsabar {
+ }
+
+ require("awesome-wm-widgets.email-widget.email")
+
+ require("awesome-wm-widgets.spotify-widget.spotify")
+#+END_SRC
+Quake
+#+BEGIN_SRC lua
+-- local quakeemacs = lain.util.quake({app="emacsclient -c -e '(progn (display-buffer (get-buffer-create \"Quake\")) (delete-window))';#", argname = "", name = "QuakeEmacs", secondcmd = "xprop -name 'Quake' -f WM_CLASS 8s -set WM_CLASS \"QuakeEmacs\"", followtag = true, loosepos = true})
+-- Command to create emacsclient with Quake buffer and set wm_class to QuakeDD
+-- emacsclient -c -e '(progn (display-buffer (get-buffer-create "Quake")) (delete-window))'&;sleep 1;xprop -name "Quake" -f WM_CLASS 8s -set WM_CLASS "QuakeDD"
+local quake = lain.util.quake({app="tilix", argname = "--new-process --name %s", followtag = true})
+local quake_emacs = lain.util.quake({app="emacsclient", name="_Quake_Emacs_", argname = "-e \"(fpi/make-floating-frame nil nil t \\\"*Quake Emacs*\\\")\"", followtag = true, height = 400})
+#+END_SRC
+*** Wibox
+ #+BEGIN_SRC lua
+ -- Create a wibox for each screen and add it
+ local taglist_buttons = gears.table.join(
+ awful.button({ }, 1, function(t) t:view_only() end),
+ awful.button({ modkey }, 1, function(t)
+ if client.focus then
+ client.focus:move_to_tag(t)
+ end
+ end),
+ awful.button({ }, 3, awful.tag.viewtoggle),
+ awful.button({ modkey }, 3, function(t)
+ if client.focus then
+ client.focus:toggle_tag(t)
+ end
+ end),
+ awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end),
+ awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end)
+ )
+ #+END_SRC
+ #+BEGIN_SRC lua
+ local tasklist_buttons = gears.table.join(
+ awful.button({ }, 1, function (c)
+ if c == client.focus then
+ c.minimized = true
+ else
+ -- Without this, the following
+ -- :isvisible() makes no sense
+ c.minimized = false
+ if not c:isvisible() and c.first_tag then
+ c.first_tag:view_only()
+ end
+ -- This will also un-minimize
+ -- the client, if needed
+ client.focus = c
+ c:raise()
+ end
+ end),
+ awful.button({ }, 3, client_menu_toggle_fn()),
+ awful.button({ }, 4, function ()
+ awful.client.focus.byidx(1)
+ end),
+ awful.button({ }, 5, function ()
+ awful.client.focus.byidx(-1)
+ end))
+ #+END_SRC
+ #+BEGIN_SRC lua
+ local function set_wallpaper(s)
+ -- Wallpaper
+ if beautiful.wallpaper then
+ local wallpaper = beautiful.wallpaper
+ -- If wallpaper is a function, call it with the screen
+ if type(wallpaper) == "function" then
+ wallpaper = wallpaper(s)
+ end
+ gears.wallpaper.maximized(wallpaper, s, true)
+ end
+ end
+ #+END_SRC
+ #+BEGIN_SRC lua
+ -- Re-set wallpaper when a screen's geometry changes (e.g. different resolution)
+ screen.connect_signal("property::geometry", set_wallpaper)
+ #+END_SRC
+
+ #+BEGIN_SRC lua
+ awful.screen.connect_for_each_screen(function(s)
+
+ -- Wallpaper
+ set_wallpaper(s)
+ -- Each screen has its own tag table.
+ awful.tag({"α", "β", "γ", "δ", "ε","♫","ζ","η","θ","ι","κ","λ","μ","ν","ξ","ο","π","ρ","σ","τ",
+ "υ","φ","χ","ψ","Ω"}, s, awful.layout.layouts[1])
+
+ -- Create a promptbox for each screen
+ s.mypromptbox = awful.widget.prompt()
+ -- Create an imagebox widget which will contains an icon indicating which layout we're using.
+ -- We need one layoutbox per screen.
+ s.mylayoutbox = awful.widget.layoutbox(s)
+ s.mylayoutbox:buttons(gears.table.join(
+ awful.button({ }, 1, function () awful.layout.inc( 1) end),
+ awful.button({ }, 3, function () awful.layout.inc(-1) end),
+ awful.button({ }, 4, function () awful.layout.inc( 1) end),
+ awful.button({ }, 5, function () awful.layout.inc(-1) end)))
+ -- Create a taglist widget
+ s.mytaglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, taglist_buttons)
+
+ -- Create a tasklist widget
+ s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, tasklist_buttons)
+
+ -- Create a calendar widget
+ local cal_notification
+ mytextclock:connect_signal("button::release",
+ function()
+ if cal_notification == nil then
+ awful.spawn.easy_async([[bash -c "ncal -3MC | sed 's/_.\(.\)/+\1-/g'"]],
+ function(stdout, stderr, reason, exit_code)
+ cal_notification = naughty.notify{
+ text = string.gsub(string.gsub(stdout,
+ "+", "<span foreground='red'>"),
+ "-", "</span>"),
+ font = "Ubuntu Mono 9",
+ timeout = 0,
+ width = auto,
+ destroy = function() cal_notification = nil end
+ }
+ end
+ )
+ else
+ naughty.destroy(cal_notification)
+ end
+ end)
+ #+END_SRC
+ Actual wibox setup for top bar:
+ #+BEGIN_SRC lua
+ -- Create the wibox
+ s.mywibox = awful.wibar({ position = "top", screen = s, visible = false })
+ -- Colors for right wibox widgets
+ local fg_col = "#303f30"
+ local bg_col = "#395039"
+
+ -- Add widgets to the wibox
+ s.mywibox:setup {
+ layout = wibox.layout.align.horizontal,
+ { -- Left widgets
+ layout = wibox.layout.fixed.horizontal,
+ -- mylauncher,
+ s.mytaglist,
+ s.mypromptbox,
+ },
+ s.mytasklist, -- Middle widget
+ { -- Right widgets
+ layout = wibox.layout.fixed.horizontal,
+ separators.arrow_left(fg_col,bg_col),
+ wibox.container.background(wibox.container.margin(wibox.widget {cpuicon, cpu, layout = wibox.layout.align.horizontal},1,2), bg_col),
+ separators.arrow_left(bg_col,fg_col),
+ -- volume.widget,
+ wibox.container.background(wibox.widget {battery, layout = wibox.layout.align.horizontal}, fg_col),
+ separators.arrow_left(fg_col,bg_col),
+ wibox.container.background(wibox.widget {email_widget, layout = wibox.layout.align.horizontal}, bg_col),
+ separators.arrow_left(bg_col,fg_col),
+ wibox.container.background(wibox.widget {mykeyboardlayout, layout = wibox.layout.align.horizontal}, fg_col),
+ -- wibox.container.background(wibox.widget {myredshift, layout = wibox.layout.align.vertical([]myredshift)}, fg_col),
+ separators.arrow_left(fg_col,bg_col),
+ wibox.container.background(wibox.widget {spotify_widget, layout = wibox.layout.fixed.horizontal}, bg_col),
+ separators.arrow_left(bg_col,fg_col),
+ {
+ wibox.container.place(myredshift),
+ layout = wibox.layout.stack
+ },
+ separators.arrow_left(fg_col,bg_col),
+ wibox.container.background(wibox.widget {net_wireless, wibox.widget.systray(), layout = wibox.layout.align.horizontal}, bg_col),
+ separators.arrow_left(bg_col,fg_col),
+ wibox.container.background(wibox.widget {mytextclock,s.mylayoutbox, layout = wibox.layout.align.horizontal}, fg_col)
+ },
+ }
+#+end_src
+#+begin_src lua
+end)
+-- }}}
+#+END_SRC
+ Wie redshift einbauen?
+ #+BEGIN_SRC lua
+ -- wibox.container.background(wibox.widget{{widget=dummy}, {widget=myredshift}, {widget=dummy}, layout=wibox.layout.flex.vertical}, fg_col) ,
+ -- {
+ -- wibox.container.place(myredshift),--.content_fill_vertical,
+ -- layout = wibox.layout.fixed.horizontal
+ -- },
+ #+END_SRC
+
+** Bindings
+ Mouse
+ #+BEGIN_SRC lua
+ -- {{{ Mouse bindings
+ root.buttons(gears.table.join(
+ awful.button({ }, 3, function () mymainmenu:toggle() end),
+ awful.button({ }, 4, awful.tag.viewnext),
+ awful.button({ }, 5, awful.tag.viewprev)
+ ))
+ -- }}}
+ #+END_SRC
+ and Keyboard
+ #+BEGIN_SRC lua
+ -- {{{ Key bindings
+ globalkeys = gears.table.join(
+ --awful.key({ modkey }, "z", function() spawn("tilix --quake", "Tilix", nil, "class") end),
+ awful.key({ modkey }, "z", function() quake_emacs:toggle() end),
+ awful.key({ modkey }, "e", function() quake:toggle() end),
+ awful.key({ modkey }, "c", function() awful.placement.centered(client.focus) end),
+ awful.key({ modkey }, "ä", function() awful.spawn("emacsclient -e \"(fpi/make-floating-frame)\"") end),
+ awful.key({ modkey }, "ö", function() awful.spawn("emacsclient -e \"(fpi/make-floating-capture-frame)\"") end),
+ awful.key ({ modkey }, "w", function()
+ awful.screen.focused().mywibox.visible = not awful.screen.focused().mywibox.visible
+ end,
+ {description="toggle top wibar", group="awesome"}),
+ --awful.key({ modkey, }, "z", function () awful.screen.focused().quake:toggle() end),
+ awful.key({ modkey, }, "s", hotkeys_popup.show_help,
+ {description="show help", group="awesome"}),
+ awful.key({ modkey, "Control" }, "Left", awful.tag.viewprev,
+ {description = "view previous", group = "tag"}),
+ awful.key({ modkey, "Control" }, "Right", awful.tag.viewnext,
+ {description = "view next", group = "tag"}),
+ awful.key({ modkey, }, "Escape", awful.tag.history.restore,
+ {description = "go back", group = "tag"}),
+
+ awful.key({ modkey, }, "j",
+ function ()
+ awful.client.focus.byidx( 1)
+ end,
+ {description = "focus next by index", group = "client"}
+ ),
+ awful.key({ modkey, }, "k",
+ function ()
+ awful.client.focus.byidx(-1)
+ end,
+ {description = "focus previous by index", group = "client"}
+ ),
+ --awful.key({ modkey, }, "w", function () mymainmenu:show() end,
+ -- {description = "show main menu", group = "awesome"}),
+
+ -- Layout manipulation
+ awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end,
+ {description = "swap with next client by index", group = "client"}),
+ awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end,
+ {description = "swap with previous client by index", group = "client"}),
+ awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end,
+ {description = "focus the next screen", group = "screen"}),
+ awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end,
+ {description = "focus the previous screen", group = "screen"}),
+ awful.key({ modkey, }, "u", awful.client.urgent.jumpto,
+ {description = "jump to urgent client", group = "client"}),
+ awful.key({ modkey, }, "Tab",
+ function ()
+ awful.client.focus.history.previous()
+ if client.focus then
+ client.focus:raise()
+ end
+ end,
+ {description = "go back", group = "client"}),
+ awful.key({modkey, "Control"}, "l",
+ function()
+ if client.focus then
+ client.focus.sticky = not client.focus.sticky
+ end
+ end,
+ {description = "Toggle sticky", group = "client"}),
+
+ -- Standard program
+ awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end,
+ {description = "open a terminal", group = "launcher"}),
+ awful.key({ modkey, "Control" }, "r", awesome.restart,
+ {description = "reload awesome", group = "awesome"}),
+ awful.key({ modkey, "Shift" }, "q", awesome.quit,
+ {description = "quit awesome", group = "awesome"}),
+
+ awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end,
+ {description = "increase master width factor", group = "layout"}),
+ awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end,
+ {description = "decrease master width factor", group = "layout"}),
+ awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1, nil, true) end,
+ {description = "increase the number of master clients", group = "layout"}),
+ awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1, nil, true) end,
+ {description = "decrease the number of master clients", group = "layout"}),
+ awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1, nil, true) end,
+ {description = "increase the number of columns", group = "layout"}),
+ awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1, nil, true) end,
+ {description = "decrease the number of columns", group = "layout"}),
+ awful.key({ modkey, }, "space", function () awful.layout.inc( 1) end,
+ {description = "select next", group = "layout"}),
+ awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(-1) end,
+ {description = "select previous", group = "layout"}),
+
+ awful.key({ modkey, "Control" }, "n",
+ function ()
+ local c = awful.client.restore()
+ -- Focus restored client
+ if c then
+ client.focus = c
+ c:raise()
+ end
+ end,
+ {description = "restore minimized", group = "client"}),
+
+ -- Prompt
+ --awful.key({ modkey }, "r", function () awful.screen.focused().mypromptbox:run() end,
+ -- {description = "run prompt", group = "launcher"}),
+ awful.key({ modkey }, "r",
+ function ()
+ awful.prompt.run({ prompt = "Run: ", hooks = {
+ {{ },"Return",function(command)
+ local result = awful.util.spawn(command)
+ awful.screen.focused().mypromptbox.widget:set_text(type(result) == "string" and result or "")
+ return true
+ end},
+ {{"Mod1" },"Return",function(command)
+ local result = awful.util.spawn(command,{intrusive=true})
+ awful.screen.focused().mypromptbox.widget:set_text(type(result) == "string" and result or "")
+ return true
+ end},
+ {{"Shift" },"Return",function(command)
+ local result = awful.util.spawn(command,{intrusive=true,ontop=true,floating=true})
+ awful.screen.focused().mypromptbox.widget:set_text(type(result) == "string" and result or "")
+ return true
+ end}
+ }},
+ awful.screen.focused().mypromptbox.widget,nil,
+ awful.completion.shell,
+ awful.util.getdir("cache") .. "/history")
+ end),
+ awful.key({ modkey }, "x",
+ function ()
+ awful.prompt.run {
+ prompt = "Run Lua code: ",
+ textbox = awful.screen.focused().mypromptbox.widget,
+ exe_callback = awful.util.eval,
+ history_path = awful.util.get_cache_dir() .. "/history_eval"
+ }
+ end,
+ {description = "lua execute prompt", group = "awesome"}),
+
+ -- Menubar
+ awful.key({ modkey, "Control" }, "p", function() menubar.show() end,
+ {description = "show the menubar", group = "launcher"})
+ )
+ #+END_SRC
+ Launcher Binding using rofi. Before rofi version 1.4
+ #+BEGIN_SRC shell :tangle no :exports code :eval never
+ "rofi -show run -bw 0 -fullscreen -padding 420 -hide-scrollbar -terminal "..terminal.." -location 0 -width 30 -color-normal \"#00303f30,#ff778877,#00303f30,#00303f30,#ffffffff\" -color-active \"#00303f30,#ff778877,#00303f30,#00303f30,#ffffffff\"-color-window \"#df303f30,#000000,#00303f30\" "
+ #+END_SRC
+
+ #+BEGIN_SRC lua
+ globalkeys = gears.table.join(globalkeys,
+ awful.key({ modkey }, "p", function() awful.spawn.with_shell("PATH=~/.local/bin:$PATH rofi -show run -theme "..theme.."rofi_theme.rasi") end,
+ {description = "run rofi", group = "launcher"})
+ )
+ #+END_SRC
+ #+BEGIN_SRC lua
+ clientkeys = gears.table.join(
+ awful.key({ modkey, }, "f",
+ function (c)
+ c.fullscreen = not c.fullscreen
+ c:raise()
+ end,
+ {description = "toggle fullscreen", group = "client"}),
+ awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end,
+ {description = "close", group = "client"}),
+ awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ,
+ {description = "toggle floating", group = "client"}),
+ awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end,
+ {description = "move to master", group = "client"}),
+ awful.key({ modkey, }, "o", function (c) c:move_to_screen() end,
+ {description = "move to screen", group = "client"}),
+ awful.key({ modkey, "Shift" }, "u", function (c) c.ontop = not c.ontop end,
+ {description = "toggle keep on top", group = "client"}),
+ awful.key({ modkey, }, "n",
+ function (c)
+ -- The client currently has the input focus, so it cannot be
+ -- minimized, since minimized clients can't have the focus.
+ c.minimized = true
+ end ,
+ {description = "minimize", group = "client"}),
+ awful.key({ modkey, }, "m",
+ function (c)
+ c.maximized = not c.maximized
+ c:raise()
+ end ,
+ {description = "(un)maximize", group = "client"}),
+ awful.key({ modkey, "Control" }, "m",
+ function (c)
+ c.maximized_vertical = not c.maximized_vertical
+ c:raise()
+ end ,
+ {description = "(un)maximize vertically", group = "client"}),
+ awful.key({ modkey, "Shift" }, "m",
+ function (c)
+ c.maximized_horizontal = not c.maximized_horizontal
+ c:raise()
+ end ,
+ {description = "(un)maximize horizontally", group = "client"})
+ )
+ #+END_SRC
+ #+BEGIN_SRC lua
+ -- Bind all key numbers to tags.
+ -- Be careful: we use keycodes to make it work on any keyboard layout.
+ -- This should map on the top row of your keyboard, usually 1 to 9.
+ for i = 1, 9 do
+ globalkeys = gears.table.join(globalkeys,
+ -- View tag only.
+ awful.key({ modkey }, "#" .. i + 9,
+ function ()
+ local screen = awful.screen.focused()
+ local tag = screen.tags[i]
+ if tag then
+ tag:view_only()
+ end
+ end),
+ -- Toggle tag display.
+ awful.key({ modkey, "Control" }, "#" .. i + 9,
+ function ()
+ local screen = awful.screen.focused()
+ local tag = screen.tags[i]
+ if tag then
+ awful.tag.viewtoggle(tag)
+ end
+ end),
+ -- Move client to tag.
+ awful.key({ modkey, "Shift" }, "#" .. i + 9,
+ function ()
+ if client.focus then
+ local tag = client.focus.screen.tags[i] --awful.screen.focused().tags[i]
+ if tag then
+ client.focus:move_to_tag(tag)
+ end
+ end
+ end),
+ -- Toggle tag on focused client.
+ awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
+ function ()
+ if client.focus then
+ local tag = client.focus.screen.tags[i]
+ if tag then
+ client.focus:toggle_tag(tag)
+ end
+ end
+ end)
+ )
+ end
+ #+END_SRC
+ #+BEGIN_SRC lua
+ function tablelength(T)
+ local count = 0
+ for _ in pairs(T) do count = count +1 end
+ return count
+ end
+ #+END_SRC
+ #+BEGIN_SRC lua
+ globalkeys = gears.table.join(globalkeys,
+ -- Move client to tag to the right/left
+ -- Because of tag:view_only() does not preserve the current viewed tags!
+ -- ##TODO Make tags.length global?
+ awful.key({ modkey, "Shift" }, "Right",
+ function ()
+ if client.focus then
+ local tag = client.focus and client.focus.first_tag or nil --.screen.tags[i]
+ local next_tag_index = tag.index + 1
+ if next_tag_index == tablelength(client.focus.screen.tags)+1 then
+ next_tag_index = 1
+ end
+ local next_tag = client.focus.screen.tags[next_tag_index]
+ if tag then
+ client.focus:move_to_tag(next_tag)
+ next_tag:view_only()
+ end
+ end
+ end,
+ {description = "move focused client one tag to the right", group = "tag"}),
+ awful.key({ modkey, "Shift" }, "Left",
+ function ()
+ if client.focus then
+ local tag = client.focus and client.focus.first_tag or nil --.screen.tags[i]
+ local next_tag_index = tag.index - 1
+ if next_tag_index == 0 then
+ next_tag_index = tablelength(client.focus.screen.tags)
+ end
+ local next_tag = client.focus.screen.tags[next_tag_index]
+ if tag then
+ client.focus:move_to_tag(next_tag)
+ next_tag:view_only()
+ end
+ end
+ end,
+ {description = "move focused client one tag to the left", group = "tag"}),
+ awful.key({ modkey }, "Right",
+ function ()
+ local screen = awful.screen.focused()
+ local start_tag = screen.selected_tag
+ local next_tag_index = start_tag.index + 1
+ if next_tag_index == tablelength(screen.tags)+1 then
+ next_tag_index = 1
+ end
+ local next_tag=screen.tags[next_tag_index]
+ while next(next_tag:clients()) == nil do
+ next_tag_index = next_tag.index + 1
+ if next_tag_index == tablelength(screen.tags)+1 then
+ next_tag_index = 1
+ end
+ next_tag=screen.tags[next_tag_index]
+ if next_tag_index == start_tag.index then
+ break
+ end
+ end
+ if next_tag then
+ next_tag:view_only()
+ end
+ end,
+ {description = "view next non-empty tag on the right", group = "tag"}),
+ awful.key({ modkey }, "Left",
+ function ()
+ local screen = awful.screen.focused()
+ local start_tag = screen.selected_tag
+ local next_tag_index = start_tag.index - 1
+ if next_tag_index == 0 then
+ next_tag_index = tablelength(screen.tags)
+ end
+ local next_tag=screen.tags[next_tag_index]
+ while next(next_tag:clients()) == nil do
+ next_tag_index = next_tag.index - 1
+ if next_tag_index == 0 then
+ next_tag_index = tablelength(screen.tags)
+ end
+ next_tag=screen.tags[next_tag_index]
+ if next_tag_index == start_tag.index then
+ break
+ end
+ end
+ if next_tag then
+ next_tag:view_only()
+ end
+ end,
+ {description = "view next non-empty tag on the left", group = "tag"}),
+ awful.key({ }, "Print", function () awful.util.spawn("scrot -e 'mv $f ~/screenshots/ 2>/dev/null'", false) end)
+ )
+ #+END_SRC
+ #+BEGIN_SRC lua
+ clientbuttons = gears.table.join(
+ awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
+ awful.button({ modkey }, 1, awful.mouse.client.move),
+ awful.button({ modkey }, 3, awful.mouse.client.resize))
+ #+END_SRC
+** Tag Movement
+*** Move Tag to other screen
+#+BEGIN_SRC lua :tangle no
+ local function move_tag(args)
+ screen = args.screen or awful.screen.focused()
+ local oldscreen = args.tag.screen
+ if oldscreen ~= screen then
+ local oldsel = oldscreen.selected_tag
+ args.tag.screen = screen
+
+ if oldsel == args.tag then
+ local newtag = awful.tag.find_fallback(oldscreen)
+ if newtag then
+ newtag:view_only()
+ end
+ end
+ -- Rename Tag
+ --if string.find(tag.name, "'$") == nil then
+ -- tag.name = tag.name .. "'"
+ --end
+
+ -- Insert tag at what position?
+ end
+ end
+
+ local function rename_tag(args)
+ local input = (args.name=='' or args.name == nil) and "NaN" or args.name
+ args.tag.name = input
+ end
+
+ globalkeys = gears.table.join(globalkeys,
+ awful.key({ modkey, "Shift" }, "r",
+ function ()
+ awful.prompt.run {
+ prompt = 'New name: ',
+ text = '',
+ bg_cursor = '#aaaaaa',
+ -- To use the default rc.lua prompt:
+ textbox = mouse.screen.mypromptbox.widget,
+ --textbox = atextbox,
+ exe_callback = function(input)
+ rename_tag({name=input, tag=awful.screen.focused().selected_tag})
+ end
+ }
+ end,
+ {description = "rename current tag", group = "tag"}),
+ awful.key({ modkey, "Shift", "Control" }, "t",
+ function ()
+ local targetscreen = nil
+ --for s in screen do
+ --if s.index == client.focus.screen.index + 1 then
+ --targetscreen = s
+ --break
+ --end
+ --end
+ --move_tag({tag=client.focus.first_tag, screen=s})
+ --move_tag({tag=awful.screen.focused().selected_tag, screen=s})
+ move_tag({tag=client.focus.first_tag, screen=awful.screen.focused()})
+ end,
+ {description = "move tag to other screen", group = "tag"})
+ )
+#+END_SRC
+*** Move all clients of tag to other tag
+#+BEGIN_SRC lua
+ local function move_tag_clients (source,target)
+ naughty.notify({text="Hi"})
+ naughty.notify({text="Moving from "..source})
+ naughty.notify({text=" to "..target})
+ if args.target ~= source then
+ for _,c in pairs(source:clients()) do
+ c:move_to_tag(target)
+ end
+ naughty.notify({text="success"})
+ end
+ end
+
+ globalkeys = gears.table.join(globalkeys,
+ awful.key({ modkey, "Shift", "Control" }, "v",
+ function ()
+ local source = client.focus.first_tag
+ local target = awful.screen.focused().selected_tag
+ if target ~= source then
+ for _,c in pairs(source:clients()) do
+ c:move_to_tag(target)
+ end
+ end
+ end,
+ {description = "move clients of tag to other screen", group = "tag"})
+ )
+#+END_SRC
+
+#+RESULTS:
+** Volume and Brightness
+ #+BEGIN_SRC lua
+ -- {{{ Volume notify & changing
+ volnotify = {}
+ volnotify.id = nil
+ function volnotify:notify (msg)
+ self.id = naughty.notify({ text = msg, timeout = 1, replaces_id = self.id}).id
+ end
+
+ function volume(incdec)
+ awful.util.spawn_with_shell ("vol=$(amixer -D pulse set Master 5%" .. incdec .. "|tail -1|cut -d % -f 1|cut -d '[' -f 2) && echo \"volnotify:notify('Volume $vol%')\"|awesome-client", false)
+ end
+
+ function togglemute()
+ awful.util.spawn_with_shell("vol=$(amixer -D pulse set Master toggle|tail -n 1|cut -d '[' -f 3|cut -d ']' -f 1) && echo \"volnotify:notify('Volume $vol')\"|awesome-client", false)
+ end
+
+ globalkeys = awful.util.table.join(globalkeys,
+ awful.key({ }, "XF86AudioLowerVolume", function () volume("-") end),
+ awful.key({ }, "XF86AudioRaiseVolume", function () volume("+") end),
+ awful.key({ }, "XF86AudioMute", togglemute))
+ -- }}}
+ #+END_SRC
+ #+BEGIN_SRC lua
+ -- {{{ Brightness keys & notify
+ brnotify = {}
+ brnotify.id = nil
+ function brnotify:notify (msg)
+ self.id = naughty.notify({ text = msg, timeout = 1, replaces_id = self.id}).id
+ end
+
+ function brightness(incdec)
+ awful.util.spawn_with_shell ("xbacklight " .. incdec .. "10;br=$(LANG=C printf \"%.0f\" $(xbacklight)) && echo \"brnotify:notify('Brightness $br%')\"|awesome-client", false)
+ end
+
+ globalkeys = awful.util.table.join(globalkeys,
+ awful.key({ }, "XF86MonBrightnessDown", function () brightness("-") end),
+ awful.key({ }, "XF86MonBrightnessUp", function () brightness("+") end))
+ -- }}}
+ #+END_SRC
+** Music keys
+For now just for Spotify & vlc:
+#+BEGIN_SRC lua
+globalkeys = awful.util.table.join(globalkeys,
+ awful.key({ }, "XF86AudioPlay", function ()
+ awful.spawn("sp play")
+ awful.spawn("dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause")
+ end),
+ awful.key({ }, "XF86AudioPause", function ()
+ awful.spawn("sp play")
+ awful.spawn("dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause")
+ end),
+ awful.key({ }, "XF86AudioNext", function ()
+ awful.spawn("sp next")
+ awful.spawn("dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next")
+ end),
+ awful.key({ }, "XF86AudioPrev", function ()
+ awful.spawn("sp prev")
+ awful.spawn("dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous")
+ end),
+ awful.key({ }, "XF86Explorer", function ()
+ awful.spawn("sp next")
+ awful.spawn("dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next")
+ end),
+ awful.key({ }, "XF86LaunchA", function ()
+ awful.spawn("sp prev")
+ awful.spawn("dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous")
+ end)
+)
+#+END_SRC
+Still missing:
+- <XF86AudioForward>
+- <XF86AudioRewind>
+** Launcher shortcuts
+ Open some programs directly instead of calling them over rofi. I
+ use the CAPS Key as it is used as a modifier key in my keyboard
+ layout (Neo2).
+ #+BEGIN_SRC lua
+ -- {{{ Launcher shortcuts
+ globalkeys = awful.util.table.join(globalkeys,
+ awful.key({ modkey, "Mod5" }, "y", function () awful.util.spawn("thunderbird") end,
+ {description = "Start Thunderbird", group = "buttons | Mod5=Caps"}),
+ awful.key({ modkey, "Mod5"}, "k", function () awful.util.spawn("autopass") end,
+ {description = "Start autopass", group = "buttons | Mod5=Caps"})) -- Mod5 == Caps/Ebene 3 (xmodmap hilft)
+ -- }}}
+ #+END_SRC
+** TODO Fix for broken windows
+ Sometimes clients end up wierdly maximized after exiting fullscreen
+ or right after start. This just unsets everything.
+
+ \\Does this still happen as of now?
+ #+BEGIN_SRC lua
+ -- {{{ Repair windows starting in floating, vert and horizontal maximized
+ globalkeys = awful.util.table.join(globalkeys,
+ awful.key({ modkey, "Shift" }, "x", function () client.focus.maximized_horizontal = false
+ client.focus.maximized_vertical = false
+ client.focus.maximized = false end,
+ {description = "repair no tiling windows", group = "client"}))
+ -- }}}
+ #+END_SRC
+** move tags on screen disconnect
+ #+BEGIN_SRC lua
+ -- awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
+
+ -- doesnt work with tyrannical???
+ tag.connect_signal("request::screen", function(t)
+ clients = t:clients()
+ for s in screen do
+ if s ~= t.screen and clients and next(clients) then
+ t.selected = false
+ t.volatile = true
+ t.screen = s
+ t.name = t.name .. "'"
+ --awful.tag.setvolatile(true, t)
+ return
+ end
+ end
+ end);
+ #+END_SRC
+** Some more libraries
+ Screenful and screenmenu manage adding and removal of screens
+ during runtime. Tagmanip/Clientmanip provide more functionality to
+ manipulate Clients and tags.
+
+ #+BEGIN_SRC lua
+ require("awful.remote")
+ require("screenful")
+ require("tagmanip")
+ require("clientmanip")
+ local screenmenu = require("screenmenu")
+
+ globalkeys = gears.table.join(globalkeys,
+ awful.key({ modkey, "Shift" }, "p", function() screenManager() end,
+ {description = "run screen manager", group = "screen"}),
+ awful.key({ modkey }, "b", function() moveWindowToCurrentTag() end,
+ {description = "select window and move to tag", group = "tag"}))
+ #+END_SRC
+** Set Keys
+ #+BEGIN_SRC lua
+ -- Set keys
+ root.keys(globalkeys)
+ -- }}}
+ #+END_SRC
+** Rules
+ #+BEGIN_SRC lua
+ -- {{{ Rules
+ -- Rules to apply to new clients (through the "manage" signal).
+ awful.rules.rules = {
+ -- All clients will match this rule.
+ { rule = { },
+ properties = { border_width = beautiful.border_width * 2,
+ border_color = beautiful.border_normal,
+ focus = awful.client.focus.filter,
+ raise = true,
+ keys = clientkeys,
+ buttons = clientbuttons,
+ screen = awful.screen.preferred,
+ placement = awful.placement.no_overlap+awful.placement.no_offscreen
+ }
+ },
+
+ -- Floating clients.
+ { rule_any = {
+ instance = {
+ "DTA", -- Firefox addon DownThemAll.
+ "copyq", -- Includes session name in class.
+ "guake",
+ },
+ class = {
+ "Arandr",
+ "Gpick",
+ "Kruler",
+ "MessageWin", -- kalarm.
+ "Sxiv",
+ "Wpa_gui",
+ "pinentry",
+ "veromix",
+ "xtightvncviewer"},
+
+ name = {
+ "Ediff",
+ "^**Floating Emacs**$", -- floating emacs client on exact match
+ "^**Capture**$",
+ "Event Tester", -- xev.
+ "Volume Control" -- pavuaudio (pulseaudio controller)
+ },
+ role = {
+ "AlarmWindow", -- Thunderbird's calendar.
+ "pop-up", -- e.g. Google Chrome's (detached) Developer Tools.
+ }
+ }, properties = { floating = true, placement = awful.placement.centered }},
+
+ -- Add titlebars to normal clients and dialogs
+ { rule_any = {type = { "normal", "dialog" }
+ }, properties = { titlebars_enabled = false }
+ },
+
+ -- Set Firefox to always map on the tag named "2" on screen 1.
+ -- { rule = { class = "Firefox" },
+ -- properties = { screen = 1, tag = "2" } },
+ }
+ -- }}}
+ #+END_SRC
+** Signals
+ #+BEGIN_SRC lua
+ -- {{{ Signals
+ -- Signal function to execute when a new client appears.
+ client.connect_signal("manage", function (c)
+ -- Set the windows at the slave,
+ -- i.e. put it at the end of others instead of setting it master.
+ -- if not awesome.startup then awful.client.setslave(c) end
+
+ if awesome.startup and
+ not c.size_hints.user_position
+ and not c.size_hints.program_position then
+ -- Prevent clients from being unreachable after screen count changes.
+ awful.placement.no_offscreen(c)
+ end
+ end)
+
+ -- Add a titlebar if titlebars_enabled is set to true in the rules.
+ client.connect_signal("request::titlebars", function(c)
+ -- buttons for the titlebar
+ local buttons = gears.table.join(
+ awful.button({ }, 1, function()
+ client.focus = c
+ c:raise()
+ awful.mouse.client.move(c)
+ end),
+ awful.button({ }, 3, function()
+ client.focus = c
+ c:raise()
+ awful.mouse.client.resize(c)
+ end)
+ )
+
+ awful.titlebar(c) : setup {
+ { -- Left
+ awful.titlebar.widget.iconwidget(c),
+ buttons = buttons,
+ layout = wibox.layout.fixed.horizontal
+ },
+ { -- Middle
+ { -- Title
+ align = "center",
+ widget = awful.titlebar.widget.titlewidget(c)
+ },
+ buttons = buttons,
+ layout = wibox.layout.flex.horizontal
+ },
+ { -- Right
+ awful.titlebar.widget.floatingbutton (c),
+ awful.titlebar.widget.maximizedbutton(c),
+ awful.titlebar.widget.stickybutton (c),
+ awful.titlebar.widget.ontopbutton (c),
+ awful.titlebar.widget.closebutton (c),
+ layout = wibox.layout.fixed.horizontal()
+ },
+ layout = wibox.layout.align.horizontal
+ }
+ end)
+
+ -- Enable sloppy focus, so that focus follows mouse.
+ client.connect_signal("mouse::enter", function(c)
+ if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
+ and awful.client.focus.filter(c) then
+ client.focus = c
+ end
+ end)
+
+ client.connect_signal("focus", function(c)
+ c.border_color = beautiful.border_focus
+ c.opacity = 1
+ end)
+ client.connect_signal("unfocus", function(c)
+ c.border_color = beautiful.border_normal
+ if c.sticky then
+ c.opacity = 1
+ else
+ c.opacity = 0.8
+ end
+ end)
+
+
+ -- }}}
+ #+END_SRC
diff --git a/redshift.org b/redshift.org
new file mode 100644
index 0000000..dc2ed38
--- /dev/null
+++ b/redshift.org
@@ -0,0 +1,66 @@
+Website: http://jonls.dk/redshift/
+#+PROPERTY: header-args:conf :tangle tangle/redshift.conf :tangle-mode (identity #o444)
+** Config
+#+BEGIN_SRC conf
+[redshift]
+; Set the day and night screen temperatures
+temp-day=5700
+temp-night=3500
+
+; Enable/Disable a smooth transition between day and night
+; 0 will cause a direct change from day to night screen temperature.
+; 1 will gradually increase or decrease the screen temperature.
+transition=1
+
+; Set the screen brightness. Default is 1.0.
+;brightness=0.9
+; It is also possible to use different settings for day and night
+; since version 1.8.
+;brightness-day=0.7
+;brightness-night=0.4
+; Set the screen gamma (for all colors, or each color channel
+; individually)
+gamma=0.8
+;gamma=0.8:0.7:0.8
+; This can also be set individually for day and night since
+; version 1.10.
+;gamma-day=0.8:0.7:0.8
+;gamma-night=0.6
+
+; Set the location-provider: 'geoclue', 'geoclue2', 'manual'
+; type 'redshift -l list' to see possible values.
+; The location provider settings are in a different section.
+location-provider=manual
+
+; Set the adjustment-method: 'randr', 'vidmode'
+; type 'redshift -m list' to see all possible values.
+; 'randr' is the preferred method, 'vidmode' is an older API.
+; but works in some cases when 'randr' does not.
+; The adjustment method settings are in a different section.
+adjustment-method=randr
+
+; Configuration of the location-provider:
+; type 'redshift -l PROVIDER:help' to see the settings.
+; ex: 'redshift -l manual:help'
+; Keep in mind that longitudes west of Greenwich (e.g. the Americas)
+; are negative numbers.
+[manual]
+lat=52.375892
+lon=9.732010
+
+; Configuration of the adjustment-method
+; type 'redshift -m METHOD:help' to see the settings.
+; ex: 'redshift -m randr:help'
+; In this example, randr is configured to adjust screen 1.
+; Note that the numbering starts from 0, so this is actually the
+; second screen. If this option is not specified, Redshift will try
+; to adjust _all_ screens.
+[randr]
+;screen=0
+#+END_SRC
+
+** Symlink
+
+ #+BEGIN_SRC sh :tangle tangle/symlink.sh :shebang "#!/bin/bash"
+ ln -siv $(pwd)/tangle/redshift.conf ~/.config/
+ #+END_SRC
diff --git a/rofi.org b/rofi.org
new file mode 100644
index 0000000..f706789
--- /dev/null
+++ b/rofi.org
@@ -0,0 +1,141 @@
+#+begin_src shell :tangle tangle/symlink.sh :results silent :shebang "#!/bin/bash"
+ln -siv $(pwd)/tangle/config.rasi ~/.config/rofi/
+#+end_src
+
+#+begin_src conf :tangle tangle/config.rasi :eval never
+,* {
+ background: #303f30df;
+ background-color: #00000000;
+ foreground: #778877ff;
+
+ selected-normal-foreground: #ffffffff;
+ normal-foreground: #778877ff;
+ alternate-normal-foreground: @normal-foreground;
+ active-foreground: #bbccbb;
+ selected-active-foreground: #ffffff;
+ alternate-active-foreground: @active-foreground;
+
+ normal-background: #00000000;
+ alternate-normal-background: #00000000;
+ selected-normal-background: #00000000;
+ selected-active-background: #00000000;
+ active-background: #00000000;
+ alternate-active-background: #00000000;
+
+ border-color: #000000aa;
+ spacing: 2;
+ separatorcolor: #00000000;
+ red: rgba ( 220, 50, 47, 100 % );
+ blue: rgba ( 38, 139, 210, 100 % );
+ lightbg: rgba ( 238, 232, 213, 100 % );
+ lightfg: rgba ( 88, 104, 117, 100 % );
+
+ selected-urgent-foreground: @background;
+ urgent-foreground: @red;
+ alternate-urgent-foreground: @red;
+ selected-urgent-background: @red;
+ urgent-background: @background;
+ alternate-urgent-background: @lightbg;
+}
+#window {
+ background-color: @background;
+ border: 0;
+ padding: 50;
+ transparency: "background";
+}
+#mainbox {
+ border: 0;
+ padding: 0;
+}
+#message {
+ border: 1px dash 0px 0px ;
+ border-color: @separatorcolor;
+ padding: 1px ;
+}
+#textbox {
+ text-color: @foreground;
+}
+#listview {
+ fixed-height: 0;
+ border: 2px dash 0px 0px ;
+ border-color: @separatorcolor;
+ spacing: 2px ;
+ scrollbar: false;
+ padding: 2px 0px 0px ;
+}
+#element {
+ border: 0;
+ padding: 1px ;
+}
+#element.normal.normal {
+ background-color: @normal-background;
+ text-color: @normal-foreground;
+}
+#element.normal.urgent {
+ background-color: @urgent-background;
+ text-color: @urgent-foreground;
+}
+#element.normal.active {
+ background-color: @active-background;
+ text-color: @active-foreground;
+}
+#element.selected.normal {
+ background-color: @selected-normal-background;
+ text-color: @selected-normal-foreground;
+}
+#element.selected.urgent {
+ background-color: @selected-urgent-background;
+ text-color: @selected-urgent-foreground;
+}
+#element.selected.active {
+ background-color: @selected-active-background;
+ text-color: @selected-active-foreground;
+}
+#element.alternate.normal {
+ background-color: @alternate-normal-background;
+ text-color: @alternate-normal-foreground;
+}
+#element.alternate.urgent {
+ background-color: @alternate-urgent-background;
+ text-color: @alternate-urgent-foreground;
+}
+#element.alternate.active {
+ background-color: @alternate-active-background;
+ text-color: @alternate-active-foreground;
+}
+#scrollbar {
+ width: 4px ;
+ border: 0;
+ handle-color: @normal-foreground;
+ padding: 0;
+}
+#sidebar {
+ border: 2px dash 0px 0px ;
+ border-color: @separatorcolor;
+}
+#button {
+ spacing: 0;
+ text-color: @normal-foreground;
+}
+#button.selected {
+ background-color: @selected-normal-background;
+ text-color: @selected-normal-foreground;
+}
+#inputbar {
+ spacing: 0;
+ text-color: @normal-foreground;
+ padding: 1px ;
+}
+#case-indicator {
+ spacing: 0;
+ text-color: @normal-foreground;
+}
+#entry {
+ spacing: 0;
+ text-color: @normal-foreground;
+}
+#prompt {
+ spacing: 0;
+ text-color: @normal-foreground;
+}
+#+end_src
diff --git a/ssh_config.org.gpg b/ssh_config.org.gpg
new file mode 100644
index 0000000..c657ed9
--- /dev/null
+++ b/ssh_config.org.gpg
Binary files differ
diff --git a/tex.org b/tex.org
new file mode 100644
index 0000000..5355514
--- /dev/null
+++ b/tex.org
@@ -0,0 +1,64 @@
+#+PROPERTY: header-args :tangle-mode (identity #o444)
+#+PROPERTY: header-args:latex :eval never
+Here are some custom latex packages and stuff.
+
+Let us start by creating the local latex directory. We can also use this source block as a quick way to find the appropriate tangle directory for any latex files.
+#+NAME: lob-localtexdir
+#+begin_src sh :results silent
+texdir=$(kpsewhich -var-value "TEXMFHOME")/tex/latex
+mkdir -p $texdir
+echo $texdir
+#+end_src
+* defeq.sty
+This first latex package defines a better looking version of =:==.
+#+begin_src latex :tangle (expand-file-name "defeq.sty" (org-sbe "lob-localtexdir"))
+% Tangled from dotfiles/tex.org
+% Defines a better looking version of :=
+\NeedsTeXFormat{LaTeX2e}[1999/12/01]
+\ProvidesPackage{defeq}
+ [2016/03/28 v0.1 defeq]
+
+\RequirePackage{textcomp}
+\RequirePackage{marvosym}
+\RequirePackage{amsmath}
+
+\newcommand*{\defeq}{\mathrel{\vcenter{\baselineskip0.5ex \lineskiplimit0pt \hbox{\scriptsize.}\hbox{\scriptsize.}}} =}
+
+\endinput
+%%
+%% End of file `defeq.sty'.
+#+end_src
+* personal.sty
+A package which includes commands, packages and settings I want to be generally available.
+Some settings are in external files. We can list these files using basic unix commands and input them in the main file using the noweb syntax.
+
+#+NAME: personal-files
+#+begin_src sh :dir (org-sbe lob-localtexdir) :results raw silent
+ls personal-*sty | sed -e 's/\(.*\)/\\input{\1}/'
+#+end_src
+
+#+begin_src latex :tangle (expand-file-name "personal.sty" (org-sbe "lob-localtexdir")) :tangle-mode (identity #o444) :noweb yes
+% Tangled from dotfiles/tex.org
+\ProvidesPackage{personal}
+\RequirePackage{defeq}
+\RequirePackage{unicode-math}
+\RequirePackage{textcomp}
+\RequirePackage{marvosym}
+\RequirePackage{amsmath}
+
+% Command for non-italic subscripts
+\newcommand{\V}[1]{\textrm{#1}}
+\catcode`\~=\active
+\newcommand{~}[1]{_{\textrm{#1}}}
+
+\def\μ{\si{\micro}}
+% \def\Ω{\si{\ohm}}
+
+\RequirePackage{tikz}
+\usetikzlibrary{scopes, intersections, positioning}
+\usepackage{gnuplot-lua-tikz}
+
+% Include other files
+<<personal-files()>>
+#+end_src
+