# sway config file

set $mod Mod4

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

# Terminal
#set $term kitty
set $term foot

# Font
font pango:Iosevka SS05 Medium 10

# Kurzor
seat * xcursor_theme Bibata-Modern-Classic 24

# Launcher
set $menu "rofi -combi-modi window,drun,run -show combi -modi combi"
#set $menu j4-dmenu-desktop
#set $menu compgen -c | sort -u | fzf | xargs -r swaymsg -t command exec

output eDP-1 {
  pos 0 0 
  resolution 1920x1080 
  scale 1.2
  scale_filter smart
}
#output eDP-1 resolution 2560x1440 scale 2
#output eDP-1 resolution 1920x1080 scale 1
#output "*" background ~/Slike/Wallpapers/1596344206877.jpg fill
#output "*" background "~/riz0m/Photos/sri lanka/IMG_20220220_120730.jpg" fill
#output "*" background "~/Slike/☭/bigstock-Sutjeska-National-Park-Bosnia-63011269.jpg" fill
output "*" background "~/sredstva/dotfiles/ozadje2.jpg" fill
# Zamik dobimo z SIRINA / SCALE
output HDMI-A-2 pos 1601 0 scale 1
output HDMI-A-1 pos 1601 0 scale 1
output DP-5 pos 1601 0 scale 1
output DP-2 pos 1601 0 scale 1

# start a terminal
bindsym $mod+Return exec $term

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

# start your launcher
bindsym $mod+d 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 $mod normal

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

    # exit sway (logs you out of your wayland session)
    bindsym $mod+Shift+e 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
    bindsym $mod+$altright 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
    bindsym $mod+Shift+$altright 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:
#

# name workspaces
set $w1 1:
set $w2 2:
set $w3 3:
set $w4 4:
set $w5 5:
set $w6 6:
set $w7 7:✭❀❤♫
set $w8 8:☭
set $w9 9:
set $w0 0:

# switch to workspace
bindsym $mod+1 workspace $w1
bindsym $mod+2 workspace $w2
bindsym $mod+3 workspace $w3
bindsym $mod+4 workspace $w4
bindsym $mod+5 workspace $w5
bindsym $mod+6 workspace $w6
bindsym $mod+7 workspace $w7
bindsym $mod+8 workspace $w8
bindsym $mod+9 workspace $w9
bindsym $mod+0 workspace $w0


# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace $w1
bindsym $mod+Shift+2 move container to workspace $w2
bindsym $mod+Shift+3 move container to workspace $w3
bindsym $mod+Shift+4 move container to workspace $w4
bindsym $mod+Shift+5 move container to workspace $w5
bindsym $mod+Shift+6 move container to workspace $w6
bindsym $mod+Shift+7 move container to workspace $w7
bindsym $mod+Shift+8 move container to workspace $w8
bindsym $mod+Shift+9 move container to workspace $w9
bindsym $mod+Shift+0 move container to workspace $w0

bindsym $mod+Tab workspace next
bindsym $mod+Shift+Tab workspace prev
bindsym Mod1+Shift+$right move workspace to output right
bindsym Mod1+Shift+$altright move workspace to output right
bindsym Mod1+Shift+j move workspace to output left

# back and forth between workspaces
bindsym Mod1+Tab workspace back_and_forth

# workspace bindings
assign [class="Firefox"] $w8
assign [class="Gnote"] $w9
assign [class="Slack"] $w4
assign [class="Element"] $w4
assign [class="Lollypop"] $w3
assign [class="Transmission"] $w3
assign [class="Nicotine+"] $w3

# Program startup
#exec lollypop &



#
# 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+h 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 Mod1+space focus mode_toggle

    # move focus to the parent container
    bindsym $mod+a focus parent
#
# 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
#
# 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 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

    # ditto, with 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

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

set $ospredje #cccccc
set $ospredjeTrans #cccccccc
set $ospredjeNefokusiran #ebdbb2cc
set $ozadje #32302f
set $ozadjeTrans #32302fcc

#
# Status Bar:
#
# Read `man 5 sway-bar` for more information about this section.
bar {
    position top
    status_command i3status
    colors {
        focused_background $ozadje
        background $ozadjeTrans
        statusline $ospredje

        focused_workspace $ospredje $ospredje $ozadje
        active_workspace $ospredjeTrans $ospredjeTrans $ozadje 
        inactive_workspace $ozadje $ozadje $ospredje
    }
    font pango:FontAwesome, Iosevka SS01 Medium 12
    strip_workspace_numbers yes
    height 26
    #tray_padding 2
    separator_symbol ""
}

