BurntSushi / wingo

A fully-featured window manager written in Go.
Do What The F*ck You Want To Public License
1k stars 86 forks source link

Misleading error message on crash during initialization #122

Open hannson opened 9 years ago

hannson commented 9 years ago

Steps to reproduce:

Errors in console:

WINGO WARNING: state.go:74: Could not add workspace : workspaces must have a name of length at least one.
WINGO WARNING: state.go:74: Could not add workspace : workspaces must have a name of length at least one.
WINGO ERROR: heads.go:42: There must be at least 2 workspaces (one for each head).

When you read the default config you can clearly see the 6 workspaces:

~/.config/wingo/options.wini

[Options]
# The list of workspaces to set upon startup. Workspaces can be added or
# removed while Wingo is running.
workspaces := 1 2 3 4 browser mail

Yet, it does not work. Apparently there's a hidden check for EWMH that overrides the config file.

In state.go:

// If _NET_DESKTOP_NAMES is set, let's use workspaces from that instead.
if names, _ := ewmh.DesktopNamesGet(X); len(names) > 0 {
    for _, wrkName := range names {
        if err := AddWorkspace(wrkName); err != nil {
            logger.Warning.Printf("Could not add workspace %s: %s",
                wrkName, err)
        }
    }
} else {
    for _, wrkName := range Config.Workspaces {
        if err := AddWorkspace(wrkName); err != nil {
            logger.Error.Fatalf("Could not initialize workspaces: %s", err)
        }
    }
}
Heads.Initialize(Clients)

I think this could be handled more gracefully. Perhaps by doing something equivalent to this:

