You are not logged in.

#1 2017-03-17 22:37

michaelk
Member
Registered: 2017-03-16
Posts: 81

how to organize kde-servicemenus?

Hi,
I want to apply servicemenus like I remember it from old KDE 3 but have problem now:

For Konqueror I find 2 directories:

/home/user/.trinity/share/apps/konqueror

/home/user/.kde/share/apps/konqueror

Where must the direcotry „Servicemenus“ be placed? Anybody around?

Offline

#2 2017-03-18 00:03

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,989

Re: how to organize kde-servicemenus?

$HOME/.trinity/share/apps/konqueror/servicemenus/ is the place I was recommended by the dev team. although if you want to see the current service menus they can be found in /opt/trinity/share/apps/konqueror/servicemenus/

Offline

#3 2017-03-18 08:16

michaelk
Member
Registered: 2017-03-16
Posts: 81

Re: how to organize kde-servicemenus?

Thank you, Dai_trying,
understood. Hopefully the dev team reads here as well. A *.dektop-file, that worked under KDE 3 on an old installation, does not work now under TDE though it is in right directory:

[Desktop Action allFiles]
Exec=tree -a %f | kwrite --stdin
Icon=kwrite
Name=All Files

[Desktop Action directoryTree]
Exec=tree -ad %f | kwrite --stdin
Icon=kwrite
Name=Directories Only

[Desktop Action fullPath]
Exec=tree -af %f | kwrite --stdin
Icon=kwrite
Name=All Files w/Full Path

[Desktop Entry]
Actions=directoryTree;allFiles;fullPath
Encoding=UTF-8
Icon=
ServiceTypes=inode/directory
X-KDE-Submenu=Make Tree

<= may be there some TDE-specific details missing in it?

Offline

#4 2017-03-18 09:07

bin
Member
From: U.K.
Registered: 2016-01-28
Posts: 1,295

Re: how to organize kde-servicemenus?

Don't these need a Type= entry?

I'm going to ask a really stupid question here, but if we are talking about tree as in the tree command, it is installed isn't it?

Last edited by bin (2017-03-18 09:41)

Offline

#5 2017-03-18 10:28

michaelk
Member
Registered: 2017-03-16
Posts: 81

Re: how to organize kde-servicemenus?

@bin: I do not know. A *.dektop-servicemenu that works looks like this (from: /opt/trinity/share/apps/konqueror/servicemenus, email.desktop):

„[Desktop Entry]
Actions=Email
Encoding=UTF-8
X-TDE-ServiceTypes=allfiles

[Desktop Action Email]
Name=Email File
Name[de]=Versenden als E-Mail
Name[fr]=Envoyer par courriel
Name[pl]=Wyślij plik w załączniku
Exec=kmail --attach %F
Icon=kmail“

tree is of course installed and manually applied it works via the konsole.

Last edited by michaelk (2017-03-18 10:29)

Offline

#6 2017-03-18 10:59

michaelk
Member
Registered: 2017-03-16
Posts: 81

Re: how to organize kde-servicemenus?

@Dear bin,

the question was not stupid at all! ;-)

I just added the line „X-TDE-ServiceTypes=allfiles“ into the above given file so it reads now:
„[Desktop Entry]
Actions=directoryTree;allFiles;fullPath
Encoding=UTF-8
X-TDE-ServiceTypes=allfiles
Icon=
ServiceTypes=inode/directory
X-KDE-Submenu=Make Tree“

- and now it works. One thing is missing: with a right click on a directory you normally see under „Actions“ the offer: „Make Tree“ and then 3 further offers „directories only“ and „all files“ and „all files with full path“. This does not show!

Anyway, I guess it is not only for me important to learn to apply such menuservices, for example for quick resizing of images or for uncompressing compressed files, like the *.war-formate, so if some developer might teach us how to arrange that I would appreciate it a lot.


thanks and regards,

Michael

Last edited by michaelk (2017-03-18 11:04)

Offline

#7 2017-03-18 11:29

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,989

Re: how to organize kde-servicemenus?

