# set edp
output eDP-1 {
  #mode 1920x1080@60.004Hz
  mode 1920x1080@144.003Hz
  #scale 1.0
  adaptive_sync on
  pos 0 0
}

output DP-1 {
  mode 2560x1440@144.000Hz
  scale 1.0
  adaptive_sync off
  pos 1920 0
  disable
}

output HDMI-A-1 {
  mode 2560x1440@144.000Hz
  scale 1.0
  adaptive_sync off
  disable
}

output HDMI-A-2 {
  mode 2560x1440@144.000Hz
  scale 1.0
  #adaptive_sync off
  pos 0 0
  disable
}

# virtual output, disabled by default
#exec swaymsg create_output
#output HEADLESS-1 {
#  mode 1920x1200
#  pos 1920 0
#}
#
#exec systemctl --user start sunshine

# set mouse
input type:pointer {
  accel_profile flat
}

# set touchpad
input "1267:12521:ELAN1205:00_04F3:30E9_Touchpad" {
  tap enabled
  tap_button_map lrm
}

# fix for gtk app loading
exec systemctl --user import-environment SWAYSOCK WAYLAND_DISPLAY
exec dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK

# kde wallet manager daemon
exec /usr/bin/kwalletd6

# disable xwayland
#xwayland disable

# fix for screen sharing
exec /usr/lib/xdg-desktop-portal -r & /usr/lib/xdg-desktop-portal-wlr

# fix for gtk theming
exec_always {
  gsettings set org.gnome.desktop.interface gtk-theme "Adwaita-dark"
  gsettings set org.gnome.desktop.interface icon-theme "Adwaita"
  gsettings set org.gnome.desktop.interface cursor-theme "Adwaita"
  gsettings set org.gnome.desktop.interface font-name "Cantarell"
}

# polkit
exec /usr/bin/lxpolkit

# easy-effects for speakers
exec /usr/bin/flatpak run --command=easyeffects com.github.wwmm.easyeffects --gapplication-service

# set mod to super
set $mod Mod4

# font for window titles
font pango:Roboto Mono for Powerline 10

# use mouse + $mod to move windows
floating_modifier $mod

# start a terminal
bindsym $mod+Return exec alacritty

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

# start dmenu
bindsym $mod+d exec j4-dmenu-desktop --dmenu='bemenu -i'

# change focus
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right

# alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right

# move focused window
bindsym $mod+Shift+h move left
bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+l move right

# alternatively, you can use the cursor 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

# split in horizontal orientation
bindsym $mod+semicolon split h

# split in vertical orienta! special
bindsym $mod+v split v

# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle

# change container layout (stacked, tabbed, toggle split)
#bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split

# toggle tiling / floating
bindsym $mod+Shift+space floating toggle

# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle

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

# focus the child container
#bindsym $mod+d focus child

# Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places.
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"

# switch to workspace
bindsym $mod+1 workspace $ws1
bindsym $mod+2 workspace $ws2
bindsym $mod+3 workspace $ws3
bindsym $mod+4 workspace $ws4
bindsym $mod+5 workspace $ws5
bindsym $mod+6 workspace $ws6
bindsym $mod+7 workspace $ws7
bindsym $mod+8 workspace $ws8
bindsym $mod+9 workspace $ws9
bindsym $mod+0 workspace $ws10

# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace $ws1
bindsym $mod+Shift+2 move container to workspace $ws2
bindsym $mod+Shift+3 move container to workspace $ws3
bindsym $mod+Shift+4 move container to workspace $ws4
bindsym $mod+Shift+5 move container to workspace $ws5
bindsym $mod+Shift+6 move container to workspace $ws6
bindsym $mod+Shift+7 move container to workspace $ws7
bindsym $mod+Shift+8 move container to workspace $ws8
bindsym $mod+Shift+9 move container to workspace $ws9
bindsym $mod+Shift+0 move container to workspace $ws10

# reload the configuration file
bindsym $mod+Shift+r reload

# exit i3 (logs you out of your X 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 session.' -B 'Yes, exit sway' 'swaymsg exit'"

# resize window
mode "resize" {
        # Pressing left will shrink the window’s width.
        # Pressing right will grow the window’s width.
        # Pressing up will shrink the window’s height.
        # Pressing down will grow the window’s height.
        bindsym h resize shrink width 10 px or 10 ppt
        bindsym j resize grow height 10 px or 10 ppt
        bindsym k resize shrink height 10 px or 10 ppt
        bindsym l resize grow width 10 px or 10 ppt

        # same bindings, but for the arrow keys
        bindsym Left resize shrink width 10 px or 10 ppt
        bindsym Down resize grow height 10 px or 10 ppt
        bindsym Up resize shrink height 10 px or 10 ppt
        bindsym Right resize grow width 10 px or 10 ppt

        # back to normal: Enter or Escape or $mod+r
        bindsym Return mode "default"
        bindsym Escape mode "default"
        bindsym $mod+r mode "default"
}

bindsym $mod+r mode "resize"

