TimUntersberger / nog

A tiling window manager for Windows
MIT License
697 stars 20 forks source link

Nog doesn't load the config file in latest development build #251

Closed keepitsane closed 3 years ago

keepitsane commented 3 years ago

Version (which release did you use?) 3fadff7

Describe the bug

Nog seems to start up fine and is running in the task tray. But doesn't respond to any keybindings or do anything.

Here is my log file:

[2021-02-28 09:06:40.068071 -05:00] DEBUG [twm\src\main.rs:161] initializing displays took 2.2042ms
[2021-02-28 09:06:40.070072 -05:00] DEBUG [twm\src\main.rs:867] Running config file
[2021-02-28 09:06:40.081570 -05:00] INFO [twm\src\main.rs:1089] 
[2021-02-28 09:06:40.081570 -05:00] INFO [twm\src\main.rs:888] Starting hot reloading of config
[2021-02-28 09:06:40.081570 -05:00] DEBUG [twm\src\system\win\api.rs:137] Exe doesn't exist yet
[2021-02-28 09:06:40.082070 -05:00] DEBUG [twm\src\config\hot_reloading.rs:25] Watching "C:\\Users\\Abhishek\\AppData\\Roaming\\nog" recursively for file changes
[2021-02-28 09:06:40.120072 -05:00] INFO [twm\src\startup.rs:11] Enabled launch on startup in registry
[2021-02-28 09:06:40.120574 -05:00] INFO [twm\src\main.rs:808] Creating tray icon
[2021-02-28 09:06:40.126073 -05:00] INFO [twm\src\main.rs:895] Listening for keybindings
TimUntersberger commented 3 years ago

[2021-02-28 09:06:40.081570 -05:00] DEBUG [twm\src\system\win\api.rs:137] Exe doesn't exist yet

This looks interesting. Did you delete the other executable before? There might be some path issues, since running the exe on my pc is working just fine.

keepitsane commented 3 years ago

The way I usually upgrade my Nog executable is download the latest release from github. From my downloads folder I run it once and then immediately exit Nog and delete the exe from my downloads folder. I have a shortcut in my start menu folder link to the exe that gets copied over to the Nog folder in AppData. I then start Nog using that shortcut.

Now even if I download the exe and move in manually to my Nog folder I still get this issue and the same above posted log file.

keepitsane commented 3 years ago

Even just running the exe from my downloads folder gets the same issue.

TimUntersberger commented 3 years ago

The way I usually upgrade my Nog executable is download the latest release from github. From my downloads folder I run it once and then immediately exit Nog and delete the exe from my downloads folder.

I did the same thing and I am not encountering the issue.

[2021-02-28 09:06:40.081570 -05:00] DEBUG [twm\src\system\win\api.rs:137] Exe doesn't exist yet

That is why I think this line is interesting as it should exist right?

keepitsane commented 3 years ago

Yeah it is very weird, cause the exe does exist so I am not sure what I am missing. The last working build for me is the official 0.13 release. Following my usually routine with that works normally.

TimUntersberger commented 3 years ago

@ramirezmike is the latest build working for you?

ramirezmike commented 3 years ago

I downloaded this and this and both seem to be working correctly for me in the brief testing I did.

Although... I don't use the launch_on_startup feature, so maybe that's why?

it looks like it might be related to that?

keepitsane commented 3 years ago

Removing this line from my config.ns fixed the issue for me nog.config.disable("work_mode")

keepitsane commented 3 years ago

It seem also that once Nog enters work mode after starting using my keybinding to toggle work mode off makes Nog get stuck and not able to toggle work mode back on. If I toggle work mode off I have to quit Nog from the system tray and start a new instance of Nog.

ramirezmike commented 3 years ago

I have a couple questions.

  1. Are you using the launch_on_startup feature?
  2. is the issue still that it's not using your config or that workmode gets stuck?

