Commits

Anonymous committed 5c66f64

improvement for screenshot program, remove my notmuch tagging emails

  • Participants
  • Parent commits 9315e69

Comments (0)

Files changed (9)

 .*\.pyc$
 ^m-ext$
 ^backup_via_duplicity.sh$
+.ropeproject/.*
 
+
 fi
 
 echo Switching to HDMI1
-xrandr --output HDMI1 --mode "2560x1440_40" --output LVDS1 --off --output VGA1 --off
+xrandr --output HDMI1 --mode "2560x1440_40" --dpi 108 --output LVDS1 --off --output VGA1 --off
 
 echo Adding VGA-right
-xrandr --output HDMI1 --mode "2560x1440_40" --output LVDS1 --off --output VGA1 --auto --right-of HDMI1
+xrandr --output HDMI1 --mode "2560x1440_40" --dpi 108 --output LVDS1 --off --output VGA1 --auto --right-of HDMI1
 
 echo Additional setup tweaks
 set-keyboard-rate
+#!/bin/bash
+MODE_PRESENT=`xrandr -q|grep 2560x1440_40|grep -v grep`
+if test -z "$MODE_PRESENT"
+then
+    echo Adding new mode
+    xrandr  --newmode "2560x1440_40" 200.80  2560 2712 2984 3408  1440 1441 1444 1473  -HSync +Vsync
+    xrandr  --addmode HDMI1 "2560x1440_40"
+else
+    echo Mode already present, not adding
+fi
+
+echo Switching to HDMI1
+xrandr --output HDMI1 --mode "2560x1440_40" --dpi 108 --output LVDS1 --off --output VGA1 --off
+
+echo Adding 2nd monitor
+xrandr --output VGA1 --mode 1920x1200 --dpi 108 --rotate left --right-of HDMI1
+
+echo Additional setup tweaks
+set-keyboard-rate
+#set-desktop-wallpaper
+#!/usr/bin/env python
+import i3
+from gi.repository import Gtk, Gdk
+from gio import app_info_get_all
+
+VETO_NAMES=("topdock","bottomdock","__i3_scratch")
+
+def filter_func(model, treeiter, user_data):
+    query = entry.get_text().lower()
+    value = model.get_value(treeiter, 0).lower()
+    if value not in VETO_NAMES:
+        for q in query.split(" "):
+            if q not in value: return False
+            # elif all q's in value:
+        return True
+    else:
+        return False
+
+def sort_func(model, a, b, user_data):
+    a_id, b_id = model.get_value(a,1), model.get_value(b,1)
+    a_name, b_name = model.get_value(a,0), model.get_value(b,0)
+    if a_id == -1 and b_id != -1:
+        return -1
+    elif a_id == -1 and b_id == -1 or (a_id > -1 and b_id > -1):
+        if a_name.lower() == b_name.lower(): return 0
+        elif a_name.lower() > b_name.lower(): return -1
+        else: return 1
+    elif a_id > -1 and b_id == -1:
+        return 1
+
+def refilter(*_):
+    filterStore.refilter()
+    if filterStore.get_iter_first():
+        tree.get_selection().select_iter(filterStore.get_iter_first())
+        tree.set_cursor( filterStore.get_path( filterStore.get_iter_first() ) )
+
+def activate(*_):
+    model, treeiter = tree.get_selection().get_selected()
+    conid = model.get_value(treeiter, 1)
+    if conid > -1:
+        i3.command("[con_id={conid}] focus".format(conid=conid))
+    else:
+        app_id = model.get_value(treeiter, 2)
+        apps[app_id].launch()
+    Gtk.main_quit()
+
+def win_key_press(widget,event):
+    if Gdk.keyval_name( event.keyval ) == "Escape":
+        Gtk.main_quit()
+    elif not entry.is_focus(): 
+        if event.string:
+            entry.grab_focus()
+
+def tree_move_up(widget,event):
+    if Gdk.keyval_name( event.keyval ) == "Up":
+        (model, it1) = widget.get_selection().get_selected()
+        if model.get_string_from_iter(it1) == "0":
+            entry.grab_focus()
+
+win = Gtk.Window(title="fooswitcher")
+box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
+win.add(box)
+
+entry = Gtk.Entry()
+box.pack_start(entry, False, False, 0)
+
+store = Gtk.ListStore(str,int,str,str)
+for con in i3.filter(type=4):
+    if con['name'] in VETO_NAMES: continue
+    store.append(["Workspace: " + con['name'], con['id'], "","gtk-home"])
+for con in i3.filter(type=2,nodes=[]):
+    if con['name'] in VETO_NAMES: continue
+    store.append([con['name'], con['id'], "","gtk-fullscreen"])
+
+apps = dict(map(lambda o: (o.get_id(), o), app_info_get_all()))
+for app_id, app in apps.items():
+    store.append([app.get_name(), -1, app_id, "gtk-execute"])
+
+filterStore = Gtk.TreeModelFilter(child_model=store)
+
+tree = Gtk.TreeView(filterStore)
+tree.set_enable_search(False)
+tree.set_headers_visible(False)
+
+tree.append_column(Gtk.TreeViewColumn("", Gtk.CellRendererPixbuf(), stock_id=3))
+tree.append_column(Gtk.TreeViewColumn("", Gtk.CellRendererText(), text=0))
+
+box.pack_start(Gtk.ScrolledWindow(child=tree), True, True, 0)
+
+store.set_sort_func(0, sort_func, None)
+store.set_sort_column_id(0, Gtk.SortType.DESCENDING)
+filterStore.set_visible_func(filter_func)
+
+entry.connect("changed", refilter)
+entry.connect("activate", activate)
+tree.connect("row-activated", activate)
+tree.connect("key-press-event", tree_move_up)
+win.connect("key-press-event", win_key_press)
+win.connect("delete-event", Gtk.main_quit)
+
+win.set_type_hint(Gdk.WindowTypeHint.DIALOG)
+win.set_default_size(400,300)
+win.show_all()
+
+refilter()
+Gtk.main()
 #!/bin/bash
