aboutsummaryrefslogtreecommitdiffstats
path: root/sxhkd/default.nix
blob: 762c6b0f8e7d20383fe93c5b88b6c8bf58af08d6 (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
{ pkgs, ... }:

{
	services.sxhkd.enable = true;

	xdg.configFile."sxhkd/scripts/show-keybindings.sh" = {
		source = ./scripts/show-keybindings.sh;
		executable = true;
	};

	services.sxhkd.keybindings =
	let
		modKey = "alt";
		createKeybinding = keybinding: description: "# ${description}\n${modKey} + ${keybinding}";
	in {
		${(createKeybinding
			"s"
			"Show keybindings.")}
				= "$HOME/.config/sxhkd/scripts/show-keybindings.sh";

		${(createKeybinding
			"r"
			"Launch rofi.")}
				= "rofi -show run";

		${(createKeybinding
			"t"
			"Launch terminal.")}
				= "alacritty";

		${(createKeybinding
			"f"
			"Launch File Explorer.")}
				= "alacritty -t 'File Explorer' --class 'popup' -e lf";

		${(createKeybinding
			"q"
			"Kill current window.")}
				= "bspc node -c";

		${(createKeybinding
			"{1-9,0}"
			"Switch workspace.")}
				= "bspc desktop -f {1-9,10}";

		${(createKeybinding
			"shift + {1-9,0}"
			"Move window to workspace.")}
				= "bspc node -d {1-9,10} --follow";

		${(createKeybinding
			"{n,d,m}"
			"Set current window mode (tiled, floating, fullscreen).")}
				= "bspc node focused -t {tiled,floating,fullscreen}";

		${(createKeybinding
			"{_,shift + }{h,j,k,l}"
			"Navigate between windows.")}
				= "bspc node --{focus,swap} {west,south,north,east}";

		# the indentation for each line is required to work with the help prompt
		${(createKeybinding
			"ctrl + {h,j,k,l}"
			"Resize current window.")}
				= ''
				{bspc node @parent/second -z left -20 0; \
				bspc node @parent/first -z right -20 0, \
				bspc node @parent/second -z top 0 +20; \
				bspc node @parent/first -z bottom 0 +20, \
				bspc node @parent/first -z bottom 0 -20; \
				bspc node @parent/second -z top 0 -20, \
				bspc node @parent/first -z right +20 0; \
				bspc node @parent/second -z left +20 0}
		'';
	};
}