Rework status functionality, save status bar to file, update various

other scripts by default so that all dependencies are forced. This is so
that people will actually install the dependencies. They are still not
100% forced as you can remove the line from Makefile.
This commit is contained in:
speediegq 2022-10-01 17:29:31 +02:00
parent 04f823a596
commit 776a054830
11 changed files with 47 additions and 41 deletions

View file

@ -82,6 +82,7 @@ install: all
cp -f scripts/speedwm-netctrl ${DESTDIR}${PREFIX}/bin ; chmod +x ${DESTDIR}${PREFIX}/bin/speedwm-netctrl
cp -f scripts/speedwm-btctrl ${DESTDIR}${PREFIX}/bin ; chmod +x ${DESTDIR}${PREFIX}/bin/speedwm-btctrl
cp -f scripts/speedwm_run ${DESTDIR}${PREFIX}/bin ; chmod +x ${DESTDIR}${PREFIX}/bin/speedwm_run
cp -f scripts/speedwm_status ${DESTDIR}${PREFIX}/bin ; chmod +x ${DESTDIR}${PREFIX}/bin/speedwm_status
cp -f scripts/speedwm-core ${DESTDIR}${PREFIX}/bin ; chmod +x ${DESTDIR}${PREFIX}/bin/speedwm-core
cp -f scripts/speedwm-dfmpeg ${DESTDIR}${PREFIX}/bin ; chmod +x ${DESTDIR}${PREFIX}/bin/speedwm-dfmpeg
cp -f status ${DESTDIR}${PREFIX}/bin ; chmod +x ${DESTDIR}${PREFIX}/bin/status
@ -98,6 +99,8 @@ install: all
uninstall:
rm -rf ${DESTDIR}${PREFIX}/bin/speedwm \
${DESTDIR}${PREFIX}/bin/speedwm-utils \
${DESTDIR}${PREFIX}/bin/speedwm_run \
${DESTDIR}${PREFIX}/bin/speedwm_status \
${DESTDIR}${PREFIX}/bin/speedwm-audioctrl \
${DESTDIR}${PREFIX}/bin/speedwm-applist \
${DESTDIR}${PREFIX}/bin/speedwm-winnav \

View file

