{"id":13413063,"url":"https://github.com/altermo/nwm","last_synced_at":"2025-03-14T19:31:10.952Z","repository":{"id":212676225,"uuid":"732026475","full_name":"altermo/nwm","owner":"altermo","description":"A graphical display window manager in neovim","archived":false,"fork":false,"pushed_at":"2024-04-04T16:55:45.000Z","size":65,"stargazers_count":244,"open_issues_count":0,"forks_count":5,"subscribers_count":7,"default_branch":"x11","last_synced_at":"2024-04-12T12:06:51.724Z","etag":null,"topics":["lua","lua-ffi","luajit-ffi","neovim","neovim-lua","neovim-lua-plugin","neovim-plugin","nvim","nvim-lua","nvim-plugin","nvim-wm","window-manager"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/altermo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-12-15T13:05:57.000Z","updated_at":"2024-04-10T21:53:31.000Z","dependencies_parsed_at":"2024-01-29T13:48:39.355Z","dependency_job_id":"c1336fb2-3689-423e-92ba-86fb04036527","html_url":"https://github.com/altermo/nwm","commit_stats":null,"previous_names":["altermo/nxwm","altermo/nwm"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/altermo%2Fnwm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/altermo%2Fnwm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/altermo%2Fnwm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/altermo%2Fnwm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/altermo","download_url":"https://codeload.github.com/altermo/nwm/tar.gz/refs/heads/x11","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243635218,"owners_count":20322899,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lua","lua-ffi","luajit-ffi","neovim","neovim-lua","neovim-lua-plugin","neovim-plugin","nvim","nvim-lua","nvim-plugin","nvim-wm","window-manager"],"created_at":"2024-07-30T20:01:32.985Z","updated_at":"2025-03-14T19:31:10.626Z","avatar_url":"https://github.com/altermo.png","language":"Lua","readme":"# NXWM\n**N**eovim **X**11 **W**indow **M**anager allows you to use x11 windows as if they were buffers.\nWhen entering a x-window-buffer, you'll need to start insert-mode to focus the x-window (unless some configurations are set to do this automatically).\n## Requirements\n+ `libx11`\n+ `libxfixes` (almost always installed if libx11 is installed)\n+ `glibc` (or most other standard C libraries)\n+ Terminal supporting `TIOCGWINSZ`\n    + Recommended terminal is `kitty`\n    + Run `:lua= require'nxwm'.term_supported()` to check\n        + NOTE: some terminals may support `TIOCGWINSZ` while still not working (like `neovim-qt`)\n## Installation\nUse whichever package manager you like.\\\nIt is recommended to lock/pin the plugin to one version/branch because of changes.\n\n- lazy\n```lua\n{'altermo/nwm',branch='x11'},\n```\n- packer\n```lua\nuse {'altermo/nwm',branch='x11'},\n```\n\n## Configuration\nUsing `require(\"nxwm\").setup({})` is **not required**, it is only there if you want to change the default config.\n```lua\n{\n    --What happens when a new x-window is created\n    on_win_open=function (buf,xwin)\n        vim.cmd.vsplit()\n        vim.api.nvim_set_current_buf(buf)\n    end,\n    --Configuration to pass to window\n    --`conf` is global config\n    on_win_get_conf=function (conf,xwin) return conf end,\n    --How to handle when multiple windows in the same tabpage has the x-window-buffer open\n    on_multiple_win_open=function (vwins,buf,xwin)\n        for k,vwin in ipairs(vwins) do\n            if k~=1 then\n                local scratchbuf=vim.api.nvim_create_buf(false,true)\n                vim.bo[scratchbuf].bufhidden='wipe'\n                vim.api.nvim_win_set_buf(vwin,scratchbuf)\n            end\n        end\n    end,\n    --Whether to be more verbose\n    verbal=false,\n    --Whether to show float windows above x-windows (depending on z-index)\n    floatover=true,\n    --Map to unfocus a window (multiple key mappings is not (yet) supported)\n    unfocus_map='\u003cA-F4\u003e',\n    --Create your own mappings\n    --IMPORTANT: the x-window needs to be focused for such mappings to work\n    maps={\n        --{'\u003cC-A-del\u003e',function () vim.cmd'quitall!' end},\n        --Or you could also have lhs as a table\n        --{{mods={'control','mod1'},key='Delete'},function () vim.cmd'quitall!' end},\n    },\n    --Window-opt: auto focus x-window when entering x-window-buffer\n    autofocus=false,\n    --Window-opt: try-delete x-window if no vim-window shows buffer (similar to `bufhidden=wipe`)\n    delhidden=true,\n    --Window-opt: when click on x-window, goto that buffer (may not focus x-window)\n    clickgoto=true,\n    --Window-opt: offset the window this many x pixels (useful if terminal has padding)\n    xoffset=0,\n    --Window-opt: offset the window this many y pixels (useful if terminal has padding)\n    yoffset=0,\n}\n```\n## Usage\n\u003c!--\nlocal terminals={\n    kitty=[[kitty -c NONE -o placement_strategy=top-left -e nvim -c 'lua require(\"nxwm\").start()']],\n    alacritty=[[alacritty --config-file /dev/null -e nvim -c 'lua require(\"nxwm\").start()']],\n    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()']]\n}\nlocal clients={\n    wayland={\n        'From \u003cb\u003ewayland\u003c/b\u003e window manager using Xwayland',\n        'Install Xwayland (may have the package name `xwayland`, `xorg-xwayland` or `xorg-x11-server-Xwayland`)',\n        'Xwayland :99 -noreset\u0026\\nenv -u WAYLAND_DISPLAY DISPLAY=:99 %s\\njobs -p | xargs kill',\n    },\n    x11={\n        'From \u003cb\u003eX11\u003c/b\u003e window manager using Xephyr',\n        'Install Xephyr (may be installed together with `xorg-sever` or have the package name `xorg-server-xephyr`)',\n        'Xephyr -ac -br -noreset :99\u0026\\nenv DISPLAY=:99 %s\\njobs -p | xargs kill',\n    },\n    tty={\n        'From \u003cb\u003etty\u003c/b\u003e using sx',\n        'Install sx (most distros don\\'t have it as a package so you may need to install from [source](https://github.com/Earnestly/sx))',\n        'sx %s',\n    }\n}\nlocal out={}\nfor c,i in vim.spairs(clients) do\n    table.insert(out,('\u003cdetails\u003e\u003csummary\u003e%s\u003c/summary\u003e'):format(i[1]))\n    table.insert(out,'')\n    table.insert(out,i[2])\n    for k,v in vim.spairs(terminals) do\n        table.insert(out,('\u003cdetails\u003e\u003csummary\u003eUsing \u003ci\u003e%s\u003c/i\u003e\u003c/summary\u003e'):format(k))\n        table.insert(out,'')\n        if c=='tty' and k=='wezterm' then --HACK\n            table.insert(out,\"**IMPORTANT:** Running NXWM in Wezterm started with sx sometimes doesn't work\")\n        end\n        table.insert(out,'```bash')\n        table.insert(out,'#!/bin/bash')\n        vim.list_extend(out,vim.split(i[3]:format(v),'\\n'))\n        table.insert(out,'```')\n        table.insert(out,'\u003c/details\u003e')\n    end\n    table.insert(out,'')\n    table.insert(out,'---')\n    table.insert(out,'')\n    table.insert(out,'\u003c/details\u003e')\nend\ntable.insert(out,38,'sleep 0.05 # HACK to make alacritty work with Xwayland') --HACK\ntable.insert(out,73,'sleep 0.05 # HACK to make alacritty work with Xephyr') --HACK\nvim.fn.writefile(out,'/tmp/out.md')\n--\u003e\n### Start\nCreate an executable file with the following contents (or run directly in bash):\\\n(click triangle to expand)\n\n\u003c!--tag:auto-generated--\u003e\n\u003cdetails\u003e\u003csummary\u003eFrom \u003cb\u003etty\u003c/b\u003e using sx\u003c/summary\u003e\n\nInstall sx (most distros don't have it as a package so you may need to install from [source](https://github.com/Earnestly/sx))\n\u003cdetails\u003e\u003csummary\u003eUsing \u003ci\u003ealacritty\u003c/i\u003e\u003c/summary\u003e\n\n```bash\n#!/bin/bash\nsx alacritty --config-file /dev/null -e nvim -c 'lua require(\"nxwm\").start()'\n```\n\u003c/details\u003e\n\u003cdetails\u003e\u003csummary\u003eUsing \u003ci\u003ekitty\u003c/i\u003e\u003c/summary\u003e\n\n```bash\n#!/bin/bash\nsx kitty -c NONE -o placement_strategy=top-left -e nvim -c 'lua require(\"nxwm\").start()'\n```\n\u003c/details\u003e\n\u003cdetails\u003e\u003csummary\u003eUsing \u003ci\u003ewezterm\u003c/i\u003e\u003c/summary\u003e\n\n**IMPORTANT:** Running NXWM in Wezterm started with sx sometimes doesn't work\n```bash\n#!/bin/bash\nsx 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()'\n```\n\u003c/details\u003e\n\n---\n\n\u003c/details\u003e\n\u003cdetails\u003e\u003csummary\u003eFrom \u003cb\u003ewayland\u003c/b\u003e window manager using Xwayland\u003c/summary\u003e\n\nInstall Xwayland (may have the package name `xwayland`, `xorg-xwayland` or `xorg-x11-server-Xwayland`)\n\u003cdetails\u003e\u003csummary\u003eUsing \u003ci\u003ealacritty\u003c/i\u003e\u003c/summary\u003e\n\n```bash\n#!/bin/bash\nXwayland :99 -noreset\u0026\nsleep 0.05 # HACK to make alacritty work with Xwayland\nenv -u WAYLAND_DISPLAY DISPLAY=:99 alacritty --config-file /dev/null -e nvim -c 'lua require(\"nxwm\").start()'\njobs -p | xargs kill\n```\n\u003c/details\u003e\n\u003cdetails\u003e\u003csummary\u003eUsing \u003ci\u003ekitty\u003c/i\u003e\u003c/summary\u003e\n\n```bash\n#!/bin/bash\nXwayland :99 -noreset\u0026\nenv -u WAYLAND_DISPLAY DISPLAY=:99 kitty -c NONE -o placement_strategy=top-left -e nvim -c 'lua require(\"nxwm\").start()'\njobs -p | xargs kill\n```\n\u003c/details\u003e\n\u003cdetails\u003e\u003csummary\u003eUsing \u003ci\u003ewezterm\u003c/i\u003e\u003c/summary\u003e\n\n```bash\n#!/bin/bash\nXwayland :99 -noreset\u0026\nenv -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()'\njobs -p | xargs kill\n```\n\u003c/details\u003e\n\n---\n\n\u003c/details\u003e\n\u003cdetails\u003e\u003csummary\u003eFrom \u003cb\u003eX11\u003c/b\u003e window manager using Xephyr\u003c/summary\u003e\n\nInstall Xephyr (may be installed together with `xorg-sever` or have the package name `xorg-server-xephyr`)\n\u003cdetails\u003e\u003csummary\u003eUsing \u003ci\u003ealacritty\u003c/i\u003e\u003c/summary\u003e\n\n```bash\n#!/bin/bash\nXephyr -ac -br -noreset :99\u0026\nsleep 0.05 # HACK to make alacritty work with Xephyr\nenv DISPLAY=:99 alacritty --config-file /dev/null -e nvim -c 'lua require(\"nxwm\").start()'\njobs -p | xargs kill\n```\n\u003c/details\u003e\n\u003cdetails\u003e\u003csummary\u003eUsing \u003ci\u003ekitty\u003c/i\u003e\u003c/summary\u003e\n\n```bash\n#!/bin/bash\nXephyr -ac -br -noreset :99\u0026\nenv DISPLAY=:99 kitty -c NONE -o placement_strategy=top-left -e nvim -c 'lua require(\"nxwm\").start()'\njobs -p | xargs kill\n```\n\u003c/details\u003e\n\u003cdetails\u003e\u003csummary\u003eUsing \u003ci\u003ewezterm\u003c/i\u003e\u003c/summary\u003e\n\n```bash\n#!/bin/bash\nXephyr -ac -br -noreset :99\u0026\nenv 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()'\njobs -p | xargs kill\n```\n\u003c/details\u003e\n\n---\n\n\u003c/details\u003e\n\u003c!--tag_end:auto-generated--\u003e\n\n### Use\nOpen up a terminal (with `:term`) and run your wanted GUI.\nNOTE: x-windows aren't auto focused by default, so start insert (by pressing `i` or similar) and then you'll focus the window.\nTo unfocus an x-window, either click into another buffer, or press `alt-F4`(unless the default config has been changed).\n## Q\u0026A\n#### Is multiple displays supported?\nNo, and not likely until something like [neovim#2161](https://github.com/neovim/neovim/issues/2161) is implemented.\n#### Will there be a wayland version?\nMaybe, though wlroots is 10 times more complicated than X11 and much more unstable (e.g. most fails results in crash).\n#### How do I exit a focused x-window?\nPress `alt-F4` (I know this is an unusual keymap, if someone has a better idea, please let me know).\n#### What are some future plans?\nSee [TODO.md](./TODO.md) (it may be outdated).\n\n#### Donate\nIf you want to donate then you need to find the correct link (hint: No Break Here):\n* [10]() [11]() [12]() [13]() [14]() [15]() [16]() [17]() [18]()\n* [20]() [21]() [22]() [23]() [24]() [25]() [26]() [27]() [28]()\n* [30]() [31]() [32]() [33]() [34]() [35]() [36]() [37]() [38]()\n* [40]() [41]() [42]() [43]() [44]() [45]() [46]() [47]() [48]()\n* [50]() [51]() [52]() [53]() [54]() [55]() [56]() [57]() [58]()\n* [60]() [61]() [62]() [63]() [64]() [65]() [66]() [67]() [68]()\n* [70]() [71]() [72]() [73]() [74]() [75]() [76]() [77]() [78]()\n* [80]() [81]() [82]() [83](https://www.buymeacoffee.com/altermo) [84]() [85]() [86]() [87]() [88]()\n\n","funding_links":["https://www.buymeacoffee.com/altermo"],"categories":["Split and Window","Lua"],"sub_categories":["Indent"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faltermo%2Fnwm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faltermo%2Fnwm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faltermo%2Fnwm/lists"}