Are these essentially the steps to reproduce:

  1. set nog to launch_on_startup and start with work_mode disabled
  2. toggle work_mode ON with a custom keybinding from your config
  3. (everything is working normally at this point?)
  4. toggle work_mode OFF
  5. attempt to toggle work_mode back ON

And then at this point nothing works, is that right?

Just trying to understand what is happening and what steps you're taking because I'm not running into anything like this but I also think my config is slightly different...

keepitsane commented 3 years ago

@ramirezmike Sorry for the delayed response!

  1. Are you using the launch_on_startup feature?

Yes I am.

  1. is the issue still that it's not using your config or that workmode gets stuck?

Using this line nog.config.disable("work_mode") makes it so that Nog never loads properly (Log file from first comment). Removing this line from my config file causes Nog to start up and work properly. However, if I use my keybinding to toggle work mode off nog.bind("Alt+Control+W", nog.toggle_work_mode, true) I can not toggle work mode back on. I am forced to quit Nog using the system tray icon and launch a new instance. Here is the log file after I use my keybinding to toggle work mode off:

[2021-03-08 16:41:09.642766 -05:00] DEBUG [twm\src\main.rs:934] Received keybinding Keybinding(ALT+CONTROL+W, 17, Normal, 3087, None)
[2021-03-08 16:41:09.642766 -05:00] DEBUG [twm\src\system\win\win_event_listener.rs:117] Unregistering win event hook
[2021-03-08 16:41:09.658237 -05:00] DEBUG [twm\src\keybindings.rs:239] KbManager received LeaveWorkMode
[2021-03-08 16:41:09.658237 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+I, 0, Normal, 1073, None)
[2021-03-08 16:41:09.658237 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+Q, 1, Normal, 1081, None)
[2021-03-08 16:41:09.658736 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+M, 2, Normal, 1077, None)
[2021-03-08 16:41:09.658736 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+X, 3, Normal, 1088, None)
[2021-03-08 16:41:09.658736 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+R, 4, Normal, 1082, None)
[2021-03-08 16:41:09.658736 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+CONTROL+I, 5, Normal, 3073, None)
[2021-03-08 16:41:09.659239 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+H, 6, Normal, 1072, None)
[2021-03-08 16:41:09.659239 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+K, 7, Normal, 1075, None)
[2021-03-08 16:41:09.659239 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+L, 8, Normal, 1076, None)
[2021-03-08 16:41:09.659737 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+J, 9, Normal, 1074, None)
[2021-03-08 16:41:09.660238 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+SHIFT+H, 10, Normal, 5072, None)
[2021-03-08 16:41:09.660735 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+SHIFT+K, 11, Normal, 5075, None)
[2021-03-08 16:41:09.660735 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+SHIFT+L, 12, Normal, 5076, None)
[2021-03-08 16:41:09.660735 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+SHIFT+J, 13, Normal, 5074, None)
[2021-03-08 16:41:09.660735 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+Plus, 14, Normal, 1187, None)
[2021-03-08 16:41:09.660735 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+Minus, 15, Normal, 1189, None)
[2021-03-08 16:41:09.661238 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(CONTROL+SHIFT+F, 16, Normal, 6070, None)
[2021-03-08 16:41:09.661238 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+CONTROL+W, 17, Normal, 3087, None)
[2021-03-08 16:41:09.661238 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+F, 18, Normal, 1070, None)
[2021-03-08 16:41:09.661238 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+SHIFT+Zero, 19, Normal, 5048, None)
[2021-03-08 16:41:09.661737 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+SHIFT+One, 20, Normal, 5049, None)
[2021-03-08 16:41:09.661737 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+SHIFT+Two, 21, Normal, 5050, None)
[2021-03-08 16:41:09.661737 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+SHIFT+Three, 22, Normal, 5051, None)
[2021-03-08 16:41:09.661737 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+SHIFT+Four, 23, Normal, 5052, None)
[2021-03-08 16:41:09.662238 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+SHIFT+Five, 24, Normal, 5053, None)
[2021-03-08 16:41:09.662238 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+SHIFT+Six, 25, Normal, 5054, None)
[2021-03-08 16:41:09.662238 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+SHIFT+Seven, 26, Normal, 5055, None)
[2021-03-08 16:41:09.662735 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+SHIFT+Eight, 27, Normal, 5056, None)
[2021-03-08 16:41:09.662735 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+SHIFT+Nine, 28, Normal, 5057, None)
[2021-03-08 16:41:09.662735 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+CONTROL+Zero, 29, Normal, 3048, None)
[2021-03-08 16:41:09.662735 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+CONTROL+One, 30, Normal, 3049, None)
[2021-03-08 16:41:09.662735 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+CONTROL+Two, 31, Normal, 3050, None)
[2021-03-08 16:41:09.663233 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+CONTROL+Three, 32, Normal, 3051, None)
[2021-03-08 16:41:09.663233 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+CONTROL+Four, 33, Normal, 3052, None)
[2021-03-08 16:41:09.663233 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+CONTROL+Five, 34, Normal, 3053, None)
[2021-03-08 16:41:09.663233 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+CONTROL+Six, 35, Normal, 3054, None)
[2021-03-08 16:41:09.663233 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+CONTROL+Seven, 36, Normal, 3055, None)
[2021-03-08 16:41:09.663736 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+CONTROL+Eight, 37, Normal, 3056, None)
[2021-03-08 16:41:09.663736 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+CONTROL+Nine, 38, Normal, 3057, None)
[2021-03-08 16:41:09.663736 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+Zero, 39, Normal, 1048, None)
[2021-03-08 16:41:09.664234 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+One, 40, Normal, 1049, None)
[2021-03-08 16:41:09.664234 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+Two, 41, Normal, 1050, None)
[2021-03-08 16:41:09.665734 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+Three, 42, Normal, 1051, None)
[2021-03-08 16:41:09.665734 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+Four, 43, Normal, 1052, None)
[2021-03-08 16:41:09.666233 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+Five, 44, Normal, 1053, None)
[2021-03-08 16:41:09.666233 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+Six, 45, Normal, 1054, None)
[2021-03-08 16:41:09.666233 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+Seven, 46, Normal, 1055, None)
[2021-03-08 16:41:09.666737 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+Eight, 47, Normal, 1056, None)
[2021-03-08 16:41:09.666737 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+Nine, 48, Normal, 1057, None)
[2021-03-08 16:41:09.666737 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+B, 49, Normal, 1066, None)
[2021-03-08 16:41:09.667235 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+C, 50, Normal, 1067, None)
[2021-03-08 16:41:09.667235 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+E, 51, Normal, 1069, None)
[2021-03-08 16:41:09.667734 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+S, 52, Normal, 1083, None)
[2021-03-08 16:41:09.667734 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+V, 53, Normal, 1086, None)
[2021-03-08 16:41:09.667734 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+N, 54, Normal, 1078, None)
[2021-03-08 16:41:09.667734 -05:00] INFO [twm\src\keybindings.rs:67] Unregistering Keybinding(ALT+A, 55, Normal, 1065, None)
[2021-03-08 16:41:09.673738 -05:00] DEBUG [twm\src\system\win\win_event_listener.rs:100] Win event hook unregistered

Are these essentially the steps to reproduce:

  1. set nog to launch_on_startup and start with work_mode disabled

If this is how I have my config setup then I can never actually enable Nog as the log file from the first comment happens.

[2021-02-28 09:06:40.068071 -05:00] DEBUG [twm\src\main.rs:161] initializing displays took 2.2042ms
[2021-02-28 09:06:40.070072 -05:00] DEBUG [twm\src\main.rs:867] Running config file
[2021-02-28 09:06:40.081570 -05:00] INFO [twm\src\main.rs:1089] 
[2021-02-28 09:06:40.081570 -05:00] INFO [twm\src\main.rs:888] Starting hot reloading of config
[2021-02-28 09:06:40.081570 -05:00] DEBUG [twm\src\system\win\api.rs:137] Exe doesn't exist yet
[2021-02-28 09:06:40.082070 -05:00] DEBUG [twm\src\config\hot_reloading.rs:25] Watching "C:\\Users\\Abhishek\\AppData\\Roaming\\nog" recursively for file changes
[2021-02-28 09:06:40.120072 -05:00] INFO [twm\src\startup.rs:11] Enabled launch on startup in registry
[2021-02-28 09:06:40.120574 -05:00] INFO [twm\src\main.rs:808] Creating tray icon
[2021-02-28 09:06:40.126073 -05:00] INFO [twm\src\main.rs:895] Listening for keybindings

Your steps to reproduce this issue are correct only when either removing the line nog.config.disable("work_mode") or changing it nog.config.enable("work_mode") from my config.ns.

So step one should be:

  1. set nog to launch_on_startup and start with work_mode enabled (I think removing the nog.config.disable("work_mode") is the same as enabling it as that is the default behavior.

Basically there are two ways to encounter this issue using nog.config.disable("work_mode") or following your setups to reproduce with my modified step one. I hope this helps please let me know if you need any clarifications.

Here is my config.ns:

import nog
import nog.bar.components

import keybindings
import workspace
import rules
import modes.resize
import plugins

nog.bar.configure(#{
    font: "FiraCode NF",
    font_size: 17,
    color: 0x4B326E, 
    components: #{
        left: [components.workspaces()],
        center: [components.time("%l:%M:%S %p")],
        right: [components.active_mode(), components.padding(5), components.date("%a, %e %b %Y"), components.padding(1)]
    }
})