@ -11,33 +11,22 @@
* Once you're done with your edits, run 'make clean install'.
*************************************************************/
static const char *const autostart[] = {
static const char *autostart[] = {
/* Autostart script, if it exists */
shell, "-c", "ls $HOME/.config/speedwm-de/autostart.sh && $HOME/.config/speedwm-de/autostart.sh", NULL,
/* Bind Right Super+hjkl to arrow keys */
shell, "-c", "xmodmap -e 'keycode 134 = Mode_switch'", NULL,
shell, "-c", "xmodmap -e 'keycode 43 = h H Left H'", NULL,
shell, "-c", "xmodmap -e 'keycode 44 = j J Down J'", NULL,
shell, "-c", "xmodmap -e 'keycode 45 = k K Up K", NULL,
shell, "-c", "xmodmap -e 'keycode 46 = l L Right L", NULL,
/* Caps Lock = Escape */
shell, "-c", "xmodmap -e 'clear Lock'", NULL,
shell, "-c", "xmodmap -e 'keycode 66 = Escape NoSymbol Escape'", NULL,
/* Run the defined clipboard manager */
shell, "-c", CLIPBOARD "&", NULL,
shell, "-c", CLIPBOARD "& > /tmp/clipboard-log", NULL,
/* Run the defined compositor */
shell, "-c", COMPOSITOR "&", NULL,
shell, "-c", COMPOSITOR "& > /tmp/compositor-log", NULL,
/* Run the defined notification daemon */
shell, "-c", NOTIFICATION "&", NULL,
shell, "-c", NOTIFICATION "& > /tmp/notification-log", NULL,
/* Run the status bar defined */
shell, "-c", status, NULL,
/* Run the defined status bar */
shell, "-c", "speedwm_status", NULL,
NULL
};

View file

@ -3,7 +3,8 @@
*
* Once you're done with your edits, run 'make clean install'. */
/* Misc color options */
/* Misc color options
*/
static char *colors[][3] = {
[SchemeBar] = { col_textnorm, col_background, col_windowbordernorm },
[SchemeTags] = { col_textnorm, col_background, col_windowbordernorm },
@ -12,13 +13,14 @@ static char *colors[][3] = {
[SchemeStatus] = { col_textnorm, col_background, col_textsel },
[SchemeNormTitle] = { col_textnorm, col_background, col_background },
[SchemeSelTitle] = { col_textsel, col_title, col_textsel },
[SchemeHid] = { col_title, col_background, col_title },
[SchemeHiddenTitle] = { col_title, col_background, col_title },
[SchemeLayout] = { col_layouttext, col_layoutbgsel, col_layoutbgnorm },
/* text background window border
*/
};
/* Colors for the status bar (.Xresources) */
/* Colors for the status bar (.Xresources)
*/
static char *colstatus[] = {
col_status0,
col_status1,
@ -40,7 +42,6 @@ static char *colstatus[] = {
/* Colors to use for opacity
*/
static const unsigned int alphas[][3] = {
/* fg bg border/unused */
[SchemeBar] = { OPAQUE, baropacity, baropacity },
@ -48,11 +49,12 @@ static const unsigned int alphas[][3] = {
[SchemeSelTitle] = { OPAQUE, seltitleopacity, seltitleopacity },
[SchemeLayout] = { OPAQUE, layoutopacity, layoutopacity },
[SchemeStatus] = { OPAQUE, statusopacity, statusopacity },
[SchemeHid] = { OPAQUE, hiddenopacity, hiddenopacity },
[SchemeHiddenTitle] = { OPAQUE, hiddenopacity, hiddenopacity },
[SchemeTags] = { tagselopacity, tagselopacity, tagnormopacity },
};
/* Colors to use for tags */
/* Colors to use for tags
*/
static char *tagsel[][2] = {
{ col_tag1_text, col_tag1 },
{ col_tag2_text, col_tag2 },
@ -66,7 +68,8 @@ static char *tagsel[][2] = {
/* Text Background */
};
/* Alpha for tags */
/* Alpha for tags
*/
static const unsigned int tagalpha[] = {
tagselopacity,
tagnormopacity,

View file

@ -165,6 +165,10 @@
!!
- speedwm.autoresize: 1
!!
!! Urgent windows
!!
- speedwm.urgentwindows: 1
!!
!! Window icon size in pixels:
!!
- speedwm.iconsize: 10

View file

@ -192,6 +192,7 @@ static char *alttrayname = "tray"; /* Polybar tray instance
/* Misc */
static char shell[] = "/bin/sh"; /* Shell to use */
static int warpcursor = 1; /* Warp cursor when switching client/monitor */
static int urgentwindows = 1; /* Color urgent tags */
static int pertag = 1; /* Use different mfact and layout for each layout */
static int wmclass = 1; /* Enable (1) workaround for when a class cannot be grabbed */
static int clicktofocus = 0; /* Click to focus, or focus when the mouse moves to another window */

View file

@ -43,7 +43,7 @@ FREETYPEINC = /usr/include/freetype2
# includes and libs
INCS = -I${X11INC} -I${FREETYPEINC} -I${YAJLINC}
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lXrender ${IMLIB2LIBS} -lX11-xcb -lxcb -lxcb-res -lXext ${YAJLLIBS} -lXrdb
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lXrender ${IMLIB2LIBS} -lX11-xcb -lxcb -lxcb-res -lXext ${YAJLLIBS}
# flags
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}

View file

@ -31,7 +31,7 @@ fi
# create applist
MK_APPLIST() {
if [ -e "$HOME/.local/share/speedwm/applist" ]; then
USER_CMD="$(printf "$(cat $HOME/.local/share/speedwm/applist)\n------\nAdd command\nRemove command\nClear\n" | $RUNLAUNCHER -l 20 -p 'Run: ' $GRIDARG $GRIDNUM)"
USER_CMD="$(printf "$(cat $HOME/.local/share/speedwm/applist)\n------\nAdd command\nRemove command\nClear\n" | $RUNLAUNCHER -l 20 -p 'Run:' $GRIDARG $GRIDNUM)"
else
mkdir -p $HOME/.local/share/speedwm
echo "No commands added." > $HOME/.local/share/speedwm/applist
@ -67,7 +67,7 @@ CLEAR_CMD() {
# add command
ADD_CMD() {
grep -q "No commands added" $HOME/.local/share/speedwm/applist && rm -f $HOME/.local/share/speedwm/applist
USER_I_ARG="$(printf "" | $RUNLAUNCHER -l 0 -p 'Enter a command: ' $GRIDARG $GRIDNUM)"
USER_I_ARG="$(printf "" | $RUNLAUNCHER -l 0 -p 'Enter a command:' $GRIDARG $GRIDNUM)"
printf "$USER_I_ARG\n" >> $HOME/.local/share/speedwm/applist
$0 && exit 0
}

View file

@ -8,35 +8,35 @@ BINDIR=$(cat /usr/share/speedwm/bindir)
if [ -e "${BINDIR}xrdb" ]; then
xrdb_exists=true
else
printf "WARNING: xrdb was not found. .Xresources and Pywal support will not work.\n"
printf "Error: ${BINDIR}xrdb was not found\n" && exit 1
fi
# Check if wmctrl exists
if [ -e "${BINDIR}wmctrl" ]; then
wmctrl_exists=true
else
printf "WARNING: wmctrl was not found. Window management using 'Alt+Tab' will not work.\n"
printf "Error: ${BINDIR}wmctrl was not found\n" && exit 1
fi
# Check if xsetroot exists
if [ -e "${BINDIR}xsetroot" ]; then
xsetroot_exists=true
else
printf "\nError: ${BINDIR}xsetroot was not found\n" && exit 1
printf "Error: ${BINDIR}xsetroot was not found\n" && exit 1
fi
# Check if xwallpaper exists
if [ -e "${BINDIR}xwallpaper" ]; then
xwallpaper_exists=true
else
printf "WARNING: xwallpaper was not found. This means setting your wallpaper and Pywal support won't work.\n"
printf "Error: ${BINDIR}xwallpaper was not found\n" && exit 1
fi
# Check if xmodmap exists
if [ -e "${BINDIR}xmodmap" ]; then
xmodmap_exists=true
else
printf "WARNING: xmodmap was not found. This means the Alt+Tab script will not be able to remap Alt+hjkl temporarily.\n"
printf "Error: ${BINDIR}xmodmap was not found\n" && exit 1
fi
# Check if trayer exists
@ -49,9 +49,11 @@ fi
# Check if srg or not.
if [ "$trayer_exists" = "false" ]; then
printf "WARNING: trayer was not found. This means the systray will not be available.\n"
elif [ "$trayer_srg" = "true" ]; then
printf "WARNING: Before trayer-srg can be used instead of trayer, you must edit ~/.config/speedwm-de/systray/config and set USE_SRG to true.\n"
if [ "$trayer_srg" = "true" ]; then
printf "WARNING: Before trayer-srg can be used instead of trayer, you must edit ~/.config/speedwm-de/systray/config and set USE_SRG to true.\n"
else
printf "WARNING: trayer was not found. This means the systray will not be available.\n"
fi
fi
# Check if dmenu exists

View file

@ -23,10 +23,14 @@ PADDING=$(grep "barpaddingv" options.h | grep "0" | awk '{ print $5 }')
# Write the compositor to /usr/share/speedwm/compositor
COMPOSITOR=$(grep "define COMPOSITOR " options.h | awk '{ print $3 }' | sed 's/"//g')
# Status
STATUS=$(grep "char status" options.h | awk '{ print $5 }' | sed 's/"//g; s/;//g')
# Print all of it
echo $TOPBAR | grep -q "1" && touch /usr/share/speedwm/topbar
echo $PADDING | grep -q "0" && touch /usr/share/speedwm/nopadding
echo $COMPOSITOR > /usr/share/speedwm/compositor
echo $STATUS > /usr/share/speedwm/statusbar
echo $(pwd) > /usr/share/speedwm/sourcedir
sed "s/#define //g" toggle.h | grep LAYOUT | sed "s|/[*]|#|g; s|[*]/||g; s/ //g; s/1/=1/g; s/0/=0/g; s/#/ # /g" > /usr/share/speedwm/layouts

View file

@ -82,7 +82,7 @@ enum { SchemeNormBorder,
SchemeSelBorder,
SchemeTags,
SchemeBar,
SchemeHid,
SchemeHiddenTitle,
SchemeLayout,
SchemeNormTitle,
SchemeSelTitle,
@ -625,6 +625,8 @@ static xcb_connection_t *xcon;
#define SUPER Mod4Mask
#define SHIFTL Mod5Mask
/* Misc */
#define STATUSBAR status
/* Rest of the headers */
#include "layouts.c" /* Enable patched layouts */
@ -1858,7 +1860,7 @@ drawbar(Monitor *m)
if (m->sel == c)
scm = SchemeSelTitle;
else if (HIDDEN(c))
scm = SchemeHid;
scm = SchemeHiddenTitle;
else
scm = SchemeNormTitle;
drw_setscheme(drw, scheme[scm]);
@ -1965,7 +1967,7 @@ focus(Client *c)
if (c) {
if (c->mon != selmon)
selmon = c->mon;
if (c->isurgent)
if (c->isurgent && urgentwindows)
seturgent(c, 0);
detachstack(c);
attachstack(c);
@ -5040,7 +5042,6 @@ updatepreview(void)
.border_pixel = 0,
.colormap = cmap,
.override_redirect = True,
//.background_pixmap = ParentRelative,
.event_mask = ButtonPressMask|ExposureMask
};
@ -5048,8 +5049,6 @@ updatepreview(void)
m->tagwin = XCreateWindow(dpy, root, m->wx, m->by + bh, m->mw / scalepreview, m->mh / scalepreview, 0,
depth, CopyFromParent, visual,
CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &wa);
//DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen),
//CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
XDefineCursor(dpy, m->tagwin, cursor[CurNormal]->cursor);
XMapRaised(dpy, m->tagwin);
XUnmapWindow(dpy, m->tagwin);

View file

@ -171,6 +171,7 @@ ResourcePref resources[] = {
{ "resetgaps", INTEGER, &resetgaps },
{ "wmclass", INTEGER, &wmclass },
{ "clicktofocus", INTEGER, &clicktofocus },
{ "urgentwindows", INTEGER, &urgentwindows },
#if USEROUNDCORNERS
{ "roundedcorners", INTEGER, &roundedcorners },
{ "cornerradius", INTEGER, &cornerradius },