You are not logged in.

#101 2017-03-05 12:47:52

malm
jgmenu developer
Registered: 2016-10-13
Posts: 531
Website

Re: jgmenu

^ Hi tynman

It's a simple

^sep()

in the description field (the first field).

So a menu file could like like this

Terminal,xterm
^sep()
Browser,firefox

There are a couple of jgmenurc options for it too:

sep_height   = 5
color_sep_fg = #ffffff 20

It also understands

^sep(some text)

Last edited by malm (2017-03-05 12:50:09)

Offline

#102 2017-03-05 13:11:59

malm
jgmenu developer
Registered: 2016-10-13
Posts: 531
Website

Re: jgmenu

I've updated the man pages.

See Lesson 9 of JGMENUTUTORIAL(7)

JGMENU(1)

Offline

#103 2017-03-05 13:14:52

tynman
Member
Registered: 2015-10-13
Posts: 84

Re: jgmenu

Thank you!

Offline

#104 2017-04-07 15:07:28

misko_2083
Member
Registered: 2016-05-24
Posts: 252

Re: jgmenu

Figured out how to use the jgmenu with the yad --list dialog
What is needed is another layer on top of yad dialog like gtk application in this case. Otherwise it's not going to work.

Ok, now a short how to. Two scripts are required, jgmenu, yad, xclip, firefox, python3-gi (gobject-introspection libraries):
1. Name it however you like, just change the path to the other script in this file

#!/bin/bash

function run_jgmenu
{
python3  << END
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
import subprocess

class jgMenu:
    def __init__(self):
        jgmenu = subprocess.Popen(['/home/misko/Desktop/jgmenu03', '$1'])
        stdoutdata, stderrdata = jgmenu.communicate()
        exit()

    def main(self):
        Gtk.main()

if __name__ == "__main__":

     app = jgMenu()
     app.main()
END
}
export -f run_jgmenu


 yad --list --column="#":text --column="Nick":text --width=500 --height=600 \
      --dclick-action='bash -c "run_jgmenu $1"' "1" "Misko" "2" "Damo" "3" "Malm" "4" "Head Without a Stick"

2. name it jgmenu03

#!/bin/bash

printf \
"Copy,sh -c 'echo $1 | xclip -selection clipboard',gtk-copy\n\
Google Search,firefox https://www.google.com/search?q=$1,google" \
      | jgmenu --at-pointer --stay-alive 2>/dev/null

http://i.imgur.com/BcKxlCXm.png

(edit) *Forgot to mention double-click on a yad list item to activate the menu.

To use it with buttons check this post

Last edited by misko_2083 (2017-04-07 15:16:04)

Offline

#105 2017-04-07 20:26:00

malm
jgmenu developer
Registered: 2016-10-13
Posts: 531
Website

Re: jgmenu

Wow. That's very clever, bordering on mind boggling.
I'm not near a machine, but will have a play tomorrow.

Offline

#106 2017-04-08 12:59:37

misko_2083
Member
Registered: 2016-05-24
Posts: 252

Re: jgmenu

If you can add "Paste" and "New Row" functionality that'd be perfect. smile
This yad --list dialog can listen for stdin data and can be cleared with echo -e '\f' before inserting new data.

Offline

#107 2017-04-08 22:35:13

malm
jgmenu developer
Registered: 2016-10-13
Posts: 531
Website

Re: jgmenu

^

Here is an alternative version. It avoids the python code and gtk dependency.
It also keeps all the code in one file.

#!/bin/bash

# In case jgmenu is already running in stay-alive mode
killall jgmenu >/dev/null

printf "%b" \
'Copy,cat /tmp/misko | xclip -selection clipboard,gtk-copy\n
Google Search,q=$(cat /tmp/misko | tr " " "+"); firefox https://www.google.co.uk/#q=$q,google\n' \
      | jgmenu --at-pointer --stay-awake --hide-on-startup &

yad --list --column="#":text --column="Nick":text --width=500 --height=600 \
      --dclick-action='bash -c "echo $1 >/tmp/misko; jgmenu_run"' "1" "Misko" "2" "Damo" "3" "Malm" "4" "Head Without a Stick"

test -e /tmp/misko && rm -f /tmp/misko
killall jgmenu >/dev/null

Do you mean "paste" and "new row" functionality for jgmenu or yad?

I found a bug in jgmenu whilst playing with this. I've just pushed a fix, so it'd advise pulling and re-compiling.

