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
父節點 a92d475e60
當前提交 627ee855a7
共有 1 個文件被更改,包括 4 次插入8 次删除

查看文件

@ -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`;
}