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

Herbstluftwm Help #2884

Open
tororutsu opened this issue Apr 10, 2022 · 16 comments
Open

Herbstluftwm Help #2884

tororutsu opened this issue Apr 10, 2022 · 16 comments

Comments

@tororutsu
Copy link

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

@berbiche
Copy link
Member

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.

@tororutsu
Copy link
Author

@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

@berbiche
Copy link
Member

berbiche commented Apr 12, 2022

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.

@tororutsu
Copy link
Author

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

@berbiche
Copy link
Member

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:

if ${cfg.package}/bin/herbstclient object_tree tags.by-name | ${pkgs.gnugrep}/bin/grep default; then
herbstclient rename default ${
lib.escapeShellArg (builtins.head cfg.tags)
}
fi

cc: @olmokramer

@tororutsu
Copy link
Author

@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 🤦🏽

@berbiche
Copy link
Member

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.

@olmokramer
Copy link
Contributor

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"?

@tororutsu
Copy link
Author

@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 🤦🏽

@olmokramer
Copy link
Contributor

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.

@tororutsu
Copy link
Author

tororutsu commented Apr 20, 2022 via email

@tororutsu
Copy link
Author

@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
Copy link
Author

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

@berbiche
Copy link
Member

@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

@olmokramer
Copy link
Contributor

@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.

@stale
Copy link

stale bot commented Oct 12, 2022

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.

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

No branches or pull requests

3 participants