mixu / nwm

Tiling window manager for X11 written in Node.js
http://mixu.net/nwm/
MIT License
789 stars 72 forks source link

fatal error: request code=2, error code=10 #4

Closed ashnur closed 13 years ago

ashnur commented 13 years ago

Ok so this came is exactly after my last issue: :~/work/nwm/nwm$ node nwm-user-sample.js readfile /home/ashnur/work/nwm/nwm/lib/layouts/tile.js /home/ashnur/work/nwm/nwm/lib/layouts/tile.js watch /home/ashnur/work/nwm/nwm/lib/layouts/tile.js readfile /home/ashnur/work/nwm/nwm/lib/layouts/monocle.js /home/ashnur/work/nwm/nwm/lib/layouts/monocle.js watch /home/ashnur/work/nwm/nwm/lib/layouts/monocle.js readfile /home/ashnur/work/nwm/nwm/lib/layouts/wide.js /home/ashnur/work/nwm/nwm/lib/layouts/wide.js watch /home/ashnur/work/nwm/nwm/lib/layouts/wide.js readfile /home/ashnur/work/nwm/nwm/lib/layouts/grid.js /home/ashnur/work/nwm/nwm/lib/layouts/grid.js watch /home/ashnur/work/nwm/nwm/lib/layouts/grid.js [ { key: 49, modifier: 64, callback: [Function] }, { key: 49, modifier: 65, callback: [Function] }, { key: 50, modifier: 64, callback: [Function] }, { key: 50, modifier: 65, callback: [Function] }, { key: 51, modifier: 64, callback: [Function] }, { key: 51, modifier: 65, callback: [Function] }, { key: 52, modifier: 64, callback: [Function] }, { key: 52, modifier: 65, callback: [Function] }, { key: 53, modifier: 64, callback: [Function] }, { key: 53, modifier: 65, callback: [Function] }, { key: 54, modifier: 64, callback: [Function] }, { key: 54, modifier: 65, callback: [Function] }, { key: 55, modifier: 64, callback: [Function] }, { key: 55, modifier: 65, callback: [Function] }, { key: 56, modifier: 64, callback: [Function] }, { key: 56, modifier: 65, callback: [Function] }, { key: 57, modifier: 64, callback: [Function] }, { key: 57, modifier: 65, callback: [Function] }, { key: 65293, modifier: 65, callback: [Function] }, { key: 99, modifier: 65, callback: [Function] }, { key: 32, modifier: 64, callback: [Function] }, { key: 104, modifier: 64, callback: [Function] }, { key: 65479, modifier: 64, callback: [Function] }, { key: 108, modifier: 64, callback: [Function] }, { key: 65480, modifier: 64, callback: [Function] }, { key: 65289, modifier: 64, callback: [Function] }, { key: 44, modifier: 65, callback: [Function] }, { key: 46, modifier: 65, callback: [Function] }, { key: 106, modifier: 64, callback: [Function] }, { key: 107, modifier: 64, callback: [Function] }, { key: 113, modifier: 65, callback: [Function] } ] JS: addMonitor [ { id: 0, x: 0, y: 0, width: 1920, height: 1080 } ] ptrtomon 0, monitor id 0 Done with updategeom nwm: fatal error: request code=2, error code=10

I tried to find out what the request code and the error code means, but got no luck. Is it in the source somewhere? (I have ubuntu and gdm)

mixu commented 13 years ago

Hi,

X11 cannot run multiple window managers at the same time on the same display, only one window manager can be subscribed to certain global events. "Request code = 2, error code= 10" means that we nwm could not subscribe to the events it needs, probably because you already have Gnome or some other window manager on the default display.

If you're running it under Xephyr, you need to run it with:

DISPLAY=:1 node nwm-user-sample.js

Of course, you need to start Xephyr first...

If you are running it natively as your primary window manager via GDM and still experience this error, let me know!

ashnur commented 13 years ago

Ok, I am sorry, I should've known that.

I set up the xsessions file, and when I try to log into the nwm session I get the mouse cursor and the default ubuntu background and nothing else.

I am pretty sure that this is not really an nwm issue, but being really unexperienced with these things, I have not much of an idea where to look for the solution.

$ cat /usr/share/xsessions/nwm.desktop 
[Desktop Entry]
Encoding=UTF-8
Name=nwm
Comment=This session starts nwm
Exec=/home/ashnur/work/nwm/nwm/nwm.sh
Type=Application
cat ~/work/nwm/nwm/nwm.sh 
#!/bin/sh
/home/ashnur/.nvm/v0.4.12/bin/node /home/ashnur/work/nwm/nwm/nwm-user-sample.js 2> ~/nwm-log/nwm.err.log 1>~/nwm-log/nwm.log