var ignored = [
    "explorer.exe",
    "Taskmgr.exe",
    "SnippingTool.exe",
    "Bitwarden.exe",
    "notepad.exe",
    ".*- Zoom Cloud Meetings|Zoom Cloud Meetings",
    ".*- Waiting for Host|Waiting for Host",
    ".*- Chat|Chat",
    ".*- Zoom|Zoom",
    "Zoom.exe",
    "WINWORD.EXE",
    "steam.exe",
    "Authy Desktop.exe",
    "Wox.exe",
    "ImageResizer.exe"
]

var workspace_count = 10
var direction_keys = #{
    "H": "Left",
    "J": "Down",
    "K": "Up",
    "L": "Right"
}

// nog.config.disable("work_mode")
nog.config.enable("work_mode")

nog.config.enable("display_app_bar")
nog.config.enable("launch_on_startup")
nog.config.enable("multi_monitor")
nog.config.enable("remove_task_bar")
nog.config.enable("remove_title_bar")

workspace.init()
keybindings.init(direction_keys, workspace_count)
rules.init(ignored)
ramirezmike commented 3 years ago

@keepitsane I think I figured this out!

So first, the "Exe doesn't exist yet" message will show if the .exe you launch from has a different path than the AppData one, so even if you already have a nog.exe there, if you are launching it from anywhere else it'll say "Exe doesn't exist yet". I think the functionality shouldn't change but maybe the message could be made less confusing. If you download a new version, we do want it to overwrite what's there, it just says "Exe doesn't exist yet" when it adds or overwrites the .exe file in AppData.

