summaryrefslogtreecommitdiff
path: root/scripts
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
commita420066aaae0d4a5d1804673d823ca49dd4f2503 (patch)
tree9eefe6040712a51895ec63e509bfa64a5c55ecfd /scripts
parentd4911881471dec9cbf3c5b1b6e39a989ceceb638 (diff)
downloaddotfiles-a420066aaae0d4a5d1804673d823ca49dd4f2503.tar.gz
i3status-wrapper: prepare the hostinfo block once
Diffstat (limited to 'scripts')
-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 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";
}