[rc] nix → deb, and a few useful aliases
[~bandali/configs] / rc.org
diff --git a/rc.org b/rc.org
index 2be067f..6843791 100644 (file)
--- a/rc.org
+++ b/rc.org
@@ -643,7 +643,7 @@ timeout = 0
 [retriever]
 type = SimplePOP3SSLRetriever
 server = fencepost.gnu.org
-username = aminb
+username = bandali
 password_command = ("gpg2", "--no-tty", "-q", "-d", "/home/amin/.passwd/gnu.gpg")
 port = 995
 use_apop = True
@@ -781,7 +781,7 @@ WantedBy=timers.target
 **** send-email
 #+begin_src conf
 [sendemail]
-       smtpuser = aminb
+       smtpuser = bandali
        smtpserver = fencepost.gnu.org
        smtpserverport = 587
        smtpencryption = tls
@@ -921,6 +921,7 @@ separator_width=0
 general {
         colors = true
         interval = 5
+        output_format = "i3bar"
 }
 
 # order += "ipv6"
@@ -990,7 +991,7 @@ CopyArrivalDate yes
 
 ######
 IMAPAccount amin
-Host nix.aminb.org
+Host mail.aminb.org
 User amin@aminb.org
 PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/amin.gpg"
 SSLType IMAPS
@@ -1534,9 +1535,9 @@ logfile ~/.msmtp.log
 
 # aminb
 account aminb
-host nix.aminb.org
+host mail.aminb.org
 # use `msmtp -a aminb --serverinfo --tls --tls-certcheck=off --tls-fingerprint=` to get the current fingerprint
-tls_fingerprint 98:C7:F0:02:7F:2B:D8:B6:D3:BF:E8:C1:D4:07:6B:B5:6C:B1:C7:5D:97:20:70:88:AB:9E:B5:09:5D:2C:DC:8E
+tls_fingerprint C7:A4:2E:A3:11:FA:80:45:C4:29:D6:62:4D:73:DB:34:43:67:8F:16:F1:2E:54:43:06:1B:41:B6:A9:09:E0:37
 tls_starttls on
 from amin@aminb.org
 user amin@aminb.org
@@ -1548,13 +1549,17 @@ host fencepost.gnu.org
 # use `msmtp -a gnu --serverinfo --tls --tls-certcheck=off --tls-fingerprint=` to get the current fingerprint
 tls_fingerprint 34:60:91:B5:71:5B:76:87:50:F3:83:13:26:0F:EE:75:42:83:93:9A:E2:AF:1E:87:72:02:C9:61:CE:28:1B:8E
 tls_starttls on
-from aminb@gnu.org
-user aminb
+from bandali@gnu.org
+user bandali
 passwordeval gpg2 --no-tty -q -d ~/.passwd/gnu.gpg
 
-# gnu (bandali)
-account gnu-bandali : gnu
-from bandali@gnu.org
+# gnu (old)
+account gnu-aminb : gnu
+from aminb@gnu.org
+account gnu-amin : gnu
+from amin@gnu.org
+account gnu-mab : gnu
+from mab@gnu.org
 
 # uwaterloo
 account uwaterloo
@@ -3794,8 +3799,8 @@ output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
 ### Idle configuration
 
 exec swayidle \
-   timeout 120  'swaymsg "output * dpms off"' \
-   resume       'swaymsg "output * dpms on"'  \
+   timeout 120  '[ -f ~/.nosleep ] || swaymsg "output * dpms off"' \
+        resume  '[ -f ~/.nosleep ] || swaymsg "output * dpms on"'  \
    before-sleep swaylock
 
 
@@ -3981,6 +3986,12 @@ mode "$mode_system" {
 }
 bindsym XF86PowerOff mode "$mode_system"
 
+#
+# Presentation mode
+#
+
+bindsym $mod+$mod2+p exec ([ ! -e ~/.nosleep ] && touch ~/.nosleep || rm ~/.nosleep) && killall -USR1 i3status
+
 #
 # Notifications
 #
