# {{@@ header() @@}}
#  _ _____
# (_)___ /
# | | |_ \
# | |___) |
# |_|____/


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

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

# 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

# The combination of xss-lock, nm-applet and pactl is a popular choice, so
# they are included here as an example. Modify as you see fit.

# xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the
# screen before suspend. Use loginctl lock-session to lock your screen.
exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork

# NetworkManager is the most popular way to manage wireless networks on Linux,
# and nm-applet is a desktop environment-independent system tray GUI for it.
exec --no-startup-id nm-applet

# Use pactl to adjust volume in PulseAudio.
set $refresh_i3status killall -SIGUSR1 i3status
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status
bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status

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

# start a terminal
bindsym $mod+Return exec terminal

# kill focused window
bindsym $mod+x kill


# Home row direction keys, like vim
set $left       {{@@ key.left @@}}
set $down       {{@@ key.down @@}}
set $up         {{@@ key.up @@}}
set $right      {{@@ key.right @@}}
set $menu       s
set $mus        r


{%@@ for dir in "Left,Up,Right,Down".split(',') @@%}
    {%@@ set resize_cmd = "{} {} 20px".format(
        ('shrink' if (loop.index0 < 2) else 'grow'),
        ('height' if (loop.index0 % 2) else 'width'),
    ) @@%}
    # Move focus
    bindsym $mod+${{@@         dir @@}} focus  {{@@ dir @@}}
    bindsym $mod+{{@@          dir @@}} focus  {{@@ dir @@}}
    # Move window
    bindsym $mod+Shift+${{@@   dir @@}} move   {{@@ dir @@}}
    bindsym $mod+Shift+{{@@    dir @@}} move   {{@@ dir @@}}
    # Resize window
    bindsym $mod+Control+${{@@ dir @@}} resize {{@@ resize_cmd @@}}
    bindsym $mod+Control+{{@@  dir @@}} resize {{@@ resize_cmd @@}}
{%@@ endfor @@%}

# Switch to workspace
# Move focused container to workspace
{%@@ for i in range(1,11) @@%}
    bindsym $mod+{{@@       i%10 @@}} workspace {{@@                i @@}}
    bindsym $mod+Shift+{{@@ i%10 @@}} move container workspace {{@@ i @@}}
{%@@ endfor @@%}

# go/move to Workspaces
# button8,9 = Mouse next/prev button
# Prior,Next = PageUp/Down
{%@@ for targ, buttons in {
    "prev_on_output": [ key.tabL, "bracketleft", "Prior", "button9", ],
    "next_on_output": [ key.tabR, "bracketright", "Next", "button8", ],
}.items() @@%}
{%@@ for button in buttons @@%}
    {%@@ set pref = ("--whole-window " if "button" in button) @@%}
    bindsym {{@@ pref @@}}$mod+{{@@       button @@}}      workspace {{@@ targ @@}}
    bindsym {{@@ pref @@}}$mod+Shift+{{@@ button @@}} move workspace {{@@ targ @@}}
{%@@ endfor @@%}
{%@@ endfor @@%}

###############################################################
# Layout
###############################################################

# Splits
bindsym $mod+v splitv
# No splith since we can just mod+r

# Layout styles
bindsym $mod+t layout tabbed
bindsym $mod+r layout toggle split

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

# Floating
bindsym $mod+Shift+space floating toggle
bindsym $mod+space focus mode_toggle

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






####################################################################
# OLD
####################################################################

# 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+P restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+F 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" {
        # These bindings trigger as soon as you enter the resize mode

        # 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 n resize shrink width 10 px or 10 ppt
        bindsym e resize grow height 10 px or 10 ppt
        bindsym i resize shrink height 10 px or 10 ppt
        bindsym o 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+p mode "default"
}

bindsym $mod+p mode "resize"

# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
        status_command i3status
}