+
+SLEEP=600
+
 while /bin/true
 do
     offlineimap -q
     echo Done at `date`
     echo
 
-    sleep 120
+    sleep $SLEEP
 
     offlineimap -q -a avk
     notmuch-simpletag
     echo Done at `date`
     echo
 
-    sleep 120
+    sleep $SLEEP
 
     offlineimap -q -a avk
     notmuch-simpletag
     echo Done at `date`
     echo
 
-    sleep 120
+    sleep $SLEEP
 done

notmuch-simpletag

-#!/bin/bash
-
-echo "Importing new mail"
-notmuch new
-
-echo "Running global tag additions to tag new mail"
-
-notmuch tag +redmine from:redmine@ua2web.com and not tag:redmine
-notmuch tag +ian999 from:ian999@gmail.com and not tag:ian999
-notmuch tag +yp from:yacapaca.com and not tag:yp
-notmuch tag +gmail to:alex.v.koval@gmail.com and not tag:gmail and not from:alex@
-
-notmuch tag +sent from:alex@halogen-dg.com and not tag:sent
-notmuch tag +sent from:alex@ua2web.com and not tag:sent
-notmuch tag +sent from:alex@halogen.kharkov.ua and not tag:sent
-notmuch tag +sent from:alex@koval.kharkov.ua and not tag:sent
-notmuch tag +sent from:alex.v.koval@gmail.com and not tag:sent
-
-# ua2web group
-notmuch tag +ua2web from:ua2web.com and not from redmine@ua2web.com and not tag:ua2web
-notmuch tag +ua2web from:leha2000@gmail.com and not tag:ua2web
-notmuch tag +ua2web from:vic@nix.kh.ua and not tag:ua2web
-
-# mail lists
-notmuch tag +i3wm to:i3-discuss@i3.zekjur.net and not tag:i3wm
-
-# customers
-notmuch tag +customers from:gjamal@gmail.com and not tag:customers
-notmuch tag +customers from:ian999 and not tag:customers
-notmuch tag +customers from:miles and not tag:customers
-notmuch tag +customers from:urbanalarm.com and not tag:customers
-notmuch tag +customers "(from:david@tagvillage.com or from:ideacentrics@yahoo.com) and not tag:customers"
-notmuch tag +customers from:kevin@prizewheel.com and not tag:customers
-notmuch tag +customers from:jw@print-science.com and not tag:customers
-notmuch tag +customers from:kevin.feltner@gmail.com and not tag:customers
-
-# family
-notmuch tag +family from:koval.natasha@gmail.com and not tag:family
-
-# bike
-notmuch tag +bike from:Lodewijk.De.Meulemeester@ahlers.com and not tag:bike
-
-# colleague
-notmuch tag +colleague +vic from:vic@ua2web.com or from vic@nix.kh.ua or from vic.in.kh@gmail.com
-notmuch tag +colleague +dnata from:nata@halogen-dg.com or from:natadulger@gmail.com or from nata@halogen.kharkov.ua
-notmuch tag +colleague +kostin from:kostin@halogen-dg.com or from kostin@halogen.kharkov.ua or from kostin@ukr.net
-notmuch tag +colleague +sasa from:sasa@halogen.kharkov.ua or from:from:sasa@halogen-dg.com or from sasa@ua2web.com
-notmuch tag +colleague +dimon from:dimon@halogen.kharkov.ua or from:from:dimon@halogen-dg.com or from dimon@ua2web.com
-notmuch tag +colleague +petr from:petr@halogen.kharkov.ua or from:from:petr@halogen-dg.com or from petr@ua2web.com
-notmuch tag +colleague from:axel@ua2web.com
-notmuch tag +colleague from:max@ua2web.com
-notmuch tag +colleague from:vlad@ua2web.com
-
-
-# ignore some unread
-notmuch tag -unread from:htreports@host-tracker.com and tag:unread
-echo "Done."
+cd ~/wine/SAS.Planet.Release.121010
+wine SASPlanet.exe
 
 
 import os
