YggdrasilWM  0.1.1
A tiny window manager coded in C++
FocusGroup Class Reference

FocusGroup implement the mecanism to switch between group. More...

#include <FocusGroup.hpp>

Inheritance diagram for FocusGroup:
Inheritance graph
Collaboration diagram for FocusGroup:
Collaboration graph

Public Member Functions

 FocusGroup ()
 
 ~FocusGroup () override=default
 
void execute (const std::string &args) override
 switch from the current active group to the group index passed as argument More...
 

Detailed Description

FocusGroup implement the mecanism to switch between group.

Constructor & Destructor Documentation

◆ FocusGroup()

FocusGroup::FocusGroup ( )
33  {
34 
35 }

◆ ~FocusGroup()

FocusGroup::~FocusGroup ( )
overridedefault

Member Function Documentation

◆ execute()

void FocusGroup::execute ( const std::string &  args)
overridevirtual

switch from the current active group to the group index passed as argument

Parameters
argsthe string will be parsed to an integer to switch to the group index

Implements CommandBase.

37  {
38  int index;
39  try {
40  index = std::stoi(args) - 1;
41  } catch ( const std::exception &e) {
42  Logger::GetInstance()->Log("Focus Group argument is not convertible to int",L_ERROR);
43  }
45  if (index < 0)
46  index = 0;
47  if (index > wm->getGroups().size())
48  index = wm->getGroups().size();
49  if (wm->getActiveGroup() != wm->getGroups()[index]) {
50  wm->getActiveGroup()->switchFrom();
51  wm->getGroups()[index]->switchTo();
52  }
53 }
@ L_ERROR
Definition: Logger.hpp:51
virtual void Log(const std::string &message, LogLevel level) const
Log a message This method logs a message to the log file or stream. The message is only logged if the...
Definition: Logger.cpp:73
static Logger * GetInstance()
Get the Logger object.
Definition: Logger.cpp:41
WindowManager class This class is responsible for managing the windows.in an X11 session....
Definition: WindowManager.hpp:59
std::shared_ptr< Group > getActiveGroup() const
get the current Active Group
Definition: WindowManager.cpp:272
static WindowManager * getInstance()
Get the WindowManager instance this is a singleton class this function returns the instance of the Wi...
Definition: WindowManager.cpp:244
const std::vector< std::shared_ptr< Group > > & getGroups() const
Get the Groups vector this function returns the groups vector the groups vector contains all the grou...
Definition: WindowManager.cpp:279

References WindowManager::getActiveGroup(), WindowManager::getGroups(), Logger::GetInstance(), WindowManager::getInstance(), L_ERROR, and Logger::Log().

Here is the call graph for this function:

The documentation for this class was generated from the following files: