{ pkgs, ... }:
(pkgs.writeText "config" ''
  # i3 config file (v4)
  #
  # Please see http://i3wm.org/docs/userguide.html for a complete reference!

  exec redshift-gtk -l 51.0504:13.7373

  ### START USER CONFIG ###
  set $mod Mod4
  workspace "HDMI" output HDMI1
  workspace_auto_back_and_forth yes
  new_window pixel
  hide_edge_borders both

  exec setxkbmap de

  #exec compton -f
  exec ${pkgs.feh}/bin/feh --bg-scale $(xdg-user-dir PICTURES)/wallpaper.jpg
  #exec pulseaudio -D
  exec fcitx5
  #exec conky -c $HOME/.my_little_conky/.conkyrc
  #exec xsnow -nosanta -norudolf -notrees
  #exec $LOCK

  ###  END USER CONFIG  ###

  ### START USER PROGRAMMS ###

  ###  END USER PROGRAMMS  ###

  ### START MEDIA BINDSYM ###

  bindsym XF86AudioPlay exec ${pkgs.playerctl}/bin/playerctl play
  bindsym XF86AudioPause exec ${pkgs.playerctl}/bin/playerctl pause
  bindsym XF86AudioNext exec ${pkgs.playerctl}/bin/playerctl next
  bindsym XF86AudioPrev exec ${pkgs.playerctl}/bin/playerctl previous

  bindsym $mod+Mod1+space exec ${pkgs.playerctl}/bin/playerctl play-pause
  bindsym $mod+Mod1+Left exec ${pkgs.playerctl}/bin/playerctl position 10-
  bindsym $mod+Mod1+Right exec ${pkgs.playerctl}/bin/playerctl position 10+
  bindsym $mod+Mod1+Down exec ${pkgs.playerctl}/bin/playerctl next
  bindsym $mod+Mod1+Up exec ${pkgs.playerctl}/bin/playerctl previous

  bindsym $mod+Shift+w sticky toggle
  bindsym $mod+Shift+B floating enable; border none; resize set 900 600; move position 1020 19

  ###  END MEDIA BINDSYM  ###


  ### START BINDSYM ###

  bindsym $mod+b border toggle
  bindsym $mod+m bar mode toggle
  bindsym $mod+y move container to output left
  bindsym $mod+x move container to output right
  bindsym $mod+Shift+y move workspace to output left
  bindsym $mod+Shift+x move workspace to output right
  bindsym $mod+l exec ${pkgs.i3lock}/bin/i3lock -efc 000000
  bindsym $mod+minus exec ${pkgs.alsa-utils}/bin/amixer -c 0 sset Master 1%-
  bindsym $mod+plus exec ${pkgs.alsa-utils}/bin/amixer -c 0 sset Master 1%+
  bindsym $mod+Mod1+minus exec ${pkgs.alsa-utils}/bin/amixer -D pulse sset Master 1%-
  bindsym $mod+Mod1+plus exec ${pkgs.alsa-utils}/bin/amixer -D pulse sset Master 1%+
  bindsym $mod+Shift+minus exec ${pkgs.acpilight}/bin/xbacklight -5
  bindsym $mod+Shift+plus exec ${pkgs.acpilight}/bin/xbacklight +5
  bindsym $mod+Ctrl+0 exec ${pkgs.acpilight}/bin/xbacklight -set 0
  bindsym $mod+Ctrl+1 exec ${pkgs.acpilight}/bin/xbacklight -set 10
  bindsym $mod+Ctrl+2 exec ${pkgs.acpilight}/bin/xbacklight -set 20
  bindsym $mod+Ctrl+3 exec ${pkgs.acpilight}/bin/xbacklight -set 30
  bindsym $mod+Ctrl+4 exec ${pkgs.acpilight}/bin/xbacklight -set 40
  bindsym $mod+Ctrl+5 exec ${pkgs.acpilight}/bin/xbacklight -set 50
  bindsym $mod+Ctrl+6 exec ${pkgs.acpilight}/bin/xbacklight -set 60
  bindsym $mod+Ctrl+7 exec ${pkgs.acpilight}/bin/xbacklight -set 70
  bindsym $mod+Ctrl+8 exec ${pkgs.acpilight}/bin/xbacklight -set 80
  bindsym $mod+Ctrl+9 exec ${pkgs.acpilight}/bin/xbacklight -set 90
  bindsym $mod+p move scratchpad
  bindsym $mod+Shift+p scratchpad show
  bindsym --release $mod+Ctrl+s exec scrot
  bindsym --release $mod+Ctrl+d exec "scrot --select"
  bindsym --release $mod+Ctrl+a exec "scrot -s '/tmp/%F_%T_$wx$h.png' -e 'xclip -selection clipboard -target image/png -i $f && rm $f'"
  bindsym $mod+o exec pcmanfm
  bindsym $mod+Mod1+1 exec luxa fade --speed 50 '00ff00'
  bindsym $mod+Mod1+2 exec luxa fade --speed 50 'ffff00'
  bindsym $mod+Mod1+3 exec luxa fade --speed 50 'ff0000'
  bindsym $mod+Mod1+4 exec luxa fade --speed 50 '0000ff'
  bindsym $mod+Mod1+5 exec luxa fade --speed 50 'ffffff'
  ###  END BINDSYM  ###

  ### START MODES ###

  mode "ACPI Events" {
  	bindsym p exec systemctl poweroff; mode "default"
  	bindsym h exec systemctl hibernate; mode "default"
  	bindsym s exec systemctl suspend; mode "default"
  	bindsym r exec systemctl reboot; mode "default"
  	bindsym h exec systemctl halt; mode "default"
  	bindsym e exec systemctl exit; mode "default"
  	bindsym l exec $LOCK; mode "default"

          bindsym Return mode "default"
          bindsym Escape mode "default"
  }

  mode "Power Mode"{
  	bindsym s exec  xbacklight -set 5;   exec rfkill block all  ; exec xset -b +dpms; mode "default"
  	bindsym p exec	xbacklight -set 100; exec rfkill unblock all; exec xset -dpms;    mode "default"

  	bindsym Return mode "default"
          bindsym Escape mode "default"
  }

  mode "No Keybinds" {
  	bindsym $mod+Shift+Escape mode "default"
  }

  bindsym $mod+F12 mode "ACPI Events"
  bindsym $mod+F11 mode "No Keybinds"
  bindsym $mod+F10 mode "Power Mode"

  ###  END MODES  ###

  # 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
  #font pango:System San Francisco Display 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

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

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

  # start dmenu (a program launcher)
  bindsym $mod+d exec ${pkgs.rofi}/bin/rofi -config /etc/rofi.rasi -show combi
  # 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

  # 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+odiaeresis move right
  #bindsym $mod+Shift+semicolon1 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+h split h

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

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

  # change container layout (stacked, tabbed, toggle split)
  bindsym $mod+q 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+s focus child

  # switch to workspace
  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

  # move focused container to workspace
  bindsym $mod+Shift+1 move container to workspace 1
  bindsym $mod+Shift+2 move container to workspace 2
  bindsym $mod+Shift+3 move container to workspace 3
  bindsym $mod+Shift+4 move container to workspace 4
  bindsym $mod+Shift+5 move container to workspace 5
  bindsym $mod+Shift+6 move container to workspace 6
  bindsym $mod+Shift+7 move container to workspace 7
  bindsym $mod+Shift+8 move container to workspace 8
  bindsym $mod+Shift+9 move container to workspace 9
  bindsym $mod+Shift+0 move container to workspace 10

  # 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" {
          # 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 j resize shrink width 10 px or 10 ppt
          bindsym k resize grow height 10 px or 10 ppt
          bindsym l resize shrink height 10 px or 10 ppt
          bindsym semicolon 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
          bindsym Return mode "default"
          bindsym Escape mode "default"
  }

  bindsym $mod+r mode "resize"

  # Start i3bar to display a workspace bar (plus the system information i3status
  # finds out, if available)
  bar {
    position top
    status_command py3status -c /etc/i3/py3status
    tray_output primary
    # status_command i3status
    colors {
      separator #586e75
      background #002b36
      statusline #aea79f
      focused_workspace #586e75 #586e75 #ffffff
      active_workspace #073642 #073642 #ffffff
      inactive_workspace #002b36 #002b36 #aea79f
      urgent_workspace #77216f #77216f #ffffff
    }
  }
  client.focused #008666 #000000 #ffffff
  client.focused_inactive #000000 #222222 #ffffff
  client.unfocused #002b36 #333333 #ffffff #ffffff
  client.urgent #aa0000 y#990000 #ffffff

  #client.focused #586e75 #586e75 #fdf6e3 #268bd2
  #client.focused_inactive #073642 #073642 #93a1a1 #002b36
  #client.unfocused #002b36 #002b36 #586e75 #002b36
  #client.urgent #dc322f #dc322f #fdf6e3 #dc322f
'')