dotfiles/entropy/nixos/modules/sway.nix

145 lines
4 KiB
Nix
Raw Normal View History

2021-05-18 12:09:48 +00:00
{ pkgs, ... }:
2022-08-29 12:38:07 +00:00
let
# 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
gsettings set $gnome_schema gtk-theme "Dracula"
gsettings set $gnome_schema icon-theme "Paper"
'';
};
greetstyleWrapper = pkgs.writeText "gtkgreet.css" ''
window {
background-image: url("file://${pkgs.nixos-artwork.wallpapers.stripes-logo.gnomeFilePath}");
background-size: cover;
background-position: center;
color: #dddddd;
}
'';
# configures the sway wrapper for the GTK greeter
gtkgreetSwayWrapper = pkgs.writeText "gtkgreet-sway" ''
# `-l` activates layer-shell mode. Notice that `swaymsg exit` will run after gtkgreet.
exec configure-gtk
exec "${pkgs.greetd.gtkgreet}/bin/gtkgreet -l -s ${greetstyleWrapper}; swaymsg exit"
bindsym Mod4+shift+q exec swaynag \
-t warning \
-m 'What do you want to do?' \
-b 'Poweroff' 'systemctl poweroff' \
-b 'Reboot' 'systemctl reboot'
include /etc/sway/config.d/*
'';
in
2021-05-18 12:09:48 +00:00
{
programs.sway = {
enable = true;
wrapperFeatures.gtk = true; # so that gtk works properly
extraPackages = with pkgs; [
swaylock
swayidle
xwayland # for legacy apps
waybar
wl-clipboard
mako # notification daemon
kanshi # replacement for autorandr
sway-contrib.grimshot
imv # image viewer
2022-08-29 12:38:07 +00:00
glib # gsettings
configure-gtk
#zafiro-icons
dracula-theme
paper-icon-theme
2022-10-13 13:22:00 +00:00
# xdotool type application for inserting keypresses
wtype
# wofi as application runner
wofi
wofi-emoji
2021-05-18 12:09:48 +00:00
];
extraSessionCommands = ''
export SDL_VIDEODRIVER=wayland
# needs qt5.qtwayland in systemPackages
export QT_QPA_PLATFORM=wayland
export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
# Fix for some Java AWT applications (e.g. Android Studio),
# use this if they aren't displayed properly:
export _JAVA_AWT_WM_NONREPARENTING=1
2021-10-14 14:15:27 +00:00
# firefox x11 <-> wayland interoperability
export MOZ_DBUS_REMOTE=1
2022-06-22 12:19:19 +00:00
# override VA-API driver
export LIBVA_DRIVER_NAME=iHD
2021-05-18 12:09:48 +00:00
'';
};
2021-11-18 18:04:41 +00:00
programs.waybar.enable = true;
2021-05-18 12:09:48 +00:00
2021-11-18 18:04:41 +00:00
services.redshift = {
enable = true;
2022-06-15 15:14:20 +00:00
package = pkgs.gammastep;
2021-11-18 18:04:41 +00:00
temperature.night = 3500;
};
2021-05-18 12:09:48 +00:00
2021-11-18 18:04:41 +00:00
# ------------ Display Manager ----------------------------------------------
2022-08-29 12:38:07 +00:00
services.greetd = {
2022-06-22 12:19:19 +00:00
enable = true;
2022-08-29 12:38:07 +00:00
settings = {
default_session = {
command = "${pkgs.sway}/bin/sway --config ${gtkgreetSwayWrapper}";
};
};
};
2022-06-22 12:19:19 +00:00
2022-08-29 12:38:07 +00:00
environment.etc."greetd/environments".text = ''
${pkgs.sway}/bin/sway
startx
${pkgs.libsForQt5.plasma-workspace}/bin/startplasma-wayland
${pkgs.fish}/bin/fish
'';
2022-06-22 12:19:19 +00:00
2022-08-29 12:38:07 +00:00
#environment.etc."greetd/gtkgreet.css".text = ''
#window {
#background-image: url("file://${pkgs.nixos-artwork.wallpapers.stripes-logo.gnomeFilePath}");
#background-size: cover;
#background-position: center;
#}
#'';
#services.xserver = {
## under protest
2021-10-14 14:15:27 +00:00
#enable = true;
2022-08-29 12:38:07 +00:00
## graphics
##videoDrivers = [ "modesetting" ];
#useGlamor = true;
## use sddm for authentication
##displayManager.sddm.enable = true;
#displayManager.lightdm = {
#enable = true;
#greeters.enso = {
#enable = true;
#theme = {
#name = "Dracula";
#package = pkgs.dracula-theme;
#};
#};
#};
2021-10-14 14:15:27 +00:00
#};
2021-05-18 12:09:48 +00:00
}