lesgrieve / lockunlock

macOS script to display log in/out time
Apache License 2.0
11 stars 1 forks source link

Bug: Foreground Color stays on either green or red after finishing #1

Closed keenonkites closed 3 years ago

keenonkites commented 3 years ago

Nice little script. Good for 'timetracking' in the HomeOffice. Thanks.

Have a small issue: when the script finishes, the output color for further commands in this terminal window stays on green instead of reseting back to original color. Adding 'tput sgr0' as the very last line in the script solved the issue for me. This resets the text format to the terminals default.

I'm quite sure there is a nicer way to do this (reseting only text color, for example) but it works for me.

Cheers

lesgrieve commented 3 years ago

I never noticed this because my prompt (PS1) is set to "[\033[36m]\u[\033[m]@[\033[32m]\h:[\033[33;1m]\w[\033[m]\$ " which sets the colour every time. The solution is to reset the colour with printf "\033[0m". Thank you for pointing it out.

lesgrieve commented 3 years ago

Fixed with https://github.com/lesgrieve/lockunlock/commit/dc4c87c182300cac7d5b9164b91ef88138d23901

keenonkites commented 3 years ago

Thanks for the fix. Confirmed, works now. Definitely nicer than my hack.