franciscolourenco / done

A fish-shell package to automatically receive notifications when long processes finish.
MIT License
770 stars 70 forks source link

Support for tab detection #40

Open BarbzYHOOL opened 6 years ago

BarbzYHOOL commented 6 years ago

Actually, it displays the notification when the window is not focused, which is great, but if you open a new tab and switch to it, then the notification won't display because it considers you're in the same windows (which is true lol)

Need to add a tab option

I'm on linux so it's probably this line to edit, but no idea how:

    xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2

Maybe getting the tab title can work too?

PS: why is the main file in /conf.d/ ??

franciscolourenco commented 6 years ago

There might be limitations in terms of tab detection.

conf.d is where you can add extra configuration files which get executed on setup. https://github.com/fish-shell/fish-shell/blob/master/etc/config.fish#L2

BarbzYHOOL commented 6 years ago

Put system-wide fish configuration entries here

But it's a bunch of function, not a simple configuration file. Seems weird to me

For tab detection, I looked on google and found nobody who tried this yet... not very encouraging :P

franciscolourenco commented 6 years ago

@BarbzYHOOL This thread might give you some insight into conf.d https://github.com/fisherman/done/issues/12

BarbzYHOOL commented 6 years ago

(sorry for offtopic)

    In alternative why not define all the functions in conf.d/done.fish?

For the same reason you should not use alias in your config. If you put those functions in the snippet, then they will be eagerly loaded, completely missing the point of fish excellent lazy loading mechanism.

He said not to put all in conf.d (didn't read entire thread yet though), no?

His own plugin doesn't do it like this https://github.com/fisherman/fishtape

franciscolourenco commented 6 years ago

These 2 functions need to be eagerly loaded:

function __done_started --on-event fish_preexec
function __done_ended --on-event fish_prompt 

It was not worthwhile to spread the other 3 functions in different files since the performance impact is negligible.

ammgws commented 4 years ago

@BarbzYHOOL What is a "tab" in this case? Which window manager/desktop environment were you using?

quantonganh commented 4 years ago

What is a "tab" in this case? Which window manager/desktop environment were you using?

@ammgws

eugene-babichenko commented 3 years ago

I think it is possible for at least for iTerm2, here's how zsh-notify does that https://github.com/marzocchi/zsh-notify/blob/master/applescript/resources/is-iterm2-active.applescript