You are not logged in.

#1 2016-01-13 02:29:43

o9000
tint2 developer
From: Network Neighborhood
Registered: 2015-10-24
Posts: 416
Website

Yet another start menu

This is a small script that displays a start menu:

https://gitlab.com/o9000/pmenu/blob/master/pmenu.py

The menu structure is not configurable. This is a feature. It auto-populates itself by reading all the .desktop and .directory files found in /usr/share, /usr/local/share, ~/.local/share and $XDG_DATA_DIRS.

See the readme for instructions: https://gitlab.com/o9000/pmenu/blob/master/README.md

Last edited by o9000 (2017-04-02 07:45:47)

Offline

#2 2016-01-13 07:49:10

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,279
Website

Re: Yet another start menu

Appreciated (been staring at the code on the bus smile), tryin to learn some python (really slowly).

Offline

#3 2016-01-13 08:45:29

ohnonot
...again
Registered: 2015-09-29
Posts: 5,445
Website

Re: Yet another start menu

o9000, this is so cool! because it took me less than a minute to get it working on my system big_smile


BL quote proposals to this thread please.

Offline

#4 2016-01-13 12:13:10

pvsage
Internal Affairs
Registered: 2015-09-29
Posts: 1,433

Re: Yet another start menu

Call it "yast" and it's gold.


Be excellent to each other, and...party on, dudes!
BunsenLabs Forum Rules
Tending and defending the Flame since 2009

Offline

#5 2016-01-13 13:08:37

Unia
Octo-portal-pussy
From: Stockholm, Sweden
Registered: 2015-09-17
Posts: 355
Website

Re: Yet another start menu

pvsage wrote:

Call it "yast" and it's gold.

YaST


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#6 2017-04-01 15:09:41

o9000
tint2 developer
From: Network Neighborhood
Registered: 2015-10-24
Posts: 416
Website

Re: Yet another start menu

I played a bit more with this script. It is now able to generate 3 types of menus:

* builtin GTK menu
* openbox pipe menu with icons
* output to be piped to jgmenu

It can also show custom buttons for logging out, locking the screen or accessing settings in openbox or xfce. This is optional.

With the latest tint2 from master, the builtin GTK menu aligns with tint2 (see screenshot).

pmenu.th.png

pmenu-pipea32ad.th.png

Tint2rc: http://paste.ubuntu.com/24293604/

To add it to the openbox pipe menus, add:

<menu execute="pmenu.py --mode openbox" id="pmenu" label="Pmenu" />

near the other "menu execute" items in ~/.config/openbox/menu.xml.

To play more:

pmenu.py --help

Last edited by o9000 (2017-04-01 15:13:34)

Offline

#7 2017-04-01 19:01:37

hhh
Meep!
Registered: 2015-09-17
Posts: 11,651
Website

Re: Yet another start menu

I'm about to boot into BL to play with this!

Offline

#8 2017-04-01 20:44:03

hhh
Meep!
Registered: 2015-09-17
Posts: 11,651
Website

Re: Yet another start menu

Awesome!

***** (<-- 5 star rating!)

Could you make your instructions/ReadMe more n00b friendly? It's a n00b friendly menu! For example (my n00b points and questions)...

The install script creates the directory ~/bin if you don't have it. If you don't want that directory in your home folder, you can move the pmenu.py file to /usr/local/bin or /usr/bin.

You can copy your menu code to anywhere in the Openbox menu.xml file, as long as it's nested in another "menu" section. For example, this puts it as the first entry in the default BL menu, under < menu id="root-menu" > (about line #40)...

                    bl-exit --poweroff
                </command>
            </action>
        </item>
    </menu>

    <menu id="root-menu" label="Openbox 3">
      <menu execute="pmenu.py --mode openbox" id="pmenu" label="Pmenu" />
        <separator/>
        <item label="Run Program">
            <action name="Execute">
                <command>

What's the *.desktop file for? Where does it go? (~/.local/share/applications)