Last edited by malm (2017-04-08 22:38:07)

Offline

#108 2017-04-10 17:57:09

misko_2083
Member
Registered: 2016-05-24
Posts: 252

Re: jgmenu

malm wrote:

^
I found a bug in jgmenu whilst playing with this. I've just pushed a fix, so it'd advise pulling and re-compiling.

Thank you for fixing that bug, that makes things easier. I can run jgmenu without that py hack.
Your script works fine only on first run. After the second double-click on a yad list, it launces the pmenu.
Made some modifications and additions. Paste function is giving me a headake (xclip trouble), when pasting from external source. What can I do, I'm a lousy coder. smile

#!/bin/bash
test -e /tmp/yadpipe03 && rm -f /tmp/yadpipe03

# Named pipe initialization
export PIPE_03=/tmp/yadpipe03
mkfifo $PIPE_03
exec 3<> $PIPE_03

# Function to paste into new line (BROKEN)
# -----------------------------
function paste_new
{
  if ! xclip -selection clipboard -o 2>&1 >/dev/null; then
     :
  else
    echo "" > $PIPE_03
    xclip -selection clipboard -o 2>/dev/null | sed 's/\&/\&amp;/g' > $PIPE_03
  fi
}
# ------------------------------
export -f paste_new

# Function to (re)load data
# ------------------------------
function load_data
{
  local YAD_DATA=("1" "Misko" "2" "Damo" "3" "Malm" "4" "Head Without a Stick")
  for DATA in "${YAD_DATA[@]}";do echo "$DATA" | sed "s/\&/\&amp;/g" > $PIPE_03;done
}
# ------------------------------
export -f load_data

# Function to show the menu
# ------------------------------
function show_jg
{
  local EXEC_NEW='yad --form --field="Number":num --separator="" | sed "s/\&/\&amp;/g" > $PIPE_03; yad --form --field="Data":ce --separator="" | sed "s/\&/\&amp;/g" > $PIPE_03'
  local EXEC_COPY="echo '${@}' | xclip -selection clipboard"
  local EXEC_CLEAR='echo "\f" > $PIPE_03; load_data'
  local EXEC_GSEARCH="firefox \'https://www.google.com/#q=${@}\'"

killall jgmenu &>/dev/null

printf "%b" \
"New Row,$EXEC_NEW,gtk-new\n
Copy,$EXEC_COPY,gtk-copy\n
Paste in a New Row(Broken),paste_new,gtk-paste\n
Reload Data,eval $EXEC_CLEAR,gtk-refresh\n
Google Search,eval $EXEC_GSEARCH,google\n" \
      | jgmenu --at-pointer
}
# --------------------------------
export -f show_jg


# Main Dialog
yad --list --column="#":text --column="Nick":text --width=500 --height=600 \
      --dclick-action='bash -c "show_jg $1"' \
       --listen --print-all < $PIPE_03 &

# Load data
load_data

One thing; is there a way of changing the internal field separator in jgmenu? Does it only creates new menu items on new lines "\n"?
The icons were missing, when I tried something like this:

OIFS=$IFS
IFS="\t"

printf .... \
..... \t
..... \t
..... \t \
 | jgmenu

IFS=$OIFS

Offline

#109 2017-04-11 05:20:14

ohnonot
...again
Registered: 2015-09-29
Posts: 4,163
Website

Re: jgmenu

i don't know what your script is doing, but i noticed that you can eliminate a few pipes (each one opens a subshell) by using bash builtin string manipulation.

exampkle:

misko_2083 wrote:
#!/bin/bash
echo "$DATA" | sed "s/\&/\&amp;/g"
etc.

better:

echo "${DATA//&/&amp;}"

Offline

#110 2017-04-13 17:48:59

misko_2083
Member
Registered: 2016-05-24
Posts: 252

Re: jgmenu

ohnonot wrote:

i don't know what your script is doing, but i noticed that you can eliminate a few pipes (each one opens a subshell) by using bash builtin string manipulation.

exampkle:

misko_2083 wrote:
#!/bin/bash
echo "$DATA" | sed "s/\&/\&amp;/g"
etc.

better:

echo "${DATA//&/&amp;}"

Thanks, it's hard to get rid of the bad habbits. smile
The scrpipt is using jgmenu to manipulate with the data from yad --list dialog without closing that dialog. Just experimenting what jgmenu can do.
It cold be usefull if I decide to play with the zenity scripts I made for Linux Lite.
For example, I could use jgmenu to load different categories of software in Lite Software.
Lite Software
Or I could use it to add tasks in Lite Tweaks.
Lite Tweaks
Jerry (LL) has always insisted that we stick to zenity. I liked yad more, and now when I'm not in LL dev team I play with it even more. The problem is I don't have much free time as before.

Offline

#111 2017-05-02 20:56:49

malm
jgmenu developer
Registered: 2016-10-13
Posts: 531
Website

Re: jgmenu

@Misko, sorry I had missed these last couple of posts.

Your named pipe is neater than my simple tmp file smile

Although I think it would be easier to run jgmenu in short-lived mode for these yad scripts (recently added --simple for this).

Sorry to mess around with the defaults. I want to make it as easy as possible for those using jgmenu as a long-running start menu. Still early days smile

I'll have a play with yad. I'm sure between us we'll get there.

Offline

#112 2017-05-03 17:27:15

misko_2083
Member
Registered: 2016-05-24
Posts: 252

Re: jgmenu

@malm Hey no problem at all. smile
That is what you designed it for in the first place.

This is a very usefull project for the community. Thank you creating jgmenu.

Offline

#113 2017-05-08 17:31:54

malm
jgmenu developer
Registered: 2016-10-13
Posts: 531
Website

Re: jgmenu

@misko
I've had a play with the code you posted on 10 April.
I think it works very well smile It's a nice solution.
Regarding the "xclip problem", if you put

echo "" > $PIPE_03

after the xclip line too if works fine (unless I'm missing the point of what you expect it to do).

Offline

#114 2017-05-08 17:37:20

malm
jgmenu developer
Registered: 2016-10-13
Posts: 531
Website

Re: jgmenu

^ regarding the IFS, yes we use fgets() and then change '\n' to '\0', so it's very much '\n'.
I think I'd prefer to keep it as it is, but am of course happy to re-consider if it is going to help solve a problem.

Offline

#115 2017-05-13 14:07:03

misko_2083
Member
Registered: 2016-05-24
Posts: 252

Re: jgmenu

malm wrote:

@misko
Regarding the "xclip problem", if you put

echo "" > $PIPE_03

after the xclip line too if works fine (unless I'm missing the point of what you expect it to do).

Yes that works if I want to paste into the next available column. Pasting into column number 2 (Nick) sometimes work, sometimes not.

malm wrote:

^ regarding the IFS, yes we use fgets() and then change '\n' to '\0', so it's very much '\n'.
I think I'd prefer to keep it as it is, but am of course happy to re-consider if it is going to help solve a problem.

No problem at all.  smile
Though, maybe, sometimes setting the field separator could be usefull.

Offline

#116 2017-05-13 14:59:44

malm
jgmenu developer
Registered: 2016-10-13
Posts: 531
Website

Re: jgmenu

It worked consistently when I played with it.

Are you using --simple?

Does the xclip selection contain '\n' when you get the inconsistent behaviour?

If you're happy, I can commit this script to the jgmenu repo so that we make sure we talk about the same version.

Offline

#117 2017-05-13 15:19:38

malm
jgmenu developer
Registered: 2016-10-13
Posts: 531
Website

Re: jgmenu

I'm thinking of writing a jgmenuconf tool using shell + yad. It will probably be small and just cover some options that tint2conf doesn't.
Python+gtk/qt might be a more conventional choice, but I rather like yad smile

Offline

#118 2017-05-13 19:51:45

misko_2083
Member
Registered: 2016-05-24
Posts: 252

Re: jgmenu

malm wrote:

It worked consistently when I played with it.

Are you using --simple?

Does the xclip selection contain '\n' when you get the inconsistent behaviour?

If you're happy, I can commit this script to the jgmenu repo so that we make sure we talk about the same version.

Checked. Sorry it was an older version. Updated now.
Works. I will check that simple option.

malm wrote:

I'm thinking of writing a jgmenuconf tool using shell + yad. It will probably be small and just cover some options that tint2conf doesn't.
Python+gtk/qt might be a more conventional choice, but I rather like yad smile

Hey that's great. "Yell" if you need any help. smile

Last edited by misko_2083 (2017-05-14 15:15:13)

Offline

#119 2017-05-14 15:18:01

misko_2083
Member
Registered: 2016-05-24
Posts: 252

Re: jgmenu

jgmenu can be used in Thunar Custom Actions. smile

If jgmenu is used in the Thunar Custom Action, and the file name contains \n in it's name or path, it makes a fuzzy menu.
http://i.imgur.com/Dbje7Cn.png
Regular files and paths are ok.
Command used for the Custom Action:

killall jgmenu; printf "Mousepad,mousepad %f,mousepad\nFirefox,firefox %f,firefox" | jgmenu --simple  --at-pointer

Since it's possible to assign keyboard shortcuts to the Thunar Custom Actions,
after the file is selected a simple key/key-combo would launch the jgmenu. wink

E: Hmm, maybe, I can hack "Yet Another Start Menu" for this use.

Last edited by misko_2083 (2017-05-14 15:38:48)

Offline

#120 2017-05-21 00:53:12

tynman
Member
Registered: 2015-10-13
Posts: 84

Re: jgmenu

Malm,

I have been building a new system this weekend. When it came time to install jgmenu (which is now part of my "standard setup" (I love it smile )), I noticed one change in the Installation instructions on https://github.com/johanmalm/jgmenu since I did this the last time - you have added a handy new script, "install-debian-dependencies.sh".

Which is very nice enhancement, although I didn't notice it until after I had typed in all those "apt install" commands for the various lib*-dev packages. Anyway, I thought in the instructions,

./scripts/install-debian-dependencies.sh
mkdir ~/src && cd ~/src
git clone https://github.com/johanmalm/jgmenu.git
cd jgmenu
make
make install

the order is wrong, because the "install-debian-dependencies.sh" script won't exist until after you run the "git clone" command. I think the step to run the "install-debian-dependencies.sh" script needs to go between "cd jgmenu" and "make", as in:

mkdir ~/src && cd ~/src
git clone https://github.com/johanmalm/jgmenu.git
cd jgmenu
./scripts/install-debian-dependencies.sh
make
make install

Ben

Offline

#121 2017-05-21 06:42:58

malm
jgmenu developer
Registered: 2016-10-13
Posts: 531
Website

Re: jgmenu

Thanks. Good spot! I've changed it.

I'm delighted that you use+like it.
Depending on how old your jgmenurc is, you may do well to delete/update it smile to allow tint2 integration to take place (assuming you use tint2).
Do shout if there are any config mismatches between jgmenu+tint2. jgmenu should pick up on all the tint2 colour scheme and positioning automatically.

If you modify your tint2rc, you'll need to do a `killall jgmenu` to re-load the config (for the time being anyway).

In terms of "interfaces", beware that icon-caching has now been implemented in C and happens automatically, so there is no need to do `jgmenu_run cache` anymore.

I've got a few things to sort out before v0.5.2 (see the TODO2 file).

Offline

#122 2017-05-21 06:47:46

malm
jgmenu developer
Registered: 2016-10-13
Posts: 531
Website

Re: jgmenu

P.S.
  - We also honour bl-tint2zen, so it should work even if you don't use a plain tint2rc.
  - The recent addition of `jgmenu_run lx` is still a bit experimental. It's an alternative to pmenu and is just a front-end to libmenu-cache (LXDE's lib for parsing XDG menus). I've noticed a few peculiarities with it and will try to iron them out.

Offline

#123 2017-06-15 18:34:58

martix
Kim Jong-un Stunt Double
Registered: 2016-02-19
Posts: 1,267

Re: jgmenu

I'm not sure if it is - easily? - possible, but I'd like to suggest a menu configuration feature to consider: (Vertical) Mirroring.

The categories are on the left side and sub-menus open on the right side. In certain configurations (e.g. when the start button is in the upper right corner) the other way around would work more convenient.

Offline

#124 2017-06-15 22:45:18

malm
jgmenu developer
Registered: 2016-10-13
Posts: 531
Website

Re: jgmenu

Good to hear from you.
I'll have a go. Shouldn't be too hard. It'll have to be tomorrow/weekend though.

Offline

#125 2017-06-16 20:51:16

malm
jgmenu developer
Registered: 2016-10-13
Posts: 531
Website

Re: jgmenu

@martix: Like this?

WMTxb6Qt.png

The above example has the following jgmenurc:

tint2rules   = 0
item_halign  = right
arrow_string = <
menu_halign  = right

commit 9a5e6c9b

Offline

Board footer

Powered by FluxBB