#!/bin/bash # restart with wish \ exec wish "$0" "$@" # tkgamma # Simple front end to xgamma proc SetGamma {g} { global gamma # well, I have to catch this, but otherwise it works ! catch {exec xgamma -gamma [expr double($g)/50]} set gamma "[format %3i $g]" } proc Drag {} { wm geometry . +[expr [winfo pointerx .] - 13]+[expr [winfo pointery .] - 10] # update } ### main ### set arg1 [lindex $argv 0] if {"$arg1" != "" } { puts stderr {tkgamma: no args accepted} } # xgamma sends to stderr !^%$ wm title . "Tkgamma" # wm overrideredirect . 1 wm resizable . 0 0 # supposing gamma is 0 to 3.0 scale that to 100 by * 3 # supposing gamma is 0 to 2.0 scale that to 100 by * 2 set gamma [expr int ([lindex [exec xgamma |& cat] 6] * 50)] # wish 8.4 doesn't properly honor scale reliefs on linux. 8.5 does # we have to use ints for the scale, as otherwise the scale widget is alwyas mouthing off scale .s -from 1 -to 100 -orient h -length 100 -showvalue False \ -sliderlength 20 -command SetGamma -resolution 5 -showvalue 0 \ -variable gamma label .l -textvariable gamma -font {Courier 10} .s set $gamma pack .s -side right pack .l -side left bind . {destroy .} bind . {lower .} bind . {SetGamma 50} bind . {incr gamma -5 ; SetGamma $gamma} bind . {incr gamma 5 ; SetGamma $gamma} bind .l "Drag" bind .l "Drag"