The "Lock Screen" item runs slock. If you don't know that, you won't know to just type your password to unlock the screen!

If you want to have that item use light-locker instead, in pmenu.py change line #391 from "slock" to "bl-lock" in BL or "light-locker-command -l" in Debian.

Can I make this the default root-menu in Openbox and include openbox --reconfigure/--restart and systemd commands to reboot/shutdown/suspend/hibernate?

Thanks for your work on this, it's very cool!

P.S. The BL flame on the Pmenu Start Menu icon is blurry, can you point me to your sources? I can probably clean it up for you. smile

Offline

#9 2017-04-01 21:14:44

hhh
Meep!
Registered: 2015-09-17
Posts: 11,651
Website

Re: Yet another start menu

This is working on BL upgraded to stretch as well, I'm happy to report!

Offline

#10 2017-04-01 21:19:17

o9000
tint2 developer
From: Network Neighborhood
Registered: 2015-10-24
Posts: 416
Website

Re: Yet another start menu

Thanks for the feedback! I will reply tomorrow as it's pretty late here.

Offline

#11 2017-04-02 07:44:49

o9000
tint2 developer
From: Network Neighborhood
Registered: 2015-10-24
Posts: 416
Website

Re: Yet another start menu

I've updated the readme: https://gitlab.com/o9000/pmenu/blob/master/README.md

The pmenu.desktop file is useful if you want to add it as a tint2 launcher.

As for the blurry icon, I assume in the tint2 panel, you could play a bit with the icon size or the padding until it has the same size as the image file, then it won't appear blurry anymore.

Offline

#12 2017-04-02 09:45:23

hhh
Meep!
Registered: 2015-09-17
Posts: 11,651
Website

Re: Yet another start menu

^ Thanks, the ReadMe is great!

Offline

#13 2017-04-03 21:25:42

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: Yet another start menu

Thank you very much for this smile

Finishes off my BSDLabs desktop perfectly:

screenFetch-2017-04-03_22-23-14.th.png

cool


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#14 2017-04-03 22:27:54

geekosupremo
Member
Registered: 2016-04-27
Posts: 168

Re: Yet another start menu

Hawt Daym!

Looking good!

And again HoaS makes my head explode! I ... might need to try my hand at that.

Offline

#15 2017-04-04 15:25:27

o9000
tint2 developer
From: Network Neighborhood
Registered: 2015-10-24
Posts: 416
Website

Re: Yet another start menu

On another computer I've noticed that the pipe menu loads slowly (10 seconds) because of the GTK icon lookup. So I've added an option to generate the openbox static menu:

pmenu.py --mode openbox-static --wm openbox > ~/.config/openbox/menu.xml

The only downside is that it would have to be updated manually if applications are installed or removed, or if the icon theme is changed.

Offline

#16 2017-04-05 14:45:20

ohnonot
...again
Registered: 2015-09-29
Posts: 5,445
Website

Re: Yet another start menu

o9000 wrote:

The only downside is that it would have to be updated manually if applications are installed or removed

does apt have the option to define custom hooks, i.e. actions that are executed when installing/updating/removing?
that's how i'm updating my menus on archlinux.


BL quote proposals to this thread please.

Offline

#17 2017-04-05 18:26:16

o9000
tint2 developer
From: Network Neighborhood
Registered: 2015-10-24
Posts: 416
Website

Re: Yet another start menu

Yes it does. But it will run as root, not as the user, so it won't pick up entries from $HOME/.local/share/applications. So for my personal use it's irrelevant.

Offline

#18 2017-04-06 02:41:49

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 7,909
Website

Re: Yet another start menu

o9000 wrote:

On another computer I've noticed that the pipe menu loads slowly (10 seconds) because of the GTK icon lookup.

Is it possible to add an option for a menu without icons? (but still dynamically checking the .desktop files)
A plain-text menu would fit in with the rest of the Openbox menu anyway.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#19 2017-04-06 10:54:51

hhh
Meep!
Registered: 2015-09-17
Posts: 11,651
Website

