Comments (32)
I like "bringing out the lab
". Very puppy-like.
I've had a quick go. Still not working very well though 😄
from labwc.
First attempt pushed. It'd doesn't supported nested (inline) definitions yet.
from labwc.
Excellent.
Video looks great.
Just an idea - maybe we ought to create a labwc organization (github.com/labwc) and move the whole repo there.
Then we could add separate repos for
- labwc-gnome-menus (yours)
- labwc-gnome-menus-3.0 (just had a quick play and reckon it would be fairly quick to do - with gio, etc)
- labwc-lxmenu (I have the structure for this in jgmenu/contrib)
- labwc-garcon (for xfce users)
from labwc.
Great question. My quick thoughts are outlined below.
In the interest of keeping labwc small and maintainable, I prefer the feature
set of the built-in menu to be pretty small. Having developed jgmenu I know
how easy it is to over-do it 😄
In my opinion, the most sensible way forward is to have a very limited built-in
menu and to use layer-shell clients for more feature rich menus. I'm not aware
of any openbox/JWM style wayland clients.
So where do we draw the line? Here is a proposal:
Built-in menu
- Read openbox style menu.xml [already done]
- Separators
- Submenus
Layer-shell client
- Icons
- Pipe-menus
- Search
- Auto-refresh when new apps installed
- Read xdg menu spec
- Read read menu.xml as well as .desktop + .directory files
For a layer-shell client I think it would be best to avoid GTK/Qt.
from labwc.
A layer-shell client would be a lot of work. I am familiar with xlib code and wrote a few xlib programs and a library ( pmclock - a configurable desktop analogue clock, pmdesktop - a simple library that finds a wm's desktop window ID and cairo-msg - displays a splash message on screen ). I'm not a trained programmer either, though I did learn some basic java in a network engineering diploma but that was mostly windows 7 and server based, though I completed the course mostly running Fedora!
I probably don't have time until Christmas to dive into wlroots and layer-shell, and I don't know if I have the inclination.
Another idea though, if I could develop a cli menu generator similar to the one above that just displays the categories and once clicked a category that menu opens up and the category menu closes, generated by an option to the cli program like this: -g, --generate-categories : generate individual menus for each category
from labwc.
Nice apps. You're code looks very neat 😄
I'll have a got at implementing submenus (but not icons). That way we can show xdg-menus.
Probably won't have time to look until next week though.
from labwc.
I'm working on this now.
TODO:
- Parsing sub-menus in menu.xml
- Render sub-menus and handle cursor movements and button presses
- Handle some basic keys such as arrows and escape
- Fit within output geometry
- Support hover-delay (i.e. delay before showing sub-menu when hovering over sub-menu item)
- Support nested menus
- Support
<separator>
from labwc.
Thanks for looking at this. IMHO this will allow labwc
to be more user friendly and and a good step to bringing it out of the 'lab'.
from labwc.
I like "bringing out the
lab
". Very puppy-like.
Was early morning when I posted and that thought hadn't occurred to me. It gives me a good idea for a wallpaper at least when I can get a labwc
based puppy ready for testing. 😄
from labwc.
In Puppy, JWM uses dynamic menus. I certainly don't expect labwc
to support this so I've raised an issue on gtkdialog to support gtk-layer-shell
.
from labwc.
In Puppy, JWM uses dynamic menus. I certainly don't expect
labwc
to support this so I've raised an issue on gtkdialog to supportgtk-layer-shell
.
What is a dynamic menu? It is like a pipe-menu in openbox?
from labwc.
What is a dynamic menu? It is like a pipe-menu in openbox?
Yes, similar
from labwc.
First attempt pushed. It'd doesn't supported nested (inline) definitions yet.
Working great for me with very minor issue (gap - see screencap)
<openbox_menu>
<menu id="submenu0" label="Net">
<item label="Browser">
<action name="Execute"><command>$BROWSER</command></action>
</item>
<item label="Torrent">
<action name="Execute"><command>transmission-gtk</command></action>
</item>
</menu>
<menu id="submenu1" label="Doc">
<item label="Word Processor">
<action name="Execute"><command>abiword</command></action>
</item>
<item label="Spread Sheet">
<action name="Execute"><command>gnumeric</command></action>
</item>
<item label="Text Editor">
<action name="Execute"><command>geany</command></action>
</item>
<item label="PDF Viewer">
<action name="Execute"><command>evince</command></action>
</item>
</menu>
<menu id="submenu2" label="Graphic">
<item label="Image Viewer">
<action name="Execute"><command>imgview</command></action>
</item>
<item label="Image Editor">
<action name="Execute"><command>mtpaint</command></action>
</item>
</menu>
<menu id="submenu3" label="Utility">
<item label="Terminal">
<action name="Execute"><command>lxterminal</command></action>
</item>
<item label="Processes">
<action name="Execute"><command>lxtask</command></action>
</item>
</menu>
<menu id="root-menu" label="">
<menu id="submenu0" />
<menu id="submenu1" />
<menu id="submenu2" />
<menu id="submenu3" />
<item label="____________">
</item>
<item label="Exit">
<action name="Exit"></action>
</item>
<item label="Reconfigure">
<action name="Reconfigure"></action>
</item>
</menu>
</openbox_menu>
from labwc.
That’s good.
Regarding the gap, sorry I just hard-coded a value of 10 with a TODO note.
I will implement theme option menu.overlap.x
http://openbox.org/wiki/Help:Themes#menu.overlap.x
from labwc.
I re-coded the menu generator and use a template script to build the menu. Works great!
See screen recording:
recording.mp4
from labwc.
The code for labwc-xdgmenu
/**
* labwc-xdgmenu
*
* This command line application generates an OpenBox menu XML segment based on
* an Xdg menu structure. Adapted for labwc <https://github.com/johanmalm/labwc>
*
* Usage: labwc-xdgmenu <Xdg menu file>
*
* Copyright (C) Nathan Fisher <[email protected]>
* Copyright (C) 2008 Siegfried-A. Gevatter <[email protected]>
* Copyright (C) 2011 Kévin Joly <[email protected]>
* Copyright (C) 2016 James Budiono <[email protected]>
* Copyright (C) 2021 Michael Amadio <[email protected]>
* Originally based upon code by Raul Suarez <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Dependencies:
* gnome-menus
* glib
*/
#include <string.h>
#include <glib.h>
#include <glib/gprintf.h>
#include <gnome-menus/gmenu-tree.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
/*=============================================================================
* Declarations
*/
static void show_help();
static void process_directory(GMenuTreeDirectory *directory);
static void process_entry(GMenuTreeEntry *entry);
/*=============================================================================
* Main Function
*/
int main (int argc, char **argv)
{
if ((argc < 2)
|| (strcmp (argv[1], "-h") == 0)
|| (strcmp (argv[1], "-help") == 0)
|| (strcmp (argv[1], "--help") == 0))
{
show_help();
return (1);
}
GMenuTree *menuTree = gmenu_tree_lookup (argv[1], GMENU_TREE_FLAGS_NONE );
GMenuTreeDirectory *rootDirectory = gmenu_tree_get_root_directory(menuTree);
process_directory(rootDirectory);
gmenu_tree_item_unref (rootDirectory);
return 0;
}
/*=============================================================================
* Shows usage parameters
*/
void show_help()
{
g_printf ("Creates a labwc menu from an Xdg menu structure.\n");
g_printf ("\n");
g_printf ("Usage:\n");
g_printf (" labwc-xdgmenu <Xdg menu file>\n");
g_printf ("\n");
g_printf ("For example:\n");
g_printf (" labwc-xdgmenu \"/etc/xdg/menus/applications.menu\"\n\n");
}
/*=============================================================================
* This function processes a directory entry and all it's child nodes
*/
void process_directory(GMenuTreeDirectory *directory)
{
g_printf(
"<menu id=\"xdg-menu-%s\" label=\"%s\">\n",
gmenu_tree_directory_get_name(directory),
gmenu_tree_directory_get_name(directory));
GMenuTreeItemType entryType;
GSList *entryList = gmenu_tree_directory_get_contents (directory);
GSList *l;
for (l = entryList; l; l = l->next)
{
GMenuTreeItem *item = l->data;
entryType = gmenu_tree_item_get_type (GMENU_TREE_ITEM(item));
switch (entryType)
{
case GMENU_TREE_ITEM_DIRECTORY:
break;
case GMENU_TREE_ITEM_ENTRY:
process_entry(GMENU_TREE_ENTRY(item));
break;
}
gmenu_tree_item_unref (item);
}
g_printf("</menu>\n");
g_slist_free (entryList);
}
/*=============================================================================
* This function adds an application entry
*/
void process_entry(GMenuTreeEntry *entry)
{
char *name = g_strdup (gmenu_tree_entry_get_name(entry));
char *exec = g_strdup (gmenu_tree_entry_get_exec(entry));
int i;
for (i = 0; i < strlen(exec) - 1; i++) {
if (exec[i] == '%')
{
switch (exec[i+1]) {
case 'f': case 'F':
case 'u': case 'U':
case 'd': case 'D':
case 'n': case 'N':
case 'i': case 'c': case 'k': case 'v': case 'm':
exec[i] = ' ';
exec[i+1] = ' ';
i++;
break;
}
}
}
g_printf(" <item label=\"%s\">\n", g_strjoinv("&", g_strsplit(name,"&",0))),
g_printf(" <action name=\"Execute\"><command>%s</command></action>\n", exec),
g_printf(" </item>\n");
g_free(name);
g_free(exec);
}
/*=============================================================================
*/
It puts each category iterated over on STDOUT . I might event start a github repo for this.
from labwc.
A separate labwc
organization sounds like a good idea. It could -
- attract more interest
- have it's own github.io website
- have useful forks of related projects
from labwc.
Yeah. I’ve just created the org.
from labwc.
Yeah. I’ve just created the org.
A simple logo
labwc.svg
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 120 160">
<!--labwc logo
(c) Michael Amadio, [email protected], Labrador, QLD, Australia
LICENSE: CC BY-SA 4.0-->
<path d="m 80,29.5 a 0.5 0.5 0 0 1 -0.5,0.5 l -30,0 -30,-20 c -5,-3.5 -7,-2 -7,4 l 0,60
c 0,6 1,7.5 7,4 l 30,-20 30,0
a 0.5 0.5 0 0 1 0.5,0.5 l 5,0 a 5.5 5.5 0 0 0 -5.5,-5.5
l -62,0 0,-38 30,20 32,0 a 5.5 5.5 0 0 0 5.5,-5.5 z" style="fill:#000000"/>
<path d="m 77.5 80 -5,0 0,60 a 12.5,12.5 0 0 0 25,0 l 0,-60 -5,0 0,40 -15,0 z" style="fill:#000000"/>
<path d="m 85,58 a 10 10 0 0 1 -3,7 a 5 5 1 1 0 6,0 a 10 10 0 0 1 -3,-7" style="fill:#000000;stroke-linejoin:round" />
</svg>
.. and font from icomoon
Maybe more contrast needed in my config.
A better one.. and a fullscreen
from labwc.
Any copyright on it. Did you make it?
from labwc.
Any copyright on it. Did you make it?
Yes I did. I'll add a comment in the xml... later.
icomoon allows you to add your own svg files to the font. More on that later.
from labwc.
I updated comment, yes, I live in Labrador 🤣
EDIT: forgot to save, now updated.
from labwc.
@01micko
Nested menus work now :) And I've added support for menu.overlap.{x,y} which solves the gap issue.
from labwc.
@01micko Nested menus work now :) And I've added support for menu.overlap.{x,y} which solves the gap issue.
Excellent, thanks 😄 . Just built and running now from 3541616
from labwc.
@01micko
I've written a little hack for libgnome-menu-3.0 and gio.
https://github.com/labwc/labwc-menu-gnome3
from labwc.
@01micko I've written a little hack for libgnome-menu-3.0 and gio. https://github.com/labwc/labwc-menu-gnome3
Puppy's menu generator with JWM this patch (https://github.com/puppylinux-woof-CE/woof-CE/blob/testing/woof-code/rootfs-petbuilds/xdg-puppy-jwm/2089.patch), which:
- Adds tooltips
- Removes
%F
and friends -
$ grep ^Exec /usr/share/applications/geany.desktop
Exec=geany %F
- Runs applications with
Terminal=true
inside a terminal emulator, and wraps the command-line withsh -c
(puppylinux-woof-CE/woof-CE#2542, puppylinux-woof-CE/woof-CE#2561)
@johanmalm I'll open a PR to https://github.com/labwc/labwc-menu-gnome3, with 2 and 3, sometime soon.
from labwc.
I'm working on this now.
TODO:
1. [x] Parsing sub-menus in menu.xml 2. [x] Render sub-menus and handle cursor movements and button presses 3. [ ] Handle some basic keys such as arrows and escape 4. [ ] Fit within output geometry 5. [ ] Support hover-delay (i.e. delay before showing sub-menu when hovering over sub-menu item) 6. [x] Support nested menus 7. [ ] Support `<separator>`
I've added support for <separator>
to the TODO list (sorry --edited--). Still lots to do with menus 😄
Just playing around with themes
recording.mp4
from labwc.
Looking good.
I want to see if I can add icon font support to the menu generator 😆
from labwc.
I like the look of that. Keeps it simple and avoids all the color clashes that comes with PNG/SVG icons.
Talking of icons - for the longer term most advanced layer-shell menu (with pipemenus, icons, etc, I think this library will be great https://gitlab.freedesktop.org/ddevault/fdicons
from labwc.
does implementation allow to fix drawn out-of screen menus?
(in master when right-clicking the desktop near screen right-edge, menu will draw off-screen)
from labwc.
sorry, please ignore, had not seen your 4th point
from labwc.
Will close this now as sub-menus have been implemented.
Will track other menu enhancements here https://github.com/labwc/labwc-acceptance-criteria/blob/main/TODO.md
Have written a separator
implementation, just need to refactoring some output.c code before committing.
from labwc.
Related Issues (20)
- Feature request: dynamic SnapToEdge sizing HOT 6
- SendToDesktop keeps focus with follow="no" HOT 8
- Feature request: Grow-or-shrink windows HOT 3
- Feature request: more options for MoveTo HOT 5
- Feature request: Move/resize partially maximized windows HOT 1
- Feature request: option to contain/push off edges in ResizeRelative, ResizeTo HOT 1
- Add empty `shutdown` script to docs/ to increase visibility of the feature
- Allow keybinds with `-` HOT 1
- [Bug][Commit bisected] Commit breaks fullscreen SDL2 programs behaviour HOT 12
- Feature request: Global policies for moving/resizing windows on workarea size change
- Feature request: Hierarchal keybinds (sway/i3 style modes) HOT 5
- double bound mouse clicks ignored
- Magnifier is broken for pixman renderer HOT 9
- Is there any way to get an application's icon? HOT 2
- Feature request: Unmaximize
- Feature request: focus/urgency handling for new/activating windows HOT 6
- Do not run dbus-update-activation-environment if dbus implementation is dbus-broker HOT 1
- Various issues with running labwc within a VM since moving to wlroots 0.17 HOT 2
- Inconsistent use of `_` and `-` in filenames HOT 4
- magnifier: improve performance by preventing useless rendering when enabled HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from labwc.