Display current task (if one)
This commit is contained in:
parent
fad526e2ca
commit
56628a8d0f
51
rofi-task.sh
51
rofi-task.sh
|
@ -7,14 +7,51 @@
|
||||||
black="#000000"
|
black="#000000"
|
||||||
blue="#0094cc"
|
blue="#0094cc"
|
||||||
|
|
||||||
# Display pending tasks list and get title from the choosen one
|
is_task_running() { # {{{
|
||||||
TITLE=$(task status:pending export | jq -r 'sort_by( -.urgency )[] | [ (.id|tostring), .description ] | join(" ")' |
|
|
||||||
rofi -location 2 -no-auto-select -i -dmenu -p "Task" -color-enabled -color-normal "${black},${blue},${black},${blue},${black}" -color-window "${black},${black}" |
|
|
||||||
cut --delimiter=" " --field=2)
|
|
||||||
|
|
||||||
[ -z "${TITLE}" ] && echo "Cancelled." && exit 0
|
if task active >/dev/null 2>&1; then
|
||||||
|
return_is_task_running="0"
|
||||||
|
else
|
||||||
|
return_is_task_running="1"
|
||||||
|
fi
|
||||||
|
|
||||||
# Start task with pomodorrior script (task end after 25 minutes)
|
return "${return_is_task_running:=/dev/null}"
|
||||||
pomodorrior "${TITLE}" && exit 0
|
}
|
||||||
|
# }}}
|
||||||
|
display_current_task() { # {{{
|
||||||
|
|
||||||
|
## Display active tasks list and get title from the choosen one
|
||||||
|
TITLE=$(task +ACTIVE export | jq -r 'sort_by( -.urgency )[] | [ (.id|tostring), .description ] | join(" ")' |
|
||||||
|
rofi -location 2 -lines 3 -no-auto-select -i -dmenu -p "RUNNING task(s)" -color-enabled -color-normal "${blue},${black},${blue},${black},${blue}" -color-window "${blue},${blue}" |
|
||||||
|
cut --delimiter=" " --field=2)
|
||||||
|
|
||||||
|
}
|
||||||
|
# }}}
|
||||||
|
select_task() { # {{{
|
||||||
|
## Display pending tasks list and get title from the choosen one
|
||||||
|
TITLE=$(task status:pending export | jq -r 'sort_by( -.urgency )[] | [ (.id|tostring), .description ] | join(" ")' |
|
||||||
|
rofi -location 2 -no-auto-select -i -dmenu -p "Task" -color-enabled -color-normal "${black},${blue},${black},${blue},${black}" -color-window "${black},${black}" |
|
||||||
|
cut --delimiter=" " --field=2)
|
||||||
|
|
||||||
|
[ -z "${TITLE}" ] && echo "Cancelled." && exit 0
|
||||||
|
|
||||||
|
## Start task with pomodorrior script (task end after 25 minutes)
|
||||||
|
pomodorrior "${TITLE}" && exit 0
|
||||||
|
}
|
||||||
|
# }}}
|
||||||
|
|
||||||
|
main() { # {{{
|
||||||
|
|
||||||
|
is_task_running \
|
||||||
|
&& display_current_task \
|
||||||
|
&& exit 0
|
||||||
|
|
||||||
|
select_task \
|
||||||
|
&& exit 0
|
||||||
|
|
||||||
|
}
|
||||||
|
# }}}
|
||||||
|
|
||||||
|
main
|
||||||
|
|
||||||
exit 255
|
exit 255
|
||||||
|
|
Loading…
Reference in New Issue