Re: Yet another start menu

^ +1, I was thinking the same thing.

If that were the case, I could see us adopting pmenu as part of the default menu.

An all-icon menu is possible too, but it's sure to be slower.

Offline

#20 2017-04-07 06:48:48

ohnonot
...again
Registered: 2015-09-29
Posts: 5,445
Website

Re: Yet another start menu

o9000 wrote:

Yes it does. But it will run as root, not as the user, so it won't pick up entries from $HOME/.local/share/applications. So for my personal use it's irrelevant.

run it as

sudo -u o9000 ....

?


BL quote proposals to this thread please.

Offline

#21 2017-04-07 09:32:45

o9000
tint2 developer
From: Network Neighborhood
Registered: 2015-10-24
Posts: 416
Website

Re: Yet another start menu

Applications installed in $HOME are installed from source, not by the package manager. So the hook won't be executed.

Offline

#22 2017-04-07 19:30:05

ohnonot
...again
Registered: 2015-09-29
Posts: 5,445
Website

Re: Yet another start menu

archlinux pacman hooks definitely work in the desired manner:

  • i can define a custom hook that is run after each un/install and update

  • the update process, and so also the hook, runs as superuser

  • the hook calls a script that calls e.g. 'sudo -u ohnonot fbmenugen'

  • so menu generation is executed as a normal user and will pick up menu entries both in /usr/share as well as in ~/.local/share

my question was if hooks like that can be designed for apt.

Last edited by ohnonot (2017-04-07 19:33:03)


BL quote proposals to this thread please.

Offline

#23 2017-04-07 19:40:43

twoion
ほやほや
Registered: 2015-08-10
Posts: 3,173

Re: Yet another start menu

ohnonot wrote:

archlinux pacman hooks definitely work in the desired manner:

  • i can define a custom hook that is run after each un/install and update

  • the update process, and so also the hook, runs as superuser

  • the hook calls a script that calls e.g. 'sudo -u ohnonot fbmenugen'

  • so menu generation is executed as a normal user and will pick up menu entries both in /usr/share as well as in ~/.local/share

my question was if hooks like that can be designed for apt.

In /etc/apt/apt.conf.d, like this:

DPkg::Pre-Invoke       { "if [ -x /usr/bin/etckeeper ]; then etckeeper pre-install; fi"; };
DPkg::Post-Invoke      { "if [ -x /usr/bin/etckeeper ]; then etckeeper post-install; fi"; };
DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt || true";};

Things like "listening" for specific package updates is possible with DPKG triggers: https://wiki.debian.org/DpkgTriggers.

Altogether it's a lot more complicated than pacman for no clearly discernible benefit smile


There is no competition between bugs. When you combine two awesome bugs, you get a totally awesome bug.

Online

#24 2017-04-08 17:10:53

o9000
tint2 developer
From: Network Neighborhood
Registered: 2015-10-24
Posts: 416
Website

Re: Yet another start menu

johnraff wrote:

Is it possible to add an option for a menu without icons? (but still dynamically checking the .desktop files)

I've added an option to support this. Although I'd rather optimize by caching the icon/menu lookups instead of turning them off. Personally I don't like menus without icons.

It still has some quirks. @malm has pointed out that I do not handle correctly .desktop files that contain Terminal=true (for example midnight commander). That would require knowing which terminal to run (or a generic symlink to whatever the user has configured). I suppose there is a way to get that on BL, but I'm not sure how and if it works on other distros.

Offline

#25 2017-04-08 18:39:26

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

Re: Yet another start menu

You could try:

def terminals():
     try:
         terminal = (subprocess.getoutput                    
                    ("readlink -f $(command -v x-terminal-emulator)").split('/')[3].split('.')[0])     
     except:         
         terminal = None     
     return terminal

If terminal is None you could try to execute in Vte but that requires libvte to be installed.


Што ни оштровиди ум сагледати не може - љубав превазилази.

Offline

Board footer

Powered by FluxBB