summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Morgan <jesse@jesterpm.net>2013-03-16 10:31:35 -0700
committerJesse Morgan <morganjm@amazon.com>2013-03-16 10:31:35 -0700
commitac5044074e01f518ae3c837dfad0fa3fc0719962 (patch)
tree0a08e08fdda7d75bc9857b20c2fdb51f19bd10a1
Initial commit of some shell scripts
-rwxr-xr-xconky-i3bar8
-rwxr-xr-xgnome-keyring-add-imap-password.py43
-rwxr-xr-xlock14
-rwxr-xr-xmake_i3_config26
-rwxr-xr-xmutt-display-filter.sh13
-rwxr-xr-xofflineimap-daemon.sh3
-rwxr-xr-xofflineimap-wrapper.sh7
-rwxr-xr-xweatherbar.sh5
8 files changed, 119 insertions, 0 deletions
diff --git a/conky-i3bar b/conky-i3bar
new file mode 100755
index 0000000..b810c50
--- /dev/null
+++ b/conky-i3bar
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+# Send out the necessary headers and then start conky.
+
+echo '{ "version": 1 }'
+echo '['
+echo '[],'
+exec conky -c $HOME/.conkyrc-json
diff --git a/gnome-keyring-add-imap-password.py b/gnome-keyring-add-imap-password.py
new file mode 100755
index 0000000..24ab44d
--- /dev/null
+++ b/gnome-keyring-add-imap-password.py
@@ -0,0 +1,43 @@
+#!/usr/bin/python
+
+import gtk
+import gnomekeyring as gkey
+import getpass
+
+class Keyring(object):
+ def __init__(self, name, server, protocol):
+ self._name = name
+ self._server = server
+ self._protocol = protocol
+ self._keyring = gkey.get_default_keyring_sync()
+
+ def has_credentials(self):
+ try:
+ attrs = {"server": self._server, "protocol": self._protocol}
+ items = gkey.find_items_sync(gkey.ITEM_NETWORK_PASSWORD, attrs)
+ return len(items) > 0
+ except gkey.DeniedError:
+ return False
+
+ def get_credentials(self):
+ attrs = {"server": self._server, "protocol": self._protocol}
+ items = gkey.find_items_sync(gkey.ITEM_NETWORK_PASSWORD, attrs)
+ return (items[0].attributes["user"], items[0].secret)
+
+ def set_credentials(self, (user, pw)):
+ attrs = {
+ "user": user,
+ "server": self._server,
+ "protocol": self._protocol,
+ }
+ gkey.item_create_sync(gkey.get_default_keyring_sync(),
+ gkey.ITEM_NETWORK_PASSWORD, self._name, attrs, pw, True)
+
+server = raw_input("Server: ")
+username = raw_input("Username: ")
+password = getpass.getpass(prompt="Password: ")
+print
+
+keyring = Keyring("offlineimap", server, "imap")
+
+keyring.set_credentials((username, password))
diff --git a/lock b/lock
new file mode 100755
index 0000000..312c82b
--- /dev/null
+++ b/lock
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+# Set pidgin away.
+if pgrep pidgin &> /dev/null; then
+ currentStatusMessage="$(purple-remote 'getstatusmessage')"
+ currentStatus="$(purple-remote 'getstatus')"
+ purple-remote 'setstatus?status=away&message=Away'
+fi
+
+i3lock -n -i $HOME/.wallpapers/lock.png --color=0e0e0e -u -m
+
+if pgrep pidgin &> /dev/null; then
+ purple-remote 'setstatus?status='"$currentStatus"'&message='"$currentStatusMessage"
+fi
diff --git a/make_i3_config b/make_i3_config
new file mode 100755
index 0000000..8377b14
--- /dev/null
+++ b/make_i3_config
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+## This script is used to assemble the various components of my i3 config at login.
+## Written by Jesse Morgan <jesse@jesterpm.net>
+
+CONFIGD=$HOME/.config/i3/config.d
+AUTOSTARTD=$HOME/.config/i3/autostart.d
+
+echo "###"
+echo "### Do not edit this file!"
+echo "###"
+echo "### This file is automatically generated from the files in config.d"
+echo "### and autostart.d. Edit those files instead."
+echo "###\n"
+
+# Get files from config.d
+for file in $CONFIGD/*; do
+ echo "### $file"
+ cat $file
+done
+
+# Get files from autostart.d
+for file in $AUTOSTARTD/*; do
+ echo "### $file"
+ cat $file
+done
diff --git a/mutt-display-filter.sh b/mutt-display-filter.sh
new file mode 100755
index 0000000..4ab8a23
--- /dev/null
+++ b/mutt-display-filter.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+MESSAGE=$(cat)
+
+NEWALIAS=$(echo "${MESSAGE}" | grep ^"From: " | sed s/[\,\"\']//g | awk '{$1=""; if (NF == 3) {print "alias" $0;} else if (NF == 2) {print "alias" $0 $0;} else if (NF > 3) {print "alias", tolower($2)"-"tolower($(NF-1)) $0;}}')
+
+if grep -Fxq "$NEWALIAS" $HOME/.mutt/aliases; then
+ :
+else
+ echo "$NEWALIAS" >> $HOME/.mutt/aliases
+fi
+
+echo "${MESSAGE}"
diff --git a/offlineimap-daemon.sh b/offlineimap-daemon.sh
new file mode 100755
index 0000000..ec2e51e
--- /dev/null
+++ b/offlineimap-daemon.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+offlineimap > $HOME/.offlineimap.log 2>&1 &
diff --git a/offlineimap-wrapper.sh b/offlineimap-wrapper.sh
new file mode 100755
index 0000000..bc60571
--- /dev/null
+++ b/offlineimap-wrapper.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+. $HOME/.gpg-agent-info
+export GPG_AGENT_INFO
+export DISPLAY=:0
+/usr/bin/offlineimap >> $HOME/.offlineimap.log
+
diff --git a/weatherbar.sh b/weatherbar.sh
new file mode 100755
index 0000000..781fd35
--- /dev/null
+++ b/weatherbar.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+temp=`weather --headers="Temperature" -q | awk '/Temperature/ {print $2}'`
+cond=`weather --headers="Sky conditions" -q | awk '/Sky conditions/ {print $3 " " $4}'`
+
+echo "$temp °C $cond"