@@ -475,80 +475,133 @@ function match(c, startup)
475
475
-- try matching client to config.apps
476
476
for i , a in ipairs (config .apps ) do
477
477
if a .match then
478
- for k , w in ipairs (a .match ) do
479
- if
480
- (cls and cls :find (w )) or
481
- (inst and inst :find (w )) or
482
- (name and name :find (w )) or
483
- (role and role :find (w )) or
484
- (typ and typ :find (w )) then
485
- if a .screen then target_screen = a .screen end
486
- if a .tag then
487
- if type (a .tag ) == " string" then
488
- target_tag_names = {a .tag }
489
- else
490
- target_tag_names = a .tag
491
- end
492
- end
493
- if a .startup and startup then
494
- a = awful .util .table .join (a , a .startup )
495
- end
496
- if a .geometry ~= nil then
497
- geom = {x = a .geometry [1 ],
498
- y = a .geometry [2 ],
499
- width = a .geometry [3 ],
500
- height = a .geometry [4 ]}
501
- end
502
- if a .float ~= nil then float = a .float end
503
- if a .slave ~= nil then slave = a .slave end
504
- if a .border_width ~= nil then
505
- c .border_width = a .border_width
478
+ local matched = false
479
+ -- match only class
480
+ if not matched and cls and a .match .class then
481
+ for k , w in ipairs (a .match .class ) do
482
+ matched = cls :find (w )
483
+ if matched then
484
+ break
506
485
end
507
- if a .nopopup ~= nil then nopopup = a .nopopup end
508
- if a .intrusive ~= nil then
509
- intrusive = a .intrusive
510
- end
511
- if a .fullscreen ~= nil then
512
- c .fullscreen = a .fullscreen
513
- end
514
- if a .honorsizehints ~= nil then
515
- c .size_hints_honor = a .honorsizehints
516
- end
517
- if a .kill ~= nil then c :kill (); return end
518
- if a .ontop ~= nil then c .ontop = a .ontop end
519
- if a .above ~= nil then c .above = a .above end
520
- if a .below ~= nil then c .below = a .below end
521
- if a .buttons ~= nil then
522
- c :buttons (a .buttons )
523
- end
524
- if a .nofocus ~= nil then nofocus = a .nofocus end
525
- if a .keys ~= nil then
526
- keys = awful .util .table .join (keys , a .keys )
486
+ end
487
+ end
488
+ -- match only instance
489
+ if not matched and inst and a .match .instance then
490
+ for k , w in ipairs (a .match .instance ) do
491
+ matched = inst :find (w )
492
+ if matched then
493
+ break
527
494
end
528
- if a .hidden ~= nil then c .hidden = a .hidden end
529
- if a .minimized ~= nil then
530
- c .minimized = a .minimized
495
+ end
496
+ end
497
+ -- match only name
498
+ if not matched and name and a .match .name then
499
+ for k , w in ipairs (a .match .name ) do
500
+ matched = name :find (w )
501
+ if matched then
502
+ break
531
503
end
532
- if a .dockable ~= nil then
533
- awful .client .dockable .set (c , a .dockable )
504
+ end
505
+ end
506
+ -- match only role
507
+ if not matched and role and a .match .role then
508
+ for k , w in ipairs (a .match .role ) do
509
+ matched = role :find (w )
510
+ if matched then
511
+ break
534
512
end
535
- if a .urgent ~= nil then
536
- c .urgent = a .urgent
513
+ end
514
+ end
515
+ -- match only type
516
+ if not matched and typ and a .match .type then
517
+ for k , w in ipairs (a .match .type ) do
518
+ matched = typ :find (w )
519
+ if matched then
520
+ break
537
521
end
538
- if a .opacity ~= nil then
539
- c .opacity = a .opacity
522
+ end
523
+ end
524
+ -- check everything else against all attributes
525
+ if not matched then
526
+ for k , w in ipairs (a .match ) do
527
+ matched = (cls and cls :find (w )) or
528
+ (inst and inst :find (w )) or
529
+ (name and name :find (w )) or
530
+ (role and role :find (w )) or
531
+ (typ and typ :find (w ))
532
+ if matched then
533
+ break
540
534
end
541
- if a .run ~= nil then run = a .run end
542
- if a .sticky ~= nil then c .sticky = a .sticky end
543
- if a .wfact ~= nil then wfact = a .wfact end
544
- if a .struts then struts = a .struts end
545
- if a .skip_taskbar ~= nil then
546
- c .skip_taskbar = a .skip_taskbar
535
+ end
536
+ end
537
+ -- set attributes
538
+ if matched then
539
+ if a .screen then target_screen = a .screen end
540
+ if a .tag then
541
+ if type (a .tag ) == " string" then
542
+ target_tag_names = {a .tag }
543
+ else
544
+ target_tag_names = a .tag
547
545
end
548
- if a .props then
549
- for kk , vv in pairs (a .props ) do
550
- awful .client .property .set (c , kk , vv )
551
- end
546
+ end
547
+ if a .startup and startup then
548
+ a = awful .util .table .join (a , a .startup )
549
+ end
550
+ if a .geometry ~= nil then
551
+ geom = {x = a .geometry [1 ],
552
+ y = a .geometry [2 ],
553
+ width = a .geometry [3 ],
554
+ height = a .geometry [4 ]}
555
+ end
556
+ if a .float ~= nil then float = a .float end
557
+ if a .slave ~= nil then slave = a .slave end
558
+ if a .border_width ~= nil then
559
+ c .border_width = a .border_width
560
+ end
561
+ if a .nopopup ~= nil then nopopup = a .nopopup end
562
+ if a .intrusive ~= nil then
563
+ intrusive = a .intrusive
564
+ end
565
+ if a .fullscreen ~= nil then
566
+ c .fullscreen = a .fullscreen
567
+ end
568
+ if a .honorsizehints ~= nil then
569
+ c .size_hints_honor = a .honorsizehints
570
+ end
571
+ if a .kill ~= nil then c :kill (); return end
572
+ if a .ontop ~= nil then c .ontop = a .ontop end
573
+ if a .above ~= nil then c .above = a .above end
574
+ if a .below ~= nil then c .below = a .below end
575
+ if a .buttons ~= nil then
576
+ c :buttons (a .buttons )
577
+ end
578
+ if a .nofocus ~= nil then nofocus = a .nofocus end
579
+ if a .keys ~= nil then
580
+ keys = awful .util .table .join (keys , a .keys )
581
+ end
582
+ if a .hidden ~= nil then c .hidden = a .hidden end
583
+ if a .minimized ~= nil then
584
+ c .minimized = a .minimized
585
+ end
586
+ if a .dockable ~= nil then
587
+ awful .client .dockable .set (c , a .dockable )
588
+ end
589
+ if a .urgent ~= nil then
590
+ c .urgent = a .urgent
591
+ end
592
+ if a .opacity ~= nil then
593
+ c .opacity = a .opacity
594
+ end
595
+ if a .run ~= nil then run = a .run end
596
+ if a .sticky ~= nil then c .sticky = a .sticky end
597
+ if a .wfact ~= nil then wfact = a .wfact end
598
+ if a .struts then struts = a .struts end
599
+ if a .skip_taskbar ~= nil then
600
+ c .skip_taskbar = a .skip_taskbar
601
+ end
602
+ if a .props then
603
+ for kk , vv in pairs (a .props ) do
604
+ awful .client .property .set (c , kk , vv )
552
605
end
553
606
end
554
607
end
0 commit comments