summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2023-02-01 11:49:30 -0700
committerSean Whitton <spwhitton@spwhitton.name>2023-02-01 12:10:59 -0700
commit89bd8c53433e11e701a04e687e3a5b41148114ca (patch)
tree093ededb4385023788364f9042e772c256dab1a9
parent14873d2c0083cd4ed340dc1f63c31030d3e020e0 (diff)
downloadpapersway-89bd8c53433e11e701a04e687e3a5b41148114ca.tar.gz
i3status-wrapper: prepare the hostinfo block once
-rwxr-xr-xscripts/desktop/i3status-wrapper5
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";
}