Comments (10)
A way to solve this is to use the config file and this little library
from lazydocker.
very cool library! I wonder how best to go about this: we currently have most (though not all) of our keybindings defined in one place, so for those which are stored there, it would not be hard to merge in what we have defined in the user config. In fact even in the other places it wouldn't be hard just to refer to the user config.
in config.yml we can have:
keybindings:
stopContainer: 's'
nextTab: '['
previousTab: ']'
then in keybindings.go we can have:
{
ViewName: "containers",
Key: keybinding.MustParse(gui.Config.UserConfig.Keybindings.StopContainer),
Modifier: gocui.ModNone,
Handler: gui.handleContainerStop,
Description: gui.Tr.Stop,
},
How does that approach sound? Only real downside with that approach is that you don't get to specify if you want to use the gocui.ModAlt modifier, but we aren't currently using that anywhere anyway.
Another open question would be: how general should the keybindings be? Should there be one key for 'stop' or should we have 'stopContainer' and 'stopService'?
from lazydocker.
That approach sounds good, we could indeed look into the modAlt, but that is an issue for the library i guess. I could spend this weekend on it?
As for how general they should be, I think at first the best thing is to include everything to avoid bug creation. If we find that they are "too" general, they can always be stripped away.
from lazydocker.
I agree @glvr182 , and if you want to spend time on this that would be awesome :)
from lazydocker.
Also worth noting that if we set a key to be the empty string, that will enable the user to disable certain keys, which satisfies #27
from lazydocker.
also worth noting we'd need to support arrays of keys which luckily is already covered by that library. And if we're supporting arrays of keys then I guess we'd need to have it look like this:
keybindings:
stopContainer: ['s']
nextTab: ['[']
previousTab: [']']
So that we can continue to use the simple config merging logic
from lazydocker.
@jesseduffield Do you think we should use a map or a struct for the config?
from lazydocker.
I think a struct works better, that way we have strong typing. I made the decision to switch the i18n stuff to a struct and it's already proven really helpful in telling me when things are out of sync :)
from lazydocker.
Any news on this one?
from lazydocker.
This is totally do-able: we can just copy the approach that lazygit uses: https://github.com/jesseduffield/lazygit/blob/master/pkg/config/user_config.go
Any takers?
from lazydocker.
Related Issues (20)
- Changed DOCKERFILE with existing hub image
- After running lazydocker, docker completely breaks and it starts to require root permissions HOT 2
- Cannot install on Debian 5.10.197-1 via curl .sh HOT 2
- Custom Colors/Theme Config
- Possibility to configure different servers to manage the Dockers and have then split on "tabs" HOT 4
- Request: View only mode
- Enhance Image Section with Active Use Indicator HOT 2
- Connecting to remote docker host over ssh is broken
- XDG base directory specification is not described in the config docs HOT 1
- Config options for side panel visibility / size HOT 1
- Rounded Corners
- can't install following README instructions HOT 1
- Installing on arch linux using yay fails HOT 4
- Can I pass a flag to set the Project Name to something ?
- Cannot proceed until docker gives us more information about the container. Please retry in a few moments.
- Move the panel with number like lazygit HOT 1
- Container log colors HOT 1
- Selectable Logs/Stats/Env/Config/Top HOT 2
- Inquiry about Memory Usage in LazyDocker HOT 1
- Issue while connecting to remote docker socket HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lazydocker.