From f183cfec8b565beeafd93f8f8b76a23fa71e78ff Mon Sep 17 00:00:00 2001 From: "B. Stack" Date: Wed, 9 Nov 2022 16:04:18 -0500 Subject: add fluxbox --- .../patches/add-clientmachine-if-forwarded.patch | 134 +++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 fluxbox/debian/patches/add-clientmachine-if-forwarded.patch (limited to 'fluxbox/debian/patches/add-clientmachine-if-forwarded.patch') diff --git a/fluxbox/debian/patches/add-clientmachine-if-forwarded.patch b/fluxbox/debian/patches/add-clientmachine-if-forwarded.patch new file mode 100644 index 0000000..5191173 --- /dev/null +++ b/fluxbox/debian/patches/add-clientmachine-if-forwarded.patch @@ -0,0 +1,134 @@ +Author: bgstack15 +Date: 2022-11-09 +Version: fluxbox 1.4.0 +Source: original +Summary: Add "(on $CLIENT)" to titlebar for forwarded windows +Message: +Inspired by xfwm4's ability to display the remote host running an X11 window. This fails on xfe which somehow lacks the WM_CLIENT_MACHINE property. +--- a/src/Xutil.cc ++++ b/src/Xutil.cc +@@ -43,6 +43,51 @@ using std::endl; + + namespace Xutil { + ++FbTk::FbString getWMClientMachine(Window window) { ++ ++ if (window == None) ++ return FbTk::FbString(""); ++ ++ Display *display = FbTk::App::instance()->display(); ++ ++ XTextProperty text_prop; ++ text_prop.value = 0; ++ char **list = 0; ++ int num = 0; ++ _FB_USES_NLS; ++ FbTk::FbString name; ++ ++ if (XGetWMClientMachine(display, window, &text_prop)) { ++ if (text_prop.value && text_prop.nitems > 0) { ++ if (text_prop.encoding != XA_STRING) { ++ ++ text_prop.nitems = strlen((char *) text_prop.value); ++ XmbTextPropertyToTextList(display, &text_prop, &list, &num); ++ ++ if (num > 0 && list != 0) ++ name = FbTk::FbStringUtil::LocaleStrToFb(static_cast(*list)); ++ else ++ name = text_prop.value ? FbTk::FbStringUtil::XStrToFb((char *)text_prop.value) : ""; ++ ++ if (list) ++ XFreeStringList(list); ++ ++ } else ++ name = text_prop.value ? FbTk::FbStringUtil::XStrToFb((char *)text_prop.value) : ""; ++ ++ XFree(text_prop.value); ++ ++ } else { // default name ++ name = _FB_XTEXT(Window, Unnamed, "Unnamed", "Default name for a window without a WM_NAME"); ++ } ++ } else { ++ // default name ++ name = _FB_XTEXT(Window, Unnamed, "Unnamed", "Default name for a window without a WM_NAME"); ++ } ++ ++ return name; ++} ++ + FbTk::FbString getWMName(Window window) { + + if (window == None) +--- a/src/Xutil.hh ++++ b/src/Xutil.hh +@@ -28,6 +28,7 @@ + + namespace Xutil { + ++FbTk::FbString getWMClientMachine(Window window); + FbTk::FbString getWMName(Window window); + + FbTk::FbString getWMClassName(Window win); +--- a/src/WinClient.cc ++++ b/src/WinClient.cc +@@ -49,6 +49,7 @@ + #else + #include + #endif ++#include + + using std::string; + using std::list; +@@ -217,6 +218,10 @@ bool WinClient::getAttrib(XWindowAttribu + return XGetWindowAttributes(display(), window(), &attr); + } + ++bool WinClient::getWMClientMachine(XTextProperty &textprop) const { ++ return XGetWMClientMachine(display(), window(), &textprop); ++} ++ + bool WinClient::getWMName(XTextProperty &textprop) const { + return XGetWMName(display(), window(), &textprop); + } +@@ -319,7 +324,14 @@ void WinClient::updateTitle() { + if (m_title_override) + return; + +- m_title.setLogical(FbTk::FbString(Xutil::getWMName(window()), 0, 512)); ++ FbTk::FbString fullname = FbTk::FbString(Xutil::getWMName(window()), 0, 512); ++ FbTk::FbString clientmachine = FbTk::FbString(Xutil::getWMClientMachine(window()), 0, 512); ++ char *host = new char[512]; gethostname(host, 512); ++ FbTk::FbString hostname = FbTk::FbString(host); ++ if (clientmachine != "Unnamed" && clientmachine != "" && clientmachine != hostname) { ++ fullname += " (on " + clientmachine + ")"; ++ } ++ m_title.setLogical(fullname); + m_title_update_timer.start(); + } + +@@ -328,7 +340,14 @@ void WinClient::emitTitleSig() { + } + + void WinClient::setTitle(const FbTk::FbString &title) { +- m_title.setLogical(title); ++ FbTk::FbString fullname = title; ++ FbTk::FbString clientmachine = FbTk::FbString(Xutil::getWMClientMachine(window()), 0, 512); ++ char *host = new char[512]; gethostname(host, 512); ++ FbTk::FbString hostname = FbTk::FbString(host); ++ if (clientmachine != "Unnamed" && clientmachine != "" && clientmachine != hostname) { ++ fullname += " (on " + clientmachine + ")"; ++ } ++ m_title.setLogical(fullname); + m_title_override = true; + m_title_update_timer.start(); + } +--- a/src/WinClient.hh ++++ b/src/WinClient.hh +@@ -91,6 +91,7 @@ public: + // + + bool getAttrib(XWindowAttributes &attr) const; ++ bool getWMClientMachine(XTextProperty &textprop) const; + bool getWMName(XTextProperty &textprop) const; + bool getWMIconName(XTextProperty &textprop) const; + std::string getWMRole() const; -- cgit From 086fb1135186d4c8c4ae16d6e969dc3be0fb8a02 Mon Sep 17 00:00:00 2001 From: "B. Stack" Date: Sat, 26 Nov 2022 08:24:06 -0500 Subject: store local hostname on WinClient instance so we do not have to run gethostname() for all title changes, just at each new window instantiation. --- .../patches/add-clientmachine-if-forwarded.patch | 49 ++++++++++++++++++---- 1 file changed, 41 insertions(+), 8 deletions(-) (limited to 'fluxbox/debian/patches/add-clientmachine-if-forwarded.patch') diff --git a/fluxbox/debian/patches/add-clientmachine-if-forwarded.patch b/fluxbox/debian/patches/add-clientmachine-if-forwarded.patch index 5191173..f8a7f27 100644 --- a/fluxbox/debian/patches/add-clientmachine-if-forwarded.patch +++ b/fluxbox/debian/patches/add-clientmachine-if-forwarded.patch @@ -79,7 +79,27 @@ Inspired by xfwm4's ability to display the remote host running an X11 window. Th using std::string; using std::list; -@@ -217,6 +218,10 @@ bool WinClient::getAttrib(XWindowAttribu +@@ -58,8 +59,10 @@ using std::cerr; + using std::hex; + using std::dec; + ++ + namespace { + ++ + void sendMessage(const WinClient& win, Atom atom, Time time) { + XEvent ce; + ce.xclient.type = ClientMessage; +@@ -104,6 +107,8 @@ WinClient::WinClient(Window win, BScreen + updateWMHints(); + updateWMNormalHints(); + updateWMClassHint(); ++ gethostname(hostname_char, 512); ++ hostname = FbTk::FbString(hostname_char); + updateTitle(); + Fluxbox::instance()->saveWindowSearch(win, this); + if (window_group != None) +@@ -217,6 +222,10 @@ bool WinClient::getAttrib(XWindowAttribu return XGetWindowAttributes(display(), window(), &attr); } @@ -90,15 +110,13 @@ Inspired by xfwm4's ability to display the remote host running an X11 window. Th bool WinClient::getWMName(XTextProperty &textprop) const { return XGetWMName(display(), window(), &textprop); } -@@ -319,7 +324,14 @@ void WinClient::updateTitle() { +@@ -319,7 +328,12 @@ void WinClient::updateTitle() { if (m_title_override) return; - m_title.setLogical(FbTk::FbString(Xutil::getWMName(window()), 0, 512)); + FbTk::FbString fullname = FbTk::FbString(Xutil::getWMName(window()), 0, 512); + FbTk::FbString clientmachine = FbTk::FbString(Xutil::getWMClientMachine(window()), 0, 512); -+ char *host = new char[512]; gethostname(host, 512); -+ FbTk::FbString hostname = FbTk::FbString(host); + if (clientmachine != "Unnamed" && clientmachine != "" && clientmachine != hostname) { + fullname += " (on " + clientmachine + ")"; + } @@ -106,15 +124,13 @@ Inspired by xfwm4's ability to display the remote host running an X11 window. Th m_title_update_timer.start(); } -@@ -328,7 +340,14 @@ void WinClient::emitTitleSig() { +@@ -328,7 +342,12 @@ void WinClient::emitTitleSig() { } void WinClient::setTitle(const FbTk::FbString &title) { - m_title.setLogical(title); + FbTk::FbString fullname = title; + FbTk::FbString clientmachine = FbTk::FbString(Xutil::getWMClientMachine(window()), 0, 512); -+ char *host = new char[512]; gethostname(host, 512); -+ FbTk::FbString hostname = FbTk::FbString(host); + if (clientmachine != "Unnamed" && clientmachine != "" && clientmachine != hostname) { + fullname += " (on " + clientmachine + ")"; + } @@ -124,7 +140,15 @@ Inspired by xfwm4's ability to display the remote host running an X11 window. Th } --- a/src/WinClient.hh +++ b/src/WinClient.hh -@@ -91,6 +91,7 @@ public: +@@ -31,6 +31,7 @@ + class BScreen; + class Strut; + ++ + /// Holds client window info + class WinClient: public Focusable, public FbTk::FbWindow { + public: +@@ -91,6 +92,7 @@ public: // bool getAttrib(XWindowAttributes &attr) const; @@ -132,3 +156,12 @@ Inspired by xfwm4's ability to display the remote host running an X11 window. Th bool getWMName(XTextProperty &textprop) const; bool getWMIconName(XTextProperty &textprop) const; std::string getWMRole() const; +@@ -141,6 +143,8 @@ public: + unsigned long initial_state, normal_hint_flags, wm_hint_flags; + + private: ++ char hostname_char[512]; ++ FbTk::FbString hostname; + /// removes client from any waiting list and clears empty waiting lists + void removeTransientFromWaitingList(); + -- cgit From 754024033108d13b7562b83a906afda24d4f7ff3 Mon Sep 17 00:00:00 2001 From: "B. Stack" Date: Sat, 26 Nov 2022 11:31:20 -0500 Subject: add tuneable: session.screen0.showClientmachine --- .../patches/add-clientmachine-if-forwarded.patch | 119 ++++++++++++++++----- 1 file changed, 90 insertions(+), 29 deletions(-) (limited to 'fluxbox/debian/patches/add-clientmachine-if-forwarded.patch') diff --git a/fluxbox/debian/patches/add-clientmachine-if-forwarded.patch b/fluxbox/debian/patches/add-clientmachine-if-forwarded.patch index f8a7f27..e55e13a 100644 --- a/fluxbox/debian/patches/add-clientmachine-if-forwarded.patch +++ b/fluxbox/debian/patches/add-clientmachine-if-forwarded.patch @@ -1,7 +1,7 @@ Author: bgstack15 -Date: 2022-11-09 +Date: 2022-11-26 Version: fluxbox 1.4.0 -Source: original +Source: bgstack15 Summary: Add "(on $CLIENT)" to titlebar for forwarded windows Message: Inspired by xfwm4's ability to display the remote host running an X11 window. This fails on xfe which somehow lacks the WM_CLIENT_MACHINE property. @@ -79,18 +79,7 @@ Inspired by xfwm4's ability to display the remote host running an X11 window. Th using std::string; using std::list; -@@ -58,8 +59,10 @@ using std::cerr; - using std::hex; - using std::dec; - -+ - namespace { - -+ - void sendMessage(const WinClient& win, Atom atom, Time time) { - XEvent ce; - ce.xclient.type = ClientMessage; -@@ -104,6 +107,8 @@ WinClient::WinClient(Window win, BScreen +@@ -104,6 +105,8 @@ WinClient::WinClient(Window win, BScreen updateWMHints(); updateWMNormalHints(); updateWMClassHint(); @@ -99,7 +88,7 @@ Inspired by xfwm4's ability to display the remote host running an X11 window. Th updateTitle(); Fluxbox::instance()->saveWindowSearch(win, this); if (window_group != None) -@@ -217,6 +222,10 @@ bool WinClient::getAttrib(XWindowAttribu +@@ -217,6 +220,10 @@ bool WinClient::getAttrib(XWindowAttribu return XGetWindowAttributes(display(), window(), &attr); } @@ -110,15 +99,17 @@ Inspired by xfwm4's ability to display the remote host running an X11 window. Th bool WinClient::getWMName(XTextProperty &textprop) const { return XGetWMName(display(), window(), &textprop); } -@@ -319,7 +328,12 @@ void WinClient::updateTitle() { +@@ -319,7 +326,14 @@ void WinClient::updateTitle() { if (m_title_override) return; - m_title.setLogical(FbTk::FbString(Xutil::getWMName(window()), 0, 512)); + FbTk::FbString fullname = FbTk::FbString(Xutil::getWMName(window()), 0, 512); -+ FbTk::FbString clientmachine = FbTk::FbString(Xutil::getWMClientMachine(window()), 0, 512); -+ if (clientmachine != "Unnamed" && clientmachine != "" && clientmachine != hostname) { -+ fullname += " (on " + clientmachine + ")"; ++ if (m_screen.isShowClient()) { ++ FbTk::FbString clientmachine = FbTk::FbString(Xutil::getWMClientMachine(window()), 0, 512); ++ if (clientmachine != "Unnamed" && clientmachine != "" && clientmachine != hostname) { ++ fullname += " (on " + clientmachine + ")"; ++ } + } + m_title.setLogical(fullname); m_title_update_timer.start(); @@ -140,15 +131,7 @@ Inspired by xfwm4's ability to display the remote host running an X11 window. Th } --- a/src/WinClient.hh +++ b/src/WinClient.hh -@@ -31,6 +31,7 @@ - class BScreen; - class Strut; - -+ - /// Holds client window info - class WinClient: public Focusable, public FbTk::FbWindow { - public: -@@ -91,6 +92,7 @@ public: +@@ -91,6 +91,7 @@ public: // bool getAttrib(XWindowAttributes &attr) const; @@ -156,7 +139,7 @@ Inspired by xfwm4's ability to display the remote host running an X11 window. Th bool getWMName(XTextProperty &textprop) const; bool getWMIconName(XTextProperty &textprop) const; std::string getWMRole() const; -@@ -141,6 +143,8 @@ public: +@@ -141,6 +142,8 @@ public: unsigned long initial_state, normal_hint_flags, wm_hint_flags; private: @@ -165,3 +148,81 @@ Inspired by xfwm4's ability to display the remote host running an X11 window. Th /// removes client from any waiting list and clears empty waiting lists void removeTransientFromWaitingList(); +--- a/src/ConfigMenu.cc ++++ b/src/ConfigMenu.cc +@@ -344,6 +344,10 @@ void ConfigMenu::setup(FbTk::Menu& menu, + "Workspace Warping", + "Workspace Warping - dragging windows to the edge and onto the next workspace", + sh.resource.workspace_warping, saverc_cmd); ++ _BOOLITEM(menu, Configmenu, WorkspaceShowClientmachine, ++ "Show (on $CLIENT)", ++ "Show clientmachine if not running on localhost", ++ sh.resource.show_clientmachine, saverc_cmd); + + #undef _BOOLITEM + +--- a/src/Screen.hh ++++ b/src/Screen.hh +@@ -99,6 +99,7 @@ public: + bool isWorkspaceWarpingVertical() const { return isWorkspaceWarping() && *resource.workspace_warping_vertical; } + int getWorkspaceWarpingHorizontalOffset() const { return *resource.workspace_warping_horizontal_offset; } + int getWorkspaceWarpingVerticalOffset() const { return *resource.workspace_warping_vertical_offset; } ++ bool isShowClient() const { return *resource.show_clientmachine; } + bool doAutoRaise() const { return *resource.auto_raise; } + bool clickRaises() const { return *resource.click_raises; } + bool doOpaqueMove() const { return *resource.opaque_move; } +--- a/src/ScreenResource.cc ++++ b/src/ScreenResource.cc +@@ -93,6 +93,7 @@ ScreenResource::ScreenResource(FbTk::Res + workspace_warping_vertical(rm, true, scrname+".workspacewarpingvertical", altscrname+".WorkspaceWarpingVertical"), + workspace_warping_horizontal_offset(rm, 1, scrname+".workspacewarpinghorizontaloffset", altscrname+".WorkspaceWarpingHorizontalOffset"), + workspace_warping_vertical_offset(rm, 1, scrname+".workspacewarpingverticaloffset", altscrname+".WorkspaceWarpingVerticalOffset"), ++ show_clientmachine(rm, true, scrname+".showClientmachine", altscrname+".ShowClientmachine"), + show_window_pos(rm, false, scrname+".showwindowposition", altscrname+".ShowWindowPosition"), + auto_raise(rm, true, scrname+".autoRaise", altscrname+".AutoRaise"), + click_raises(rm, true, scrname+".clickRaises", altscrname+".ClickRaises"), +--- a/src/ScreenResource.hh ++++ b/src/ScreenResource.hh +@@ -40,6 +40,7 @@ struct ScreenResource { + workspace_warping, + workspace_warping_horizontal, + workspace_warping_vertical, ++ show_clientmachine, + show_window_pos, + auto_raise, + click_raises; +--- a/nls/C/Translation.m ++++ b/nls/C/Translation.m +@@ -83,6 +83,7 @@ $set 4 #Configmenu + 27 Ignore Resize Increment + 28 Disable Moving + 29 Disable Resizing ++33 Show clientmachine + + $set 5 #Ewmh_OBSOLETE + +--- a/nls/fluxbox-nls.hh ++++ b/nls/fluxbox-nls.hh +@@ -90,6 +90,7 @@ enum { + ConfigmenuStrictMouseFocus = 30, + ConfigmenuFocusSameHead = 31, + ConfigmenuOpaqueResize = 32, ++ ConfigmenuWorkspaceShowClientmachine = 33, + + EwmhSet = 5, + EwmhOutOfMemoryClientList = 1, +--- a/doc/asciidoc/fluxbox.txt ++++ b/doc/asciidoc/fluxbox.txt +@@ -1084,6 +1084,12 @@ across the edge of the screen. + + + Default: *True* + ++*session.screen0.showClientmachine*: 'boolean':: ++This enables in the titlebar an indication of forwarded client windows ++with "(on $CLIENT)" appended to the main title. +++ ++Default: *True* ++ + *session.screen0.showwindowposition*: 'boolean':: + Setting this resource to True shows the user, in a little window, + the exact position of the application window while the user is -- cgit From e8aa62b3931d58e6dba87c97ec6c06719bfb2258 Mon Sep 17 00:00:00 2001 From: "B. Stack" Date: Sat, 26 Nov 2022 12:39:45 -0500 Subject: use tuneable everywhere --- .../patches/add-clientmachine-if-forwarded.patch | 270 +++++++++++---------- 1 file changed, 136 insertions(+), 134 deletions(-) (limited to 'fluxbox/debian/patches/add-clientmachine-if-forwarded.patch') diff --git a/fluxbox/debian/patches/add-clientmachine-if-forwarded.patch b/fluxbox/debian/patches/add-clientmachine-if-forwarded.patch index e55e13a..4da9714 100644 --- a/fluxbox/debian/patches/add-clientmachine-if-forwarded.patch +++ b/fluxbox/debian/patches/add-clientmachine-if-forwarded.patch @@ -5,70 +5,84 @@ Source: bgstack15 Summary: Add "(on $CLIENT)" to titlebar for forwarded windows Message: Inspired by xfwm4's ability to display the remote host running an X11 window. This fails on xfe which somehow lacks the WM_CLIENT_MACHINE property. ---- a/src/Xutil.cc -+++ b/src/Xutil.cc -@@ -43,6 +43,51 @@ using std::endl; - - namespace Xutil { +--- a/doc/asciidoc/fluxbox.txt ++++ b/doc/asciidoc/fluxbox.txt +@@ -1084,6 +1084,12 @@ across the edge of the screen. + + + Default: *True* -+FbTk::FbString getWMClientMachine(Window window) { -+ -+ if (window == None) -+ return FbTk::FbString(""); -+ -+ Display *display = FbTk::App::instance()->display(); -+ -+ XTextProperty text_prop; -+ text_prop.value = 0; -+ char **list = 0; -+ int num = 0; -+ _FB_USES_NLS; -+ FbTk::FbString name; -+ -+ if (XGetWMClientMachine(display, window, &text_prop)) { -+ if (text_prop.value && text_prop.nitems > 0) { -+ if (text_prop.encoding != XA_STRING) { -+ -+ text_prop.nitems = strlen((char *) text_prop.value); -+ XmbTextPropertyToTextList(display, &text_prop, &list, &num); -+ -+ if (num > 0 && list != 0) -+ name = FbTk::FbStringUtil::LocaleStrToFb(static_cast(*list)); -+ else -+ name = text_prop.value ? FbTk::FbStringUtil::XStrToFb((char *)text_prop.value) : ""; -+ -+ if (list) -+ XFreeStringList(list); -+ -+ } else -+ name = text_prop.value ? FbTk::FbStringUtil::XStrToFb((char *)text_prop.value) : ""; -+ -+ XFree(text_prop.value); -+ -+ } else { // default name -+ name = _FB_XTEXT(Window, Unnamed, "Unnamed", "Default name for a window without a WM_NAME"); -+ } -+ } else { -+ // default name -+ name = _FB_XTEXT(Window, Unnamed, "Unnamed", "Default name for a window without a WM_NAME"); -+ } -+ -+ return name; -+} ++*session.screen0.showClientmachine*: 'boolean':: ++This enables in the titlebar an indication of forwarded client windows ++with "(on $CLIENT)" appended to the main title. +++ ++Default: *True* + - FbTk::FbString getWMName(Window window) { + *session.screen0.showwindowposition*: 'boolean':: + Setting this resource to True shows the user, in a little window, + the exact position of the application window while the user is +--- a/nls/C/Translation.m ++++ b/nls/C/Translation.m +@@ -83,6 +83,7 @@ $set 4 #Configmenu + 27 Ignore Resize Increment + 28 Disable Moving + 29 Disable Resizing ++33 Show clientmachine - if (window == None) ---- a/src/Xutil.hh -+++ b/src/Xutil.hh -@@ -28,6 +28,7 @@ + $set 5 #Ewmh_OBSOLETE - namespace Xutil { +--- a/nls/fluxbox-nls.hh ++++ b/nls/fluxbox-nls.hh +@@ -90,6 +90,7 @@ enum { + ConfigmenuStrictMouseFocus = 30, + ConfigmenuFocusSameHead = 31, + ConfigmenuOpaqueResize = 32, ++ ConfigmenuWorkspaceShowClientmachine = 33, -+FbTk::FbString getWMClientMachine(Window window); - FbTk::FbString getWMName(Window window); + EwmhSet = 5, + EwmhOutOfMemoryClientList = 1, +--- a/src/ConfigMenu.cc ++++ b/src/ConfigMenu.cc +@@ -344,6 +344,10 @@ void ConfigMenu::setup(FbTk::Menu& menu, + "Workspace Warping", + "Workspace Warping - dragging windows to the edge and onto the next workspace", + sh.resource.workspace_warping, saverc_cmd); ++ _BOOLITEM(menu, Configmenu, WorkspaceShowClientmachine, ++ "Show (on $CLIENT)", ++ "Show clientmachine if not running on localhost", ++ sh.resource.show_clientmachine, saverc_cmd); - FbTk::FbString getWMClassName(Window win); + #undef _BOOLITEM + +--- a/src/Screen.hh ++++ b/src/Screen.hh +@@ -99,6 +99,7 @@ public: + bool isWorkspaceWarpingVertical() const { return isWorkspaceWarping() && *resource.workspace_warping_vertical; } + int getWorkspaceWarpingHorizontalOffset() const { return *resource.workspace_warping_horizontal_offset; } + int getWorkspaceWarpingVerticalOffset() const { return *resource.workspace_warping_vertical_offset; } ++ bool isShowClient() const { return *resource.show_clientmachine; } + bool doAutoRaise() const { return *resource.auto_raise; } + bool clickRaises() const { return *resource.click_raises; } + bool doOpaqueMove() const { return *resource.opaque_move; } +--- a/src/ScreenResource.cc ++++ b/src/ScreenResource.cc +@@ -93,6 +93,7 @@ ScreenResource::ScreenResource(FbTk::Res + workspace_warping_vertical(rm, true, scrname+".workspacewarpingvertical", altscrname+".WorkspaceWarpingVertical"), + workspace_warping_horizontal_offset(rm, 1, scrname+".workspacewarpinghorizontaloffset", altscrname+".WorkspaceWarpingHorizontalOffset"), + workspace_warping_vertical_offset(rm, 1, scrname+".workspacewarpingverticaloffset", altscrname+".WorkspaceWarpingVerticalOffset"), ++ show_clientmachine(rm, true, scrname+".showClientmachine", altscrname+".ShowClientmachine"), + show_window_pos(rm, false, scrname+".showwindowposition", altscrname+".ShowWindowPosition"), + auto_raise(rm, true, scrname+".autoRaise", altscrname+".AutoRaise"), + click_raises(rm, true, scrname+".clickRaises", altscrname+".ClickRaises"), +--- a/src/ScreenResource.hh ++++ b/src/ScreenResource.hh +@@ -40,6 +40,7 @@ struct ScreenResource { + workspace_warping, + workspace_warping_horizontal, + workspace_warping_vertical, ++ show_clientmachine, + show_window_pos, + auto_raise, + click_raises; --- a/src/WinClient.cc +++ b/src/WinClient.cc @@ -49,6 +49,7 @@ @@ -115,15 +129,17 @@ Inspired by xfwm4's ability to display the remote host running an X11 window. Th m_title_update_timer.start(); } -@@ -328,7 +342,12 @@ void WinClient::emitTitleSig() { +@@ -328,7 +342,14 @@ void WinClient::emitTitleSig() { } void WinClient::setTitle(const FbTk::FbString &title) { - m_title.setLogical(title); + FbTk::FbString fullname = title; -+ FbTk::FbString clientmachine = FbTk::FbString(Xutil::getWMClientMachine(window()), 0, 512); -+ if (clientmachine != "Unnamed" && clientmachine != "" && clientmachine != hostname) { -+ fullname += " (on " + clientmachine + ")"; ++ if (m_screen.isShowClient()) { ++ FbTk::FbString clientmachine = FbTk::FbString(Xutil::getWMClientMachine(window()), 0, 512); ++ if (clientmachine != "Unnamed" && clientmachine != "" && clientmachine != hostname) { ++ fullname += " (on " + clientmachine + ")"; ++ } + } + m_title.setLogical(fullname); m_title_override = true; @@ -148,81 +164,67 @@ Inspired by xfwm4's ability to display the remote host running an X11 window. Th /// removes client from any waiting list and clears empty waiting lists void removeTransientFromWaitingList(); ---- a/src/ConfigMenu.cc -+++ b/src/ConfigMenu.cc -@@ -344,6 +344,10 @@ void ConfigMenu::setup(FbTk::Menu& menu, - "Workspace Warping", - "Workspace Warping - dragging windows to the edge and onto the next workspace", - sh.resource.workspace_warping, saverc_cmd); -+ _BOOLITEM(menu, Configmenu, WorkspaceShowClientmachine, -+ "Show (on $CLIENT)", -+ "Show clientmachine if not running on localhost", -+ sh.resource.show_clientmachine, saverc_cmd); +--- a/src/Xutil.cc ++++ b/src/Xutil.cc +@@ -43,6 +43,51 @@ using std::endl; - #undef _BOOLITEM + namespace Xutil { ---- a/src/Screen.hh -+++ b/src/Screen.hh -@@ -99,6 +99,7 @@ public: - bool isWorkspaceWarpingVertical() const { return isWorkspaceWarping() && *resource.workspace_warping_vertical; } - int getWorkspaceWarpingHorizontalOffset() const { return *resource.workspace_warping_horizontal_offset; } - int getWorkspaceWarpingVerticalOffset() const { return *resource.workspace_warping_vertical_offset; } -+ bool isShowClient() const { return *resource.show_clientmachine; } - bool doAutoRaise() const { return *resource.auto_raise; } - bool clickRaises() const { return *resource.click_raises; } - bool doOpaqueMove() const { return *resource.opaque_move; } ---- a/src/ScreenResource.cc -+++ b/src/ScreenResource.cc -@@ -93,6 +93,7 @@ ScreenResource::ScreenResource(FbTk::Res - workspace_warping_vertical(rm, true, scrname+".workspacewarpingvertical", altscrname+".WorkspaceWarpingVertical"), - workspace_warping_horizontal_offset(rm, 1, scrname+".workspacewarpinghorizontaloffset", altscrname+".WorkspaceWarpingHorizontalOffset"), - workspace_warping_vertical_offset(rm, 1, scrname+".workspacewarpingverticaloffset", altscrname+".WorkspaceWarpingVerticalOffset"), -+ show_clientmachine(rm, true, scrname+".showClientmachine", altscrname+".ShowClientmachine"), - show_window_pos(rm, false, scrname+".showwindowposition", altscrname+".ShowWindowPosition"), - auto_raise(rm, true, scrname+".autoRaise", altscrname+".AutoRaise"), - click_raises(rm, true, scrname+".clickRaises", altscrname+".ClickRaises"), ---- a/src/ScreenResource.hh -+++ b/src/ScreenResource.hh -@@ -40,6 +40,7 @@ struct ScreenResource { - workspace_warping, - workspace_warping_horizontal, - workspace_warping_vertical, -+ show_clientmachine, - show_window_pos, - auto_raise, - click_raises; ---- a/nls/C/Translation.m -+++ b/nls/C/Translation.m -@@ -83,6 +83,7 @@ $set 4 #Configmenu - 27 Ignore Resize Increment - 28 Disable Moving - 29 Disable Resizing -+33 Show clientmachine ++FbTk::FbString getWMClientMachine(Window window) { ++ ++ if (window == None) ++ return FbTk::FbString(""); ++ ++ Display *display = FbTk::App::instance()->display(); ++ ++ XTextProperty text_prop; ++ text_prop.value = 0; ++ char **list = 0; ++ int num = 0; ++ _FB_USES_NLS; ++ FbTk::FbString name; ++ ++ if (XGetWMClientMachine(display, window, &text_prop)) { ++ if (text_prop.value && text_prop.nitems > 0) { ++ if (text_prop.encoding != XA_STRING) { ++ ++ text_prop.nitems = strlen((char *) text_prop.value); ++ XmbTextPropertyToTextList(display, &text_prop, &list, &num); ++ ++ if (num > 0 && list != 0) ++ name = FbTk::FbStringUtil::LocaleStrToFb(static_cast(*list)); ++ else ++ name = text_prop.value ? FbTk::FbStringUtil::XStrToFb((char *)text_prop.value) : ""; ++ ++ if (list) ++ XFreeStringList(list); ++ ++ } else ++ name = text_prop.value ? FbTk::FbStringUtil::XStrToFb((char *)text_prop.value) : ""; ++ ++ XFree(text_prop.value); ++ ++ } else { // default name ++ name = _FB_XTEXT(Window, Unnamed, "Unnamed", "Default name for a window without a WM_NAME"); ++ } ++ } else { ++ // default name ++ name = _FB_XTEXT(Window, Unnamed, "Unnamed", "Default name for a window without a WM_NAME"); ++ } ++ ++ return name; ++} ++ + FbTk::FbString getWMName(Window window) { - $set 5 #Ewmh_OBSOLETE + if (window == None) +--- a/src/Xutil.hh ++++ b/src/Xutil.hh +@@ -28,6 +28,7 @@ ---- a/nls/fluxbox-nls.hh -+++ b/nls/fluxbox-nls.hh -@@ -90,6 +90,7 @@ enum { - ConfigmenuStrictMouseFocus = 30, - ConfigmenuFocusSameHead = 31, - ConfigmenuOpaqueResize = 32, -+ ConfigmenuWorkspaceShowClientmachine = 33, + namespace Xutil { - EwmhSet = 5, - EwmhOutOfMemoryClientList = 1, ---- a/doc/asciidoc/fluxbox.txt -+++ b/doc/asciidoc/fluxbox.txt -@@ -1084,6 +1084,12 @@ across the edge of the screen. - + - Default: *True* ++FbTk::FbString getWMClientMachine(Window window); + FbTk::FbString getWMName(Window window); -+*session.screen0.showClientmachine*: 'boolean':: -+This enables in the titlebar an indication of forwarded client windows -+with "(on $CLIENT)" appended to the main title. -++ -+Default: *True* -+ - *session.screen0.showwindowposition*: 'boolean':: - Setting this resource to True shows the user, in a little window, - the exact position of the application window while the user is + FbTk::FbString getWMClassName(Window win); -- cgit