Code::Blocks Forums

User forums => Help => Topic started by: teto on August 19, 2014, 04:12:41 pm

Title: Ring a bell on compilation completion
Post by: teto on August 19, 2014, 04:12:41 pm
Hi,

I would like codeblocks to throw an urgency hint when it completes compilation (for instance Xterm sets the urgency hint on a bell echo -e '\a' ). This way my window manager would make the virtual space blink on codeblocks completion. (Same for windows, codeblocks icon would blink). Maybe it already exists as an option but I couldn't find any. I tried to generate a bell as a postbuild script but codeblocks does not relay the bell. any way I am not too sure how that stuff works but that would sure be neat !

Matt
Title: Re: Ring a bell on compilation completion
Post by: oBFusCATed on August 19, 2014, 08:59:26 pm
I think you would need to write simple c++ plugin for this task.
Title: Re:
Post by: MortenMacFly on August 19, 2014, 10:03:48 pm
Right.it would possibly be the smallest plugin ever but it would certainly be doable.
Title: Re: Ring a bell on compilation completion
Post by: teto on August 20, 2014, 12:16:17 pm
Thanks for your answers.
I've followed the tutorial and compiled my first plugin. Could you give me a pointer on how to hook to the compiler completion event please ?

Regards

EDIT: OK I found it. It compiles now I need to install plugin & test
Title: Re: Ring a bell on compilation completion
Post by: teto on August 20, 2014, 12:44:09 pm
Hi,
I setup a repo here. I use 13.12 SDK with a nightly build so I had some errors when installing the plugin but nothing serious. Here is the code
https://github.com/teto/cbalert
I use http://docs.wxwidgets.org/trunk/classwx_top_level_window.html#a749d23ea08f6273fb93fe2c003b650b3 to notify the user. It seems to me that the event COMPILER_FINISHED isn't tirggered since my log message doesn't appear in codeblocks panel ?
Title: Re: Ring a bell on compilation completion
Post by: Jenna on August 20, 2014, 02:28:42 pm
I just did a short test.
I did not use your sources, but hacked the relevant part into the IncrementalSearch-plugin.
The event gets triggered, but wxBell does nothing (on Fedora 20 64Bit).
RequestUserAttention shows a notification (on gnome-shell), but only if C::B is in the background (as documented).

If I find time, I will clone your repo and do another test.
Title: Re: Ring a bell on compilation completion
Post by: teto on August 20, 2014, 02:56:40 pm
wxBell didn't work here either. I am using i3 (www.i3wm.org) as a WM and urgency hints work with many applications already so it must be my code which is wrong.
Did you test also when the build fails ? I haven't tested when it succeeded , only when it failed.

Thanks for the help.
Title: Re: Ring a bell on compilation completion
Post by: Jenna on August 20, 2014, 03:56:11 pm
Your plugin works here also after renaming the lib (removing the lib-prefix and unchecking the autogenerate prefix box).

Without that I was not able to install the plugin.

You might need to start C::B with the -v option to get more useful messages.
Title: Re: Ring a bell on compilation completion
Post by: teto on August 20, 2014, 04:27:26 pm
Glad it works !
May I inquire which version do you use ? I am using rev9501 and even when the build succeeds and window unfocsed, my workspace doesn't flash as it should. Might be a problem with i3 but would like to test with the same version as you before.

The -v flag showed nothing of interest.
Title: Re: Ring a bell on compilation completion
Post by: Jenna on August 20, 2014, 04:35:41 pm
Actual nightly from my repo (9854).
Title: Re: Ring a bell on compilation completion
Post by: teto on August 20, 2014, 05:20:27 pm
Quote
unchecking the autogenerate prefix box
OMG didn't see that box. was wondering why the lib prefix would reappear again and again after saving the project. So I kept loading an old version of my plugin !
I unchecked the box and it works perfectly :s !

this is one tricky box. I wonder if it is that useful, maybe warn the user when he modifies the output filename.

well thanks for your help, the "new plugin project" wizard is really cool : it makes it easy to create a plugin for CB (at least so simple as mine). good job to the team.
Title: Re: Ring a bell on compilation completion
Post by: teto on December 05, 2014, 02:21:48 pm
Would it be possible to add this plugin here :
http://wiki.codeblocks.org/index.php?title=Code::Blocks_Plugins
even though it's simple I believe it could interest others (I've seen at least one reference to it on the tracker).