KDE: Hello Kassie!
Good bye K.S.A. Welcome Kassie, the Kate Advanced Session Selector... plus "ie" to make the name sound more feminine, to match with Kate. And Kassie is also a feminine first name, so...
It was hard and fun. I crashed and froze Kicker more than once, and I enjoyed its auto-restart feature in between the hundreds of times I restarted it manually through DCOP. The crashes and freezes were due to the fact I was trying try to do something way out of my league: To hijack a drop action to Cuba... No! From where it began to a dialog that I inserted in the middle of the drop action.
It failed but I learned a lot of interesting things about KDE/Qt while browsing their docs. Definitively not a waste of time. It could have work if were already in 2008, not because of KDE 4 that will be released for a long time at this moment but because I will probably be able to do what I wanted. I say this because of this thought that haunts my mind when I see my code: I could never have done this last year. Last year, at the end of February, I was working on Serenity 0.2 to release it in March. Amazing... :-)
Well, "Kassie" was I saying. Instead of the programmatic torture I was trying to inflict to KDE, I made something very simple: I just let the drop action go to its completion (the release of the button) then I show my little menu. And what's on the menu? See for yourself!
Another auto-reverse menu! ;-) And, yes, the icons are so big intentionally. I tried with regular little icons but the big ones are better, they bring you comfort or, in other words, usability. Any way, the menu shouldn't grow very much and big icons won't be a problem, even if your have 45 available sessions --as somebody told to me-- because what it shows to you are only the running instances of Kate. (Of course, if Kate isn't running at all, no menu will appear.)
So, when you drop files on Kassie's icon, she... it proposes you to choose where you want to drop them, either into one of the running instances or in a new one. And the last entry "Cancel" is here because you never know where to click to close a menu. A clearly defined area is very convenient. And thanks to the auto-reverse menu, it's always "at the other end" of the menu, never in your way to click by error.
To sum up, here are all the ways you can open files with Kassie's popup menu:
- You open an available session and you drop files on the window.
- You create a new session with a name and you drop files onto it.
- You simply launch Kate and drop files onto its window.
And when you drop files on Kassie's icon:
- The files can be added into a running session/instance.
- The files can be used to create a new instance or session (if you don't forget to save it to give it a name).
The hidden features: Kassie always keeps accurate lists of the available sessions (You can manage them by hand without worring.) and of the running instances so that you never need to tell to Kassie to update anything. It's automagic. ;-) Kassie will warn you if you try to create a session that already exists and it proposes you to open it instead. If you try to re-open a session, you will get a little warning too. Right now that's all Kassie does but --if there are no problem-- I will add to it the possibility to propose you to bring the already opened session to the current desktop.
All this for the version 0.2! There are other ideas that crossed my mind but I dropped all of them because I didn't want to make your panel fall below your screen because of a too heavy Kassie. ;-)
And now, a little warning...
To anyone who uses my script to open a URL in a new tab of Konqueror, I noticed a little flaw. It may look like sometimes that nothing happens anymore, whatever the number of times you click. In that case, STOP clicking! Then restore that minimized Konqueror that now shows a dozen of copies of the page you wanted to see... or worst --if it gets on your nevers. :-)
As I said, it was a little warning. Nothing serious. :-D
Then comes the improved script:
#! /bin/bash
ALLKONQ=`dcop "konqueror*"`
for THIS in $ALLKONQ
do
HIDDEN=`dcop $THIS konqueror-mainwindow#1 hidden`
MINIMIZED=`dcop $THIS konqueror-mainwindow#1 minimized`
PROFILE=`dcop $THIS konqueror-mainwindow#1 currentProfile`
if [ "$HIDDEN"=="false" -a "$MINIMIZED"=="false" \
-a "$PROFILE"=="webbrowsing" ]
then
KONQ=$THIS
fi
done
if [ -z $KONQ ]
then
konqueror $1 &
else
dcop $KONQ konqueror-mainwindow#1 newTab $1
fi
I guess that shaded windows should also lead to a problem of... well... visibility but there's nothing to do this time. Konqueror doesn't provide any DCOP access to this information. Wait for KDE 4 and D-Bus. Maybe.
Hmm... I wonder what D-Bus management looks like in KDE 4. (Cough) I have to go I think I let the water running in my tub... ;-)
Labels: development, Kate, KDE