Improvement requests :  K-Meleon Forum
Use this forum to talk about a feature you're missing.  
Xtra Gestures for/from Tabs
Posted by: SoerenB
Date: February 15, 2010 05:04PM

Hi,

I do like K-Meleons approach to mouse gestures - just having 10 of them makes remembering easy, and I love the tiny quick movements needed,

What I do not like is using keyboard accelerators to modify the gestures - see this thread.

But just some more gestures might be a good idea?
Well, wouldn't it be possible to have a set of gestures not modified by an accelerator, but rather by the context,

namely: by starting the gesture on a tab or the tab bar?

Human memory would be helped, in this case, if by default that second set of gestures was set to trigger tab and navigation actions, mainly. This way, more content area gestures would be available for, e.g., window manipulation - see this Fullscreen thread

Or would it even be possible to implement such a feature via an extension?

Cheers
SoerenB



Edited 1 time(s). Last edit at 02/15/2010 05:05PM by SoerenB.

Options: ReplyQuote
Re: Xtra Gestures for/from Tabs
Posted by: siria
Date: February 15, 2010 06:32PM

Crazy, now that you say it... *thinkinghard*... guess there could really be at least partly some workarounds via macros!!
As it happens, just a few days ago I had thought the same, that e.g. it would be handy to have the action "open link in new window" when pulling upwards from a link, but the action "go to top of page" when pulling up from elsewhere in a page, or some such... And I had thought, oh well, don't think that will be available anytime soon, and at first look thought that seems not really possible just with macros. Certainly not with my restricted knowledge. But funny effect, as soon as someone else asks, the answers start flowing grinning smiley Not always of course, but there's definitely something to it smiling smiley

Now for the workaround that I think of, it includes simply checking if context variables exist:
Is there a $LinkURL or not? Is there a $ImageURL or not? Is there a $SelectedText or not? There are more variables of that sort, listed in the wiki:
http://kmeleon.sourceforge.net/wiki/MacroLanguage#global

Sorry, don't know how to check if the context is a page (in the middle) or a tab in the tabsbar, but it's still a quite good start...
And configuration would be cumbersome, one has to modify the macros instead of doing it in the settings window... For people like you not really a prob, but certainly for most other users... And the macro command names are a bit a prob too, at the moment I tend to just name them like the action (pull up, goright or such)...

I sure would welcome your suggestion here as a "real" function too, included in the plugin and the preferences configuration! Workarounds with macros may work, but just partly, and it's just far more complicated to configure.

But hey, guess that would be the perfect second macro for you to create, what do you think? cool smiley Get yourself an editor with macro syntax highlighting, then check with the error console afterwards... smiling smiley

Am just going to create that "pullup" example macro now and post it when ready.... am a bit slow ya know ;-) And perhaps this is just all nonsense and doesn't work at all as I imagine, will have to try and see...



Edited 1 time(s). Last edit at 02/15/2010 06:39PM by siria.

Options: ReplyQuote
Re: Xtra Gestures for/from Tabs
Posted by: siria
Date: February 15, 2010 08:50PM

Sorry, really can't figure out that "tabsbar context". Perhaps anyone else knows how to figure out if a gesture is started in the tabsbar or inside a page??
Or perhaps everything I do here is just nonsense because it already exists somewhere? No idea, but there sure are alternatives, if anyone knows please say it too.

Well, as for the other contexts, hey, that workaround actually seems to work *shock*
As usual I "couldnt stop" myself playing around (too much fun) and made a full first version of such a macro - except that it only contains one single gesture yet, for "UP".
And the syntax got pretty complicated, because of that little prob to exclude double or triple actions with one move, there may be easier ways...?

Anyway, this is just a first draft and has NO TABS context, but if you feel like, just take over and add more gestures...


EDIT: New version 0.2!

# K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage2)
#
# ------------------ gestureplus. kmm -------------- (Version 0.2) -----------------
# Menu entry: Tools > Mouse Gestures Plus (for information and config)
# Gestures: You must manually assign the new macros below to your desired mouse gestures (also in "Tools")
# Version: 0.2 / 2010-02-16 / by Siria
# Forum: kmeleon.sourceforge.net/forum/read.php?4,103033
#----------------------------------------------------------------------------
#
# To use different mouse gestures depending on context (on selected text, on link, on image, on somewhere in page)
#
# YOUR CONFIGURATION IS NEEDED:
# Add the macro commands you wish from below to Tools>Mouse Gestures..., e.g. "macros(gestureplus_UP)"

# And you CAN use the actions as set below, but if you prefer to exchange some commands:
#
# Find default command names here: two.xthost.info/kmeleon/lizard/commands.html
# Find commands from user-defined macros in their kmm-file, in their "setmenu" lines near the end
# Syntax-Translation: xyz=="abc" ? command1 : command2 ; That means if xyz=abc do command1, else do command2
# Macros global variables (link or...): kmeleon.sourceforge.net/wiki/MacroLanguage2#global
# Note that "&macroname" is the same as "macros(macroname)" HERE, but in Tools>Gestures use "macros(gestureplus_xy)"

gestureplus_UP{
macroinfo="Mouse gesture 'UP' on: SELECTED: Open as URL / LINKS: Open in new page / IMAGE: Zoom Image / PAGE: Go to top / ABOUTCONFIG: Open prefs info links";
if ($URL=="about:config") {
$OpenURL="kmeleon.sourceforge.net/wiki/NewPreferences"; &OpenURL_InNew;
$OpenURL="kb.mozillazine.org/About:config_entries"; &OpenURL_InNew;
$OpenURL="kb.mozillazine.org/Category:Preferences"; &OpenURL_InNew; }
else
if ($SelectedText > "") {&Open_TextAsURL ;}
else
if ($LinkURL > "") {$OpenURL=$LinkURL; &OpenURL_InNew;}
else
if ($ImageURL > "") {macros(Zoom_Image_In);}
else
{&JS_scrollTop;}
}

gestureplus_openkmm{
macroinfo="Open configuration of macro gestureplus.kmm";
$_GestPls_kmm=getfolder(UserMacroFolder)."\\gestureplus.kmm";
readfile($_GestPls_kmm)==""?$_GestPls_kmm=getfolder(MacroFolder)."\\gestureplus.kmm":0;
# exec("notepad.exe \"".$_FSCap_kmm."\"");
$ext="kmm"; &getExtensionHandler;
exec(sub("%1",$_GestPls_kmm,$cmdline));
}

# The menu is just for information what actions are defined:

_gestureplus_BuildMenu{
$gestureplus_menu="Mouse Gestures Plus";
setmenu("Settings",popup,$gestureplus_menu,2);
setmenu("Settings",separator,3);
#
setmenu($gestureplus_menu,macro,"info UP (read statusline)",gestureplus_UP);
#
setmenu($gestureplus_menu,separator,-1);
setmenu($gestureplus_menu,macro,"Configuration (macro gestureplus)",gestureplus_openkmm);
}

#---------------------- BROWSER START ---------------------------
$OnInit=$OnInit."_gestureplus_BuildMenu;";
$macroModules=$macroModules."gestureplus;";




Edited 3 time(s). Last edit at 02/16/2010 08:11PM by siria.

Options: ReplyQuote
Re: Xtra Gestures for/from Tabs
Posted by: siria
Date: February 15, 2010 11:02PM

Hey, another thought: One can even define different gestures by website!
hostname($URL)=="kmeleon.sourceforge.net" ? ... : ... ;

Okay, not sure yet what exactly that could be good for (if any), but exciting how much is possible, LOL! If only there were also "AND" and "OR" conditions possible, I mean without that ultracomplicated 'pyramiding' or how to call...

Oh, forgot, actually I am already using different mouse gestures by website: An extra version for "Go to end of page" for one of my forums, that has a huge footer. A special macro that goes to end then scrolls one page up again. So far I used different mousegestures, since only one command by gesture was possible, and of course kept confusing the two gestures tongue sticking out smiley

Another possibility with own macros for gestures: One can set multiple actions for one gesture. If anyone has use for it... ;-)

The only problem really is to knit the various conditions together, without short AND/OR commands.

And by the way for if-conditions there are 2 syntax versions available, and both can be used. The "old" one (for KM 1.1+1.5) goes like this:

$OpenURL=$LinkURL ;
$SelectedText > "" ? &Open_TextAsURL : ($LinkURL > "" ? &OpenURL_InNew : &JS_scrollTop);


The "new" one (works in KM 1.5x and newer) allows multiple commands in one bracket, same action as above can be written like this:

if ($SelectedText > "") {&Open_TextAsURL ;}
else
if ($LinkURL > "") {$OpenURL=$LinkURL; &OpenURL_InNew;} else {&JS_scrollTop;}




