#Mod key. Win key is more usefull and preferable one.
set $mod Mod4

#Direction keys, vim-style.
set $left h
set $down j
set $up k
set $right l

#My terminal emulator. Usually it is alacritty, because of Rust.
set $term alacritty

#Launch menu. I like wofi more than dmenu.
set $menu dmenu_path | wofi --show drun -I | xargs swaymsg exec --

#Gaps. I change it really often.
gaps outer 6
gaps inner 12

#smart_gaps on

#Border.
default_border pixel

for_window [tiling] border pixel 3

smart_borders on

#Class                  Border  BG      Indicator   Parent_Border
client.focused          #4c7899 #285577 #ffffff     #2e9ef4
client.focused_inactive #333333 #5f676a #ffffff     #484e50
client.unfocused        #333333 #222222 #888888     #292d2e

#Monitors.
output HDMI-A-1 resolution 1920x1080 position 1280,0
output HDMI-A-2 resolution 1280x768 position 0,314

workspace 1 output HDMI-A-1
workspace 2 output HDMI-A-2

#Wallpaper.
output * bg /home/moony/Images/Wallpapers/Star\ Fly.png fill

#Input
input * {
	xkb_layout us,ru
	xkb_options grp:ctrl_shift_toggle,grp:win_space_toggle
	xkb_numlock enabled
}

#Keys and so on.
#
#Basic.
#Terminal.
bindsym --to-code $mod+Return exec $term
#Kill focused window.
bindsym --to-code $mod+Shift+q kill
#Start menu.
bindsym --to-code $mod+d exec $menu
#Reload config.
bindsym --to-code $mod+Shift+c reload
#Exit sway.
bindsym --to-code $mod+Shift+Escape exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will also end you Wayland session.' -B 'Yes, exit sway' 'swaymsg exit'

#Move.
#Move focus.
#Left.
bindsym --to-code $mod+$left focus left
bindsym --to-code $mod+Left focus left
#Right.
bindsym --to-code $mod+$right focus right
bindsym --to-code $mod+Right focus right
#Up
bindsym --to-code $mod+$up focus up
bindsym --to-code $mod+Up focus up
#And down.
bindsym --to-code $mod+$down focus down
bindsym --to-code $mod+Down focus down

#Move windows.
#Left.
bindsym --to-code $mod+Shift+$left move left
bindsym --to-code $mod+Shift+Left move left
#Right.
bindsym --to-code $mod+Shift+$right move right
bindsym --to-code $mod+Shift+Right move right
#Up.
bindsym --to-code $mod+Shift+$up move up
bindsym --to-code $mod+Shift+Up move up
#And down (again).
bindsym --to-code $mod+Shift+$down move down
bindsym --to-code $mod+Shift+Down move down

#Workspaces.
#Switch.
bindsym --to-code $mod+1 workspace number 1
bindsym --to-code $mod+2 workspace number 2
bindsym --to-code $mod+3 workspace number 3
bindsym --to-code $mod+4 workspace number 4
bindsym --to-code $mod+5 workspace number 5
bindsym --to-code $mod+6 workspace number 6
bindsym --to-code $mod+7 workspace number 7
bindsym --to-code $mod+8 workspace number 8
bindsym --to-code $mod+9 workspace number 9
bindsym --to-code $mod+0 workspace number 0
#Move window.
bindsym --to-code $mod+Shift+1 move container to workspace number 1
bindsym --to-code $mod+Shift+2 move container to workspace number 2
bindsym --to-code $mod+Shift+3 move container to workspace number 3
bindsym --to-code $mod+Shift+4 move container to workspace number 4
bindsym --to-code $mod+Shift+5 move container to workspace number 5
bindsym --to-code $mod+Shift+6 move container to workspace number 6
bindsym --to-code $mod+Shift+7 move container to workspace number 7
bindsym --to-code $mod+Shift+8 move container to workspace number 8
bindsym --to-code $mod+Shift+9 move container to workspace number 9
bindsym --to-code $mod+Shift+0 move container to workspace number 10

#Layouts.
#Split.
bindsym --to-code $mod+b splith
bindsym --to-code $mod+v splitv
#Switch containers between different layouts.
bindsym --to-code $mod+s layout stacking
bindsym --to-code $mod+w layout tabbed
bindsym --to-code $mod+e layout toggle split
#Fullscreen.
bindsym --to-code $mod+f fullscreen
#Toggle tiling and floating.
bindsym --to-code $mod+Shift+space floating toggle
#Switch between floating and tiling.
bindsym --to-code $mod+space focus mode_toggle
#Focus parent.
bindsym --to-code $mod+a focus parent

#Scratchpad
#Move window to scratchpad.
bindsym --to-code $mod+Shift+Minus move scratchpad
#Cycle through scratchpad windows.
bindsym --to-code $mod+minus scratchpad show

#Resize.
mode "resize" {
	#Left.
	bindsym --to-code $left resize shrink width 10px
	bindsym --to-code Left resize shrink width 10px
	#Right.
	bindsym --to-code $right resize grow width 10px
	bindsym --to-code Right resize grow width 10px
	#Up.
	bindsym --to-code $up resize shrink height 10px
	bindsym --to-code Up resize shrink height 10px
	#Down.
	bindsym --to-code $down resize grow height 10px
	bindsym --to-code Down resize grow height 10px

	#Default mode.
	bindsym --to-code Return mode "default"
	bindsym --to-code Escape mode "default"
	bindsym --to-code Alt+F4 mode "default"
}
#Enable resize mode.
bindsym --to-code $mod+r mode "resize"

#Waybar.
bar {
	swaybar_command waybar
}

#Opacity.

bindsym --to-code $mod+Ctrl+n opacity minus 0.1

bindsym --to-code $mod+Ctrl+m opacity 1

include /etc/sway/config.d/*
