Skip to content

Instantly share code, notes, and snippets.

@anxiousmodernman
Last active April 13, 2018 19:43
Show Gist options
  • Save anxiousmodernman/e1586454c63e78116e8fd30185f1873a to your computer and use it in GitHub Desktop.
Save anxiousmodernman/e1586454c63e78116e8fd30185f1873a to your computer and use it in GitHub Desktop.
Tcl update alacritty config
#!/usr/bin/env tclsh
set timestamp [clock format [clock seconds] -format {%Y%m%d%H%M%S}]
set newOpacity [lindex $argv 0]
puts "got arg: $newOpacity" # check args
if {[string is integer $newOpacity] == 0} {
puts "You must pass an integer value for opacity"
exit 1
}
set filename "~/.config/alacritty/alacritty.yml"
set temp $filename.new.$timestamp
set backup $filename.bak.$timestamp
set in [open $filename r]
set out [open $temp w]
while {[gets $in line] != -1} {
if {[string match background_opacity* $line] == 1} {
set line "background_opacity: 0.$newOpacity"
puts $line
}
puts $out $line
}
close $in
close $out
file rename -force $temp $filename
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment