# sway configuration file
# v2 (2023) by koehr

set $mod Mod4
set $term foot
set $editor hx
set $rofi_cmd rofi -terminal '$term' -show drun

set $black       #000000
set $darkgray    #212121
set $red         #fb4934
set $darkred     #cc241d
set $green       #b8bb26
set $darkgreen   #98971a
set $yellow      #fabd2f
set $darkyellow  #d79921
set $blue        #83a598
set $darkblue    #458588
set $magenta     #d3869b
set $darkmagenta #b16286
set $cyan        #8ec07c
set $darkcyan    #689d6a
set $white       #ebdbb2
set $darkwhite   #a89984
set $transparent #00000000

set $ws1  "1:  "
set $ws2  "2:  "
set $ws3  "3: ⚂ "
set $ws4  "4: ⚃ "
set $ws5  "5: ⚄ "
set $ws6  "6: ⚅ "
set $ws7  "7: 7 "
set $ws8  "8: 8 "
set $ws9  "9: 9 "
set $ws10 "10: 10 "
set $ws11 "11: 11 "
set $ws12 "12: 12 "
set $ws13 "13: 13 "
set $ws14 "14: 14 "
set $ws15 "15: 15 "
set $ws16 "16: 16 "
set $ws17 "17: 17 "
set $ws18 "18: 18 "
set $ws19 "19: 19 "
set $ws20 "20: 20 "

output eDP-1 {
  res 2880x1800@120Hz
  pos 0,0
  scale 1.5
  render_bit_depth 10
  adaptive_sync on
  bg $HOME/Wallpapers/desktop.jpg fill
}
output DP-1 {
  res 2880x864@120Hz
  pos 0,1200
  scale 1.5
  render_bit_depth 10
  adaptive_sync on
  bg #000000 solid_color
}
input type:keyboard {
  xkb_layout us
  xkb_variant alt-intl-unicode
  xkb_options grp:alt_shift_toggle
}
input type:touchpad {
  tap enabled
  tap_button_map lrm
  drag enabled
  click_method clickfinger
  scroll_method two_finger
  natural_scroll disabled
  dwt enabled
}

gaps inner 2
gaps outer 0
default_border pixel 1
default_floating_border normal 2
titlebar_border_thickness 0
hide_edge_borders --i3 smart
smart_borders on
smart_gaps on

workspace_auto_back_and_forth yes
font monospace 0

#                       BORDER      BACKGROUND  TEXT   INDICATOR   CHILD_BORDER
client.focused          $yellow     $yellow     $black $yellow     $yellow
client.unfocused        $black      $black      $white $black      $darkyellow
client.focused_inactive $black      $black      $white $black      $darkyellow
client.urgent           $darkred    $darkred    $black $darkred    $darkred
client.background       $black

#bar {
#  font Monofur Nerd Font 14
#  output eDP-1
#  position top
#}

# window management
floating_modifier $mod normal
bindsym $mod+Return exec $term
bindsym $mod+q kill
bindsym $mod+p exec --no-startup-id $rofi_cmd

bindsym $mod+Left focus left
bindsym $mod+Right focus right
bindsym $mod+Up focus up
bindsym $mod+Down focus down

bindsym $mod+Shift+Left move left 35px
bindsym $mod+Shift+Down move down 35px
bindsym $mod+Shift+Up move up 35px
bindsym $mod+Shift+Right move right 35px

bindsym $mod+Shift+minus split h
bindsym $mod+Shift+backslash split v
bindsym $mod+Shift+equal split toggle

bindsym $mod+w layout tabbed
bindsym $mod+Shift+w layout stacking
bindsym $mod+equal layout toggle split

bindsym $mod+Shift+space floating toggle
bindsym $mod+space focus mode_toggle
bindsym $mod+Shift+s sticky toggle

bindsym $mod+a focus parent
bindsym $mod+Shift+a focus child

