sleek icon indicating copy to clipboard operation
sleek copied to clipboard

Undo function

Open Evgheni-E opened this issue 3 years ago • 7 comments

Hi! Would it be possible to add an undo button? Especially when I accidentally clicked complete, I would really appreciate such a function to bring the task backe where it was.

Thanks in advance! <3

Evgheni-E avatar May 10 '21 11:05 Evgheni-E

Along with a CTRL+Z shortcut 😉

IgnacioHeredia avatar Mar 11 '22 15:03 IgnacioHeredia

This is an automated response. We acknowledge your report, and we appreciate your engagement. However, as there has been no recent activity in this thread, it has been marked as stale. If you have any further feedback or if the matter is still relevant, please do not hesitate to respond. Otherwise, this thread will be automatically closed in 15 days from now.

github-actions[bot] avatar Sep 03 '23 19:09 github-actions[bot]

Still think this is relevant.

IgnacioHeredia avatar Sep 03 '23 21:09 IgnacioHeredia

Since sleek is not incorporating a database I think the only really viable option here is to let sleek create one or more backups of the todo file, every time something changes. So that Ctrl + Z will restore the contents of the last backed up file.

But since the issue doesn't really provide a lot of detail on what is expected, it would be just me guessing, if this solution would be of value.

This would of course only restore contents of the file, not changes of settings or anything like that.

ransome1 avatar Dec 07 '23 18:12 ransome1

I think a single backup would be fine. So anytime you have the current state and the previous state. In this way, if you mark by error something as completed you can undo that change. Personally I have never experienced the need to perform more than a single undo.

Anyway @ransome1 , at the end of the day, it's up to you to decide. If this adds to much complexity to the codebase, maybe it's not worth the effort to add it. Just thought it could be a nice small feature to have.

IgnacioHeredia avatar Dec 11 '23 10:12 IgnacioHeredia

Tip for users finding this: for now, as a workaround, you could create a simple launcher shell script that creates a backup and then opens Sleek, so you can always manually revert changes or view the older todo file in a text editor. You can add this script as a launcher to your desktop environment's panel (taskbar).

Remember to chmod +x the script, and adjust the sleek= and todofile= variables to your liking.

Example:

#!/bin/sh
scriptname="$(basename "$0")"

sleek="$HOME/Programs/sleek-2.0.6.AppImage"
todofile="$HOME/Documents/todo.txt"

main() {
    if ! cp -a "$todofile" "$todofile.bak"; then
        message="$scriptname: failed to create a todo backup"
        echo "ERROR: $message" >&2
        zenity --error --text "$message"
    else
        exec nohup "$sleek" >/dev/null 2>&1 &
    fi
}

main "$@"

bughunter2 avatar Jan 18 '24 00:01 bughunter2