Taskw: Fix command to stop a task
This commit is contained in:
parent
b4fb94963a
commit
6a58b9fa9f
|
@ -33,6 +33,7 @@ display_current_task() { # {{{
|
||||||
## Display active tasks list and get title from the choosen one
|
## Display active tasks list and get title from the choosen one
|
||||||
TITLE=$(rofi -location 2 -lines 5 -no-auto-select -i -dmenu -p "RUNNING task(s)" -color-enabled -color-normal "${blue},${black},${blue},${black},${blue}" -color-window "${blue},${blue}" < "${TASKW_CURRENT_LIST}" |
|
TITLE=$(rofi -location 2 -lines 5 -no-auto-select -i -dmenu -p "RUNNING task(s)" -color-enabled -color-normal "${blue},${black},${blue},${black},${blue}" -color-window "${blue},${blue}" < "${TASKW_CURRENT_LIST}" |
|
||||||
cut --delimiter=" " --field=2)
|
cut --delimiter=" " --field=2)
|
||||||
|
ID=$(task "${TITLE}" simpleid | grep --after-context=2 -- ID | tail --lines=1 || return 0)
|
||||||
|
|
||||||
## Remove temp file
|
## Remove temp file
|
||||||
rm --force -- "${TASKW_CURRENT_LIST}"
|
rm --force -- "${TASKW_CURRENT_LIST}"
|
||||||
|
@ -40,6 +41,9 @@ display_current_task() { # {{{
|
||||||
## If no task was selected (empty var) then exit
|
## If no task was selected (empty var) then exit
|
||||||
[ -z "${TITLE}" ] && echo "Cancelled." && exit 0
|
[ -z "${TITLE}" ] && echo "Cancelled." && exit 0
|
||||||
|
|
||||||
|
## If no ID was found (empty var) then exit
|
||||||
|
[ -z "${ID}" ] && echo "Cancelled." && exit 0
|
||||||
|
|
||||||
## Kill any pomodorrior process running for the current task
|
## Kill any pomodorrior process running for the current task
|
||||||
pkill --full -- "${TITLE}"
|
pkill --full -- "${TITLE}"
|
||||||
|
|
||||||
|
@ -47,7 +51,7 @@ display_current_task() { # {{{
|
||||||
pkill --full -- "sleep 60"
|
pkill --full -- "sleep 60"
|
||||||
|
|
||||||
## Stop the selected task and exit
|
## Stop the selected task and exit
|
||||||
task "${TITLE}" stop >/dev/null && exit 0
|
task "${ID}" stop >/dev/null && exit 0
|
||||||
}
|
}
|
||||||
# }}}
|
# }}}
|
||||||
select_task() { # {{{
|
select_task() { # {{{
|
||||||
|
|
Loading…
Reference in New Issue