2024-03-18 00:34:52 +01:00
|
|
|
{ pkgs, config, lib, ... }: let
|
|
|
|
cfg = config.grimmShared;
|
|
|
|
in {
|
|
|
|
config = let
|
|
|
|
build_definition_lines = lib.mapAttrsToList (name: value: "set \$${name} ${value}");
|
|
|
|
build_keybind_lines = lib.mapAttrsToList (key: value: "bindsym ${key} ${value}");
|
|
|
|
build_exec_lines = map (item: "exec " + item);
|
|
|
|
|
2024-03-21 16:03:56 +01:00
|
|
|
text = lib.strings.concatLines [
|
2024-03-18 00:34:52 +01:00
|
|
|
(lib.strings.concatLines (build_definition_lines cfg.sway.definitions))
|
|
|
|
(lib.strings.concatLines (build_keybind_lines cfg.sway.keybinds))
|
|
|
|
(lib.strings.concatLines (build_exec_lines cfg.sway.autolaunch))
|
|
|
|
cfg.sway.extraConfig
|
2024-03-21 16:03:56 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
sway_conf = pkgs.writeText "sway.conf" text;
|
2024-03-18 00:34:52 +01:00
|
|
|
in with cfg; lib.mkIf (enable && sway.enable) {
|
|
|
|
environment.etc."sway.conf" = {
|
|
|
|
source = sway_conf;
|
|
|
|
};
|
|
|
|
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
procps
|
|
|
|
slurp
|
|
|
|
libnotify
|
|
|
|
];
|
|
|
|
|
|
|
|
systemd.services.reload-sway = {
|
|
|
|
description = "Reload all running sway instances";
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
|
|
|
|
serviceConfig.Type = "oneshot";
|
|
|
|
script =''
|
|
|
|
for pid in $(${pkgs.procps}/bin/pgrep sway -x)
|
|
|
|
do
|
|
|
|
uid=$(id -u $(${pkgs.procps}/bin/ps -o user= -p $pid))
|
|
|
|
export SWAYSOCK="/run/user/$uid/sway-ipc.$uid.$pid.sock"
|
|
|
|
if [[ -e "$SWAYSOCK" ]] ; then
|
|
|
|
echo "sock is $SWAYSOCK"
|
|
|
|
${config.programs.sway.package}/bin/swaymsg reload
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
'';
|
2024-03-21 16:03:56 +01:00
|
|
|
reloadTriggers = [ text ];
|
2024-03-18 00:34:52 +01:00
|
|
|
};
|
|
|
|
|
2024-03-21 16:03:56 +01:00
|
|
|
programs.waybar.enable = true;
|
|
|
|
|
2024-03-18 00:34:52 +01:00
|
|
|
programs.sway = {
|
|
|
|
enable = true;
|
|
|
|
wrapperFeatures = {
|
|
|
|
gtk = true;
|
|
|
|
base = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
extraPackages = with pkgs; [
|
|
|
|
swaylock
|
|
|
|
swayidle
|
|
|
|
wl-clipboard
|
|
|
|
wf-recorder
|
|
|
|
dmenu
|
|
|
|
wmenu
|
|
|
|
];
|
|
|
|
extraOptions = [
|
|
|
|
"--unsupported-gpu"
|
|
|
|
"--config"
|
|
|
|
"/etc/sway.conf"
|
|
|
|
];
|
|
|
|
extraSessionCommands = ''
|
|
|
|
export XDG_CURRENT_DESKTOP=sway
|
|
|
|
export SDL_VIDEODRIVER=wayland
|
|
|
|
export QT_QPA_PLATFORM=wayland
|
|
|
|
export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
|
|
|
|
export _JAVA_AWT_WM_NONREPARENTING=1
|
|
|
|
export MOZ_ENABLE_WAYLAND=1
|
|
|
|
# export MESA_LOADER_DRIVER_OVERRIDE="zink"
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|