$ cat ~/nwm-log/nwm.log 
readfile /home/ashnur/work/nwm/nwm/lib/layouts/tile.js /home/ashnur/work/nwm/nwm/lib/layouts/tile.js
watch /home/ashnur/work/nwm/nwm/lib/layouts/tile.js
readfile /home/ashnur/work/nwm/nwm/lib/layouts/monocle.js /home/ashnur/work/nwm/nwm/lib/layouts/monocle.js
watch /home/ashnur/work/nwm/nwm/lib/layouts/monocle.js
readfile /home/ashnur/work/nwm/nwm/lib/layouts/wide.js /home/ashnur/work/nwm/nwm/lib/layouts/wide.js
watch /home/ashnur/work/nwm/nwm/lib/layouts/wide.js
readfile /home/ashnur/work/nwm/nwm/lib/layouts/grid.js /home/ashnur/work/nwm/nwm/lib/layouts/grid.js
watch /home/ashnur/work/nwm/nwm/lib/layouts/grid.js
[ { key: 49, modifier: 64, callback: [Function] },
  { key: 49, modifier: 65, callback: [Function] },
  { key: 50, modifier: 64, callback: [Function] },
  { key: 50, modifier: 65, callback: [Function] },
  { key: 51, modifier: 64, callback: [Function] },
  { key: 51, modifier: 65, callback: [Function] },
  { key: 52, modifier: 64, callback: [Function] },
  { key: 52, modifier: 65, callback: [Function] },
  { key: 53, modifier: 64, callback: [Function] },
  { key: 53, modifier: 65, callback: [Function] },
  { key: 54, modifier: 64, callback: [Function] },
  { key: 54, modifier: 65, callback: [Function] },
  { key: 55, modifier: 64, callback: [Function] },
  { key: 55, modifier: 65, callback: [Function] },
  { key: 56, modifier: 64, callback: [Function] },
  { key: 56, modifier: 65, callback: [Function] },
  { key: 57, modifier: 64, callback: [Function] },
  { key: 57, modifier: 65, callback: [Function] },
  { key: 65293, modifier: 65, callback: [Function] },
  { key: 99, modifier: 65, callback: [Function] },
  { key: 32, modifier: 64, callback: [Function] },
  { key: 104, modifier: 64, callback: [Function] },
  { key: 65479, modifier: 64, callback: [Function] },
  { key: 108, modifier: 64, callback: [Function] },
  { key: 65480, modifier: 64, callback: [Function] },
  { key: 65289, modifier: 64, callback: [Function] },
  { key: 44, modifier: 65, callback: [Function] },
  { key: 46, modifier: 65, callback: [Function] },
  { key: 106, modifier: 64, callback: [Function] },
  { key: 107, modifier: 64, callback: [Function] },
  { key: 113, modifier: 65, callback: [Function] } ]
JS:  addMonitor [ { id: 0, x: 0, y: 0, width: 1920, height: 1200 } ]
JS:  rearrange []
Lazy init workspace 1
rearrange tile

$ cat ~/nwm-log/nwm.err.log 
ptrtomon 0, monitor id 0
Done with updategeom
grab key -- key: 113 modifier 65 
grab key -- key: 107 modifier 64 
grab key -- key: 106 modifier 64 
grab key -- key: 46 modifier 65 
grab key -- key: 44 modifier 65 
grab key -- key: 65289 modifier 64 
grab key -- key: 65480 modifier 64 
grab key -- key: 108 modifier 64 
grab key -- key: 65479 modifier 64 
grab key -- key: 104 modifier 64 
grab key -- key: 32 modifier 64 
grab key -- key: 99 modifier 65 
grab key -- key: 65293 modifier 65 
grab key -- key: 57 modifier 65 
grab key -- key: 57 modifier 64 
grab key -- key: 56 modifier 65 
grab key -- key: 56 modifier 64 
grab key -- key: 55 modifier 65 
grab key -- key: 55 modifier 64 
grab key -- key: 54 modifier 65 
grab key -- key: 54 modifier 64 
grab key -- key: 53 modifier 65 
grab key -- key: 53 modifier 64 
grab key -- key: 52 modifier 65 
grab key -- key: 52 modifier 64 
grab key -- key: 51 modifier 65 
grab key -- key: 51 modifier 64 
grab key -- key: 50 modifier 65 
grab key -- key: 50 modifier 64 
grab key -- key: 49 modifier 65 
grab key -- key: 49 modifier 64 
XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server ":0"
      after 145 requests (145 known processed) with 0 events remaining.
