Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 18 Sep 2019, 07:57
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Desktop
It was so obvious... :-) ...yet nobody saw it!
Post new topic   Reply to topic View previous topic :: View next topic
Page 2 of 3 [42 Posts]   Goto page: Previous 1, 2, 3 Next
Author Message
musher0

Joined: 04 Jan 2009
Posts: 14306
Location: Gatineau (Qc), Canada

PostPosted: Tue 02 Jun 2015, 03:53    Post subject:  

Hi, Puppus.

Sorry for the late reply. I was really tired yesterday.

About your implementation of an aemenu two posts up: yep, you got it! Smile
Works well. Now you know everything there is to knoiw about aemenu! Wink

BFN.

musher0

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 14306
Location: Gatineau (Qc), Canada

PostPosted: Tue 02 Jun 2015, 11:51    Post subject:  

Hello, all.

FWIW, the final code (for a while, anyway) is here. It doesn't change
the previous (English) layout.

It just adds a French translation, which has to have a flush-left layout [for
now, anyway; why, I don't know] instead of the centered one I had
managed to achieve in the English version. Oh well, you can't win them all,
can you?...

~~~~~~~~~
Also, this may be of note: scripts defaultvideoplayer and defaultmediaplayer
in /usr/local/bin are doubles. Remedy: make the first a link of the second.

Since the present defaults menu script doesn't pick up links -- Embarassed oops, I
had forgotten to tell you that! -- you'll have only one entry for this function
in the menu, while maintaining the appearance of a "defaultvideoplayer"
script if some other Puppy program needs it.

~~~~~~~~
Finally, we found and corrected two already, but I'd be grateful if you report
here any "zibarre"Smile behaviour in < defaultsomething > scripts. There's
probably an easy fix.

BFN.

musher0

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)

Last edited by musher0 on Tue 02 Jun 2015, 14:40; edited 2 times in total
Back to top
View user's profile Send private message 
Jasper

Joined: 25 Apr 2010
Posts: 1350
Location: England

PostPosted: Tue 02 Jun 2015, 14:13    Post subject:  

Hi musher0 et al,

To suit my personal preference, I made some small changes to the original script from musher0 to give:

Code:
#!/bin/sh
# /usr/local/bin/progs-default.sh
# But : créer un aemenu des logiciels par défaut
# dans PuppyLinux pour le gest. de fen. aewm, echinus ou autre.
# Dépendance : aemenu
# (c) musher0, 30 mai 2015.(English only version with small changes for Jasper)
####
cd /usr/local/bin/
ls -Algoh --file-type defau* | awk '$1 !~ /lrw/ && $7 !~ /.cdr/ && $7 !~ /.bak/ && $7 !~ /han/ { print $7 }' > liste-progs
echo "menu \"Default apps\"" > progs-default
for i in `cat liste-progs`;do
echo "cmd ${i#*t} $i" >> progs-default
done
echo "cmd \">        chooser\" /usr/bin/defaults-chooser" >> progs-default
aemenu -rc /usr/local/bin/progs-default
rm -f liste-progs

and the resulting menu was instantaneously available and I have not encountered any of the problems reported in musher0's post immediately above.

My regards

ADDENDUM

IMPORTANTLY: my thanks to musher0 as, in a post below, he has kindly both corrected and improved my above effort.
--------------

Last edited by Jasper on Tue 02 Jun 2015, 17:27; edited 1 time in total
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 14306
Location: Gatineau (Qc), Canada

PostPosted: Tue 02 Jun 2015, 14:38    Post subject:  

Hello, Jasper.

If it works, great! But I think there is an
Code:
echo end

missing just after the < done > line in your adapted script.

Then again, maybe I need new glasses! Sad

BFN.

musher0

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
Jasper

Joined: 25 Apr 2010
Posts: 1350
Location: England

PostPosted: Tue 02 Jun 2015, 15:10    Post subject:  

Hi musher0,

It would take you only seconds to try it and see how and if it works for you by displaying a single list of apps ending with the "chooser".

I'm happy and pleased.

My regards and thanks
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 14306
Location: Gatineau (Qc), Canada

PostPosted: Tue 02 Jun 2015, 16:48    Post subject:  

Jasper wrote:
Hi musher0,

It would take you only seconds to try it and see how and if it works for
you by displaying a single list of apps ending with the "chooser".

I'm happy and pleased.

My regards and thanks


Hi, jasper.

Yeah, it's ok, but it's still a syntax error to have the beginning menu
command and not the end command. Error notices may pile up in the
/tmp/xerrs.log error log.

