Commit graph

2505 commits

Author SHA1 Message Date
Jens Peters
cf123dd78e
data: disable Inhibit D-BUS interface in xdg-portals configuration (#2205)
The GTK xdg-portal implementation, which is used as
the default behind the wlr xdg-portal implementation,
exposes the Inhibit interface even on a non-Gnome
session. Unfortunately this D-BUS interface does not
work on labwc.
By explicitly disabling this interface, firefox and may be
other applications are not tricked into using the
xdg-portal interface but use the Wayland IdleInhibit
protocol instead which labwc supports.
2024-10-02 21:32:47 +01:00
Johan Malm
c7983129d4 cosmic-workspaces: fix menu.c 2024-10-01 21:45:13 +01:00
Rick Calixte
5b774e6e99
Add labwc to XDG_CURRENT_DESKTOP to support a portals.conf (#1716)
The previous `UseIn` key was deprecated in xdg-desktop-portal 1.17/1.18.
It has been superceded by the portals.conf structure so that each
desktop can configure the precise desired structure for portals. In
addition, support was added to the Desktop Entry Specifications to
support a `DesktopNames` key that login managers will use to set
XDG_CURRENT_DESKTOP.

* [portals.conf
  Documentation](https://github.com/flatpak/xdg-desktop-portal/blob/main/doc/portals.conf.rst.in)
* [Example
  sway-portals.conf](https://salsa.debian.org/swaywm-team/sway/-/blob/debian/sid/debian/sway-portals.conf)
* [Desktop Entry
  Specifications](https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html)

Ref: flatpak/xdg-desktop-portal#955
2024-10-01 21:33:45 +01:00
Johan Malm
d18e67eea8
Merge pull request #2030 from Consolatis/wip/cosmic_workspaces
Initial implementation of cosmic-workspace-unstable-v1
2024-10-01 21:31:04 +01:00
tokyo4j
1557cb774f cursor: prevent Drag mousebinds from running without button press
For `Drag` mousebinds, `pressed_in_context` is set by
`cursor_process_button_press()` and cleared by `cursor_process_motion()`
which runs actions bound to them. However, when `cursor_process_motion()`
is called while interactive move/resize, it doesn't clear
`pressed_in_context` due to the early-return and the `Drag` mousebinds are
unexpectedly executed on another call to `cursor_process_motion()` after
the interactive move/resize is finished by button release, even when the
button is not pressed.

So this commit fixes it by always clearing `pressed_in_context` on button
releases.
2024-10-01 21:26:19 +01:00
John Lindgren
452f45cd3d xdg: try to handle slow un-maximize with empty natural geometry better
In the case of an initially-maximized view which is taking a long time
to un-maximize (seen for example with Thunderbird on slow machines), we
may end up in handle_configure_timeout() with an empty pending geometry.
In that case we have no great options (we can't center the view since we
don't know the un-maximized size yet), so set a fallback position.

v2: check wlr_box_empty() before comparing pending and current

Fixes: #2191
2024-10-01 21:22:00 +01:00
tokyo4j
915d638f8a doc: update default value of <theme><titlebar><layout> 2024-10-01 15:11:43 +09:00
John Lindgren
c9e0a6e125 icon-loader: add a new loader for XPM icons, used by many legacy X11 apps
Adapted from gdk-pixbuf, see the original at:

  https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/blob/master/gdk-pixbuf/io-xpm.c

rgb.txt is from X.org, see:

  https://gitlab.freedesktop.org/xorg/app/rgb/-/blob/master/rgb.txt

Differences from the gdk-pixbuf version:

- GdkPixbuf replaced with struct lab_data_buffer
- Progressive and in-memory loading code removed
- Two functions that had separate BSD copyright rewritten
- Stores colors as ARGB32 earlier in the decoding process for efficiency
- Limited to 1024x1024 px and 1024 colors to prevent abuse
- Uses struct buf to build strings, in place of manual g_new/g_realloc
- Uses xzalloc/xznew_n for other memory allocations
- Uses g_strlcpy in place of banned strcpy/strncpy/strncat
- Uses standard C types (int, bool, etc.) in place of the GLib ones
- Follows labwc coding style (whitespace, braces, letter case, etc.)
- Et cetera ...

v2: add Perl fixes from @domo141
2024-09-30 21:17:19 -04:00
John Lindgren
887ec70ba4 icon-loader: match more application icons via fuzzy match
Add fallback logic to match reverse-URL .desktop file names when
the app_id is just the base name (e.g. "thunderbird" ->
org.mozilla.Thunderbird.desktop).
2024-09-30 22:05:38 +01:00
Weblate
2f3cd205f3 Translation updates from weblate
Co-authored-by: Eric Migeon <weblate.tilux@spamgourmet.com>
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/fr/
Translation: Labwc/labwc
2024-09-30 22:02:23 +01:00
John Lindgren
ce0ce2aae7 ssd: also add spacing between innermost button and title
Currently, left-aligned title text gets pushed right up to the window
icon with no spacing at all, which looks bad IMO.
2024-09-30 18:28:55 +01:00
tokyo4j
014d07651f xdg: fix de-synced SSD when shrinking Thunderbird window
On a slow mechine or heavy load, we sometimes see de-synced SSD with
Thunderbird windows when shrinking it. Here's how it happened:

1. Labwc sends a configure event.
2. The configure event timeouts and labwc resets view->{pending,current}
   with the old geometry.
3. Thunderbird updates the toplevel window geometry and the toplevel
   surface size, but not the subsurface size. Then it sends a commit.
4. Since now the committed window geometry and view->pending are
   different, the workaround for Qt apps is applied and the whole surface
   extent is set to view->current. Thus SSD stays in the old geometry.
5. Thunderbird finally updates the subsurface size.

So, this commit fixes this conflict between Thunderbird and the workaround
for Qt apps by using the toplevel surface size instead of the whole
surface extent to update view->current.
2024-09-30 10:19:54 +09:00
Johan Malm
3394f191a4 icon-loader: support absolute icon names 2024-09-28 12:38:18 +01:00
Johan Malm
be5472a840 icon-loader: refactor in preparation for supporting absolute icon names
No functional change intended.
2024-09-28 12:38:18 +01:00
Johan Malm
340733e494 ci: add libsfdo-devel for Void 2024-09-27 21:58:35 +01:00
Weblate
9b56cb6226 Translation updates from weblate
Co-authored-by: Giannis Antypas <gianni.antypas@gmail.com>
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/el/
Translation: Labwc/labwc
2024-09-25 22:01:02 +01:00
tokyo4j
701679bae0 ssd: fix crash on app_id updates while the app is in fullscreen
`view->ssd_enabled && view->ssd == NULL` is possible during the client is
in fullscreen. So we need to check if `view->ssd` is NULL first in
`ssd_update_window_icon()`.
2024-09-25 21:44:33 +09:00
tokyo4j
a745f91169 ssd: support window icons
The default `titleLayout` is updated to `icon:iconify,max,close` which
replaces the window menu button with the window icon.

When the icon file is not found or could not be loaded, the window menu
icon as before is shown.

The icon theme can be selected with `<theme><icon>`.

This commit adds libsfdo as an optional dependency. `-Dicon=disabled` can
be passsed to `meson setup` command in order to disable window icon, in
which case the window icon is always replaced with a window menu button.
2024-09-25 18:04:09 +09:00
Jens Peters
b9414d8b8d action: implicitely unmaximize when unsnapping
Co-authored-by: tokyo4j <hrak1529@gmail.com>
2024-09-25 17:59:10 +09:00
Jens Peters
694c5a7469 action: add UnSnap action
Same untiling behavior as ToggleSnapToEdge/Region,
but unconditionally.

Co-authored-by: tokyo4j <hrak1529@gmail.com>
2024-09-25 17:59:10 +09:00
Jens Peters
cb2e2c1016 action: add ToggleSnapToEdge/Region actions
Behaves identical like SnapToEdge and SnapToRegion, but
untiles the window when already being tiled to the given
region or direction.

Co-authored-by: tokyo4j <hrak1529@gmail.com>
2024-09-25 17:59:10 +09:00
Jens Peters
4fd7a8075c view: expose view_apply_natural_geometry()
Co-authored-by: tokyo4j <hrak1529@gmail.com>
2024-09-25 17:59:10 +09:00
Johan Malm
f1141c62d4 ci: disable debian build checks until dependencies can be met 2024-09-24 20:32:32 +01:00
Johan Malm
9d251a96b1 theme: fix incorrect default for <titlebar><showTitle> 2024-09-24 19:59:46 +01:00
Weblate
95bc420403 Translation updates from weblate
Co-authored-by: Ihor Hordiichuk <igor_ck@outlook.com>
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/uk/
Translation: Labwc/labwc
2024-09-24 19:49:30 +01:00
David Turner
ff012fa331 Don't detect edge-resizes in configure timeout
If a client times out responding to a configure request then the
handle_configure_timeout() callback is run.  This cleans up the pending
state and moves the view to the pending location, but keeps the current
size. The idea is to stop slow applications causing too much lag when
the user manipulates the window.  This callback used
view_impl_apply_geometry() to actually apply the changes.

view_impl_apply_geometry() contains some heuristics to detect if we're
resizing a window from the top, left, or top-left, and if so to do the
expected behaviour of keeping the window's bottom/right corner in the
same place.  However, that code was erroneously triggering in the case
when the user requests to change a window from maximized to fullscreen
but the client times out on the configure request.
handle_configure_timeout() decides to enact the movement of the window
but keep its size at the old size and tells view_impl_apply_geometry()
to do that.

The current view position and size is 0,64 1920x1016, the pending
position/size is 0,0 1920x1080, and the last committed size is
1920x1016.  Looking at the current and pending position and size, the
height changes while the bottom edge stays in the same place so this
looks like a top-edge-resize and view_impl_apply_geometry() decides to
keep the window's bottom edge in the same place while setting the
position according to the last-committed size.  This results in the
window staying at position 0,64 size 1920x1016 despite being marked as
fullscreen.

My solution to this is just to change handle_configure_timeout() to
directly change the view's position and call view_moved() if necessary.
The idea of handle_configure_timeout() is to action the window movement
now while discarding the size change, and let the size change take place
later on when the client catches up.  The logic of
view_impl_apply_geometry() doesn't make sense in this case so just avoid
it entirely.

Fixes #1922
2024-09-24 19:45:16 +01:00
Johan Malm
e5f60ce8a7 ci: use -Wno-expansion-to-defined to avoid Arch CI error
...with this warning message:

[100/161] Compiling C object labwc.p/src_button_button-svg.c.o
FAILED: labwc.p/src_button_button-svg.c.o
gcc -Ilabwc.p -I. -I.. -Iinclude -I../include -I/usr/include/wlroots-0.18 -I/usr/include/pixman-1 -I/usr/include/libdrm -I/usr/include/libxml2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/sysprof-6 -I/usr/include/cairo -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/lib/pkgconfig/../../include/librsvg-2.0 -I/usr/include/gdk-pixbuf-2.0 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -std=c11 -O0 -g -DWLR_USE_UNSTABLE -Wundef -Wlogical-op -Wmissing-include-dirs -Wold-style-definition -Wpointer-arith -Winit-self -Wstrict-prototypes -Wimplicit-fallthrough=2 -Wendif-labels -Wstrict-aliasing=2 -Woverflow -Wmissing-prototypes -Walloca -Wunused-macros -Wno-unused-parameter '-DLABWC_VERSION="0.8.0"' '-DGETTEXT_PACKAGE="labwc"' '-DLOCALEDIR="/usr/local/share/locale"' -pthread -MD -MQ labwc.p/src_button_button-svg.c.o -MF labwc.p/src_button_button-svg.c.o.d -o labwc.p/src_button_button-svg.c.o -c ../src/button/button-svg.c
In file included from ../src/button/button-svg.c:7:
/usr/lib/pkgconfig/../../include/librsvg-2.0/librsvg/rsvg.h:1331:1: error: this use of "defined" may not be portable [-Werror=expansion-to-defined]
 1331 | #if LIBRSVG_CHECK_FEATURE(PIXBUF)
      | ^~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
2024-09-24 07:15:13 +09:00
Weblate
4acac07323 Translation updates from weblate
Co-authored-by: Abdullah Albaroty <albaroty@gmail.com>
Co-authored-by: Priit Jõerüüt <lxqtwlate@joeruut.com>
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/ar/
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/et/
Translation: Labwc/labwc
2024-09-23 21:03:27 +01:00
Johan Malm
cc26ac29b9
theme: finish titleLayout implementation (#2150)
Change Openbox style WLIMC syntax to `menu:iconify,max,close` as was
agreed when PR #2088 was merged.

    <titlebar>
      <layout>menu:iconify,max,close</layout>
      <showTitle>yes|on</showTitle>
    </titlebar>

Ref:
- https://github.com/labwc/labwc/pull/2088#issuecomment-2295730704
2024-09-23 19:17:12 +01:00
Weblate
04a145f89a Translation updates from weblate
Co-authored-by: Heimen Stoffels <vistausss@fastmail.com>
Co-authored-by: Hugo Carvalho <hugokarvalho@hotmail.com>
Co-authored-by: Jan Rolski <wbcwknvstb@proton.me>
Co-authored-by: Standreas <standreas@riseup.net>
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/it/
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/nl/
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/pl/
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/pt/
Translation: Labwc/labwc
2024-09-21 22:05:03 +01:00
Weblate
09bd2a59c8 Translation updates from weblate
Co-authored-by: Weblate <noreply@weblate.org>
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/
Translation: Labwc/labwc
2024-09-21 19:17:17 +01:00
tokyo4j
80e7b64a41 xdg: handle show_window_menu requests 2024-09-21 18:34:17 +01:00
tokyo4j
31fec2f9cb xdg: don't always adjust the window size before configure
This fixes the small flicker when the client initially submits a window
size smaller than the minimum value.
2024-09-21 18:08:29 +01:00
tokyo4j
25f5cdd3a6 Refactor the logic of placing client-menu with ShowMenu action
Before this commit, we assumed `ShowMenu` action is not bound to any
buttons other than window menu button and always place the client-menu
under the window-menu button when atCursor="no". Also, it was going to be
difficult to distinguish whether the action is executed from the window
menu button or the window icon, which will be added soon.

This commit fixes it to open the menu under the actually-clicked button by
passing `cursor_context` to `actions_run()`, with some refactoring:
- `seat->pressed.resize_edges` is removed and it's calculated from the
  cursor position and `seat->pressed.type` just before running Resize
  action. This slightly changes the existing logic to determine the
  resizing edges with Alt-Right + Drag mousebinding, but
  `seat->pressed.type` is still stored on button press so it doesn't bring
  back the issue #543.
- `seat->pressed.toplevel` is removed and `get_toplevel()` in
  `update_pressed_surface()` may be called more often, but its overhead
  will be negligible.
2024-09-21 18:07:34 +01:00
tokyo4j
d29464bac7 docs: fix documentation of "atCursor" for dynamic titlebar layout 2024-09-21 14:15:16 +01:00
tokyo4j
14f4d8c361 docs/rc.xml.all: add missing atCursor="no" 2024-09-21 14:15:16 +01:00
Droc
331ded0328 client list combines fix empty title
this adds a check for title being null or empty as well as
existence of toplevel.handle
2024-09-19 20:57:39 +01:00
01micko
0ce9b465b5 labwc.pot: update translation template for 71b2b5a
fixes #2157
2024-09-19 20:32:33 +01:00
Droc
4a1375c701 client send to menu
Shows all workspaces that current view can be sent to.
Works best when added to Client menu.

<menu id="client-send-to-menu" label="Send to..." />

Menu uses ">" and "<"  to highlight the current workspace
2024-09-19 06:36:27 +01:00
Droc
4f11dad45b client list combined menu examples 2024-09-19 06:33:17 +01:00
Droc
d26b868dbe client list combined menu fix
We don't know if the client-list-combined-menu is standalone
ie. triggered by a keybind or a submenu of another menu.
So we update client-list-combined-menu every time ShowMenu is called.
2024-09-18 22:07:41 +01:00
Droc
71b2b5a4bc menu: support client-list-combined-menu
...showing windows across all workspaces.

<action name="ShowMenu" menu="client-list-combined-menu"/>
2024-09-17 22:13:23 +01:00
Johan Malm
fc4bbca6f2 NEWS.md: interim update 2024-09-16 18:45:50 +01:00
Jens Peters
8b1831c731 action: open the client menu underneath the window menu button
It looks slightly awkward when the client menu shows up
in the left corner of the view and the window menu button
is configured to be on the right side.
2024-09-15 22:05:46 +01:00
tokyo4j
e53ec5e5a0 theme: round the hover effect along the window border 2024-09-15 21:52:13 +01:00
Jens Peters
21e92632a6 theme: compensate the hover corner radius with padding
When padding.width is set, the corner radius of the rectangle
hover effect can be smaller since there is more space available.
2024-09-11 21:22:06 +01:00
Jens Peters
9395348c55 theme: add circle button hover effect (#2127) 2024-09-10 22:14:30 +01:00
Jens Peters
dcd9b47e5b theme: ensure positive values (#2127)
Clamp invalid configuration values to zero.
2024-09-10 22:14:30 +01:00
Jens Peters
824b0fa4e3 theme: add button padding and spacing (#2127)
While at it, separate corner width from button
width. Both are independed and having them
separately improves readability.
2024-09-10 22:14:30 +01:00
Droc
8850368ab9 Add position arguments for menus
...utilizing x,y coordinates where values can be a number, a negative
number, a percentage or "center".

- (0,0) is top left corner
- (-0,-0) is bottom right corner
- % is percentage of width and/or height
- 'center' centers the menu vertically and/or horizontally

    <action name="ShowMenu">
      <menu>root-menu</menu>
      <position>
        <x>0</x>
        <y>0</y>
      </position>
    </action>

Note: both x and y values must be supplied for positioning to work.
2024-09-05 22:28:50 +02:00