Last active
May 14, 2019 10:58
-
-
Save laerreal/4ee3b4107409f3df408dfeb6b9245786 to your computer and use it in GitHub Desktop.
Tcl/Tk GUI for sha1sum
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#\ | |
exec wish "$0" "$@" | |
wm title . "sha1sum front-end" | |
for {set i 0} {$i < $argc} {incr i} { | |
set file [lindex $argv $i] | |
# label ".lab$i" -text "Computing SHA1 of $file..." | |
global "var$i" | |
set "var$i" "Computing SHA1 of $file..." | |
entry ".lab$i" -state readonly -textvariable "var$i" -width [string length [set "var$i"]] | |
pack ".lab$i" -fill x -side top | |
set io "sha1io$i" | |
set $io [open "|sha1sum $file" r] | |
fconfigure [set $io] -blocking false | |
set update_code " | |
global var$i | |
# puts \"Update\" | |
set read \[gets [set $io] sha1\] | |
# puts \$read | |
if {\$read > 0} { | |
# puts \"\$sha1\" | |
# .lab$i configure -text \"\$sha1\" | |
set var$i \"\$sha1\" | |
.lab$i configure -width \$read | |
} else { | |
after 100 update$i | |
} | |
" | |
# puts $update_code | |
proc "update$i" {} $update_code | |
after 100 "update$i" | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Designed to be a Nautilus script (
$HOME/.local/share/nautilus/scripts
).It can be applied to set of selected files.