17 lines
343 B
Ruby
Executable file
17 lines
343 B
Ruby
Executable file
#!/usr/bin/env ruby
|
|
|
|
require 'socket'
|
|
|
|
eth0 = Socket.getifaddrs.find { |i| i.name == "eth0" && i.addr.ipv4? }
|
|
|
|
if Socket.gethostname.end_with? 'Vm'
|
|
status = "#S@#H|#{eth0.addr.ip_address}"
|
|
bg = 'colour24'
|
|
else
|
|
status = "#S"
|
|
bg = 'colour0'
|
|
end
|
|
|
|
|
|
system "tmux setw -g status-right \"#{status}\""
|
|
system "tmux setw -g status-bg '#{bg}'"
|