set $foreground	#a3a3a3ff
set $background	#1f2022e5
set $dark_black	#1f2022ff
set $light_black   #282828ff
set $dark_red	  #444155ff
set $light_red	 #585858ff
set $dark_green	#b8b8b8ff
set $light_green   #a3a3a3ff
set $dark_yellow   #e8e8e8ff
set $light_yellow  #f8f8f8ff
set $dark_blue	 #f2241fff
set $light_blue	#ffa500ff
set $dark_magenta  #b1951dff
set $light_magenta #67b11dff
set $dark_cyan	 #2d9574ff
set $light_cyan	#4f97d7ff
set $dark_white	#a31db1ff
set $light_white   #b03060ff

xwayland enable

# global modifier key
set $mod Mod4

# 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

# the font to be used for i3bar and window decorations
font pango:Source Code Pro 8

bindsym $mod+Return exec alacritty
bindsym $mod+Space exec bemenu-run

# switch keyboard to neo
#bindsym $mod+F1 exec neo-key
#bindsym $mod+F2 exec eu-key

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

# toggle moving floating windows with the mouse
floating_modifier $mod

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

# resize window (you can also use the mouse for that)
mode "resize" {
	# resize windows with hjkl
	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
	
	# back to normal mode 
	bindsym Return mode "default"
	bindsym Escape mode "default"
}

# switch to resize mode
bindsym $mod+r mode "resize"

# set border width of new window
default_border pixel 1

# keep focus within current container?
focus_wrapping no

# focus goes to window if mouse is moved onto it
focus_follows_mouse yes

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

# default orientation of new windows
default_orientation horizontal

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

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

# change container layout (stacked, tabbed, toggle split)
bindsym $mod+x layout toggle all

# name workspaces
set $1 1
set $2 2
set $3 3
set $4 4
set $5 5
set $6 6
set $7 7
set $8 8
set $9 9
set $10 10

# default mode
workspace_layout tabbed

# automatically jump back to previous workspace
workspace_auto_back_and_forth yes

# messaging
#workspace 2 output LVDS-1

# web and doc
#workspace 1 output VGA-1

# editor and IDE
#workspace 3 output DP-2

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

# focus latest urgent window
bindsym $mod+Shift+1 [urgent=latest] focus

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

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

# focus tiling/floating
bindsym $mod+f focus mode_toggle

# focus workspace
bindsym $mod+1 workspace number $1
bindsym $mod+2 workspace number $2
bindsym $mod+3 workspace number $3
bindsym $mod+4 workspace number $4
bindsym $mod+5 workspace number $5
bindsym $mod+6 workspace number $6
bindsym $mod+7 workspace number $7
bindsym $mod+8 workspace number $8
bindsym $mod+9 workspace number $9
bindsym $mod+0 workspace number $10
bindsym $mod+n workspace next_on_output
bindsym $mod+p workspace prev_on_output

# focus different outputs (displays)
bindsym $mod+shift+h focus output left
bindsym $mod+shift+j focus output down
bindsym $mod+shift+k focus output up
bindsym $mod+shift+l focus output right

# show the first scratchpad window
bindsym $mod+minus scratchpad show

set $mode_move "move"
bindsym $mod+m mode "$mode_move"

mode "$mode_move" {

	# move focused container
	bindsym h move left ;mode "default"
	bindsym j move down ;mode "default"
	bindsym k move up   ;mode "default"
	bindsym l move right;mode "default"
	bindsym 1 move container to workspace number $1     ;mode "default"
	bindsym 2 move container to workspace number $2     ;mode "default"
	bindsym 3 move container to workspace number $3     ;mode "default"
	bindsym 4 move container to workspace number $4     ;mode "default"
	bindsym 5 move container to workspace number $5     ;mode "default"
	bindsym 6 move container to workspace number $6     ;mode "default"
	bindsym 7 move container to workspace number $7     ;mode "default"
	bindsym 8 move container to workspace number $8     ;mode "default"
	bindsym 9 move container to workspace number $9     ;mode "default"
	bindsym 0 move container to workspace number $10    ;mode "default"
	bindsym n move container to workspace next_on_output;mode "default"
	bindsym p move container to workspace prev_on_output;mode "default"

	# move focused workspace to output
	bindsym shift+h move workspace to output left ; mode "default"
	bindsym shift+j move workspace to output down ; mode "default"
	bindsym shift+k move workspace to output up ; mode "default"
	bindsym shift+l move workspace to output right ; mode "default"
	bindsym shift+n move container to output next ; mode "default"
	bindsym shift+p move container to output prev ; mode "default"

	# make the currently focused window a scratchpad
	bindsym minus move scratchpad; mode "default"
	
	# Move container to the current position of the cursor
	bindsym m move position mouse; mode "default"

	bindsym Escape mode "default"
}