# switch workspaces
bindsym $mod+1 workspace $ws1
bindsym $mod+2 workspace $ws2
bindsym $mod+3 workspace $ws3
bindsym $mod+4 workspace $ws4
bindsym $mod+5 workspace $ws5
bindsym $mod+6 workspace $ws6
bindsym $mod+7 workspace $ws7
bindsym $mod+8 workspace $ws8
bindsym $mod+9 workspace $ws9
bindsym $mod+0 workspace $ws10

bindsym $mod+Ctrl+1 workspace $ws11
bindsym $mod+Ctrl+2 workspace $ws12
bindsym $mod+Ctrl+3 workspace $ws13
bindsym $mod+Ctrl+4 workspace $ws14
bindsym $mod+Ctrl+5 workspace $ws15
bindsym $mod+Ctrl+6 workspace $ws16
bindsym $mod+Ctrl+7 workspace $ws17
bindsym $mod+Ctrl+8 workspace $ws18
bindsym $mod+Ctrl+9 workspace $ws19
bindsym $mod+Ctrl+0 workspace $ws20

bindgesture swipe:right workspace prev
bindgesture swipe:left workspace next
bindsym $mod+Tab workspace back_and_forth

# move workspaces between monitors
bindsym $mod+Prior move workspace to up  # Prior is also called PageUp
bindsym $mod+Next move workspace to down # Next is also called PageDown
bindsym $mod+Home move workspace to left
bindsym $mod+End move workspace to right

# move containers between workspaces
bindsym $mod+Shift+1 move container to workspace number $ws1
bindsym $mod+Shift+2 move container to workspace number $ws2
bindsym $mod+Shift+3 move container to workspace number $ws3
bindsym $mod+Shift+4 move container to workspace number $ws4
bindsym $mod+Shift+5 move container to workspace number $ws5
bindsym $mod+Shift+6 move container to workspace number $ws6
bindsym $mod+Shift+7 move container to workspace number $ws7
bindsym $mod+Shift+8 move container to workspace number $ws8
bindsym $mod+Shift+9 move container to workspace number $ws9
bindsym $mod+Shift+0 move container to workspace number $ws10

# scratchpad
bindsym $mod+Shift+backspace move scratchpad
bindsym $mod+backspace scratchpad show
# make fullscreen window sticky and floating on the top right corner of the screen
bindsym $mod+y fullscreen disable; floating enable; resize set 400 300; sticky enable; move window to position 1180 20

bindsym $mod+l exec /home/n/.local/bin/lock

# reload config / restart
bindsym $mod+Shift+c reload
bindsym $mod+Shift+r restart
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'

# MULTIMEDIA CONTROL KEYS
#bindsym XF86AudioLowerVolume exec --no-startup-id pulsemixer --change-volume -5
#bindsym XF86AudioRaiseVolume exec --no-startup-id pulsemixer --change-volume +5
#bindsym XF86AudioMute exec --no-startup-id pulsemixer --toggle-mute

#bindsym XF86MonBrightnessDown exec --no-startup-id sudo light -U 10
#bindsym XF86MonBrightnessUp exec --no-startup-id sudo light -A 10

# SCREENSHOTS
bindsym --release Print exec --no-startup-id "grim -t jpeg $HOME/Media/Screenshots/scrot-$(date +%Y%m%d%H%M%S).jpg"
bindsym --release Shift+Print exec --no-startup-id "grim -t jpeg -g $(slurp) $HOME/Media/Screenshots/scrot-$(date +%Y%m%d%H%M%S).jpg"

exec swayidle -w \
  timeout 300 'swaylock -f -c 000000' \
  timeout 600 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' \
  before-sleep 'swaylock -f -c 000000'

include '$(/usr/libexec/sway/layered-include "/usr/share/sway/config.d/*.conf" "/etc/sway/config.d/*.conf" "${XDG_CONFIG_HOME:-$HOME/.config}/sway/config.d/*.conf")'
