Browse Source

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.
master
John Mertz 11 months ago
parent
commit
627ee855a7
  1. 12
      sway/displays.pl

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

Loading…
Cancel
Save