Dump waybar config to semi-permanent destination

Since a previous change combined all displays into a single file, it is
no longer necessary to create many temporary configs. The latest config
can just be dumped to the standard path so that running `waybar` on it's
own will load it.
This commit is contained in:
John Mertz 2021-08-11 18:05:30 -04:00 committed by John Mertz
parent c5d8ade430
commit 77db7f3640
Signed by: jpm
GPG Key ID: E9C5EA2D867501AB
1 changed files with 4 additions and 8 deletions

View File

@ -30,8 +30,8 @@
# "width": __WIDTH__ (optional)
my $waybar_template = "$ENV{'HOME'}/.config/waybar/config.template";
# Temporary directory to save generated waybar config(s)
my $waybar_temporary = '/tmp';
# Path to actual config file generated from template
my $waybar_config = "$ENV{'HOME'}/.config/waybar/config";
# File to log and recover last used layout name
my $last = "$ENV{'HOME'}/.config/last_display";
@ -382,12 +382,8 @@ unless ($pid) {
open STDOUT, '>>/dev/null';
open STDERR, '>>/dev/null';
# Write config to a temporary file
my $tmp = $waybar_temporary . "/waybar-" . time() .".config";
open ($fh, '>', $tmp);
open ($fh, '>', $waybar_config);
print $fh $waybar;
close $fh;
`nohup waybar --config=$tmp >> waybar.log`;
# Remove config
unlink $tmp;
`nohup waybar --config=$waybar_config >> waybar.log`;
}