Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ToggleDesktop() for switching desktops #181

Merged
merged 1 commit into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions toggle.c
Original file line number Diff line number Diff line change
Expand Up @@ -765,4 +765,26 @@ ToggleFullscreen(const Arg *arg)
setfullscreen(c, !ISFULLSCREEN(c));
}

void
ToggleDesktop(const Arg *arg)
{
if(!_wm.selmon || !_wm.selmon->desktops)
{ return;
}
u32 index = arg->ui;
Desktop *desk;
for(desk = _wm.selmon->desktops; desk; desk = nextdesktop(desk))
{
if(desk->num == index)
{
setdesktopsel(_wm.selmon, desk);
focus(NULL);
/* shouldnt need to as clients probably still retained order unless they got corrupted but just in case */
arrange(desk);
XCBFlush(_wm.dpy);
break;
}
}
}


2 changes: 2 additions & 0 deletions toggle.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,6 @@ void AltTab(const Arg *arg);
void ToggleStatusBar(const Arg *arg);
/* Toggles fullscreen mode for all windows in current tag */
void ToggleFullscreen(const Arg *arg);
/* Toggles desktop based on arg->ui, index starts at 0 */
void ToggleDesktop(const Arg *arg);
#endif