Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blank config #242

Closed
los95 opened this issue Feb 20, 2021 · 11 comments
Closed

Blank config #242

los95 opened this issue Feb 20, 2021 · 11 comments

Comments

@los95
Copy link

los95 commented Feb 20, 2021

Hello, I am happy to see that there is a window manager being made for windows as sometimes I need to boot it up and not having keybindings is a nightmare. However, trying to set up the config is sort tedious. Forgive my ignorance but other window managers in Linux like dwm and xmonad usually come with a pre-configured config where the bindings work. On here, the config is just blank and the documentation is in my opinion, vague. I think it would be a good idea to implement a config where keybindings are already set. Thanks for reading!

@los95 los95 changed the title Blank confg Blank config Feb 20, 2021
@TimUntersberger
Copy link
Owner

I am thinking about using the below script as the default config. Any thoughts?

import nog
import nog.rules

var ignored = [
    "explorer.exe",
    "Taskmgr.exe"
]

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

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.bind("Alt+I", nog.window.ignore)
nog.bind("Alt+Q", nog.window.close)
nog.bind("Alt+M", nog.window.minimize)
nog.bind("Alt+X", nog.quit)

nog.bind_map("Alt", nog.workspace.focus, direction_keys)
nog.bind_map("Alt+Control", nog.workspace.swap, direction_keys)

nog.bind("Alt+Plus", () => nog.window.set_split_direction("Vertical"))
nog.bind("Alt+Minus", () => nog.window.set_split_direction("Horizontal"))

nog.bind("Alt+Control+F", nog.window.toggle_floating)
nog.bind("Alt+Control+W", nog.toggle_work_mode, true)
nog.bind("Alt+F", nog.workspace.toggle_fullscreen)

nog.bind_arr("Alt+Shift", nog.window.move_to_workspace, range(9))
nog.bind_arr("Alt+Control", nog.workspace.move_to_monitor, range(9))
nog.bind_arr("Alt", nog.workspace.change, range(9))

ignored.for_each(rules.ignore)

rules.match("firefox.exe", #{
    has_custom_titlebar: true,
    firefox: true
})

rules.match("chrome.exe", #{
    has_custom_titlebar: true,
    chromium: true
})

rules.match("Discord.exe", #{
    has_custom_titlebar: true,
})

rules.match("Spotify.exe", #{
    has_custom_titlebar: true,
})

rules.match("Code.exe", #{
    has_custom_titlebar: true,
})

@ramirezmike
Copy link
Collaborator

I know we'll keep working on the documentation but it might be nice to have some sections in the default config that are somewhat instructive but commented out.. at least things that are pretty solid that we're not planning on changing so we're not having to worry about updating documentation in multiple places.

Here are some thoughts

  1. I know nog has a default bar configuration in the code, but maybe having a simple layout commented out with some notes like "uncomment this section to customize the appbar"
  2. Because of "Alt Gr" key is blocked by nog #210 I'm somewhat hesitant about default configs that overlap with the AltGr usage like "nog.bind_arr("Alt+Control", nog.workspace.move_to_monitor, range(9))" There is a lot of overlap though so.. idk, maybe this is something that we should have in the "known issues" section as a head's up
  3. maybe an example of toggling config settings like this (could be commented out)

nog.bind("Alt+I", () => nog.config.toggle("display_app_bar"))

  1. commented section that sets inner/outer gaps
  2. Maybe something commented out for resizing? I'm hesitant to have too many bindings out of the box that might make users feel like nog is taking over and personally I use modes for resizing so I can keep the keybinding footprint down. Not sure if a commented mode example in the config is ideal either because it's probably better as a separate file but idk, maybe it's ok if it's a small mode example of just resizing
  3. the ignored.for_each(rules.ignore) should be next to the array

Here's what you wrote but with some added comments (I didn't add any of the above). Maybe they're a little overkill and obvious though?

import nog
import nog.rules

// Example of creating an array to store values
// and running a function on each value.
// This sets up a list of programs that Nog will ignore
var ignored = [
    "explorer.exe",
    "Taskmgr.exe"
]
ignored.for_each(rules.ignore)


nog.config.enable("work_mode")         // set Nog to run in work mode when launched
nog.config.enable("display_app_bar")   // shows Nog appbar at top of screen
nog.config.enable("launch_on_startup") // sets registry value to launch Nog on startup
nog.config.enable("multi_monitor")     // sets Nog to run across all available monitors
nog.config.enable("remove_task_bar")   // hides Window taskbar

nog.bind("Alt+I", nog.window.ignore)   // updates config to ignore currently focused program
nog.bind("Alt+Q", nog.window.close)    // quits currently focused program
nog.bind("Alt+M", nog.window.minimize) // minimizes currently focused program
nog.bind("Alt+X", nog.quit)            // quits Nog

// Example of creating a dictionary object
// This is used for mapping keybindings
var direction_keys = #{
    "H": "Left",
    "J": "Down",
    "K": "Up",
    "L": "Right"
}

// Examples of using dictionary object to bind functions to each key/value pair
nog.bind_map("Alt", nog.workspace.focus, direction_keys)
nog.bind_map("Alt+Control", nog.workspace.swap, direction_keys)

