nix-home/home/modules/linux/graphical/wayland.nix

112 lines
3.6 KiB
Nix
Raw Normal View History

2022-04-20 17:05:02 +00:00
{ pkgs, config, lib, ... }:
let
notificationModule = { config, pkgs, lib, ... }:
let
2023-12-01 21:05:54 +00:00
swaync = pkgs.swaynotificationcenter;
in
with lib; mkIf (config.linux.graphical.type == "wayland") {
2024-05-28 20:02:40 +00:00
services.swaync = {
enable = true;
settings.widgets = [ "inhibitors" "title" "dnd" "mpris" "notifications" ];
style = ./swaync.css;
};
2024-05-28 20:02:40 +00:00
systemd.user.services.swaync.Install.WantedBy = lib.mkForce [ "sway-session.target" ];
systemd.user.services.swaync.Unit.PartOf = lib.mkForce [ "sway-session.target" ];
programs.my-sway.waybar = {
extraSettings = {
modules-right = mkAfter [ "custom/swaync" ];
modules."custom/swaync" = {
tooltip = false;
format = "{icon} {}";
format-icons = {
notification = "<span foreground='red'><sup></sup></span>";
none = "";
dnd-notification = "<span foreground='red'><sup></sup></span>";
dnd-none = "";
inhibited-notification = "<span foreground='red'><sup></sup></span>";
inhibited-none = "";
dnd-inhibited-notification = "<span foreground='red'><sup></sup></span>";
dnd-inhibited-none = "";
};
return-type = "json";
# exec-if = "which swaync-client";
exec = "${swaync}/bin/swaync-client -swb";
on-click = "${swaync}/bin/swaync-client -t -sw";
on-click-right = "${swaync}/bin/swaync-client -d -sw";
escape = true;
};
};
extraStyle = mkAfter ''
#custom-swaync {
background: #F0FFFF;
color: #000000;
}
'';
};
};
2024-06-03 11:30:42 +00:00
plasmaModule = { pkgs, ... }: {
home.packages = with pkgs.kdePackages; [
discover
kmail
2024-06-03 23:35:29 +00:00
kontact
2024-06-03 11:30:42 +00:00
akonadi
kdepim-runtime
kmail-account-wizard
akonadi-import-wizard
];
# Not working yet, see #316784
xdg.configFile."plasma-workspace/env/wayland.sh".source = pkgs.writeScript "plasma-wayland-env.sh" ''
export NIXOS_OZONE_WL=1
'';
xdg.dataFile."dbus-1/services/org.freedesktop.Notifications.service".source = "${pkgs.kdePackages.plasma-workspace}/share/dbus-1/services/org.kde.plasma.Notifications.service";
};
in
2022-04-20 17:05:02 +00:00
with lib;
{
2024-06-03 11:30:42 +00:00
imports = [ notificationModule plasmaModule ];
2022-04-20 17:05:02 +00:00
config = mkIf (config.linux.graphical.type == "wayland") {
# Additional packages
home.packages = with pkgs; [
wl-clipboard # Clipboard management
# Mimic the clipboard stuff in MacOS
(pkgs.writeShellScriptBin "pbcopy" ''
2024-04-26 17:16:10 +00:00
exec ${pkgs.wl-clipboard}/bin/wl-copy "$@"
2022-04-20 17:05:02 +00:00
'')
(pkgs.writeShellScriptBin "pbpaste" ''
2024-04-26 17:16:10 +00:00
exec ${pkgs.wl-clipboard}/bin/wl-paste "$@"
2022-04-20 17:05:02 +00:00
'')
];
2024-06-03 23:37:31 +00:00
home.sessionVariables = {
ANKI_WAYLAND = "1";
};
2022-04-20 17:05:02 +00:00
# Notification system
# services.dunst = {
# enable = true;
# settings.global.follow = "keyboard";
2022-10-24 10:58:49 +00:00
# settings.global.width = "(400, 800)";
# settings.global.notification_limit = 5;
2022-10-24 10:58:49 +00:00
# settings.global.font = "Monospace 12";
2022-10-24 10:58:49 +00:00
# settings.global.dmenu = "${pkgs.bemenu}/bin/bemenu";
# settings.global.browser = "${pkgs.firefox-wayland}/bin/firefox";
2022-10-24 10:58:49 +00:00
# settings.global.mouse_left_click = "do_action, close_current";
# settings.global.mouse_right_click = "close_current";
# settings.global.mouse_middle_click = "close_all";
2022-10-24 10:58:49 +00:00
# settings.experimental.per_monitor_dpi = "true";
# };
2022-04-20 17:05:02 +00:00
# Forward wallpaper settings to sway
programs.my-sway.wallpaper = config.linux.graphical.wallpaper;
};
}