mirror of
https://github.com/debauchee/barrier.git
synced 2026-02-12 22:55:53 +08:00
Added toggleScreen function, using hot key to loop through all screens.
Comparing to switchToScreen, it is more handy since the user only need to hit one hotkey.
This commit is contained in:
@@ -163,6 +163,10 @@ Server::Server(
|
||||
m_inputFilter,
|
||||
new TMethodEventJob<Server>(this,
|
||||
&Server::handleSwitchToScreenEvent));
|
||||
m_events->adoptHandler(m_events->forServer().toggleScreen(),
|
||||
m_inputFilter,
|
||||
new TMethodEventJob<Server>(this,
|
||||
&Server::handleToggleScreenEvent));
|
||||
m_events->adoptHandler(m_events->forServer().switchInDirection(),
|
||||
m_inputFilter,
|
||||
new TMethodEventJob<Server>(this,
|
||||
@@ -1407,6 +1411,24 @@ Server::handleSwitchToScreenEvent(const Event& event, void*)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Server::handleToggleScreenEvent(const Event& event, void*)
|
||||
{
|
||||
std::string current = getName(m_active);
|
||||
ClientList::const_iterator index = m_clients.find(current);
|
||||
if (index == m_clients.end()) {
|
||||
LOG((CLOG_DEBUG1 "screen \"%s\" not active", current.c_str()));
|
||||
}
|
||||
else {
|
||||
++index;
|
||||
if (index == m_clients.end()) {
|
||||
index = m_clients.begin();
|
||||
}
|
||||
jumpToScreen(index->second);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Server::handleSwitchInDirectionEvent(const Event& event, void*)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user