From 627ee855a74e527425261627fc83ff22002ccf94 Mon Sep 17 00:00:00 2001 From: John Mertz Date: Wed, 11 Aug 2021 18:05:30 -0400 Subject: [PATCH] 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. --- sway/displays.pl | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/sway/displays.pl b/sway/displays.pl index 739ca23..bee2afe 100755 --- a/sway/displays.pl +++ b/sway/displays.pl @@ -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`; }