# Read `man 5 sway` for a complete reference.

### Variables

# Logo key. Use Mod1 for Alt.
set $mod mod4
#set $background ~/Pictures/wallpaper/arch.jpg

# Your preferred terminal emulator
set $term ghostty

# Your preferred application launcher
# Note: pass the final command to swaymsg so that the resulting window can be opened
# on the original workspace that the command was run on.
#set $menu dmenu_path | dmenu | xargs swaymsg exec --

set $menu rofi -show drun
#set $menu wofi --show run
#set $menu mounch -p
#bindsym $mod+d exec

# Start your launcher
bindsym $mod+d exec $menu|xargs swaymsg exec --
bindsym --release Super_L exec $menu|xargs swaymsg exec --

# Home row direction keys, like vim
set $left h
set $down j
set $up k
set $right l

# Workspaces
set $ws1 "1 "
set $ws2 "2 "
set $ws3 "3 "
set $ws4 "4 "
set $ws5 "5 "
#set $ws6 "6 "
#set $ws7 "7 "
#set $ws8 "8 "
#set $ws9 "9 "
#set $ws10 "10"

set $bg #000000
set $br #1F51FF
set $brbug #FF0000
set $textColor #cbccc6

# class		border  backgr. text		indicator	child_border
client.focused	$br     $br     $textColor	$brbug		$br

#output configurations
# You can get the names of your outputs by running: swaymsg -t get_outputs


#xdg-desktop-portal-wlr
#exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway

#output eDP-1 scale 1.30
output eDP-1 mode 1920x1080@120hz scale 1.30
#output eDP-1 mode 2560x1440@165.003Hz position 0,0 adaptive_sync on
#output DP-3 mode 2560x1440 position 0,0 adaptive_sync on
#output HDMI-A-1 res 2560x1440 position 0,0

#wallpaper
#output * bg $background fill

#way-displays
#exec way-displays > /tmp/way-displays.${XDG_VTNR}.${USER}.log 2>&1

#windows borders

gaps inner 10
gaps outer 8
#smart_gaps on
default_border pixel 2
default_floating_border normal
hide_edge_borders smart
#smart_borders on
focus_follows_mouse no
floating_modifier $mod normal
font CascadiaCodePLSemiBoldItalic 10
#
#font
#font pango: CascadiaCodePLSemiBoldItalic 11

#polkit
exec_always /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1

##Idle configuration
#
# Example configuration:
#
# exec swayidle -w \
#          timeout 300 'swaylock -f -c 000000' \
#          timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \
#          before-sleep 'swaylock -f -c 000000'
#
# This will lock your screen after 300 seconds of inactivity, then turn off
# your displays after another 300 seconds, and turn your screens back on when
# resumed. It will also lock your screen before your computer goes to sleep.

### Input configuration
#
# Example configuration:
#
#   input "2:14:SynPS/2_Synaptics_TouchPad" {
#       dwt enabled
#       tap enabled
#       natural_scroll enabled
#       middle_emulation enabled
#   }
#
# You can get the names of your inputs by running: swaymsg -t get_inputs
# Read `man 5 sway-input` for more information about this section.

input * {
    xkb_layout "es,us"
}
#  _  _________   ______ ___ _   _ ____ ___ _   _  ____ ____
# | |/ / ____\ \ / / __ )_ _| \ | |  _ \_ _| \ | |/ ___/ ___|
# | ' /|  _|  \ V /|  _ \| ||  \| | | | | ||  \| | |  _\___ \
# | . \| |___  | | | |_) | || |\  | |_| | || |\  | |_| |___) |
# |_|\_\_____| |_| |____/___|_| \_|____/___|_| \_|\____|____/
#
#
# Basics:
#
# Start a terminal
bindsym $mod+Return exec $term
 
# Kill focused window
bindsym $mod+Shift+q kill

# 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.

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

# 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:
#
bindsym $mod+1 workspace number $ws1
bindsym $mod+2 workspace number $ws2
bindsym $mod+3 workspace number $ws3
bindsym $mod+4 workspace number $ws4
bindsym $mod+5 workspace number $ws5
#bindsym $mod+6 workspace number $ws6
#bindsym $mod+7 workspace number $ws7
#bindsym $mod+8 workspace number $ws8
#bindsym $mod+9 workspace number $ws9
#bindsym $mod+0 workspace number $ws10
#
# Move focused container to workspace
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


# 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

# enable Alt+Tab Functionality
bindsym $mod+Tab workspace next
bindsym $mod+Shift+Tab workspace prev

