I showed you my source code, pls respond
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.

165 lines
4.8 KiB

  1. #+TITLE: X11
  2. #+AUTHOR: Christopher James Hayward
  3. #+EMAIL: chris@chrishayward.xyz
  4. #+PROPERTY: header-args:emacs-lisp :tangle x11.el :comments org
  5. #+PROPERTY: header-args :results silent :eval no-export :comments org
  6. #+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil
  7. #+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil
  8. X11[fn:1] is a graphical display manager.
  9. * Setup
  10. Install the required software on your system before loading the module. Installing X11[fn:1] without any install recommends may not include all of the packages you need on your system. Make sure you don't need any GNOME software utilities before using this example.
  11. #+begin_src shell
  12. RUN apt install -y xserver-xorg-core \
  13. --no-install-recommends \
  14. --no-install-suggests
  15. #+end_src
  16. ** Displays
  17. Setup ~autorandr~[fn:2] with pre-configured profiles for screen size and display output.
  18. #+begin_src shell
  19. RUN apt install autorandr -y
  20. #+end_src
  21. ** Screen locking
  22. If you want to be able to lock and unlock your screen when you're away from your machine, install ~xss-lock~[fn:3]. By default, it will show a blue screen, turning red if you input your password incorrectly, and returning to your previous screen when successful.
  23. #+begin_src shell
  24. RUN apt install -y xss-lock slock
  25. #+end_src
  26. ** Desktop compositor
  27. Download and install ~compton~[fn:4], a desktop compositor for X11[fn:1] that adds shadows, fading, translucency, and implements window frame opacity controls, inactive window transparency, and more.
  28. #+begin_src shell
  29. RUN apt install -y compton
  30. #+end_src
  31. ** Desktop notifications
  32. Make sure ~dbus~[fn:5] is installed to receive desktop notifications, it's an IPC system used by lots of utilities.
  33. #+begin_src shell
  34. RUN apt install -y dbus
  35. #+end_src
  36. * Config
  37. :PROPERTIES:
  38. :header-args: :tangle ../config/xinitrc :comments org
  39. :END:
  40. My workflow includes launching Emacs under X11[fn:1] without the use of a display manager, controlling everything within Emacs, while still providing the functionality of a desktop environment.
  41. #+begin_src conf
  42. compton &
  43. xss-lock -- slock &
  44. exec dbus-launch --exit-with-session emacs -mm --debug-init
  45. #+end_src
  46. ** Create symbolic link
  47. By default ~xinit~[fn:1] will read the configuration file at =$HOME/.xinitrc=. Override this location with a link to the custom configuration.
  48. #+begin_src emacs-lisp
  49. (dotfiles/symlink "~/.emacs.d/config/xinitrc"
  50. "~/.xinitrc")
  51. #+end_src
  52. ** Desktop environment
  53. Use the ~desktop-environment~[fn:6] package to automatically bind well-known programs for controlling the volume, brightness, media playback, and many other XF86 functionality bindings.
  54. #+begin_src emacs-lisp
  55. (use-package desktop-environment
  56. :after exwm
  57. :custom (desktop-environment-brightness-small-increment "2%+")
  58. (desktop-environment-brightness-small-decrement "2%-")
  59. (desktop-environment-brightness-normal-decrement "5%-")
  60. (desktop-environment-brightness-normal-decrement "5%-")
  61. (desktop-environment-volume-small-increment "2%+")
  62. (desktop-environment-volume-small-decrement "2%-")
  63. (desktop-environment-volume-normal-increment "5%+")
  64. (desktop-environment-volume-normal-decrement "5%-")
  65. :config (desktop-environment-mode))
  66. #+end_src
  67. ** Swapping CAPS and CTRL
  68. :PROPERTIES:
  69. :header-args: conf :tangle ../config/xmodmap
  70. :END:
  71. Use ~Xmodmap~[fn:7] to swap CapsLock and Ctrl to keep common bindings on the home row.
  72. #+begin_src conf
  73. clear lock
  74. clear control
  75. keycode 66 = Control_L
  76. add control = Control_L
  77. add Lock = Control_R
  78. #+end_src
  79. Override the configuration file.
  80. #+begin_src emacs-lisp
  81. (dotfiles/symlink "~/.emacs.d/config/xmodmap"
  82. "~/.Xmodmap")
  83. #+end_src
  84. ** Frame transparency
  85. Emacs supports frame transparency when running under the X Window System[fn:1].
  86. #+begin_src emacs-lisp
  87. (defun dotfiles/toggle-transparency ()
  88. (interactive)
  89. (let ((alpha (frame-parameter nil 'alpha)))
  90. (set-frame-parameter nil 'alpha
  91. (if (eql (cond ((numberp alpha) alpha)
  92. ((numberp (cdr alpha)) (cdr alpha))
  93. ((numberp (cadr alpha)) (cadr alpha)))
  94. 100)
  95. '(85 . 80) '(100 . 100)))))
  96. #+end_src
  97. Enable frame transparency by default.
  98. #+begin_src emacs-lisp
  99. (set-frame-parameter (selected-frame) 'alpha '(85 . 80))
  100. (add-to-list 'default-frame-alist '(alpha . (85 . 80)))
  101. #+end_src
  102. * Shortcuts
  103. Toggle frame transparency with =SPC t r=.
  104. #+begin_src emacs-lisp
  105. (dotfiles/leader
  106. "tr" '(dotfiles/toggle-transparency :which-key "Transparency"))
  107. #+end_src
  108. * Footnotes
  109. [fn:1] https://en.wikipedia.org/wiki/X_Window_System
  110. [fn:2] https://github.com/phillipberndt/autorandr
  111. [fn:3] https://man.archlinux.org/man/xss-lock.1
  112. [fn:4] https://github.com/chjj/compton
  113. [fn:5] https://packages.debian.org/stretch/dbus-x11
  114. [fn:6] https://github.com/DamienCassou/desktop-environment
  115. [fn:7] https://wiki.archlinux.org/title/Xmodmap