# lock the screen
bindsym $mod+equal exec lock-session

# control volume
bindsym --locked XF86AudioRaiseVolume exec amixer set 'Master' 5%+ && pkill -RTMIN+10 i3blocks
bindsym --locked XF86AudioLowerVolume exec amixer set 'Master' 5%- && pkill -RTMIN+10 i3blocks
bindsym --locked XF86AudioMute exec amixer set Master toggle && pkill -RTMIN+10 i3blocks
bindsym --locked --to-code XF86AudioMicMute exec --no-startup-id pactl set-source-mute 1 toggle

# control media player
bindsym --locked XF86AudioPlay exec playerctl play-pause && pkill -RTMIN+11 i3blocks
bindsym --locked XF86LaunchA exec playerctl play-pause && pkill -RTMIN+11 i3blocks
bindsym --locked XF86AudioNext exec playerctl next && pkill -RTMIN+11 i3blocks
bindsym --locked XF86Explorer exec playerctl next && pkill -RTMIN+11 i3blocks
bindsym --locked XF86AudioPrev exec playerctl previous && pkill -RTMIN+11 i3blocks
bindsym --locked XF86Search exec playerctl previous && pkill -RTMIN+11 i3blocks

# control screen brightness
bindsym --locked XF86MonBrightnessUp exec brightnessctl set -d intel_backlight +5%
bindsym --locked XF86MonBrightnessDown exec brightnessctl set -d intel_backlight 5%-

# Basic bar configuration using the Base16 variables.
bar {
	id bar
	status_command i3status
	mode dock
	modifier $mod
	position bottom
	strip_workspace_numbers yes
	workspace_buttons yes
	#output LVDS-1

	colors {
		background $background
		separator  $light_green
		statusline $foreground

		# State			Border		BG		   Text
		focused_workspace  $light_black $dark_cyan	$background
		active_workspace   $light_black $dark_green   $background
		inactive_workspace $dark_black  $background   $foreground
		urgent_workspace   $light_black $dark_red	 $background
		binding_mode	   $light_black $dark_magenta $background
	}
}

#hide_edge_borders both
bindsym XF86Launch1 exec aplay ~/lib/sounds/wortwitzklingel-mono.wav

# Basic color configuration using the Base16 variables for windows and borders.
# Property Name		 Border	   BG			Text		Indicator	 Child Border
client.focused		  $light_black $dark_cyan	$background $dark_cyan	$dark_cyan
client.focused_inactive $light_black $dark_green   $background $dark_green   $dark_green
client.unfocused		$light_black  $background   $foreground $dark_white   $dark_white
client.urgent		   $light_black $dark_red	 $background $dark_red	 $dark_red
client.placeholder	  $light_black $dark_magenta $background $dark_magenta $dark_magenta

input * {
	xkb_layout eu
	xkb_model pc105+inet
	xkb_options caps:escape
	natural_scroll enabled
}

input 2:7:SynPS/2_Synaptics_TouchPad {
	# disables the input device
	events disabled
}

seat * {
	hide_cursor 5000
}

assign [app_id="thunderbird"] workspace 1
assign [app_id="telegramdesktop"] workspace 1
assign [app_id="firefox" title="Riot.*"] workspace 1
assign [app_id="firefox" title="Instant messaging.*"] workspace 1
assign [app_id="firefox" title="Threema Web.*"] workspace 1
assign [app_id="firefox" title="chaos\.social.*"] workspace 1
assign [app_id="thunderbird" title="Write:.*"] workspace 3
assign [app_id="firefox"] workspace 2
assign [app_id="jetbrains-studio"] workspace 3
assign [app_id="org.keepassxc.KeePassXC"] workspace 10

exec xset s off
exec mako