You need to replace X-KDE-Submenu=Make Tree with X-TDE-Submenu=Make Tree I just tested and it works fine. smile

Offline

#8 2017-03-18 11:38

michaelk
Member
Registered: 2017-03-16
Posts: 81

Re: how to organize kde-servicemenus?

Thanks a lot, Dai_trying! This is the way we solve problems under Linux with the community! ;-)

Offline

#9 2017-03-18 11:42

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,989

Re: how to organize kde-servicemenus?

michaelk wrote:

This is the way we solve problems under Linux with the community! ;-)

It certainly is smile and thanks for that servicemenu example, I'm not too experienced with them so am learning myself as I go along, yours is quite a useful one.

Offline

#10 2017-03-18 11:54

bin
Member
From: U.K.
Registered: 2016-01-28
Posts: 1,295

Re: how to organize kde-servicemenus?

This is a resize script from Thunar/Xfce custom actions right click menu - it requires imagemagik

1  #!/bin/bash
     2 
     3  PERCENT="$1"
     4    shift
     5  while (( "$#" )); do 
     6    convert "$1" -resize "$PERCENT%" -quality 100 "resized_to_${PERCENT}%_$1"
     7    shift
     8  done
     9 
    10  exit 0


This rotates images
1  #!/bin/bash
     2 
     3 
     4  DIRECTION="$1"
     5  shift
     6 
     7  case "$DIRECTION" in
     8    "r")
     9      while (( "$#" )); do
    10        convert -rotate 90 -quality 100 "$1" "$1"
    11        shift
    12      done
    13    ;;
    14    "l")
    15      while (( "$#" )); do
    16        convert -rotate -90 -quality 100 "$1" "$1"
    17        shift
    18      done
    19    ;;
    20  esac
    21 
    22  exit 0

I guess it would not be too hard to adapt to work in Konq?

Offline

#11 2017-03-18 12:31

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,989

Re: how to organize kde-servicemenus?

There is a "convert to" script for converting images to different formats, I would imagine editing that to incorporate these scripts would be the easiest way to go. smile

Just noticed there is a "jpegorient.desktop file in servicemenu which might be a nearer fit to what you can modify/copy.

Offline

#12 2017-03-18 12:57

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,989

Re: how to organize kde-servicemenus?

I just tested a couple of things with the previously mentioned servicemenu options and took a picture taken on my phone (png) and converted it to jpeg then changed orientation and converted back to png, I found a couple of interesting points.
1.) The file size of the final picture is smaller (a little) than original but retains quality (maybe due to compression routine)
2.) The process was very easy and took just a few seconds!!
3.) The resulting image has a thumbnail (I'm using scorpion and there is an issue displaying thumbnails ATM)

Just thought I'd share

Offline

#13 2017-03-18 13:01

michaelk
Member
Registered: 2017-03-16
Posts: 81

Re: how to organize kde-servicemenus?

Well, there are quite some suitable kde-servicemenus around.
https://www.linux-apps.com/content/show … iles-panel
Even for TDE:
https://www.linux-apps.com/p/998173/
This here would be great:
https://www.linux-apps.com/content/show … tent=11505
That is for image resizing.

But the problem is: TDE has a modified architecture and that creates a configuration problem to make these things effective, what is beyond my abilities to solve. Except, like here, by shere luck. ;-)

Last edited by michaelk (2017-03-18 13:02)

Offline

#14 2017-03-18 13:12

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,989

Re: how to organize kde-servicemenus?

That KIM looks quite interesting, I have downloaded it and will look to see if I can convert it to TDE and will post an update if and when I have something.

Offline

#15 2017-03-18 15:02

JimW
Member
Registered: 2015-12-08
Posts: 400

Re: how to organize kde-servicemenus?

Sigh....
Now if they just had it for video!
But, I manage...
I convert my 4:3 aspect game camera avi's to 16:9 aspect mp4's for youtube without loosing too much quality. Managed to do it with ffmpeg. Thing is, I wanted to keep the bottom of the game camera picture where the date/time information was, so I had to crop the top (which was just tree tops and sky anyway). Most examples have the cropping of the 4:3 aspect ratio to get 16:9 aspect radio to do the cropping evenly from top and bottom.

