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 | 89bd8c53433e11e701a04e687e3a5b41148114ca (patch) | |
tree | 093ededb4385023788364f9042e772c256dab1a9 | |
parent | 14873d2c0083cd4ed340dc1f63c31030d3e020e0 (diff) | |
download | papersway-89bd8c53433e11e701a04e687e3a5b41148114ca.tar.gz |
i3status-wrapper: prepare the hostinfo block once
-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 0f8f96e..665630b 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"; } |