# client colors		border	backgr	text	indicator child_border
client.focused		#161b1d	#161b1d	#ebf8ff	#161b1d	#161b1d	
client.focused_inactive	#333333	#161bfd	#7ea2b4	#5a7b8c	#333333
client.unfocused	#333333	#161b1d	#7ea2b4	#5a7b8c	#333333
client.urgent		#d22d72	#161b1d	#7ea2b4	#5d5db1	#d22d72
client.placeholder	#333333	#161b1d	#7ea2b4	#5a7b8c	#333333

client.background	#161b1d

# start urxvtd for faster term load
# exec /usr/bin/urxvtd

# start polybar
exec_always --no-startup-id $HOME/.config/waybar/launch.sh

# start kde connect
exec --no-startup-id /usr/lib/kdeconnectd

# invoke i3lock-color
bindsym $mod+x exec gtklock

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

# Show the scratchpad
bindsym $mod+minus scratchpad show

# remove title bars
#for_window [class=".*"] border pixel 2
#for_window [class="VirtualBox Manager"] border normal 1
#for_window [class="VirtualBox Machine"] border normal 1
default_border pixel
default_floating_border pixel

# set gaps
#gaps top 43
#gaps inner 20

# set smart gaps
#smart_gaps on
bindsym $mod+g exec "swaymsg gaps inner current toggle 20"

# set desktop bg
exec_always swaybg -i ~/.config/sway/wall.jpg -m stretch

# start picom, config: .config/picom.conf
#exec --no-startup-id dbus-launch picom --experimental-backend

# start dunst, config: .config/dunst/dunstrc
exec --no-startup-id dunst -config .config/dunst/dunstrc

# start nextcloud
exec "/usr/bin/sleep 5; /usr/bin/nextcloud --background"

# start nm-applet
exec --no-startup-id nm-applet --indicator

# start rog-control-center
#exec --no-startup-id rog-control-center

# dunst keybinds
bindsym Ctrl+space exec dunstctl close
bindsym Ctrl+Shift+space exec dunstctl close-all

# take screenshot
#bindsym --release $mod+Control+s exec "gnome-screenshot -c"
#bindsym --release $mod+Control+s exec "import -format png -window root /tmp/ss.png && xclip -i /tmp/ss.png -selection c -t image/png && mv /tmp/ss.png ~/Pictures/Screenshots/Screenshot-$(date +%s).png"
bindsym --release $mod+s exec grim /tmp/ss.png && wl-copy </tmp/ss.png && mv /tmp/ss.png ~/Pictures/Screenshots/Screenshot-$(date +%s).png

# drag area for screenshot
#bindsym --release $mod+Shift+s exec "gnome-screenshot -a -c"
#bindsym --release $mod+Shift+s exec "import -format png /tmp/ss.png && xclip -i /tmp/ss.png -selection c -t image/png && mv /tmp/ss.png ~/Pictures/Screenshots/Screenshot-$(date +%s).png"
bindsym --release $mod+Shift+s exec grim -g "$(slurp)" /tmp/ss.png && wl-copy </tmp/ss.png && mv /tmp/ss.png ~/Pictures/Screenshots/Screenshot-$(date +%s).png

# Vol Up
bindsym XF86AudioRaiseVolume exec "pamixer --allow-boost -i 5; notify-send -u low 'Vol Up' $(pamixer --get-volume-human)"

# Vol Down
bindsym XF86AudioLowerVolume exec "pamixer --allow-boost -d 5; notify-send -u low 'Vol Down' $(pamixer --get-volume-human)"

# Media Controls! Through playerctl
bindsym XF86AudioPlay exec playerctl play-pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous

# Brightness Up
bindsym XF86MonBrightnessUp exec sudo /usr/bin/light -A 10

# Brightness Down
bindsym XF86MonBrightnessDown exec sudo /usr/bin/light -U 10

# Custom Bindings for Applications
# Mod + n Zen
bindsym $mod+n exec zen-browser

# Mod + b (old: min) notesnook
#bindsym $mod+b exec "min --use-gl=desktop --enable-features=VaapiVideoDecoder,VaapiVideoEncoder,CanvasOopRasterization --ozone-platform-hint=auto --ignore-gpu-blocklist --enable-gpu-rasterization --enable-zero-copy --disable-features=UseSkiaRenderer,UseChromeOSDirectVideoDecoder --canvas-oop-rasterization"
#bindsym $mod+b exec "notesnook --ozone-platform-hint=x11"
bindsym $mod+b exec "min-browser"

# Mod + Shift + b firefox-dev
bindsym $mod+Shift+b exec "firefox-developer-edition"

# Mod + m pantheon files
bindsym $mod+m exec io.elementary.files

# Mod + Shift + m cider 2
bindsym $mod+Shift+m exec cider --ozone-platform-hint=wayland

# emotes via rofi script
bindsym $mod+Shift+x exec /usr/local/bin/emotes

# Assign windows to workspaces
assign [class="Brave-browser"] 3
#assign [class="Steam"] 4
assign [class="discord"] 10

# make notification windows floating
for_window [window_role="pop-up"] floating enable
for_window [window_role="task_dialog"] floating enable
for_window [title="\ -\ Sharing\ Indicator$"] floating enable, sticky enable

# fix notifs for ms teams
for_window [title="Microsoft Teams Notification"] floating enable

# pavucontrol as floating
for_window [class="Pavucontrol"] floating enable