#include /etc/sway/config.d/*

set $zelena #b8bb26
set $temnoZelena #98971a
set $okvir #665c54
set $bg0_s #32302f
set $fg3 #bdae93

# Colors
client.focused          $okvir $ozadje $ospredje $ospredje $okvir
client.focused_inactive #444444 #444444 #A9D000 $fg3 $bg0_s
client.unfocused        #222222 #222222 #888888 #292d2e #222222

# gaps between windows
gaps inner 6
smart_gaps on

#smart_borders on
# No titles
#for_window [class="^.*"] border pixel 2
default_border pixel 3
default_floating_border normal
hide_edge_borders smart

# Mouse focus
focus_follows_mouse yes

# Premik kurzorja v aktivno okno
mouse_warping container

# KBD layouti
input "type:keyboard" {
  xkb_layout us,si
  xkb_options grp:win_space_toggle,compose:caps
}

# Touchpad fensi
input "type:touchpad" {
  tap enabled
  click_method clickfinger
  natural_scroll enabled
  dwt enabled
  scroll_factor 0.25
  #pointer_accel 0.5
  click_method clickfinger
}

# Radio študent
bindsym Mod1+shift+r exec vlc /home/g1smo/Glasba/rs.m3u
bindsym Mod1+shift+x exec playerctl play-pause
bindsym Mod1+shift+c exec playerctl play-pause

# Zvok
set $vol_down_cmd pamixer -d 5
set $vol_up_cmd pamixer -i 5
set $vol_toggle_cmd pamixer -t

bindsym $mod+shift+d exec "$vol_up_cmd"
bindsym XF86AudioRaiseVolume exec "$vol_up_cmd"
bindsym $mod+shift+s exec "$vol_down_cmd"
bindsym XF86AudioLowerVolume exec "$vol_down_cmd"
bindsym XF86AudioMute exec "$vol_toggle_cmd"
bindsym $mod+shift+a exec "$vol_toggle_cmd"

# GTK tema
set $gnome-schema org.gnome.desktop.interface
exec_always {
  gsettings set $gnome-schema gtk-theme 'Arc-Darker'
  gsettings set $gnome-schema icon-theme 'Papirus'
  gsettings set $gnome-schema cursor-theme 'Adwaita'
}

# Zvetlost zaslona
bindsym XF86MonBrightnessUp exec "brightnessctl set 3%+"
bindsym XF86MonBrightnessDown exec "brightnessctl set 3%-"

# Zunanji skrin
bindsym $mod+p exec "swaymsg output HDMI-A-2 enable"
bindsym $mod+shift+p exec "swaymsg output HDMI-A-2 disable"

# Skrinsot
bindsym 0xff61 exec ~/bin/screenshot

# Scaling toggle
bindsym $mod+i exec "swaymsg output eDP-1 scale 1"
bindsym $mod+o exec "swaymsg output eDP-1 scale 1.2"
bindsym $mod+y exec "swaymsg output HDMI-A-1 pos 0 0 && swaymsg output eDP-1 pos 1920 0"
bindsym $mod+u exec "swaymsg output HDMI-A-1 pos 1600 0 && swaymsg output eDP-1 pos 0 0"

bindsym $mod+space exec "/home/g1smo/bin/get-layout.sh"

######
# AUTOSTART
###

# Fix za pocasen GTK app startup
exec dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK

# transparenca nekativnih oken
exec ~/bin/inactive-windows-transparency.py

# Desktop notifikacije
exec mako --default-timeout=5000 --icon-path /usr/share/icons/Numix

# Autotiling https://github.com/nwg-piotr/autotiling
exec ~/bin/autotiling.py

# Rdece, da lahko spim, hvala
exec gammastep -m wayland -l 46.05108:14.50513

# Zagoni programov razporejeni na workspejse
workspace 1:
#exec firefox
exec librewolf

workspace 2:
exec emacs

workspace 3:
exec icedove

workspace 4:
#exec revolt
#exec element-desktop --enable-features=UseOzonePlatform --ozone-platform=wayland
exec element-desktop

workspace 9:
exec gnome-keyring-daemon --start --control-directory=/run/user/1000/keyring
exec keepassxc

# autolock in te fore
#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'

# prazna baterija tezenje
exec ~/bin/swaynag-battery

# Lebdeca okna (najdes preko "swaymsg -t get_tree")
for_window [app_id="org.keepassxc.KeePassXC"] floating enable
