JWM Right Click Substitute

Moderator: Forum moderators

User avatar
taersh
Posts: 951
Joined: Tue Jul 07, 2020 11:13 pm
Location: Germany
Has thanked: 53 times
Been thanked: 119 times

JWM Right Click Substitute

Post by taersh »

Hi.

JWM Right Click Substitute 1.0

Based on this Topic I wrote a small program to have ability in JWM/Rox Puppies to place a desktop icon for a program just by clicking its menu entry.

After installation you will find its menu entry Add a Program to the Rox Desktop almost on top of menu Desktop.

This is how it works after clicking :

  • makes a copy of /root/.jwmrc
  • makes a backup of /root/.jwmrc
  • grabs all commands from the copy into a separate file
  • adding a new command to those commands within the separate file
  • replacing original commands within the copy by the new commands from the separate file
  • replacing /root/.jwmrc by the modified copy of /root/.jwmrc
  • updating the JWM menu (jwm -reload)
  • brings up the JWM menu again to select a program from its whole content

Make sure your mouse pointer is placed above free space on the desktop.

The menu won't come up again and It doesn't create a desktop icon, if the mouse pointer is placed at a window.
The menu also won't come up again and It doesn't create a desktop icon, if the mouse pointer is placed at another desktop icon.

If that's the case the menu also won't rebuild again to start programs as usual.
You need to do a fixmenus and jwm -reload from terminal then, to get the working menu back!

Then you need to select the designated program by clicking it just as you would want to start it normally.

  • searches /usr/share/applications for a .desktop file containing the command of the clicked menu entry
  • if found, it places the .desktop file onto the desktop
  • the desktop icon is locked, so it can't be removed by accident
  • restoring the /root/.jwmrc file back to original
  • again updating the JWM menu (jwm -reload)

Done!

NOTE: this needs to have xdotool and replaceit installed. If you don't have them and if they aren't at the repository of your Puppy I can distribute them both. Xdotool is already available to download in the SFS PLUS topic. Replaceit is locally available in 32bit and 64bit. So, I could easily add them to this post.

Have fun creating desktop icons from a menu entry. :thumbup:

JWM-Right-Click-Substitute-1.0.pet
(13.14 KiB) Downloaded 143 times

Xdotool and Replaceit might be also available via PPM in the repositories of the dependent Puppy in use.

Xdotool download in the SFS PLUS topic

Replaceit64.pet
(4.66 KiB) Downloaded 108 times
Replaceit32.pet
(4.57 KiB) Downloaded 80 times
Last edited by taersh on Mon Nov 02, 2020 10:57 pm, edited 4 times in total.

My Music:
https://soundcloud.com/user-633698367
Using my own build of Bionic64
The far-left is as fascist as the far-right is!

User avatar
taersh
Posts: 951
Joined: Tue Jul 07, 2020 11:13 pm
Location: Germany
Has thanked: 53 times
Been thanked: 119 times

Re: JWM Right Click Substitute

Post by taersh »

Hi.

When creating multiple desktop icons too fast in a row, it could break the menu!

I discovered this right now by its heavy use in a plain FossaPup64.
So, I updated the package to make sure it won't run unless the previous call is completely finished.

There was already one single download. Please, download again the secure version.

Thanks!

My Music:
https://soundcloud.com/user-633698367
Using my own build of Bionic64
The far-left is as fascist as the far-right is!

User avatar
bigpup
Moderator
Posts: 6999
Joined: Tue Jul 14, 2020 11:19 pm
Location: Earth, South Eastern U.S.
Has thanked: 913 times
Been thanked: 1528 times

Re: JWM Right Click Substitute

Post by bigpup »

NOTE: this needs to have xdotool and replaceit installed. If you don't have them and if they aren't at the repository of your Puppy I can distribute them both.
It would be nice if you could attach them to this topic!!!

The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected :o

User avatar
taersh
Posts: 951
Joined: Tue Jul 07, 2020 11:13 pm
Location: Germany
Has thanked: 53 times
Been thanked: 119 times

