LOGIN / SIGN UP

#237 Allow static placement of WorkspaceIndicator

Reported by: askreet Assigned to: pekdon
Phase: release-0.1.11 Component: configuration
Type: enhancement Status: fixed
Priority: 5: Very low
Watchers:

Description

Hi, not sure if this is the right place to submit a patch. I'm pretty novice at C++ but hacking this functionality in was pretty straight-forward. I wanted to be able to place the Workspace Indicator in a reliable location, and not cut in half on my two monitors. You suggested HonourRandR, but I was hoping to place it in the top-left.

Here is a git diff of my changes: diff --git a/src/Config.cc b/src/Config.cc index 606d16e..377e4f0 100644 --- a/src/Config.cc +++ b/src/Config.cc @@ -93,6 +93,8 @@ Config::Config(void) :

         _screen_show_status_window(true), _screen_show_status_window_on_root(false),
         _screen_show_client_id(false),
         _screen_show_workspace_indicator(500), _screen_workspace_indicator_scale(16),

+ _screen_workspace_indicator_center(true), + _screen_workspace_indicator_x(0), _screen_workspace_indicator_y(0),

         _screen_place_new(true), _screen_focus_new(false),
         _screen_focus_new_child(true), _screen_honour_randr(true),
         _screen_honour_aspectratio(true),

@@ -587,6 +589,9 @@ Config::loadScreen(CfgParser::Entry *section)

                                            _screen_show_workspace_indicator, 500, 0));
     key_list.push_back(new CfgParserKeyNumeric<int>("WORKSPACEINDICATORSCALE",
                                            _screen_workspace_indicator_scale, 16, 2)); 

+ key_list.push_back(new CfgParserKeyBool("WORKSPACEINDICATORCENTER", _screen_workspace_indicator_center)); + key_list.push_back(new CfgParserKeyNumeric<int>("WORKSPACEINDICATORX", _screen_workspace_indicator_x)); + key_list.push_back(new CfgParserKeyNumeric<int>("WORKSPACEINDICATORY", _screen_workspace_indicator_y));

     key_list.push_back(new CfgParserKeyBool("PLACENEW", _screen_place_new));
     key_list.push_back(new CfgParserKeyBool("FOCUSNEW", _screen_focus_new));
     key_list.push_back(new CfgParserKeyBool("FOCUSNEWCHILD", _screen_focus_new_child, true));

diff --git a/src/Config.hh b/src/Config.hh index e4c1a32..92a687d 100644 --- a/src/Config.hh +++ b/src/Config.hh @@ -125,6 +125,9 @@ public:

     inline bool isShowClientID(void) const { return _screen_show_client_id; }
     int getShowWorkspaceIndicator(void) const { return _screen_show_workspace_indicator; }
     int getWorkspaceIndicatorScale(void) const { return _screen_workspace_indicator_scale; }

+ bool getWorkspaceIndicatorCenter(void) const { return _screen_workspace_indicator_center; } + int getWorkspaceIndicatorX(void) const { return _screen_workspace_indicator_x; } + int getWorkspaceIndicatorY(void) const { return _screen_workspace_indicator_y; }

     inline bool isPlaceNew(void) const { return _screen_place_new; }
     inline bool isFocusNew(void) const { return _screen_focus_new; }
     inline bool isFocusNewChild(void) const { return _screen_focus_new_child; }

@@ -273,6 +276,8 @@ private:

     bool _screen_show_client_id; //!< Flag to display client ID in title.
     int _screen_show_workspace_indicator; //!< Display workspace indicator for N seconds.
     int _screen_workspace_indicator_scale; //!< Scale of the workspace indicator head

+ bool _screen_workspace_indicator_center; // Draw WorkspaceIndicator at centered location + int _screen_workspace_indicator_x, _screen_workspace_indicator_y; // Location to draw WorkspaceIndicator if above is false

     bool _screen_place_new, _screen_focus_new, _screen_focus_new_child;
     bool _screen_honour_randr; /**< Boolean flag if randr information should be honoured. */
     bool _screen_honour_aspectratio; /**< if true, pekwm keeps aspect ratio (XSizeHint) */

diff --git a/src/WorkspaceIndicator.cc b/src/WorkspaceIndicator.cc index c145161..47d7b00 100644 --- a/src/WorkspaceIndicator.cc +++ b/src/WorkspaceIndicator.cc @@ -229,8 +229,14 @@ WorkspaceIndicator::render(void)

     _display_wo.getSizeRequest(request);
     resizeChild(request.width, request.height);
 

- move(head.x + (head.width - _gm.width) / 2, - head.y + (head.height - _gm.height) / 2); + if(Config::instance()->getWorkspaceIndicatorCenter()) + { + move(head.x + (head.width - _gm.width) / 2, + head.y + (head.height - _gm.height) / 2); + } else { + move(head.x + Config::instance()->getWorkspaceIndicatorX(), + head.y + Config::instance()->getWorkspaceIndicatorY()); + }

 
     // Render workspaces
     _display_wo.render();

- Kyle

2010-02-09

05:07:19

Well, that came out like shit after I submitted it.

Here: http://paste2.org/p/658051