summaryrefslogtreecommitdiff
path: root/common/home/hyprland/hl.nix
blob: fb2565dff746ca69409e0cec77e99efbee7a831c (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
{ lib }: let
	Lua = lib.generators.mkLuaInline;
	toLua = lib.generators.toLua;
	join = builtins.concatStringsSep;
	call = name: opts: (Lua "${name}(${if opts == null then "" else (toLua {} opts)})");
in
{
	bind = { mod ? false, shift ? false, keys, flags ? null }: lua: {
		_args = [
			(Lua (
						(if mod then "mod .. ' + " else "'") +
						(if shift then "SHIFT + " else "") + 
						(join " + " keys) + "'")
			)
			lua
			flags
		];
	};
	on.start = luas: {
		_args = [
			"hyprland.start"
			(Lua "function()${join ";" (map (l: l.expr) luas)}end")
		];
	};
	dsp = {
		exec = call "hl.dsp.exec_cmd";
		exit = call "hl.dsp.exit" null;
		focus = call "hl.dsp.focus";
		layout = call "hl.dsp.layout";
		window = {
			drag = call "hl.dsp.window.drag" null;
			move = call "hl.dsp.window.move";
			close = call "hl.dsp.window.close" null;
			fullscreen = call "hl.dsp.window.fullscreen" null;
			resize = call "hl.dsp.window.resize";
		};
	};
}