aboutsummaryrefslogtreecommitdiffstats
path: root/modules/desktop/window-manager/sxhkd/default.nix
blob: 63a1cf5fb21194af8a28db6aaaee9f033d6b8baa (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
{ 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: command: {
				"# ${description}\n${modKey} + ${keybinding}" = command;
			};
		in lib.mkMerge [
			(
				if config.desktop.window-manager.bspwm.enable then
					(import ./keybindings/bspwm.nix { inherit pkgs createKeybinding lib; })
				else {}
			)
			(lib.mkMerge [
				(createKeybinding
					"s"
					"Show keybindings."
					(pkgs.writeShellScript "keybindings.sh" (builtins.readFile ./scripts/keybindings.sh)))

				(createKeybinding
					"r"
					"Application launcher."
					config.desktop.application-launcher.command)

				(createKeybinding
					"t"
					"Launch terminal."
					config.tools.terminal.command)

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