Ok, separately, the config not working...

There was a recent change here that changes the NogScript bind function to use an enum instead of "true" or "false"

I was able to reproduce your specific issue I think by making changes to my config to match what you said. I then took this line...

nog.bind("Alt+Control+W", nog.toggle_work_mode, true)

and updated it to use the enum

nog.bind("Alt+Control+W", nog.toggle_work_mode, "global")

and restarted nog and I was able to get it to toggle correctly. This looks like what you might be running into, effectively you don't have any keybindings set because "true" no longer binds.

@TimUntersberger The doc was updated here but I think the example should be updated too because it's not clear which of the following the user should do and I don't think it's unrealistic for someone to consider trying these.

nog.bind("Alt+Control+W", nog.toggle_work_mode, "global") nog.bind("Alt+Control+W", nog.toggle_work_mode, global) nog.bind("Alt+Control+W", nog.toggle_work_mode, Global) nog.bind("Alt+Control+W", nog.toggle_work_mode, KeybindingKind.Global)

Also, what's the difference between KeybindingKind.Normal and KeybindingKind.Global? I feel like the docs doesn't make that clear either.

Finally, we might want to have somewhere to list config structure changes although I'm not sure where best that would be... maybe on the doc website itself?

TimUntersberger commented 3 years ago

Also, what's the difference between KeybindingKind.Normal and KeybindingKind.Global? I feel like the docs doesn't make that clear either.

