feat(nix): extend wayland with sway setup

This commit is contained in:
steveej 2023-05-23 18:11:30 +02:00
parent 2da1181445
commit 6970b8c7d2
27 changed files with 867 additions and 516 deletions

View file

@ -12,17 +12,9 @@ in {
../profiles/wayland-desktop.nix
];
home.packages = with pkgs; [
home.packages = [
# experimental WMs
packages'.jay
packages'.magmawm
# swayidle
# swaylock
# # fonts
# noto-fonts
# font-awesome
# noto-fonts-emoji
];
}

View file

@ -13,6 +13,7 @@ in {
gnome-keyring.enable = false;
blueman-applet.enable = true;
flameshot.enable = true;
pasystray.enable = true;
};
# TODO: remove this comment once i'm sure everything works

View file

@ -2,38 +2,139 @@
pkgs,
config,
lib,
packages',
...
}: let
inherit (import ../lib.nix {}) mkSimpleTrayService;
lockCmd = "${pkgs.swaylock}/bin/swaylock -efF --color '#000000'";
displayOffCmd = "${pkgs.sway}/bin/swaymsg 'output * power off'";
displayOnCmd = "${pkgs.sway}/bin/swaymsg 'output * power on'";
swapOutputWorkspaces = ../../../scripts/sway-swapoutputworkspaces.sh;
in {
imports = [
../profiles/wayland-desktop.nix
../programs/waybar.nix
../programs/salut.nix
];
home.packages = with pkgs; [
swayidle
swaylock
services = {
blueman-applet.enable = true;
flameshot.enable = true;
};
home.packages = [
pkgs.swayidle
pkgs.swaylock
packages'.yofi
pkgs.fuzzel
# required by any bar that has a tray plugin
pkgs.libappindicator-gtk3
## themes
pkgs.gnome.adwaita-icon-theme
pkgs.hicolor-icon-theme
pkgs.gnome-icon-theme
## fonts
pkgs.dejavu_fonts # just a basic good fond
pkgs.font-awesome_5 # needed by i3status-rust
pkgs.nerdfonts
pkgs.font-awesome
pkgs.roboto
pkgs.ttf_bitstream_vera
# from the wiki
pkgs.noto-fonts
pkgs.noto-fonts-cjk
pkgs.noto-fonts-cjk-sans
pkgs.noto-fonts-cjk-serif
pkgs.noto-fonts-emoji
pkgs.noto-fonts-emoji-blob-bin
pkgs.noto-fonts-extra
pkgs.noto-fonts-lgc-plus
pkgs.liberation_ttf
pkgs.fira-code
pkgs.fira-code-symbols
pkgs.mplus-outline-fonts.githubRelease
pkgs.dina-font
pkgs.monoid
pkgs.hermit
# by colemickens
pkgs.gelasio # metric-compatible with Georgia
pkgs.powerline-symbols
pkgs.iosevka-comfy.comfy-fixed
# fonts
noto-fonts
font-awesome
noto-fonts-emoji
];
wayland.windowManager.sway = {
enable = true;
systemdIntegration = true;
xwayland = false;
config = let
modifier = "Mod4";
inherit (config.wayland.windowManager.sway.config) left right up down;
in {
inherit modifier;
bars = [];
input = {
"type:keyboard" = {
xkb_layout = "us";
xkb_variant = "altgr-intl";
xkb_options = "nodeadkeys";
};
"type:touchpad" = {
natural_scroll = "enabled";
};
};
keybindings = lib.mkOptionDefault {
"${modifier}+Ctrl+l" = "exec ${pkgs.swaylock}/bin/swaylock -fF";
"XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
# as of 2023-05-21 the `!!` arg parsing mode was broken for me on yofi
# "${modifier}+d" = "exec ${packages'.yofi}/bin/yofi binapps";
"${modifier}+d" = "exec ${pkgs.fuzzel}/bin/fuzzel";
# only 1-9 exist on the default config
"${modifier}+0" = "workspace number 0";
"${modifier}+Shift+0" = "move container to workspace number 0";
# move workspace to output
"${modifier}+Control+Shift+${left}" = "move workspace to output left";
"${modifier}+Control+Shift+${right}" = "move workspace to output right";
"${modifier}+Control+Shift+${up}" = "move workspace to output up";
"${modifier}+Control+Shift+${down}" = "move workspace to output down";
# move workspace to output with arrow keys
"${modifier}+Control+Shift+Left" = "move workspace to output left";
"${modifier}+Control+Shift+Right" = "move workspace to output right";
"${modifier}+Control+Shift+Up" = "move workspace to output up";
"${modifier}+Control+Shift+Down" = "move workspace to output down";
"${modifier}+Shift+e" = "exec swaymsg exit";
"${modifier}+q" = "kill";
"${modifier}+x" = "exec ${swapOutputWorkspaces}";
"${modifier}+Ctrl+l" = "exec ${lockCmd}";
"--locked XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
"XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous";
"XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next";
"XF86AudioRaiseVolume" = "exec ${pkgs.pulsemixer}/bin/pulsemixer --change-volume +5";
"XF86AudioLowerVolume" = "exec ${pkgs.pulsemixer}/bin/pulsemixer --change-volume -5";
"--locked XF86AudioMute" = "exec ${pkgs.pulsemixer}/bin/pulsemixer --toggle-mute";
# TODO: screenshot util, flameshot doesn't work in the packaged version
"Print" = "exec ${pkgs.flameshot}/bin/flameshot gui";
};
terminal = "alacritty";
@ -41,44 +142,33 @@ in {
# Launch Firefox on start
# {command = "firefox";}
# {command = "gnome-keyring --replace"}
{command = "systemctl --user restart waybar";}
];
fonts = {
names = [ "Noto Sans" "Font Awesome 5 Free" ];
style = "Heavy";
size = 10.0;
colors.focused = lib.mkOptionDefault {
childBorder = lib.mkForce "#ffa500";
};
#fonts = {
# names = [ "DejaVu Sans Mono" "FontAwesome5Free" ];
# style = "Bold Semi-Condensed";
# size = 11.0;
#};
colors.focused = {
childBorder = "#ffa500";
# border = "#ffa500";
# TODO: refer to the defaults for these
border = "#4c7899";
background = "#285577";
text = "#ffffff";
indicator = "#2e9ef4";
};
window = {
border = 4;
};
window.border = 4;
};
};
services.swayidle = {
enable = true;
timeouts = [
{ timeout = 60 * 5; command = "${pkgs.swaylock}/bin/swaylock -fF"; }
{ timeout = 10; command = "if ${pkgs.procps}/bin/pgrep -x swaylock; then ${displayOffCmd}; fi"; resumeCommand = displayOnCmd; }
{ timeout = 60 * 5; command = lockCmd; }
{ timeout = 60 * 6; command = displayOffCmd; resumeCommand = displayOnCmd; }
];
events = [
{ event = "before-sleep";
command = builtins.concatStringsSep "; " [
lockCmd
"${pkgs.playerctl}/bin/playerctl pause"
];
}
{ event = "after-resume"; command = displayOnCmd; }
{ event = "lock"; command = lockCmd; }
];
};
}

View file

@ -1,19 +1,34 @@
{
pkgs,
config,
lib,
repoFlake,
nodeFlake,
...
}: let
inherit (import ../lib.nix {}) mkSimpleTrayService;
nixpkgs-2211 = nodeFlake.inputs.nixpkgs-2211.legacyPackages.${pkgs.system};
nixpkgs-wayland' = repoFlake.inputs.nixpkgs-wayland.packages.${pkgs.system};
wayprompt = nixpkgs-wayland'.wayprompt;
in {
services.gpg-agent.pinentryFlavor = "gtk2";
fonts.fontconfig.enable = true;
# services.gpg-agent.pinentryFlavor = lib.mkForce null;
# services.gpg-agent.extraConfig = ''
# pinentry-program "${wayprompt}/bin/pinentry-wayprompt"
# '';
home.packages = with pkgs; [
wlr-randr
wayout
wl-clipboard
wmctrl
wayprompt
nixpkgs-wayland'.shotman
# identifies key input syms
wev
@ -25,6 +40,35 @@ in {
pasystray
qt5.qtwayland
qt6.qtwayland
# probably required by flameshot
# xdg-desktop-portal xdg-desktop-portal-wlr
# grim
(signal-desktop.overrideAttrs (old: {
preFixup = old.preFixup + ''
gappsWrapperArgs+=(
--add-flags "--enable-features=UseOzonePlatform"
--add-flags "--ozone-platform=wayland"
)
'';
}))
((pkgs.session-desktop.override (old: {
inherit (nixpkgs-2211) appimageTools;
}))
.overrideAttrs(old: {
nativeBuildInputs = old.nativeBuildInputs ++ [
pkgs.wrapGAppsHook
];
preFixup = (old.preFixup or "") + ''
gappsWrapperArgs+=(
--add-flags "--enable-features=UseOzonePlatform"
--add-flags "--ozone-platform=wayland"
)
'';
}))
];
home.sessionVariables = {