Offline

#16 2017-03-18 15:48

michaelk
Member
Registered: 2017-03-16
Posts: 81

Re: how to organize kde-servicemenus?

@Dai_trying:

The menuservices are a great feature of the KDE Desktop. But they are connected with configuration problems. It is differently organized with KDE 3.., 4... und 5. In addition TDE has organized details in a different way. We have this .trinity-directory in the /home/user-directory.

So the aim should be to adapt those *.desktop-files to the specific conditions in TDE and, if possible, document how to do it. If you and your dev team could solve this problem it would be splendid.

Offline

#17 2017-03-18 15:58

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,989

Re: how to organize kde-servicemenus?

michaelk wrote:

@Dai_trying:
snip...

If you and your dev team could solve this problem it would be splendid.

This made me smile big_smile

I am just a Q4OS user that spends some time helping (and getting help from) other users on the forum, the dev team are very active and usually read and reply if necessary to any posts here on the forum, I try to answer anything I can to leave them free to do the more important work on the OS itself, but you can be sure they will respond / react to anything that requires their attention. And I'm sure we can all work together to find a solution, maybe a small section of the q4os documentation regarding servicemenus or maybe I could add a page to my site to cover it.

Offline

#18 2017-03-18 17:28

michaelk
Member
Registered: 2017-03-16
Posts: 81

Re: how to organize kde-servicemenus?

And here how to get „Make Tree“ to work:
Go to /home/user/trinity/share/apps/konqueror/servicemenus
and make a text file with this content:

[Desktop Action allFiles]
Exec=tree -a %f | kwrite --stdin
Icon=kwrite
Name=All Files

[Desktop Action directoryTree]
Exec=tree -ad %f | kwrite --stdin
Icon=kwrite
Name=Directories Only

[Desktop Action fullPath]
Exec=tree -af %f | kwrite --stdin
Icon=kwrite
Name=All Files w/Full Path

[Desktop Entry]
Actions=directoryTree;allFiles;fullPath
Encoding=UTF-8
X-TDE-ServiceTypes=allfiles
Icon=
ServiceTypes=inode/directory
X-TDE-Submenu=Make Tree

store it as maketree.desktop - and you are done.
Open a new konqueror window. If you right-click on to a directory within that window you will see the Make Tree offer.

Offline

#19 2017-03-19 02:24

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,989

Re: how to organize kde-servicemenus?

Ok I managed to get KIM working although I have not tested all the functions, but the ones I did test seemed to work. If anyone has any problems with this let me know and I will see if there is anything I can do to help.

Attached is the modified KIM download complete with installer.


Attachments:
gz kim.tar.gz, Size: 51.41 KiB, Downloads: 710

Offline

#20 2017-03-19 09:11

bin
Member
From: U.K.
Registered: 2016-01-28
Posts: 1,295

Re: how to organize kde-servicemenus?

Dai_trying wrote:

Ok I managed to get KIM working although I have not tested all the functions, but the ones I did test seemed to work. If anyone has any problems with this let me know and I will see if there is anything I can do to help.

Attached is the modified KIM download complete with installer.

Thanks Dai - thought I'd give this a whirl.

Installation seems OK running sudo ./install

The basic resize, rename, change format,compress etc all seem OK so far.

The Treatment and Publication area is where it starts to fall apart.

It looks as though the TMPDIR line is failing to read $HOSTNAME and so it errors

/opt/trinity/bin/kim_pelemele: 23: /opt/trinity/bin/kim_pelemele: let: not found
mktemp: failed to create directory via template ‘/home/robin/.trinity/tmp-/kim.X
XXXXXXX’: No such file or directory

This does not seem to be a universal failing - should the variable $HOSTNAME be defined at the start of the script?

Out of interest the use of let in BASH seems to be frowned on - not my territory I'm afraid

/opt/trinity/bin/kim_pelemele                        1582/2822               56%
# Author :  Charles Bouveyron <charles.bouveyron@free.fr>

FILE="";
let "nbfiles = $#"

test -n "$TDEHOME" || TDEHOME="`tde-config --localprefix`"; export TDEHOME
TMPDIR=`mktemp -d "$TDEHOME"/tmp-"$HOSTNAME"/kim.XXXXXXXX` || exit 1

SIZE=`kdialog --inputbox "Size of small images:" 400x400`;
TILE=`kdialog --inputbox "Number of rows and columns:" 5x4`;
RATIO=`kdialog --inputbox "Overlaping ratio in percent:" 15`;
COLOR=`kdialog --inputbox "Background color:" grey`;
W=`echo $SIZE | sed 's/[^0-9]/ /g' | awk '{print $1}'`;
let "OVER = ($RATIO*$W)/100";
let "BORDER = (2*$W)/100";

dcopRef=`kdialog --progressbar "Kim - Initialising ..." $nbfiles`
dcop "$dcopRef" showCancelButton true
compteur=0

Does the sue of compteur as opposed to counter make a difference. It doesn't seem to cause problems with the resize etc scripts though it is noted as a variable for the progress dialogue - I think.......

The HTML Gallery option works but the resulting gallery doesn't - index.html loads a page but the picture frames are empty - thumbnails.... The actual pics load but that's all - this is handled better by the Kong Image Gallery addon methinks.

It looks like this could be a good basis for a project to improve in various places. For example the email image script needs to know the preferred application for email - not sure how it would interact with Thunderbird.......

Offline

#21 2017-03-19 10:05

michaelk
Member
Registered: 2017-03-16
Posts: 81

Re: how to organize kde-servicemenus?

@Dai_trying: thanks a lot for your effort @bin: thanks for your attention.

My result is: does not work yet, unfortunately.
The output of ./install.sh:

./install.sh: Zeile 20: tde-config: Kommando nicht gefunden. (did not find the command)

<My comment: user@q4os-desktop:~$ $TDEHOME
bash: /home/michael/.trinity - this works then!>


cp: das angegebene Ziel „/share/apps/konqueror/servicemenus/“ ist kein Verzeichnis (this goal is no directory)

<My comment: there is a directory, but at
root@q4os-desktop:/home/michael/Schreibtisch/kim/kim# ls /usr/share/apps/konqueror/servicemenus >


chmod: Zugriff auf „/share/apps/konqueror/servicemenus/kim*.desktop“ nicht möglich: Datei oder Verzeichnis nicht gefunden (did not find this file or directory)
mkdir: das Verzeichnis „/share/apps/kim“ kann nicht angelegt werden: Datei oder Verzeichnis nicht gefunden (this  file or directory cannot be created: not found)

cp: reguläre Datei „/share/apps/kim/kim_about.txt“ kann nicht angelegt werden: Datei oder Verzeichnis nicht gefunden (not found)
mkdir: das Verzeichnis „/share/apps/kim/slideshow/“ kann nicht angelegt werden: Datei oder Verzeichnis nicht gefunden (not found)
cp: das angegebene Ziel „/share/apps/kim/slideshow/“ ist kein Verzeichnis (goal is no directory)
mkdir: das Verzeichnis „/share/apps/kim/galery“ kann nicht angelegt werden: Datei oder Verzeichnis nicht gefunden (not found)
cp: das angegebene Ziel „/share/apps/kim/galery“ ist kein Verzeichnis (goal is no directory)
./install.sh: Zeile 36: cd: /share/apps/konqueror/servicemenus/: Datei oder Verzeichnis nicht gefunden (not found)
mv: der Aufruf von stat für „imageconverter.desktop“ ist nicht möglich: Datei oder Verzeichnis nicht gefunden (not found)
mv: der Aufruf von stat für „jpegorient.desktop“ ist nicht möglich: Datei oder Verzeichnis nicht gefunden (not found)
Installation completed. Good bye. (installation completed. Good bye)

What I realize if a right-click on an image is: offers for conversion to jpg etc., but nothing with resizing. So it does not work!
And now the good news: I opened this install.sh and simply did as user (not as root!) manually, step by step, what the script wanted to do: instead of /opt/.trinity I used the directory ~/.trinity - and now it works!!! ;-)

