Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Goodness Suggestion #1

Open
meyersbs opened this issue Feb 11, 2017 · 0 comments
Open

Goodness Suggestion #1

meyersbs opened this issue Feb 11, 2017 · 0 comments

Comments

@meyersbs
Copy link

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)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant