Compare commits
	
		
			No commits in common. "796a663c435c3efe56f2e86529bc0cca49ed50d7" and "9faaaa2285c5a8967ed951b3fed47e92db30622c" have entirely different histories.
		
	
	
		
			796a663c43
			...
			9faaaa2285
		
	
		
					 2 changed files with 102 additions and 187 deletions
				
			
		
							
								
								
									
										15
									
								
								rules.lua
									
										
									
									
									
								
							
							
						
						
									
										15
									
								
								rules.lua
									
										
									
									
									
								
							|  | @ -15,20 +15,6 @@ local function popup_urgent(client, message) | ||||||
| 		end | 		end | ||||||
| 	end) | 	end) | ||||||
| end | end | ||||||
| 
 |  | ||||||
| local function keyboard_layer(num) |  | ||||||
| 	return function(client) |  | ||||||
| 		client:connect_signal("focus", function(c) |  | ||||||
| 			awful.util.spawn("kontroll-launch set-layer --index " .. num) |  | ||||||
| 			naughty.notify({ text = "kontroll: switching to layer " .. num }) |  | ||||||
| 		end) |  | ||||||
| 		client:connect_signal("unfocus", function(c) |  | ||||||
| 			awful.util.spawn("kontroll-launch set-layer --index 0") |  | ||||||
| 			naughty.notify({ text = "kontroll: switching to base layer" }) |  | ||||||
| 		end) |  | ||||||
| 	end |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| if not localconf.screen then | if not localconf.screen then | ||||||
| 	localconf.screen = {} | 	localconf.screen = {} | ||||||
| end | end | ||||||
|  | @ -86,7 +72,6 @@ awful.rules.rules = { | ||||||
| 		end, | 		end, | ||||||
| 	}, | 	}, | ||||||
| 	{ rule = { role = "buddy_list" }, callback = awful.client.setmaster }, | 	{ rule = { role = "buddy_list" }, callback = awful.client.setmaster }, | ||||||
| 	{ rule_any = { class = { "factorio" } }, callback = keyboard_layer(3) }, |  | ||||||
| 	{ | 	{ | ||||||
| 		rule = { class = "steam", name = "Friends" }, | 		rule = { class = "steam", name = "Friends" }, | ||||||
| 		properties = { screen = screen_chat, tag = "3" }, | 		properties = { screen = screen_chat, tag = "3" }, | ||||||
|  |  | ||||||
|  | @ -13,7 +13,7 @@ local app_folders = { | ||||||
| 	"/usr/share/applications", | 	"/usr/share/applications", | ||||||
| 	"/usr/local/share/applications", | 	"/usr/local/share/applications", | ||||||
| 	(os.getenv("XDG_DATA_HOME") or os.getenv("HOME") .. "/.local/share") .. "/applications", | 	(os.getenv("XDG_DATA_HOME") or os.getenv("HOME") .. "/.local/share") .. "/applications", | ||||||
| 	os.getenv("HOME") .. "/Desktop", | 	os.getenv("HOME") .. "/Desktop" | ||||||
| } | } | ||||||
| local menubar = require("menubar") | local menubar = require("menubar") | ||||||
| 
 | 
 | ||||||
|  | @ -21,20 +21,12 @@ menubar.utils.terminal = conf.cmd.terminal -- Set the terminal for applications | ||||||
| 
 | 
 | ||||||
| local binder = {modal = mb} | local binder = {modal = mb} | ||||||
| 
 | 
 | ||||||
| local function spawnf(cmd) | local function spawnf(cmd) return function() awful.spawn(cmd) end end | ||||||
| 	return function() |  | ||||||
| 		awful.spawn(cmd) |  | ||||||
| 	end |  | ||||||
| end |  | ||||||
| binder.spawn = spawnf | binder.spawn = spawnf | ||||||
| 
 | 
 | ||||||
| conf.cmd.run = conf.cmd.run or spawnf("dmenu_run") | conf.cmd.run = conf.cmd.run or spawnf("dmenu_run") | ||||||
| 
 | 
 | ||||||
| local function use_layout(layout) | local function use_layout(layout) return function() awful.layout.set(layout) end end | ||||||
| 	return function() |  | ||||||
| 		awful.layout.set(layout) |  | ||||||
| 	end |  | ||||||
| end |  | ||||||
| local layoutmap = { | local layoutmap = { | ||||||
| 	{"f", use_layout(awful.layout.suit.fair),            "Fair" }, | 	{"f", use_layout(awful.layout.suit.fair),            "Fair" }, | ||||||
| 	{"h", use_layout(awful.layout.suit.fair.horizontal), "Fair Horizontal" }, | 	{"h", use_layout(awful.layout.suit.fair.horizontal), "Fair Horizontal" }, | ||||||
|  | @ -42,59 +34,23 @@ local layoutmap = { | ||||||
| 	{"b", use_layout(awful.layout.suit.tile.bottom),     "Tile Bottom" }, | 	{"b", use_layout(awful.layout.suit.tile.bottom),     "Tile Bottom" }, | ||||||
| 	{"m", use_layout(awful.layout.suit.max),             "Maximized" }, | 	{"m", use_layout(awful.layout.suit.max),             "Maximized" }, | ||||||
| 	{"F", use_layout(awful.layout.suit.max.fullscreen),  "Fullscreen" }, | 	{"F", use_layout(awful.layout.suit.max.fullscreen),  "Fullscreen" }, | ||||||
| 	{ "space", use_layout(awful.layout.suit.floating), "Float" }, | 	{"space", use_layout(awful.layout.suit.floating),    "Float" } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| local layoutsettings = { | local layoutsettings = { | ||||||
| 	{ | 	{"h", function () awful.tag.incmwfact(-0.05) end,  "Master smaller" }, | ||||||
| 		"h", | 	{"l", function () awful.tag.incmwfact( 0.05) end,  "Master bigger" }, | ||||||
| 		function() | 	{"H", function () awful.tag.incnmaster( 1) end,    "More masters" }, | ||||||
| 			awful.tag.incmwfact(-0.05) | 	{"L", function () awful.tag.incnmaster(-1) end,    "Less masters" }, | ||||||
| 		end, | 	{"c", function () awful.tag.incncol( 1) end,       "More columns" }, | ||||||
| 		"Master smaller", | 	{"C", function () awful.tag.incncol(-1) end,       "Less columns" }, | ||||||
| 	}, |  | ||||||
| 	{ |  | ||||||
| 		"l", |  | ||||||
| 		function() |  | ||||||
| 			awful.tag.incmwfact(0.05) |  | ||||||
| 		end, |  | ||||||
| 		"Master bigger", |  | ||||||
| 	}, |  | ||||||
| 	{ |  | ||||||
| 		"H", |  | ||||||
| 		function() |  | ||||||
| 			awful.tag.incnmaster(1) |  | ||||||
| 		end, |  | ||||||
| 		"More masters", |  | ||||||
| 	}, |  | ||||||
| 	{ |  | ||||||
| 		"L", |  | ||||||
| 		function() |  | ||||||
| 			awful.tag.incnmaster(-1) |  | ||||||
| 		end, |  | ||||||
| 		"Less masters", |  | ||||||
| 	}, |  | ||||||
| 	{ |  | ||||||
| 		"c", |  | ||||||
| 		function() |  | ||||||
| 			awful.tag.incncol(1) |  | ||||||
| 		end, |  | ||||||
| 		"More columns", |  | ||||||
| 	}, |  | ||||||
| 	{ |  | ||||||
| 		"C", |  | ||||||
| 		function() |  | ||||||
| 			awful.tag.incncol(-1) |  | ||||||
| 		end, |  | ||||||
| 		"Less columns", |  | ||||||
| 	}, |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| local opposite_dirs = { | local opposite_dirs = { | ||||||
| 	left  = "right", | 	left  = "right", | ||||||
| 	right = "left", | 	right = "left", | ||||||
| 	up    = "down", | 	up    = "down", | ||||||
| 	down = "up", | 	down  = "up" | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| local function screen_in_wrapdir(dir, _screen) | local function screen_in_wrapdir(dir, _screen) | ||||||
|  | @ -117,6 +73,7 @@ local function screen_in_wrapdir(dir, _screen) | ||||||
|     end |     end | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
| local function screen_focus_wrapdir(dir) | local function screen_focus_wrapdir(dir) | ||||||
| 	return function() | 	return function() | ||||||
| 		local target = screen_in_wrapdir(dir) | 		local target = screen_in_wrapdir(dir) | ||||||
|  | @ -132,7 +89,7 @@ local function screen_move_client_wrapdir(dir) | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| function binder.add_bindings(keys) | function binder.add_bindings(keys) | ||||||
| 	globalkeys = awful.util.table.join(globalkeys, keys) | 	globalkeys = awful.util.table.join(globalkeys, keys); | ||||||
| 	return binder | 	return binder | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
|  | @ -147,7 +104,7 @@ function binder.clear() | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| function binder.apply() | function binder.apply() | ||||||
| 	naughty.notify({ text = "Reloading key bindings" }) |     naughty.notify { text="Reloading key bindings" } | ||||||
|     local allkeys = awful.util.table.clone(globalkeys) |     local allkeys = awful.util.table.clone(globalkeys) | ||||||
|     for _,v in pairs(globalkeyfuncs) do |     for _,v in pairs(globalkeyfuncs) do | ||||||
| 	local loadedkeys = v() | 	local loadedkeys = v() | ||||||
|  | @ -169,47 +126,31 @@ local function client_opacity_set(c, default, max, step) | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| local clientkeys = awful.util.table.join( | local clientkeys = awful.util.table.join( | ||||||
| 	awful.key({ modkey, "Shift" }, "f", function(c) | awful.key({ modkey, "Shift"   }, "f",      function (c) c.fullscreen = not c.fullscreen  end), | ||||||
| 		c.fullscreen = not c.fullscreen | awful.key({ modkey, "Shift"   }, "c",      function (c) c:kill()                         end), | ||||||
| 	end), | awful.key({ modkey,           }, "f",      awful.client.floating.toggle                     ), | ||||||
| 	awful.key({ modkey, "Shift" }, "c", function(c) | awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end), | ||||||
| 		c:kill() | awful.key({ modkey,           }, "o",      awful.client.movetoscreen                        ), | ||||||
| 	end), |  | ||||||
| 	awful.key({ modkey }, "f", awful.client.floating.toggle), |  | ||||||
| 	awful.key({ modkey, "Control" }, "Return", function(c) |  | ||||||
| 		c:swap(awful.client.getmaster()) |  | ||||||
| 	end), |  | ||||||
| 	awful.key({ modkey }, "o", awful.client.movetoscreen), |  | ||||||
| awful.key({ modkey, "Shift"   }, "h", screen_move_client_wrapdir("left")), | awful.key({ modkey, "Shift"   }, "h", screen_move_client_wrapdir("left")), | ||||||
| awful.key({ modkey, "Shift"   }, "l", screen_move_client_wrapdir("right")), | awful.key({ modkey, "Shift"   }, "l", screen_move_client_wrapdir("right")), | ||||||
| 	awful.key({ modkey, "Control" }, "o", function(c) | awful.key({ modkey, "Control" }, "o",      function (c) c.ontop = not c.ontop end), | ||||||
| 		c.ontop = not c.ontop | awful.key({ modkey, "Shift"   }, "a",      function (c) c.sticky = not c.sticky end), | ||||||
| 	end), | awful.key({ modkey,           }, "Up",     function(c) client_opacity_set(c, 1, 1, 0.1) end), | ||||||
| 	awful.key({ modkey, "Shift" }, "a", function(c) | awful.key({ modkey,           }, "Down",   function(c) client_opacity_set(c, 1, 0, -0.1) end), | ||||||
| 		c.sticky = not c.sticky |  | ||||||
| 	end), |  | ||||||
| 	awful.key({ modkey }, "Up", function(c) |  | ||||||
| 		client_opacity_set(c, 1, 1, 0.1) |  | ||||||
| 	end), |  | ||||||
| 	awful.key({ modkey }, "Down", function(c) |  | ||||||
| 		client_opacity_set(c, 1, 0, -0.1) |  | ||||||
| 	end), |  | ||||||
| awful.key({ }, "XF86Calculater",      awful.client.movetoscreen                        ), | awful.key({ }, "XF86Calculater",      awful.client.movetoscreen                        ), | ||||||
| awful.key({ modkey }, "i", function(c) | awful.key({ modkey }, "i", function(c) | ||||||
| 		require("naughty").notify({ | 	require("naughty").notify({ text = | ||||||
| 			text = string.format( | 	    string.format( | ||||||
| 	    "name: '%s'\nclass: '%s'\ninstance: '%s'\ntype: '%s'\npid: %d", | 	    "name: '%s'\nclass: '%s'\ninstance: '%s'\ntype: '%s'\npid: %d", | ||||||
| 				c["name"], | 	    c["name"], c["class"], c["instance"], c["type"], c["pid"]) | ||||||
| 				c["class"], |  | ||||||
| 				c["instance"], |  | ||||||
| 				c["type"], |  | ||||||
| 				c["pid"] |  | ||||||
| 			), |  | ||||||
| 	}) | 	}) | ||||||
|     end) |     end) | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| root.buttons(awful.util.table.join(awful.button({}, 4, awful.tag.viewnext), awful.button({}, 5, awful.tag.viewprev))) | root.buttons(awful.util.table.join( | ||||||
|  | 	awful.button({ }, 4, awful.tag.viewnext), | ||||||
|  | 	awful.button({ }, 5, awful.tag.viewprev) | ||||||
|  | )) | ||||||
| 
 | 
 | ||||||
| local clientbuttons = awful.util.table.join( | local clientbuttons = awful.util.table.join( | ||||||
|     awful.button({ }, 1, function (c) |     awful.button({ }, 1, function (c) | ||||||
|  | @ -219,8 +160,7 @@ local clientbuttons = awful.util.table.join( | ||||||
|         end |         end | ||||||
|     end), |     end), | ||||||
|     awful.button({ modkey }, 1, awful.mouse.client.move), |     awful.button({ modkey }, 1, awful.mouse.client.move), | ||||||
| 	awful.button({ modkey }, 3, awful.mouse.client.resize) |     awful.button({ modkey }, 3, awful.mouse.client.resize)) | ||||||
| ) |  | ||||||
| 
 | 
 | ||||||
| binder.client = {} | binder.client = {} | ||||||
| 
 | 
 | ||||||
|  | @ -233,31 +173,27 @@ function binder.client.keys() | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| function binder.client.add_buttons(buttons) | function binder.client.add_buttons(buttons) | ||||||
| 	clientbuttons = awful.util.table.join(clientbuttons, buttons) | 	clientbuttons = awful.util.table.join(clientbuttons, buttons); | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| function binder.client.add_bindings(keys) | function binder.client.add_bindings(keys) | ||||||
| 	clientkeys = awful.util.table.join(clientkeys, keys) | 	clientkeys = awful.util.table.join(clientkeys, keys); | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| local default_bindings = awful.util.table.join( | local default_bindings = awful.util.table.join( | ||||||
| 	awful.key({ modkey, "Control" }, "r", awesome.restart), | 	awful.key({ modkey, "Control" }, "r", awesome.restart), | ||||||
| 	awful.key({ modkey, "Shift"   }, "q", awesome.quit), | 	awful.key({ modkey, "Shift"   }, "q", awesome.quit), | ||||||
| 	awful.key({ modkey }, "Return", spawnf(conf.cmd.terminal)), | 	awful.key({ modkey,           }, "Return", spawnf(conf.cmd.terminal)), | ||||||
| 	awful.key({ modkey, "Shift"   }, "Return", spawnf("kitty-session")), | 	awful.key({ modkey, "Shift"   }, "Return", spawnf("kitty-session")), | ||||||
| 
 | 
 | ||||||
| 	--{{{ Layout manipulation and client position | 	--{{{ Layout manipulation and client position | ||||||
| 	awful.key({ modkey }, "j", function () | 	awful.key({ modkey }, "j", function () | ||||||
| 		awful.client.focus.byidx( 1) | 		awful.client.focus.byidx( 1) | ||||||
| 		if client.focus then | 		if client.focus then client.focus:raise() end | ||||||
| 			client.focus:raise() |  | ||||||
| 		end |  | ||||||
| 	end), | 	end), | ||||||
| 	awful.key({ modkey }, "k", function () | 	awful.key({ modkey }, "k", function () | ||||||
| 		awful.client.focus.byidx(-1) | 		awful.client.focus.byidx(-1) | ||||||
| 		if client.focus then | 		if client.focus then client.focus:raise() end | ||||||
| 			client.focus:raise() |  | ||||||
| 		end |  | ||||||
| 	end), | 	end), | ||||||
| 
 | 
 | ||||||
| 	-- Layout manipulation | 	-- Layout manipulation | ||||||
|  | @ -267,7 +203,7 @@ local default_bindings = awful.util.table.join( | ||||||
| 			client.focus:raise() | 			client.focus:raise() | ||||||
| 		end | 		end | ||||||
| 	end), | 	end), | ||||||
| 	awful.key({ "Mod1" }, "Tab", function() | 	awful.key({ "Mod1",           }, "Tab", function () | ||||||
| 		awful.client.focus.history.previous() | 		awful.client.focus.history.previous() | ||||||
| 		if client.focus then | 		if client.focus then | ||||||
| 			client.focus:raise() | 			client.focus:raise() | ||||||
|  | @ -279,28 +215,20 @@ local default_bindings = awful.util.table.join( | ||||||
| 	awful.key({ modkey, "Shift"   }, "k", function () | 	awful.key({ modkey, "Shift"   }, "k", function () | ||||||
| 		awful.client.swap.byidx( -1) | 		awful.client.swap.byidx( -1) | ||||||
| 	end), | 	end), | ||||||
| 	awful.key({ modkey }, "h", function() | 	awful.key({ modkey,           }, "h", function() awful.screen.focus_relative(1) end), | ||||||
| 		awful.screen.focus_relative(1) | 	awful.key({ modkey,           }, "l", function() awful.screen.focus_relative(-1) end), | ||||||
| 	end), |  | ||||||
| 	awful.key({ modkey }, "l", function() |  | ||||||
| 		awful.screen.focus_relative(-1) |  | ||||||
| 	end), |  | ||||||
| 	--}}} | 	--}}} | ||||||
| 
 | 
 | ||||||
| 	--{{{ Modal mappings | 	--{{{ Modal mappings | ||||||
| 
 | 
 | ||||||
| 	awful.key({ modkey }, "space", mb.grabf({ keymap = layoutmap, name = "Layouts" })), | 	awful.key({ modkey            },  "space",  mb.grabf{keymap=layoutmap, name="Layouts"}), | ||||||
| 	awful.key( | 	awful.key({ modkey, "Control" },  "space",  mb.grabf{keymap=layoutsettings, name="Layout settings", stay_in_mode=true}), | ||||||
| 		{ modkey, "Control" }, |  | ||||||
| 		"space", |  | ||||||
| 		mb.grabf({ keymap = layoutsettings, name = "Layout settings", stay_in_mode = true }) |  | ||||||
| 	), |  | ||||||
| 	--}}} | 	--}}} | ||||||
| 
 | 
 | ||||||
| 	--{{{ Prompt | 	--{{{ Prompt | ||||||
| 
 | 
 | ||||||
| 	awful.key({ modkey }, "r", conf.cmd.drun), | 	awful.key({ modkey }, "r", conf.cmd.run), | ||||||
| 	awful.key({ modkey, "Shift" }, "r", conf.cmd.run), | 	awful.key({ modkey, "Shift" }, "r", conf.cmd.drun), | ||||||
| 
 | 
 | ||||||
| 	--}}} | 	--}}} | ||||||
| 
 | 
 | ||||||
|  | @ -311,5 +239,7 @@ function binder.add_default_bindings() | ||||||
| 	return binder.add_bindings(default_bindings) | 	return binder.add_bindings(default_bindings) | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| return binder | return binder | ||||||
| -- vim: set fenc=utf-8 tw=80 foldmethod=marker : | -- vim: set fenc=utf-8 tw=80 foldmethod=marker : | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue