[PATCH 1/2] WPrefs: add hotplug monitor option in expert panel

0 views
Skip to first unread message

david.m...@gmail.com

unread,
Mar 27, 2026, 8:42:44 PM (10 days ago) Mar 27
to Window Maker Development
This patch is adding a new HotplugMonitor option
to automatically (de)activate monitors on randr hotplug events.
It is disabled by default.
---
 WPrefs.app/Expert.c | 5 +++++
 src/WindowMaker.h   | 3 +++
 src/defaults.c      | 5 ++++-
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/WPrefs.app/Expert.c b/WPrefs.app/Expert.c
index d3731ae4..21fbcb4a 100644
--- a/WPrefs.app/Expert.c
+++ b/WPrefs.app/Expert.c
@@ -132,6 +132,11 @@ static struct expert_option {
 
  { N_("Allow windows to take focus using mouse wheel."),
    /* default: */ False, OPTION_WMAKER, "MouseWheelFocus"},
+
+#ifdef USE_RANDR
+ { N_("Automatically (de)activate monitors on hotplug events."),
+   /* default: */ False, OPTION_WMAKER, "HotplugMonitor"},
+#endif
 };
 
 
diff --git a/src/WindowMaker.h b/src/WindowMaker.h
index cd2c9b48..f979573f 100644
--- a/src/WindowMaker.h
+++ b/src/WindowMaker.h
@@ -410,6 +410,9 @@ extern struct WPreferences {
 
  char dont_blink;                   /* do not blink icon selection */
  char keep_dock_on_primary_head;    /* keep dock on primary head */
+#ifdef USE_RANDR
+ char hotplug_monitor;              /* auto-(de)activate monitors */
+#endif
 
  /* Appearance options */
  char new_style;                    /* Use newstyle buttons */
diff --git a/src/defaults.c b/src/defaults.c
index d5d81a2d..101e4dc1 100644
--- a/src/defaults.c
+++ b/src/defaults.c
@@ -5,7 +5,6 @@
  *  Copyright (c) 1997-2003 Alfredo K. Kojima
  *  Copyright (c) 1998-2003 Dan Pascu
  *  Copyright (c) 2014-2026 Window Maker Team
-
  *
  *  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
@@ -527,6 +526,10 @@ WDefaultEntry optionList[] = {
  {"KeepDockOnPrimaryHead", "NO", NULL,
      &wPreferences.keep_dock_on_primary_head, getBool, updateDock,
      NULL, NULL},
+#ifdef USE_RANDR
+ {"HotplugMonitor", "NO", NULL,
+     &wPreferences.hotplug_monitor, getBool, NULL, NULL, NULL},
+#endif
  {"HotCorners", "NO", NULL,
      &wPreferences.hot_corners, getBool, NULL, NULL, NULL},
  {"HotCornerDelay", "250", (void *)&wPreferences.hot_corner_delay,
--
2.43.0
0001-WPrefs-add-hotplug-monitor-option-in-expert-panel.patch
Reply all
Reply to author
Forward
0 new messages