# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#

set_from_resource $bg background #0c080b
set_from_resource $fg foreground #e5e3e3

set_from_resource $color_1 color1 #a83d63
set_from_resource $color_2 color2 #d09177
set_from_resource $color_4 color4 #b5659a
set_from_resource $color_6 color6 #aea0c7
set_from_resource $color_16 color16 #ffffff

set $screenshot_filename '%F-%H-%M-%S-$wx$h.png' 
set $scrot_move_directory_command 'mv $f ~/screenshots'

exec_always feh --bg-scale ~/wallpapers/sand.jpg

# Startup applications
exec firefox
exec thunderbird

# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
set $mod Mod4

# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font pango:monospace 10

# This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango).
#font pango:DejaVu Sans Mono 8
font pango:Fira Code 10
font pango:Iosevka 11

# Setting up borders for windows of different states
default_border pixel 6
client.focused $color_2 $color_2 #ffffff
client.focused_inactive $color_2 $color_2 #ffffff
client.urgent $color_1 $color_1 #ffffff

# Before i3 v4.8, we used to recommend this one as the default:
# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
# The font above is very space-efficient, that is, it looks good, sharp and
# clear in small sizes. However, its unicode glyph coverage is limited, the old
# X core fonts rendering does not support right-to-left and this being a bitmap
# font, it doesn’t scale on retina/hidpi displays.

# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod

# start a terminal
bindsym $mod+Return exec i3-sensible-terminal

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

# start dmenu (a program launcher)
bindsym $mod+d exec rofi -show drun -sidebar-mode -theme fds-sidebar-dark
# There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed.
# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop

# 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+j move left
bindsym $mod+Shift+k move down
bindsym $mod+Shift+l move up
bindsym $mod+Shift+semicolon 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+b split h

# split in vertical orientation
bindsym $mod+v split v

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

# jump to latest urgent window
bindsym $mod+x [urgent=latest] focus

# 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

# Volume keyboard control
bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +1% ; exec pactl set-sink-mute @DEFAULT_SINK@ 0
bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -1% ; exec pactl set-sink-mute @DEFAULT_SINK@ 0
bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle

# Moving between workspaces
bindsym XF86Back workspace prev
bindsym XF86Forward workspace next

bindsym $mod+Tab workspace next
bindsym Shift+$mod+Tab workspace prev

bindsym $mod+z move window to workspace next
bindsym Shift+$mod+z move window to workspace prev

# $mod + ` (backtick)
bindsym $mod+grave workspace back_and_forth
bindsym $mod+slash workspace back_and_forth

# Moving windows between workspaces
# $mod + Shift + ` (backtick)
bindsym Shift+$mod+grave move window to workspace back_and_forth
bindsym Shift+$mod+slash move window to workspace back_and_forth

# Application bound shortcuts
bindsym XF86HomePage exec alacritty --class "ranger" --command ranger
bindsym XF86Mail exec thunderbird

# Screenshot capture
bindsym Print exec ~/.scripts/maim-screenshot.sh
bindsym Control+Print exec ~/.scripts/maim-screenshot.sh --select

# Delayed screenshot capture
bindsym Shift+Print exec ~/.scripts/maim-screenshot.sh --delay 3
bindsym Control+Shift+Print exec ~/.scripts/maim-screenshot.sh --select --delay 3

# 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 $web_ws "1"
set $mail_ws "2"
set $code_ws "3"
set $vim_ws "4"
set $graphics_ws "5"
set $file_ws "6"
set $music_ws "7"
set $ws8 "8"
set $ws9 "9"
set $ws10 "10"

# automatic back-and-forth switching with $mod+<num>
workspace_auto_back_and_forth yes

assign [instance="^(?i)vim$"] $vim_ws
assign [class="^(?i)vim$"] $vim_ws

assign [instance="^(?i)ranger$"] $file_ws
assign [class="^(?i)ranger$"] $file_ws

assign [class="^(?i)code-oss$"] $code_ws
assign [class="^(?i)inkscape$"] $graphics_ws
assign [class="^(?i)thunderbird$"] $mail_ws

# switch to workspace
bindsym $mod+1 workspace $web_ws
bindsym $mod+2 workspace $mail_ws
bindsym $mod+3 workspace $code_ws
bindsym $mod+4 workspace $vim_ws
bindsym $mod+5 workspace $graphics_ws
bindsym $mod+6 workspace $file_ws
bindsym $mod+7 workspace $music_ws
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 $web_ws
bindsym $mod+Shift+2 move container to workspace $mail_ws
bindsym $mod+Shift+3 move container to workspace $code_ws
bindsym $mod+Shift+4 move container to workspace $vim_ws
bindsym $mod+Shift+5 move container to workspace $graphics_ws
bindsym $mod+Shift+6 move container to workspace $file_ws
bindsym $mod+Shift+7 move container to workspace $music_ws
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+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'"

# resize window (you can also use the mouse for that)
mode "resize" {
    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"

# Make dialogs to float by default
for_window [window_role="pop-up"] floating enable
for_window [window_role="task_dialog"] floating enable

# This is mostly for limiting pop-up dialogs
floating_maximum_size 750 x 650

mode "applications" {
    # Here you can add/remove/modify applications of your own, if you want
    bindsym c exec code 
    bindsym f exec firefox 
    bindsym v exec inkscape
    bindsym r exec alacritty --class "ranger" --command ranger
    bindsym Shift+r exec alacritty --command ranger
    bindsym t exec thunderbird
    bindsym a exec thunar
    bindsym x exec alacritty --class "vim" --command vim
    bindsym Shift+x exec alacritty --command vim
    bindsym o exec obs
    bindsym z exec zathura

    # Ways to exit the mode
    bindsym Escape mode "default"
    bindsym Return mode "default"
    bindsym $mod+a mode "default"
}

bindsym $mod+a mode "applications"; exec sleep 1 && i3-msg mode "default"

# i3 bar
bar {
    height 35
    font pango:Fira Code 10
    font pango:Iosevka 11
    position top
    separator_symbol " "
    status_command i3status
    tray_padding 10
    colors {
        separator $color_16
        background $bg
        statusline $fg
				# border	#background	#foreground
        focused_workspace 	$color_2 	$color_2	#ffffff
        active_workspace 	$color_4	$color_4 	#ffffff
        inactive_workspace 	$bg 		$bg		#888888
        urgent_workspace 	$color_1	$color_1 	#ffffff
    }
}

# Setting the gaps
gaps inner 6
smart_gaps on
smart_borders on 
