feat(emacs-i3): demo

This commit is contained in:
Pavel Korytov 2021-10-06 12:25:45 +03:00
parent d2a41a0a76
commit 3337054e5e
4 changed files with 27 additions and 14 deletions

View file

@ -14,6 +14,12 @@ But why not just use EXWM? One key reason is that to my taste (and perhaps on my
One common point of criticism of i3 is that it is not extensible enough, especially compared to WMs that are configured in an actual programing language, like the mentioned XMonad, [Qtile](http://www.qtile.org/), [Awesome](https://awesomewm.org/), etc. But I think i3's extensibility is underappreciated, although the contents of this article may lie closer to the limits of how far one can go there.
Here is a small demo of how it currently works:
<video controls width="100%">
<source src="/ox-hugo/i3-emacs-demo.mp4" type="video/mp4">
</video>
## Emacs integration {#emacs-integration}
@ -77,7 +83,7 @@ One caveat here is that the minibuffer is always the bottom-most Emacs window, s
The relevant section of the i3 config looks like this:
```conf-space
```bash
bindsym $mod+h exec emacs-i3-integration focus left
bindsym $mod+j exec emacs-i3-integration focus down
bindsym $mod+k exec emacs-i3-integration focus up
@ -141,7 +147,7 @@ And the implementation of the move command.
The relevant section of the i3 config:
```conf-space
```bash
bindsym $mod+Shift+h exec emacs-i3-integration move left
bindsym $mod+Shift+j exec emacs-i3-integration move down
bindsym $mod+Shift+k exec emacs-i3-integration move up
@ -184,7 +190,7 @@ This function also checks whether there is space to resize in the given directio
Here I'm following the default configuration of i3, which creates a "submode" to resize windows.
```conf-space
```bash
mode "resize" {
bindsym h exec emacs-i3-integration resize shrink width 10 px or 10 ppt
@ -240,7 +246,7 @@ i3_balance_workspace
The i3 config for this command:
```conf-space
```bash
bindsym $mod+e exec emacs-i3-integration layout toggle split
```
@ -272,14 +278,14 @@ Finally, the entrypoint for the Emacs integration. In addition to the commands d
The rest of the relevant i3 config to do the splits:
```conf-space
```bash
bindsym $mod+s exec emacs-i3-integration split h
bindsym $mod+v exec emacs-i3-integration split v
```
And to kill the window:
```conf-space
```bash
bindsym $mod+Shift+q exec emacs-i3-integration kill
```
@ -290,7 +296,7 @@ As I use i3's tabbed layout quite extensively, occasionally I want to switch out
As a workaround, I found a small Rust program called [i3-switch-tabs](https://github.com/nikola-kocic/i3-switch-tabs), which also communicates with i3 via its IPC to switch the top-level tab. I've written a [Guix package definition](https://github.com/SqrtMinusOne/channel-q/blob/master/i3-switch-tabs.scm) for that as well.
```conf-space
```bash
bindsym $mod+period exec i3-switch-tabs right
bindsym $mod+comma exec i3-switch-tabs left
```

View file

@ -12,6 +12,13 @@ But why not just use EXWM? One key reason is that to my taste (and perhaps on my
One common point of criticism of i3 is that it is not extensible enough, especially compared to WMs that are configured in an actual programing language, like the mentioned XMonad, [[http://www.qtile.org/][Qtile]], [[https://awesomewm.org/][Awesome]], etc. But I think i3's extensibility is underappreciated, although the contents of this article may lie closer to the limits of how far one can go there.
Here is a small demo of how it currently works:
#+begin_export html
<video controls width="100%">
<source src="/ox-hugo/i3-emacs-demo.mp4" type="video/mp4">
</video>
#+end_export
* Emacs integration
What I'm trying to do is actually quite simple, so I'm somewhat surprised I didn't find anything similar on the Internet. But I didn't look too hard.
@ -64,7 +71,7 @@ One caveat here is that the minibuffer is always the bottom-most Emacs window, s
#+END_SRC
The relevant section of the i3 config looks like this:
#+BEGIN_SRC conf-space
#+BEGIN_SRC bash
bindsym $mod+h exec emacs-i3-integration focus left
bindsym $mod+j exec emacs-i3-integration focus down
bindsym $mod+k exec emacs-i3-integration focus up
@ -120,7 +127,7 @@ And the implementation of the move command.
#+END_SRC
The relevant section of the i3 config:
#+BEGIN_SRC conf-space
#+BEGIN_SRC bash
bindsym $mod+Shift+h exec emacs-i3-integration move left
bindsym $mod+Shift+j exec emacs-i3-integration move down
bindsym $mod+Shift+k exec emacs-i3-integration move up
@ -159,7 +166,7 @@ This function also checks whether there is space to resize in the given directio
#+END_SRC
Here I'm following the default configuration of i3, which creates a "submode" to resize windows.
#+BEGIN_SRC conf-space
#+BEGIN_SRC bash
mode "resize" {
bindsym h exec emacs-i3-integration resize shrink width 10 px or 10 ppt
@ -210,7 +217,7 @@ i3_balance_workspace
#+END_SRC
The i3 config for this command:
#+BEGIN_SRC conf-space
#+BEGIN_SRC bash
bindsym $mod+e exec emacs-i3-integration layout toggle split
#+END_SRC
@ -238,13 +245,13 @@ Finally, the entrypoint for the Emacs integration. In addition to the commands d
#+END_SRC
The rest of the relevant i3 config to do the splits:
#+BEGIN_SRC conf-space
#+BEGIN_SRC bash
bindsym $mod+s exec emacs-i3-integration split h
bindsym $mod+v exec emacs-i3-integration split v
#+END_SRC
And to kill the window:
#+BEGIN_SRC conf-space
#+BEGIN_SRC bash
bindsym $mod+Shift+q exec emacs-i3-integration kill
#+END_SRC
@ -253,7 +260,7 @@ As I use i3's tabbed layout quite extensively, occasionally I want to switch out
As a workaround, I found a small Rust program called [[https://github.com/nikola-kocic/i3-switch-tabs][i3-switch-tabs]], which also communicates with i3 via its IPC to switch the top-level tab. I've written a [[https://github.com/SqrtMinusOne/channel-q/blob/master/i3-switch-tabs.scm][Guix package definition]] for that as well.
#+BEGIN_SRC conf-space
#+BEGIN_SRC bash
bindsym $mod+period exec i3-switch-tabs right
bindsym $mod+comma exec i3-switch-tabs left
#+END_SRC

Binary file not shown.

Binary file not shown.