Author Topic: Ring a bell on compilation completion  (Read 7618 times)

Offline teto

  • Almost regular
  • **
  • Posts: 127
Ring a bell on compilation completion
« 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

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Ring a bell on compilation completion
« Reply #1 on: August 19, 2014, 08:59:26 pm »
I think you would need to write simple c++ plugin for this task.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re:
« Reply #2 on: August 19, 2014, 10:03:48 pm »
Right.it would possibly be the smallest plugin ever but it would certainly be doable.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline teto

  • Almost regular
  • **
  • Posts: 127
Re: Ring a bell on compilation completion
« Reply #3 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
« Last Edit: August 20, 2014, 12:32:17 pm by teto »

Offline teto

  • Almost regular
  • **
  • Posts: 127
Re: Ring a bell on compilation completion
« Reply #4 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 ?
« Last Edit: August 20, 2014, 02:06:59 pm by teto »

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Ring a bell on compilation completion
« Reply #5 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.

Offline teto

  • Almost regular
  • **
  • Posts: 127
Re: Ring a bell on compilation completion
« Reply #6 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.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Ring a bell on compilation completion
« Reply #7 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.

Offline teto

  • Almost regular
  • **
  • Posts: 127
Re: Ring a bell on compilation completion
« Reply #8 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.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Ring a bell on compilation completion
« Reply #9 on: August 20, 2014, 04:35:41 pm »
Actual nightly from my repo (9854).

Offline teto

  • Almost regular
  • **
  • Posts: 127
Re: Ring a bell on compilation completion
« Reply #10 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.
« Last Edit: August 20, 2014, 05:22:21 pm by teto »

Offline teto

  • Almost regular
  • **
  • Posts: 127
Re: Ring a bell on compilation completion
« Reply #11 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).