// If _NET_DESKTOP_NAMES is set, let's use workspaces from that instead.
if names, _ := ewmh.DesktopNamesGet(X); len(names) >= heads.NumHeads() {

So that it reverts back to options.wini if DesktopNamesGet is insufficient (even if it is present). Having said that I believe this behavior should be properly documented (I suggest putting it in options.wini in the comment above the workspaces variable) and actually logged as well in some verbose log level.

Thoughts?

BurntSushi commented 9 years ago

Yeah, I think that is a reasonable change in behavior. Nice find!

Do you want to submit a PR? Otherwise, I can do it.

hannson commented 9 years ago

You can do it if you don't mind. I haven't forked the project yet.

averrin commented 8 years ago

So, and how i can run wingo?

❯ wingo --replace
WINGO ERROR: heads.go:42: There must be at least 2 workspaces (one for each head).
❯ head ~/.config/wingo/options.wini                                                                                                                                                             user@PC-001-00480
# These are some global configuration options for Wingo. It may not look like
# there's a lot here, but that's because a lot of the configuration is done
# with your key/mouse bindings, and your theme settings.

[Options]
# The list of workspaces to set upon startup. Workspaces can be added or
# removed while Wingo is running.
workspaces := 1 2
BurntSushi commented 8 years ago

I don't think wingo modifies workspace list when replacing. Create more workspaces in your existing window manger.

averrin commented 8 years ago

I use awesome. Ok, i add second tag, but:

❯ wingo --replace                                                                                                                                                                               user@PC-001-00480
WINGO WARNING: state.go:72: Could not add workspace #: a workspace with name '#' already exists.
WINGO WARNING: state.go:72: Could not add workspace #2: a workspace with name '#2' already exists.
WINGO WARNING: bindings_key.go:77: Could not bind 'Mod1-s': Got a bad access error when trying to bind 'Mod1-s'. This usually means another client has already grabbed this keybinding.
WINGO WARNING: bindings_key.go:77: Could not bind 'Mod4-Shift-right': Got a bad access error when trying to bind 'Mod4-Shift-right'. This usually means another client has already grabbed this keybinding.
WINGO WARNING: bindings_key.go:77: Could not bind 'Mod1-w': Got a bad access error when trying to bind 'Mod1-w'. This usually means another client has already grabbed this keybinding.
WINGO WARNING: bindings_key.go:77: Could not bind 'Mod1-w': Got a bad access error when trying to bind 'Mod1-w'. This usually means another client has already grabbed this keybinding.
WINGO WARNING: bindings_key.go:77: Could not bind 'Mod1-F2': Got a bad access error when trying to bind 'Mod1-F2'. This usually means another client has already grabbed this keybinding.
WINGO WARNING: bindings_key.go:77: Could not bind 'Mod4-Shift-left': Got a bad access error when trying to bind 'Mod4-Shift-left'. This usually means another client has already grabbed this keybinding.
WINGO WARNING: bindings_key.go:77: Could not bind 'Mod1-a': Got a bad access error when trying to bind 'Mod1-a'. This usually means another client has already grabbed this keybinding.
WINGO WARNING: bindings_key.go:77: Could not bind 'Mod1-h': Got a bad access error when trying to bind 'Mod1-h'. This usually means another client has already grabbed this keybinding.
WINGO WARNING: bindings_key.go:77: Could not bind 'Mod4-left': Got a bad access error when trying to bind 'Mod4-left'. This usually means another client has already grabbed this keybinding.
WINGO WARNING: bindings_key.go:77: Could not bind 'Mod1-n': Got a bad access error when trying to bind 'Mod1-n'. This usually means another client has already grabbed this keybinding.
WINGO WARNING: bindings_key.go:77: Could not bind 'Mod1-k': Got a bad access error when trying to bind 'Mod1-k'. This usually means another client has already grabbed this keybinding.
WINGO WARNING: bindings_key.go:77: Could not bind 'Mod4-Shift-h': Got a bad access error when trying to bind 'Mod4-Shift-h'. This usually means another client has already grabbed this keybinding.
WINGO WARNING: bindings_key.go:77: Could not bind 'Mod4-right': Got a bad access error when trying to bind 'Mod4-right'. This usually means another client has already grabbed this keybinding.
WINGO WARNING: bindings_key.go:77: Could not bind 'Mod1-e': Got a bad access error when trying to bind 'Mod1-e'. This usually means another client has already grabbed this keybinding.
WINGO WARNING: bindings_key.go:77: Could not bind 'Mod1-e': Got a bad access error when trying to bind 'Mod1-e'. This usually means another client has already grabbed this keybinding.
WINGO WARNING: bindings_key.go:77: Could not bind 'Mod4-Shift-l': Got a bad access error when trying to bind 'Mod4-Shift-l'. This usually means another client has already grabbed this keybinding.
WINGO WARNING: bindings_key.go:51: Could not bind 'Mod1-Tab': Got a bad access error when trying to bind 'Mod1-Tab'. This usually means another client has already grabbed this keybinding.
WINGO ERROR: root.go:34: Could not listen to Root window events: BadAccess {NiceName: Access, Sequence: 693, BadValue: 216, MinorOpcode: 0, MajorOpcode: 2}

It means "--replace" is not my case?

BurntSushi commented 8 years ago

It means your existing window manager isn't quitting when Wingo asks it too.

On Sep 7, 2016 5:44 AM, "Averrin" notifications@github.com wrote:

I use awesome. Ok, i add second tag, but:

❯ wingo --replace user@PC-001-00480 WINGO WARNING: state.go:72: Could not add workspace #: a workspace with name '#' already exists. WINGO WARNING: state.go:72: Could not add workspace #2: a workspace with name '#2' already exists. WINGO WARNING: bindings_key.go:77: Could not bind 'Mod1-s': Got a bad access error when trying to bind 'Mod1-s'. This usually means another client has already grabbed this keybinding. WINGO WARNING: bindings_key.go:77: Could not bind 'Mod4-Shift-right': Got a bad access error when trying to bind 'Mod4-Shift-right'. This usually means another client has already grabbed this keybinding. WINGO WARNING: bindings_key.go:77: Could not bind 'Mod1-w': Got a bad access error when trying to bind 'Mod1-w'. This usually means another client has already grabbed this keybinding. WINGO WARNING: bindings_key.go:77: Could not bind 'Mod1-w': Got a bad access error when trying to bind 'Mod1-w'. This usually means another client has already grabbed this keybinding. WINGO WARNING: bindings_key.go:77: Could not bind 'Mod1-F2': Got a bad access error when trying to bind 'Mod1-F2'. This usually means another client has already grabbed this keybinding. WINGO WARNING: bindings_key.go:77: Could not bind 'Mod4-Shift-left': Got a bad access error when trying to bind 'Mod4-Shift-left'. This usually means another client has already grabbed this keybinding. WINGO WARNING: bindings_key.go:77: Could not bind 'Mod1-a': Got a bad access error when trying to bind 'Mod1-a'. This usually means another client has already grabbed this keybinding. WINGO WARNING: bindings_key.go:77: Could not bind 'Mod1-h': Got a bad access error when trying to bind 'Mod1-h'. This usually means another client has already grabbed this keybinding. WINGO WARNING: bindings_key.go:77: Could not bind 'Mod4-left': Got a bad access error when trying to bind 'Mod4-left'. This usually means another client has already grabbed this keybinding. WINGO WARNING: bindings_key.go:77: Could not bind 'Mod1-n': Got a bad access error when trying to bind 'Mod1-n'. This usually means another client has already grabbed this keybinding. WINGO WARNING: bindings_key.go:77: Could not bind 'Mod1-k': Got a bad access error when trying to bind 'Mod1-k'. This usually means another client has already grabbed this keybinding. WINGO WARNING: bindings_key.go:77: Could not bind 'Mod4-Shift-h': Got a bad access error when trying to bind 'Mod4-Shift-h'. This usually means another client has already grabbed this keybinding. WINGO WARNING: bindings_key.go:77: Could not bind 'Mod4-right': Got a bad access error when trying to bind 'Mod4-right'. This usually means another client has already grabbed this keybinding. WINGO WARNING: bindings_key.go:77: Could not bind 'Mod1-e': Got a bad access error when trying to bind 'Mod1-e'. This usually means another client has already grabbed this keybinding. WINGO WARNING: bindings_key.go:77: Could not bind 'Mod1-e': Got a bad access error when trying to bind 'Mod1-e'. This usually means another client has already grabbed this keybinding. WINGO WARNING: bindings_key.go:77: Could not bind 'Mod4-Shift-l': Got a bad access error when trying to bind 'Mod4-Shift-l'. This usually means another client has already grabbed this keybinding. WINGO WARNING: bindings_key.go:51: Could not bind 'Mod1-Tab': Got a bad access error when trying to bind 'Mod1-Tab'. This usually means another client has already grabbed this keybinding. WINGO ERROR: root.go:34: Could not listen to Root window events: BadAccess {NiceName: Access, Sequence: 693, BadValue: 216, MinorOpcode: 0, MajorOpcode: 2}

It means "--replace" is not my case?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/BurntSushi/wingo/issues/122#issuecomment-245229700, or mute the thread https://github.com/notifications/unsubscribe-auth/AAb34nfxFTyNrWVfJG1vPRVjNVGPvnK7ks5qnodrgaJpZM4D8Z_B .

averrin commented 8 years ago

Ok, killall awesome; wingo helps, thanks.