Normal is the same as passing false previously and Global just means that the keybinding won't get unregistered when leaving work mode.

Finally, we might want to have somewhere to list config structure changes although I'm not sure where best that would be... maybe on the doc website itself?

Maybe we should introduce a CHANGELOG.md file? Not to sure myself how to do this as I have never had to deal with this.

keepitsane commented 3 years ago

So first, the "Exe doesn't exist yet" message will show if the .exe you launch from has a different path than the AppData one, so even if you already have a nog.exe there, if you are launching it from anywhere else it'll say "Exe doesn't exist yet". I think the functionality shouldn't change but maybe the message could be made less confusing. If you download a new version, we do want it to overwrite what's there, it just says "Exe doesn't exist yet" when it adds or overwrites the .exe file in AppData.

The only issue is that I encountered the same issue even when manually replacing the .exe in my AppData with the new version. Normally I launch Nog using a shortcut I created, but even when manually double clicking the .exe to run it I encountered the same bug.

Ok, separately, the config not working...

and updated it to use the enum

nog.bind("Alt+Control+W", nog.toggle_work_mode, "global")

and restarted nog and I was able to get it to toggle correctly. This looks like what you might be running into, effectively you don't have any keybindings set because "true" no longer binds.

This fixed the issue for me and I can now toggle work mode on and off. @ramirezmike thank you very much for finding that!

Maybe I missed it somehow, but it would be nice if maybe in the readme or release notes if any breaking changes are made to notify users. I understand obviously I am running dev builds and changes are going to be made rapidly, but a small note would go a long way.

ramirezmike commented 3 years ago

The only issue is that I encountered the same issue even when manually replacing the .exe in my AppData with the new version. Normally I launch Nog using a shortcut I created, but even when manually double clicking the .exe to run it I encountered the same bug.

I'm not following what the issue is here exactly. I get that you're saying it happens with the launch_on_startup regardless of which .exe you use, but I'm not sure what exactly you're saying is happening. This is separate from the work mode thing?

a small note would go a long way.

yeah, agreed. We could try the CHANGELOG.md thing

keepitsane commented 3 years ago

I'm not following what the issue is here exactly. I get that you're saying it happens with the launch_on_startup regardless of which .exe you use, but I'm not sure what exactly you're saying is happening. This is separate from the work mode thing?

@ramirezmike Well I was just mentioning because you original said this...

So first, the "Exe doesn't exist yet" message will show if the .exe you launch from has a different path than the AppData one, so >even if you already have a nog.exe there

I was just adding the fact that even when launching the .exe that is located in the AppData folder (double-clicking the exe in AppData) I get the same error message. So I am not sure if it is a ".exe you launch from has a different path than the AppData one". Sorry if that is still confusing, let me know and I can definitely try to clarify again.

TimUntersberger commented 3 years ago

@keepitsane is this still happening for you?

keepitsane commented 3 years ago

I am no longer experiencing this bug in the latest version.