Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Adding to Konqueror contextual menu (right click)
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
Ian Goldby
Guru
Guru


Joined: 18 May 2002
Posts: 539
Location: (Inactive member)

PostPosted: Mon Jun 03, 2002 10:09 pm    Post subject: Adding to Konqueror contextual menu (right click) Reply with quote

Is there a simple way of adding something to Konqueror's contextual menu that appears when I right-click on a file?

I'd like to add a menu item to run jpegtrans -progressive -rotate 90 or similar commands on jpeg files that I right-click on.

If this can't be achieved easily, is it something that could be done as a plugin?

Ta

Ian
Back to top
View user's profile Send private message
mksoft
l33t
l33t


Joined: 28 May 2002
Posts: 844

PostPosted: Wed Jun 05, 2002 3:55 pm    Post subject: Reply with quote

Haven't tried it, but you can :)
    Right click a jpeg image
    Select Edit File Type
    Under Application Preference Order click Add
    Type the command you wish to run
    OK everything

Then right click and try it.
Something along this lines should work.
_________________
There's someone in my head but it's not me - Pink Floyd
Back to top
View user's profile Send private message
Ian Goldby
Guru
Guru


Joined: 18 May 2002
Posts: 539
Location: (Inactive member)

PostPosted: Wed Jun 05, 2002 7:12 pm    Post subject: Reply with quote

Yay! I tried this before posting my query and it didn't work. But I've finally discovered the problem was that I had failed to put quotes around $1 - the file name - and in my test case, the file name had spaces in. Anyway, here's the script for anyone else who is interested:

Code:
#!/bin/sh
mv "$1" "$1~"
jpegtran -optimise -progressive -rotate 270 -trim -copy all -outfile "$1" "$1~"


For those who've not come across jpegtran before, the above does some optimisation of the image, changes it to progressive JPEG (I can't see any reason why anyone would want non-progressive JPEGs now that they are supported almost universally and since they are slightly smaller and load faster), rotates it by 90 degrees anticlockwise, and ensures that marker information inserted by digital cameras etc (recording things like exposure mode, shutter speed, etc) are preserved. jpegtran does lossless transformations, so you don't lose any picture quality by doing this, unlike loading into a graphics package, rotating, and resaving.

Make sure the execute permissions on the script file are set. When adding the script to the Application Preference Order of the Jpeg file type, it doesn't matter if 'Run in terminal' is selected or not, but if it isn't you don't get any feedback that the process is running/finished.

Ian
Back to top
View user's profile Send private message
Ian Goldby
Guru
Guru


Joined: 18 May 2002
Posts: 539
Location: (Inactive member)

PostPosted: Wed Jun 05, 2002 8:15 pm    Post subject: Here's another one Reply with quote

Here's one to display the extra data inserted into jpeg files by many digital cameras:

Code:
#!/bin/sh
until [ -z "$1" ]
do
  TN="/tmp/`basename "$1"`.txt"
  jhead "$1" > "$TN"
  xmessage -center -default okay -file "$TN"
  rm "$TN"
  shift
done


In fact the until-done loop seems to be unnecessary because KDE launches a separate process for each file selected, but it seemed neater to do it this way.

Ian
Back to top
View user's profile Send private message
Ian Goldby
Guru
Guru


Joined: 18 May 2002
Posts: 539
Location: (Inactive member)

PostPosted: Sat Jul 27, 2002 9:44 pm    Post subject: Better way... Reply with quote

See https://forums.gentoo.org/viewtopic.php?t=4253, and the KDE tutorial at http://developer.kde.org/documentation/tutorials/dot/servicemenus.html for how to do this using Konqueror Service Menus. Very powerful and dead-easy.

Ian
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum