update sway config

This commit is contained in:
Charlotte 🦝 Delenk 2022-07-06 07:59:56 +01:00
parent 1feafcc53d
commit 95bff7d7dc
Signed by: darkkirb
GPG key ID: AB2BD8DAF2E37122
3 changed files with 58 additions and 32 deletions

View file

@ -14,7 +14,6 @@
'';
in {
imports = [
./services/sway.nix
./services/pipewire.nix
./desktop-secrets.nix
./services/cups.nix
@ -87,4 +86,16 @@ in {
# For syncthing
networking.firewall.allowedTCPPorts = [22000];
networking.firewall.allowedUDPPorts = [22000];
environment.systemPackages = [
pkgs.qt5.qtwayland
];
xdg.portal = {
enable = true;
wlr.enable = true;
# gtk portal needed to make gtk apps happy
extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
gtkUsePortal = true;
};
}

View file

@ -57,6 +57,42 @@
'';
installPhase = "true";
};
# bash script to let dbus know about important env variables and
# propogate them to relevent services run at the end of sway config
# see
# https://github.com/emersion/xdg-desktop-portal-wlr/wiki/"It-doesn't-work"-Troubleshooting-Checklist
# note: this is pretty much the same as /etc/sway/config.d/nixos.conf but also restarts
# some user services to make sure they have the correct environment variables
dbus-sway-environment = pkgs.writeTextFile {
name = "dbus-sway-environment";
destination = "/bin/dbus-sway-environment";
executable = true;
text = ''
${pkgs.dbus}/bin/dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway
${pkgs.systemd}/bin/systemctl --user stop pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr
${pkgs.systemd}/bin/systemctl --user start pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr
'';
};
# currently, there is some friction between sway and gtk:
# https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland
# the suggested way to set gtk settings is with gsettings
# for gsettings to work, we need to tell it where the schemas are
# using the XDG_DATA_DIR environment variable
# run at the end of sway config
configure-gtk = pkgs.writeTextFile {
name = "configure-gtk";
destination = "/bin/configure-gtk";
executable = true;
text = let
schema = pkgs.gsettings-desktop-schemas;
datadir = "${schema}/share/gsettings-schemas/${schema.name}";
in ''
export XDG_DATA_DIRS=${datadir}:$XDG_DATA_DIRS
gnome_schema=org.gnome.desktop.interface
${pkgs.glib}/bin/gsettings set $gnome_schema gtk-theme 'Breeze-Dark'
'';
};
in {
imports = [
./wl-clipboard.nix
@ -138,6 +174,16 @@ in {
};
};
wrapperFeatures.gtk = true;
extraSessionCommands = ''
export SDL_VIDEODRIVER=wayland
export QT_QPA_PLATFORM=wayland
export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
export _JAVA_AWT_WM_NONREPARENTING=1
'';
extraConfig = ''
exec ${dbus-sway-environment}/bin/dbus-sway-environment
exec ${configure-gtk}/bin/configure-gtk
'';
};
#home.file.".XCompose".source = ../../extra/.XCompose;

View file

@ -1,31 +0,0 @@
{
config,
pkgs,
lib,
...
}: {
systemd.user.targets.sway-session = {
description = "Sway compositor session";
documentation = ["man:systemd.special(7)"];
bindsTo = ["graphical-session.target"];
wants = ["graphical-session-pre.target"];
after = ["graphical-session-pre.target"];
};
programs.sway = {
enable = true;
extraPackages = with pkgs; [
xwayland
wl-clipboard
(python38.withPackages (ps: with ps; [i3pystatus keyring]))
];
};
services.xserver = {
enable = true;
displayManager.defaultSession = "sway";
displayManager.sddm.enable = true;
libinput.enable = true;
layout = "de";
xkbVariant = "neo";
};
}