aboutsummaryrefslogtreecommitdiffstats
path: root/modules/desktop/window-manager/sxhkd/default.nix
blob: c31604b9fd475569a3aca01deb99871df8adc6af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{ pkgs, config, lib, ... }:

{
	options.desktop.window-manager.sxhkd = {
		enable = lib.mkEnableOption "Enables sxhkd.";
	};

	config = lib.mkIf config.desktop.window-manager.sxhkd.enable {
		services.sxhkd.enable = true;

		services.sxhkd.keybindings =
		let
			modKey = "alt";
			createKeybinding = keybinding: description: "# ${description}\n${modKey} + ${keybinding}";
		in lib.mkMerge [
			(
				if config.desktop.window-manager.bspwm.enable then
					(import ./keybindings/bspwm.nix { inherit pkgs createKeybinding; })
				else {}
			)
			{
				${(createKeybinding
					"s"
					"Show keybindings.")}
						= pkgs.writeShellScript
							"keybindings.sh"
							(builtins.readFile ./scripts/keybindings.sh);

				${(createKeybinding
					"r"
					"Application launcher.")}
						= config.desktop.popup-manager.application-launcher.command;

				${(createKeybinding
					"t"
					"Launch terminal.")}
						= config.desktop.terminal.command;

				${(createKeybinding
					"f"
					"Launch File Manager.")}
						= "${config.desktop.terminal.command} --title 'File Manager' --class popup -e ${config.tools.file-manager.command}";
			}
		];
	};
}