################################################################################
###  VARIABLES
################################################################################

set $mod Mod4
set $term kitty
set $file_man kitty -e ranger
set $menu rofi -show run
set $browser firefox
set $alt_browser waterfox
set $audio_man pavucontrol
set $email_client mutt

set $left h
set $down j
set $up k
set $right l

################################################################################
###  STARTUP
################################################################################

exec light -A 100
workspace 1
exec $term
workspace 2
exec $browser
workspace 1
exec mako

################################################################################
###  STYLING
################################################################################

font pango:iosevka Medium 9
default_border pixel 1
client.focused          #81a1c1 #81a1c1 #FFFFFF #81a1c1 #81a1c1
client.focused_inactive #282c34 #282c34 #FFFFFF #282c34 #282c34
client.urgent           #e06c75 #e06c75 #FFFFFF #e06c75 #e06c75
client.unfocused        #282c34 #282c34 #FFFFFF #282c34 #282c34

gaps inner 3
gaps outer 5

output "*" background "~/Documents/Wallpapers/w.jpg" fill

################################################################################
###  KEYBINDINGS
################################################################################

## Applications:

    bindsym --to-code $mod+Return exec $term
    bindsym --to-code $mod+Shift+Return exec $file_man
    bindsym --to-code $mod+d exec $menu
    bindsym $mod+Escape exec powermenu
    bindsym --to-code $mod+n exec notesmenu
    bindsym --to-code $mod+b exec $browser
    bindsym --to-code $mod+Shift+b exec $alt_browser

    bindsym --to-code $mod+Alt+a exec $audio_man
    bindsym --to-code $mod+Alt+b exec blueman-manager

    bindsym --to-code $mod+y exec playweb
## Sway:

    bindsym --to-code $mod+q kill
    bindsym --to-code $mod+Shift+q exec swaymsg exit
    bindsym --to-code $mod+Shift+c reload

    floating_modifier $mod normal

## Window Navigation:

    # Move your focus around
    bindsym $mod+$left focus left
    bindsym $mod+$down focus down
    bindsym $mod+$up focus up
    bindsym $mod+$right focus right

    # Move the focused window with the same, but add Shift
    bindsym $mod+Shift+$left move left
    bindsym $mod+Shift+$down move down
    bindsym $mod+Shift+$up move up
    bindsym $mod+Shift+$right move right

## Workspaces:

    # Switch to workspace
    bindsym $mod+1 workspace number 1
    bindsym $mod+2 workspace number 2
    bindsym $mod+3 workspace number 3
    bindsym $mod+4 workspace number 4
    bindsym $mod+5 workspace number 5
    bindsym $mod+6 workspace number 6

    # Move focused container to workspace
    bindsym $mod+Shift+1 move container to workspace number 1
    bindsym $mod+Shift+2 move container to workspace number 2
    bindsym $mod+Shift+3 move container to workspace number 3
    bindsym $mod+Shift+4 move container to workspace number 4
    bindsym $mod+Shift+5 move container to workspace number 5
    bindsym $mod+Shift+6 move container to workspace number 6

## Layout stuff:

    # Switch layout style of current container
    bindsym --to-code $mod+w layout tabbed
    bindsym --to-code $mod+e layout toggle split

    # bindsym $mod+space focus mode_toggle
    bindsym --to-code $mod+f fullscreen
    bindsym --to-code $mod+t floating toggle
    bindsym --to-code $mod+a focus parent

## Scratchpad:

    bindsym $mod+Shift+minus move scratchpad
    bindsym $mod+minus scratchpad show

## Spotify:

    bindsym $mod+s+p exec spotifycli --playpause
    bindsym $mod+s+l exec spotifycli --next
    bindsym $mod+s+h exec spotifycli --previous

# Random Stuff:

    bindsym --to-code $mod+p exec screenshot

mode "resize" {
    bindsym $left resize grow width 10px
    bindsym $down resize grow height 10px
    bindsym $up resize shrink height 10px
    bindsym $right resize shrink width 10px

    bindsym Return mode "default"
    bindsym Escape mode "default"
}
    bindsym --to-code $mod+r mode "resize"

## Layout keyboard

input * {
    xkb_layout "us,ru"
    xkb_options "grp:caps_toggle"
}

input <identifier> xkb_model "pc101"

## Display light
  bindsym XF86MonBrightnessUp exec light -A 1
  bindsym XF86MonBrightnessDown exec light -U 1

# Volumes

  bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +1%
  bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -1%
  bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle

################################################################################
###  GET GTK WORKING IN SWAY
################################################################################

set $gnome-schema org.gnome.desktop.interface
exec_always {
  gsettings set org.gnome.desktop.interface gtk-theme "matbook"
  gsettings set org.gnome.desktop.interface icon-theme "Arc"
  gsettings set org.gnome.desktop.interface cursor-theme "DMZ-Black"
  gsettings set $gnome-schema cursor-theme 'Adwaita'
  gsettings set $gnome-schema font-name 'iosevka Medium 9'
}

################################################################################
###  STATUS BAR
################################################################################

bar {
        swaybar_command waybar
    }
}

include /etc/sway/config.d/*