+import optparse
 from subprocess import Popen, PIPE
 from tempfile import NamedTemporaryFile
 
 SCREENSHOT_UTILITY = '/usr/bin/scrot -s' # /usr/bin/import
 
-def feed_xclipboard(str):
+def feed_xclipboard(s):
     pipe = Popen("xclip -sel clip", shell=True, stdin=PIPE).stdin
-    pipe.write(str)
+    pipe.write(s)
     pipe.close()
 
 def import_screenshot():
         prefix='screenshot_',
         dir = os.path.expanduser('~/tmp'),
         delete=False).name
-    p = Popen(SCREENSHOT_UTILITY + " " + filename, shell=True)
-    sts = os.waitpid(p.pid, 0)[1]
+    process = Popen(SCREENSHOT_UTILITY + " " + filename, shell=True)
+    os.waitpid(process.pid, 0)
     return filename
 
+def post_process(program, screenshot_filename):
+    """ Post process via user defined utility. Tried: `pinta` (misses arrows),
+    nathive (misses everything, but nice), stopped on app-office/dia """
+
+    process = Popen(program + " " + screenshot_filename, shell=True)
+    os.waitpid(process.pid, 0)
+
 
 if __name__ == '__main__':
+    p = optparse.OptionParser()
+    p.add_option("--post-process", '-p')
+    options, arguments = p.parse_args()
+
     screenshot = import_screenshot()
     feed_xclipboard(screenshot)
+
+    if options.post_process:
+        post_process(options.post_process, screenshot)

set-x-desktop-wallpaper

 #FILE="$USER/dsc00997.jpg"
 #FILE="/home/$USER/photo/2013.03.10/IMG_0919.JPG"
 #FILE="/home/$USER/photo/2013.03.10-more/IMG_3897.JPG"
+FILE="/home/$USER/photo/2013.03.10-more/IMG_3872.JPG"
 #FILE="/home/$USER/photo/2013.03.10-more/P3080445.JPG"
 #FILE="/home/$USER/photo/2013.03.24/IMG_0992.JPG"
 #FILE="/home/$USER/photo/2013.03.10/IMG_0945.JPG"
 #FILE="caedes1/gs208103-1111547085.jpg"
 #FILE="caedes1/busybottle-1301204710.jpg"
 
-FILE="/home/avk/photo/2013.05.26/IMG_2050.JPG" # near sev. donets
-FILE="/home/avk/photo/2013.05.26/IMG_2153.JPG" # ..
+#FILE="/home/avk/photo/2013.05.26/IMG_2050.JPG" # near sev. donets
+#FILE="/home/avk/photo/2013.05.26/IMG_2153.JPG" # ..
 #FILE="/home/avk/photo/2013.05.26/IMG_2167.JPG" # ..
 #FILE="/home/avk/photo/2013-06-01/IMG_2203.JPG" # near mzha
-FILE="/home/avk/photo/2013.06.08/IMG_2208.JPG"
-FILE="/home/avk/photo/MonteNegro/2013.05.11/IMG_1999.JPG" # this is sea from air
+#FILE="/home/avk/photo/2013.06.08/IMG_2208.JPG"
+#FILE="/home/avk/photo/MonteNegro/2013.05.11/IMG_1999.JPG" # this is sea from air
 
 #feh --bg-scale $FILE
 feh --bg-fill $FILE