Skip to content

Commit eea2602

Browse files
committed
doc(readme): update start examples
1 parent def7f25 commit eea2602

File tree

1 file changed

+148
-26
lines changed

1 file changed

+148
-26
lines changed

README.md

Lines changed: 148 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -70,32 +70,154 @@ Using `require("nxwm").setup({})` is **not required**, it is only there if you w
7070
}
7171
```
7272
## Usage
73-
### Start (from wayland window manager)
74-
1. Install Xwayland.
75-
2. Run `Xwayland :99`.
76-
3. Run `DISPLAY=:99 WAYLAND_DISPLAY= {NXWM}` in a **terminal** where `{NXWM}` is path to a terminal which runs Neovim and starts NXWM. \
77-
NOTE: the terminal should have it's start in the top left, have zero padding, have no title bar...\
78-
NOTE2: some applications (like `kitty` with default config) tries (and fails) to spawn in wayland even when `WAYLAND_DISPLAY` is empty...\
79-
Examples of how to start for specific terminals:
80-
+ kitty: `DISPLAY=:99 WAYLAND_DISPLAY= kitty -c NONE -o placement_strategy=top-left -o linux_display_server=x11 -e nvim -c 'lua require("nxwm").start()'`
81-
+ alacritty: `DISPLAY=:99 WAYLAND_DISPLAY= alacritty --config-file /dev/null -e nvim -c 'lua require("nxwm").start()'`
82-
+ wezterm: `DISPLAY=:99 WAYLAND_DISPLAY= wezterm -n --config enable_tab_bar=false --config window_padding='{left=0,right=0,top=0,bottom=0}' start nvim -c 'lua require"nxwm".start()'`
83-
84-
### Start (from Xephyr in x11)
85-
* Install `Xephyr`.
86-
* Run `Xephyr -ac -br -noreset :99`.
87-
* You may add `-screen 800x600` to set the Xephyr window size.
88-
* Start your terminal emulator, passing `DISPLAY=:99` to start it in the Xephyr session.
89-
* Wezterm example: `DISPLAY=:99 wezterm -n --config enable_tab_bar=false --config window_padding='{left=0,right=0,top=0,bottom=0}' start nvim -c 'lua require"nxwm".start()'`
90-
### Start (from tty)
91-
1. Install [sx](https://github.com/Earnestly/sx).
92-
2. Run `sx {NXWM}` in a **tty** where `{NXWM}` is path to a terminal which runs Neovim and starts NXWM.\
93-
NOTE: the terminal should have it's start in the top left, have zero padding, have no title bar...\
94-
Examples of how to start for specific terminals:
95-
+ kitty: `sx kitty -c NONE -o placement_strategy=top-left -e nvim -c 'lua require("nxwm").start()'`
96-
+ alacritty: `sx alacritty --config-file /dev/null -e nvim -c 'lua require("nxwm").start()'`
97-
+ wezterm: `sx wezterm -n --config enable_tab_bar=false --config window_padding='{left=0,right=0,top=0,bottom=0}' start nvim -c 'lua require"nxwm".start()'`
98-
<!--+ neovim-qt: `nvim-qt --nofork -- -c 'lua require("nxwm").start()'`-->
73+
<!--
74+
local terminals={
75+
kitty=[[kitty -c NONE -o placement_strategy=top-left -e nvim -c 'lua require("nxwm").start()']],
76+
alacritty=[[alacritty --config-file /dev/null -e nvim -c 'lua require("nxwm").start()']],
77+
wezterm=[[wezterm -n --config enable_tab_bar=false --config window_padding='{left=0,right=0,top=0,bottom=0}' start nvim -c 'lua require"nxwm".start()']]
78+
}
79+
local clients={
80+
wayland={
81+
'From <b>wayland</b> window manager using Xwayland',
82+
'Install Xwayland (may have the package name `xwayland`, `xorg-xwayland` or `xorg-x11-server-Xwayland`)',
83+
'Xwayland :99 -noreset&\nenv -u WAYLAND_DISPLAY DISPLAY=:99 %s\njobs -p | xargs kill',
84+
},
85+
x11={
86+
'From <b>X11</b> window manager using Xephyr',
87+
'Install Xephyr (may be installed together with `xorg-sever` or have the package name `xorg-server-xephyr`)',
88+
'Xephyr -ac -br -noreset :99&\nenv DISPLAY=:99 %s\njobs -p | xargs kill',
89+
},
90+
tty={
91+
'From <b>tty</b> using sx',
92+
'Install sx (most distros don\'t have it as a package so you may need to install from [source](https://github.com/Earnestly/sx))',
93+
'sx %s',
94+
}
95+
}
96+
local out={}
97+
for _,i in vim.spairs(clients) do
98+
table.insert(out,('<details><summary>%s</summary>'):format(i[1]))
99+
table.insert(out,'')
100+
table.insert(out,i[2])
101+
for k,v in vim.spairs(terminals) do
102+
table.insert(out,('<details><summary>Using <i>%s</i></summary>'):format(k))
103+
table.insert(out,'')
104+
table.insert(out,'```bash')
105+
table.insert(out,'#!/bin/bash')
106+
vim.list_extend(out,vim.split(i[3]:format(v),'\n'))
107+
table.insert(out,'```')
108+
table.insert(out,'</details>')
109+
end
110+
table.insert(out,'')
111+
table.insert(out,'---')
112+
table.insert(out,'')
113+
table.insert(out,'</details>')
114+
115+
end
116+
vim.fn.writefile(out,'/tmp/out.md')
117+
-->
118+
### Start
119+
Create an executable file with the following contents (or run directly in bash):\
120+
(click triangle to expand)
121+
122+
<!--tag:auto-generated-->
123+
<details><summary>From <b>tty</b> using sx</summary>
124+
125+
Install sx (most distros don't have it as a package so you may need to install from [source](https://github.com/Earnestly/sx))
126+
<details><summary>Using <i>alacritty</i></summary>
127+
128+
```bash
129+
#!/bin/bash
130+
sx alacritty --config-file /dev/null -e nvim -c 'lua require("nxwm").start()'
131+
```
132+
</details>
133+
<details><summary>Using <i>kitty</i></summary>
134+
135+
```bash
136+
#!/bin/bash
137+
sx kitty -c NONE -o placement_strategy=top-left -e nvim -c 'lua require("nxwm").start()'
138+
```
139+
</details>
140+
<details><summary>Using <i>wezterm</i></summary>
141+
142+
```bash
143+
#!/bin/bash
144+
sx wezterm -n --config enable_tab_bar=false --config window_padding='{left=0,right=0,top=0,bottom=0}' start nvim -c 'lua require"nxwm".start()'
145+
```
146+
</details>
147+
148+
---
149+
150+
</details>
151+
<details><summary>From <b>wayland</b> window manager using Xwayland</summary>
152+
153+
Install Xwayland (may have the package name `xwayland`, `xorg-xwayland` or `xorg-x11-server-Xwayland`)
154+
<details><summary>Using <i>alacritty</i></summary>
155+
156+
```bash
157+
#!/bin/bash
158+
Xwayland :99 -noreset&
159+
env -u WAYLAND_DISPLAY DISPLAY=:99 alacritty --config-file /dev/null -e nvim -c 'lua require("nxwm").start()'
160+
jobs -p | xargs kill
161+
```
162+
</details>
163+
<details><summary>Using <i>kitty</i></summary>
164+
165+
```bash
166+
#!/bin/bash
167+
Xwayland :99 -noreset&
168+
env -u WAYLAND_DISPLAY DISPLAY=:99 kitty -c NONE -o placement_strategy=top-left -e nvim -c 'lua require("nxwm").start()'
169+
jobs -p | xargs kill
170+
```
171+
</details>
172+
<details><summary>Using <i>wezterm</i></summary>
173+
174+
```bash
175+
#!/bin/bash
176+
Xwayland :99 -noreset&
177+
env -u WAYLAND_DISPLAY DISPLAY=:99 wezterm -n --config enable_tab_bar=false --config window_padding='{left=0,right=0,top=0,bottom=0}' start nvim -c 'lua require"nxwm".start()'
178+
jobs -p | xargs kill
179+
```
180+
</details>
181+
182+
---
183+
184+
</details>
185+
<details><summary>From <b>X11</b> window manager using Xephyr</summary>
186+
187+
Install Xephyr (may be installed together with `xorg-sever` or have the package name `xorg-server-xephyr`)
188+
<details><summary>Using <i>alacritty</i></summary>
189+
190+
```bash
191+
#!/bin/bash
192+
Xephyr -ac -br -noreset :99&
193+
env DISPLAY=:99 alacritty --config-file /dev/null -e nvim -c 'lua require("nxwm").start()'
194+
jobs -p | xargs kill
195+
```
196+
</details>
197+
<details><summary>Using <i>kitty</i></summary>
198+
199+
```bash
200+
#!/bin/bash
201+
Xephyr -ac -br -noreset :99&
202+
env DISPLAY=:99 kitty -c NONE -o placement_strategy=top-left -e nvim -c 'lua require("nxwm").start()'
203+
jobs -p | xargs kill
204+
```
205+
</details>
206+
<details><summary>Using <i>wezterm</i></summary>
207+
208+
```bash
209+
#!/bin/bash
210+
Xephyr -ac -br -noreset :99&
211+
env DISPLAY=:99 wezterm -n --config enable_tab_bar=false --config window_padding='{left=0,right=0,top=0,bottom=0}' start nvim -c 'lua require"nxwm".start()'
212+
jobs -p | xargs kill
213+
```
214+
</details>
215+
216+
---
217+
218+
</details>
219+
<!--tag_end:auto-generated-->
220+
99221
### Use
100222
Open up a terminal (with `:term`) and run your wanted GUI.
101223
NOTE: x-windows aren't auto focused by default, so start insert (by pressing `i` or similar) and then you'll focus the window.

0 commit comments

Comments
 (0)