My wife’s book!

I normally don’t plug other people’s stuff on my blog, but I am making an obvious exception in this case. My wife has just published her debut novel, The Lady of Souls!

Book cover

It is a grand adventure full of mayhem and mischief. There is everything you could want in a book: Magic! Trains! Ghosts! Strong women! It is set on a planet similar to a late 19th century Earth, but different in fun and imaginative ways. If you need more convincing you can read the first chapter on her website. What are you still doing here? Go, go! Buy her book, and enjoy!

For Praxis Fellows, greatness has always been a given. But life doesn’t always go according to plan, and now she finds herself half a world away from where she started. Banned from using magic, employed by the son of a railroad baron to realize a dead man’s dreams, Praxis’ life has become a sort of living death.

Kaedrich Mannly has never done anything of consequence. As the newest member of the household staff of Brindlewood Hall, his role in simple: stay out of sight, and do as he’s told. It’s a far cry from the dreams of his childhood, when he and his twin would rule their imaginary kingdom in the forest, but even if he was brave enough to take on the hero’s role these days, there’s too much at stake for him to risk stepping out of his narrow comfort zone.

When a mysterious beast attacks the local village, both Praxis and Kaedrich end up with more than they bargained for. Soon they find themselves bound together on a quest to discover the source of a growing breach between the land of the living and the dead, on a journey that will take them far beyond the walls of their quiet lives—if they have the nerve to see it through. Because as they both soon realize, saving the world isn’t quite the fate that they’d dreamed it would be.

You can get it from Amazon, iBooks, Kobo, or NOOK.

NovProg is alive!

It feels strange to bring an old project of mine back to life, but here we go: I have updated NovProg and made a new release, version 3.0.0! It has languished quite by accident, as I have been distracted by bigger and shinier projects. No more!

New in this release is a tab to show you the progress on each day. I find this to be far more useful than just seeing the total graph. The graphs now include bars to show you how much you have to do each day to meet your total goal, and the days which you meet it have green bars.

Daily graph

Daily graph

This is the first release for Windows that uses a static build of Qt. This makes the total install much smaller (a reduction from 48MiB to 17MiB is pretty significant), but it makes the executable itself much larger. If it works well I will be switching all of my future releases of the rest of my projects to work the same way.

Another new feature is the ability to specify a starting word count for your novel. So, if you’re already into a project, say a certain novel writing marathon in the month of November, you can jump in the middle. Enjoy!

New FocusWriter release!

I have made a new feature release of FocusWriter, version 1.5.0. This has been far too long in the making, partly because I was very distracted with Whisker Menu. This release mostly focuses on code cleanup and other internal changes. There are a few user visible improvements, though.

I have added a daily progress dialog which allows you to see how many days in a row you have managed to reach your daily goal, labeled as a “streak”. It also displays the length of the longest streak of days in which you have reached your daily goal. It shows you how far through your daily goal you are each day by changing the color of the background of the date, and when you reach your daily goal it shows a star behind the date:

Daily progress dialog

Daily progress dialog

I have at long last completely and utterly killed the awful black-on-gray default theme. And there was much rejoicing! Ahem. Anyway, there are now four default themes included, and the default when creating a theme more closely resembles that of other word processors. I have added two useful visual effects to the themes, namely the ability to blur the background behind the text, and the ability to have a drop shadow. Also, I replaced the tabs in the theme dialog to be a scrollable list to make it easier to find theme options:

Themes dialog showing default themes

Themes dialog showing default themes


Theme edit dialog with a new theme

Theme edit dialog with a new theme

This release also marks the return of included dictionaries on Windows. This does bloat the installed size quite a bit, and I am still figuring out what I want to do about that for future releases. I added them back as too many users were confused by having to download dictionaries separately from third-party sites.

There is now a basic NSIS installer for Windows; however a ZIP download for portable mode is still provided.

Enjoy! Please report any issues you have.

FocusWriter 1.4.5 released

I have made a new bugfix release of FocusWriter, version 1.4.5. This release fixes quite a few smaller bugs. It will most likely be the last bugfix release I make before the next feature release, which if I hope to have finished soon. Enjoy!

On Break

I am taking a break from my open source work. Please continue to enjoy the projects until I return!

Whisker Menu 1.3.0 released!

I have just released a new version of Whisker Menu, version 1.3.0. The biggest feature in this release is probably the addition of search actions, which are inspired by the Xfce application finder’s custom actions. These are useful if you want to perform specific actions by typing something into the search field, and included by default are four example actions that you can change or remove. For instance, one of the default actions allows you to open your default web browser and search Wikipedia by starting your search with “!w” (eg, “!wopen source” will show you Wikipedia’s definition of “Open Source”).

This release also has a lot of smaller features, such as the ability to run arbitrary programs from your path by typing the entire program name into the search field. You can also now drag menu items to your panel or desktop if you do not want to use the context menu. Additionally there is more flexibility in configuring the command buttons, as well as the option to hide them if you do not need them. You can also hide the category or menu item icons by setting their size to “None” if you prefer a menu without icons.

I hope you enjoy this release! And, of course, please let me know if you have any issues.

Theming Whisker Menu

I have seen several people state that Whisker Menu does not use their GTK theme. This is understandable but completely incorrect. Whisker Menu is a regular window and therefore it matches the GTK theme of regular windows. It can not be a GtkMenu because of the widgets it uses (believe me, I tried), so it does not match the theming of menus.

I did investigate if it would be possible for Whisker Menu to “pick up” the theming of GTK menus and mimic them. Short answer: no. Longer answer: haha, my sanity is worth more than the creaky mess of hacks it would take, and besides I’m fairly certain it still wouldn’t work. So instead I did something much simpler: I named the menu widget itself “whiskermenu-window” so users or theme makers can play with its appearance as much as they want.

I will not be adding any theme configuration settings to Whisker Menu. First, I really have no interest in doing so. Second, modifying the theme from a .gtkrc file gives you much more power than I could ever expose from a GUI. Third, anything I add would probably interfere with .gtkrc theming.

So, how do you theme Whisker Menu? It’s pretty easy, actually. Open up the hidden file named .gtkrc-2.0 in your home directory with any text editor you want. If the file doesn’t exist, create it. Now, if you want to change the background color of the menu window add something like this:

style "darkback"
{
	bg[NORMAL] = "#404040"
	bg[ACTIVE] = "#606060"
	bg[PRELIGHT] = "#808080"
}
widget "whiskermenu-window*" style "darkback"


Whisker Menu darkback

If you want to change the window text color as well, add something like this:

style "darkback"
{
	bg[NORMAL] = "#404040"
	bg[ACTIVE] = "#606060"
	bg[PRELIGHT] = "#808080"
	fg[NORMAL] = "#ccc"
	fg[ACTIVE] = "#fff"
	fg[PRELIGHT] = "#fff"
}
widget "whiskermenu-window*" style "darkback"


Whisker Menu darkback2

If you want to change the background color of the menu items, add something like this:

style "darktree"
{
	base[NORMAL] = "#404040"
	base[ACTIVE] = "#606060"
}
widget "whiskermenu-window*TreeView*" style "darktree"


Whisker Menu darktree

If you want to change the text color of the menu items as well, add something like this:

style "darktree"
{
	base[NORMAL] = "#404040"
	base[ACTIVE] = "#606060"
	text[NORMAL] = "#ccc"
	text[ACTIVE] = "#fff"
}
widget "whiskermenu-window*TreeView*" style "darktree"


Whisker Menu darktree2

These examples just scratch the surface of what you can do with theming from a .gktrc file. I don’t have much experience with it myself, nor do I intend to really look into it further. There are plenty of resources on how to make GTK themes and what they say should be applicable to Whisker Menu as well.

Revisiting signal handlers

Ever since I changed how I handle connecting GTK+ signals to C++ members I have never been completely happy with that code. I prefer to not repeat myself, and I like the power and simplicity that templates can bring (and the safety they have over macros). I though that any GCC before 4.7 would not allow me to write the signal handlers the way I want, but it turns out I was wrong!

Based on the load time error of Whisker Menu 1.0.0 I had surmised that there was a bug in GCC where you can’t take the address of a template function becuase it did not handle the name mangling properly. However, upon further research I discovered that the bug really is that if you take the address of a template function and cast it to something else before storing it the template is not instantiated. Easy enough to fix: just create a function pointer of the correct type and then cast that:

template <typename T, typename R, typename A1, typename A2>
gulong g_signal_connect_slot(gpointer instance,
        const gchar* detailed_signal,
        R (T::*member)(A1,A2),
        T* obj,
        bool after = false)
{
    class Slot
    {
        T* m_instance;
        R (T::*m_member)(A1,A2);

    public:
        Slot(T* instance, R (T::*member)(A1,A2)) :
            m_instance(instance),
            m_member(member)
        {
        }

        static R invoke(A1 a1, A2 a2, Slot* slot)
        {
            return (slot->m_instance->*slot->m_member)(a1, a2);
        }

        static void destroy(Slot* slot)
        {
            delete slot;
        }
    };
    R (*invoke_slot)(A1,A2,Slot*) = &Slot::invoke;
    void (*destroy_slot)(Slot*) = &Slot::destroy;

    return g_signal_connect_data(instance,
            detailed_signal,
            reinterpret_cast<GCallback>(invoke_slot),
            new Slot(obj, member),
            reinterpret_cast<GClosureNotify>(destroy_slot),
            after ? G_CONNECT_AFTER : GConnectFlags(0));
}

class Example
{
public:
    Example();
    gboolean button_press_event(GtkWidget* widget, GdkEventButton* event);
};

Example::Example()
{
    g_signal_connect_slot(widget, "button-press-event", &Example::button_press_event, this);
}

The code is not quite as simple as the original version, though, because variadic templates are only available in C++11. Instead I have to make make overloads of the function for each amount of parameters I want to support. I did clean it up in other ways by using local classes, which I think makes the new template slot handlers more clear. It even compiles to less space than using class functions for slots.

Whisker Menu will be staying with Xfce

I’m sorry to disappoint the users who have been requesting this, but after giving it some serious consideration I have decided that I will not be porting Whisker Menu to any other desktop environment. I set out to make a menu for Xfce, and Whisker Menu relies on Xfce quite a lot throughout the codebase. I would have to redesign Whisker Menu to try and support different environments, and even then I would still have to completely rewrite it for some of them as they are Qt based and very little code could be shared between them. Again, sorry, but Whisker Menu will remain Xfce only.

Adventures in packaging land

It took me much longer than I expected to make the most recent Whisker Menu release, all because the RPM’s would not build. I forgot to include the new manpage in the %files section of the RPM spec file at first, and then every attempt I made to add it did not work. I tried listing the manpage path with %{_mandir}, then just hardcoding the full path, and finally telling it to grab all of the files installed by my package under %{_mandir}.

None of those approaches worked, which left me both baffled and a bit frustrated. And then I noticed I had been forgetting to increase the “Release” number in the spec file. Oops! Such a simple mistake. Once I fixed that they built fine. Long story short, always double check that you increased the “Release” number when you make a change to a RPM spec file!

Follow

Get every new post delivered to your Inbox.

Join 36 other followers