Enable UWSM for Hyprland and tie Waybar to session

This commit is contained in:
2026-02-04 12:13:15 -08:00
parent b1c1cf9ddc
commit de64062078

View File

@@ -4,29 +4,19 @@ makeEnable config "myModules.hyprland" true {
enable = true; enable = true;
# Use Hyprland from the flake for proper plugin compatibility # Use Hyprland from the flake for proper plugin compatibility
package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland; package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland;
# Let UWSM manage the Hyprland session targets
withUWSM = true;
}; };
home-manager.sharedModules = [ home-manager.sharedModules = [
{ {
xdg.configFile."waybar" = {
source = ../dotfiles/config/waybar;
recursive = true;
force = true;
};
programs.waybar.enable = true; programs.waybar.enable = true;
systemd.user.targets.hyprland-session = {
Unit = {
Description = "Hyprland session";
};
};
systemd.user.services.waybar = { systemd.user.services.waybar = {
Unit = { Unit = {
Description = "Waybar"; Description = "Waybar";
PartOf = [ "hyprland-session.target" ]; PartOf = [ "wayland-session@Hyprland.target" ];
After = [ "hyprland-session.target" ]; After = [ "wayland-session@Hyprland.target" ];
}; };
Service = { Service = {
ExecStartPre = "${pkgs.bash}/bin/bash -lc 'uid=$(id -u); for i in $(seq 1 50); do runtime_dir=\"$XDG_RUNTIME_DIR\"; if [ -z \"$runtime_dir\" ]; then runtime_dir=\"/run/user/$uid\"; fi; if [ -n \"$WAYLAND_DISPLAY\" ] && [ -S \"$runtime_dir/$WAYLAND_DISPLAY\" ]; then exit 0; fi; sleep 0.1; done; exit 1'"; ExecStartPre = "${pkgs.bash}/bin/bash -lc 'uid=$(id -u); for i in $(seq 1 50); do runtime_dir=\"$XDG_RUNTIME_DIR\"; if [ -z \"$runtime_dir\" ]; then runtime_dir=\"/run/user/$uid\"; fi; if [ -n \"$WAYLAND_DISPLAY\" ] && [ -S \"$runtime_dir/$WAYLAND_DISPLAY\" ]; then exit 0; fi; sleep 0.1; done; exit 1'";
@@ -35,11 +25,9 @@ makeEnable config "myModules.hyprland" true {
RestartSec = 1; RestartSec = 1;
}; };
Install = { Install = {
WantedBy = [ "hyprland-session.target" ]; WantedBy = [ "wayland-session@Hyprland.target" ];
}; };
}; };
programs.hyprpanel.enable = false;
} }
]; ];
@@ -51,6 +39,7 @@ makeEnable config "myModules.hyprland" true {
hyprlock # Screen locker hyprlock # Screen locker
hyprcursor # Cursor themes hyprcursor # Cursor themes
wl-clipboard # Clipboard for Wayland wl-clipboard # Clipboard for Wayland
wtype # Wayland input typing
cliphist # Clipboard history cliphist # Clipboard history
grim # Screenshot utility grim # Screenshot utility
slurp # Region selection slurp # Region selection