Skip to content

Goodness Suggestion #1

@meyersbs

Description

@meyersbs

I wrote this monster a few weeks ago. For any command that lasts longer than the defined THRESHOLD, make a pop-up notification including the PID and the command when it finishes. It seems like something that might be up your alley, so I figured I'd share.

    ICON=/usr/share/icons/Numix-Circle/48/apps/terminal-tango.svg
    THRESHOLD=5
    trap '_start=$SECONDS' DEBUG
    PROMPT_COMMAND='(if (( SECONDS - _start > $THRESHOLD )); then
        hist1=$(echo $(history 1) | cut -d " " -f1)
        hist2=$(echo $(history 1) | cut -d " " -f2-)
        notify-send --icon=$ICON "$(echo -e Finished!\\nPID: ${hist1}\\nCommand: ${hist2})"; fi)'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions