{ config, pkgs, lib, ...}: let cfg = config.my.sway; in { imports = [./desktop.nix]; options.my.sway = with pkgs.lib; { KDEConnect = mkOption { default = true; type = types.bool; description = "enable KDEConnect support"; }; xwayland = mkOption { default = false; type = types.bool; description = "enable xwayland support"; }; mail = mkOption { default = true; type = types.bool; description = "enable mail support (thunderbird)"; }; nextcloud = mkOption { default = true; type = types.bool; description = "enable nextcloud support"; }; XMPP = mkOption { default = false; type = types.bool; description = "enable XMPP support ()"; }; }; config = { home.sessionVariables = { XDG_CURRENT_DESKTOP = "sway"; MOZ_ENABLE_WAYLAND = 1; MOZ_WEBRENDER = 1; }; home.packages = with pkgs; [ # sway # alacritty # swayidle # swaylock-effects # mako # wl-clipboard #- xdg-desktop-portal-wlr # bemenu # i3blocks # acpi # lm_sensors # ponymix # brightnessctl # gammastep # grim # slurp # kdeconnect # wdisplays ]; wayland.windowManager.sway = let ws1 = "1💬"; #ws2 = "2📝"; ws2 = "2🌟"; ws3 = "3🍁"; ws4 = "4🍀"; ws5 = "5🌈"; ws6 = "6💎"; ws7 = "7🎥"; ws8 = "8🌍"; ws9 = "9🔒"; ws10 = "10🌀"; white = "#ffffff"; cyan = "#00afd7"; acqua = "#00d787"; violet = "#800080"; wine = "#72003e"; magenta = "#af005f"; orange = "#ff8700"; silver = "#e4e4e4"; gray = "#353535"; elegant = "#1b1d1e"; black = "#000000"; transparent = "#000000b2"; modifier = "Mod4"; menu = "bemenu-run -i -p 'Run:' --fn 'pango:monospace 7'"; # config.wayland.windowManager.sway.config.modifier; in { enable = true; xwayland = cfg.xwayland; config = { input = { "*" = { xkb_layout = "de"; xkb_model = "chromebook"; # no click needed tap = "enabled"; }; "1452:544:Apple,_Inc_Apple_Keyboard" = { xkb_layout = "us"; }; }; output = { "*".bg = "~/.config/wallpaper.png fill"; # fireThink "Unknown 0x226D 0x00000000" = { enable = ""; }; # fireG0 "Unknown 0x405C 0x00000000" = { position = "0 0"; # scale = "0.7"; # resolution = "1920x1080"; resolution = "1366x768@60Hz"; }; # fireEmerald "Unknown 0x364C 0x00000000" = { position = "0 0"; scale = "1.25"; }; "Goldstar Company Ltd LG HDR 4K 0x0000655D" = { position = "3000 0"; enable = ""; scale = "1.0"; # disable = true; # resolution = "3840x2160@30Hz"; resolution = "3840x2160"; }; "HEADLESS-1" = { resolution = "2560x1440"; }; "DP-1" = { position = "3000 0"; # resolution = "2560x1440"; }; # "DP-2" = { # position = "1920 0"; # # position = "4480 0"; # # resolution = "1280x1024"; # }; }; modifier = "${modifier}"; menu = "${menu}"; terminal = "alacritty"; fonts = { names = ["monospace"]; style = "monospace"; size = 7.0;}; colors = { focused = { background = "${cyan}"; border = "${cyan}"; childBorder = "${cyan}"; indicator = "${white}"; text = "${elegant}"; }; focusedInactive = { background = "${gray}"; border = "${gray}"; childBorder = "${gray}"; indicator = "${magenta}"; text = "${cyan}"; }; unfocused = { background = "${elegant}"; border = "${elegant}"; childBorder = "${elegant}"; indicator = "${white}"; text = "${orange}"; }; urgent = { background = "${magenta}"; border = "${magenta}"; childBorder = "${magenta}"; indicator = "${magenta}"; text = "${silver}"; }; placeholder = { background = "${magenta}"; border = "${magenta}"; childBorder = "${magenta}"; indicator = "${white}"; text = "${silver}"; }; background = "${transparent}"; }; bars = [{ position = "top"; statusCommand = "i3blocks"; trayOutput = "*"; colors = { statusline = "${white}"; # focusedStatusline = "${white}"; background = "${black}"; # focusedBackground = "${transparent}"; activeWorkspace = { background = "${cyan}"; border = "${gray}"; text = "${white}"; }; focusedWorkspace = { background = "${cyan}"; border = "${cyan}"; text = "${white}"; }; inactiveWorkspace = { background = "${black}"; border = "${black}"; text = "${orange}"; }; urgentWorkspace = { background = "${magenta}"; border = "${magenta}"; text = "${white}"; }; bindingMode = { background = "${orange}"; border = "${orange}"; text = "${white}"; }; }; }]; gaps = { inner = 2; outer = 0; smartGaps = true; smartBorders = "no_gaps"; }; modes.resize = { Left = "resize shrink width 10 px or 10 ppt"; Down = "resize grow height 10 px or 10 ppt"; Up = "resize shrink height 10 px or 10 ppt"; Right = "resize grow width 10 px or 10 ppt"; j = "resize grow height 10 px or 10 ppt"; k = "resize shrink height 10 px or 10 ppt"; l = "resize grow width 10 px or 10 ppt"; h = "resize shrink width 10 px or 10 ppt"; Return = "mode default"; Escape = "mode default"; "${modifier}+r" = "mode default"; }; workspaceAutoBackAndForth = true; keybindings = { "${modifier}+Return" = "exec alacritty"; # "${modifier}+Return" = "exec ${config.wayland.windowManager.sway.config.terminal}"; "${modifier}+Shift+c" = "reload"; "${modifier}+Shift+r" = "restart"; "${modifier}+c" = "kill"; "${modifier}+Shift+e" = "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway?' -b 'Yes, exit sway' 'swaymsg exit'"; "${modifier}+Shift+h" = "split h"; "${modifier}+Shift+v" = "split v"; "${modifier}+z" = "fullscreen toggle"; "${modifier}+s" = "layout stacking"; "${modifier}+w" = "layout tabbed"; "${modifier}+e" = "layout toggle split"; "${modifier}+Shift+space" = "floating toggle"; "${modifier}+space" = "focus mode_toggle"; "${modifier}+a" = "focus parent"; "${modifier}+d" = "focus child"; "${modifier}+v" = "exec ${menu}"; "${modifier}+x" = "sticky toggle"; "${modifier}+Shift+x" = "move workspace to output left"; "${modifier}+r" = "mode resize"; # window "${modifier}+Left" = "focus left"; "${modifier}+Down" = "focus down"; "${modifier}+Up" = "focus up"; "${modifier}+Right" = "focus right"; "${modifier}+j" = "focus left"; "${modifier}+k" = "focus down"; "${modifier}+l" = "focus up"; "${modifier}+odiaeresis" = "focus right"; "${modifier}+Shift+Left" = "move left"; "${modifier}+Shift+Down" = "move down"; "${modifier}+Shift+Up" = "move up"; "${modifier}+Shift+Right" = "move right"; "${modifier}+Shift+j" = "move left"; "${modifier}+Shift+k" = "move down"; "${modifier}+Shift+l" = "move up"; "${modifier}+Shift+odiaeresis" = "move right"; # workspace "${modifier}+1" = "workspace number ${ws1}"; "${modifier}+2" = "workspace number ${ws2}"; "${modifier}+3" = "workspace number ${ws3}"; "${modifier}+4" = "workspace number ${ws4}"; "${modifier}+5" = "workspace number ${ws5}"; "${modifier}+6" = "workspace number ${ws6}"; "${modifier}+7" = "workspace number ${ws7}"; "${modifier}+8" = "workspace number ${ws8}"; "${modifier}+9" = "workspace number ${ws9}"; "${modifier}+0" = "workspace number ${ws10}"; "${modifier}+Shift+1" = "move container to workspace number ${ws1}"; "${modifier}+Shift+2" = "move container to workspace number ${ws2}"; "${modifier}+Shift+3" = "move container to workspace number ${ws3}"; "${modifier}+Shift+4" = "move container to workspace number ${ws4}"; "${modifier}+Shift+5" = "move container to workspace number ${ws5}"; "${modifier}+Shift+6" = "move container to workspace number ${ws6}"; "${modifier}+Shift+7" = "move container to workspace number ${ws7}"; "${modifier}+Shift+8" = "move container to workspace number ${ws8}"; "${modifier}+Shift+9" = "move container to workspace number ${ws9}"; "${modifier}+Shift+0" = "move container to workspace number ${ws10}"; "XF86AudioLowerVolume" = "exec ponymix -N decrease 5"; "${modifier}+XF86AudioLowerVolume" = ''exec "ponymix -N -t source -d $(ponymix -t source list | grep source | grep -v -E '(monitor|fallback)' | sed -r 's/source\s([0-9]+):.*/\1/') decrease 5"''; "XF86AudioRaiseVolume" = "exec ponymix -N increase 5"; "${modifier}+XF86AudioRaiseVolume" = ''exec "ponymix -N -t source -d $(ponymix -t source list | grep source | grep -v -E '(monitor|fallback)' | sed -r 's/source\s([0-9]+):.*/\1/') increase 5"''; "XF86AudioMute" = "exec ponymix -N toggle"; "${modifier}+XF86AudioMute" = ''exec "ponymix -N -t source -d $(ponymix -t source list | grep source | grep -v -E '(monitor|fallback)' | sed -r 's/source\s([0-9]+):.*/\1/') toggle"''; "XF86AudioMicMute" = ''exec "ponymix -N -t source -d $(ponymix -t source list | grep source | grep -v -E '(monitor|fallback)' | sed -r 's/source\s([0-9]+):.*/\1/') toggle"''; "XF86MonBrightnessUp" = ''exec brightnessctl set +10% && \ notify-send -h "int:value:$(brightnessctl -m info | cut -d',' -f4)" -i display-brightness-symbolic -a Display Light -t 1000''; "XF86MonBrightnessDown" = ''exec brightnessctl set 10%- && \ notify-send -h "int:value:$(brightnessctl -m info | cut -d',' -f4)" -i display-brightness-symbolic -a Display Light -t 1000''; "XF86Display" = ''exec "swaymsg output eDP-1 toggle"''; "${modifier}+p" = "exec passmenu"; "${modifier}+F11" = ''exec "swaylock -SeFfk --clock --effect-blur 7x5 --effect-vignette 0.5:0.5 --grace 2 --fade-in 0.2 --submit-on-touch"''; "Print" = ''exec "grim -g \"$(slurp)\""''; }; assigns = { "${ws1}" = [ { app_id = "(?i)empathy"; } { app_id = "(?i)gajim"; } { app_id = "(?i)dino"; } { app_id = "(?i)pidgin"; } ]; "${ws2}" = [ { app_id = "(?i)thunderbird"; } { app_id = "(?i)evolution"; } ]; "${ws4}" = [ { app_id = "(?i)atril"; } { app_id = "(?i)evince"; } ]; "${ws7}" = [ { app_id = "(?i)mpv"; } ]; "${ws8}" = [ { app_id = "(?i)firefox"; } { app_id = "(?i)firefoxdeveloperedition"; } ]; }; floating = { modifier = modifier; }; window = { border = 1; # hideEdgeBorders = "smart_no_gaps"; hideEdgeBorders = "smart"; commands = [ { command = "move to scratchpad"; criteria = { title = "Firefox.* Sharing Indicator"; }; } { command = "sticky enable"; criteria = { title = "Picture-in-Picture"; }; } { command = "floating enable"; criteria = { title = "Picture-in-Picture"; }; } { command = "floating enable"; criteria = { title = "Extension: \(Tree Style Tab\) - .*"; }; } ]; }; startup = [ { command = "systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK"; } { command = "hash dbus-update-activation-environment 2>/dev/null && dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK" ; } { command = "swayidle -w \\ timeout 300 'swaylock -SeFfk --clock --effect-blur 7x5 --effect-vignette 0.5:0.5 --grace 2 --fade-in 0.2 --submit-on-touch' \\ timeout 600 'swaymsg output * dpms off' \\ resume 'swaymsg output * dpms on' \\ before-sleep 'swaylock -SeFfk --clock --effect-blur 7x5 --effect-vignette 0.5:0.5 --grace 2 --fade-in 0.2 --submit-on-touch'"; } { command = "mako"; } #{ command = "kanshi"; } # indicator { command = "networkd-notify"; } # needs x11 #{ command = "udiskie -t"; } #{ command = "modem-manager-gui -i"; } #{ command = "nm-applet"; } # apps { command = "firefox"; } #{ command = "firefoxdeveloperedition"; } ] ++ lib.optionals (cfg.KDEConnect) [ { command = "/usr/lib/kdeconnectd"; } { command = "${pkgs.libsForQt5.kdeconnect-kde}/libexec/kdeconnectd"; } { command = "kdeconnect-indicator"; } ] ++ lib.optionals (cfg.mail) [ { command = "thunderbird"; } ] ++ lib.optionals (cfg.nextcloud) [ { command = "nextcloud"; } ] ++ lib.optionals (cfg.XMPP) [ { command = "dino"; } #{ command = "gajim"; } ]; }; }; # use nixos's .... # from programs.sway: # xdg.portal.enable = true; # xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-wlr ]; programs.mako = { enable = true; font = "monospace 7"; iconPath = "/home/genofire/.nix-profile/share/icons/Adwaita/:/home/genofire/.nix-profile/share/icons/hicolor/"; maxIconSize = 32; margin = "2"; padding = "3"; width = 380; format = "[%a] %s %h\\n%b"; maxVisible = 14; # layer = "overlay"; groupBy = "app-name,summary"; sort = "+time"; backgroundColor = "#000000bf"; borderColor = "#00afd7"; extraConfig = '' [app-name=""] width=380 [app-name=""] format=%s %h\n%b [app-name="notify-send"] format=%s %h\n%b [grouped] format=(%g) [%a] %s %h\n%b [actionable] border-radius=2 [urgency=low] #background-color=#00d787cf border-color=#00d787 progress-color=over #00d787c0 [urgency=normal] #background-color=#00afd7cf #background-color=#ff8700df #border-color=#00afd7 progress-color=over #00afd7c0 #progress-color=over #ff8700df [urgency=high] border-color=#af005f #background-color=#af005f #text-color=#e4e4e4 #progress-color=over #ff8700df progress-color=over #af005fc0 [app-icon="mail-message-new"] border-color=#00afd7 background-color=#00afd7c0 border-size=1 [app-icon="kdeconnect"] format=%s %h\n%b border-color=#353535 background-color=#1b1d1e border-size=1 anchor=top-left [summary="Log sum7"] border-color=#ff8700 background-color=#ff870090 border-size=1 [summary="[Sum7] Alerts"] format=%s %h\n%b border-color=#af005f background-color=#ff870090 border-size=1 ''; }; services.gammastep = { enable = true; provider = "geoclue2"; # duskTime = "22:00-23:00"; # dawnTime = "6:00-10:00"; }; programs.alacritty = { enable = true; settings = { window.opacity = 0.95; font.size = 8; colors.primary = { background = "0x0a0a0a"; foreground = "0xffffff"; }; }; }; xdg.configFile."i3blocks/bin/wifi".source = ./sway-i3block/wifi; xdg.configFile."i3blocks/bin/battery".source = ./sway-i3block/battery; xdg.configFile."i3blocks/config".text = '' align=center separator=false # separator_block_width=15 markup=pango # color=#f8f8f2 color=#e4e4e4 [root] label=💽 command=df -h / | awk 'FNR==2 { gsub(/[A-Za-z]/, ""); printf " %iG\n", $4 }' interval=3 [memory] label=💾 command=free --giga | awk 'FNR==2{ printf " %iG\n", $7 }' interval=2 [wifi] label= command=~/.config/i3blocks/bin/wifi interval=5 color=#589df6 [volume] command=if ponymix -t sink is-muted; then echo '🔇'; else if test $(ponymix -t sink get-volume) -gt 50; then echo -n "🔊"; else echo -n "🔉"; fi; echo "$(ponymix -t sink get-volume)%"; fi interval=1 [mic] command=if ponymix -t source is-muted; then echo ''; else echo " $(ponymix -t source get-volume)%"; fi interval=1 [battery] command=~/.config/i3blocks/bin/battery interval=2 color=#ff5555 [time] label=⏰ command=date '+%T' interval=1 ''; }; }