diff --git a/snowblocks/taskwarrior/README.md b/snowblocks/taskwarrior/README.md deleted file mode 100644 index bbdf61a..0000000 --- a/snowblocks/taskwarrior/README.md +++ /dev/null @@ -1,45 +0,0 @@ -# Taskwarrior - -> Taskwarrior is a flexible, fast, and unobtrusive CLI tool to manage your TODOs that does its job and gets out of your way. - -## Extensions - -### taskopen - -The [taskopen][] extension allows to take notes and open URLs with attached to Taskwarrior tasks. - -Next to the `task` binary itself, this Perl script depends on the `JSON` module which can be installed on Arch Linux via the [perl-json][arch-perl-json] package. - -## Troubleshooting - -### taskopen workaround for macOS - -The management of installed [Perl modules][cpan-doc-modules] on macOS is not as simple and well thought through like with package managers on Linux systems, e.g. via [pacman][archw-pacman] on [Arch Linux][archlinux]. There are problems when is comes to configuring the runtime path the modules have been installed to even when using the most popular module manager called [cpanminus][]. -This causes the [Taskwarrior][] plugin [taskopen][] fail to load because the Perl core module `JSON` can't be found and loaded. - -As a workaround a custom script can be implemented to create and open an attached task note: - -1. Use the [`_get`][tw-doc-api-_get] function of the [Taskwarrior DOM API][tw-doc-dom-api] to extract any stored piece of information of an task. This allows to receive the [UUID of an task][tw-doc-ids]. -2. Create a custom `on` (open note) [Taskwarrior alias][tw-doc-alias] to run the implemented custom script via the `execute` command. - -The logic of the script follows the same like taskopen uses for default notes: - -* Use the [UUID of an task][tw-doc-ids] as the note filename. -* Simply pass the file to an editor (in this case [Atom][]) which will… - * …create a new file if it doesn't exist yet. - * …open the file if it already exists. - -Note that **this script is not limited to macOS** but can also be used for any other Linux host! - -[archlinux]: https://archlinux.org -[arch-perl-json]: https://www.archlinux.org/packages/community/any/perl-json -[archw-pacman]: https://wiki.archlinux.org/index.php/Pacman -[atom]: https://atom.io -[cpanminus]: https://github.com/miyagawa/cpanminus -[cpan-doc-modules]: http://www.cpan.org/modules -[taskopen]: https://github.com/ValiValpas/taskopen -[taskwarrior]: https://taskwarrior.org -[tw-doc-alias]: https://taskwarrior.org/docs/terminology.html#alias -[tw-doc-api-_get]: https://taskwarrior.org/docs/commands/_get.html -[tw-doc-dom-api]: https://taskwarrior.org/docs/dom.html -[tw-doc-ids]: https://taskwarrior.org/docs/ids.html diff --git a/snowblocks/taskwarrior/hooks/on-modify-track-timewarrior.py b/snowblocks/taskwarrior/hooks/on-modify-track-timewarrior.py deleted file mode 100755 index 6306575..0000000 --- a/snowblocks/taskwarrior/hooks/on-modify-track-timewarrior.py +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# Copyright (C) 2016-present Arctic Ice Studio -# Copyright (C) 2016-present Sven Greb - -# Project: igloo -# Repository: https://github.com/arcticicestudio/igloo -# License: MIT -# References: -# https://taskwarrior.org/docs -# https://taskwarrior.org/docs/timewarrior -# timew(1) -# task(1) - -"""A Taskwarrior hook to track the time of a active task with Taskwarrior. - -This hook will extract all of the following for use as Timewarrior tags: - -* UUID -* Project -* Tags -* Description -* UDAs - -Note: - This hook requires Python 3 and is only compatible with Taskwarrior version greater or equal to 2.4! - -This hook is a fork from the `official on-modify.timewarrior hook`_. - -.. _`official on-modify.timewarrior hook`: - https://github.com/GothenburgBitFactory/timewarrior/blob/dev/ext/on-modify.timewarrior -""" - -from sys import stdin -from os import system -from json import loads, dumps - -# Make no changes to the task, simply observe. -old = loads(stdin.readline()) -new = loads(stdin.readline()) -print(dumps(new)) - -# Extract attributes for use as tags. -tags = [new["description"]] - -if "project" in new: - project = new["project"] - tags.append(project) - if "." in project: - tags.extend([tag for tag in project.split(".")]) - -if "tags" in new: - tags.extend(new["tags"]) - -combined = " ".join(["'%s'" % tag for tag in tags]).encode("utf-8").strip() - -# Task has been started. -if "start" in new and not "start" in old: - system("timew start " + combined.decode() + " :yes") - -# Task has been stopped. -elif not "start" in new and "start" in old: - system("timew stop " + combined.decode() + " :yes") - -# Any task that is active, with a non-pending status should not be tracked. -elif "start" in new and new["status"] != "pending": - system("timew stop " + combined.decode() + " :yes") diff --git a/snowblocks/taskwarrior/hooks/on-modify-track-total-active-time.py b/snowblocks/taskwarrior/hooks/on-modify-track-total-active-time.py deleted file mode 100755 index c3332a3..0000000 --- a/snowblocks/taskwarrior/hooks/on-modify-track-total-active-time.py +++ /dev/null @@ -1,135 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# Copyright (C) 2016-present Arctic Ice Studio -# Copyright (C) 2016-present Sven Greb - -# Project: igloo -# Repository: https://github.com/arcticicestudio/igloo -# License: MIT -# References: -# https://taskwarrior.org/docs -# task(1) - -"""A Taskwarrior hook to track the total active time of a task. - -The tracked time is stored in a UDA task duration attribute named ``totalactivetime`` of type ``duration`` holding the total number of seconds the task was -active. The tracked time can then be included in any report by adding the ``totalactivetime`` column. - -By default, this plugin allows to have one task active at a time. This can be changed by setting ``max_active_tasks`` in ``.taskrc`` to a value greater than -``1``. - -Note: - This hook requires Python 3 and the `taskw`_ package to be installed which provides the python bindings for Taskwarrior! - Also note that this hook is only compatible with Taskwarrior version greater or equal to 2.4! - -This hook is a fork from `kostajh/taskwarrior-time-tracking-hook`_ - -.. _taskw: - https://pypi.python.org/pypi/taskw -.. _kostajh/taskwarrior-time-tracking-hook: - https://github.com/kostajh/taskwarrior-time-tracking-hook -""" - -import datetime -import json -import re -import sys -import subprocess -from taskw import TaskWarrior -from typing import TypeVar - -TIME_FORMAT = "%Y%m%dT%H%M%SZ" -UDA_KEY = "totalactivetime" - -w = TaskWarrior() -config = w.load_config() -if "max_active_tasks" in config: - MAX_ACTIVE = int(config["max_active_tasks"]) -else: - MAX_ACTIVE = 1 - -"""Compiled regular expression for the duration as ISO-8601 formatted string.""" -ISO8601DURATION = re.compile("P((\d*)Y)?((\d*)M)?((\d*)D)?T((\d*)H)?((\d*)M)?((\d*)S)?") - -"""The duration type either as integer (in seconds), as ISO-8601 formatted string ("PT1H10M31S") or the seconds suffixed with "seconds".""" -DurationType = TypeVar("DurationType", str, int) - - -def duration_str_to_time_delta(duration_str: DurationType) -> datetime.timedelta: - """Converts duration string into a timedelta object. - - :param duration_str: The duration - :return: The duration as timedelta object - """ - if duration_str.startswith("P"): - match = ISO8601DURATION.match(duration_str) - if match: - year = match.group(2) - month = match.group(4) - day = match.group(6) - hour = match.group(8) - minute = match.group(10) - second = match.group(12) - value = 0 - if second: - value += int(second) - if minute: - value += int(minute) * 60 - if hour: - value += int(hour) * 3600 - if day: - value += int(day) * 3600 * 24 - if month: - # Assume a month is 30 days for now. - value += int(month) * 3600 * 24 * 30 - if year: - # Assume a year is 365 days for now. - value += int(year) * 3600 * 24 * 365 - else: - value = int(duration_str) - elif duration_str.endswith("seconds"): - value = int(duration_str.rstrip("seconds")) - else: - value = int(duration_str) - return datetime.timedelta(seconds=value) - - -def main(): - original = json.loads(sys.stdin.readline()) - modified = json.loads(sys.stdin.readline()) - - # An active task has just been started. - if "start" in modified and "start" not in original: - # Prevent this task from starting if "task +ACTIVE count" is greater than "MAX_ACTIVE". - p = subprocess.Popen(["task", "+ACTIVE", "status:pending", "count", "rc.verbose:off"], stdout=subprocess.PIPE) - out, err = p.communicate() - count = int(out.rstrip()) - if count >= MAX_ACTIVE: - print("Only %d task(s) can be active at a time. " - "See 'max_active_tasks' in .taskrc." % MAX_ACTIVE) - sys.exit(1) - - # An active task has just been stopped. - if "start" in original and "start" not in modified: - # Calculate the elapsed time. - start = datetime.datetime.strptime(original["start"], TIME_FORMAT) - end = datetime.datetime.utcnow() - - if UDA_KEY not in modified: - modified[UDA_KEY] = 0 - - this_duration = (end - start) - total_duration = (this_duration + duration_str_to_time_delta(str(modified[UDA_KEY]))) - print("Total Time Tracked: %s (%s in this instance)" % (total_duration, this_duration)) - modified[UDA_KEY] = str(int(total_duration.days * (60 * 60 * 24) + total_duration.seconds)) + "seconds" - - return json.dumps(modified, separators=(",", ":")) - - -def cmdline(): - sys.stdout.write(main()) - - -if __name__ == "__main__": - cmdline() diff --git a/snowblocks/taskwarrior/nord.theme b/snowblocks/taskwarrior/nord.theme deleted file mode 100644 index 9399a8a..0000000 --- a/snowblocks/taskwarrior/nord.theme +++ /dev/null @@ -1,100 +0,0 @@ -# Copyright (C) 2016-present Arctic Ice Studio -# Copyright (C) 2016-present Sven Greb - -# Project: igloo -# Repository: https://github.com/arcticicestudio/igloo -# License: MIT -# References: -# https://taskwarrior.org/docs/themes.html -# task-color(5) -# taskrc(5) - -rule.precedence.color=deleted,completed,active,keyword.,tag.,project.,overdue,scheduled,due.today,due,blocked,blocking,recurring,tagged,uda. - -#+---------+ -#+ General + -#+---------+ -color.label= -color.label.sort= -color.alternate= -color.header=bold blue -color.footnote=cyan -color.warning=bold black on yellow -color.error=bold white on red -color.debug=magenta - -#+-------------+ -#+ Task States + -#+-------------+ -color.completed=green -color.deleted=red -color.active=bold black on cyan -color.recurring= -color.scheduled=white on black -color.until=white on bright black -color.blocked=yellow on black -color.blocking=bold yellow on black - -#+----------+ -#+ Projects + -#+----------+ -color.project.none= - -#+----------+ -#+ Priority + -#+----------+ -color.uda.priority.H=bold cyan -color.uda.priority.M=bold blue -color.uda.priority.L=bold black - -#+------+ -#+ Tags + -#+------+ -color.tag.next= -color.tag.none= -color.tagged= - -#+-----+ -#+ Due + -#+-----+ -color.due=blue -color.due.today=cyan on black -color.overdue=bold red - -#+---------+ -#+ Reports + -#+---------+ -color.burndown.done=bold black on cyan -color.burndown.pending=black on bright cyan -color.burndown.started=black on blue - -color.history.add=bold black on blue -color.history.delete=bright white on bold black -color.history.done=bold black on cyan - -color.summary.background=bright white on black -color.summary.bar=black on cyan - -#+----------+ -#+ Calendar + -#+----------+ -color.calendar.due=bold black on blue -color.calendar.due.today=bold black on cyan -color.calendar.holiday=bold blue on white -color.calendar.overdue=white on red -color.calendar.today=bold black on cyan -color.calendar.weekend=bright white on bright black -color.calendar.weeknumber=bold black - -#+-----------------+ -#+ Synchronization + -#+-----------------+ -color.sync.added=green -color.sync.changed=yellow -color.sync.rejected=red - -#+------+ -#+ Undo + -#+------+ -color.undo.after=green -color.undo.before=red diff --git a/snowblocks/taskwarrior/scripts/open-note.sh b/snowblocks/taskwarrior/scripts/open-note.sh deleted file mode 100755 index 4c05e7d..0000000 --- a/snowblocks/taskwarrior/scripts/open-note.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (C) 2016-present Arctic Ice Studio -# Copyright (C) 2016-present Sven Greb - -# Project: igloo -# Repository: https://github.com/arcticicestudio/igloo -# License: MIT -# References: -# https://taskwarrior.org/docs -# https://taskwarrior.org/docs/terminology.html#regex -# taskrc(5) -# task(1) -# https://en.wikibooks.org/wiki/Regular_Expressions/POSIX-Extended_Regular_Expressions - -set -e - -cleanup() { - unset -f log_error validate_parameter get_task_uuid open_notes -} - -log_error() { - printf "\e[31m%s\e[0m\n" "✖ $*" 1>&2 -} - -validate_parameter() { - if [ $# -eq 0 ]; then - log_error "No task IDs specified!" - exit 1 - fi - - local VALID_NUMBER_REGEX="^[0-9]+$" - if ! [[ $1 =~ $VALID_NUMBER_REGEX ]]; then - log_error "Invalid parameter '$1': parameters must be of type number!" - exit 1 - fi -} - -get_task_uuid() { - local task_id=$1 - local uuid="$(task _get $task_id.uuid)" - if [ -z $uuid ]; then - log_error "No task found with for specified ID '$task_id'!" - exit 1 - fi - printf "$uuid" -} - -open_notes() { - declare -a local task_uuids - local task_uuid - local note_path="~/.task/notes" - local editor_cmd="code --add --resue-window" - local note_file_ext="md" - - for task_id in $@; do - validate_parameter $task_id - task_uuid="$(get_task_uuid $task_id)" - if ! [ -z $task_uuid ]; then - $editor_cmd "$note_path/$task_uuid.$note_file_ext" - fi - done -} - -trap 'printf "User aborted.\n" && exit 1' SIGINT SIGTERM -trap cleanup EXIT - -open_notes $@ -exit 0 diff --git a/snowblocks/taskwarrior/snowblock.json b/snowblocks/taskwarrior/snowblock.json deleted file mode 100644 index a4db914..0000000 --- a/snowblocks/taskwarrior/snowblock.json +++ /dev/null @@ -1,41 +0,0 @@ -[ - { - "clean": ["~", "~/.task"] - }, - { - "link": { - "~/.taskrc": { - "force": true, - "hosts": { - "iceowl": "taskrc", - "igloo": "taskrc" - } - }, - "~/.taskopenrc": { - "force": true, - "hosts": { - "iceowl": "taskopenrc", - "igloo": "taskopenrc" - } - }, - "~/.task/nord.theme": { - "create": true, - "force": true, - "hosts": { - "iceowl": "nord.theme", - "igloo": "nord.theme" - } - }, - "~/.task/hooks": { - "create": true, - "force": true, - "path": "hooks" - }, - "~/.task/scripts": { - "create": true, - "force": true, - "path": "scripts" - } - } - } -] diff --git a/snowblocks/taskwarrior/taskopenrc b/snowblocks/taskwarrior/taskopenrc deleted file mode 100644 index a7e4794..0000000 --- a/snowblocks/taskwarrior/taskopenrc +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (C) 2016-present Arctic Ice Studio -# Copyright (C) 2016-present Sven Greb - -# Project: igloo -# Repository: https://github.com/arcticicestudio/igloo -# License: MIT -# References: -# https://github.com/ValiValpas/taskopen -# taskopenrc(5) -# taskopen(1) - -#+------+ -#+ Core + -#+------+ -NOTES_FOLDER="~/.task/notes/" -NOTES_EXT=".md" -NOTES_CMD="code --add --reuse-window ~/.task/notes/$UUID.md" - -PATH_EXT=/usr/share/taskopen/scripts diff --git a/snowblocks/taskwarrior/taskrc b/snowblocks/taskwarrior/taskrc deleted file mode 100644 index 07dd694..0000000 --- a/snowblocks/taskwarrior/taskrc +++ /dev/null @@ -1,92 +0,0 @@ -# Copyright (C) 2016-present Arctic Ice Studio -# Copyright (C) 2016-present Sven Greb - -# Project: igloo -# Repository: https://github.com/arcticicestudio/igloo -# License: MIT -# References: -# https://taskwarrior.org/docs -# https://taskwarrior.org/docs/terminology.html#regex -# taskrc(5) -# task(1) -# https://en.wikibooks.org/wiki/Regular_Expressions/POSIX-Extended_Regular_Expressions - -#+------+ -#+ Core + -#+------+ -data.location=~/.task - -complete.all.tags=true -default.command=stat -editor=vim -list.all.projects=true -list.all.tags=true -max_active_tasks=20 -regex=true -weekstart=Monday - -#+----+ -#+ UI + -#+----+ -include ~/.task/nord.theme -color=true - -#+---------+ -#+ Context + -#+---------+ -context.aur=project:aur -context.cckey=project:cckey -context.icecore=project:icecore -context.icepick=project:icepick -context.igloo=project:igloo -context.job=+job -context.lumio=project:lumio -context.nord=project:nord -context.nord-docs=project:nord-docs -context.northem=project:northem -context.private=+private -context.snowsaw=project:snowsaw -context.styleguide=project:styleguide - -#+-----+ -#+ UDA + -#+-----+ -uda.assignee.type=string -uda.assignee.label=Assignee -uda.assignee.values=arcticicestudio,svengreb,arcticfrostgaming, -uda.assignee.default= - -uda.estimate.type=string -uda.estimate.label=Size Estimate -uda.estimate.values=huge,large,medium,small,trivial, -uda.estimate.default= - -uda.ghi.type=numeric -uda.ghi.label=GitHub Issue -uda.ghi.default= - -uda.totalactivetime.type=duration -uda.totalactivetime.label=Total active time -uda.totalactivetime.values= - -#+---------+ -#+ Reports + -#+---------+ -report.stat.description=Optimized and extended status report -report.stat.columns=id,start.age,entry.age,totalactivetime,depends.indicator,priority,project,tags,recur.indicator,scheduled,scheduled.relative,due,due.relative,until.remaining,description.count,urgency -report.stat.labels=ID,Active,Age,Time,D,P,Project,Tags,R,Sch,,Due,,Until,Desc,Urg -report.stat.filter=status:pending -report.stat.sort=start-,due+,project+,urgency- - -#+---------+ -#+ Aliases + -#+---------+ -alias.a=add -alias.an=annotate -- Notes -alias.bd=burndown.daily -alias.cx=context -alias.e=edit -alias.ls=list -alias.mod=modify -alias.o=execute taskopen -alias.on=execute "$HOME/.task/scripts/open-note.sh" diff --git a/snowblocks/timewarrior/nord.theme b/snowblocks/timewarrior/nord.theme deleted file mode 100644 index da3c387..0000000 --- a/snowblocks/timewarrior/nord.theme +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright (C) 2016-present Arctic Ice Studio -# Copyright (C) 2016-present Sven Greb - -# Project: igloo -# Repository: https://github.com/arcticicestudio/igloo -# License: MIT -# References: -# https://taskwarrior.org/docs/timewarrior/themes.html -# timew(1) - -define theme: - description = "An arctic, north-bluish clean and elegant Timewarrior theme." - colors: - exclusion = "bold black" - today = "cyan" - holiday = "bold blue on white" - label = "bold white on black" - ids = "bold black on cyan" - debug = "magenta" - - # Rotating color palette for tags. - palette: - color01 = "bold black on cyan" - color02 = "bold black on bright cyan" - color03 = "bold black on blue" diff --git a/snowblocks/timewarrior/snowblock.json b/snowblocks/timewarrior/snowblock.json deleted file mode 100644 index 1cf3122..0000000 --- a/snowblocks/timewarrior/snowblock.json +++ /dev/null @@ -1,22 +0,0 @@ -[ - { - "clean": ["~/.timewarrior"] - }, - { - "link": { - "~/.timewarrior/timewarrior.cfg": { - "create": true, - "force": true, - "hosts": { - "iceowl": "timewarrior.cfg.iceowl", - "igloo": "timewarrior.cfg.igloo" - } - }, - "~/.timewarrior/nord.theme": { - "create": true, - "force": true, - "path": "nord.theme" - } - } - } -] diff --git a/snowblocks/timewarrior/timewarrior.cfg.iceowl b/snowblocks/timewarrior/timewarrior.cfg.iceowl deleted file mode 100644 index 726bcbf..0000000 --- a/snowblocks/timewarrior/timewarrior.cfg.iceowl +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (c) 2016-present Arctic Ice Studio -# Copyright (c) 2016-present Sven Greb - -# Project: igloo -# Repository: https://github.com/arcticicestudio/igloo -# License: MIT -# References: -# https://taskwarrior.org/docs/timewarrior -# timew(1) - -#+----+ -#+ UI + -#+----+ -import /Users/sgreb/.timewarrior/nord.theme -color = true - -#+---------+ -#+ Reports + -#+---------+ -define reports: - day: - lines = 10 - month = true - week = true diff --git a/snowblocks/timewarrior/timewarrior.cfg.igloo b/snowblocks/timewarrior/timewarrior.cfg.igloo deleted file mode 100644 index a93ad29..0000000 --- a/snowblocks/timewarrior/timewarrior.cfg.igloo +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (C) 2016-present Arctic Ice Studio -# Copyright (C) 2016-present Sven Greb - -# Project: igloo -# Repository: https://github.com/arcticicestudio/igloo -# License: MIT -# References: -# https://taskwarrior.org/docs/timewarrior -# timew(1) - -#+----+ -#+ UI + -#+----+ -import /home/arcticicestudio/.timewarrior/nord.theme -color = true - -#+---------+ -#+ Reports + -#+---------+ -define reports: - day: - lines = 10 - month = true - week = true