#pragma once /* * The initial "port" of dwm to curses was done by * * © 2007-2016 Marc André Tanner * © 2020-???? Nicholas Noll * * It is highly inspired by the original X11 dwm and * reuses some code of it which is mostly * * © 2006-2007 Anselm R. Garbe * * See LICENSE for details. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "vt.h" #ifdef PDCURSES int ESCDELAY; #endif #ifndef NCURSES_REENTRANT # define set_escdelay(d) (ESCDELAY = (d)) #endif typedef struct { float mfact; unsigned int nmaster; int history; int w; int h; volatile sig_atomic_t need_resize; } Screen; typedef struct { const char *symbol; void (*arrange)(void); } Layout; typedef struct Client Client; struct Client { WINDOW *window; Vt *term; Vt *editor, *app; int editor_fds[2]; volatile sig_atomic_t editor_died; const char *cmd; char title[255]; int order; pid_t pid; ushort id; ushort x; ushort y; ushort w; ushort h; bool has_title_line; bool minimized; bool urgent; volatile sig_atomic_t died; Client *next; Client *prev; Client *snext; unsigned int tags; }; typedef struct { short fg; short bg; short fg256; short bg256; short pair; } Color; typedef struct { const char *title; attr_t attrs; Color *color; } ColorRule; #define ALT(k) ((k) + (161 - 'a')) #if defined CTRL && defined _AIX #undef CTRL #endif #ifndef CTRL #define CTRL(k) ((k) & 0x1F) #endif #define CTRL_ALT(k) ((k) + (129 - 'a')) #define MAX_ARGS 8 typedef struct { void (*cmd)(const char *args[]); const char *args[3]; } Action; #define MAX_KEYS 3 typedef unsigned int KeyCombo[MAX_KEYS]; typedef struct { KeyCombo keys; Action action; } KeyBinding; typedef struct { mmask_t mask; Action action; } Button; typedef struct { const char *name; Action action; } Cmd; enum { BAR_TOP, BAR_BOTTOM, BAR_OFF }; typedef struct { int fd; int pos, lastpos; bool autohide; ushort h; ushort y; char text[512]; const char *file; } StatusBar; typedef struct { int fd; const char *file; ushort id; } CmdFifo; typedef struct { char *data; size_t len; size_t size; } Register; typedef struct { char *name; const char *argv[4]; bool filter; bool color; } Editor; #define TAGMASK ((1 << arrlen(tags)) - 1) #ifdef NDEBUG #define debug(format, args...) #else #define debug eprint #endif /* commands for use by keybindings */ void create(const char *args[]); void copymode(const char *args[]); void focusn(const char *args[]); void focusid(const char *args[]); void focusnext(const char *args[]); void focusnextnm(const char *args[]); void focusprev(const char *args[]); void focusprevnm(const char *args[]); void focuslast(const char *args[]); void focusup(const char *args[]); void focusdown(const char *args[]); void focusleft(const char *args[]); void focusright(const char *args[]); void killclient(const char *args[]); void paste(const char *args[]); void quit(const char *args[]); void redraw(const char *args[]); void scrollback(const char *args[]); void send(const char *args[]); void setlayout(const char *args[]); void incnmaster(const char *args[]); void setmfact(const char *args[]); void startup(const char *args[]); void tag(const char *args[]); void tagid(const char *args[]); void togglebar(const char *args[]); void togglebarpos(const char *args[]); void toggleminimize(const char *args[]); void togglemouse(const char *args[]); void togglerunall(const char *args[]); void toggletag(const char *args[]); void toggleview(const char *args[]); void viewprevtag(const char *args[]); void view(const char *args[]); void zoom(const char *args[]); /* commands for use by mouse bindings */ void mouse_focus(const char *args[]); void mouse_fullscreen(const char *args[]); void mouse_minimize(const char *args[]); void mouse_zoom(const char *args[]); /* functions and variables available to layouts via config.h */ Client* nextvisible(Client *c); void focus(Client *c); void resize(Client *c, int x, int y, int w, int h); extern Screen screen; extern unsigned int waw, wah, wax, way; extern Client *clients; extern char *title; void fibonacci(int s); void spiral(void); void dwindle(void); void fullscreen(void); void grid(void); void tile(void); void tstack(void); void bstack(void); void vstack(void); #include "config.h"