dotfiles/entropy/nixos/modules/sway.nix

137 lines
3.7 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; [
2023-01-24 09:53:08 +00:00
swaylock-effects
2021-05-18 12:09:48 +00:00
swayidle
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
2022-10-27 09:53:48 +00:00
# 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;
programs.xwayland.enable = true; # for legacy apps
2021-05-18 12:09:48 +00:00
2024-10-23 12:27:30 +00:00
# Hyprland! Experimental
programs.hyprland = {
enable = true;
};
environment.systemPackages = with pkgs; [
kitty
dunst
tela-circle-icon-theme
eww
];
2021-11-18 18:04:41 +00:00
services.redshift = {
enable = true;
2022-06-15 15:14:20 +00:00
package = pkgs.gammastep;
2023-01-24 09:53:08 +00:00
executable = "/bin/gammastep";
2021-11-18 18:04:41 +00:00
temperature.night = 3500;
};
2021-05-18 12:09:48 +00:00
# fixes vs code for wayland
environment.sessionVariables.NIXOS_OZONE_WL = "1";
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 = ''
2024-10-23 12:27:30 +00:00
Hyprland
2024-03-22 09:40:02 +00:00
sway
startplasma-wayland
2024-10-23 12:27:30 +00:00
fish
${pkgs.sway}/bin/sway
${pkgs.hyprland}/bin/Hyprland
2022-08-29 12:38:07 +00:00
${pkgs.fish}/bin/fish
'';
2024-03-22 09:40:02 +00:00
# ${pkgs.xorg.xinit}/bin/startx
# ${pkgs.libsForQt5.plasma-workspace}/bin/startplasma-wayland
2022-06-22 12:19:19 +00:00
2021-05-18 12:09:48 +00:00
}