ashnur commented 13 years ago

I found something in the ~/.xsession-errors:

/etc/gdm/Xsession: Beginning session setup...
cat: /home/ashnur/.gnupg/gpg-agent.info: No such file or directory
cut: /home/ashnur/.gnupg/gpg-agent.info: No such file or directory
export DESKTOP_SESSION='nwm'
export DISPLAY=':0'
export GDMSESSION='nwm'
export GDM_KEYBOARD_LAYOUT='us'
export GDM_LANG='en_US.utf8'
export GNOME_KEYRING_CONTROL='/tmp/keyring-iDJxqV'
export GNOME_KEYRING_PID='10178'
export HOME='/home/ashnur'
export LANG='en_US.UTF-8'
export LOGNAME='ashnur'
export PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games'
export PWD='/home/ashnur'
export SHELL='/bin/bash'
export USER='ashnur'
export USERNAME='ashnur'
export WINDOWPATH='8'
export XAUTHORITY='/var/run/gdm/auth-for-ashnur-JT2fol/database'
export XDG_SESSION_COOKIE='f8a6df7d81d24b3657e99dbc4ba356e2-1316603842.755820-2045539268'
Agent pid 10213
/home/ashnur/.nvm/nvm.sh: 11: Bad substitution
/etc/gdm/Xsession: Setup done, will execute: /home/ashnur/work/nwm/nwm/nwm.sh
mixu commented 13 years ago

Looks like it's working:

 I set up the xsessions file, and when I try to log into the nwm session I
 get the mouse cursor and the default ubuntu background and nothing else.

nwm is very much modeled after dwm and xmonad, both of which are minimalistic tiling window managers.

So nwm doesn't really have any window chrome like title bars, menus or stuff like that. Have a look at xmonad's tour - some of the keyboard shortcuts are different, but the basic idea is the same: http://xmonad.org/tour.html

You should start an xterm by pressing Meta + Shift + Enter (e.g. where Meta is probably the Windows key) and go from there. For example, I have an .sh script in my home folder which launches Chrome, guake (for easy access to a terminal everywhere) and my text editor in the background.

I spend most of my time in those programs, generally having guake tiled next to Chrome on my laptop screen and Sublime Text on my main monitor. All windows open on the current monitor at first. To move windows between monitors, use Meta + Shift + comma / period.

Each project I have is on a different workspace on the main monitor (e.g. Meta + Shift + 0..9 to move a window, Meta + 0..9 to switch to a workspace). Similarly, I keep different Chrome windows on different workspaces on my laptop screen (e.g. mail vs. reference material). Then I have a terminal -only workspace which I keep in Grid mode (Meta + space to cycle between layouts). Mostly I use the Tiling layout, since that can be dynamically resized (Meta + F10 / Meta + F11). When I need to close a window, I use Meta+Shift+c to close the focused window, and "killall node" from a terminal to stop nwm.

So, there is nothing particularly fancy - but after the initial setup I can pretty much work effectively with tons of different apps and contexts and never manually resize anything.

So the main benefit of nwm is minimalism, and that unlike with xmonad, you can actually configure it (e.g. write new layouts, change keyboard shortcuts etc. etc.) without learning Haskell or some other strange language...

ashnur commented 13 years ago

You are right! It does work. Although I still have minor issues, like when I eventually hit Meta+Tab, it threw me out of the session, to the login screen.


got event KeyPress (2).
EmitKeyPress

/home/ashnur/work/nwm/nwm/nwm-user-sample.js:96
  workspace.setMainWindow(monitor.focused_window);
            ^
TypeError: Object #<Object> has no method 'setMainWindow'
    at Object.callback (/home/ashnur/work/nwm/nwm/nwm-user-sample.js:96:13)
    at /home/ashnur/work/nwm/nwm/nwm.js:178:18
    at Array.forEach (native)
    at [object Object].<anonymous> (/home/ashnur/work/nwm/nwm/nwm.js:176:20)
    at /home/ashnur/work/nwm/nwm/nwm.js:217:30

Anyway, I am going to use it now for a while, and try to understand the source. :)

mixu commented 13 years ago

Awesome! Good to hear that ;)

I'll put that on the to-do list and close this issue.

mixu commented 13 years ago

Also, fixed that shortcut just now. I forgot to update it to the new api.