exec "/usr/lib/polkit-kde-authentication-agent-1"
exec_always "pkill kanshi"
exec_always "pkill swayidle"
exec_always "pkill swaync"
exec_always "sleep 1"

### Variables
set $mod Mod4
set $left h
set $down j
set $up k
set $right l
set $term kitty
set $files cosmic-files
set $browser flatpak run io.gitlab.librewolf-community 
set $menu wofi 

include /etc/sway/config-vars.d/*
exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway

exec_always {
  gsettings set org.gnome.desktop.interface gtk-theme 'catppuccin-mocha-mauve-standard+default'
}

### Output configuration
output * bg ~/.config/configfiles/wallpaper.png fill
exec_always "kanshi"

### Idle configuration
exec_always swayidle -w \
timeout 300 'swaylock -f' \
timeout 600  'swaymsg "output * dpms off"' \
resume 'swaymsg "output * dpms on"' \
before-sleep 'swaylock -f'

#timeout 1200  'systemctl suspend' \
### Input configuration
input "type:touchpad" {
    dwt enabled
    tap enabled
    middle_emulation enabled
    natural_scroll disabled
    scroll_factor 0.2
}

input "type:pointer" {
    accel_profile "flat" 
    pointer_accel 0
}
# Notification Daemon
exec_always swaync

# Toggle control center
bindsym $mod+Shift+n exec swaync-client -t -sw

# Start IDE
bindsym $mod+Shift+i exec /opt/goland/bin/goland.sh

### Key bindings

# Basics:
  # Start a terminal
  bindsym $mod+Return exec $term

  # File Browser
  bindsym $mod+Shift+t exec $files
  
  # Browser
  bindsym $mod+Shift+f exec $browser

  # Kill focused window
  bindsym $mod+Shift+q kill

  # Start your launcher
  bindsym $mod+space exec $menu

  # Drag floating windows by holding down $mod and left mouse button.
  # Resize them with right mouse button + $mod.
  # Despite the name, also works for non-floating windows.
  # Change normal to inverse to use left mouse button for resizing and right
  # mouse button for dragging.
  #floating_modifier control normal

  # Reload the configuration file
  bindsym $mod+Shift+c reload

  # Lock
  bindsym $mod+Shift+Escape exec swaylock -f -c 000000

  # Exit sway (logs you out of your Wayland 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'

# Moving around:

  # Move your focus around
  bindsym $mod+$left focus left
  bindsym $mod+$down focus down
  bindsym $mod+$up focus up
  bindsym $mod+$right focus right
  # Or use $mod+[up|down|left|right]
  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
  # Ditto, with arrow 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

# 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
  bindsym $mod+7 workspace number 7
  bindsym $mod+8 workspace number 8
  bindsym $mod+9 workspace number 9
  bindsym $mod+0 workspace number 10
  # Move focused container to workspace
  bindsym $mod+control+1 move container to workspace number 1
  bindsym $mod+control+2 move container to workspace number 2
  bindsym $mod+control+3 move container to workspace number 3
  bindsym $mod+control+4 move container to workspace number 4
  bindsym $mod+control+5 move container to workspace number 5
  bindsym $mod+control+6 move container to workspace number 6
  bindsym $mod+control+7 move container to workspace number 7
  bindsym $mod+control+8 move container to workspace number 8
  bindsym $mod+control+9 move container to workspace number 9
  bindsym $mod+control+0 move container to workspace number 10

  bindsym $mod+control+$left move workspace to output left
  bindsym $mod+control+$down move workspace to output down
  bindsym $mod+control+$up move workspace to output up
  bindsym $mod+control+$right move workspace to output right

# Layout stuff:

  # You can "split" the current object of your focus with
  # $mod+b or $mod+v, for horizontal and vertical splits
  # respectively.
  bindsym $mod+b splith
  bindsym $mod+v splitv

  # Switch the current container between different layout styles
  bindsym $mod+s layout stacking
  bindsym $mod+w layout tabbed
  bindsym $mod+e layout toggle split

  # Make the current focus fullscreen
  bindsym $mod+f fullscreen

  # Toggle the current focus between tiling and floating mode
  bindsym $mod+Shift+space floating toggle

  # Swap focus between the tiling area and the floating area
  #bindsym $mod+space focus mode_toggle

  # Move focus to the parent container
  bindsym $mod+a focus parent

# Resizing containers:

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

  bindsym Left resize shrink width 10px
  bindsym Down resize grow height 10px
  bindsym Up resize shrink height 10px
  bindsym Right resize grow width 10px

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

# Status Bar:
bar {
  swaybar_command waybar
  workspace_buttons yes
}

# Audio
bindsym XF86AudioRaiseVolume exec "wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+; pkill -RTMIN+8 waybar"
bindsym XF86AudioLowerVolume exec "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-; pkill -RTMIN+8 waybar"
bindsym XF86AudioMute exec "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle; pkill -RTMIN+8 waybar"

# Brightness
bindsym XF86MonBrightnessDown exec brightnessctl s 10%-
bindsym XF86MonBrightnessUp exec brightnessctl s +10%


# ScreenShot
bindsym $mod+p exec grim -g "$(slurp)" - | wl-copy

# Border
default_border pixel 
gaps inner 5

# Guesture
bindgesture swipe:right workspace prev
bindgesture swipe:left workspace next

include /etc/sway/config.d/*
