# SWAY CONFIG


# Variables

set $mod Mod4
set $menu wofi --show drun -i -H 500 -W 450
set $term foot

set $WOBSOCK $XDG_RUNTIME_DIR/wob.sock

floating_modifier $mod normal
default_border pixel 2
client.focused #1c81e6 #1c81e6 #771cb7 #bf1541
client.unfocused #3436a7 #3436a7 #ffffff
client.focused_inactive #3436a7 #3436a7 #ffffff
gaps inner 10
gaps outer 0
font pango: Fira Code 12

# No gaps if there's only 1 window
smart_gaps on

# Hides the borders if theres only 1 window
hide_edge_borders smart

# Output configuration
output * {
        bg ~/.config/sway/background.png fill
}

output LVDS-1 pos 640 1080
output DP-1 pos 1280 0
output VGA-1 pos 0 56

# Input configuration
input type:touchpad {
        dwt disabled
        scroll_method edge
}

# Key bindings
bindsym $mod+Return exec $term
bindsym $mod+Shift+Return exec $term -a float
bindsym $mod+q kill
bindsym $mod+F4 wkill
bindsym $mod+d exec $menu
bindsym $mod+Shift+c reload
bindsym mod1+shift+w exec setbg -s
bindsym $mod+Shift+l exec ~/.local/bin/lock
bindsym $mod+Shift+q exec ~/.local/bin/logout-wofi

# 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

# 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

#resize
bindsym $mod+mod1+Left exec swaymsg resize shrink right 10px || swaymsg resize grow left 10px
bindsym $mod+mod1+Down exec swaymsg resize grow down 10px || swaymsg resize shrink up 10px
bindsym $mod+mod1+Up exec swaymsg resize shrink down 10px || swaymsg resize grow up 10px
bindsym $mod+mod1+Right exec swaymsg resize grow right 10px || swaymsg resize shrink left 10px

# 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+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
bindsym $mod+Shift+7 move container to workspace number 7
bindsym $mod+Shift+8 move container to workspace number 8
bindsym $mod+Shift+9 move container to workspace number 9
bindsym $mod+Shift+0 move container to workspace number 10

# Layout stuff:
bindsym $mod+b splith
bindsym $mod+v splitv

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

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

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

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

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

# Sticky
bindsym $mod+s sticky toggle
# Scratchpad:

bindsym $mod+bracketleft move scratchpad
bindsym $mod+bracketright scratchpad show

# Tor Browser
bindsym $mod+w exec ~/.local/bin/torbrowser


# 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

    # Return to default mode
    bindsym Return mode "default"
    bindsym Escape mode "default"
}


# Media Keys
bindsym XF86AudioLowerVolume exec pamixer -d 5 && pamixer --get-volume > $WOBSOCK
bindsym XF86AudioRaiseVolume exec pamixer -i 5 && pamixer --get-volume > $WOBSOCK

bindsym XF86MonBrightnessUp exec brightnessctl s +5%
bindsym XF86MonBrightnessDown exec brightnessctl s 5%-

bindsym XF86AudioStop exec cmus-remote -s
bindsym XF86AudioPlay exec cmus-remote -u
bindsym XF86AudioNext exec cmus-remote -n
bindsym XF86AudioPrev exec cmus-remote -r

# Funny noises
bindsym XF86Launch1 exec mpv ~/Audio/boom.opus
bindsym KP_Enter exec mpv ~/Audio/metal-pipe.opus
bindsym KP_0 exec mpv ~/Audio/running.opus
bindsym KP_Decimal exec mpv ~/Audio/among-us.opus
bindsym KP_Add exec mpv ~/Audio/wah-wah-wah-wah.opus
bindsym KP_1 exec mpv ~/Audio/boowomp.opus
bindsym KP_2 exec mpv ~/Audio/chomp.ogg
bindsym KP_3 exec mpv ~/Audio/slip.opus
bindsym KP_Subtract exec mpv ~/Audio/inception.opus
bindsym KP_4 exec mpv ~/Audio/waltuh.opus
bindsym KP_5 exec mpv ~/Audio/hallway.opus
bindsym KP_6 exec mpv ~/Audio/bell.opus
bindsym KP_Multiply exec mpv ~/Audio/lego.opus
bindsym KP_7 exec mpv ~/Audio/mega.opus

# clipped
exec ~/.local/bin/make-combined

bindsym $mod+r exec ~/.local/bin/wf-shadow -r LVDS-1
bindsym $mod+g exec ~/.local/bin/wf-shadow -r DP-1

bindsym XF86ScreenSaver exec ~/.local/bin/lock
bindsym Print exec ~/.local/bin/screenshot -w
bindsym Pause exec ~/.local/bin/logout-wofi

# Mumble

bindsym $mod+z exec mumble rpc starttalking
bindsym --release $mod+z exec mumble rpc stoptalking

# Rules
for_window [app_id="float"] floating enable;

exec swayidle -w timeout 290 'brightnessctl -s; brightnessctl s 50%-' resume 'brightnessctl -r'
exec swayidle -w timeout 300 '~/.local/bin/lock'
exec rm -f $WOBSOCK && mkfifo $WOBSOCK && tail -f $WOBSOCK | wob
exec ~/.local/bin/beep-wrapper

# Audio
exec ~/.local/bin/start-pipewire

bindswitch --reload --locked lid:on exec ~/.local/bin/suspend

bar {
        swaybar_command waybar
    }
}

include /etc/sway/config.d/*