Author Topic: A categorized desktop menu for i3 using dmenu (or rofi or something else)  (Read 9912 times)

0 Members and 2 Guests are viewing this topic.

Offline boruch

  • Jr. Mitglied
  • **
  • Posts: 85
  • Skill: Intermediate
URL: https://github.com/Boruch-Baum/morc_menu

A while back, there was some discussion on the forum about the desirability of having some form of dmenu that would present applications the way many window managers do, organized by category. So, I wrote it. It's VERY customizable. The github project page has a tab for a wiki, and there I've put a plain-text, readable version of the script's man page.

I've chosen to call the script 'morc_menu', morc standing for "Manjaro OpenRC", because I like the sound "morc", and it's dedicated to Aaditya for his work on Manjaro OpenRC, which was what drew me to Manjaro from Debian. I also want to thank Chrysostomus for his input.

Please, if you have any suggestions, or notice any anomalies or bugs, let me know. It's best to file an 'issue' on github, but you can also send me a message here, or contact me via email (subject line: [morc_menu]).

If this is of enough interest and usefulness, the next step would be looking into how to package it, which would be a new milestone for me in Manjaro/Arch.

Offline oberon

  • Core Team
  • *****
  • Posts: 3858
  • I'm nice. Be new!
  • Branch: unstable
  • Desktop: i3, Deepin, Cinnamon
  • GPU Card: Intel ValleyView Gen7
  • GPU driver: Intel
  • Kernel: 4.1 / 4.4
  • Skill: Intermediate
Wow, boruch! Really exciting! :o 8) (I had heard some rumours already ... ::) ;) ;D
I will have a close look as soon as I can :D
Thank you very much!
manjaro is addictive ::)
* manjaro-i3  * manjaro-cinnamon  * manjaro-deepin

Offline oberon

  • Core Team
  • *****
  • Posts: 3858
  • I'm nice. Be new!
  • Branch: unstable
  • Desktop: i3, Deepin, Cinnamon
  • GPU Card: Intel ValleyView Gen7
  • GPU driver: Intel
  • Kernel: 4.1 / 4.4
  • Skill: Intermediate
How about packaging this for the AUR. Can you do it yourself or would you like some help with that? I'd offer to do that with pleasure.
And I have a suggestion right away: How about the script creates its .config automatically at user level at first run? From a packagers perspective it's kind of a no go to do that - on the other hand it's nice if it doesn't need to be done manually... ;)
manjaro is addictive ::)
* manjaro-i3  * manjaro-cinnamon  * manjaro-deepin

Offline oberon

  • Core Team
  • *****
  • Posts: 3858
  • I'm nice. Be new!
  • Branch: unstable
  • Desktop: i3, Deepin, Cinnamon
  • GPU Card: Intel ValleyView Gen7
  • GPU driver: Intel
  • Kernel: 4.1 / 4.4
  • Skill: Intermediate
2nd suggestion: package-names are not allowed to contain underscores, so you will need to call the package morc-menu instead of morc_menu . So it would probably be more consistent if the script would have the exact same name? What do you think?
manjaro is addictive ::)
* manjaro-i3  * manjaro-cinnamon  * manjaro-deepin

Offline boruch

  • Jr. Mitglied
  • **
  • Posts: 85
  • Skill: Intermediate
Thank you very much!
Your welcome. Glad to be of use.

How about packaging this for the AUR. Can you do it yourself or would you like some help with that? I'd offer to do that with pleasure.
OK. I'd like to try that. I don't know if  can do it myself because I've never tried, so it would be great to be able to turn to you if I have any trouble. Let's see what I can manage in the next few days.

And I have a suggestion right away: How about the script creates its .config automatically at user level at first run? From a packagers perspective it's kind of a no go to do that - on the other hand it's nice if it doesn't need to be done manually... ;)
A middle ground would be to add a small setup script in the github repository, and add to the morc_menu (or morc-menu) script a first-run action to create the user config dir, place a copy of the config file there, and notify the user. Another method would be to have morc menu add it own entries, maybe at the main level or maybe under settings, that perform specifc tasks such as installing the config file, restoring it to its default, and creating a static menu (suggested off-line by Chrysostomus). I could maybe turn the 'about' entry into a special form of sub-menu that both displays the 'about information' and offers those two execution options.

2nd suggestion: package-names are not allowed to contain underscores, so you will need to call the package morc-menu instead of morc_menu . So it would probably be more consistent if the script would have the exact same name? What do you think?
Ooops. I think you're right. Bad foresight on my part, but manageable. On the other hand, when I run at a command line  'apropos -s1 -r .* 2>/dev/null | cut -d" " -f1| grep _', I get 42 or 46 user commands with embedded underscores, depending upon whether I do it on my manjaro openrc i3 system or my manjaro openrc xfce system. Running the same command for "-" instead of "_" yields 477 or 520 (use grep option '-c'), which makes the presence of underscore characters in commands 8% as common as dashes, so while its not standard, its not unheard of. Further in support of keeping the current name, with the underscore,is that the command isn't intended to be run from the command line; its primarily meant for keybindings and scripts.  I then ran the same basic command line based upon 'pacman -Q' instead of 'apropos...' and get 9/362 and 11/345 occurrences for installed package names.
« Last Edit: 13. March 2016, 22:21:48 by boruch »

Offline oberon

  • Core Team
  • *****
  • Posts: 3858
  • I'm nice. Be new!
  • Branch: unstable
  • Desktop: i3, Deepin, Cinnamon
  • GPU Card: Intel ValleyView Gen7
  • GPU driver: Intel
  • Kernel: 4.1 / 4.4
  • Skill: Intermediate
