improve eww
This commit is contained in:
@@ -1,17 +1,10 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
# Close the bar if it's already open (wrong screen), then open on the target screen.
|
||||
# Must go through eww-ensure-daemon: this runs on every monitor hotplug, and a
|
||||
# bare `eww open` against a busy/dead socket spawns a second daemon, leaving the
|
||||
# first one's bar and popups on screen with no way to close them.
|
||||
moveOrOpenBar = screen: "${pkgs.writeShellScript "kanshi-eww-bar-${toString screen}" ''
|
||||
${pkgs.custom.eww-ensure-daemon}/bin/eww-ensure-daemon || exit 1
|
||||
|
||||
if ${pkgs.eww}/bin/eww active-windows 2>/dev/null | grep -qx "bar"; then
|
||||
${pkgs.eww}/bin/eww close bar
|
||||
fi
|
||||
${pkgs.eww}/bin/eww open bar --screen ${toString screen}
|
||||
''}";
|
||||
# Re-place the bar on the profile's main output. eww-bar waits for the
|
||||
# daemon (kanshi and eww.service start together at login), and resolves the
|
||||
# monitor by description on every hotplug, so the bar follows the profile
|
||||
# instead of a GDK monitor index that changes as outputs come and go.
|
||||
placeBar = screen: "${pkgs.custom.eww-bar}/bin/eww-bar place '${screen}'";
|
||||
|
||||
baseOutput = {
|
||||
position = "0,0";
|
||||
@@ -71,7 +64,7 @@ in {
|
||||
}
|
||||
];
|
||||
exec = [
|
||||
(moveOrOpenBar 0)
|
||||
(placeBar "desc:${aocB}")
|
||||
"${pkgs.writeShellScript "kanshi-hyprland-init" ''
|
||||
#!/usr/bin/env bash
|
||||
${pkgs.hyprland}/bin/hyprctl eval '
|
||||
@@ -127,8 +120,8 @@ in {
|
||||
|
||||
''}"
|
||||
"${pkgs.awww}/bin/awww restore"
|
||||
(moveOrOpenBar 0)
|
||||
];
|
||||
(placeBar "desc:${aocB}")
|
||||
];
|
||||
};}
|
||||
{profile = {
|
||||
name = "valinor00";
|
||||
@@ -156,8 +149,8 @@ in {
|
||||
|
||||
''}"
|
||||
"${pkgs.awww}/bin/awww restore"
|
||||
(moveOrOpenBar 0)
|
||||
];
|
||||
(placeBar "desc:Lenovo Group Limited")
|
||||
];
|
||||
};}
|
||||
];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user