Re: JWM Right Click Substitute

Post by taersh »

I attached Replaceit in 32bit and 64bit to the opening post.
But I wasn't allowed either to attach more than 3 attachments or even to attach again Xdotool.

So, I posted again a link to Xdotool above the attachments of Replaceit.

My Music:
https://soundcloud.com/user-633698367
Using my own build of Bionic64
The far-left is as fascist as the far-right is!

User avatar
bigpup
Moderator
Posts: 6999
Joined: Tue Jul 14, 2020 11:19 pm
Location: Earth, South Eastern U.S.
Has thanked: 913 times
Been thanked: 1528 times

Re: JWM Right Click Substitute

Post by bigpup »

I am still checking out your program in Fossapup64 9.5.
Thanks for adding the other needed software links.

In another topic 666philb posted about this in Fossapup64 9.5 and maybe other Puppies made with Woof-CE.
In a terminal:

Code: Select all

mm_menuinfo
This seems to be doing basically the same thing as your program.
It is already in Fossapup.

Maybe something you want to look at to see how it is working.

The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected :o

User avatar
bigpup
Moderator
Posts: 6999
Joined: Tue Jul 14, 2020 11:19 pm
Location: Earth, South Eastern U.S.
Has thanked: 913 times
Been thanked: 1528 times

Re: JWM Right Click Substitute

Post by bigpup »

the desktop icon is locked, so it can't be removed by accident
Why lock it?
Non of the other desktop icons are locked.

This threw me a curve in testing and trying to remove an icon I made with your program.
I was use to how the icons could be removed by right clicking on them and selecting remove item.
But your programs icons had remove item grayed out.
Had to go into icon edit item and uncheck locked.
Then I could remove item.

I would think, removing a desktop icon should be the same, as the ones that are on the desktop, as default.
Last edited by bigpup on Sun Oct 04, 2020 2:35 am, edited 1 time in total.

The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected :o

User avatar
taersh
Posts: 951
Joined: Tue Jul 07, 2020 11:13 pm
Location: Germany
Has thanked: 53 times
Been thanked: 119 times

Re: JWM Right Click Substitute

Post by taersh »

No, it's not working in my OS.

The file /root/.jwmrc contains some stuff that's not supported by mochi's mm_menuinfo.

I don't want to change my structure of /etc/xdg/templates/_root_.jwmrc again, as I have three different JWM menus.
Left-click, middle-click and right-click. There is some parts equal in all menus and I'm using e.g. <Include>FileHere</Include> within the <RootMenu></RootMenu> structure to have these parts available in all menus. This is not supported by mm_menuinfo. To be able to use mm_menuinfo, II would need to change three different files in /etc/xdg/templates.

However, meanwhile I have extended the JWM Right Click Substitute for my own needs. So, It's now able to add desktop icons from all these three menus. I'm pretty satisfied with that solution by now.

My Music:
https://soundcloud.com/user-633698367
Using my own build of Bionic64
The far-left is as fascist as the far-right is!

User avatar
taersh
Posts: 951
Joined: Tue Jul 07, 2020 11:13 pm
Location: Germany
Has thanked: 53 times
Been thanked: 119 times

Re: JWM Right Click Substitute

Post by taersh »

bigpup wrote: Sun Oct 04, 2020 2:25 am
the desktop icon is locked, so it can't be removed by accident
Why lock it?
Non of the other desktop icons are locked.
As I said: it can't be removed by accident. From my experience e.g right-clicking a desktop drive icon very often accidentally removes the desktop drive icon. So, in my system all the desktop icons are locked, including the drive icons.

You can edit /usr/local/JWM-Right-Click-Substitute/lp2_add_desktop_button at line 78:
Add_To_Desktop='<icon x="'$Size_w'" y="'$Size_h'" label="'$DEntryCut'" locked="true">'$ATD'</icon>'
changing locked="true" to locked="false"

