# 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 http://i3wm.org/docs/userguide.html for a complete reference!

set $mod Mod4

set $term $(command -v kitty || command -v urxvt || command -v xterm || command -v xst || command -v st)

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

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

# 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 $term

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

# start dmenu / rofi (a program launcher)
# bindsym $mod+d exec dmenu_run
bindsym $mod+d exec rofi -show run
bindsym $mod+Shift+d exec rofi -show drun
# 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

# run an arbitrary shell sommand
bindsym $mod+Shift+Return exec rofi -dmenu -p ">" | $SHELL

bindsym $mod+Tab exec --no-startup-id rofi -show window

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

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

# split in horizontal orientation
bindsym $mod+Shift+v split h

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

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

# Move floating container to the center
bindsym $mod+c move position center
bindsym $mod+shift+c move position center
#bindsym $mod+shift+c move absolute position center

# focus last urgent
bindsym $mod+i [urgent=latest] focus

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

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

# switch to workspace
bindsym $mod+n workspace next_on_output
bindsym $mod+p workspace prev_on_output

bindsym $mod+1 workspace 1
bindsym $mod+2 workspace 2
bindsym $mod+3 workspace 3
bindsym $mod+4 workspace 4
bindsym $mod+5 workspace 5
bindsym $mod+6 workspace 6
bindsym $mod+7 workspace 7
bindsym $mod+8 workspace 8
bindsym $mod+9 workspace 9
bindsym $mod+0 workspace 10

bindsym $mod+z scratchpad show

# move focused container to workspace
bindsym $mod+Shift+n move container to workspace next_on_output , workspace next_on_output
bindsym $mod+Shift+p move container to workspace prev_on_output , workspace prev_on_output

bindsym $mod+shift+1 exec "i3-msg move container to workspace 1 && i3-msg workspace 1"
bindsym $mod+shift+2 exec "i3-msg move container to workspace 2 && i3-msg workspace 2"
bindsym $mod+shift+3 exec "i3-msg move container to workspace 3 && i3-msg workspace 3"
bindsym $mod+shift+4 exec "i3-msg move container to workspace 4 && i3-msg workspace 4"
bindsym $mod+shift+5 exec "i3-msg move container to workspace 5 && i3-msg workspace 5"
bindsym $mod+shift+6 exec "i3-msg move container to workspace 6 && i3-msg workspace 6"
bindsym $mod+shift+7 exec "i3-msg move container to workspace 7 && i3-msg workspace 7"
bindsym $mod+shift+8 exec "i3-msg move container to workspace 8 && i3-msg workspace 8"
bindsym $mod+shift+9 exec "i3-msg move container to workspace 9 && i3-msg workspace 9"
bindsym $mod+shift+0 exec "i3-msg move container to workspace 10 && i3-msg workspace 10"

bindsym $mod+Shift+z move scratchpad

# move focus to output
bindsym $mod+o focus output next
bindsym $mod+shift+o move container to output next , focus output next
bindsym $mod+shift+w move workspace to output next

bindsym $mod+shift+s sticky toggle

focus_follows_mouse no

# windows demanding focus will always be marked urgent but the focus will not be stolen
focus_on_window_activation urgent

# reload the configuration file
bindsym $mod+Shift+r reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+Escape restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+e exec "echo 'no\nyes' | rofi -dmenu -p 'exit i3?' | grep -qi yes && 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

        # border pixel 6, border color #FF0000

        # Pressing left will shrink the window’s width.
        bindsym Shift+h resize shrink width 12 px, move right 6 px
        bindsym h resize shrink width 192 px, move right 96 px
        # Pressing up will shrink the window’s height.
        bindsym Shift+k resize grow height 12 px, move up 6 px
        bindsym k resize grow height 192 px, move up 96 px
        # Pressing down will grow the window’s height.
        bindsym Shift+j resize shrink height 12 px, move down 6 px
        bindsym j resize shrink height 192 px, move down 96 px
        # Pressing right will grow the window’s width.
        bindsym Shift+l resize grow width 12 px, move left 6 px
        bindsym l resize grow width 192 px, move left 96 px

        # same bindings, but for the arrow keys
        bindsym Left resize shrink width 12 px, move right 6 px
        bindsym Up resize grow height 12 px, move up 6 px
        bindsym Down resize shrink height 12 px, move down 6 px
        bindsym Right resize grow width 12 px, move left 6 px

        # make also center work in resize mode
        bindsym $mod+shift+c move absolute position center
        bindsym Shift+c move position center
        bindsym c move position center

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

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

bindsym $mod+r mode "resize"

# resizing

set $maxw 1644
set $minw 12
set $maxh 1236
set $minh 12

# floating window size
floating_minimum_size 12 x 12
floating_maximum_size 1644 x 1236

