{ inputs, pkgs, hostname, outputs, config, ... } @args: { xdg.configFile."sway/config".text = '' # For ${(if args ? osConfig then args.osConfig else args.config).networking.hostName} set $mod Mod1 set $terminal_path /home/don/bin/mynewterm set $snd_sink alsa_output.usb-Corsair_CORSAIR_VOID_ELITE_Wireless_Gaming_Dongle-00.iec958-stereo set $lock /home/don/bin/lock.sh exec ${pkgs.swayidle}/bin/swayidle -w \ timeout 300 $lock \ timeout 360 'swaymsg "output * dpms off"' \ resume 'swaymsg "output * dpms on"' \ before-sleep $lock floating_modifier $mod hide_edge_borders both titlebar_border_thickness 0 titlebar_padding 5 0 font pango:JetBrains Mono 8 workspace_auto_back_and_forth yes set $laptop eDP-1 output $laptop scale ${(if args ? osConfig then args.osConfig else args.config).variables.swayScale} output * bg /home/don/nixos/hosts/fan-table-device-box-wallpaper.jpg fill bindswitch --reload --locked lid:on output $laptop disable bindswitch --reload --locked lid:off output $laptop enable title_align center # Music control bindsym XF86AudioPlay exec --no-startup-id control-music --pause bindsym XF86AudioNext exec --no-startup-id control-music --next bindsym XF86AudioPrev exec --no-startup-id control-music --prev bindsym XF86AudioStop exec --no-startup-id control-music --stop bindsym Control+Shift+F7 exec --no-startup-id control-music --pause bindsym Control+Shift+F2 exec --no-startup-id control-music --next bindsym Control+Shift+F1 exec --no-startup-id control-music --prev # Brightness bindsym XF86MonBrightnessDown exec brightnessctl set 10%- bindsym XF86MonBrightnessUp exec brightnessctl set +10% bindsym Control+Shift+F5 exec brightnessctl set 10%- bindsym Control+Shift+F6 exec brightnessctl set +10% # Volume bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5% bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5% bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle bindsym Control+Shift+F10 exec pactl set-sink-volume @DEFAULT_SINK@ +5% bindsym Control+Shift+F9 exec pactl set-sink-volume @DEFAULT_SINK@ -5% bindsym Control+Shift+F8 exec pactl set-sink-mute @DEFAULT_SINK@ toggle # start a terminal bindsym $mod+Return exec --no-startup-id $HOME/bin/mynewterm # kill focused window bindsym $mod+Shift+q kill # start dmenu (a program launcher) set $menu_command ${pkgs.fuzzel}/bin/fuzzel set $bemenu_options -i --nb "#3f3f3f" --nf "#dcdccc" -fn "pango:JetBrains Mono 8" set $menu ${pkgs.dmenu-wayland}/bin/dmenu-wl_path | ${pkgs.bemenu}/bin/bemenu $bemenu_options| xargs swaymsg exec -- bindsym $mod+Shift+d exec $menu # Screenshots: bindsym Mod4+p exec ${pkgs.sway-contrib.grimshot}/bin/grimshot --notify save active # Current window bindsym Mod4+Shift+p exec ${pkgs.sway-contrib.grimshot}/bin/grimshot --notify save area # Select area bindsym Mod4+Mod1+p exec ${pkgs.sway-contrib.grimshot}/bin/grimshot --notify save output # Current output bindsym Mod4+Ctrl+p exec ${pkgs.sway-contrib.grimshot}/bin/grimshot --notify save window # Select a window # rofi app and window launchers bindsym $mod+p exec --no-startup-id $menu bindsym menu exec $menu_command bindsym $mod+Shift+w exec dwifi bindsym $mod+d exec --no-startup-id $menu # change focus bindsym $mod+j focus left bindsym $mod+k focus down bindsym $mod+l focus up bindsym $mod+semicolon focus right # alternatively, you can use the cursor keys: bindsym $mod+Left focus left bindsym $mod+Down focus down bindsym $mod+Up focus up bindsym $mod+Right focus right # move focused window bindsym $mod+Shift+j move left bindsym $mod+Shift+k move down bindsym $mod+Shift+l move up bindsym $mod+Shift+semicolon move right # alternatively, you can use the cursor keys: bindsym $mod+Shift+Left move left bindsym $mod+Shift+Down move down bindsym $mod+Shift+Up move up bindsym $mod+Shift+Right move right # split in horizontal orientation bindsym $mod+Shift+h split h # split in vertical orientation bindsym $mod+Shift+v split v # enter fullscreen mode for the focused container bindsym $mod+f fullscreen toggle # change container layout (stacked, tabbed, toggle split) bindsym $mod+s layout stacking bindsym $mod+w layout tabbed bindsym $mod+e layout toggle split # toggle tiling / floating bindsym $mod+Shift+space floating toggle # change focus between tiling / floating windows bindsym $mod+Shift+f focus mode_toggle # switch to workspace bindsym $mod+F1 workspace 1 bindsym $mod+F2 workspace 2 bindsym $mod+F3 workspace 3 bindsym $mod+F4 workspace 4 bindsym $mod+F5 workspace 5 bindsym $mod+F6 workspace 6 bindsym $mod+F7 workspace 7 bindsym $mod+F8 workspace 8 bindsym $mod+F9 workspace 9 bindsym $mod+F10 workspace 10 # move focused container to workspace bindsym $mod+Shift+F1 move container to workspace 1 bindsym $mod+Shift+F2 move container to workspace 2 bindsym $mod+Shift+F3 move container to workspace 3 bindsym $mod+Shift+F4 move container to workspace 4 bindsym $mod+Shift+F5 move container to workspace 5 bindsym $mod+Shift+F6 move container to workspace 6 bindsym $mod+Shift+F7 move container to workspace 7 bindsym $mod+Shift+F8 move container to workspace 8 bindsym $mod+Shift+F9 move container to workspace 9 bindsym $mod+Shift+F10 move container to workspace 10 # reload the configuration file bindsym $mod+Shift+r reload # exit sway (logs you out of your sway session) bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit' # Fancy logout set $mode_system System (l) lock, (e) logout, (a) goaway, (s) suspend, (h) hibernate, (r) reboot, (CTRL+s) shutdown mode "$mode_system" { bindsym l exec --no-startup-id $lock, mode "default" bindsym e exec --no-startup-id swaymsg exit, mode "default" bindsym a exec --no-startup-id $HOME/bin/goaway, mode "default" bindsym s exec --no-startup-id systemctl suspend, mode "default" bindsym h exec --no-startup-id systemctl hibernate, mode "default" bindsym r exec --no-startup-id systemctl reboot, mode "default" bindsym Ctrl+s exec --no-startup-id systemctl poweroff -i, mode "default" # back to normal: Enter or Escape bindsym Return mode "default" bindsym Escape mode "default" } bindsym $mod+BackSpace mode "$mode_system" # resize window (you can also use the mouse for that) mode "Resize Mode" { # These bindings trigger as soon as you enter the resize mode bindsym Left resize shrink width 6 px or 6 ppt bindsym Down resize grow height 6 px or 6 ppt bindsym Up resize shrink height 6 px or 6 ppt bindsym Right resize grow width 6 px or 6 ppt bindsym Shift+Left resize shrink width 12 px or 12 ppt bindsym Shift+Down resize grow height 12 px or 12 ppt bindsym Shift+Up resize shrink height 12 px or 12 ppt bindsym Shift+Right resize grow width 12 px or 12 ppt bindsym h resize shrink width 6 px or 6 ppt bindsym k resize grow height 6 px or 6 ppt bindsym j resize shrink height 6 px or 6 ppt bindsym l resize grow width 6 px or 6 ppt bindsym Shift+h resize shrink width 12 px or 12 ppt bindsym Shift+k resize grow height 12 px or 12 ppt bindsym Shift+j resize shrink height 12 px or 12 ppt bindsym Shift+l resize grow width 12 px or 12 ppt # back to normal: Enter or Escape bindsym Return mode "default" bindsym Escape mode "default" bindsym $mod+r mode "default" } bindsym $mod+r mode "Resize Mode" # Disable titlebar default_border none default_floating_border pixel 1 # Only enable gaps on a workspace when there is at least one container smart_gaps on # Enable popup during fullscreen popup_during_fullscreen smart # window focus follows your mouse movements as the mouse crosses window borders focus_follows_mouse yes # Configure the bar bar { swaybar_command waybar position bottom hidden_state hide mode dock modifier Mod4 } # To get the app_id of the focused window use: # $ sleep 2 ; swaymsg -t get_tree | jq -r '..|try select(.focused == true)' assign [class="^Wfica$"] 3 assign [class="zoom"] 5 assign [title="^Zoom"] 5 assign [class="^mpv$"] 9 assign [app_id="^mpv$"] 9 assign [app_id="firefox"] 2 assign [app_id="org.qutebrowser.qutebrowser"] 2 assign [class="^darktable$"] 4 assign [class="^Darktable$"] 4 assign [app_id="^org.telegram.desktop"] 6 assign [title="^Signal"] 6 assign [title="^Tootle"] 6 assign [title="^Element"] 6 assign [app_id="com.github.iwalton3.jellyfin-media-player"] 8 assign [title="Jellyfin Media Player"] 8 for_window { [title="ttmenu"] move scratchpad [title="Reminders"] floating enable [title="Reminders"] sticky enable [title="^Print$"] floating disable } input type:touchpad { tap enabled click_method clickfinger middle_emulation enabled dwt enabled tap_button_map lrm } # Custom keys bindsym $mod+Shift+n exec swaync-client -t -sw bindsym $mod+m move scratchpad bindsym $mod+o scratchpad show bindsym Mod4+l exec --no-startup-id "~/bin/lock.sh -m" bindsym Mod4+Shift+l exec --no-startup-id "~/bin/lock.sh -m -t" bindsym Mod4+Tab focus right bindsym Mod4+Shift+Tab focus left bindsym $mod+Control+h move workspace to output left bindsym $mod+Control+j move workspace to output down bindsym $mod+Control+k move workspace to output up bindsym $mod+Control+l move workspace to output right bindsym $mod+Shift+Control+h move container to output left bindsym $mod+Shift+Control+j move container to output down bindsym $mod+Shift+Control+k move container to output up bindsym $mod+Shift+Control+l move container to output right bindsym $mod+Shift+x floating enable, sticky enable, resize set 50 ppt 50 ppt, move position 0 px 0 px bindsym $mod+Shift+Return exec --no-startup-id $HOME/bin/myterm bindsym $mod+x [urgent=latest] focus # Set inner/outer gaps gaps inner 0 gaps outer 0 # Hide titlebar on windows: default_border pixel 1 # Default Font font pango:Noto Sans Regular 10 # Thin borders: smart_borders on # Title format for windows for_window [shell="xdg_shell"] title_format "%title (%app_id)" for_window [shell="x_wayland"] title_format "-X- %class - %title" # class border bground text indicator child_border client.focused #6272A4 #6272A4 #F8F8F2 #6272A4 #6272A4 client.focused_inactive #44475A #44475A #F8F8F2 #44475A #44475A client.unfocused #282A36 #282A36 #BFBFBF #282A36 #282A36 client.urgent #44475A #FF5555 #F8F8F2 #FF5555 #FF5555 client.placeholder #282A36 #282A36 #F8F8F2 #282A36 #282A36 client.background #F8F8F2 exec_always ${pkgs.keyutils}/bin/keyctl link @u @s exec ${pkgs.shikane}/bin/shikane exec ${pkgs.wayland-pipewire-idle-inhibit}/bin/wayland-pipewire-idle-inhibit exec_always ${pkgs.shikane}/bin/shikanectl reload exec ${pkgs.foot}/bin/foot -W 36x22 -T ttmenu -f "Courier New:size=12" -e ttmenu-loop seat * hide_cursor 8000 # exec ${pkgs.systemd}/bin/systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK # exec ${pkgs.dbus}/bin/dbus-update-activation-environment --all 2>/dev/null && dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK exec ${pkgs.udiskie}/bin/udiskie exec ${pkgs.wl-clipboard}/bin/wl-paste -t text --watch clipman store exec ~/bin/auto-start exec ${pkgs.sway-audio-idle-inhibit}/bin/sway-audio-idle-inhibit exec ${pkgs.swaynotificationcenter}/bin/swaync exec ${pkgs.networkmanagerapplet}/bin/nm-applet exec ${pkgs.kdePackages.kdeconnect-kde}/bin/kdeconnect-indicator exec ~/bin/myweb exec ~/bin/myterm exec ${pkgs.headset-charge-indicator}/bin/headset-charge-indicator.py exec ${pkgs.wlsunset}/bin/wlsunset -l 29.7 -L -95.8 # exec ${pkgs.blueman}/bin/blueman-applet include /etc/sway/config.d/* ''; programs = { swaylock = { enable = true; settings = { ignore-empty-password = true; daemonize = true; indicator-radius = "100"; scaling = "fill"; #fade-in = "3"; #effect-blur = "3x10"; }; }; waybar = { enable = true; settings = { mainBar = { ipc = true; position = "top"; height = 20; spacing = 0; modules-left = ["sway/workspaces" "sway/mode" "wlr/workspaces" "custom/mycal"]; modules-center = []; modules-right = [ "idle_inhibitor" "custom/toggle-sink" "custom/mytimew" "pulseaudio" "custom/mymusic" "bluetooth" "network" "backlight" "battery" "tray" "custom/mycal" "clock" ]; bluetooth = { format-alt = "bt: {status}"; format-on = "bt"; format-connected = "^bt"; format-off = "!bt"; format-disabled = "xbt"; on-click = "bzmenu -l rofi"; tooltip-format = "{status}"; }; backlight = { device = "intel_backlight"; format = "{icon} {percent}%"; format-alt-click = "click-right"; on-scroll-down = "${pkgs.brightnessctl}/bin/brightnessctl set +1"; on-scroll-up = "${pkgs.brightnessctl}/bin/brightnessctl set 1-"; }; "custom/toggle-sink" = { format = "sink"; on-click = "~/bin/toggle-sink"; }; "custom/mytimew" = { exec = "~/bin/timebar"; interval = 30; on-click = "${pkgs.alacritty}/bin/alacritty -e ~/bin/ttmenu"; }; "custom/mycal" = { exec = "~/bin/show-next-event"; interval = 300; on-click = "~/bin/mynewterm -e ikhal"; }; "custom/mymusic" = { exec = "~/bin/show-playing"; on-click = "~/bin/control-music --pause"; interval = 5; }; "sway/window" = {icon-size = 10;}; "sway/mode" = {format = ''{}'';}; "idle_inhibitor" = { format = "{icon}"; format-icons = { activated = ""; deactivated = ""; }; }; tray = { icon-size = 16; spacing = 10; expand = true; show-passive-items = true; }; clock = { tooltip-format = '' {:%Y %B %d} {calendar}''; format = "{:%I:%M %p}"; format-alt = "{:%Y-%m-%d}"; on-click = "~/bin/mynewterm -e ikhal"; }; cpu = { format = "cpu: {usage}%"; tooltip = false; }; memory = {format = "mem: {}%";}; temperature = { critical-threshold = 80; format = "{temperatureC}°C {icon}"; }; battery = { states = { good = 75; warning = 20; critical = 10; }; format = "{capacity}% {time}"; format-charging = "c:{capacity}% {time}"; format-plugged = "p:{capacity}% {time}"; format-discharging = "d:{capacity}% {time}"; format-alt = "{time} {icon}"; }; network = { format-wifi = "{essid} ({signalStrength}%)"; format-ethernet = "{ipaddr}/{cidr}"; tooltip-format = "{ifname} via {gwaddr}"; format-linked = "{ifname} (No IP)"; format-disconnected = "Disconnected"; format-alt = "{ifname}: {ipaddr}/{cidr}"; # on-click = "iwmenu -l rofi"; }; pulseaudio = { format = "v:{volume}%"; format-bluetooth = "{volume}% {icon} {format_source}"; format-bluetooth-muted = " {icon} {format_source}"; format-muted = "muted"; format-source = "v:{volume}% "; format-source-muted = ""; format-icons = { headphone = "hp"; hands-free = "hf"; headset = "hs"; phone = "p"; }; on-click = "${pkgs.pwvucontrol}/bin/pwvucontrol"; }; }; }; style = '' * { border: none; border-radius: 0; font-family: "JetBrains Mono", FontAwesome6Free, SymbolsNerdFont, Roboto, Helvetica, Arial, sans-serif; font-size: 10px; min-height: 0; } window#waybar { background: rgba(43, 48, 59, 0.5); border-bottom: 3px solid rgba(100, 114, 125, 0.5); color: #ffffff; } window#waybar.hidden { opacity: 0.0; } #workspaces button { padding: 0 5px; background: transparent; color: #ffffff; border-bottom: 3px solid transparent; } #workspaces button.focused { background: #64727D; border-bottom: 3px solid #ffffff; } #workspaces button.urgent { background-color: #eb4d4b; } #mode { background: #64727D; border-bottom: 3px solid #ffffff; } #clock, #battery, #cpu, #memory, #temperature, #backlight, #network, #pulseaudio, #custom-mymusic, #tray, #mode, #idle_inhibitor, #bluetooth { padding: 0 5px; margin: 0 0px; } #clock { background-color: #64727D; color: #f1fa8c; } #battery { color: #000000; background-color: #50fa7b; } #battery.warning { color: #000000; background-color: #ff79c6; } #battery.critical { color: #ffffff; background-color: #ff5555; } #battery.charging { color: #44475a; background-color: #50fa7b; } @keyframes blink { to { background-color: #ffffff; color: #000000; } } #battery.critical:not(.charging) { background: #f53c3c; color: #ffffff; animation-name: blink; animation-duration: 0.5s; animation-timing-function: linear; animation-iteration-count: infinite; animation-direction: alternate; } #cpu { background: #2ecc71; color: #000000; } #memory { background: #9b59b6; } #backlight { color: #000000; background: #90b1b1; } #bluetooth { background: #ffb86c; color: #000000; } #network { background: #bd93f9; color: #000000; } #network.disconnected { background: #ff5555; } #pulseaudio { background: #ffb86c; color: #000000; } #pulseaudio.muted { background: #90b1b1; color: #2a5c45; } #custom-mytimew { background: #8be9fd; color: #000000; } #custom-mymusic { background: #8be9fd; color: #000000; } #custom-mycal { background: #cccc99; color: #2a5c45; } #temperature { background: #f0932b; } #temperature.critical { background: #eb4d4b; } #tray { background-color: #64727D; } #idle_inhibitor { background-color: #2d3436; } #idle_inhibitor.activated { background-color: #ecf0f1; color: #2d3436; } ''; }; }; }