Dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

190 lines
6.2 KiB

4 years ago
4 years ago
  1. {writeTextDir, writeScript, lib,
  2. rofi, xss-lock, nitrogen, compton-git, i3status, i3-gaps
  3. ,i3lock-color, xset, alsaUtils, light, screenshot_public, xorg, libinput-gestures,
  4. haskellPackages, polybar, procps,
  5. with_lock ? true, compton_name ? "default"}:
  6. let
  7. kill-and-restart = pkg: as:
  8. with lib; let
  9. name = head (splitString " " as);
  10. args = concatStringsSep " " (tail (splitString " " as));
  11. in
  12. ''exec_always --no-startup-id "pkill ${name}; while pgrep -x ${name} >/dev/null; do sleep 1; done; exec ${pkg}/bin/${name} ${args}"
  13. '';
  14. locker = writeScript "dlock.sh" ''
  15. #!/bin/sh
  16. revert() {
  17. ${xset}/bin/xset dpms 0 0 0
  18. }
  19. trap revert SIGHUP SIGINT SIGTERM
  20. ${xset}/bin/xset +dpms dpms 5 5 5
  21. ${i3lock-color}/bin/i3lock-color -B 10 -r -n -e
  22. revert
  23. '';
  24. in
  25. writeTextDir "i3-config" (''
  26. # i3 config file (v4)
  27. # Please see http://i3wm.org/docs/userguide.html for a complete reference!
  28. set $mod Mod4
  29. gaps inner 5
  30. # gaps outer 5
  31. font pango:Source Code Pro 10
  32. # Before i3 v4.8, we used to recommend this one as the default:
  33. # font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
  34. # The font above is very space-efficient, that is, it looks good, sharp and
  35. # clear in small sizes. However, its unicode glyph coverage is limited, the old
  36. # X core fonts rendering does not support right-to-left and this being a bitmap
  37. # font, it doesn’t scale on retina/hidpi displays.
  38. # Use Mouse+$mod to drag floating windows to their wanted position
  39. floating_modifier $mod
  40. # start a terminal
  41. bindsym $mod+Return exec i3-sensible-terminal
  42. # kill focused window
  43. bindsym $mod+Shift+c kill
  44. # start dmenu (a program launcher)
  45. bindsym $mod+e exec --no-startup-id ${rofi}/bin/rofi -fuzzy -show drun
  46. bindsym $mod+z exec --no-startup-id ${rofi}/bin/rofi -fuzzy -show window
  47. # change focus
  48. bindsym $mod+j focus left
  49. bindsym $mod+k focus down
  50. bindsym $mod+l focus up
  51. bindsym $mod+semicolon focus right
  52. # alternatively, you can use the cursor keys:
  53. bindsym $mod+Left focus left
  54. bindsym $mod+Down focus down
  55. bindsym $mod+Up focus up
  56. bindsym $mod+Right focus right
  57. # move focused window
  58. bindsym $mod+Shift+j move left
  59. bindsym $mod+Shift+k move down
  60. bindsym $mod+Shift+l move up
  61. bindsym $mod+Shift+semicolon move right
  62. # alternatively, you can use the cursor keys:
  63. bindsym $mod+Shift+Left move left
  64. bindsym $mod+Shift+Down move down
  65. bindsym $mod+Shift+Up move up
  66. bindsym $mod+Shift+Right move right
  67. # split in horizontal orientation
  68. bindsym $mod+h split h
  69. # split in vertical orientation
  70. bindsym $mod+v split v
  71. # enter fullscreen mode for the focused container
  72. bindsym $mod+f fullscreen toggle
  73. # change container layout (stacked, tabbed, toggle split)
  74. bindsym $mod+s layout stacking
  75. bindsym $mod+w layout tabbed
  76. bindsym $mod+d layout toggle split
  77. # toggle tiling / floating
  78. bindsym $mod+Shift+space floating toggle
  79. # change focus between tiling / floating windows
  80. bindsym $mod+space focus mode_toggle
  81. # focus the parent container
  82. bindsym $mod+a focus parent
  83. # focus the child container
  84. #bindsym $mod+d focus child
  85. # switch to workspace
  86. bindsym $mod+1 workspace 1
  87. bindsym $mod+2 workspace 2
  88. bindsym $mod+3 workspace 3
  89. bindsym $mod+4 workspace 4
  90. bindsym $mod+5 workspace 5
  91. bindsym $mod+6 workspace 6
  92. bindsym $mod+7 workspace 7
  93. bindsym $mod+8 workspace 8
  94. bindsym $mod+9 workspace 9
  95. bindsym $mod+0 workspace 10
  96. # move focused container to workspace
  97. bindsym $mod+Shift+1 move container to workspace number 1
  98. bindsym $mod+Shift+2 move container to workspace 2
  99. bindsym $mod+Shift+3 move container to workspace 3
  100. bindsym $mod+Shift+4 move container to workspace 4
  101. bindsym $mod+Shift+5 move container to workspace 5
  102. bindsym $mod+Shift+6 move container to workspace 6
  103. bindsym $mod+Shift+7 move container to workspace 7
  104. bindsym $mod+Shift+8 move container to workspace 8
  105. bindsym $mod+Shift+9 move container to workspace 9
  106. bindsym $mod+Shift+0 move container to workspace 10
  107. bindsym $mod+ctrl+r reload
  108. bindsym $mod+Shift+r restart
  109. 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'"
  110. bindsym $mod+ctrl+l exec --no-startup-id loginctl lock-session
  111. # resize window (you can also use the mouse for that)
  112. mode "resize" {
  113. # These bindings trigger as soon as you enter the resize mode
  114. # Pressing left will shrink the window’s width.
  115. # Pressing right will grow the window’s width.
  116. # Pressing up will shrink the window’s height.
  117. # Pressing down will grow the window’s height.
  118. bindsym j resize shrink width 10 px or 10 ppt
  119. bindsym k resize grow height 10 px or 10 ppt
  120. bindsym l resize shrink height 10 px or 10 ppt
  121. bindsym semicolon resize grow width 10 px or 10 ppt
  122. # same bindings, but for the arrow keys
  123. bindsym Left resize shrink width 10 px or 10 ppt
  124. bindsym Down resize grow height 10 px or 10 ppt
  125. bindsym Up resize shrink height 10 px or 10 ppt
  126. bindsym Right resize grow width 10 px or 10 ppt
  127. # back to normal: Enter or Escape
  128. bindsym Return mode "default"
  129. bindsym Escape mode "default"
  130. }
  131. bindsym $mod+r mode "resize"
  132. bindsym $mod+Escape workspace back_and_forth
  133. exec_always --no-startup-id ${nitrogen}/bin/nitrogen --restore
  134. ${kill-and-restart compton-git "compton --config /home/yorick/dotfiles/x/compton_${compton_name}.conf"}
  135. '' + (lib.optionalString with_lock ''
  136. ${kill-and-restart xorg.xf86inputsynaptics "syndaemon -i 0.5 -k -t"}
  137. ${kill-and-restart polybar "polybar -c /home/yorick/dotfiles/i3/polybar $(hostname)"}
  138. ${kill-and-restart xss-lock "xss-lock -l -- ${locker}"}
  139. ${kill-and-restart libinput-gestures "libinput-gestures"}
  140. ${kill-and-restart haskellPackages.arbtt "arbtt-capture"}
  141. '') + ''
  142. bindsym XF86MonBrightnessUp exec ${light}/bin/light -A 5
  143. bindsym XF86MonBrightnessDown exec ${light}/bin/light -U 5
  144. bindsym XF86AudioLowerVolume exec ${alsaUtils}/bin/amixer set Master 1%-
  145. bindsym XF86AudioRaiseVolume exec ${alsaUtils}/bin/amixer set Master 1%+
  146. bindsym XF86AudioMute exec ${alsaUtils}/bin/amixer set Master toggle
  147. bindsym $mod+Shift+s exec --no-startup-id ${screenshot_public}/bin/screenshot_public
  148. workspace_auto_back_and_forth yes
  149. hide_edge_borders smart
  150. for_window [class="URxvt"] border pixel 2
  151. new_window pixel 2
  152. '')