{ config, pkgs, lib, ... }: let cfg = config.ctucxConfig.wm.sway; in { options = { ctucxConfig.wm.sway = { enable = lib.mkEnableOption "swaywm"; }; }; config = lib.mkIf cfg.enable { nixpkgs.overlays = [(self: super: { wlroots = super.wlroots.overrideAttrs (old: { mesonFlags = (old.mesonFlags or []) ++ [ "-Dxwayland=disabled" ]; }); sway-unwrapped = super.sway-unwrapped.overrideAttrs (old: { mesonFlags = (old.mesonFlags or []) ++ [ "-Dxwayland=disabled" ]; }); xsel = super.wl-clipboard-x11; xclip = super.wl-clipboard-x11; })]; xdg.portal = { config.common.default = [ "wlr" ]; wlr.enable = true; }; home-manager.users.katja = { home.packages = with pkgs; [ qt5.qtwayland wl-clipboard ]; programs.bash.initExtra = '' if [ "$(tty)" = "/dev/tty1" ]; then exec sway fi ''; wayland.windowManager.sway = let cfg = config.home-manager.users.katja.wayland.windowManager.sway; modifier = cfg.config.modifier; in { enable = true; systemd.enable = true; xwayland = false; wrapperFeatures.gtk = true; extraSessionCommands = '' export QT_QPA_PLATFORM=wayland export QT_WAYLAND_FORCE_DPI=physical export QT_WAYLAND_DISABLE_WINDOWDECORATION=1 export _JAVA_AWT_WM_NONREPARENTING=1 # be careful with those, they *will* break some applications export SDL_VIDEODRIVER=wayland export GDK_BACKEND=wayland ''; extraConfig = '' # Import the most important environment variables into the D-Bus and systemd # user environments (e.g. required for screen sharing and Pinentry prompts): exec dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP ''; config = { fonts = { names = [ "Noto Sans Mono" "FontAwesome5Free" ]; style = ""; size = 11.0; }; colors = { focused = { background = "#3b8756"; border = "#3b8756"; childBorder = "#3b8756"; text = "#eceff4"; indicator = "#8fbcbb"; }; }; window = { titlebar = false; hideEdgeBorders = "smart"; border = 5; }; input = { "*" = { xkb_layout = "us,ru,de"; xkb_variant = "mac,mac,qwerty"; xkb_options = "grp:alt_shift_toggle"; natural_scroll = "enabled"; }; "1046:9110:Goodix_Capacitive_TouchScreen" = { map_to_output = "DSI-1"; }; "1452:613:Apple_Inc._Magic_Trackpad_2" = { accel_profile = "adaptive"; }; }; output = { "DSI-1" = { transform = "90"; scale = "1.2"; }; "*" = { # bg = "~/Pictures/photos.ctu.cx/Bahnbilder/2019.06/20190622-153441.jpg fill"; scale = lib.mkDefault "1"; }; }; assigns = { "1: Web" = [{ app_id = "firefox"; }]; "2: Mail" = [{ app_id = "thunderbird"; }]; }; bars = []; modifier = "Mod4"; workspaceAutoBackAndForth = true; keybindings = { "${modifier}+Return" = "exec ${cfg.config.terminal}"; "${modifier}+Space" = "exec ${pkgs.wofi}/bin/wofi --style ${./wofi/style.css} --conf ${./wofi/config} --show drun"; "${modifier}+l" = "exec ${pkgs.systemd}/bin/loginctl lock-session"; "${modifier}+z" = "exec sleep 1 && systemctl suspend"; "${modifier}+Tab" = "exec ${pkgs.rofi-wayland}/bin/rofi -show wifi -modi 'wifi:${pkgs.rofi-iwd-wifi-menu}/bin/iwdrofimenu'"; "${modifier}+Control+Print" = "exec ${pkgs.grim}/bin/grim ~/Pictures/Screenshots/$(date +\"%Y-%m-%d_%H:%m:%S\").png"; "${modifier}+Control+Shift+Print" = "exec ${pkgs.grim}/bin/grim - | ${pkgs.wl-clipboard}/bin/wl-copy -t image/png"; "${modifier}+Print" = "exec ${pkgs.grim}/bin/grim -g \"$(${pkgs.slurp}/bin/slurp)\" ~/Pictures/Screenshots/$(date +\"%Y-%m-%d_%H:%m:%S\").png"; "${modifier}+Shift+Print" = "exec ${pkgs.grim}/bin/grim -g \"$(${pkgs.slurp}/bin/slurp)\" - | ${pkgs.wl-clipboard}/bin/wl-copy -t image/png"; "XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl s +5%"; "XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl s 5%-"; "XF86AudioRaiseVolume" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ +5%"; "XF86AudioLowerVolume" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ -5%"; "XF86AudioMute" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle"; "XF86AudioMicMute" = "exec ${pkgs.pulseaudio}/bin/pactl set-source-mute @DEFAULT_SOURCE@ toggle"; "XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause"; "XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next"; "XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous"; "${modifier}+Shift+e" = "exec swaynag -t warning -m 'Do you really want to exit sway?' -b 'Yep' 'swaymsg exit'"; "${modifier}+q" = "kill"; "${modifier}+Shift+c" = "reload"; "${modifier}+Left" = "focus left"; "${modifier}+Down" = "focus down"; "${modifier}+Up" = "focus up"; "${modifier}+Right" = "focus right"; "${modifier}+a" = "focus parent"; "${modifier}+Shift+Left" = "move left"; "${modifier}+Shift+Down" = "move down"; "${modifier}+Shift+Up" = "move up"; "${modifier}+Shift+Right" = "move right"; "${modifier}+1" = "workspace 1: Web"; "${modifier}+2" = "workspace 2: Mail"; "${modifier}+3" = "workspace 3: Term; layout tabbed"; "${modifier}+4" = "workspace 4: Files"; "${modifier}+5" = "workspace number 5"; "${modifier}+6" = "workspace number 6"; "${modifier}+7" = "workspace number 7"; "${modifier}+8" = "workspace number 8"; "${modifier}+9" = "workspace number 9"; "${modifier}+0" = "workspace number 10"; "${modifier}+Shift+1" = "move container to workspace 1: Web"; "${modifier}+Shift+2" = "move container to workspace 2: Mail"; "${modifier}+Shift+3" = "move container to workspace 3: Term"; "${modifier}+Shift+4" = "move container to workspace 4: Files"; "${modifier}+Shift+5" = "move container to workspace number 5"; "${modifier}+Shift+6" = "move container to workspace number 6"; "${modifier}+Shift+7" = "move container to workspace number 7"; "${modifier}+Shift+8" = "move container to workspace number 8"; "${modifier}+Shift+9" = "move container to workspace number 9"; "${modifier}+Shift+0" = "move container to workspace number 10"; "${modifier}+s" = "layout stacking"; "${modifier}+w" = "layout tabbed"; "${modifier}+e" = "layout toggle split"; "${modifier}+f" = "fullscreen"; "${modifier}+r" = "mode \"resize\""; "${modifier}+b" = "mode \"waybar\""; "${modifier}+Shift+space" = "floating toggle"; }; modes = { "resize" = { "Right" = "resize shrink width 10px"; "Left" = "resize grow width 10px"; "Down" = "resize shrink height 10px"; "Up" = "resize grow height 10px"; "Return" = "mode \"default\""; "Escape" = "mode \"default\""; "${modifier}+r" = "mode \"default\""; }; "waybar" = { "space" = "exec pkill -SIGUSR1 waybar"; "r" = "exec pkill -SIGUSR2 waybar"; "Return" = "mode \"default\""; "Escape" = "mode \"default\""; "${modifier}+r" = "mode \"default\""; }; }; }; }; }; }; }