# Configures output devices.
# (This file is rather device-specific; it was made for roxy but can be used as a base for other devices.)

# OUTPUT VARIABLES
# ~~~~~~~~~~~~~~~~

# Define short names for screens.
set $OUTPUT_INTERNAL         eDP-1
set $OUTPUT_OFFICE_PRIMARY   "LG Electronics LG ULTRAWIDE 0x0008F23D"
set $OUTPUT_OFFICE_SECONDARY "Dell Inc. DELL U2422HE 5KTPNM3"

# Define which outputs are the primary, secondary and tertiary screens. Used to assign workspaces.
# Can be a list of output names, in which case the first valid (connected) output in the list will be used.
# (Don't specify internal display as fallback, otherwise workspaces might be assigned to it while in docked mode.)
set $OUTPUT_PRIMARY   $OUTPUT_OFFICE_PRIMARY
set $OUTPUT_SECONDARY $OUTPUT_OFFICE_SECONDARY
set $OUTPUT_TERTIARY  $OUTPUT_INTERNAL

# Define spatial orientation of screens.
# Used for keybindings to switch between outputs (comma, period, slash).
# (Only single names allowed, "focus output" sadly doesn't work with fallback output names.)
set $OUTPUT_LEFT   $OUTPUT_OFFICE_PRIMARY
set $OUTPUT_CENTER $OUTPUT_OFFICE_SECONDARY
set $OUTPUT_RIGHT  $OUTPUT_INTERNAL


# OUTPUT SETTINGS
# ~~~~~~~~~~~~~~~

# Set the wallpaper for all outputs
output "*" background ~/.wallpapers/desktop fill #000000

# Office: Primary screen (LG ultra-wide, 2560x1080)
output $OUTPUT_OFFICE_PRIMARY {
    # Place left-most
    position 0 0
    scale 1
}

# Office: Secondary screen (Dell, 1920x1080)
output $OUTPUT_OFFICE_SECONDARY {
    # Place right of primary screen
    position 2560 0
    scale 1
}

# Internal laptop screen (1920x1080)
# (Standalone if not docked, or tertiary screen when docked in office)
output $OUTPUT_INTERNAL {
    scale 1.25
}

# Switch focus to primary screen on start
# (Note: "focus output" sadly doesn't work with fallback outputs (like the workspace assignment),
#   but that's okay: If we're docked, this works. Otherwise, there's only one screen anyway.)
exec swaymsg focus output $OUTPUT_OFFICE_PRIMARY


# OUTPUT KEYBINDINGS
# ~~~~~~~~~~~~~~~~~~

# Keybindings to switch focus between screens
bindsym $mod+comma  focus output $OUTPUT_LEFT
bindsym $mod+period focus output $OUTPUT_CENTER
bindsym $mod+slash  focus output $OUTPUT_RIGHT

# Keybindings to move focused window/container between screens
bindsym $mod+Shift+comma  move container to output $OUTPUT_LEFT;   focus output $OUTPUT_LEFT
bindsym $mod+Shift+period move container to output $OUTPUT_CENTER; focus output $OUTPUT_CENTER
bindsym $mod+Shift+slash  move container to output $OUTPUT_RIGHT;  focus output $OUTPUT_RIGHT

# Keybindings to move entire workspace between screens
bindsym $mod+Control+comma  move workspace to output $OUTPUT_LEFT
bindsym $mod+Control+period move workspace to output $OUTPUT_CENTER
bindsym $mod+Control+slash  move workspace to output $OUTPUT_RIGHT
