From 6a58b9fa9f0659196df11dddbf9ec04fd162e46f Mon Sep 17 00:00:00 2001 From: Gardouille Date: Wed, 13 Oct 2021 10:53:39 +0200 Subject: [PATCH] Taskw: Fix command to stop a task --- rofi-task.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rofi-task.sh b/rofi-task.sh index 996bae5..e74c203 100755 --- a/rofi-task.sh +++ b/rofi-task.sh @@ -33,6 +33,7 @@ display_current_task() { # {{{ ## 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}" | cut --delimiter=" " --field=2) + ID=$(task "${TITLE}" simpleid | grep --after-context=2 -- ID | tail --lines=1 || return 0) ## Remove temp file rm --force -- "${TASKW_CURRENT_LIST}" @@ -40,6 +41,9 @@ display_current_task() { # {{{ ## If no task was selected (empty var) then exit [ -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 pkill --full -- "${TITLE}" @@ -47,7 +51,7 @@ display_current_task() { # {{{ pkill --full -- "sleep 60" ## Stop the selected task and exit - task "${TITLE}" stop >/dev/null && exit 0 + task "${ID}" stop >/dev/null && exit 0 } # }}} select_task() { # {{{