aboutsummaryrefslogtreecommitdiff
path: root/sys/cmd/dwm/func.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/cmd/dwm/func.c')
-rw-r--r--sys/cmd/dwm/func.c217
1 files changed, 0 insertions, 217 deletions
diff --git a/sys/cmd/dwm/func.c b/sys/cmd/dwm/func.c
deleted file mode 100644
index 5b0df24..0000000
--- a/sys/cmd/dwm/func.c
+++ /dev/null
@@ -1,217 +0,0 @@
-#include "dwm.h"
-
-void
-chvt(const Arg *arg)
-{
- struct wlr_session *s;
-
- s = wlr_backend_get_session(dwm.backend);
- if (!s)
- return;
-
- wlr_session_change_vt(s, arg->ui);
-}
-
-void
-incmaster(const Arg *arg)
-{
- monitor->nmaster = MAX(monitor->nmaster + arg->i, 0);
- arrange(monitor);
-}
-
-void
-focusmonitor(const Arg *arg)
-{
- Monitor *m;
-
- m = getmonitor(arg->i);
-
- if (m == monitor)
- return;
-
- monitor = m;
- setfocus(lastfocus(), nil, 1);
-}
-
-void
-focusstack(const Arg *arg)
-{
- Client *c, *sel;
-
- sel = getclient();
- if (!sel)
- return;
-
- if (arg->i > 0) {
- wl_list_for_each(c, &sel->link.tiles, link.tiles) {
- if (&c->link.tiles == &dwm.tiles)
- continue;
- if (VISIBLEON(c, monitor))
- break;
- }
- } else {
- wl_list_for_each_reverse(c, &sel->link.tiles, link.tiles) {
- if (&c->link.tiles == &dwm.tiles)
- continue; /* wrap past the sentinel node */
- if (VISIBLEON(c, monitor))
- break; /* found it */
- }
- }
- /* If only one client is visible on selmon, then c == sel */
- setfocus(c, nil, 1);
-}
-
-void
-moveresize(const Arg *arg)
-{
- grab.c = clientat(mouse.cursor->x, mouse.cursor->y);
- if (!grab.c)
- return;
-
- /* Float the window and tell motionnotify to grab it */
- setfloating(grab.c, 1);
- switch (mouse.mode = arg->ui) {
- case MouseMove:
- grab.x = mouse.cursor->x - grab.c->dim.x;
- grab.y = mouse.cursor->y - grab.c->dim.y;
- wlr_xcursor_manager_set_cursor_image(mouse.manager, "fleur", mouse.cursor);
- break;
- case MouseResize:
- wlr_cursor_warp_closest(mouse.cursor, nil,
- grab.c->dim.x + grab.c->dim.width,
- grab.c->dim.y + grab.c->dim.height);
- wlr_xcursor_manager_set_cursor_image(mouse.manager, "bottom_right_corner", mouse.cursor);
- break;
- }
-}
-
-void
-quit(const Arg *arg)
-{
- wl_display_terminate(dwm.display);
-}
-
-void
-setlayout(const Arg *arg)
-{
- if (!arg || !arg->v || arg->v != monitor->lt[monitor->sellt])
- monitor->sellt ^= 1;
- if (arg && arg->v)
- monitor->lt[monitor->sellt] = (Layout *)arg->v;
-
- arrange(monitor);
-}
-
-void
-setmfact(const Arg *arg)
-{
- float f;
-
- if (!arg || !monitor->lt[monitor->sellt]->arrange)
- return;
- f = arg->f < 1.0 ? arg->f + monitor->mfact : arg->f - 1.0;
- if (f < 0.1 || f > 0.9)
- return;
- monitor->mfact = f;
- arrange(monitor);
-}
-
-void
-spawn(const Arg *arg)
-{
- pid_t pid;
- if ((pid=fork()) == 0) {
- setsid();
-
- printf("running %s\n", ((char**)arg->v)[0]);
- execvp(((char **)arg->v)[0], (char **)arg->v);
-
- fprintf(stderr, "dwl: execvp %s", ((char **)arg->v)[0]);
- perror(" failed");
- exit(EXIT_FAILURE);
- } else if (pid < 0)
- fatal("failed to fork");
-}
-
-void
-tag(const Arg *arg)
-{
- Client *c;
-
- c = getclient();
- if (c && arg->ui & TAGMASK) {
- c->tags = arg->ui & TAGMASK;
- setfocus(lastfocus(), nil, 1);
- arrange(monitor);
- }
-}
-
-void
-tagmonitor(const Arg *arg)
-{
- Client *c;
-
- c = getclient();
- if (!c)
- return;
- setmonitor(c, getmonitor(arg->i), 0);
-}
-
-void
-togglefloating(const Arg *arg)
-{
- Client *c;
-
- c = getclient();
- if (!c)
- return;
-
- setfloating(c, !c->floating);
-}
-
-void
-toggletag(const Arg *arg)
-{
- Client *c;
- uint newtags;
-
- c = getclient();
- if (!c)
- return;
- newtags = c->tags ^ (arg->ui & TAGMASK);
- if (newtags) {
- c->tags = newtags;
- setfocus(lastfocus(), nil, 1);
- arrange(monitor);
- }
-}
-
-void
-toggleview(const Arg *arg)
-{
- uint newtagset;
-
- newtagset = monitor->tagset[monitor->seltags] ^ (arg->ui & TAGMASK);
-
- if (newtagset) {
- monitor->tagset[monitor->seltags] = newtagset;
- setfocus(lastfocus(), nil, 1);
- arrange(monitor);
- }
-}
-
-void
-view(const Arg *arg)
-{
- if ((arg->ui & TAGMASK) == monitor->tagset[monitor->seltags])
- return;
-
- monitor->seltags ^= 1; /* toggle sel tagset */
- if (arg->ui & TAGMASK)
- monitor->tagset[monitor->seltags] = arg->ui & TAGMASK;
- setfocus(lastfocus(), nil, 1);
-
- arrange(monitor);
-}
-
-