Edited 5 time(s). Last edit at 02/16/2010 12:14AM by siria.

Options: ReplyQuote
Re: Xtra Gestures for/from Tabs
Posted by: siria
Date: February 16, 2010 08:06PM

Oh man, I'm too fascinated with this!!

New version for the "UP-Gesture" grinning smiley

on SELECTED TEXT: Open as URL
on LINKS: Open link in new page
on IMAGE: Zoom this image
on PAGE: Go to top
on "about:config" page: Open info links for settings


-----------------------------------
gestureplus_UP{
macroinfo="Mouse gesture 'UP' on: SELECTED: Open as URL / LINKS: Open in new page / IMAGE: Zoom Image / PAGE: Go to top / ABOUTCONFIG: Open prefs info links";
if ($URL=="about:config") {
$OpenURL="kmeleon.sourceforge.net/wiki/NewPreferences"; &OpenURL_InNew;
$OpenURL="kb.mozillazine.org/About:config_entries"; &OpenURL_InNew;
$OpenURL="kb.mozillazine.org/Category:Preferences"; &OpenURL_InNew; }
else
if ($SelectedText > "") {&Open_TextAsURL ;}
else
if ($LinkURL > "") {$OpenURL=$LinkURL; &OpenURL_InNew;}
else
if ($ImageURL > "") {macros(Zoom_Image_In);}
else
{&JS_scrollTop;}
}
-----------------------------------

Of course it's easy to do the same for the "down" gesture, and those two I find even rather intuitive smiling smiley

-----------------------------------

ALTERNATIVE: Open the links in a bookmark folder with a mouse gesture!
Define a Nickname for a single bookmark or a bookmark-folder (or same for Hotlist), that contains the websites that shall be opened.
Let's say a folder with a nickname "pref" contains those 3 info links.

Then replace those lines in the code above:

if ($URL=="about:config") {
$OpenURL="kmeleon.sourceforge.net/wiki/NewPreferences"; &OpenURL_InNew;
$OpenURL="kb.mozillazine.org/About:config_entries"; &OpenURL_InNew;
$OpenURL="kb.mozillazine.org/Category:Preferences"; &OpenURL_InNew; }


with that one:

if ($URL=="about:config") {$URLBAR="pref";id(ID_NAV_GO); }



Edited 2 time(s). Last edit at 02/16/2010 09:16PM by siria.

Options: ReplyQuote
Re: Xtra Gestures for/from Tabs
Posted by: siria
Date: February 19, 2010 05:29AM

*sniff* Will have to leave out that image option, there's a conflict with scrolling if a page has a background image :-( For some odd reason the background images produce a permanent imageurl, then no matter where the mouse hovers it thinks the user wanted to handle that image. Can't think of any workaround... And if injecting a CSS to hide the background-image, it can't be "switched on" again afterwards...

But still love that multi-gesture thing, guess I'll make separate thread for it...

EDIT: Thread for my macro "GesturePlus": http://kmeleon.sourceforge.net/forum/read.php?9,103419



Edited 4 time(s). Last edit at 03/28/2010 10:26PM by siria.

Options: ReplyQuote
Re: Xtra Gestures for/from Tabs
Posted by: SoerenB
Date: February 19, 2010 02:49PM

Hi, siria,
great macro, anyway.
If you start a new thread, don't forget to include some key search expressions like
"drag n' go", "dragToGo" or similar (don't remember the exact spellings of those
Firefox extensions) - may be even in the headline.
People might search for them - I, in fact, did so during my first days with K-Meleon.

Cheers
SoerenB



Edited 1 time(s). Last edit at 02/19/2010 02:51PM by SoerenB.

Options: ReplyQuote
Re: Xtra Gestures for/from Tabs
Posted by: siria
Date: February 20, 2010 04:01AM

Oh, great tip! Didn't know that, but it's EXACTLY what we're trying here grinning smiley

"DragToGo" for Firefox: https://addons.mozilla.org/en-US/firefox/addon/6639

It's really a super deluxe version for customizing. Perhaps anyone can convert...? cool smiley

The customizing is really the biggest problem with my "beginner macro". Not many people will be amused when having to look up commands in a huge list (e.g. here http://two.xthost.info/kmeleon/lizard/commands.html) and then exchanging the command names in the macro file :-/

Options: ReplyQuote


K-Meleon forum is powered by Phorum.