home-manager icon indicating copy to clipboard operation
home-manager copied to clipboard

Herbstluftwm Help

Open tororutsu opened this issue 3 years ago • 15 comments

Hello, I currently have a working herbstluftwm environment. It is installed using configuration.nix. I didn't really notice problems until I tried getting dmenu working. Pkgs I installed thru home-manager wouldn't show up on dmenu. So I tried looking more into it, and I think it has to do with my WM not being configured with home-manager. If I can get some help setting that up, I would definitely appreciate it

tororutsu avatar Apr 10 '22 22:04 tororutsu

Hi @rjahrj,

First, can you confirm what Linux distribution you use?

Can you also confirm that $HOME/.nix-profile/bin is in your $PATH? If not, can you share the content of this variable.

berbiche avatar Apr 11 '22 03:04 berbiche

@berbiche hello thanks for reaching out. I am using NixOS 20.11 and yes I can confirm that .nix-profile/bin is in my path

tororutsu avatar Apr 11 '22 05:04 tororutsu

I think your herbstluftwm is not loading the environment (it does not execute $HOME/.profile, or some other shell file before starting) so it does not have the correct $PATH.

berbiche avatar Apr 12 '22 01:04 berbiche

This is the error I get when I now try to use home-manager switch

error : list index 0 is out of bounds, at /home/Rj/.nix-defexpr/channels/home-manager/modules/services/window-managers/herbstluftwm.nix

20220413_075847 20220413_075758

tororutsu avatar Apr 13 '22 12:04 tororutsu

Sorry for the late reply.

You have to set at least one tag in the configuration with xsession.windowManager.herbstluftwm.tags = [ "something" ];.

I think the issue is due to this line in Home Manager: https://github.com/nix-community/home-manager/blob/8ab155c61f5821ffda723de88b0009769771d4f2/modules/services/window-managers/herbstluftwm.nix#L148-L152

cc: @olmokramer

berbiche avatar Apr 16 '22 22:04 berbiche

@berbiche thanks that definitely allowed me to enable Herbst on HM, now the problem is the autostart file. Or the Nix equivalent? Screenshot_20220417-002800 This just gives me the red border and nothing works 🤦🏽

tororutsu avatar Apr 17 '22 04:04 tororutsu

Sorry, I'm not sure. I have no experience with Herbstluftwm.

You can change your configuration iteratively and look at the generated configuration file to fix anything until you have a 1-to-1 mapping of your shell script with the nix expression.

berbiche avatar Apr 17 '22 22:04 berbiche

Sorry for the late reply, was on vacation for a couple of days. Could you share the autostart script you're trying to recreate @rjahrj ? What do you mean with "nothing works"?

olmokramer avatar Apr 19 '22 09:04 olmokramer

@olmokramer perfectly fine, actually I am using the default config from the Herbstluftwm git repo. But I was at one point trying to load it using the xdg.configFile option while keeping it in my dotfiles. However both files become read-only 🤦🏽. So what is the default way the define and manage the autostart file using Home-manager? Please and thank you. At this point I just want to know lol 🤦🏽

tororutsu avatar Apr 20 '22 01:04 tororutsu

If you don't want to manage your Herbstluftwm config with Home Manager I would recommend setting

xsession.windowManager.herbstluftwm.enable = false

and make sure that Herbstluft is only started after Home Manger has done its setup of the PATH environment variable, for example by setting

xsession.windowManager.command = "${pkgs.herbstluftwm}/bin/herbstluftwm --locked";

Otherwise, if you do want to manage your Herbstluftwm config with Home Manager, you will need to set the settings and keybindings in your Home Manager configuration.

olmokramer avatar Apr 20 '22 11:04 olmokramer

Yes I want to use HM, so pretty much I need to convert the autostart file into the separate HM Herbstluftwm functions?

On Wed, Apr 20, 2022, 07:48 Olmo Kramer @.***> wrote:

If you don't want to manage your Herbstluftwm config with Home Manager I would recommend setting

xsession.windowManager.herbstluftwm.enable = false

and make sure that Herbstluft is only started after Home Manger has done its setup of the PATH environment variable, for example by setting

xsession.windowManager.command = "${pkgs.herbstluftwm}/bin/herbstluftwm --locked";

Otherwise, if you do want to manage your Herbstluftwm config with Home Manager, you will need to set the settings and keybindings in your Home Manager configuration.

— Reply to this email directly, view it on GitHub https://github.com/nix-community/home-manager/issues/2884#issuecomment-1103840468, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE2BBDV3RIGAVONNP57VENTVF7VJVANCNFSM5TBOTN2A . You are receiving this because you were mentioned.Message ID: @.***>

tororutsu avatar Apr 20 '22 15:04 tororutsu

@olmokramer thanks that definitely helps a lot Where would I put stuff like hc detect_monitors I tried putting it in herbstluftwm.extraConfig but that didn't work 😞

tororutsu avatar Apr 20 '22 21:04 tororutsu

@olmokramer sorry for spamming you with questions 😭 but what about tag switching? Screenshot_20220421-185448

tororutsu avatar Apr 21 '22 22:04 tororutsu

@rjahrj You can use the keybinds option and the tags option.

I recommend looking at the documentation for the options here: https://nix-community.github.io/home-manager/options.html#opt-xsession.windowManager.herbstluftwm.enable

The shell code can be translated to:

let
  # A list is used because it preserves ordering
  tags = [
    { name = "tag 1"; key = "something"; }
    { name = "tag 2"; }
    ...
  ];
  # Attribute set of { <keybind> = "use <tag>"; }
  keybinds = let
    tagsWithKeybinds = lib.filter (lib.hasAttr "key") tags;
  in lib.listToAttrs (map (x: lib.nameValuePair x.key "use ${x.name}") tagsWithKeybinds);
in
{
  xsession.windowManager.herbstluftwm.keybinds = keybinds;
  xsession.windowManager.herbstluftwm.tags = lib.catAttrs "name" tags;
}

I also recommend reading the nixpkgs manual and getting acquainted with the library functions: https://nixos.org/manual/nixpkgs/unstable/#chap-functions

berbiche avatar Apr 22 '22 00:04 berbiche

@rjahrj Sorry for the late reply, work was insanely busy the past couple of days. Yes you should put that in the herbstluftwm.extraConfig section, but you should use herbstclient instead of hc. If you want to use hc you can put alias hc=herbstclient at the top of herbstluftwm.extraConfig. For the tag switching keybinds you'd use something like @berbiche wrote.

olmokramer avatar Apr 25 '22 08:04 olmokramer

Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.

If you are the original author of the issue

  • If this is resolved, please consider closing it so that the maintainers know not to focus on this.
  • If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough.
  • If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
If you are not the original author of the issue

  • If you are also experiencing this issue, please add details of your situation to help with the debugging process.
  • If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
Memorandum on closing issues

Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.

stale[bot] avatar Oct 12 '22 01:10 stale[bot]