@@ -4019,7 +4030,7 @@ bar {
         background #323232
         inactive_workspace #32323200 #32323200 #5c5c5c
     }
-    status_command i3status
+    status_command i3status | my-i3status.py
 }
 
 # font pango: benis uushi 9
@@ -5378,10 +5389,11 @@ alias mv="mv -iv"
 alias cp="cp -iv"
 alias scl=systemctl
 alias jcl=journalctl
-alias m="mbsync -a; getmail; notmuch new"
+alias m="mbsync -a; notmuch new"
 alias best="youtube-dl -f best"
-alias nixx="ssh amin@nix.aminb.org"
-alias fence="ssh aminb@fencepost.gnu.org"
+alias sd="ssh deb"
+alias sf="ssh fp"
+alias sn="ssh nix"
 
 aur() {
    cd ~/usr/build
@@ -5431,6 +5443,83 @@ fi
 printf '%s%%%%%2dh%02dm \n' "$perc" $((secs / 3600)) $((secs % 3600 / 60))
 #+end_src
 
+** my-i3status.py
+:PROPERTIES:
+:header-args+: :tangle ~/.local/bin/my-i3status.py :shebang "#!/usr/bin/env python2"
+:END:
+
+#+begin_src python :comments none
+# -*- coding: utf-8 -*-
+
+# This script is a simple wrapper which prefixes each i3status line with custom
+# information. It is based on:
+# https://github.com/i3/i3status/blob/master/contrib/wrapper.py
+#
+# In ~/.i3status.conf, add the following line:
+#     output_format = "i3bar"
+# in the 'general' section.
+# Then, in ~/.config/i3/config or ~/.config/sway/config add:
+#     status_command i3status | my-i3status.py
+# in the 'bar' section.  Make sure my-i3status.py is in $PATH.
+#
+# © 2012 Valentin Haenel <valentin.haenel@gmx.de>
+# © 2018 Amin Bandali <bandali@gnu.org>
+#
+# This program is free software. It comes without any warranty, to the extent
+# permitted by applicable law. You can redistribute it and/or modify it under
+# the terms of the Do What The Fuck You Want To Public License (WTFPL), Version
+# 2, as published by Sam Hocevar. See http://sam.zoy.org/wtfpl/COPYING for more
+# details.
+
+import sys
+import json
+import os
+
+def get_nosleep():
+    """ Return true if ~/.nosleep exists. """
+    return os.path.isfile(os.path.expanduser("~/.nosleep"))
+
+def print_line(message):
+    """ Non-buffered printing to stdout. """
+    sys.stdout.write(message + '\n')
+    sys.stdout.flush()
+
+def read_line():
+    """ Interrupted respecting reader for stdin. """
+    # try reading a line, removing any extra whitespace
+    try:
+        line = sys.stdin.readline().strip()
+        # i3status sends EOF, or an empty line
+        if not line:
+            sys.exit(3)
+        return line
+    # exit on ctrl-c
+    except KeyboardInterrupt:
+        sys.exit()
+
+if __name__ == '__main__':
+    # Skip the first line which contains the version header.
+    print_line(read_line())
+
+    # The second line contains the start of the infinite array.
+    print_line(read_line())
+
+    while True:
+        line, prefix = read_line(), ''
+        # ignore comma at start of lines
+        if line.startswith(','):
+            line, prefix = line[1:], ','
+
+        if get_nosleep():
+            j = json.loads(line)
+            # insert information into the start of the json, but could be anywhere
+            j.insert(0, {'full_text' : '🖵 ', 'name' : 'nosleep'})
+            # and echo back new encoded json
+            print_line(prefix+json.dumps(j))
+        else:
+            print_line(prefix+line)
+#+end_src
+
 ** rofi-light
 :PROPERTIES:
 :header-args+: :tangle ~/.local/bin/rofi-light :shebang "#!/bin/bash"