As said before: there must a tricky configuration problem connected with this issue. For the experts: if I ask as a normal user for „$PATH“ I get this

bash: /usr/local/bin:/opt/trinity/bin:/usr/bin:/bin:/usr/local/games:/opt/trinity/games:/usr/games: Datei oder Verzeichnis nicht gefunden

(„Datei oder Verzeichnis nicht gefunden“ - file or directory not found)

Offline

#22 2017-03-19 10:11

michaelk
Member
Registered: 2017-03-16
Posts: 81

Re: how to organize kde-servicemenus?

And this PATH-output means for me: wrong! It should contain as well ~/.trinity/bin

My user .profile contains the lines:
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"

As I guess the PATH should also contain $HOME/.trinity/bin - otherwise the concept of the author of KIM will not work.

Right? How to establish this?

I want to get this thread so that in our local Linux user group it can be used to show beginners how to solve problems under linux.

Last edited by michaelk (2017-03-19 10:13)

Offline

#23 2017-03-19 10:16

bin
Member
From: U.K.
Registered: 2016-01-28
Posts: 1,295

Re: how to organize kde-servicemenus?

Given that this is a service menu it makes sense for it to install in /home/user.... which was what I expected and then had to use sudo to get it to install.

Offline

#24 2017-03-19 11:19

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,989

Re: how to organize kde-servicemenus?

bin wrote:

It looks as though the TMPDIR line is failing to read $HOSTNAME and so it errors

/opt/trinity/bin/kim_pelemele: 23: /opt/trinity/bin/kim_pelemele: let: not found
mktemp: failed to create directory via template ‘/home/robin/.trinity/tmp-/kim.X
XXXXXXX’: No such file or directory

This does not seem to be a universal failing - should the variable $HOSTNAME be defined at the start of the script?

Out of interest the use of let in BASH seems to be frowned on - not my territory I'm afraid

The problem is with "let", I have removed it so it should run ok now (version 2). $HOSTNAME is a bash system variable and will (should) be read ok.

bin wrote:

Does the sue of compteur as opposed to counter make a difference. It doesn't seem to cause problems with the resize etc scripts though it is noted as a variable for the progress dialogue - I think.......

I do not know at this point if it makes a difference, I have not really scrutinized the code as yet, I simply changed all the references from KDE / kde to TDE / tde, and changed the $HOST variable to $HOSTNAME.

bin wrote:

The HTML Gallery option works but the resulting gallery doesn't - index.html loads a page but the picture frames are empty - thumbnails.... The actual pics load but that's all - this is handled better by the Kong Image Gallery addon methinks.

I will look at the code again and see if there is anything I can tweak.

bin wrote:

It looks like this could be a good basis for a project to improve in various places. For example the email image script needs to know the preferred application for email - not sure how it would interact with Thunderbird.......

Again I will look at the code in more detail to see if there is an easy fix for this.

I will post an updated tar file when I have tested some improvements, and Thanks for the feedback. smile

EDIT:
As for the path to files I can change this easily and will request from devs to maybe include this path in base installation as it does seem to make sense to me. smile

Last edited by Dai_trying (2017-03-19 11:22)

Offline

#25 2017-03-19 11:32

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,989

Re: how to organize kde-servicemenus?

michaelk wrote:

My result is: does not work yet, unfortunately.
The output of ./install.sh:
snip...

You will need to install as root user (or use sudo to install).

michaelk wrote:

As said before: there must a tricky configuration problem connected with this issue. For the experts: if I ask as a normal user for „$PATH“ I get this

bash: /usr/local/bin:/opt/trinity/bin:/usr/bin:/bin:/usr/local/games:/opt/trinity/games:/usr/games: Datei oder Verzeichnis nicht gefunden

(„Datei oder Verzeichnis nicht gefunden“ - file or directory not found)

If you install as root (sudo) then everything should be working, I will be looking at changing the destination of these files to be better used by normal user.

Offline

Board footer

Powered by FluxBB