Example #1
0
    def attach_nvim(self):
        Utility.run_command("tmux split-window -h 'NVIM_LISTEN_ADDRESS=/tmp/nvim nvim'")

        while True:
            try:
                time.sleep(1)
                nvim = attach('socket', path='/tmp/nvim')
            except:
                continue
            break

        self.nvim = nvim
Example #2
0
File: tasky.py Project: s992/Tasky
    def open_browser(self, task):
        urls = []

        if Utility.is_url(task.description()):
            urls.append(task.description())

        possibles = [
            v[u'description'] for v in task.annotations()
            if Utility.is_url(v[u'description'])
        ]
        urls.extend(possibles)

        for url in urls:
            Utility.run_command('open -a "Google Chrome" %s' % url)
Example #3
0
    def task_note(self, task):
        if not self.nvim:
            self.attach_nvim()

        if not os.path.isdir(expanduser(self.note_folder)):
            os.mkdir(expanduser(self.note_folder))

        note_file = expanduser(self.note_folder + task.uuid() + ".markdown")


        if not os.path.isfile(note_file):
            with open(note_file, 'w+') as fh:
                header = "# " + task.description()
                fh.write(header)
            
            # Annotate the task to show that it has notes now.
            Utility.run_command("task %i annotate Notes" % task.id())

        # either capture error or write note before changing buffer
        try:
            self.nvim.command("e " + note_file)
        except:
            self.nvim.command("w")
            self.nvim.command("e " + note_file)
Example #4
0
 def shell_done(self, content):
     Utility.run_command("tmux split-window '%s'" % content)
Example #5
0
 def command_done(self, content):
     Utility.run_command('task ' + content)
     self.refresh()
Example #6
0
 def task_note(self, task):
     Utility.run_command("tmux split-window 'tasknote %i'" % task.id())
Example #7
0
File: tasky.py Project: s992/Tasky
 def copy_notes(self, task):
     notes = [note[u'description'] for note in task.annotations()]
     Utility.write_to_clipboard("\n".join(notes))
Example #8
0
File: tasky.py Project: s992/Tasky
 def copy_description(self, task):
     Utility.write_to_clipboard(task.description())
Example #9
0
 def task_note(self, task):
     Utility.run_command("tmux split-window 'tasknote %i'" % task.id())
Example #10
0
 def shell_done(self, content):
     Utility.run_command("tmux split-window '%s'" % content)
Example #11
0
 def command_done(self, content):
     Utility.run_command('task ' + content)
     self.refresh()