summaryrefslogtreecommitdiff
path: root/src/en/articles/gnu+linux-and-emacs-introduction
diff options
context:
space:
mode:
Diffstat (limited to 'src/en/articles/gnu+linux-and-emacs-introduction')
-rw-r--r--src/en/articles/gnu+linux-and-emacs-introduction/index.org832
1 files changed, 832 insertions, 0 deletions
diff --git a/src/en/articles/gnu+linux-and-emacs-introduction/index.org b/src/en/articles/gnu+linux-and-emacs-introduction/index.org
new file mode 100644
index 0000000..38ebc8a
--- /dev/null
+++ b/src/en/articles/gnu+linux-and-emacs-introduction/index.org
@@ -0,0 +1,832 @@
1#+title: GNU/Linux and GNU Emacs Introduction
2#+keywords: beginner gnu linux emacs
3
4* Installing Debian
5** Preparations
6*** Getting debian
7Download Debian [[https://www.debian.org/][installer image]]
8
9*** Creating installation medium
10On =M$= Windows, use a tool like [[https://rufus.ie/en/][Rufus]] to create a bootable USB flash
11drive with the downloaded =.iso= file
12
13*** Allocating disk space
14Either get an empty disk or shrink on of your data partitions (toms) to get a continuous region of free space which is at least around 100GB.
15
16** Installation process
17If installing on a laptop, make sure that it's fully charged and keep
18the charger plugged in.
19
20*** Booting from the installation medium
21NOTE: You might have to enable booting from USB in BIOS.
22
23Select the USB from boot menu or change boot order.
24
25*** The Debian installer
26Select the =install= option (not the =Graphical install=) in the GRUB bootloader.
27
28To navigate the menus, use arrow keys and TAB, to toggle check boxes use spacebar and to press button use the enter key.
29
30Simple guide:
311. Select region
322. Select localization (US)
333. Select keyboard layout (most likely US/ISO)
344. Select connected if you have Ethernet connection or wireless if you
35 want to connect to wifi.
365. Choose hostname.
376. Skip domain name.
387. Skip proxy.
398. Select mirror in your region.
409. Set root password.
4110. Set user's full name, username and password.
4211. Deselect all software packages except base.
4312. To dual boot with Windows select guided partitioning (free space).
4413. Select =/home= folder on a separate partition.
4514. Start the installation.
4615. Reboot and check that you can boot everything.
47
48* Setting up GNU/Linux
49** User setup
501. Login as root
511. Edit =/etc/apt/sources= and add =non-free contrib testing unstable=
522. ~apt udpate~
533. ~apt upgrade~
544. ~apt install sudo~
555. ~visudo~ (%wheel ALL=(ALL) NOPASSWD: ALL)
566. ~groupadd wheel~
577. ~usermod -aG wheel YOUR_USERNAME~
588. ~exit~
59
60** Environment setup
61*** Folder setup
62#+begin_src sh
63cd
64rmdir Downloads Desktop ...
65mkdir downloads documents multimedia
66cd multimedia
67mkdir screenshots
68mkdir screencasts
69#+end_src
70
71*** Emacs setup
72~sudo apt install emacs git vterm-module libtd~
73
74Delete =~/.emacs.d=
75
76Edit =~/.config/emacs/init.el=
77
78#+name: emacs-server
79#+header: :tangle emacs/init.el
80#+begin_src emacs-lisp
81(server-start)
82#+end_src
83
84#+name: emacs-straight
85#+header: :tangle emacs/init.el
86#+begin_src emacs-lisp
87(defvar bootstrap-version)
88(let ((bootstrap-file
89 (expand-file-name
90 "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
91 (bootstrap-version 6))
92 (unless (file-exists-p bootstrap-file)
93 (with-current-buffer
94 (url-retrieve-synchronously
95 "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
96 'silent 'inhibit-cookies)
97 (goto-char (point-max))
98 (eval-print-last-sexp)))
99 (load bootstrap-file nil 'nomessage))
100
101(straight-use-package 'use-package)
102(setq straight-use-package-by-default t
103 use-package-always-ensure t)
104#+end_src
105
106#+name: emacs-coding
107#+header: :tangle emacs/init.el
108#+begin_src emacs-lisp
109(prefer-coding-system 'utf-8)
110(set-language-environment "UTF-8")
111(set-default-coding-systems 'utf-8)
112(set-terminal-coding-system 'utf-8)
113(setq-default buffer-file-coding-system 'utf-8)
114#+end_src
115
116#+name: emacs-clean-look
117#+header: :tangle emacs/init.el
118#+begin_src emacs-lisp
119(menu-bar-mode -1)
120(tool-bar-mode -1)
121(scroll-bar-mode -1)
122#+end_src
123
124#+name: emacs-misc
125#+header: :tangle emacs/init.el
126#+begin_src emacs-lisp
127(setq kill-ring-max 10000)
128(repeat-mode 1)
129(auto-insert-mode 1)
130(global-hl-line-mode 1)
131(setq display-time-24hr-format t)
132(setq default-input-method "russian-computer")
133(load-theme 'modus-vivendi t)
134(fset 'yes-or-no-p 'y-or-n-p)
135(set-face-attribute 'default nil :font "Iosevka" :height 180)
136(global-subword-mode)
137#+end_src
138
139#+name: emacs-compilation
140#+header: :tangle emacs/init.el
141#+begin_src emacs-lisp
142(require 'ansi-color)
143(add-hook 'compilation-filter-hook 'ansi-color-compilation-filter)
144(add-hook 'compilation-mode-hook 'toggle-truncate-lines)
145(define-key global-map (kbd "C-<f5>") 'compile)
146(define-key global-map (kbd "<f5>") 'recompile)
147#+end_src
148
149#+name: emacs-trash
150#+header: :tangle emacs/init.el
151#+begin_src emacs-lisp
152(use-package trashed)
153(setq delete-by-moving-to-trash t)
154#+end_src
155
156#+name: emacs-undo-tree
157#+header: :tangle emacs/init.el
158#+begin_src emacs-lisp
159(use-package undo-tree
160 :config
161 (global-undo-tree-mode))
162#+end_src
163
164#+name: emacs-page-break-lines
165#+header: :tangle emacs/init.el
166#+begin_src emacs-lisp
167(use-package page-break-lines
168 :config
169 (global-page-break-lines-mode))
170#+end_src
171
172#+name: emacs-pdf-tools
173#+header: :tangle emacs/init.el
174#+begin_src emacs-lisp
175(use-package pdf-tools
176 :demand t
177 :hook (pdf-view-mode . pdf-view-themed-minor-mode)
178 :config
179 ;; Initialize the package
180 (pdf-tools-install)
181 ;; Associate pdf-view-mode with PDF files
182 (add-to-list 'auto-mode-alist '("\\.pdf\\'" . pdf-view-mode))
183 ;; Enable seamless scrolling between pages
184 (setq pdf-view-continuous-scroll-mode t)
185 ;; Use normal Emacs keybindings for scrolling
186 (setq pdf-view-continuous-scroll-keystrokes nil))
187#+end_src
188
189#+name: emacs-eglot
190#+header: :tangle emacs/init.el
191#+begin_src emacs-lisp
192(use-package eglot)
193#+end_src
194
195#+name: emacs-project
196#+header: :tangle emacs/init.el
197#+begin_src emacs-lisp
198(use-package project)
199#+end_src
200
201#+name: emacs-terminals
202#+header: :tangle emacs/init.el
203#+begin_src emacs-lisp
204(use-package vterm)
205(use-package eat)
206#+end_src
207
208#+name: emacs-telega
209#+header: :tangle emacs/init.el
210#+begin_src emacs-lisp
211(use-package telega
212 :custom
213 (telega-server-libs-prefix "/usr"))
214#+end_src
215
216#+name: emacs-emms
217#+header: :tangle emacs/init.el
218#+begin_src emacs-lisp
219(use-package emms)
220#+end_src
221
222#+name: emacs-multitran
223#+header: :tangle emacs/init.el
224#+begin_src emacs-lisp
225(use-package multitran
226 :bind
227 (("s-t" . multitran-at-pos)))
228#+end_src
229
230#+name: emacs-savehist
231#+header: :tangle emacs/init.el
232#+begin_src emacs-lisp
233(use-package savehist
234 :config
235 (savehist-mode))
236#+end_src
237
238#+name: emacs-lorem-ipsum
239#+header: :tangle emacs/init.el
240#+begin_src emacs-lisp
241(use-package lorem-ipsum)
242#+end_src
243
244#+name: emacs-smartparens
245#+header: :tangle emacs/init.el
246#+begin_src emacs-lisp
247(use-package smartparens
248 :init
249 (smartparens-global-mode t))
250#+end_src
251
252#+name: emacs-completion
253#+header: :tangle emacs/init.el
254#+begin_src emacs-lisp
255(use-package vertico
256 :init
257 (vertico-mode)
258 ;; (setq vertico-scroll-margin 0)
259 ;; (setq vertico-count 20)
260 ;; (setq vertico-resize t)
261 (setq vertico-cycle t))
262
263(use-package orderless
264 :init
265 ;; (setq orderless-style-dispatchers '(+orderless-consult-dispatch
266 ;; orderless-affix-dispatch)
267 orderless-component-separator #'orderless-escapable-split-on-space)
268(setq completion-styles '(orderless basic)
269 completion-category-defaults nil
270 completion-category-overrides '((file (styles partial-completion)))))
271
272(use-package consult
273 :bind (;; C-c bindings in `mode-specific-map'
274 ("C-c M-x" . consult-mode-command)
275 ("C-c h" . consult-history)
276 ("C-c k" . consult-kmacro)
277 ("C-c m" . consult-man)
278 ("C-c i" . consult-info)
279 ([remap Info-search] . consult-info)
280 ;; C-x bindings in `ctl-x-map'
281 ("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command
282 ("C-x b" . consult-buffer) ;; orig. switch-to-buffer
283 ("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
284 ("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame
285 ("C-x r b" . consult-bookmark) ;; orig. bookmark-jump
286 ("C-x p b" . consult-project-buffer) ;; orig. project-switch-to-buffer
287 ;; Custom M-# bindings for fast register access
288 ("M-#" . consult-register-load)
289 ("M-'" . consult-register-store) ;; orig. abbrev-prefix-mark (unrelated)
290 ("C-M-#" . consult-register)
291 ;; Other custom bindings
292 ("M-y" . consult-yank-pop) ;; orig. yank-pop
293 ;; M-g bindings in `goto-map'
294 ("M-g e" . consult-compile-error)
295 ("M-g f" . consult-flymake) ;; Alternative: consult-flycheck
296 ("M-g g" . consult-goto-line) ;; orig. goto-line
297 ("M-g M-g" . consult-goto-line) ;; orig. goto-line
298 ("M-g o" . consult-outline) ;; Alternative: consult-org-heading
299 ("M-g m" . consult-mark)
300 ("M-g k" . consult-global-mark)
301 ("M-g i" . consult-imenu)
302 ("M-g I" . consult-imenu-multi)
303 ;; M-s bindings in `search-map'
304 ("M-s d" . consult-find) ;; Alternative: consult-fd
305 ("M-s D" . consult-locate)
306 ("M-s g" . consult-grep)
307 ("M-s G" . consult-git-grep)
308 ("M-s r" . consult-ripgrep)
309 ("M-s l" . consult-line)
310 ("M-s L" . consult-line-multi)
311 ("M-s k" . consult-keep-lines)
312 ("M-s u" . consult-focus-lines)
313 ;; Isearch integration
314 ("M-s e" . consult-isearch-history)
315 :map isearch-mode-map
316 ("M-e" . consult-isearch-history) ;; orig. isearch-edit-string
317 ("M-s e" . consult-isearch-history) ;; orig. isearch-edit-string
318 ("M-s l" . consult-line) ;; needed by consult-line to detect isearch
319 ("M-s L" . consult-line-multi) ;; needed by consult-line to detect isearch
320 ;; Minibuffer history
321 :map minibuffer-local-map
322 ("M-s" . consult-history) ;; orig. next-matching-history-element
323 ("M-r" . consult-history)) ;; orig. previous-matching-history-element
324
325 ;; Enable automatic preview at point in the *Completions* buffer. This is
326 ;; relevant when you use the default completion UI.
327 :hook (completion-list-mode . consult-preview-at-point-mode)
328 :init
329 ;; Optionally configure the register formatting. This improves the register
330 ;; preview for `consult-register', `consult-register-load',
331 ;; `consult-register-store' and the Emacs built-ins.
332 (setq register-preview-delay 0.5
333 register-preview-function #'consult-register-format)
334
335 ;; Optionally tweak the register preview window.
336 ;; This adds thin lines, sorting and hides the mode line of the window.
337 (advice-add #'register-preview :override #'consult-register-window)
338
339 ;; Use Consult to select xref locations with preview
340 (setq xref-show-xrefs-function #'consult-xref
341 xref-show-definitions-function #'consult-xref)
342
343 ;; Configure other variables and modes in the :config section,
344 ;; after lazily loading the package.
345 :config
346
347 ;; Optionally configure preview. The default value
348 ;; is 'any, such that any key triggers the preview.
349 ;; (setq consult-preview-key 'any)
350 ;; (setq consult-preview-key "M-.")
351 ;; (setq consult-preview-key '("S-<down>" "S-<up>"))
352 ;; For some commands and buffer sources it is useful to configure the
353 ;; :preview-key on a per-command basis using the `consult-customize' macro.
354 (consult-customize
355 consult-theme :preview-key '(:debounce 0.2 any)
356 consult-ripgrep consult-git-grep consult-grep
357 consult-bookmark consult-recent-file consult-xref
358 consult--source-bookmark consult--source-file-register
359 consult--source-recent-file consult--source-project-recent-file
360 ;; :preview-key "M-."
361 :preview-key '(:debounce 0.4 any))
362
363 ;; Optionally configure the narrowing key.
364 ;; Both < and C-+ work reasonably well.
365 (setq consult-narrow-key "<") ;; "C-+"
366
367 ;; Optionally make narrowing help available in the minibuffer.
368 ;; You may want to use `embark-prefix-help-command' or which-key instead.
369 ;; (define-key consult-narrow-map (vconcat consult-narrow-key "?") #'consult-narrow-help)
370 )
371
372(use-package corfu
373 :custom
374 (corfu-cycle t) ;; Enable cycling for `corfu-next/previous'
375 (corfu-auto t) ;; Enable auto completion
376 (corfu-separator ?\s) ;; Orderless field separator
377 (corfu-quit-at-boundary nil) ;; Never quit at completion boundary
378 (corfu-quit-no-match nil) ;; Never quit, even if there is no match
379 (corfu-preview-current nil) ;; Disable current candidate preview
380 (corfu-preselect 'prompt) ;; Preselect the prompt
381 (corfu-on-exact-match nil) ;; Configure handling of exact matches
382 (corfu-scroll-margin 5) ;; Use scroll margin
383 :init
384 (global-corfu-mode))
385#+end_src
386
387#+name: emacs-dired
388#+header: :tangle emacs/init.el
389#+begin_src emacs-lisp
390(setq dired-listing-switches "-alh"
391 dired-dwim-target t
392 dired-recursive-copies 'always
393 dired-recursive-deletes 'always)
394(use-package dired-single)
395#+end_src
396
397#+name: emacs-emacs
398#+header: :tangle emacs/init.el
399#+begin_src emacs-lisp
400(use-package emacs
401 :init
402 ;; Add prompt indicator to `completing-read-multiple'.
403 ;; We display [CRM<separator>], e.g., [CRM,] if the separator is a comma.
404 (defun crm-indicator (args)
405 (cons (format "[CRM%s] %s"
406 (replace-regexp-in-string
407 "\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" ""
408 crm-separator)
409 (car args))
410 (cdr args)))
411 (advice-add #'completing-read-multiple :filter-args #'crm-indicator)
412
413 ;; Do not allow the cursor in the minibuffer prompt
414 (setq minibuffer-prompt-properties
415 '(read-only t cursor-intangible t face minibuffer-prompt))
416 (add-hook 'minibuffer-setup-hook #'cursor-intangible-mode)
417
418 ;; Enable recursive minibuffers
419 (setq enable-recursive-minibuffers t))
420
421;; Save all tempfiles in $TMPDIR/emacs$UID/
422(defconst emacs-tmp-dir (expand-file-name (format "emacs%d" (user-uid)) temporary-file-directory))
423(setq backup-directory-alist
424 `((".*" . ,emacs-tmp-dir)))
425(setq auto-save-file-name-transforms
426 `((".*" ,emacs-tmp-dir t)))
427(setq auto-save-list-file-prefix
428 emacs-tmp-dir)
429#+end_src
430
431#+name: emacs-multiple-cursors
432#+header: :tangle emacs/init.el
433#+begin_src emacs-lisp
434(use-package multiple-cursors
435 :bind
436 (("C-S-c" . mc/edit-lines)
437 ("C->" . mc/mark-next-like-this)
438 ("C-<" . mc/mark-previous-like-this)
439 ("C-c C-S-c" . mc/mark-all-like-this)
440 ("C-\"" . mc/skip-to-next-like-this)
441 ("C-:" . mc/skip-to-previous-like-this)))
442#+end_src
443
444#+name: emacs-expand-region
445#+header: :tangle emacs/init.el
446#+begin_src emacs-lisp
447(use-package expand-region
448 :bind
449 (("C-M-=" . er/expand-region)))
450#+end_src
451
452#+name: emacs-move-text
453#+header: :tangle emacs/init.el
454#+begin_src emacs-lisp
455(use-package move-text
456 :bind
457 (("M-P" . move-text-up)
458 ("M-N" . move-text-down)))
459#+end_src
460
461#+name: emacs-duplicate
462#+header: :tangle emacs/init.el
463#+begin_src emacs-lisp
464(keymap-global-set "C-'" 'duplicate-dwim)
465(setq duplicate-line-final-position 1)
466#+end_src
467
468#+name: emacs-hl-todo
469#+header: :tangle emacs/init.el
470#+begin_src emacs-lisp
471(use-package hl-todo
472 :config
473 (global-hl-todo-mode 1))
474#+end_src
475
476#+name: emacs-ligature
477#+header: :tangle emacs/init.el
478#+begin_src emacs-lisp
479(use-package ligature
480 :config
481 (ligature-set-ligatures
482 't '("-<<" "-<" "-<-" "<--" "<---" "<<-" "<-" "->" "->>" "-->" "--->" "->-" ">-" ">>-"
483 "=<<" "=<" "=<=" "<==" "<===" "<<=" "<=" "=>" "=>>" "==>" "===>" "=>=" ">=" ">>="
484 "<->" "<-->" "<--->" "<---->" "<=>" "<==>" "<===>" "<====>" "::" ":::" "__"
485 "<~~" "</" "</>" "/>" "~~>" "==" "!=" "/=" "~=" "<>" "===" "!==" "!===" "=/=" "=!="
486 "<:" ":=" "*=" "*+" "<*" "<*>" "*>" "<|" "<|>" "|>" "<." "<.>" ".>" "+*" "=*" "=:" ":>"
487 "(*" "*)" "/*" "*/" "[|" "|]" "{|" "|}" "++" "+++" "\\/" "/\\" "|-" "-|" "<!--" "<!---"))
488 (global-ligature-mode -1))
489#+end_src
490
491#+name: emacs-magit
492#+header: :tangle emacs/init.el
493#+begin_src emacs-lisp
494(use-package magit)
495#+end_src
496
497#+name: emacs-restart-emacs
498#+header: :tangle emacs/init.el
499#+begin_src emacs-lisp
500(use-package restart-emacs)
501#+end_src
502
503#+name: emacs-bluetooth
504#+header: :tangle emacs/init.el
505#+begin_src emacs-lisp
506(use-package bluetooth)
507#+end_src
508
509*** Installing fonts
5101. Wget latest =PkgTTC-Iosevka-X.X.X.zip= asset from [[https://github.com/be5invis/Iosevka/releases][iosevka releases]]
5112. ~unzip DOWNLOADED_FILE~
5123. ~mv contents ~/.local/share/fonts~
5134. ~fc-cache -fv~
514
515*** i3 setup
516~sudo apt install xorg i3 dbus-launch maim udiskie~
517Edit =~/.xinitrc=
518
519Disable access control for the current user.
520#+name: xinitrc-xhost
521#+header: :tangle .xinitrc
522#+begin_src sh
523xhost +SI:localuser:$USER
524#+end_src
525
526#+name: xinitrc-xset
527#+header: :tangle .xinitrc
528#+begin_src sh
529xset r rate 250 30
530#+end_src
531
532#+name: xinitrc-dbus-launch
533#+header: :tangle .xinitrc
534#+begin_src sh
535exec dbus-launch --exit-with-session i3
536#+end_src
537
538Edit =~/.config/i3/config=
539
540#+header: :tangle i3/config :exports none
541#+begin_src conf-space
542# Please see https://i3wm.org/docs/userguide.html for a complete reference!
543#+end_src
544#+name: i3-config-mod
545#+header: :tangle i3/config
546#+begin_src conf-space
547set $mod Mod4
548#+end_src
549
550Font for window titles. Will also be used by the bar unless a
551different font is used in the bar ={}= block below.
552#+header: :tangle i3/config :exports none
553#+begin_src conf-space
554# Font for window titles. Will also be used by the bar unless a different font
555# is used in the bar {} block below.
556#+end_src
557#+name: i3-config-font
558#+header: :tangle i3/config
559#+begin_src conf-space
560font pango:monospace 12
561#+end_src
562
563Start XDG autostart =.desktop= files using =dex=. See also [[https://wiki.archlinux.org/index.php/XDG_Autostart][XDG Autostart -
564ArchWiki]]
565#+header: :tangle i3/config :exports none
566#+begin_src conf-space
567# Start XDG autostart .desktop files using dex. See also
568# https://wiki.archlinux.org/index.php/XDG_Autostart
569#+end_src
570#+name: i3-config-dex
571#+header: :tangle i3/config
572#+begin_src conf-space
573exec --no-startup-id dex --autostart --environment i3
574#+end_src
575
576The combination of ~xss-lock~, ~nm-applet~ and ~pactl~ is a popular choice,
577so they are included here as an example. Modify as you see fit.
578
579~xss-lock~ grabs a =logind suspend inhibit lock= and will use ~i3lock~ to
580lock the screen before suspend. Use ~loginctl lock-session~ to lock your
581screen.
582
583#+header: :tangle i3/config :exports none
584#+begin_src conf-space
585# The combination of xss-lock, nm-applet and pactl is a popular choice, so
586# they are included here as an example. Modify as you see fit.
587
588# xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the
589# screen before suspend. Use loginctl lock-session to lock your screen.
590#+end_src
591#+name: i3-config-xss-lock
592#+header: :tangle i3/config
593#+begin_src conf-space
594exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork
595#+end_src
596
597#+name: i3-config-setxkbmap
598#+header: :tangle i3/config
599#+begin_src conf-space
600exec --no-startup-id setxkbmap -layout "us,ru" -option 'grp:shifts_toggle' -option "ctrl:nocaps"
601#+end_src
602
603#+name: i3-config-udiskie
604#+header: :tangle i3/config
605#+begin_src conf-space
606exec --no-startup-id udiskie --automount
607#+end_src
608
609NetworkManager is the most popular way to manage wireless networks on
610Linux, and ~nm-applet~ is a desktop environment-independent system tray
611GUI for it.
612#+header: :tangle i3/config :exports none
613#+begin_src conf-space
614# NetworkManager is the most popular way to manage wireless networks on Linux,
615# and nm-applet is a desktop environment-independent system tray GUI for it.
616#+end_src
617#+name: i3-config-nm-applet
618#+header: :tangle i3/config
619#+begin_src conf-space
620exec --no-startup-id nm-applet
621#+end_src
622
623#+name: i3-config-emacs
624#+header: :tangle i3/config
625#+begin_src conf-space
626exec emacs --background black
627#+end_src
628
629Use ~pactl~ to adjust volume in PulseAudio.
630#+header: :tangle i3/config :exports none
631#+begin_src conf-space
632# Use pactl to adjust volume in PulseAudio.
633#+end_src
634#+name: i3-config-pulseaudio
635#+header: :tangle i3/config
636#+begin_src conf-space
637set $refresh_i3status killall -SIGUSR1 i3status
638bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status
639bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status
640bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status
641bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status
642#+end_src
643
644Change brightness.
645#+header: :tangle i3/config :exports none
646#+begin_src conf-space
647# Change brightness
648#+end_src
649#+name: i3-config-brightnessctl
650#+header: :tangle i3/config
651#+begin_src conf-space
652bindsym XF86MonBrightnessUp exec --no-startup-id brightnessctl set +5%
653bindsym XF86MonBrightnessDown exec --no-startup-id brightnessctl set 5%-
654#+end_src
655
656Use =Mouse+$mod= to drag floating windows to their wanted position.
657#+header: :tangle i3/config :exports none
658#+begin_src conf-space
659# Use Mouse+$mod to drag floating windows to their wanted position.
660#+end_src
661#+name: i3-config-floating_modifier
662#+header: :tangle i3/config
663#+begin_src conf-space
664floating_modifier $mod
665#+end_src
666
667Move tiling windows via drag & drop by left-clicking into the title
668bar, or left-clicking anywhere into the window while holding the
669floating modifier.
670#+header: :tangle i3/config :exports none
671#+begin_src conf-space
672# Move tiling windows via drag & drop by left-clicking into the title bar,
673# or left-clicking anywhere into the window while holding the floating modifier.
674#+end_src
675#+name: i3-config-tiling_drag-modifier
676#+header: :tangle i3/config
677#+begin_src conf-space
678tiling_drag modifier titlebar
679#+end_src
680
681#+name: i3-config-bindsym
682#+header: :tangle i3/config
683#+begin_src conf-space
684# start a terminal
685bindsym $mod+Return exec emacsclient -c
686
687# kill focused window
688bindsym $mod+Shift+q kill
689
690# start dmenu (a program launcher)
691bindsym $mod+d exec --no-startup-id i3-dmenu-desktop --dmenu='dmenu -i -fn 12'
692
693# change focus
694bindsym $mod+j focus left
695bindsym $mod+k focus down
696bindsym $mod+l focus up
697bindsym $mod+semicolon focus right
698
699# alternatively, you can use the cursor keys:
700bindsym $mod+Left focus left
701bindsym $mod+Down focus down
702bindsym $mod+Up focus up
703bindsym $mod+Right focus right
704
705# move focused window
706bindsym $mod+Shift+j move left
707bindsym $mod+Shift+k move down
708bindsym $mod+Shift+l move up
709bindsym $mod+Shift+semicolon move right
710
711# alternatively, you can use the cursor keys:
712bindsym $mod+Shift+Left move left
713bindsym $mod+Shift+Down move down
714bindsym $mod+Shift+Up move up
715bindsym $mod+Shift+Right move right
716
717# split in horizontal orientation
718bindsym $mod+h split h
719
720# split in vertical orientation
721bindsym $mod+v split v
722
723# enter fullscreen mode for the focused container
724bindsym $mod+f fullscreen toggle
725
726# change container layout (stacked, tabbed, toggle split)
727bindsym $mod+s layout stacking
728bindsym $mod+w layout tabbed
729bindsym $mod+e layout toggle split
730
731# toggle tiling / floating
732bindsym $mod+Shift+space floating toggle
733
734# change focus between tiling / floating windows
735bindsym $mod+space focus mode_toggle
736
737# focus the parent container
738bindsym $mod+a focus parent
739
740# focus the child container
741#bindsym $mod+d focus child
742
743# Define names for default workspaces for which we configure key bindings later on.
744# We use variables to avoid repeating the names in multiple places.
745set $ws1 "1"
746set $ws2 "2"
747set $ws3 "3"
748set $ws4 "4"
749set $ws5 "5"
750set $ws6 "6"
751set $ws7 "7"
752set $ws8 "8"
753set $ws9 "9"
754set $ws10 "10"
755
756# switch to workspace
757bindsym $mod+1 workspace number $ws1
758bindsym $mod+2 workspace number $ws2
759bindsym $mod+3 workspace number $ws3
760bindsym $mod+4 workspace number $ws4
761bindsym $mod+5 workspace number $ws5
762bindsym $mod+6 workspace number $ws6
763bindsym $mod+7 workspace number $ws7
764bindsym $mod+8 workspace number $ws8
765bindsym $mod+9 workspace number $ws9
766bindsym $mod+0 workspace number $ws10
767
768# move focused container to workspace
769bindsym $mod+Shift+1 move container to workspace number $ws1
770bindsym $mod+Shift+2 move container to workspace number $ws2
771bindsym $mod+Shift+3 move container to workspace number $ws3
772bindsym $mod+Shift+4 move container to workspace number $ws4
773bindsym $mod+Shift+5 move container to workspace number $ws5
774bindsym $mod+Shift+6 move container to workspace number $ws6
775bindsym $mod+Shift+7 move container to workspace number $ws7
776bindsym $mod+Shift+8 move container to workspace number $ws8
777bindsym $mod+Shift+9 move container to workspace number $ws9
778bindsym $mod+Shift+0 move container to workspace number $ws10
779
780# reload the configuration file
781bindsym $mod+Shift+c reload
782# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
783bindsym $mod+Shift+r restart
784# exit i3 (logs you out of your X session)
785bindsym $mod+Shift+e exec i3-nagbar -t warning -m \
786'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' \
787-B 'Yes, exit i3' 'i3-msg exit'
788
789# resize window (you can also use the mouse for that)
790mode "resize" {
791# These bindings trigger as soon as you enter the resize mode
792
793# Pressing left will shrink the window’s width.
794# Pressing right will grow the window’s width.
795# Pressing up will shrink the window’s height.
796# Pressing down will grow the window’s height.
797bindsym Left resize shrink width 10 px or 10 ppt
798bindsym Down resize grow height 10 px or 10 ppt
799bindsym Up resize shrink height 10 px or 10 ppt
800bindsym Right resize grow width 10 px or 10 ppt
801
802# back to normal: Enter or Escape or $mod+r
803bindsym Return mode "default"
804bindsym Escape mode "default"
805bindsym $mod+r mode "default"
806}
807
808bindsym $mod+r mode "resize"
809#+end_src
810
811#+name: i3-config-bar
812#+header: :tangle i3/config
813#+begin_src conf-space
814# Start i3bar to display a workspace bar (plus the system information i3status
815# finds out, if available)
816bar {
817status_command i3status
818}
819#+end_src
820
821#+name: i3-config-print-screen
822#+header: :tangle i3/config
823#+begin_src conf-space
824# Print screen
825bindsym --release Print exec "maim $HOME/multimedia/screenshots/$(date '+%y%m%d-%H%M-%S').png"
826bindsym --release Shift+Print exec "maim --hidecursor --select $HOME/multimedia/screenshots/$(date '+%y%m%d-%H%M-%S').png"
827bindsym --release Ctrl+Print exec "maim | xclip -sel clip -t image/png"
828bindsym --release Shift+Ctrl+Print exec "maim --hidecursor --select | xclip -sel clip -t image/png"
829#+end_src
830
831- ~startx~
832- =s-RET=