You may also want to try this, which provides a straight 1-column list
with no header.
Code:
#!/bin/sh
# /usr/local/bin/progs-default.sh
# But : créer un aemenu des logiciels par défaut
# dans PuppyLinux pour le gest. de fen. aewm, echinus ou autre.
# Dépendance : aemenu
# (c) musher0, 30 mai 2015.(English only version with small changes for Jasper)
####
cd /usr/local/bin/
ls -Algoh --file-type defau* | awk '$1 !~ /lrw/ && $7 !~ /.cdr/ && $7 !~ /.bak/ && $7 !~ /han/ { print $7 }' > liste-progs
# echo "menu \"Default apps\""
> progs-default
for i in `cat liste-progs`;do
   echo "cmd ${i#*t} $i" >> progs-default
done
echo "cmd \">        chooser\" /usr/bin/defaults-chooser" >> progs-default
aemenu -rc /usr/local/bin/progs-default
rm -f liste-progs

Please note that I remarked the "menu" line.

BFN.

musher0

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
Jasper

Joined: 25 Apr 2010
Posts: 1350
Location: England

PostPosted: Tue 02 Jun 2015, 17:36    Post subject:  

Hi musher0,

Thank you for taking the time and trouble to not only correct my code, but to also improve it.

My regards

PS My changing the title to "Default apps" may seem petty - so I'm sending you an explanatory PM.
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 14306
Location: Gatineau (Qc), Canada

PostPosted: Tue 02 Jun 2015, 21:49    Post subject:  

Jasper wrote:
Hi musher0,

Thank you for taking the time and trouble to not only correct my code, but to also improve it.

My regards

PS My changing the title to "Default apps" may seem petty - so I'm sending you an explanatory PM.


Hi, Jasper.

Glad to see that my little script is being used. That's why I write them! Smile
About the change in title : don't worry about it! Wink

BFN.

musher0

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
Puppus Dogfellow


Joined: 07 Jan 2013
Posts: 1615
Location: nyc

PostPosted: Tue 02 Jun 2015, 21:56    Post subject: using ae menu to automate menu making (ae and jwm)  

musher0 wrote:
Hi, Puppus.

Sorry for the late reply. I was really tired yesterday.

About your implementation of an aemenu two posts up: yep, you got it! Smile
Works well. Now you know everything there is to knoiw about aemenu! Wink

BFN.

musher0


well, if there's a way to change the font size to override the rox or gtk settings it's using, it's not readily apparent, so, not quite. also not so sure what to make of the results of my help query:

Code:
sh-4.3# aemenu -h
usage: aemenu [--switch|-s] [--config|-rc <file>]



that aside, it's a fun and cool/nice and easy syntax--i've been using it to automate menu making, or, i've been playing around to see if it's possible and it appears it is.

Code:
 menu "jwm menu maker" # beginning of menu
cmd "jwmxx-leafpad-grab executables" "cd  /usr/share/applications; grep Exec= *.desktop | grep -o 'Exec=.*' | cut -f2- -d'=' > /root/my-documents/Text/jwmxx; leafpad /root/my-documents/Text/jwmxx
cmd "jwmxx-geany-grab executables" "cd  /usr/share/applications; grep Exec= *.desktop | grep -o 'Exec=.*' | cut -f2- -d'=' > /root/my-documents/Text/jwmxx; geany /root/my-documents/Text/jwmxx
 cmd "make a menu entry" "jwmkr"
cmd "add the menu template" "jwmenuplate"

 menu "ae menu maker"
cmd "ae menu item maker" "aeae"
cmd "ae menu slot maker" "aeaem"
end


end # end of menu



i wasn't able to get the jwmkr, jwmenuplate, aeae, or aeaem scripts to work correctly from either a jwm menu or an ae menu as bare code, but they all work fine if you call them from /root/my-applications/bin by the titles the above ae menu uses.

aeae

Code:
#! /bin/sh
# name aeae
# turn an executable into a menu item (aemenu)

xclip -o | sed 's/^/cmd "title-here" "/' | sed 's/$/\"/' | xclip -selection clipboard
xdotool type "`xclip -out -selection clipboard`"




aeaem
Code:
#! /bin/sh
# name aeaem
# ae menu slot template


xdotool type 'menu "title"
(your menu here)
end
'


jwmkr
Code:

#! /bin/sh
# name jwmkr
#  use on executables/ paths to executables
# adds jwm menu tags around a selection of text in any text editor
xclip -o | sed 's/^/<Program label="" icon="">/' | sed 's/$/<\/Program>/' | xclip -selection clipboard
xdotool type "`xclip -out -selection clipboard`"




jwmenuplate

Code:

#! /bin/sh
 #name jwmenuplate

xdotool type "<Menu label="pick a better title" icon="/path/to/img_wots_opt_icon.jpgpngsvg" height="16">


[delete this and place your entries here]

</Menu>
"



the two jwmxx entries (jwmxx-leafpad/geany-grab executables) strip the executable commands from the .desktop files in usr/share/applications. to make an off PATH executable, program, or script into a menu item for either aemenu or jwm, highlight its full path and click the appropriate menu-item maker. works for individual commands/paths or batches, separated by line break or space doesn't seem to matter though i usually rely on the former and i'm relying on memory to attest the latter works. you can mix commands and paths--the script (based on miriam's ht-b) appears to be looking for breaks in the continuity of text...

and, as i said, appears to work.

Very Happy
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 14306
Location: Gatineau (Qc), Canada

PostPosted: Tue 02 Jun 2015, 22:13    Post subject:  

Hi Puppus.

It's always great to see your work, but you lost me at jwmkr and sed.

(Is it an allergy? Do I have a couple of neurones missing? But I just can't
understand sed, sorry... )

TWYL.

musher0

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
Puppus Dogfellow


Joined: 07 Jan 2013
Posts: 1615
Location: nyc

PostPosted: Tue 02 Jun 2015, 22:33    Post subject:  

musher0 wrote:
Hi Puppus.

It's always great to see your work, but you lost me at jwmkr and sed.

(Is it an allergy? Do I have a couple of neurones missing? But I just can't
understand sed, sorry... )

TWYL.

musher0


i don't understand/am first becoming familiar with sed awk or grep myself--i mostly just reuse bits and pieces of other people's code. the sed usage above (reused an embolden this text script by miriam) is just to help surround whatever has been highlighted (mouse click or cursor shift, doesn't matter how) with the rest of the code for a menu entry, jwm in one case and ae in the other. i couldn't get the xdotool "type this thing with line breaks" command to work correctly on the menus, so i made separate scripts for them and call those instead. those basically print out a sandwich--label your bread, pick your filling.

jwmkr--make a jwm menu item
aeae --same for ae wm
the two menu scripts are mostly just spitting out what i figured i may be too lazy to type/i may not remember with enough confidence to forgo the second guess and double check.

the only thing that's really a tremendous time saver (assuming you can't type jwm syntax like it's your name) are those little grep and cut deals that give you the executables and open a file for you to work in. despite the names, they're not really jwm specific--a run command's a run command.
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 14306
Location: Gatineau (Qc), Canada

PostPosted: Fri 05 Jun 2015, 03:24    Post subject:  

@Jasper Wink

Code:
>simplest;for i in `ls -1 --file-type /usr/local/bin/default* | egrep -v '@|han|NON|non'`;do echo "cmd \"${i#*t}\" \"$i\"" >> simplest; done; aemenu -rc simplest


In regular script form it reads like this:
Code:
#!/bin/ash
# $MBINS/simplest.sh
####
# As a one-liner:
# > simplest;for i in `ls -1 --file-type /usr/local/bin/default* | egrep -v '@|han|NON'`;do echo "cmd \"${i#*t}\" \"$i\"" >> simplest; done; aemenu -rc simplest;rm -f simplest

# In regular script form:
> simplest

for i in `ls -1 --file-type /usr/local/bin/default* | egrep -v '@|han|NON'`
   do
      echo "cmd \"${i#*t}\" \"$i\"" >> simplest
   done

aemenu -rc simplest

rm -f simplest

# Note. The interesting thing about this little script is that you can call
# it from any folder, use it, and it doesn't leave a trace in the folder.


With this script, you can launch the Puppy defaults menu in whichever
folder your console is in, and when finished, it erases the temporary
menu file.

It's not fancy, it just displays the apps alphabetically, but it does the job.
And it leaves your folder clean.

BFN.

musher0
simplest.sh(1).zip
Description 
zip

 Download 
Filename  simplest.sh(1).zip 
Filesize  480 Bytes 
Downloaded  157 Time(s) 

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)

Last edited by musher0 on Fri 05 Jun 2015, 13:13; edited 2 times in total
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 14306
Location: Gatineau (Qc), Canada

PostPosted: Fri 05 Jun 2015, 03:34    Post subject:  

Hello, people.

On the other hand, some may prefer a solution with sub-menus.
(Note: don't be fooled. The picture there is in French, but English is built-in.)

Enjoy! Wink

musher0

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 14306
Location: Gatineau (Qc), Canada

PostPosted: Fri 05 Jun 2015, 03:37    Post subject:  

@Puppus

> despite the names, they're not really jwm specific -- a run command's a run command.

Ah. I see. Thanks for pointing it out. BFN.

musher0

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 14306
Location: Gatineau (Qc), Canada

PostPosted: Fri 05 Jun 2015, 13:07    Post subject:  

Hello,

Just a quick note to say that I've updated my 3rd post up with a true script
form and a zip file.

Best regards.

musher0

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 2 of 3 [42 Posts]   Goto page: Previous 1, 2, 3 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Desktop
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
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0859s ][ Queries: 13 (0.0118s) ][ GZIP on ]