def dropbox_sync (file_path): # wait until dropbox has completed syncing result = "" while result != "Up to date\n": # sleep ten seconds between invocations to not overwhelm dropbox # also wait ten seconds before checking with dropbox to begin with time.sleep(10) # check if dropbox is still syncing result = dropbox("status")
def ensure_running(proc_name, run_proc): def start_if_required(): try: sh.pidof(proc_name) except sh.ErrorReturnCode: run_proc() return start_if_required startup_apps = [lambda: sh.wmname("LG3D"), lambda: sh.xrandr(s='1920x1080'), ensure_running("gnome-settings-daemon", lambda: sh.gnome_settings_daemon(_bg=True)), ensure_running("nm-applet", lambda: sh.nm_applet(_bg=True)), ensure_running("launchy", lambda: sh.launchy(_bg=True)), lambda: sh.dropbox("start", _bg=True)] def main(qtile): for start_app in startup_apps: start_app() @hook.subscribe.client_new def dialogs(window): if(window.window.get_wm_type() == 'dialog' or window.window.get_wm_transient_for()): window.floating = True groups = [ Group("1"), Group("2"), Group("3"),
def dropbox_exclude (file_path): result = dropbox("exclude", "add", file_path) if result.split()[0] != "Excluded:": print("Error attempting to exclude " + str(file_path)) print(result) exit(1)
def dropbox_check (file_path): # get files excluded from dropbox excludes = dropbox("exclude", "list").split()[1:] excludes = [os.path.join(dropbox_root, exclude) for exclude in excludes] return (file_path in excludes)