Add option to hide title text only

This commit is contained in:
speedie 2022-09-16 12:09:19 +02:00
parent 3572abc551
commit 9c8a353b93
8 changed files with 35 additions and 10 deletions

View file

@ -158,7 +158,7 @@ help:
patch:
chmod +x scripts/mkpatch
./scripts/mkpatch
./scripts/mkpatch -mk
@echo Created patches.
patch_install:

View file

@ -88,6 +88,7 @@
- speedwm.statusallmons: 1
- speedwm.hidelayout: 0
- speedwm.hidetitle: 0
- speedwm.hidetitletext: 0
- speedwm.hideicon: 0
- speedwm.hidestatus: 0
- speedwm.hidetags: 0

View file

@ -92,7 +92,6 @@
#define SESSION_FILE "/tmp/speedwm-session" /* Session file. This file may be used as a list of windows and their tagnum */
/* Misc */
#define SHCMD(cmd) { .v = (const char*[]){ shell, "-c", cmd, NULL } }
#define TAGKEYS(CHAIN,KEY,TAG) { MODIFIER1, CHAIN, KEY, view, {.ui = 1 << TAG} }, \
{ MODIFIER1|ShiftMask, CHAIN, KEY, previewtag, {.ui = TAG} }, \

View file

@ -1,3 +1,10 @@
/* This C code handles all layouts.
* You may choose to remove layouts here if you don't find them useful.
*
* Luckily for you though, I've added simple options to disable them from getting compiled into the code at all.
* To change options, edit toggle.h.
*/
#if LAYOUT_TILE
static void
tile(Monitor *m)

View file

@ -225,6 +225,7 @@ static int underlinevoffset = 0; /* How far above the bottom o
static int showbar = 1; /* Show the bar or not? */
static int hidelayout = 0; /* Hide layout indicator (1) or show (0) */
static int hidetitle = 0; /* Hide title (1) or show (0) */
static int hidetitletext = 0; /* Hide title text (1) or show (0) */
static int hideicon = 0; /* Hide icon (1) or show (0) */
static int hidestatus = 0; /* Hide status bar (1) or show (0) */
static int hidetags = 0; /* Hide status bar (1) or show (0) */

View file

@ -2,7 +2,7 @@
# mkpatch.sh
# This shell script allows you to create a patch based on changes made to options.h, options.mk, toggle.h and toggle.mk.
# Set old pwd
# Set old (current) directory
CD="$(pwd)"
CP() {
@ -30,23 +30,38 @@ MKDIFF() {
# Patch the source
if [ "$1" = "-p" ]; then
ls *.patch || exit 1
patch < options.h_settings.patch
patch < options.mk_settings.patch
patch < toggle.h_settings.patch
patch < toggle.mk_settings.patch
cd $CD
exit 0
fi
# Remove the patch
if [ "$1" = "-r" ]; then
ls *.patch || exit 1
patch -R < options.h_settings.patch
patch -R < options.mk_settings.patch
patch -R < toggle.h_settings.patch
patch -R < toggle.mk_settings.patch
cd $CD
exit 0
fi
# Create patches
if [ "$1" = "-mk" ]; then
CP
MKDIFF
cd $CD
exit 0
fi
printf "mkpatch help\n\n"
printf "Usage:\n"
printf "\nmkpatch -p Apply the patch directly."
printf "\nmkpatch -r Remove the patch directly."
printf "\nmkpatch -h Display this help."
printf "\nmkpatch -mk Create patches based on changes."
printf "\nNo arguments will print help.\n"

View file

@ -343,9 +343,7 @@ static void drawbar(Monitor *m);
static void drawbars(void);
static void drawroundedcorners(Client *c);
static int drawstatusbar(Monitor *m, int bh, char* text);
#if USEMOUSE
static void enternotify(XEvent *e);
#endif
static void expose(XEvent *e);
static void focus(Client *c);
static void focusin(XEvent *e);
@ -527,6 +525,7 @@ static pid_t winpid(Window w);
/* variables */
static const char broken[] = "speedwm";
static const char empty[] = "";
#if USEMOUSE
static const char *layoutmenu_cmd = "speedwm-utils -layout";
#endif
@ -1952,7 +1951,6 @@ drawbars(void)
drawbar(m);
}
#if USEMOUSE
void
enternotify(XEvent *e)
{
@ -1973,7 +1971,6 @@ enternotify(XEvent *e)
focus(c);
}
}
#endif
void
expose(XEvent *e)
@ -5044,6 +5041,10 @@ updatetitle(Client *c)
if (c->name[0] == '\0')
strcpy(c->name, broken);
// Hide title by setting it to nothing
if (hidetitletext)
strcpy(c->name, empty);
#if USEIPC
for (Monitor *m = mons; m; m = m->next) {
if (m->sel == c && strcmp(oldname, c->name) != 0)

View file

@ -155,6 +155,7 @@ ResourcePref resources[] = {
{ "leftlayout", INTEGER, &leftlayout },
{ "hidelayout", INTEGER, &hidelayout },
{ "hidetitle", INTEGER, &hidetitle },
{ "hidetitletext", INTEGER, &hidetitletext },
{ "hideicon", INTEGER, &hideicon },
{ "hidetags", INTEGER, &hidetags },
{ "hideemptytags", INTEGER, &hideemptytags },