1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-03-25 06:03:31 +01:00

6 Commits

Author SHA1 Message Date
David Maciejak
329f82f6e7 WPrefs: set the PID of the application to the window
This patch is setting the _NET_WM_PID atom for WPrefs
to report its PID.

Before the patch, the PID reported is unset (0)
$ wmctrl -lp|grep 'Window Maker Preferences'
0x00a000b0  0 0      Linux Window Maker Preferences

After the patch, the PID is set (20110 in the example below)
0x00a000b0  0 20110  Linux Window Maker Preference
2026-03-23 20:43:42 +00:00
David Maciejak
60a900be28 wmaker: make sure reloaded saved window position is in visible space
This patch is checking if the session saved window positions fall
in dead space, for example when a monitor no longer exists.
If it's the case the window position is moved to the nearest active
head.
2026-03-22 22:21:00 +00:00
David Maciejak
c7c736e283 wmaker: set proper group window class when hint is empty
This patch is a follow up of commit
073235ada4
as it appears there is the same issue with the WMState
configuration file when a session state is saved.

For example, with terminator, the file will contain:
  ...
  Applications = (
    {
      Dock = Dock;
      Maximized = 0x0000;
      Name = terminator.;
      ...

After the patch:
  ...
  Applications = (
    {
      Dock = Dock;
      Maximized = 0x0000;
      Name = terminator.Terminator;
      ...
2026-03-20 10:11:02 +00:00
David Maciejak
752a949492 wmaker: fix window position issues with dockapps
The patch with commit 839061a25a
introduces an issue with dockapps that are creating their main
windows with size 1x1. That new patch is moving the existing
code further below in the wManageWindow function to be able
to check if the window flag is_dockapp is set.
Issue was seen with wmsystemtray and wmmemload.
2026-03-20 10:11:02 +00:00
David Maciejak
be495bedbc wmaker: allow the screenshot filename template to be set
This patch is adding a new option ScreenshotFilenameTemplate for users
to change the default strftime format "screenshot_%Y-%m-%d_at_%H:%M:%S".
For example, Teams is not allowing the ':' char in the filename of file
to be shared so I always have to rename the file.
2026-03-20 10:11:02 +00:00
412b3eace2 Make border opaque.
When composite manager (like picom or xcompmgr) is used together with
Window Maker, some of the windows (i.e. terminator) might have
transparent border. This patch will prevent from such situation.

Closes: https://github.com/window-maker/wmaker/issues/58
2026-03-20 10:11:02 +00:00
8 changed files with 82 additions and 13 deletions

View File

@@ -23,6 +23,7 @@
#include "WPrefs.h"
#include <assert.h>
#include <X11/Xatom.h>
#ifdef HAVE_STDNORETURN
#include <stdnoreturn.h>
@@ -516,6 +517,9 @@ void Initialize(WMScreen * scr)
char **list;
int i;
char *path;
long pid;
Atom net_wm_pid;
Display *dpy = WMScreenDisplay(scr);
list = RSupportedFileFormats();
for (i = 0; list[i] != NULL; i++) {
@@ -547,6 +551,11 @@ void Initialize(WMScreen * scr)
WMRealizeWidget(WPrefs.win);
net_wm_pid = XInternAtom(dpy, "_NET_WM_PID", False);
pid = (long)getpid();
XChangeProperty(dpy, WMWidgetXID(WPrefs.win), net_wm_pid, XA_CARDINAL,
32, PropModeReplace, (unsigned char *)&pid, 1);
WMSetWindowMiniwindowImage(WPrefs.win, WMGetApplicationIconImage(scr));
WMMapWidget(WPrefs.win);

View File

@@ -505,6 +505,7 @@ extern struct WPreferences {
Cursor cursor[WCUR_LAST];
int switch_panel_icon_size; /* icon size in switch panel */
char *screenshot_filename_template; /* strftime format for screenshot filenames */
} wPreferences;

View File

@@ -91,6 +91,7 @@ typedef struct {
/* type converters */
static WDECallbackConvert getBool;
static WDECallbackConvert getInt;
static WDECallbackConvert getString;
static WDECallbackConvert getCoord;
static WDECallbackConvert getPathList;
static WDECallbackConvert getEnum;
@@ -540,6 +541,8 @@ WDefaultEntry optionList[] = {
&wPreferences.mouse_wheel_focus, getBool, NULL, NULL, NULL},
{"KeychainTimeoutDelay", "500", NULL,
&wPreferences.keychain_timeout_delay, getInt, NULL, NULL, NULL},
{"ScreenshotFilenameTemplate", DEF_SCREENSHOT_FILENAME_TEMPLATE, NULL,
&wPreferences.screenshot_filename_template, getString, NULL, NULL, NULL},
/* style options */
@@ -1496,6 +1499,29 @@ static int string2index(WMPropList *key, WMPropList *val, const char *def, WOpti
* ret - is the address to store a pointer to a temporary buffer. ret
* must not be freed and is used by the set functions
*/
static int getString(WScreen * scr, WDefaultEntry * entry, WMPropList * value, void *addr, void **ret)
{
const char *val;
char **sptr;
/* Parameter not used, but tell the compiler that it is ok */
(void) scr;
GET_STRING_OR_DEFAULT("String", val);
if (ret)
*ret = (void *)val;
if (addr) {
sptr = (char **)addr;
if (*sptr)
wfree(*sptr);
*sptr = wstrdup(val);
}
return True;
}
static int getBool(WScreen * scr, WDefaultEntry * entry, WMPropList * value, void *addr, void **ret)
{
static char data;

View File

@@ -70,7 +70,7 @@ static void allocFrameBorderPixel(WFrameWindow *fwin, const char *color_name, un
*pixel = wmalloc(sizeof(unsigned long));
if (*pixel)
**pixel = xcol.pixel;
**pixel = xcol.pixel |= 0xff << 24;
}
WFrameWindow *wFrameWindowCreate(WScreen * scr, int wlevel, int x, int y,

View File

@@ -1270,7 +1270,14 @@ void ScreenCapture(WScreen *scr, int mode)
s = time(NULL);
tm_info = localtime(&s);
strftime(filename_date_part, sizeof(filename_date_part), "screenshot_%Y-%m-%d_at_%H:%M:%S", tm_info);
strftime(filename_date_part, sizeof(filename_date_part), wPreferences.screenshot_filename_template, tm_info);
if (strchr(filename_date_part, '/') != NULL) {
wfree(screenshot_dir);
werror(_("Unsafe screenshot filename template, it should not contain a path separator"));
return;
}
strcpy(filename, filename_date_part);
filepath = wstrconcat(screenshot_dir, strcat(filename, filetype));

View File

@@ -181,8 +181,11 @@ static WMPropList *makeWindowState(WWindow * wwin, WApplication * wapp)
}
if (PropGetWMClass(win, &class, &instance)) {
if (class && instance)
snprintf(buffer, sizeof(buffer), "%s.%s", instance, class);
if (class && instance) {
if (class[0] == '\0' && wwin->wm_class && wwin->wm_class[0] != '\0')
class = strdup(wwin->wm_class);
snprintf(buffer, sizeof(buffer), "%s%s%s", instance, class[0] ? "." : "", class);
}
else if (instance)
snprintf(buffer, sizeof(buffer), "%s", instance);
else if (class)

View File

@@ -191,6 +191,9 @@
#define DEF_APPMENU_X 10
#define DEF_APPMENU_Y 10
/* default strftime format for screenshot filenames */
#define DEF_SCREENSHOT_FILENAME_TEMPLATE "\"screenshot_%Y-%m-%d_at_%H:%M:%S\""
/* calculate window edge resistance from edge resistance */
#define WIN_RESISTANCE(x) (((x)*20)/30)

View File

@@ -688,15 +688,6 @@ WWindow *wManageWindow(WScreen *scr, Window window)
return NULL;
}
/* Some applications create placeholder windows with 1x1 size
* (e.g. VirtualBox internal windows). Don't manage those initial
* 1x1 windows — wait for a proper ConfigureNotify/MapRequest with
* a real size. */
if (wattribs.width <= 1 && wattribs.height <= 1) {
XUngrabServer(dpy);
return NULL;
}
wm_state = PropGetWindowState(window);
/* if it's startup and the window is unmapped, don't manage it */
@@ -810,6 +801,15 @@ WWindow *wManageWindow(WScreen *scr, Window window)
/* get geometry stuff */
wClientGetNormalHints(wwin, &wattribs, True, &x, &y, &width, &height);
/* Some applications create placeholder windows with 1x1 size
* (e.g. VirtualBox internal windows). Don't manage those initial
* 1x1 windows. */
if (width <= 1 && height <= 1 && !wwin->flags.is_dockapp) {
wWindowDestroy(wwin);
XUngrabServer(dpy);
return NULL;
}
/* get colormap windows */
GetColormapWindows(wwin);
@@ -1051,8 +1051,28 @@ WWindow *wManageWindow(WScreen *scr, Window window)
Bool dontBring = False;
if (win_state && win_state->state->w > 0) {
WMRect rect;
int head, flags;
x = win_state->state->x;
y = win_state->state->y;
/* If the saved position falls in dead space (for example a monitor that no longer
* exists), clamp the window to the nearest active head. */
rect.pos.x = x;
rect.pos.y = y;
rect.size.width = width;
rect.size.height = height;
head = wGetRectPlacementInfo(scr, rect, &flags);
if (flags & XFLAG_DEAD) {
rect = wGetRectForHead(scr, head);
x = rect.pos.x + (x * rect.size.width) / scr->scr_width;
y = rect.pos.y + (y * rect.size.height) / scr->scr_height;
wScreenBringInside(scr, &x, &y, width, height);
}
} else if ((wwin->transient_for == None || wPreferences.window_placement != WPM_MANUAL)
&& !scr->flags.startup
&& !wwin->flags.miniaturized