OK. I'd like to try that. I don't know if  can do it myself because I've never tried, so it would be great to be able to turn to you if I have any trouble. Let's see what I can manage in the next few days.
I can provide the PKGBUILD if you like.
Quote
On the other hand, when I run at a command line  'apropos -s1 -r .* 2>/dev/null | cut -d" " -f1| grep _', I get 42 or 46 user commands with embedded underscores, depending upon whether I do it on my manjaro openrc i3 system or my manjaro openrc xfce system.
It's not a problem to use underscores in script names of course. That's just for packages... I just thought it would be more logical if the command you will need to use is the same as the package you install ;) It's not imperative at all :)
manjaro is addictive ::)
* manjaro-i3  * manjaro-cinnamon  * manjaro-deepin

Offline oberon

  • Core Team
  • *****
  • Posts: 3858
  • I'm nice. Be new!
  • Branch: unstable
  • Desktop: i3, Deepin, Cinnamon
  • GPU Card: Intel ValleyView Gen7
  • GPU driver: Intel
  • Kernel: 4.1 / 4.4
  • Skill: Intermediate
OOoops, my bad!
https://wiki.archlinux.org/index.php/PKGBUILD#pkgname says:
Quote
...should consist of lowercase alphanumerics and any of the following characters: @, ., _, +, -
OK. So, even morc@_+menu would be fine :o ;D
« Last Edit: 13. March 2016, 22:34:04 by oberon »
manjaro is addictive ::)
* manjaro-i3  * manjaro-cinnamon  * manjaro-deepin

Offline Chrysostomus

  • Maintainer
  • ***
  • Posts: 1634
  • Neckbeards are cool
    • Git
  • Branch: unstable
  • Desktop: Gnome, bspwm
  • GPU Card: Intel HD4000
  • GPU driver: free
  • Kernel: linux44-x64
  • Skill: Intermediate
If you need help with uploading the PKGBUILD to AUR, I can help. It is not hard and arch wiki has good documentation, but it took me a while to parse it to understand it myself.

Offline Chrysostomus

  • Maintainer
  • ***
  • Posts: 1634
  • Neckbeards are cool
    • Git
  • Branch: unstable
  • Desktop: Gnome, bspwm
  • GPU Card: Intel HD4000
  • GPU driver: free
  • Kernel: linux44-x64
  • Skill: Intermediate
I think having morc_menu create user level config file when ran is a good idea. But since it also reads global config file, it is not absolutely necessary. Global confog file can be copied and by user, since there is man page to inform about it.

But mostly I think creating user level config when ran is better.

Offline oberon

  • Core Team
  • *****
  • Posts: 3858
  • I'm nice. Be new!
  • Branch: unstable
  • Desktop: i3, Deepin, Cinnamon
  • GPU Card: Intel ValleyView Gen7
  • GPU driver: Intel
  • Kernel: 4.1 / 4.4
  • Skill: Intermediate
I notice that the menu takes surprisingly long to launch. Does anyone have a theory why that is and / or if there might be a way to improve that?
manjaro is addictive ::)
* manjaro-i3  * manjaro-cinnamon  * manjaro-deepin

Offline boruch

  • Jr. Mitglied
  • **
  • Posts: 85
  • Skill: Intermediate
I notice that the menu takes surprisingly long to launch. Does anyone have a theory why that is and / or if there might be a way to improve that?
That's not good. It was a prime goal of mine fr the script to run quickly. On my box it does. Oberon, could you run the script from the command line and see if any error messages are generated? Also, how long is "surprisingly"?

Offline oberon

  • Core Team
  • *****
  • Posts: 3858
  • I'm nice. Be new!
  • Branch: unstable
  • Desktop: i3, Deepin, Cinnamon
  • GPU Card: Intel ValleyView Gen7
  • GPU driver: Intel
  • Kernel: 4.1 / 4.4
  • Skill: Intermediate
Hm.
While dmenu opens almost instantly or a splitsecond after I press mod+d, morc_menu takes a little bit more than 2 seconds after pressing mod+z.
I get no error message in the terminal.
manjaro is addictive ::)
* manjaro-i3  * manjaro-cinnamon  * manjaro-deepin

Offline Chrysostomus

  • Maintainer
  • ***
  • Posts: 1634
  • Neckbeards are cool
    • Git
  • Branch: unstable
  • Desktop: Gnome, bspwm
  • GPU Card: Intel HD4000
  • GPU driver: free
  • Kernel: linux44-x64
  • Skill: Intermediate
For me, morc_menu is instantaneous. Both on ssd and hdd. But I might not have the latest version.

Is the delay persistent or do you get it only on first launch? It would make some sense if menu was generated every time, but it should be static.

Offline oberon

  • Core Team
  • *****
  • Posts: 3858
  • I'm nice. Be new!
  • Branch: unstable
  • Desktop: i3, Deepin, Cinnamon
  • GPU Card: Intel ValleyView Gen7
  • GPU driver: Intel
  • Kernel: 4.1 / 4.4
  • Skill: Intermediate
It's the same every time ...
manjaro is addictive ::)
* manjaro-i3  * manjaro-cinnamon  * manjaro-deepin

Offline boruch

  • Jr. Mitglied
  • **
  • Posts: 85
  • Skill: Intermediate
Hm.
While dmenu opens almost instantly or a splitsecond after I press mod+d, morc_menu takes a little bit more than 2 seconds after pressing mod+z.
I get no error message in the terminal.

May I ask you to try the following, and see if that changes the speed. From the command line: First run 'morc_menu buld all'; that should return a command prompt without displaying a menu. Then run 'morc_menu txt'; that should display a menu. This test divides up the morc_menu functions, so when you tell me which command took surprisingly long, I'll know a bit more the source of the delay.

BTW, posting the script to github has already gotten me feedback to fix several bugs I hadn't come across in my own testing. I've posted the commits for those fixes, but I don't think they would affect this issue.