FelixKratz / JankyBorders

A lightweight window border system for macOS
GNU General Public License v3.0
1k stars 18 forks source link

Feature Request: Don't draw border for specific apps #26

Closed ghost closed 8 months ago

ghost commented 9 months ago

Can we exclude certain apps while drawing the border? Yabai had that option and it is crucial for some apps to function in my setup.

For e.g. slack has a had time with huddle when border is on

FelixKratz commented 9 months ago

I think some kind of blacklist feature would be a good idea and should be easy to implement.

I.e. here we already have the application pid: https://github.com/FelixKratz/JankyBorders/blob/ab4d6fce4b8fda3ae32c997dcab9e50118b5d864/src/windows.c#L14-L16 and could use it to get the process name and check a blacklist. If the blacklist hits, we simply return early (just as we do if the window belonge to our pid).

Pull requests are welcome.

PhrantiK commented 9 months ago

If you just want to exclude a single app, this patch has been working for me to exclude the bloated mess Adobe Illustrator. Just need to change to Slack and it should work:

diff --git a/src/windows.c b/src/windows.c
index 7eb52ea..7e2e411 100644
--- a/src/windows.c
+++ b/src/windows.c
@@ -2,6 +2,7 @@
 #include "hashtable.h"
 #include <string.h>
 #include "border.h"
+#include <libproc.h>

 extern pid_t g_pid;

@@ -13,6 +14,14 @@ bool windows_window_create(struct table* windows, uint32_t wid, uint64_t sid) {

   pid_t pid = 0;
   SLSConnectionGetPID(wid_cid, &pid);
+
+   char process_name[PROC_PIDPATHINFO_MAXSIZE];
+    if (proc_name(pid, process_name, sizeof(process_name))) {
+        if (strcmp(process_name, "Adobe Illustrator") == 0) {
+            return false;
+        }
+    }
+
   if (pid == g_pid) return false;

   CFArrayRef target_ref = cfarray_of_cfnumbers(&wid,
FelixKratz commented 9 months ago

The blacklist functionality has been added on master, it works to following way:

borders blacklist="System Settings,Safari,kitty"

where a comma separated list of application names can be supplied. These are excluded from being bordered.

ghost commented 8 months ago

Thanks a lot @FelixKratz for this; it was a swift implementation :D

diocletiann commented 8 months ago

@FelixKratz I just installed with --HEAD and borders blacklist="Sublime Text" doesn't work. Am I missing something? Thanks for the awesome tool!

wd commented 8 months ago

~It would be great if we can have a whitelist as well 😁~

Edit: there is a whitelist arg

liijit commented 3 weeks ago

@diocletiann Sublime's executable is named sublime_text instead. You can check this using the top command in the terminal