// Examples of binding to a lambda function call (useful for binding functions with different parameters)
// split_direction is where Nog will split on the next window it manages
nog.bind("Alt+Plus", () => nog.window.set_split_direction("Vertical"))
nog.bind("Alt+Minus", () => nog.window.set_split_direction("Horizontal"))

nog.bind("Alt+Control+F", nog.window.toggle_floating) // manage or unmanage currently focused program
nog.bind("Alt+Control+W", nog.toggle_work_mode, true) // turns work mode on or off
nog.bind("Alt+F", nog.workspace.toggle_fullscreen)    // toggles fullscreen on currently focused program

// Example of binding functions to a range of keys 1-9
nog.bind_arr("Alt+Shift", nog.window.move_to_workspace, range(9))    // moves currently focused program to another workspace
nog.bind_arr("Alt+Control", nog.workspace.move_to_monitor, range(9)) // moves current workspace to another monitor
nog.bind_arr("Alt", nog.workspace.change, range(9))                  // changes to another workspace

// Example of rules for specific programs
rules.match("firefox.exe", #{
    has_custom_titlebar: true,
    firefox: true
})

rules.match("chrome.exe", #{
    has_custom_titlebar: true,
    chromium: true
})

rules.match("Discord.exe", #{
    has_custom_titlebar: true,
})

rules.match("Spotify.exe", #{
    has_custom_titlebar: true,
})

rules.match("Code.exe", #{
    has_custom_titlebar: true,
})

@los95
Copy link
Author

los95 commented Feb 20, 2021

This is fine to begin with. I can see how the comments could be an overkill but having them describe different categories in the config won't hurt. The things that should be at least implemented in a default config are the bar, workspaces, navigating and moving programs around them, closing a program and the window manager itself. Anything else could be added from the documentation if the user desires to implement another feature. Thank you both for the quick responses!

@los95
Copy link
Author

los95 commented Feb 20, 2021

One thing I forgot to mention, is it possible to use the mod key instead of alt?

@errv01d
Copy link

errv01d commented Feb 22, 2021

Hello,
Hope this is the right way to mention this - I've been trying to explore Nog for a few weeks but couldn't get the 'set_split_direction' command to work for me.

I finally realised (thanks to recent documentation updates) that it seems the function isn't in 'nog.window', but in 'nog.workspace' .
Once I changed this, it worked perfectly.

Both example and suggested default configs have it listed as 'nog.window.set_split_direction' though. (https://timuntersberger.github.io/nog/api/nog/workspace)

I've also noticed some of the links in the documentation page's sidebar work, but some of the links on the pages themselves don't appear to go anywhere.
(ie. 'workspace' on https://timuntersberger.github.io/nog/api/nog.html
just reloads itself, whilst 'workspace' link in the sidebar goes to the correct location as per 'workspace' link mentioned above).

I'm not knowledgeable in Rust currently, but I'd like to contribute any way I can (ie. Documentation / things like above) if that wouldn't cause any problems for current contributors?

I'm happy to create a fork and submit the relevant pull request(s) (and/or file bugs) if that would be best, but thought I'd check here first.

Thank-you so much to everyone for creating and contributing to Nog as well !

I'm looking forward to watching/contributing to this project - I love the possibilities it brings to Windows users who want a lightweight, flexible tiling window manager.

Kind Regards,
errv01d

@ramirezmike
Copy link
Collaborator

@errv01d there is a pinned issue for documentation feedback here. feel free to point out issues and make recommendations. Pull requests should probably be fine since the documentation is somewhat sectioned off.

also, lol thanks for pointing out the window.split_direction vs workspace.split_direction. at some point I inadvertently moved it to the workspace level and we keep copying docs/configs from old versions.

@TimUntersberger (somewhat off topic?) I don't think we ever talked about that, would you prefer splits being stored at the window level? I only realized in retrospect that you had initially set it up this way. Whichever way it is, the default config should match at least.

@TimUntersberger
Copy link
Owner

@ramirezmike in the beginning you could have different split_directions for windows, but I like the current solution better tbh.

@errv01d Any contributions are welcome :) Do you want to fix the documentation links as your first issue?

One thing I forgot to mention, is it possible to use the mod key instead of alt?

@los95 shouldn't the mod key just send alt keycodes? I don't know how they work exactly. What mod keys are we talking about?

@los95
Copy link
Author

los95 commented Feb 23, 2021

@TimUntersberger Sorry for the confusion. I am talking about the windows key.

@TimUntersberger
Copy link
Owner

@los95 The windows key is sadly reserved for the operating system.

@TimUntersberger
Copy link
Owner

This isn't actually fixed right?

@errv01d
Copy link

errv01d commented Mar 10, 2021

This isn't actually fixed right?

No, I haven't made any changes/submitted any pull requests regarding this yet either, sorry.

I've just checked a few of the links which were previously broken/reloading the parent page and they're still doing the same.

I need to set time aside this coming Friday/weekend and try to contribute/work to fix it.

Will do my best to start on this on Friday night and will update as I go.
Apologies for not being more active recently too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants