diff --git a/KleinDwm/source/IPCClient.c b/KleinDwm/IPCClient.c similarity index 100% rename from KleinDwm/source/IPCClient.c rename to KleinDwm/IPCClient.c diff --git a/KleinDwm/source/IPCClient.h b/KleinDwm/IPCClient.h similarity index 100% rename from KleinDwm/source/IPCClient.h rename to KleinDwm/IPCClient.h diff --git a/KleinDwm/source/Makefile b/KleinDwm/Makefile similarity index 100% rename from KleinDwm/source/Makefile rename to KleinDwm/Makefile diff --git a/KleinDwm/source/colors/default.h b/KleinDwm/colors/default.h similarity index 100% rename from KleinDwm/source/colors/default.h rename to KleinDwm/colors/default.h diff --git a/KleinDwm/source/colors/space.h b/KleinDwm/colors/space.h similarity index 100% rename from KleinDwm/source/colors/space.h rename to KleinDwm/colors/space.h diff --git a/KleinDwm/source/config.def.h b/KleinDwm/config.def.h similarity index 100% rename from KleinDwm/source/config.def.h rename to KleinDwm/config.def.h diff --git a/KleinDwm/source/config.def.h.orig b/KleinDwm/config.def.h.orig similarity index 100% rename from KleinDwm/source/config.def.h.orig rename to KleinDwm/config.def.h.orig diff --git a/KleinDwm/source/config.def.h.rej b/KleinDwm/config.def.h.rej similarity index 100% rename from KleinDwm/source/config.def.h.rej rename to KleinDwm/config.def.h.rej diff --git a/KleinDwm/source/config.h b/KleinDwm/config.h similarity index 93% rename from KleinDwm/source/config.h rename to KleinDwm/config.h index 52d869a..6e4a564 100644 --- a/KleinDwm/source/config.h +++ b/KleinDwm/config.h @@ -3,7 +3,6 @@ #include "colors/space.h" #include "keys.h" -#define TERMINAL "alacritty" // default terminal appearance */ #define ICONSIZE 20 /* icon size */ #define ICONSPACING 5 /* space between icon and title */ static const unsigned int borderpx = 2; /* border pixel of windows */ @@ -23,7 +22,9 @@ static const int user_bh = 8; /* 2 is the default spacing arou //static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; //static const char *tags[] = { " \u2680 ", " \u2681 ", " \u2682 ", " \u2683 ", " \u2684 ", " \u2685 ", " \u2661 ", " \u2665 ", "\u266c" }; // Dice Faces // tag1 tag2 tag3 tag4 tag5 tag6 tag7 tag8 tag9 -static const char *tags[] = { " \uf17c ", " \uf1d8 ", " \uf0ac ", " \uf109 ", " \uf09b ", " \uf02d ", " \uf044 ", " \uf1bc ", " \uf120 " }; +//static const char *tags[] = { " \uf17c ", " \uf1d8 ", " \uf0ac ", " \uf109 ", " \uf09b ", " \uf02d ", " \uf044 ", " \uf1bc ", " \uf120 " }; + +static const char *tags[] = { "\uf17c", "\uf1d8", "\uf0ac", "\uf109", "\uf09b", "\uf02d", "\uf044", "\uf1bc", "\uf120" }; static const Rule rules[] = { /* xprop(1): diff --git a/KleinDwm/source/config.mk b/KleinDwm/config.mk similarity index 100% rename from KleinDwm/source/config.mk rename to KleinDwm/config.mk diff --git a/KleinDwm/source/config.mk.orig b/KleinDwm/config.mk.orig similarity index 100% rename from KleinDwm/source/config.mk.orig rename to KleinDwm/config.mk.orig diff --git a/KleinDwm/source/config.mk.rej b/KleinDwm/config.mk.rej similarity index 100% rename from KleinDwm/source/config.mk.rej rename to KleinDwm/config.mk.rej diff --git a/KleinDwm/source/drw.c b/KleinDwm/drw.c similarity index 100% rename from KleinDwm/source/drw.c rename to KleinDwm/drw.c diff --git a/KleinDwm/source/drw.c.orig b/KleinDwm/drw.c.orig similarity index 100% rename from KleinDwm/source/drw.c.orig rename to KleinDwm/drw.c.orig diff --git a/KleinDwm/source/drw.h b/KleinDwm/drw.h similarity index 100% rename from KleinDwm/source/drw.h rename to KleinDwm/drw.h diff --git a/KleinDwm/source/drw.h.orig b/KleinDwm/drw.h.orig similarity index 100% rename from KleinDwm/source/drw.h.orig rename to KleinDwm/drw.h.orig diff --git a/KleinDwm/source/drw.o b/KleinDwm/drw.o similarity index 100% rename from KleinDwm/source/drw.o rename to KleinDwm/drw.o diff --git a/KleinDwm/dwm b/KleinDwm/dwm new file mode 100755 index 0000000..44d1b8c Binary files /dev/null and b/KleinDwm/dwm differ diff --git a/KleinDwm/source/dwm-msg b/KleinDwm/dwm-msg similarity index 100% rename from KleinDwm/source/dwm-msg rename to KleinDwm/dwm-msg diff --git a/KleinDwm/source/dwm-msg.c b/KleinDwm/dwm-msg.c similarity index 100% rename from KleinDwm/source/dwm-msg.c rename to KleinDwm/dwm-msg.c diff --git a/KleinDwm/source/dwm-msg.o b/KleinDwm/dwm-msg.o similarity index 100% rename from KleinDwm/source/dwm-msg.o rename to KleinDwm/dwm-msg.o diff --git a/KleinDwm/source/dwm.1 b/KleinDwm/dwm.1 similarity index 100% rename from KleinDwm/source/dwm.1 rename to KleinDwm/dwm.1 diff --git a/KleinDwm/source/dwm.1.orig b/KleinDwm/dwm.1.orig similarity index 100% rename from KleinDwm/source/dwm.1.orig rename to KleinDwm/dwm.1.orig diff --git a/KleinDwm/source/dwm.c.orig b/KleinDwm/dwm.c similarity index 95% rename from KleinDwm/source/dwm.c.orig rename to KleinDwm/dwm.c index 5907d42..9d0199a 100644 --- a/KleinDwm/source/dwm.c.orig +++ b/KleinDwm/dwm.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -86,9 +87,21 @@ enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms * enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ +typedef struct TagState TagState; +struct TagState { + int selected; + int occupied; + int urgent; +}; + +typedef struct ClientState ClientState; +struct ClientState { + int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; +}; + typedef union { - int i; - unsigned int ui; + long i; + unsigned long ui; float f; const void *v; } Arg; @@ -117,6 +130,7 @@ struct Client { Client *snext; Monitor *mon; Window win; + ClientState prevstate; }; typedef struct { @@ -135,6 +149,7 @@ typedef struct { typedef struct Pertag Pertag; struct Monitor { char ltsymbol[16]; + char lastltsymbol[16]; float mfact; int nmaster; int num; @@ -145,14 +160,17 @@ struct Monitor { unsigned int seltags; unsigned int sellt; unsigned int tagset[2]; + TagState tagstate; int showbar; int topbar; Client *clients; Client *sel; + Client *lastsel; Client *stack; Monitor *next; Window barwin; const Layout *lt[2]; + const Layout *lastlt; Pertag *pertag; }; @@ -211,6 +229,7 @@ static unsigned int getsystraywidth(); static int gettextprop(Window w, Atom atom, char *text, unsigned int size); static void grabbuttons(Client *c, int focused); static void grabkeys(void); +static int handlexevent(struct epoll_event *ev); static void incnmaster(const Arg *arg); static void keypress(XEvent *e); static void killclient(const Arg *arg); @@ -241,8 +260,10 @@ static void setclientstate(Client *c, long state); static void setfocus(Client *c); static void setfullscreen(Client *c, int fullscreen); static void setlayout(const Arg *arg); +static void setlayoutsafe(const Arg *arg); static void setmfact(const Arg *arg); static void setup(void); +static void setupepoll(void); static void seturgent(Client *c, int urg); static void showhide(Client *c); static void sigchld(int unused); @@ -317,6 +338,8 @@ static void (*handler[LASTEvent]) (XEvent *) = { [UnmapNotify] = unmapnotify }; static Atom wmatom[WMLast], netatom[NetLast], xatom[XLast]; +static int epoll_fd; +static int dpy_fd; static int restart = 0; static int running = 1; static Cur *cursor[CurLast]; @@ -324,13 +347,20 @@ static Clr **scheme; static Clr **tagscheme; static Display *dpy; static Drw *drw; -static Monitor *mons, *selmon; +static Monitor *mons, *selmon, *lastselmon; static Window root, wmcheckwin; static KeySym keychain = -1; +#include "ipc.h" /* configuration, allows nested code to access above variables */ #include "config.h" +#ifdef VERSION +#include "IPCClient.c" +#include "yajl_dumps.c" +#include "ipc.c" +#endif + struct Pertag { unsigned int curtag, prevtag; /* current and previous tag */ int nmasters[LENGTH(tags) + 1]; /* number of windows in master area */ @@ -572,6 +602,12 @@ cleanup(void) XSync(dpy, False); XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime); XDeleteProperty(dpy, root, netatom[NetActiveWindow]); + + ipc_cleanup(); + + if (close(epoll_fd) < 0) { + fprintf(stderr, "Failed to close epoll file descriptor\n"); + } } void @@ -597,6 +633,7 @@ clientmessage(XEvent *e) XSetWindowAttributes swa; XClientMessageEvent *cme = &e->xclient; Client *c = wintoclient(cme->window); + unsigned int i; if (showsystray && cme->window == systray->win && cme->message_type == netatom[NetSystemTrayOP]) { /* add systray icons */ @@ -653,8 +690,14 @@ clientmessage(XEvent *e) setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */ || cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */)); } else if (cme->message_type == netatom[NetActiveWindow]) { - if (c != selmon->sel && !c->isurgent) - seturgent(c, 1); + for (i = 0; i < LENGTH(tags) && !((1 << i) & c->tags); i++); + if (i < LENGTH(tags)) { + const Arg a = {.ui = 1 << i}; + selmon = c->mon; + view(&a); + focus(c); + restack(selmon); + } } } @@ -1337,6 +1380,25 @@ grabkeys(void) } } +int +handlexevent(struct epoll_event *ev) +{ + if (ev->events & EPOLLIN) { + XEvent ev; + while (running && XPending(dpy)) { + XNextEvent(dpy, &ev); + if (handler[ev.type]) { + handler[ev.type](&ev); /* call handler */ + ipc_send_events(mons, &lastselmon, selmon); + } + } + } else if (ev-> events & EPOLLHUP) { + return -1; + } + + return 0; +} + void incnmaster(const Arg *arg) { @@ -1821,12 +1883,40 @@ restack(Monitor *m) void run(void) { - XEvent ev; - /* main event loop */ + int event_count = 0; + const int MAX_EVENTS = 10; + struct epoll_event events[MAX_EVENTS]; + XSync(dpy, False); - while (running && !XNextEvent(dpy, &ev)) - if (handler[ev.type]) - handler[ev.type](&ev); /* call handler */ + + /* main event loop */ + while (running) { + event_count = epoll_wait(epoll_fd, events, MAX_EVENTS, -1); + + for (int i = 0; i < event_count; i++) { + int event_fd = events[i].data.fd; + DEBUG("Got event from fd %d\n", event_fd); + + if (event_fd == dpy_fd) { + // -1 means EPOLLHUP + if (handlexevent(events + i) == -1) + return; + } else if (event_fd == ipc_get_sock_fd()) { + ipc_handle_socket_epoll_event(events + i); + } else if (ipc_is_client_registered(event_fd)){ + if (ipc_handle_client_epoll_event(events + i, mons, &lastselmon, selmon, + tags, LENGTH(tags), layouts, LENGTH(layouts)) < 0) { + fprintf(stderr, "Error handling IPC event on fd %d\n", event_fd); + } + } else { + fprintf(stderr, "Got event from unknown fd %d, ptr %p, u32 %d, u64 %lu", + event_fd, events[i].data.ptr, events[i].data.u32, + events[i].data.u64); + fprintf(stderr, " with events %d\n", events[i].events); + return; + } + } + } } void @@ -2044,6 +2134,18 @@ setlayout(const Arg *arg) drawbar(selmon); } +void +setlayoutsafe(const Arg *arg) +{ + const Layout *ltptr = (Layout *)arg->v; + if (ltptr == 0) + setlayout(arg); + for (int i = 0; i < LENGTH(layouts); i++) { + if (ltptr == &layouts[i]) + setlayout(arg); + } +} + /* arg > 1.0 will set mfact absolutely */ void setmfact(const Arg *arg) @@ -2146,6 +2248,36 @@ setup(void) XSelectInput(dpy, root, wa.event_mask); grabkeys(); focus(NULL); + setupepoll(); +} + +void +setupepoll(void) +{ + epoll_fd = epoll_create1(0); + dpy_fd = ConnectionNumber(dpy); + struct epoll_event dpy_event; + + // Initialize struct to 0 + memset(&dpy_event, 0, sizeof(dpy_event)); + + DEBUG("Display socket is fd %d\n", dpy_fd); + + if (epoll_fd == -1) { + fputs("Failed to create epoll file descriptor", stderr); + } + + dpy_event.events = EPOLLIN; + dpy_event.data.fd = dpy_fd; + if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, dpy_fd, &dpy_event)) { + fputs("Failed to add display file descriptor to epoll", stderr); + close(epoll_fd); + exit(1); + } + + if (ipc_init(ipcsockpath, epoll_fd, ipccommands, LENGTH(ipccommands)) < 0) { + fputs("Failed to initialize IPC\n", stderr); + } } void @@ -2749,10 +2881,18 @@ updatesystray(void) void updatetitle(Client *c) { + char oldname[sizeof(c->name)]; + strcpy(oldname, c->name); + if (!gettextprop(c->win, netatom[NetWMName], c->name, sizeof c->name)) gettextprop(c->win, XA_WM_NAME, c->name, sizeof c->name); if (c->name[0] == '\0') /* hack to mark broken clients */ strcpy(c->name, broken); + + for (Monitor *m = mons; m; m = m->next) { + if (m->sel == c && strcmp(oldname, c->name) != 0) + ipc_focused_title_change_event(m->num, c->win, oldname, c->name); + } } void diff --git a/KleinDwm/source/dwm.c b/KleinDwm/dwm.c.orig similarity index 100% rename from KleinDwm/source/dwm.c rename to KleinDwm/dwm.c.orig diff --git a/KleinDwm/source/dwm.c.rej b/KleinDwm/dwm.c.rej similarity index 100% rename from KleinDwm/source/dwm.c.rej rename to KleinDwm/dwm.c.rej diff --git a/KleinDwm/dwm.o b/KleinDwm/dwm.o new file mode 100644 index 0000000..f7519b4 Binary files /dev/null and b/KleinDwm/dwm.o differ diff --git a/KleinDwm/source/fibonacci.c b/KleinDwm/fibonacci.c similarity index 100% rename from KleinDwm/source/fibonacci.c rename to KleinDwm/fibonacci.c diff --git a/KleinDwm/source/ipc.c b/KleinDwm/ipc.c similarity index 100% rename from KleinDwm/source/ipc.c rename to KleinDwm/ipc.c diff --git a/KleinDwm/source/ipc.h b/KleinDwm/ipc.h similarity index 100% rename from KleinDwm/source/ipc.h rename to KleinDwm/ipc.h diff --git a/KleinDwm/source/keys.h b/KleinDwm/keys.h similarity index 99% rename from KleinDwm/source/keys.h rename to KleinDwm/keys.h index 488a6b3..e0c5876 100644 --- a/KleinDwm/source/keys.h +++ b/KleinDwm/keys.h @@ -2,7 +2,7 @@ #include "movestack.c" #include -#define TERMINAL "alacritty" // default terminal +#define TERMINAL "st" // default terminal /* key definitions */ #define MODKEY Mod4Mask diff --git a/KleinDwm/source/layouts.h b/KleinDwm/layouts.h similarity index 100% rename from KleinDwm/source/layouts.h rename to KleinDwm/layouts.h diff --git a/KleinDwm/source/movestack.c b/KleinDwm/movestack.c similarity index 100% rename from KleinDwm/source/movestack.c rename to KleinDwm/movestack.c diff --git a/KleinDwm/source/patches/README.md b/KleinDwm/patches/README.md similarity index 100% rename from KleinDwm/source/patches/README.md rename to KleinDwm/patches/README.md diff --git a/KleinDwm/source/patches/accessnthmon.diff b/KleinDwm/patches/accessnthmon.diff similarity index 100% rename from KleinDwm/source/patches/accessnthmon.diff rename to KleinDwm/patches/accessnthmon.diff diff --git a/KleinDwm/source/patches/dwm-6.2-urg-border.diff b/KleinDwm/patches/dwm-6.2-urg-border.diff similarity index 100% rename from KleinDwm/source/patches/dwm-6.2-urg-border.diff rename to KleinDwm/patches/dwm-6.2-urg-border.diff diff --git a/KleinDwm/source/patches/dwm-alwayscenter-20200625-f04cac6.diff b/KleinDwm/patches/dwm-alwayscenter-20200625-f04cac6.diff similarity index 100% rename from KleinDwm/source/patches/dwm-alwayscenter-20200625-f04cac6.diff rename to KleinDwm/patches/dwm-alwayscenter-20200625-f04cac6.diff diff --git a/KleinDwm/source/patches/dwm-autostart-20210120-cb3f58a.diff b/KleinDwm/patches/dwm-autostart-20210120-cb3f58a.diff similarity index 100% rename from KleinDwm/source/patches/dwm-autostart-20210120-cb3f58a.diff rename to KleinDwm/patches/dwm-autostart-20210120-cb3f58a.diff diff --git a/KleinDwm/source/patches/dwm-bar-height-spacing-6.3.diff b/KleinDwm/patches/dwm-bar-height-spacing-6.3.diff similarity index 100% rename from KleinDwm/source/patches/dwm-bar-height-spacing-6.3.diff rename to KleinDwm/patches/dwm-bar-height-spacing-6.3.diff diff --git a/KleinDwm/source/patches/dwm-centerfirstwindow-6.2.diff b/KleinDwm/patches/dwm-centerfirstwindow-6.2.diff similarity index 100% rename from KleinDwm/source/patches/dwm-centerfirstwindow-6.2.diff rename to KleinDwm/patches/dwm-centerfirstwindow-6.2.diff diff --git a/KleinDwm/source/patches/dwm-clientmonoclesymbol-20220417-d93ff48.diff b/KleinDwm/patches/dwm-clientmonoclesymbol-20220417-d93ff48.diff similarity index 100% rename from KleinDwm/source/patches/dwm-clientmonoclesymbol-20220417-d93ff48.diff rename to KleinDwm/patches/dwm-clientmonoclesymbol-20220417-d93ff48.diff diff --git a/KleinDwm/source/patches/dwm-fakefullscreen-20210714-138b405.diff b/KleinDwm/patches/dwm-fakefullscreen-20210714-138b405.diff similarity index 100% rename from KleinDwm/source/patches/dwm-fakefullscreen-20210714-138b405.diff rename to KleinDwm/patches/dwm-fakefullscreen-20210714-138b405.diff diff --git a/KleinDwm/source/patches/dwm-fibonacci-6.2.diff b/KleinDwm/patches/dwm-fibonacci-6.2.diff similarity index 100% rename from KleinDwm/source/patches/dwm-fibonacci-6.2.diff rename to KleinDwm/patches/dwm-fibonacci-6.2.diff diff --git a/KleinDwm/patches/dwm-focusonnetactive-6.2.diff b/KleinDwm/patches/dwm-focusonnetactive-6.2.diff new file mode 100644 index 0000000..5d358d2 --- /dev/null +++ b/KleinDwm/patches/dwm-focusonnetactive-6.2.diff @@ -0,0 +1,57 @@ +From 286ca3bb1af08b452bf8140abcc23d4ef61baaa2 Mon Sep 17 00:00:00 2001 +From: bakkeby +Date: Tue, 7 Apr 2020 12:33:04 +0200 +Subject: [PATCH] Activate a window in response to _NET_ACTIVE_WINDOW + +By default, dwm response to client requests to _NET_ACTIVE_WINDOW client +messages by setting the urgency bit on the named window. + +This patch activates the window instead. + +Both behaviours are legitimate according to +https://specifications.freedesktop.org/wm-spec/wm-spec-latest.html#idm140200472702304 + +One should decide which of these one should perform based on the message +senders' untestable claims that it represents the end-user. Setting the +urgency bit is the conservative decision. This patch implements the more +trusting alternative. + +It also allows dwm to work with `wmctrl -a` and other external window +management utilities + +--- + dwm.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/dwm.c b/dwm.c +index 4465af1..3919d47 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -514,6 +514,7 @@ clientmessage(XEvent *e) + { + XClientMessageEvent *cme = &e->xclient; + Client *c = wintoclient(cme->window); ++ unsigned int i; + + if (!c) + return; +@@ -523,8 +524,14 @@ clientmessage(XEvent *e) + setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */ + || (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen))); + } else if (cme->message_type == netatom[NetActiveWindow]) { +- if (c != selmon->sel && !c->isurgent) +- seturgent(c, 1); ++ for (i = 0; i < LENGTH(tags) && !((1 << i) & c->tags); i++); ++ if (i < LENGTH(tags)) { ++ const Arg a = {.ui = 1 << i}; ++ selmon = c->mon; ++ view(&a); ++ focus(c); ++ restack(selmon); ++ } + } + } + +-- +2.17.1 + diff --git a/KleinDwm/source/patches/dwm-fullgaps-20200508-7b77734.diff b/KleinDwm/patches/dwm-fullgaps-20200508-7b77734.diff similarity index 100% rename from KleinDwm/source/patches/dwm-fullgaps-20200508-7b77734.diff rename to KleinDwm/patches/dwm-fullgaps-20200508-7b77734.diff diff --git a/KleinDwm/source/patches/dwm-ipc-20201106-f04cac6.diff b/KleinDwm/patches/dwm-ipc-20201106-f04cac6.diff similarity index 100% rename from KleinDwm/source/patches/dwm-ipc-20201106-f04cac6.diff rename to KleinDwm/patches/dwm-ipc-20201106-f04cac6.diff diff --git a/KleinDwm/source/patches/dwm-keychain-20200729-053e3a2.diff b/KleinDwm/patches/dwm-keychain-20200729-053e3a2.diff similarity index 100% rename from KleinDwm/source/patches/dwm-keychain-20200729-053e3a2.diff rename to KleinDwm/patches/dwm-keychain-20200729-053e3a2.diff diff --git a/KleinDwm/source/patches/dwm-movestack-20211115-a786211.diff b/KleinDwm/patches/dwm-movestack-20211115-a786211.diff similarity index 100% rename from KleinDwm/source/patches/dwm-movestack-20211115-a786211.diff rename to KleinDwm/patches/dwm-movestack-20211115-a786211.diff diff --git a/KleinDwm/source/patches/dwm-pertag-20200914-61bb8b2.diff b/KleinDwm/patches/dwm-pertag-20200914-61bb8b2.diff similarity index 100% rename from KleinDwm/source/patches/dwm-pertag-20200914-61bb8b2.diff rename to KleinDwm/patches/dwm-pertag-20200914-61bb8b2.diff diff --git a/KleinDwm/source/patches/dwm-rainbowtags-6.2.diff b/KleinDwm/patches/dwm-rainbowtags-6.2.diff similarity index 100% rename from KleinDwm/source/patches/dwm-rainbowtags-6.2.diff rename to KleinDwm/patches/dwm-rainbowtags-6.2.diff diff --git a/KleinDwm/source/patches/dwm-restartsig-20180523-6.2.diff b/KleinDwm/patches/dwm-restartsig-20180523-6.2.diff similarity index 100% rename from KleinDwm/source/patches/dwm-restartsig-20180523-6.2.diff rename to KleinDwm/patches/dwm-restartsig-20180523-6.2.diff diff --git a/KleinDwm/source/patches/dwm-status2d-systray-6.3.diff b/KleinDwm/patches/dwm-status2d-systray-6.3.diff similarity index 100% rename from KleinDwm/source/patches/dwm-status2d-systray-6.3.diff rename to KleinDwm/patches/dwm-status2d-systray-6.3.diff diff --git a/KleinDwm/source/patches/dwm-titlecolor-20210815-ed3ab6b4.diff b/KleinDwm/patches/dwm-titlecolor-20210815-ed3ab6b4.diff similarity index 100% rename from KleinDwm/source/patches/dwm-titlecolor-20210815-ed3ab6b4.diff rename to KleinDwm/patches/dwm-titlecolor-20210815-ed3ab6b4.diff diff --git a/KleinDwm/source/patches/dwm-winicon-6.3-v2.1.diff b/KleinDwm/patches/dwm-winicon-6.3-v2.1.diff similarity index 100% rename from KleinDwm/source/patches/dwm-winicon-6.3-v2.1.diff rename to KleinDwm/patches/dwm-winicon-6.3-v2.1.diff diff --git a/KleinDwm/source/dwm b/KleinDwm/source/dwm deleted file mode 100755 index 2f00bfc..0000000 Binary files a/KleinDwm/source/dwm and /dev/null differ diff --git a/KleinDwm/source/dwm.o b/KleinDwm/source/dwm.o deleted file mode 100644 index 58d3215..0000000 Binary files a/KleinDwm/source/dwm.o and /dev/null differ diff --git a/KleinDwm/source/tags b/KleinDwm/tags similarity index 100% rename from KleinDwm/source/tags rename to KleinDwm/tags diff --git a/KleinDwm/source/transient.c b/KleinDwm/transient.c similarity index 100% rename from KleinDwm/source/transient.c rename to KleinDwm/transient.c diff --git a/KleinDwm/source/util.c b/KleinDwm/util.c similarity index 100% rename from KleinDwm/source/util.c rename to KleinDwm/util.c diff --git a/KleinDwm/source/util.c.orig b/KleinDwm/util.c.orig similarity index 100% rename from KleinDwm/source/util.c.orig rename to KleinDwm/util.c.orig diff --git a/KleinDwm/source/util.h b/KleinDwm/util.h similarity index 100% rename from KleinDwm/source/util.h rename to KleinDwm/util.h diff --git a/KleinDwm/source/util.o b/KleinDwm/util.o similarity index 100% rename from KleinDwm/source/util.o rename to KleinDwm/util.o diff --git a/KleinDwm/source/yajl_dumps.c b/KleinDwm/yajl_dumps.c similarity index 100% rename from KleinDwm/source/yajl_dumps.c rename to KleinDwm/yajl_dumps.c diff --git a/KleinDwm/source/yajl_dumps.h b/KleinDwm/yajl_dumps.h similarity index 100% rename from KleinDwm/source/yajl_dumps.h rename to KleinDwm/yajl_dumps.h diff --git a/README.md b/README.md index 752e72f..e851fac 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ -# Suckless Installs - Programs associated with my window manager, and my window manager. -## Purpose -I pretty much use this as my backup system. +# Custom Suckless Dynamic Window Manager with added patches. + +## Includes +- The DWM source. +- Statusbar with bash using status2d patches +- slstatus +- st (simple terminal with changes) +- pinentry-dmenu +- dmen diff --git a/customstatusbar/statusbars/colorvars.sh b/customstatusbar/colorvars.sh similarity index 100% rename from customstatusbar/statusbars/colorvars.sh rename to customstatusbar/colorvars.sh diff --git a/customstatusbar/install.sh b/customstatusbar/install.sh new file mode 100755 index 0000000..c7bccb8 --- /dev/null +++ b/customstatusbar/install.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash + +# Function to check if a command exists +command_exists() { + command -v "$1" >/dev/null 2>&1 +} + +# DWM dependency check (uncomment if necessary) +# if ! pgrep -x "dwm" > /dev/null; then +# echo "DWM is not running. Please ensure that DWM is installed and is your window manager." +# exit 1 +# fi + +# Check for the status2D dependency +if command_exists dwm; then + echo "DWM is installed. Make sure you have the status2D patch applied for proper rendering." +fi + +# Required packages list +required_packages=("grep" "gawk" "procps" "coreutils" "lm-sensors" "network-manager" "x11-xserver-utils") + +# Install required packages +for pkg in "${required_packages[@]}"; do + if ! dpkg -s "$pkg" >/dev/null 2>&1; then + echo "Package $pkg is not installed. Installing..." + sudo apt update + sudo apt install -y "$pkg" + if [ $? -ne 0 ]; then + echo "Failed to install $pkg. Please install it manually, or its equivalent, and edit the source code." + exit 1 + fi + else + echo "Package $pkg is already installed." + fi +done + +# Copy statusbar.sh to /usr/local/bin and make it executable +sudo cp statusbar.sh /usr/local/bin/statusbar +sudo chmod +x /usr/local/bin/statusbar + +# Create the directory and copy colorvars.sh +PREFIX="$HOME/.local/share/statusbar" +mkdir -p "$PREFIX" +cp colorvars.sh "$PREFIX" + +# Setup the systemd service +SERVICE_DIR="$HOME/.config/systemd/user" +mkdir -p "$SERVICE_DIR" +cp statusbar.service "$SERVICE_DIR" + +# Enable and restart the service +systemctl --user enable statusbar.service +systemctl --user restart statusbar.service + +echo "Installation completed successfully. The statusbar is installed and the service has been enabled and restarted." diff --git a/customstatusbar/statusbar.service b/customstatusbar/statusbar.service new file mode 100644 index 0000000..a0ec29c --- /dev/null +++ b/customstatusbar/statusbar.service @@ -0,0 +1,14 @@ +[Unit] +Description=SystemBar for DWM from suckless +After=default.target + +[Service] +Type=simple +ExecStart=/usr/local/bin/statusbar +User=klein +Restart=on-failure +Environment=DISPLAY=:0 +Environment=XAUTHORITY=/home/klein/.Xauthority + +[Install] +WantedBy=default.target diff --git a/customstatusbar/statusbars/statusbar.sh b/customstatusbar/statusbar.sh similarity index 93% rename from customstatusbar/statusbars/statusbar.sh rename to customstatusbar/statusbar.sh index 5897094..843146d 100755 --- a/customstatusbar/statusbars/statusbar.sh +++ b/customstatusbar/statusbar.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Source color vars -source /home/klein/KleinWindowManagement/customstatusbar/statusbars/colorvars.sh +source "$HOME/.local/share/statusbar/colorvars.sh" # Define Basic Dimentions base_x=0 @@ -51,7 +51,7 @@ ram() { local t_mem=$(echo "$m_mem" | awk '/^Mem:/ {print $2}') local u_mem=$(echo "$m_mem" | awk '/^Mem:/ {print $3}') local p_mem=$(awk "BEGIN {printf \"%.0f\", ($u_mem/$t_mem)*100}") - local usage_height=$((max_height * mem_usage / 100)) + local usage_height=$((max_height * p_mem / 100)) local usage_y=$((base_y + max_height - usage_height)) local status_line="" status_line+="^c$grey^^r$base_x,${base_y},${bar_width},${max_height}^" @@ -63,13 +63,13 @@ ram() { swap() { local m_swap=$(free -m) - local t_swap=$(echo "$m_mem" | awk '/^Swap:/ {print $2}') - local u_swap=$(echo "$m_mem" | awk '/^Swap:/ {print $3}') + local t_swap=$(echo "$m_swap" | awk '/^Swap:/ {print $2}') + local u_swap=$(echo "$m_swap" | awk '/^Swap:/ {print $3}') if [[ "$u_swap" -eq 0 ]]; then return fi local p_swap=$(awk "BEGIN {printf \"%.0f\", ($u_swap/$t_swap)*100}") - local usage_height=$((max_height * mem_usage / 100)) + local usage_height=$((max_height * p_swap / 100)) local usage_y=$((base_y + max_height - usage_height)) local status_line="" status_line+="^c$grey^^r$base_x,${base_y},${bar_width},${max_height}^" @@ -167,10 +167,11 @@ battery() { } wifi() { + local iface=$(ip -o link show | grep -v "lo:" | awk -F': ' '{print $2}') local ssid=$(nmcli -t -f active,ssid dev wifi | grep '^yes' | cut -d':' -f2) ssid="${ssid:-No WiFi}" ssid="${ssid:0:15}" - local dwm=$(grep wlp0s20f3 /proc/net/wireless | awk '{ print int($4) }') + local dwm=$(grep "$iface" /proc/net/wireless | awk '{ print int($4) }') if [ "$ssid" = "No WiFi" ]; then local signal=0 else @@ -212,6 +213,7 @@ wifi() { echo "{ $wifi_icon$ssid : $signal% }" } + status(){ echo "$(cpu)|$(ram)|$(swap)$(disk)|$(cpu_temperature)|$(battery)|$(wifi)" } diff --git a/customstatusbar/statusbars/install.sh b/customstatusbar/statusbars/install.sh deleted file mode 100755 index 78a4151..0000000 --- a/customstatusbar/statusbars/install.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env bash - -#Check if command exits -command_exists() { - command -v "$1" >/dev/null 2>&1 -} - -#DWM dependency is running -if ! pgrep -x "dwm" > /dev/null; then - echo "DWM is not running. Please ensure that you got that shit installed and its your window manager." - exit 1 -fi - -#status2d dependency (update later if you find out how) -if command_exists dwm; then - echo "DWM is installed. Make sure you got status2D patch applied for properrendering." -fi - -#Package dependcies -requires_packages=("grep" "gawk" "procps" "coreutils" "lm-sensors" "network-manager" "x11-xserver-utils") - -for pkg in "${requires_packages[@]}"; do - if ! dpkg -s "$pkg" >/dev/null 2>&1; then - echo "Package $pkg is not installed. Installing..." - sudo apt update - sudo apt install -y "$pkg" - if [ $? -ne 0 ]; then - echo "Failed to install $pkg. Install it manually, or its equivalent and edit source code" - exit 1 - fi - else - echo "Package $pkg is installed already. YAY" - fi -done -sudo chmod +x /home/klein/KleinWindowManagement/customstatusbar/statusbars/statusbar.sh -sudo cp /home/klein/KleinWindowManagement/customstatusbar/statusbars/statusbar.sh /usr/bin/ - -echo "Installation done. Run statusbar.sh in shell" diff --git a/customstatusbar/statusbars/oldstatus2dbar.sh b/customstatusbar/statusbars/oldstatus2dbar.sh deleted file mode 100644 index bfd0dc9..0000000 --- a/customstatusbar/statusbars/oldstatus2dbar.sh +++ /dev/null @@ -1,328 +0,0 @@ -#!/bin/bash -# This is a relic of the old. Shit sucks - - -##Global Definitions -#Color definitions -color_black="#000000" #outline -color_white="#ffffff" #default -color_green="#00ff00" -color_yellow="#ffff00" -color_red="#ff0000" -color_grey="#555555" - -#Primary scheme - medium orchid -color_scheme_1="#c067dd" #background -color_scheme_2="#a656c2" -color_scheme_3="#8B45A7" -color_scheme_4="#71348C" #highlight -color_scheme_5="#572371" -color_scheme_6="#3C1256" -color_scheme_7="#22013B" #default text color - -#Complimentary scheme - pastel green -c_color_scheme_1="#84dd67" #Complimentary background color -c_color_scheme_2="#72c059" -c_color_scheme_3="#60a44b" -c_color_scheme_4="#4f883d" #Complimentary highlight -c_color_scheme_5="#3f6e30" -c_color_scheme_6="#2f5523" -c_color_scheme_7="#203d17" #Complimentary txt color - -#GLobal basics -basic_y=27 -basic_x=0 - -get_cpu() { - local cpu_stats=$(top -bn1 | rep "%pu(s)") - local us=$(echo $cpu_stats | awk '{print $2}' | tr -d '%') - local sy=$(echo $cpu_stats | awk '{print $4}' | tr -d '%') - local ni=$(echo $cpu_stats | awk '{print $6}' | tr -d '%') - local id=$(echo $cpu_stats | awk '{print $8}' | tr -d '%') - local wa=$(echo $cpu_stats | awk '{print $10}' | tr -d '%') - local hi=$(echo $cpu_stats | awk '{print $12}' | tr -d '%') - local si=$(echo $cpu_stats | awk '{print $14}' | tr -d '%') - local st=$(echo $cpu_stats | awk '{print $16}' | tr -d '%') - - local top_cpu_consumer=$(ps -eo %cpu,comm --sort=-%cpu | head -n 2 | tail -n 1 | awk '{print $2}') - top_cpu_consumer="${top_cpu_consumer:0:8}" - - local base_x=$basic_x - local base_y=$basic_y - local max_height=16 - local bar_width=3 - local status_line="" - local bg=$color_grey - - declare -A colors=( [us]="#ffd700" [sy]="#ff4500" [ni]="#ff8c00" [id]="#008000" - [wa]="#0000ff" [hi]="#4b0082" [si]="#800080" [st]="#a0522d" ) - - for state in us sy ni id wa hi si st; do - local percentage=$(echo ${!state}) - if [[ ! "$percentage" =~ ^[0-9]+(\.[0-9]+)?$ ]]; then - percentage=0 - fi - - local bar_height=$(echo "$percentage * $max_height / 100" | bc) - - status_line+="^c$bg^^r${base_x},$((base_y - max_height)),${bar_width},${max_height}^" - - local upper_y=$((base_y - bar_height)) - status_line+="^c${colors[$state]}^^r$base_x,$upper_y,$bar_width,$bar_height^" - base_x=$((base_x + bar_width + 2)) - done - - status_line+="^d^^f30^" - - echo "{[$status_line][User:$us|Sys:$sy]$top_cpu_consumer]}" -} - -get_ram() { - local mem_info=$(free -m) - local total_mem=$(echo "$mem_info" | awk '/^Mem:/ {print $2}') - local used_mem=$(echo "$mem_info" | awk '/^Mem:/ {print $3}') - - local mem_usage=$(awk "BEGIN {printf \"%.0f\", ($used_mem/$total_mem)*100}") - - local max_height=20 - local bar_height=$((max_height * mem_usage / 100)) - local bar_width=5 - local base_x=$basic_x - local base_y=$basic_y - local color=$color_white - local border=$color_black - local bg=$color_grey - - local status_line="" - status_line+="^c$bg^" - status_line+="^r$base_x,$((base_y - max_height)),$((bar_width + 2)),$((max_height + 2))^" - status_line+="^c$color^" - status_line+="^r$((base_x + 1)),$((base_y - bar_height - 1)),${bar_width},${bar_height}^" - status_line+="^d^^f8^" - status_line+="${mem_usage}%" - - echo "{[$status_line]}" -} - -get_df() { - # Fetch disk usage data - local usage_p2=$(df -h | grep '/dev/nvme0n1p2' | awk '{print $5}' | tr -d '%') - local usage_p4=$(df -h | grep '/dev/nvme0n1p4' | awk '{print $5}' | tr -d '%') - - # Safeguard against malformed input - if [[ ! "$usage_p2" =~ ^[0-9]+(\.[0-9]+)?$ ]]; then - usage_p2=0 - fi - if [[ ! "$usage_p4" =~ ^[0-9]+(\.[0-9]+)?$ ]]; then - usage_p4=0 - fi - - # Base settings for drawing - local base_x=$basic_x - local base_y=$basic_y - local max_height=20 - local bar_width=3 - local status_line="" - local bg=$color_grey - - # Define colors for each partition - declare -A colors=( - [p2]="#FFD700" - [p4]="#FF4500" - ) - - # Define percentages - local -A usages=( - [p2]=$usage_p2 - [p4]=$usage_p4 - ) - - # Create a vertical bar for each partition - for partition in p2 p4; do - local percentage=${usages[$partition]} - local bar_height=$(echo "$percentage * $max_height / 100" | bc) - - # Draw the background rectangle for 100% capacity - status_line+="^c$bg^^r${base_x},$((base_y - max_height)),${bar_width},${max_height}^" - - # Draw the usage bar on top of the background - local upper_y=$((base_y - bar_height)) - status_line+="^c${colors[$partition]}^^r$base_x,$upper_y,$bar_width,$bar_height^" - base_x=$((base_x + bar_width + 2)) - done - - # Reset formatting and move forward - status_line+="^d^^f10^" - - echo "{[$status_line][Sys:$usage_p2%|User:$usage_p4%]}" -} - -get_temperature() { - local temp=$(sensors | awk '/Package id 0/ {gsub(/[^0-9.]/, "", $4); print int($4)}') - local max_temp=70 - - local color=$color_white - local bg=$color_scheme_1 - local outline=$color_white - - if [ "$temp" -gt "$max_temp" ]; then - color=$color_red - elif [ "$temp" -lt "$max_temp" ]; then - color=$color_green - fi - - local fill_height=$(($temp * 10 / $max_temp)) - local base_y=$((basic_y - 22)) - local temp_icon="^c$outline^" - temp_icon+="^r5,$base_y,4,11^" - temp_icon+="^c$bg^" - temp_icon+="^r6,$((base_y + 4)),2,9^" - temp_icon+="^c$color^" - temp_icon+="^r6,$((base_y + 7 - fill_height)),2,$fill_height^" - temp_icon+="^c$outline^" - temp_icon+="^r4,$((base_y + 8)),7,4^" - temp_icon+="^r5,$((base_y + 9)),5,4^" - temp_icon+="^d^^f10^" - echo "^c$color_white^{[^d^$temp_icon $temp°C^c$color_white^]}^d^" -} - -get_battery() { - local status=$(cat /sys/class/power_supply/BAT0/status) - local capacity=$(cat /sys/class/power_supply/BAT0/capacity) - local current_now=$(cat /sys/class/power_supply/BAT0/current_now) - local voltage_now=$(cat /sys/class/power_supply/BAT0/voltage_now) - local power_consumption=$(awk "BEGIN {printf \"%.2f\n\", ($current_now/1000000)*($voltage_now/1000000)}") - - local color=$color_scheme_7 - local bg=$color_scheme_1 - local outline=$color_black - local color_status=$color_white - - if [[ "$capacity" -le 15 ]]; then - color=$color_red - shutdown -h now - elif [[ "$capacity" -le 25 ]]; then - color=$color_yellow - else - color=$color_green - fi - - local fill_width=$(($capacity * 20 / 100)) - local base_y=$((basic_y - 20)) - local battery_icon="^c$outline^" - battery_icon+="^r2,$base_y,22,10^" - battery_icon+="^c$bg^" - battery_icon+="^r3,$((base_y +1)),20,8^" - battery_icon+="^c$color^" - battery_icon+="^r3,$((base_y + 1)),$fill_width,8^" - battery_icon+="^c$outline^" - battery_icon+="^r0,$((base_y + 3)),2,4^" - battery_icon+="^d^^f24^" - - if [[ "$status" == "Full" ]]; then - status="F" - color_status=$color_green - elif [[ "$status" == "Charging" ]]; then - status="C" - color_status=$c_color_scheme_1 - elif [[ "$status" == "Discharging" ]]; then - status="D" - color_status=$color_yellow - elif [[ "$status" == "Not charging" ]]; then - status="NC" - color_status=$color_scheme_4 - else - status="NA" - fi - - echo "{[$battery_icon^c$color^$capacity^d^%]}" -} - -get_wifi() { - local color=$color_black - local bg=$color_grey - local ssid=$(nmcli -t -f active,ssid dev wifi | grep '^yes' | cut -d':' -f2) - ssid="${ssid:-No WiFi}" - ssid="${ssid:0:15}" - - local dwm=$(grep wlp0s20f3 /proc/net/wireless | awk '{ print int($4) }') - local signal_normalized=$(( (dwm + 90) * 100 / 60 )) - local signal - if [ $signal_normalized -gt 100 ]; then - signal=100 - elif [ $signal_normalized -lt 0 ]; then - signal=0 - else - signal=$signal_normalized - fi - - local color=$color_white - if [ $signal -ge 66 ]; then - color=$color_green - elif [ $signal -le 33 ]; then - color=$color_red - elif [ $signal -gt 33 ] && [ $signal -lt 66 ]; then - color=$color_yellow - fi - - local base_x=$basic_x - local base_y=$((basic_y - 7)) - local max_bars=5 - local bars_filled=$((signal / 20)) - - local wifi_icon="^c$color^" - for i in 1 2 3 4 5; do - local width=$((3 * i + 1)) - local height=$((3 * i + 1)) - local height_placement=$((base_y - height)) - if [ $i -le $bars_filled ]; then - wifi_icon+="^c$color^" - else - wifi_icon+="^c$bg^" - fi - wifi_icon+="^r$((base_x + 3 * (i - 1))),$height_placement,$width,$height^" - done - wifi_icon+="^d^^f18^" - - echo "{[$wifi_icon$ssid[$signal%]]}" -} - -get_screen_width() { - local screen_width_px=$(xdpyinfo | awk '/dimensions:/ {print $2}' | cut -dx -f1) - echo $((screen_width_px / 1)) -} - -get_status() { - local screen_width=$(get_screen_width) - declare -A components=( - [cpu]="$(get_cpu)" - [ram]="$(get_ram)" - [df]="$(get_df)" - [temperature]="$(get_temperature)" - [battery]="$(get_battery)" - [wifi]="$(get_wifi)" - ) - local status_line="" - local separator="" - local total_length=0 - local sep_length=${#separator} - - for component in date wifi battery temperature df ram cpu; do - local component_output="${components[$component]}" - local component_length=$(( ${#component_output} + sep_length )) - - if [[ $((total_length + component_length)) -le $screen_width ]]; then - status_line="${component_output}${status_line}" - total_length=$((total_length + component_length)) - else - echo "Skipped: $component due to space constraints" - fi - done - - echo "$status_line" -} - -while true; do - xsetroot -name "$(get_status)" - sleep 1 -done diff --git a/customstatusbar/systrays/brightnesssystray2.sh b/customstatusbar/systrays/brightnesssystray2.sh deleted file mode 100755 index ffc949d..0000000 --- a/customstatusbar/systrays/brightnesssystray2.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash - -icon_name="/usr/share/icons/Adwaita/16x16/status/display-brightness-symbolic.symbolic.png" - -# Persistent loop to handle the system tray icon -while true -do - # Command to keep the icon in the systray and open the dialog on click - yad --notification --image="$icon_name" \ - --command="bash -c '\ - while : ; do \ - current_brightness=\$(brightnessctl get 2>/dev/null); \ - max_brightness=\$(brightnessctl max 2>/dev/null); \ - brightness_percent=\$((current_brightness * 100 / max_brightness)); \ - command_output=\$(yad --title \"Brightness Control\" --width=300 --height=150 --posx=810 --posy=575 \ - --form --separator=\",\" --field=\"Set Brightness (0-100):NUM\" \"\$brightness_percent\"!0..100!1 \ - --scale --value=\$brightness_percent --min-value=0 --max-value=100 --step=1 \ - --button=\"Increase Brightness\":1 --button=\"Decrease Brightness\":2 --button=gtk-ok:0 --button=gtk-cancel:3 \ - --fixed --undecorated --on-top --skip-taskbar --skip-pager 2>/dev/null); \ - ret=\$?; \ - case \$ret in \ - 0) \ - new_brightness=\$(echo \$command_output | cut -d ',' -f 1); \ - brightnessctl set \$new_brightness% > /dev/null 2>&1; \ - break;; \ - 1) \ - current_brightness=\$(brightnessctl get 2>/dev/null); \ - max_brightness=\$(brightnessctl max 2>/dev/null); \ - brightness_percent=\$((current_brightness * 100 / max_brightness)); \ - new_brightness=\$((brightness_percent + 10)); \ - [ \$new_brightness -gt 100 ] && new_brightness=100; \ - brightnessctl set \$new_brightness% > /dev/null 2>&1; \ - continue;; \ - 2) \ - current_brightness=\$(brightnessctl get 2>/dev/null); \ - max_brightness=\$(brightnessctl max 2>/dev/null); \ - brightness_percent=\$((current_brightness * 100 / max_brightness)); \ - new_brightness=\$((brightness_percent - 10)); \ - [ \$new_brightness -lt 0 ] && new_brightness=0; \ - brightnessctl set \$new_brightness% > /dev/null 2>&1; \ - continue;; \ - 3) \ - break;; \ - *) \ - break;; \ - esac; \ - done'" - - # Sleep to ensure it doesn't respawn too quickly if closed - sleep 0.5 -done diff --git a/customstatusbar/systrays/brightnesssystray2.sh.bak b/customstatusbar/systrays/brightnesssystray2.sh.bak deleted file mode 100755 index a6a51a2..0000000 --- a/customstatusbar/systrays/brightnesssystray2.sh.bak +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -icon_name="/usr/share/icons/Adwaita/16x16/status/display-brightness-symbolic.symbolic.png" - -# Persistent loop to handle the system tray icon -while true -do - # Command to keep the icon in the systray and open the dialog on click - yad --notification --image="$icon_name" \ - --command="bash -c '\ - while : ; do \ - current_brightness=\$(brightnessctl get 2>/dev/null); \ - max_brightness=\$(brightnessctl max 2>/dev/null); \ - brightness_percent=\$((current_brightness * 100 / max_brightness)); \ - command_output=\$(yad --title \"Brightness Control\" --width=300 --height=50 --posx=810 --posy=575 \ - --form --separator=\",\" --field=\"Set Brightness (0-100):NUM\" \"\$brightness_percent\"!0..100!1 \ - --button=\"Apply\":0 --button=\"Increase Brightness:1\" --button=\"Decrease Brightness:2\" --button=gtk-cancel:3 \ - --fixed --undecorated --on-top --skip-taskbar --skip-pager 2>/dev/null); \ - ret=\$?; \ - case \$ret in \ - 0) \ - new_brightness=\$(echo \$command_output | cut -d ',' -f 1); \ - brightnessctl set \$new_brightness% > /dev/null 2>&1;; \ - 1) \ - brightnessctl set +10% > /dev/null 2>&1;; \ - 2) \ - brightnessctl set 10%- > /dev/null 2>&1;; \ - 3) \ - break;; \ - *) \ - break;; \ - esac; \ - done'" - - # Sleep to ensure it doesn't respawn too quickly if closed - sleep 0.5 -done diff --git a/customstatusbar/systrays/expansivesystray.sh b/customstatusbar/systrays/expansivesystray.sh deleted file mode 100755 index 4eeb7ea..0000000 --- a/customstatusbar/systrays/expansivesystray.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash - -# Icon path -icon_path="/usr/share/icons/Adwaita/16x16/devices/display-symbolic.symbolic.png" - -# Persistent loop to handle the system tray icon -while true; do - yad --notification --image="$icon_path" \ - --command="bash -c 'if pgrep -x conky > /dev/null; then killall conky; else conky & disown; fi'" & - - # Wait for the tray icon to be closed - wait $! - - # Sleep to ensure it doesn't respawn too quickly if closed - sleep 2 -done - diff --git a/customstatusbar/systrays/screenshotsystray.sh b/customstatusbar/systrays/screenshotsystray.sh deleted file mode 100755 index d6e768c..0000000 --- a/customstatusbar/systrays/screenshotsystray.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -# Icon path -icon_path="/usr/share/icons/Adwaita/16x16/devices/camera-photo-symbolic.symbolic.png" - -# Directory to save screenshots -screenshot_dir="/home/klein/Pictures/screenshots" -export screenshot_dir # Export the directory path - -# Ensure directory exists -mkdir -p "$screenshot_dir" - -# Persistent loop to handle the system tray icon -while true; do - yad --notification --image="$icon_path" \ - --command="bash -c '\ - while :; do \ - yad --title \"Screenshot Tool\" --width=300 --height=50 \ - --button=\"Full Screen:0\" --button=\"Select Window:1\" --button=\"Cancel:2\" \ - --center; \ - ret=\$?; \ - counter=1; \ - while true; do \ - file_path=\"\$screenshot_dir/Screenshot_\${counter}.png\"; \ - if [[ ! -f \"\$file_path\" ]]; then \ - break; \ - fi; \ - ((counter++)); \ - done; \ - case \$ret in \ - 0) \ - scrot \"\$file_path\"; \ - break; ;; \ - 1) \ - scrot -s \"\$file_path\"; \ - break; ;; \ - 2|*) \ - break; ;; \ - esac; \ - done'" \ - # Sleep to ensure it doesn't respawn too quickly if closed - sleep 2 -done diff --git a/st/config.h b/st/config.h index 1dd7a7c..a8eb1cd 100644 --- a/st/config.h +++ b/st/config.h @@ -120,8 +120,8 @@ static const char *colorname[] = { /* more colors can be added after 255 to use with DefaultXX */ "#cccccc", "#555555", - "gray90", /* default foreground colour */ - "black", /* default background colour */ + "#ffb2b7", /* default foreground colour */ + "#011627", /* default background colour */ }; @@ -141,7 +141,7 @@ static unsigned int defaultrcs = 257; * 6: Bar ("|") * 7: Snowman ("☃") */ -static unsigned int cursorshape = 2; +static unsigned int cursorshape = 4; /* * Default columns and rows numbers diff --git a/st/st b/st/st index 2e6c613..e6994b0 100755 Binary files a/st/st and b/st/st differ diff --git a/st/x.o b/st/x.o index 330e127..c91162b 100644 Binary files a/st/x.o and b/st/x.o differ