Bind F4(open terminal) to Yakuake

Various KDE 1.-4. Improvements

Source i (link to git-repo or to original if based on someone elses unmodified work):

Add the source-code for this project on opencode.net

0
Become a Fan
5.0

Available as/for:
Description:
This is a simple script to bind F4 (open terminal) to Yakuake (http://www.kde-look.org/content/show.php?content=29153), it slides out Yakuake, creates a new tab in Yakuake and changes to the current dir for the focused Konqueror window.

You'll need to have Yakuake installed before you can use this script.

Supported KIO-slaves
file:// (/ that is)
fish://

How to install
- Put the yakuake-F4 in your $PATH, I've put mine in ~/bin for example.
For kcontrol users (debian for example)
1.a - Make a keyboard shortcut to handle this. You'll find it in Kcontrol->Regional & Accessibility->KHotKeys.
For system settings users (kubuntu for example)
1.b - Make a keyboard shortcut to handle this. You'll find it in system settings->Accessibility->Input Actions

2 - Click "New action" and choose F4 as keyboard shortcut and choose the yakuake-F4-script (where you have put it) under command/url.

TODO
Rename tabs properly
Move to the right dir with fish:// as well
Use Kwallet to pick up passwords (if someone knows how to handle qbytearrays in bash just shout it out=)
Last changelog:

0.2.5
Cleaned up the code quite a bit, fixed a miss with sed and spaces (thanks laszlok2).

0.2.4
Added some kind of support for fish://, you get hooked up to the right host but nothing more.

0.2.2
Just adds new tab when dealing with local urls (thanks Marco).

0.2
Check with dcop if Yakuake already runs (thanks laszlok2 and ZeeD).
Don't add new tab if yakuake isn't running when pressing F4.


Ratings & Comments

26 Comments

RazZziel

New url for my version of the script: http://rafb.net/p/ltwmoA91.html

Alteran

is there any way to modify the script to work with pcmanfm? great work though, just dont like konqueror

noyso

i downloaded latest script and compiled latest Yakuake, but script is still opening Konsole instead of Yakuake. any ideas? (kubuntu 7.10 + kde 3.5.8 + yakuake 2.8)

noyso

after careful reading of post i've done all requirements, but now F4 opens yakuake with home dir, not with dir of active konqueror window

RazZziel

I think the "half-transparent crippled" bug is a bug of yakuake, I think it happens when the script does dcop calls to konqueror between the slotAddSession and the slotToggleState in yakuake. I modified the script: - Crippled sessions fixed (at least in my yakuake) - Console is cleared after a local `cd` - If we are not in a fish:// session. I use simply `pwd` to check the actual directory. It works well even in URLs like media://something (I think the old script didn't work in theese cases, but I haven't tested it. - Simpler code to extract the fish url, user, host and port (I use only bash built-in variable modifiers) - Sorry about my poor english - SSH connections now support directory changes. I did it with "bash -i", but if someone knows a better way to do it, please give feedback - SHH connections also support port change - I don't know if this happens in the old version (I suppose it does), but if we don't "cd ~" before opening a new yakuake, all the tabs opened in that yakuake instance will be opened by default in the directory we are browsing in konqueror - URLs with spaces solved with scaping the double quotes instead of the spaces I think that the best way to install it is putting it in a directory under the $PATH (like /usr/bin, my ~/.bin didn't work) and set it as the KDE Component for Terminal Emulator, so I added the "-e" switch so it can execute arbitrary commands TODO: - Make it compatible with komqueror "Minimize Memory Usage: Always" mode (yeah, I have the code, but don't feel like testing it right now :P) Script URL: http://raziel.freehostia.com/yakuake-F4

peppelorum

Nice work! Good clean up and fish works as well, super! Before I update the script I just want to clear a few things. - This "-e"-flag, hos does that work? Can I just switch from Konsole to the script as prefered terminal program or do I have to do something else? Cause when I change nothing happens as far I can tell. - The show_yakuake "cd \"`pwd`\" && clear" doesn't work for me at all since `pwd` doesn't return anything in the script for some reason, you can debug with kdialog --msgbox $url for example.

RazZziel

Glad you like it :) - The "-e" switch works running anything that comes after the "-e". for example, "yakuake-F4 -e ls -la" will open a yakuake and execute "ls -la". I have selected the script as prefered terminal emulator, and does the work (but you will only notice it if the application you are using tries to use the default kde terminal emulator. I only know two apps that use it: konqueror and kdevelop). For example, in kdevelop I have configured aterm as default terminal, so when I want to run a project, kdevelop executes "aterm -e /bin/sh -c '/home/raziel/Projects/sc_pong/build/src/sc_pong ; echo "Press Enter to continue!";read dummy'". I've tried to switch in kdevelop to the default KDE terminal (I mean, the one configured in KDE Components, in kcontrol: yakuake-F4 in my system), and it works well (except for the fact that kdevelop echoes a "!", and bash doesn't like it and says "bash: !": event not found" (normal terminals, when running with -e, runs the specified command instead of a shell, and we run the command inside bash)) By the way, I have just realiced that doing >> tab=`dcop yakuake DCOPInterface selectedSession` >> dcop yakuake DCOPInterface slotRunCommandInSession $tab "$*" is the same as doing >> dcop yakuake DCOPInterface slotRunCommandInSession "$*" (I mean, if we remove the $tab, yakuake selects the active tab by default) - The `pwd` works well for me in konqueror. Konqueror, when pressing F4, doesn't give the terminal any parameter. The terminal will be executed in the actual konqueror directory (it's like if you, in an aterm, cd to a directory and then open another aterm from the first aterm, without additional parameters). Yakuake works in the same way, and that's why I have to "cd ~" if a new yakuake is run, and then force a "cd `pwd`" I tried to print the output of `pwd` before the call to "show_yakuake "cd \"`pwd`\" && clear"", and it works well in my system. Are you sure you have tried it in konqueror, or in any other terminal?

jayenell

When I press F4 yakuake opens, but it is a half-transparant crippled yakuake-session, allthough I see it has succesfully changed to the right directory.

itayf

Happens to me too...

vanaedium

hi when i push f4 button, the console opens in the right position but normal console and not yakuake. What I have to do? I use yakuake kubuntu breezy new package thanx

rgfree

Kubuntu Breezy users, please notice that this requires a very recent Yakuake with proper DCOP support. You will have to compile Yakuake yourself. Furthermore: I added a ";clear" behind the cd statement in order to have a clean screen and not a confusing cd statement at the top. SSH still has some problems here. It doesnt change into the proper directory and :22 isnt removed like in fish://bla.org:22/usr/local The ":22" is introduced by KDE when you use the remote places functionality. The script should remove this but I'm no sed-expert and my attempts to fix this were futile. The SSH support would be great if it worked. Ive been missing this for ages in KDE. I'd like to switch from Konqueror right into the right folder, already logged in.

jipumarino

Hi, I replaced the loop starting at line 17 with the following, thus making it able to work when using the Minimize Memory Usage: Always setting in Konqueror (there would be only one konqueror-NNNN process with many konqueror-mainwindow#n objects). Good luck. for i in $konq; do windows=`dcop $konq default getWindows|wc -l` for ((win=1; win

laszlok2

Good job on this update, but again here's some bugs i found. 1. The $url2 should pipe the text into sed 's/ /\\ /g' because the g makes sure that all the spaces are escaped -- useful for when the filename has more than one space. 2. Because of the issue with space, in the final if statement: if [ $url2 ]; this should be instead: if [ "$url2" ]; so that it isn't false when there is a \ and a space in the string. Keep up the good work!

peppelorum

Thanks for the comment and the bug report, it should be fixed now. //Peppe

vanaedium

I've followed the instructions but if I press F4 a normal terminal appears not on yakuake any suggestions?

thoand

you know that you have to be in some dir with your konquerer?

fungs

Why not enter it as terminal application, under kcontrol->kde components->terminal I have done so and it works just fine in konqueror. I don't know where else it is used in kde, but just adding an -e switch to the script would make it compatible to most virtual terminal calls. So this should work quite genericly.

peppelorum

Sweet, that was a much better solution. I have to check it out some more during the day.

thoand

but what, when there is already a sessiopn of yakuake startet?

EazyVG

Under KHotkeys I don't have ->Menu Editor Entries. How I activate this in SUSE running KDE 3.4.3 I would really love this on my desktop. Thanks.

peppelorum

Just click the "New action"-button and skip the menu editor-thingie, I have removed that part from the installation guide.

Ekardnam

This sounds great! Maybe I'll try YaKuake again, because this is (was) one of the features that I missed.

laszlok2

One thing: the script should not call yakuake to start each time. It should see if a dcop call returns "call failed". If it does, then start the program. I have yakuake come up on startup so its always on, and I don't want more instances launched.

laszlok2

I used the following code to solve the above problem. Replace yakuake with: if [ "`dcop yakuake yakuake-mainwindow#1 hidden`" != "true" -a "`dcop yakuake yakuake-mainwindow#1 hidden`" != "false" ]; then yakuake fi

peppelorum

Thanks for the tip=)

Pling
0 Affiliates
Details
license
version 0.2.5
updated
added
downloads 24h 0
mediaviews 24h 0
pageviews 24h 1

More Various KDE 1.-4. Improvements from peppelorum:

Minitools - Add to Google Reader/homepage
peppelorum
last update date: 18 years ago

Score 5.0

Konqueror fine-adjustments
peppelorum
last update date: 20 years ago

Score 5.0

Other Various KDE 1.-4. Improvements:

Slicker Debian Package for Woody
cirrusgr
last update date: 22 years ago

Score 5.0

Konqueror/kdesktop suggestion
PovMan
last update date: 22 years ago

Score 5.0

Biiig buttons
dbojan
last update date: 20 years ago

Score 5.0

Yet Another KControl
Frans
last update date: 21 years ago

Score 5.0

Next window and next/previos window
dbojan
last update date: 20 years ago

Score 5.0

Fantasie Toolbar
katoe
last update date: 19 years ago

Score 5.0