# jump to last used workspace
bindsym $mod+grave workspace back_and_forth

#
# Scratchpad:
#
# Sway has a "scratchpad", which is a bag of holding for windows.
# You can send windows there and get them back later.

# Move the currently focused window to the scratchpad
bindsym $mod+Shift+minus move scratchpad

# Show the next scratchpad window or hide the focused scratchpad window.
# If there are multiple scratchpad windows, this command cycles through them.
bindsym $mod+minus scratchpad show

bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +2%
bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -2%
bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle
bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle
bindsym XF86AudioPlay exec playerctl play-pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous
bindsym XF86Search exec $menu

#bindsym XF86MonBrightnessUp exec brightnessctl s 200+
#bindsym XF86MonBrightnessDown exect brightnessctl s 200-

#screenshot with slurp
# Take a screenshot with all output and save it into screenshots
bindsym Print exec grim -t jpeg ~/Pictures/Sway-Screenshots/$(date +%Y-%m-%d_%H-%m-%s).jpg

# Take a Screenshot with the region select
bindsym $mod+Print exec grim -t jpeg -g "$(slurp)" ~/Pictures/Sway-Screenshots/$(date +%Y-%m-%d_%H-%m-%s).jpg

# Resizing containers:
#
mode "resize" {
# left will shrink the containers width
# right will grow the containers width
# up will shrink the containers height
# down will grow the containers height
bindsym $left resize shrink width 10px
bindsym $down resize grow height 10px
bindsym $up resize shrink height 10px
bindsym $right resize grow width 10px

# Ditto, with arrow keys
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"

bindsym $mod+r mode "resize"
}

#     _    ____  ____  _     ___ ____    _  _____ ___ ___  _   _ ____
#    / \  |  _ \|  _ \| |   |_ _/ ___|  / \|_   _|_ _/ _ \| \ | / ___|
#   / _ \ | |_) | |_) | |    | | |     / _ \ | |  | | | | |  \| \___ \
#  / ___ \|  __/|  __/| |___ | | |___ / ___ \| |  | | |_| | |\  |___) |
# /_/   \_\_|   |_|   |_____|___\____/_/   \_\_| |___\___/|_| \_|____/
#

# Default settings for some applications
for_window [class="vlc"] floating enable
for_window [class="vlc"] move absolute center

#for_window [class="MuPDF"] floating enable
#for_window [app_id="pavucontrol"] floating enable
for_window [app_id="blueman-manager"] floating enable

for_window [class = "kitty"] floating enable

for_window [title="Picture-in-Picture"] {
  sticky enable
  move position 78ppt 65ppt
}

for_window [class="sway-img"] {
  floating enable
  move absolute center
  resize set 1200 800
}

#waybar
bar {
	swaybar_command waybar
	strip_workspace_numbers yes
}


assign [app_id="firefox"] → $ws2
assign [class="firefox"] → $ws2

assign [app_id=thunar] 3
for_window [app_id=thunar] focus
assign [app_id="Microsoft-edge"] → $ws2
#assign [app_id="microsoft-edge-stable"] → $ws2
assign [class="thunar"] → $ws3
assign [app_id="obs"] → $ws4
assign [class="Steam"] → $ws5
#assign [app_id="Steam"] → $ws5
assign [app_id="lutris"] → $ws5
#assign [app_id="virt-manager"] → $ws6
#assign [app_id="vlc"] → $ws7
#assign [app_id="audacious"] → $ws9
#assign [app_id="easyeffects"] → $ws9
#assign [app_id="pavucontrol-qt"] 9

#     _   _   _ _____ ___  ____ _____  _    ____ _____
#    / \ | | | |_   _/ _ \/ ___|_   _|/ \  |  _ \_   _|
#   / _ \| | | | | || | | \___ \ | | / _ \ | |_) || |
#  / ___ \ |_| | | || |_| |___) || |/ ___ \|  _ < | |
# /_/   \_\___/  |_| \___/|____/ |_/_/   \_\_| \_\|_|
#

#mako
exec_always mako

#easyeffects
exec easyeffects --gapplication-service -l my_own2
#exec easyeffects -r
#exec easyeffects -l my_own2

#autotiling
exec_always autotiling

#pavucontrol-qt
exec pavucontrol-qt

#GTK+ apps long time to load fix
exec dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK


#swayfx

include $HOME/.config/sway/blur
include $HOME/.config/sway/corner


include /etc/sway/config.d/*



