From 44314753a0aca76ea9d82af73a1f55a3c1ee208c Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Mon, 16 Aug 2021 14:45:58 +0200 Subject: [PATCH] mailcap, xinit --- email/.config/mutt/mailcap | 1 + email/.config/mutt/muttrc | 2 + email/.local/bin/mutt.vcard.filter | 152 +++++++++++++++++++++++++++++ x/.xinitrc | 9 +- 4 files changed, 158 insertions(+), 6 deletions(-) create mode 100755 email/.local/bin/mutt.vcard.filter diff --git a/email/.config/mutt/mailcap b/email/.config/mutt/mailcap index b79ea43..06a8d8a 100644 --- a/email/.config/mutt/mailcap +++ b/email/.config/mutt/mailcap @@ -34,3 +34,4 @@ application/ics; khal printics '%s'; copiousoutput; text/calendar; khal printics '%s'; copiousoutput; application/vnd.openxmlformats-officedocument.wordprocessingml.document; libreoffice --headless --cat '%s'; copiousoutput; application/vnd.oasis.opendocument.text; libreoffice --headless --cat '%s'; copiousoutput; +text/x-vcard; mutt.vcard.filter; copiousoutput diff --git a/email/.config/mutt/muttrc b/email/.config/mutt/muttrc index a556bc5..1125be8 100644 --- a/email/.config/mutt/muttrc +++ b/email/.config/mutt/muttrc @@ -70,6 +70,8 @@ auto_view text/calendar auto_view application/vnd.openxmlformats-officedocument.wordprocessingml.document auto_view application/vnd.oasis.opendocument.text auto_view application/msword +# vcards +auto_view text/x-vcard # Pager options #set pager=/usr/share/vim/vim82/macros/less.sh diff --git a/email/.local/bin/mutt.vcard.filter b/email/.local/bin/mutt.vcard.filter new file mode 100755 index 0000000..7d11d7d --- /dev/null +++ b/email/.local/bin/mutt.vcard.filter @@ -0,0 +1,152 @@ +#!/usr/bin/perl -Tw + +# mutt.vcard.filter - vcard filter for use with the mutt autoview facility +# Copyright (C) 1997,1998,1999 David A Pearson +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the license, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +# This little perl script is a simple filter for text/x-vcard +# attachments. I'm pretty sure I've *not* included everything +# possible in here, but it "works for me". Feel free to improve +# in any way you see fit. +# +# Here is how I use it. In my ~/.mutt_mailcap (use your filename of +# choice) I have the following entry: +# +# text/x-vcard; mutt.vcard.filter; copiousoutput +# +# All you then need to do is add a line like: +# +# auto_view text/x-vcard +# +# to your ~/.muttrc (use your filename of choice). +# +# All comments/flames/feedback can be directed to: +# +# davep@hagbard.demon.co.uk +# + +use strict; + +my $in_card = 0; +my @address = (); +my @contacts = (); +my @additional = (); +my @notes = (); +my $name = ""; +my $title = ""; +my $org = ""; +my $found_note = 0; +my $len; +my $i; +my $addr_line; +my $contact_line; + +while ( <> ) +{ + if ( $in_card ) + { + if ( /^fn:\s*(.*)$/i ) + { + $name = $1; + } + elsif ( /^n:\s*(.*);\s*(.*)$/i ) + { + @additional = ( "", "Additional information:", "" ) if $#additional == -1; + + @additional = ( @additional, "Last Name:\t$1", "First Name:\t$2" ); + } + elsif ( /^title:\s*(.*)$/i ) + { + $title = $1; + } + elsif ( /^org:\s*(.*)$/i ) + { + $org = $1; + } + elsif ( /^adr:\s*(.*)$/i ) + { + my $addr = $1; + + $addr =~ s/;+/;/g; + + @address = split( /;/, $addr ); + } + elsif ( /^email;\s*(.*?):\s*(.*)$/i || /^tel;\s*(.*?):\s*(.*)$/i ) + { + my $type = $1; + my $value = $2; + + @contacts = ( @contacts, uc( substr( $type, 0, 1 ) ) . + substr( $type, 1 ) . ": $value" ); + } + elsif ( /^note:\s*(.*)$/i ) + { + @notes = ( "" ) if $#notes == -1; + @notes = ( @notes, $1 ); + + $found_note = 1; + } + elsif ( /^=.{2}=$/ && $found_note ) + { + my $line = <>; + + chomp( $line ); + + @notes = ( "" ) if $#notes == -1; + @notes = ( @notes, $line ); + } + elsif ( /^end:\s*vcard$/i ) + { + $in_card = 0; + } + } + else + { + $in_card = /^begin:\s*vcard\s*$/i; + } +} + +@address = ( $org, @address ) if $org; +@address = ( $title, @address ) if $title; +@address = ( $name, @address ) if $name; + +format STDOUT = +@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +$addr_line, $contact_line +. + +$len = $#address > $#contacts ? $#address : $#contacts; + +print "" . ( "=" x 76 ) . "\n"; + +for ( $i = 0; $i <= $len; $i++ ) +{ + $addr_line = $i <= $#address ? $address[ $i ] : ""; + $contact_line = $i <= $#contacts ? $contacts[ $i ] : ""; + write; +} + +for ( $i = 0; $i <= $#notes; $i++ ) +{ + print "$notes[ $i ]\n"; +} + +for ( $i = 0; $i <= $#additional; $i++ ) +{ + print "$additional[ $i ]\n"; +} + +print "" . ( "=" x 76 ) . "\n"; diff --git a/x/.xinitrc b/x/.xinitrc index e789b05..4a91997 100755 --- a/x/.xinitrc +++ b/x/.xinitrc @@ -5,12 +5,6 @@ export _JAVA_AWT_WM_NONREPARENTING=1 # notifications dunst & -# gpg agent -eval "$(gpg-agent --daemon)" - -# XResources -xrdb -merge ~/.Xresources - # auto locking but only on laptop if [ $(hostname) != ygdrassil ]; then xautolock -locker slock -time 10 & @@ -22,6 +16,9 @@ slstatus & # compositor xcompmgr -a -c -l0 -t0 -r0 -o.00 & +setxkbmap dvorak,ru ,phonetic_dvorak compose:ralt,grp:shifts_toggle,grp_led:scroll,ctrl:swapcaps + + # Other system wide xinit files if [ -f /etc/X11/xinit/xinitrc ]; then . /etc/X11/xinit/xinitrc -- 2.20.1