diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-11-02 16:12:14 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-11-02 16:12:14 +0100 |
commit | e0fcf65c9e7ab50d1b524fb9a72d14724502a911 (patch) | |
tree | ea25343c5bca5acd6c86db614851ef190d4c1588 /.local/bin/mpview | |
parent | Renamed again (diff) | |
download | dotfiles-bsd-e0fcf65c9e7ab50d1b524fb9a72d14724502a911.tar.gz dotfiles-bsd-e0fcf65c9e7ab50d1b524fb9a72d14724502a911.tar.bz2 dotfiles-bsd-e0fcf65c9e7ab50d1b524fb9a72d14724502a911.tar.xz dotfiles-bsd-e0fcf65c9e7ab50d1b524fb9a72d14724502a911.tar.zst dotfiles-bsd-e0fcf65c9e7ab50d1b524fb9a72d14724502a911.zip |
linkview update
Diffstat (limited to '')
-rwxr-xr-x | .local/bin/mpview | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/.local/bin/mpview b/.local/bin/mpview index a66a75b..65fe97e 100755 --- a/.local/bin/mpview +++ b/.local/bin/mpview @@ -3,6 +3,7 @@ use strict; use warnings; use Scalar::Util qw(looks_like_number); +use Term::ReadKey; use Term::ANSIColor; sub get_size @@ -21,8 +22,18 @@ sub get_size "6) 1080\n" . "\n" . "> "; - $answer = <STDIN>; - if (!looks_like_number($answer) || $answer == 0 || $answer == 1 || $answer > 6) { + open(TTY, "</dev/tty"); + ReadMode "raw"; + $answer = ReadKey 0, *TTY; + ReadMode "normal"; + close(TTY); + print "\n"; + if ( + !looks_like_number($answer) || + $answer == 0 || + $answer == 1 || + $answer > 6 + ) { $size = 0; } elsif ($answer == 2) { |