My Music:
https://soundcloud.com/user-633698367
Using my own build of Bionic64
The far-left is as fascist as the far-right is!

User avatar
greengeek
Posts: 1384
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 535 times
Been thanked: 192 times

Re: JWM Right Click Substitute

Post by greengeek »

Very nice utility.

Do you have anything similar that can place the icon in the quick launch tray?

That would be fantastic if the user could pick a program from the main menu and have a new icon appear in the tray for launching that program.

My desktop is usually covered and a desktop icon more difficult to get to.
User avatar
taersh
Posts: 951
Joined: Tue Jul 07, 2020 11:13 pm
Location: Germany
Has thanked: 53 times
Been thanked: 119 times

Re: JWM Right Click Substitute

Post by taersh »

This would be a nice addition, I think.
Though currently I don't have anything like that on my hands.
Could be added to this program just by a small Xdialog GUI to choose either to have a Desktop icon or Tray launch icon.

But, this could be hard to develop, as there's the other JWM with the horrible templates for multiple trays etc.

I'll try to do my best to have such option as well. :thumbup2:

My Music:
https://soundcloud.com/user-633698367
Using my own build of Bionic64
The far-left is as fascist as the far-right is!

User avatar
mikewalsh
Moderator
Posts: 6163
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 795 times
Been thanked: 1983 times

Re: JWM Right Click Substitute

Post by mikewalsh »

@taersh /@greengeek :-

You could also add it into the notification area, Ian; remember that variation on my original brightness slider I knocked together for you with the pinstall script, that placed the icon over on the right-hand side as soon as you installed it?

We had to do it that way because you run without a save, from what I recall...

Code: Select all

#!/bin/sh
#
#YAD 'one-liner' from musher0 / fredx181, to place executable tray icon in notification area
#
yad --notification --text="Brightness and tint" --command='/usr/local/bin/EMBC.sh' --image='/usr/local/lib/X11/pixmaps/Bright.png' 2>/dev/null
I'm sure Rainer could modify that to use GTKdialog rather than YAD, plus whatever commands/icons are relevant. Just a thought, you understand. Do remember, that anything in the tray (whether in the Quick Launch area, or the notification area), would require at least a re-start of JWM to remove when finished with it, too.....so that would need to be incorporated somewhere along the line as well.


Mike. ;)
User avatar
taersh
Posts: 951
Joined: Tue Jul 07, 2020 11:13 pm
Location: Germany
Has thanked: 53 times
Been thanked: 119 times

Re: JWM Right Click Substitute

Post by taersh »

This script does nothing in my OS.
Even running from terminal does nothing.

Btw.: jwm -restart will refresh the Tray also.

My Music:
https://soundcloud.com/user-633698367
Using my own build of Bionic64
The far-left is as fascist as the far-right is!

User avatar
mikewalsh
Moderator
Posts: 6163
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 795 times
Been thanked: 1983 times

Re: JWM Right Click Substitute

Post by mikewalsh »

taersh wrote: Wed Oct 28, 2020 9:20 pm This script does nothing in my OS.
Even running from terminal does nothing.

Btw.: jwm -restart will refresh the Tray also.
@Rainer:-

I wasn't offering it as a 'working' example of anything, other than the fact that it can be used to place an executable icon into a Puppy's notification area. For a start, you haven't got the icon it needs, nor the shell script the icon will execute when clicked on...

I was offering it as a template.....an example by means of which it is possible to place an icon (of your choice) into the notification area. That icon, when clicked upon, will then 'launch' whatever you've pointed it at. I was thinking of it in terms of an alternative means of launching a program from your original subject in post #1, i.e. an icon in the 'tray' area instead of an icon on the desktop.

Of course, it's ultimately your choice. It WAS only a suggestion, inspired by greengeek's request for the icons generated by your script to be placed in the QuickLaunch area rather than the desktop. I know this particular method works, since I've been using it for all sorts of things for more than 3 years.

Feel free to ignore it if you wish. Your decision. It's only offered as one possible way in which your app could be enhanced, that's all.


Mike. :roll:
User avatar
taersh
Posts: 951
Joined: Tue Jul 07, 2020 11:13 pm
Location: Germany
Has thanked: 53 times
Been thanked: 119 times

Re: JWM Right Click Substitute

Post by taersh »

Ah, Ok, I see.

Tested it, used Abiword icon and Leafpad for the command and it works now. :lol:

Thanks for explanation. ;)

My Music:
https://soundcloud.com/user-633698367
Using my own build of Bionic64
The far-left is as fascist as the far-right is!

User avatar
greengeek
Posts: 1384
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 535 times
Been thanked: 192 times

Re: JWM Right Click Substitute

Post by greengeek »

Hi taersh,
Can you help me to understand a part of this utility please?
As far as i can tell from reading the code the "right-click" script must already be running at the time when you use xdotool to bring up the desktop menu (at the end of "right-click-actions" script) - so that the submenu entry can then be selected for use.

And then - as far as I can tell - the "right-click" script accepts the submenu entry (from the user click) and uses it to locate the desktop file. etc

But - I cannot see how the "right-click" script gets started? How do you start it so that it is running in the background at the time where the user clicks the submenu entry?

Cheers!
User avatar
taersh
Posts: 951
Joined: Tue Jul 07, 2020 11:13 pm
Location: Germany
Has thanked: 53 times
Been thanked: 119 times

Re: JWM Right Click Substitute

Post by taersh »

Ok, its name seems to be a little confusing.

I had chosen the name JWM Right Click Substitute because of MS Windows.
In Windows one can do a right-click on a menu entry and then to choose different actions by a context menu.
Actions could be to create a symbolic link at the desktop etc.

This here program is a substitute for such right-click action.

You will find its menu entry Add a Program to the Rox Desktop almost on top of menu Desktop. When clicking that entry the menu is rebuild to not to execute the program of the menu entry itself, but to execute the action which will place the menu's .desktop file at the desktop.

Xdotool is used to bring up the menu again after it was rebuild, so that the user can choose a menu entry to be placed at the desktop. After the desktop icon is created the menu is rebuild again and will work afterwards as usual.

Hope that helps for understanding...

Edit:

Since I'm not a native English speaker any suggestions are welcome to make the description in the opening post more clear for a better understanding!

My Music:
https://soundcloud.com/user-633698367
Using my own build of Bionic64
The far-left is as fascist as the far-right is!

User avatar
greengeek
Posts: 1384
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 535 times
Been thanked: 192 times

Re: JWM Right Click Substitute

Post by greengeek »

taersh wrote: Sat Oct 31, 2020 11:23 am Xdotool is used to bring up the menu again after it was rebuild, so that the user can choose a menu entry to be placed at the desktop. After the desktop icon is created the menu is rebuild again and will work afterwards as usual.
Clever! Thanks for the explanation.
Since I'm not a native English speaker any suggestions are welcome to make the description in the opening post more clear for a better understanding!
Your opening post was definitely clear enough - i just needed a bit more information so i could understand how the selection from submenu was able to trigger the copying of the desktop file contents (because I am trying to copy the code for a different use...) ;)

After your explanation above I understand now how the selection works. (thanks!)

When i saw that you copied the whole desktop file i thought maybe that would work also for the quicklaunch icon so I tried to add a tray launcher icon by using "exec:geany.desktop" in the <pager> spec but unfortunately it did not work :(

If that had worked i could have easily used your code to add tray icons but i think what i need to is extract desktop file icon and exec parameter contents rather than just trying to use the whole desktop file as worked ok for your desktop copy.

I have been using the following code to add a quicklaunch icon:

Code: Select all

#! /bin/bash
sed -i 's/<Pager\/>/\n<TrayButton popup="Files" icon="\/usr\/local\/lib\/X11\/themes\/JQ8raised\/home48.png" border="true">exec:rox<\/TrayButton>\n<Pager\/>/g' /root/.jwmrc-tray
jwm -restart
and it works fine... but my problem is identifying which menu entry is clicked (i am going to borrow your code for that :twisted: ) and then try extracting the popuptext/icon/exec info from the desktop file and grafting it into the pager code.
eg:

Code: Select all

#! /bin/bash
TEXTPOPUP=$...
ICON=$...
EXEC=$...
sed -i 's/<Pager\/>/\n<TrayButton popup="$TEXTPOPUP" icon=$ICON" border="true">exec:$EXEC<\/TrayButton>\n<Pager\/>/g' /root/.jwmrc-tray
jwm -restart
I don't use a savefile so i don't know if such a method is going to be safe for anyone else...
User avatar
mikewalsh
Moderator
Posts: 6163
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 795 times
Been thanked: 1983 times

Re: JWM Right Click Substitute

Post by mikewalsh »

@taersh :-

Works very nicely, Rainer. Thanks muchly!


Mike. ;)
User avatar
taersh
Posts: 951
Joined: Tue Jul 07, 2020 11:13 pm
Location: Germany
Has thanked: 53 times
Been thanked: 119 times

Re: JWM Right Click Substitute

Post by taersh »

Removed!

The posted information was completely WRONG!
Need to check this again...

Sorry. :oops:
Last edited by taersh on Sun Nov 01, 2020 6:15 pm, edited 2 times in total.

My Music:
https://soundcloud.com/user-633698367
Using my own build of Bionic64
The far-left is as fascist as the far-right is!

User avatar
mikewalsh
Moderator
Posts: 6163
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 795 times
Been thanked: 1983 times

Re: JWM Right Click Substitute

Post by mikewalsh »

Working sweetly in Sailor's Slacko 571, after a troll round /ubuntu/pool to track down age-related versions of replaceit, libxdo & xdotool for the Slackware 14.0 base.

This really is an excellent utility, Rainer. Thank you SO much. Should speed-up future custom installs even more. Cheers!


Mike. ;)
User avatar
taersh
Posts: 951
Joined: Tue Jul 07, 2020 11:13 pm
Location: Germany
Has thanked: 53 times
Been thanked: 119 times

Re: JWM Right Click Substitute

Post by taersh »

Removed, problem solved.

My Music:
https://soundcloud.com/user-633698367
Using my own build of Bionic64
The far-left is as fascist as the far-right is!

User avatar
taersh
Posts: 951
Joined: Tue Jul 07, 2020 11:13 pm
Location: Germany
Has thanked: 53 times
Been thanked: 119 times

Re: JWM Right Click Substitute

Post by taersh »

Got it working now to create either a desktop icon or tray icon.
I'd sent updated parts to greengeek asking to make some testings.
If testings are successful I will upload version 1.1 to create either a desktop icon or tray icon from menu entries.

My Music:
https://soundcloud.com/user-633698367
Using my own build of Bionic64
The far-left is as fascist as the far-right is!

User avatar
mikewalsh
Moderator
Posts: 6163
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 795 times
Been thanked: 1983 times

Re: JWM Right Click Substitute

Post by mikewalsh »

taersh wrote: Sun Nov 01, 2020 11:00 pm

Got it working now to create either a desktop icon or tray icon.
I'd sent updated parts to greengeek asking to make some testings.
If testings are successful I will upload version 1.1 to create either a desktop icon or tray icon from menu entries.

Yes, please..! That would be brilliant. :D

Mike. ;)

User avatar
taersh
Posts: 951
Joined: Tue Jul 07, 2020 11:13 pm
Location: Germany
Has thanked: 53 times
Been thanked: 119 times

Re: JWM Right Click Substitute

Post by taersh »

@mikewalsh
Would you like to test it?

My Music:
https://soundcloud.com/user-633698367
Using my own build of Bionic64
The far-left is as fascist as the far-right is!

User avatar
mikewalsh
Moderator
Posts: 6163
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 795 times
Been thanked: 1983 times

Re: JWM Right Click Substitute

Post by mikewalsh »

@taersh :-

Yes please, Rainer.....I would. Leave me details, please, and I'll get back to you tomorrow sometime.....I'm now turning in for the night!

Mike. ;)

User avatar
taersh
Posts: 951
Joined: Tue Jul 07, 2020 11:13 pm
Location: Germany
Has thanked: 53 times
Been thanked: 119 times

Re: JWM Right Click Substitute

Post by taersh »

Ok, script sent by PM.

My Music:
https://soundcloud.com/user-633698367
Using my own build of Bionic64
The far-left is as fascist as the far-right is!

User avatar
greengeek
Posts: 1384
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 535 times
Been thanked: 192 times

Re: JWM Right Click Substitute

Post by greengeek »

taersh wrote: Sun Nov 01, 2020 11:00 pm

Got it working now to create either a desktop icon or tray icon....

V1.1 test version working pretty well on Tahr32. Definitely works to create either desktop icon or tray icon. (Not so successful on upuBB32 testing yet).
Some minor bugs in other pups that i am trying to identify but i think this is going to be a great utility!

User avatar
mikewalsh
Moderator
Posts: 6163
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 795 times
Been thanked: 1983 times

Re: JWM Right Click Substitute

Post by mikewalsh »

@taersh :-

What can I say, mate? For me, it works 100%, although I have only tried it in my "daily driver" so far.....jrb's 'light' take on Barry's original 64-bit Quirky April 7.0.1. It's definitely fixed a problem I have here, though, since for some reason radky's JWMDeskManager would never function correctly here.....it seems to 'interfere' with a number of other things.

I know BK used these for experimenting, so I'm not quite sure what those changes were. Mind you, I am running Fossapup's k5.4.53 kernel in this one; perhaps there's something there? (If there IS, then Xenialpup's k4.9.58 used to interfere in exactly the same way..!)

(I've HAD to change kernels in Quirky April, since the original 3-series would never enable audio. The chip in this modern HP desktop is simply too new for the 3-series; they don't recognise it.)

The UK's going back into a 4-week national lockdown from Thursday, so I have to pop into town for a couple of hours. I'll test some of the other Pups a bit later, and let you know the results; I'll get back to you on those.

But I'll echo Ian.....this is going to be a very useful addition to the arsenal for some of us!

Cheers.

Mike. ;)

Last edited by mikewalsh on Wed Nov 04, 2020 10:04 am, edited 1 time in total.
User avatar
mikewalsh
Moderator
Posts: 6163
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 795 times
Been thanked: 1983 times

Re: JWM Right Click Substitute

Post by mikewalsh »

Update:-

Working very nicely in the 32-bitzers, too.....in this case, Sailor's Slacko 5.7.1, and radky's DPup 'Stretch' 7.5. No issues for me, though I'm not so sure about Ian, because I know he usually likes to run with a re-mastered LiveCD and no 'save'.

Guess we wait to hear about further developments..... (shrug)

A big :thumbup: from me, at any rate.

Mike. ;)

User avatar
greengeek
Posts: 1384
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 535 times
Been thanked: 192 times

Re: JWM Right Click Substitute

Post by greengeek »

mikewalsh wrote: Mon Nov 02, 2020 2:24 pm

Working very nicely in the 32-bitzers, too.....in this case, Sailor's Slacko 5.7.1, and radky's DPup 'Stretch' 7.5. No issues for me, though I'm not so sure about Ian, because I know he usually likes to run with a re-mastered LiveCD and no 'save'.

Hi Mike, I am finding good success with most pups but for some reason I cannot duplicate your success with Radky's Dpup Stretch.

I'm wondering if I am using a different version of xdotool or replaceit and maybe that is causing my issue?

Are you able to point me to the versions you are using please?

Cheers!

Post Reply

Return to “Utilities”