4 ms·
Upvoted, this took me years to do myself. However, the config file annoys me now because every time I do something like toggling tree view with T or changing so
by boogies 6y ago
Upvoted, this took me years to do myself. However, the config file annoys me now because every time I do something like toggling tree view with T or changing sort between CPU and memory with P and U it pops up in my dotfile repo’s list of modified files. I wish it only stored the stuff that’s buried down in the setup menu like what meters are at the top.
- simias 6y agoAgreed, I feel like there should be a way to mark changes as temporary instead of commiting to file every time. I found a workaround that seems to work though, once you're happy with your defaults you can do: chmod a-w ~/.config/htop/htoprc This way you make the file read-only and prevent htop from changing it. Also I had to add "vim_mode=1" directly in the rc file because I couldn't find the option in the menus. Unfortunately it seems that git only stores the eXecutable bit of the files in the index, so you can't really commit a file as read-only, so you have to remember to do it one every one of your machines (or script it in a git hook I suppose).
- boogies 6y agoThank you! I might try this on some other things too. mpv is one tool I think handles a kind of similar thing nicely: it has a main config file for long term settings, but also allows you to use Q instead of q to quit and save state (eg. playback position, speed, volume, etc.) in .config/mpv/watchlater/hashofurl (a separate file for each URL you play). htop could save the single-keypress-changeable settings in, say, .config/htop/viewstate and only keep the other stuff that’s buried in the setup menu in the htoprc
- Arnavion 6y agoI have an /etc/htoprc so I can maintain it with the same tool that maintains my other /etc config files. Unfortunately htop also copies this over to ~/.config/htop/htoprc on every startup even if I don't change any configs, and then it gets out of sync if I ever update /etc/htoprc. So I have a /usr/local/bin/htop that does #!/bin/bash rm -rf ~/.config/htop /usr/bin/htop