diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2023-02-01 11:49:30 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2023-02-01 12:10:59 -0700 |
commit | a420066aaae0d4a5d1804673d823ca49dd4f2503 (patch) | |
tree | 9eefe6040712a51895ec63e509bfa64a5c55ecfd /scripts | |
parent | d4911881471dec9cbf3c5b1b6e39a989ceceb638 (diff) | |
download | dotfiles-a420066aaae0d4a5d1804673d823ca49dd4f2503.tar.gz |
i3status-wrapper: prepare the hostinfo block once
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/desktop/i3status-wrapper | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/desktop/i3status-wrapper b/scripts/desktop/i3status-wrapper index 0f8f96ec..665630b3 100755 --- a/scripts/desktop/i3status-wrapper +++ b/scripts/desktop/i3status-wrapper @@ -115,6 +115,8 @@ open STDIN, "<&=", $pipe->fileno or die "couldn't reopen STDIN!"; my $hostname = hostname; my $username = $ENV{LOGNAME} || $ENV{USER} || getpwuid($<); +my $hostinfo + = { name => "hostinfo", full_text => $username . "@" . $hostname }; # Skip the first line which contains the version header. print scalar <>; @@ -137,8 +139,7 @@ while (my ($statusline) = (<> =~ /^,?(.*)/)) { full_text => "Caffeinated: " . $info{caffeinated_name} } if $info{caffeinated_name}; - unshift @$blocks, - { name => "hostinfo", full_text => $username . "@" . $hostname }; + unshift @$blocks, $hostinfo; print encode_json($blocks) . ",\n"; } |