# Pressing left will shrink the window’s width.
bindsym $mod+Shift+Left resize shrink width 24 px, move right 12 px
bindsym $mod+Left resize shrink width 96 px, move right 48 px
# Pressing up will grow the window’s height.
bindsym $mod+Shift+Up resize grow height 24 px, move up 12 px
bindsym $mod+Up resize grow height 96 px, move up 48 px
# Pressing down will shrink the window’s height.
bindsym $mod+Shift+Down resize shrink height 24 px, move down 12 px
bindsym $mod+Down resize shrink height 96 px, move down 48 px
# Pressing right will grow the window’s width.
bindsym $mod+Shift+Right resize grow width 24 px, move left 12 px
bindsym $mod+Right resize grow width 96 px, move left 48 px

set $black               #191919
set $dark                #222222
set $tone                #66cccc
set $dimmed              #747369
set $attention           #c47848

# window colors
#                        border     background text    indicator  child_border
client.focused           $dimmed    $dimmed    $tone   $dimmed    $dimmed
client.focused_tab_title $dimmed    $dimmed    $black
client.focused_inactive  $black     $dark      $dimmed $dark      $black
client.unfocused         $black     $black     $dimmed $black     $black
client.urgent            $attention $attention $black  $attention $attention

# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
   mode invisible
   modifier None
   position top
   status_command i3blocks
   tray_output primary
#  tray_padding 0
   separator_symbol " "
   font pango:Hasklig, Source Code Pro 7
	colors {
		background $dark
	   separator #757575
		#                  border             background         text
		focused_workspace  $dark              $dark              $tone
		inactive_workspace $dark              $dark              $dimmed
		urgent_workspace   $attention         $attention         $tone
	}
}

# i3bar
bindsym $mod+b bar mode dock
bindsym $mod+shift+b bar mode invisible

# gaps
bindsym $mod+g gaps inner all set 0px
bindsym $mod+shift+g gaps inner all set 12px

# border
bindsym $mod+t exec i3-msg '[class=".*"] border pixel 1'
bindsym $mod+shift+t exec i3-msg '[class=".*"] border none'

# default_border
default_border pixel 1
default_floating_border pixel 1

# Media volume controls
bindsym XF86AudioMute exec amixer set Master toggle
bindsym XF86AudioLowerVolume exec amixer set Master 2%-
bindsym XF86AudioRaiseVolume exec amixer set Master 2%+
bindsym XF86MonBrightnessUp exec brightnessctl s +10%
bindsym XF86MonBrightnessDown exec brightnessctl s 10%-
bindsym XF86AudioPlay exec playerctl play-pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous
bindsym XF86AudioStop exec playerctl play-pause

# Screenshot
bindsym $mod+s exec "maim -s -u --quality=10 | xclip -selection clipboard -t image/png"

# # repeat key rate
exec xset r rate 260 90  # use /etc/X11/xorg.conf.d

# x config
exec xrdb -load .Xresources

# bg color
exec --no-startup-id hsetroot -solid "#000000"

# center new floating windows
for_window [floating] move position center

# float pop-ups, don't focus
no_focus [window_role="pop-up"]
for_window [window_role="pop-up"] floating enable
for_window [window_role="^floating$"] floating enable

# float always
for_window [class="Sxiv"] floating enable
for_window [class="Nsxiv"] floating enable
for_window [class="Vlc"] floating enable
for_window [class="kitty"] floating enable , resize set 828 420
for_window [class="xst"] floating enable , resize set 828 420 , border pixel 1
for_window [class="XTerm"] floating enable , resize set 828 420
for_window [class="URxvt"] floating enable , resize set 828 420
# for_window [class="Vimb"] floating enable

# default layout for workspace level windows
workspace_layout tabbed

# set audio
exec --no-startup-id pipewire

# set default keyboard layout
exec --no-startup-id setxkbmap -layout us -variant symbolic -option 'compose:off'

# change keyboard layout
bindsym $mod+backslash exec setxkbmap -layout us -variant symbolic -option 'compose:off'
bindsym $mod+shift+backslash exec setxkbmap us intl

# night light
#exec --no-startup-id xflux -l 41.1 -g -8.4 -k 2500
exec --no-startup-id redshift -l 41.1:-8.4 -t 6500:2500

# start compositor
exec --no-startup-id picom

# # hdmi mirror
# exec --no-startup-id xrandr --output HDMI-1 --same-as eDP-1

# bg image
exec --no-startup-id feh --bg-fill ~/.jrvieira/bg.png

# rebind caps to esc
exec --no-startup-id xmodmap ~/.Xmodmap

# hide cursor
exec xbanish

# notifications
exec dunst

# machine specific
exec --no-startup-id ~/this

# cat
exec oneko -tofocus

# launch terminal
# exec $term