This commit is contained in:
DarthMooMancer
2025-07-31 17:34:28 -04:00
parent d1bcedb901
commit 5878a20504
33 changed files with 180 additions and 1943 deletions
-1
View File
@@ -1 +0,0 @@
Until changes are fixed with main neovim repo, use my neovim repo that was patched to have the package manager work with my init.
File diff suppressed because it is too large Load Diff
+20 -50
View File
@@ -1,64 +1,34 @@
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then if not (vim.uv or vim.loop).fs_stat(lazypath) then
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", "https://github.com/folke/lazy.nvim.git", lazypath }) local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", "https://github.com/folke/lazy.nvim.git", lazypath })
end end
vim.opt.rtp:prepend(lazypath) vim.opt.rtp:prepend(lazypath)
vim.g.mapleader = " "
require("lazy").setup({ require("lazy").setup({
spec = { spec = {
"neovim/nvim-lspconfig",
"nvim-treesitter/nvim-treesitter",
"cohama/lexima.vim", "cohama/lexima.vim",
"DarthMoomancer/Polydev", { "echasnovski/mini.pick", version = '*' },
"nvim-telescope/telescope.nvim", { "saghen/blink.cmp", version = "v1.*", opts = {} },
"nvim-lua/plenary.nvim",
{ "saghen/blink.cmp", version = "v1.*", opts = {
completion = {
ghost_text = {
enabled = true
} }
}
}
},
checker = { enabled = true },
},
}) })
vim.opt.mouse = "" require('mini.pick').setup()
vim.opt.completeopt = "noselect"
vim.opt.termguicolors = true vim.g.mapleader = " "
vim.opt.wrap = false vim.o.termguicolors = true
vim.opt.relativenumber = true vim.o.number = true
vim.opt.scrolloff = 8 vim.o.relativenumber = true
vim.opt.sidescrolloff = 8 vim.o.wrap = false
vim.opt.hlsearch = false vim.o.swapfile = false
vim.opt.swapfile = false vim.o.signcolumn = "yes"
vim.opt.clipboard = unnamedplus vim.o.scrolloff = 8
vim.o.sidescrolloff = 8
vim.o.hlsearch = false
vim.o.completeopt = { "menuone", "noselect", "popup" }
vim.lsp.enable({ "lua_ls", "clangd" })
vim.cmd.colorscheme('everforest')
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv") vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv") vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
vim.keymap.set("x", "<leader>p", [["_dP]]) vim.keymap.set("n", "<leader>ff", "ggVG=")
vim.keymap.set("n", "<leader>ff", "gg=G") vim.keymap.set('n', '<leader><leader>', ":Pick files<CR>")
vim.keymap.set('n', '<leader><leader>', ":Telescope find_files<CR>", { desc = 'Telescope find files' })
vim.keymap.set('n', '<leader>xg', ":Telescope live_grep<CR>", { desc = 'Telescope live grep' })
vim.keymap.set('n', '<leader>xh', ":Telescope help_tags<CR>", { desc = 'Telescope help tags' })
vim.keymap.set("n", "<leader>xc", "<Cmd>cclose<CR>")
vim.keymap.set("n", "<leader>xx", function()
vim.diagnostic.setqflist({ open = true })
end, { desc = "Show diagnostics in quickfix" })
vim.cmd.colorscheme('everforest')
vim.lsp.enable({ "lua_ls", "clangd" })
vim.api.nvim_create_autocmd("FileType", {
pattern = "qf",
callback = function()
vim.api.nvim_buf_set_keymap(0, "n", "<CR>", "<CR>:cclose<CR>", { noremap = true, silent = true })
end,
})
require("nvim-treesitter.configs").setup({
highlight = { enable = true },
indent = { enable = true }
})
+99
View File
@@ -0,0 +1,99 @@
---@brief
---
--- https://clangd.llvm.org/installation.html
---
--- - **NOTE:** Clang >= 11 is recommended! See [#23](https://github.com/neovim/nvim-lspconfig/issues/23).
--- - If `compile_commands.json` lives in a build directory, you should
--- symlink it to the root of your source tree.
--- ```
--- ln -s /path/to/myproject/build/compile_commands.json /path/to/myproject/
--- ```
--- - clangd relies on a [JSON compilation database](https://clang.llvm.org/docs/JSONCompilationDatabase.html)
--- specified as compile_commands.json, see https://clangd.llvm.org/installation#compile_commandsjson
-- https://clangd.llvm.org/extensions.html#switch-between-sourceheader
local function switch_source_header(bufnr)
local method_name = 'textDocument/switchSourceHeader'
local client = vim.lsp.get_clients({ bufnr = bufnr, name = 'clangd' })[1]
if not client then
return vim.notify(('method %s is not supported by any servers active on the current buffer'):format(method_name))
end
local params = vim.lsp.util.make_text_document_params(bufnr)
client.request(method_name, params, function(err, result)
if err then
error(tostring(err))
end
if not result then
vim.notify('corresponding file cannot be determined')
return
end
vim.cmd.edit(vim.uri_to_fname(result))
end, bufnr)
end
local function symbol_info()
local bufnr = vim.api.nvim_get_current_buf()
local clangd_client = vim.lsp.get_clients({ bufnr = bufnr, name = 'clangd' })[1]
if not clangd_client or not clangd_client.supports_method 'textDocument/symbolInfo' then
return vim.notify('Clangd client not found', vim.log.levels.ERROR)
end
local win = vim.api.nvim_get_current_win()
local params = vim.lsp.util.make_position_params(win, clangd_client.offset_encoding)
clangd_client.request('textDocument/symbolInfo', params, function(err, res)
if err or #res == 0 then
-- Clangd always returns an error, there is not reason to parse it
return
end
local container = string.format('container: %s', res[1].containerName) ---@type string
local name = string.format('name: %s', res[1].name) ---@type string
vim.lsp.util.open_floating_preview({ name, container }, '', {
height = 2,
width = math.max(string.len(name), string.len(container)),
focusable = false,
focus = false,
border = 'single',
title = 'Symbol Info',
})
end, bufnr)
end
---@class ClangdInitializeResult: lsp.InitializeResult
---@field offsetEncoding? string
return {
cmd = { 'clangd' },
filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' },
root_markers = {
'.clangd',
'.clang-tidy',
'.clang-format',
'compile_commands.json',
'compile_flags.txt',
'configure.ac', -- AutoTools
'.git',
},
capabilities = {
textDocument = {
completion = {
editsNearCursor = true,
},
},
offsetEncoding = { 'utf-8', 'utf-16' },
},
---@param client vim.lsp.Client
---@param init_result ClangdInitializeResult
on_init = function(client, init_result)
if init_result.offsetEncoding then
client.offset_encoding = init_result.offsetEncoding
end
end,
on_attach = function(_, bufnr)
vim.api.nvim_buf_create_user_command(bufnr, 'LspClangdSwitchSourceHeader', function()
switch_source_header(bufnr)
end, { desc = 'Switch between source/header' })
vim.api.nvim_buf_create_user_command(bufnr, 'LspClangdShowSymbolInfo', function()
symbol_info()
end, { desc = 'Show symbol info' })
end,
}
+21
View File
@@ -0,0 +1,21 @@
return {
cmd = { 'lua-language-server' },
filetypes = { 'lua' },
settings = {
Lua = {
diagnostics = {
globals = { "vim" }
}
}
},
root_markers = {
'.luarc.json',
'.luarc.jsonc',
'.luacheckrc',
'.stylua.toml',
'stylua.toml',
'selene.toml',
'selene.yml',
'.git',
},
}
+5 -32
View File
@@ -1,58 +1,31 @@
# dmenu - dynamic menu
# See LICENSE file for copyright and license details.
include config.mk include config.mk
SRC = drw.c dmenu.c stest.c util.c SRC = drw.c dmenu.c util.c
OBJ = $(SRC:.c=.o) OBJ = $(SRC:.c=.o)
all: dmenu stest all: dmenu
.c.o: .c.o:
$(CC) -c $(CFLAGS) $< $(CC) -c $(CFLAGS) $<
config.h:
cp config.def.h $@
$(OBJ): arg.h config.h config.mk drw.h $(OBJ): arg.h config.h config.mk drw.h
dmenu: dmenu.o drw.o util.o dmenu: dmenu.o drw.o util.o
$(CC) -o $@ dmenu.o drw.o util.o $(LDFLAGS) $(CC) -o $@ dmenu.o drw.o util.o $(LDFLAGS)
stest: stest.o
$(CC) -o $@ stest.o $(LDFLAGS)
clean: clean:
rm -f dmenu stest $(OBJ) dmenu-$(VERSION).tar.gz rm -f dmenu stest $(OBJ)
dist: clean
mkdir -p dmenu-$(VERSION)
cp LICENSE Makefile README arg.h config.def.h config.mk dmenu.1\
drw.h util.h dmenu_path dmenu_run stest.1 $(SRC)\
dmenu-$(VERSION)
tar -cf dmenu-$(VERSION).tar dmenu-$(VERSION)
gzip dmenu-$(VERSION).tar
rm -rf dmenu-$(VERSION)
install: all install: all
mkdir -p $(DESTDIR)$(PREFIX)/bin mkdir -p $(DESTDIR)$(PREFIX)/bin
cp -f dmenu dmenu_path dmenu_run stest $(DESTDIR)$(PREFIX)/bin cp -f dmenu dmenu_path dmenu_run $(DESTDIR)$(PREFIX)/bin
chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu
chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_path chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_path
chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_run chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_run
chmod 755 $(DESTDIR)$(PREFIX)/bin/stest
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
sed "s/VERSION/$(VERSION)/g" < dmenu.1 > $(DESTDIR)$(MANPREFIX)/man1/dmenu.1
sed "s/VERSION/$(VERSION)/g" < stest.1 > $(DESTDIR)$(MANPREFIX)/man1/stest.1
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/dmenu.1
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/stest.1
uninstall: uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/dmenu\ rm -f $(DESTDIR)$(PREFIX)/bin/dmenu\
$(DESTDIR)$(PREFIX)/bin/dmenu_path\ $(DESTDIR)$(PREFIX)/bin/dmenu_path\
$(DESTDIR)$(PREFIX)/bin/dmenu_run\ $(DESTDIR)$(PREFIX)/bin/dmenu_run\
$(DESTDIR)$(PREFIX)/bin/stest\
$(DESTDIR)$(MANPREFIX)/man1/dmenu.1\
$(DESTDIR)$(MANPREFIX)/man1/stest.1
.PHONY: all clean dist install uninstall .PHONY: all clean install uninstall
-15
View File
@@ -1,15 +0,0 @@
#include "/home/andrew/.config/suckless/dwm/themes/everforest.h"
static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */
static const char *fonts[] = {
"CaskaydiaCove NFM style:SemiBold:size=11"
};
static const char *prompt = NULL; /* -p option; prompt to the left of input field */
static const char *colors[SchemeLast][2] = {
[SchemeNorm] = { foreground, background },
[SchemeSel] = { background, yellow },
[SchemeOut] = { red, background },
};
static unsigned int lines = 0;
static unsigned int columns = 0;
static const char worddelimiters[] = " ";
+3 -4
View File
@@ -1,13 +1,12 @@
#include "/home/andrew/.config/suckless/dwm/themes/everforest.h"
static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */ static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */
static const char *fonts[] = { static const char *fonts[] = {
"CaskaydiaCove NFM style:SemiBold:size=11" "CaskaydiaCove NFM style:SemiBold:size=11"
}; };
static const char *prompt = NULL; /* -p option; prompt to the left of input field */ static const char *prompt = NULL; /* -p option; prompt to the left of input field */
static const char *colors[SchemeLast][2] = { static const char *colors[SchemeLast][2] = {
[SchemeNorm] = { foreground, background }, [SchemeNorm] = { "#D3C6AA", "#272E33" },
[SchemeSel] = { background, yellow }, [SchemeSel] = { "#272E33", "#DBBC7F" },
[SchemeOut] = { red, background }, [SchemeOut] = { "#E67E80", "#272E33" },
}; };
static unsigned int lines = 0; static unsigned int lines = 0;
+3 -17
View File
@@ -1,32 +1,18 @@
# dmenu version
VERSION = 5.3 VERSION = 5.3
# paths
PREFIX = /usr/local PREFIX = /usr/local
MANPREFIX = $(PREFIX)/share/man
X11INC = /usr/X11R6/include X11INC = /usr/X11R6/include
X11LIB = /usr/X11R6/lib X11LIB = /usr/X11R6/lib
# Xinerama, comment if you don't want it
XINERAMALIBS = -lXinerama
XINERAMAFLAGS = -DXINERAMA
# freetype
FREETYPELIBS = -lfontconfig -lXft FREETYPELIBS = -lfontconfig -lXft
FREETYPEINC = /usr/include/freetype2 FREETYPEINC = /usr/include/freetype2
# OpenBSD (uncomment)
#FREETYPEINC = $(X11INC)/freetype2
#MANPREFIX = ${PREFIX}/man
# includes and libs
INCS = -I$(X11INC) -I$(FREETYPEINC) INCS = -I$(X11INC) -I$(FREETYPEINC)
LIBS = -L$(X11LIB) -lX11 $(XINERAMALIBS) $(FREETYPELIBS) LIBS = -L$(X11LIB) -lX11 $(FREETYPELIBS)
# flags CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700 -D_POSIX_C_SOURCE=200809L -DVERSION=\"$(VERSION)\"
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700 -D_POSIX_C_SOURCE=200809L -DVERSION=\"$(VERSION)\" $(XINERAMAFLAGS)
CFLAGS = -std=c99 -pedantic -Wall -Os $(INCS) $(CPPFLAGS) CFLAGS = -std=c99 -pedantic -Wall -Os $(INCS) $(CPPFLAGS)
LDFLAGS = $(LIBS) LDFLAGS = $(LIBS)
# compiler and linker CC = gcc
CC = cc
Binary file not shown.
-199
View File
@@ -1,199 +0,0 @@
.TH DMENU 1 dmenu\-VERSION
.SH NAME
dmenu \- dynamic menu
.SH SYNOPSIS
.B dmenu
.RB [ \-bfiv ]
.RB [ \-g
.IR columns ]
.RB [ \-l
.IR lines ]
.RB [ \-m
.IR monitor ]
.RB [ \-p
.IR prompt ]
.RB [ \-fn
.IR font ]
.RB [ \-nb
.IR color ]
.RB [ \-nf
.IR color ]
.RB [ \-sb
.IR color ]
.RB [ \-sf
.IR color ]
.RB [ \-w
.IR windowid ]
.P
.BR dmenu_run " ..."
.SH DESCRIPTION
.B dmenu
is a dynamic menu for X, which reads a list of newline\-separated items from
stdin. When the user selects an item and presses Return, their choice is printed
to stdout and dmenu terminates. Entering text will narrow the items to those
matching the tokens in the input.
.P
.B dmenu_run
is a script used by
.IR dwm (1)
which lists programs in the user's $PATH and runs the result in their $SHELL.
.SH OPTIONS
.TP
.B \-b
dmenu appears at the bottom of the screen.
.TP
.B \-f
dmenu grabs the keyboard before reading stdin if not reading from a tty. This
is faster, but will lock up X until stdin reaches end\-of\-file.
.TP
.B \-i
dmenu matches menu items case insensitively.
.TP
.BI \-g " columns"
dmenu lists items in a grid with the given number of columns.
.TP
.BI \-l " lines"
dmenu lists items in a grid with the given number of lines.
.TP
.BI \-m " monitor"
dmenu is displayed on the monitor number supplied. Monitor numbers are starting
from 0.
.TP
.BI \-p " prompt"
defines the prompt to be displayed to the left of the input field.
.TP
.BI \-fn " font"
defines the font or font set used.
.TP
.BI \-nb " color"
defines the normal background color.
.IR #RGB ,
.IR #RRGGBB ,
and X color names are supported.
.TP
.BI \-nf " color"
defines the normal foreground color.
.TP
.BI \-sb " color"
defines the selected background color.
.TP
.BI \-sf " color"
defines the selected foreground color.
.TP
.B \-v
prints version information to stdout, then exits.
.TP
.BI \-w " windowid"
embed into windowid.
.SH USAGE
dmenu is completely controlled by the keyboard. Items are selected using the
arrow keys, page up, page down, home, and end.
.TP
.B Tab
Copy the selected item to the input field.
.TP
.B Return
Confirm selection. Prints the selected item to stdout and exits, returning
success.
.TP
.B Ctrl-Return
Confirm selection. Prints the selected item to stdout and continues.
.TP
.B Shift\-Return
Confirm input. Prints the input text to stdout and exits, returning success.
.TP
.B Escape
Exit without selecting an item, returning failure.
.TP
.B Ctrl-Left
Move cursor to the start of the current word
.TP
.B Ctrl-Right
Move cursor to the end of the current word
.TP
.B C\-a
Home
.TP
.B C\-b
Left
.TP
.B C\-c
Escape
.TP
.B C\-d
Delete
.TP
.B C\-e
End
.TP
.B C\-f
Right
.TP
.B C\-g
Escape
.TP
.B C\-h
Backspace
.TP
.B C\-i
Tab
.TP
.B C\-j
Return
.TP
.B C\-J
Shift-Return
.TP
.B C\-k
Delete line right
.TP
.B C\-m
Return
.TP
.B C\-M
Shift-Return
.TP
.B C\-n
Down
.TP
.B C\-p
Up
.TP
.B C\-u
Delete line left
.TP
.B C\-w
Delete word left
.TP
.B C\-y
Paste from primary X selection
.TP
.B C\-Y
Paste from X clipboard
.TP
.B M\-b
Move cursor to the start of the current word
.TP
.B M\-f
Move cursor to the end of the current word
.TP
.B M\-g
Home
.TP
.B M\-G
End
.TP
.B M\-h
Up
.TP
.B M\-j
Page down
.TP
.B M\-k
Page up
.TP
.B M\-l
Down
.SH SEE ALSO
.IR dwm (1),
.IR stest (1)
-46
View File
@@ -1,4 +1,3 @@
/* See LICENSE file for copyright and license details. */
#include <ctype.h> #include <ctype.h>
#include <locale.h> #include <locale.h>
#include <stdio.h> #include <stdio.h>
@@ -11,9 +10,6 @@
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xatom.h> #include <X11/Xatom.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
#ifdef XINERAMA
#include <X11/extensions/Xinerama.h>
#endif
#include <X11/Xft/Xft.h> #include <X11/Xft/Xft.h>
#include "drw.h" #include "drw.h"
@@ -670,11 +666,6 @@ setup(void)
Window w, dw, *dws; Window w, dw, *dws;
XWindowAttributes wa; XWindowAttributes wa;
XClassHint ch = {"dmenu", "dmenu"}; XClassHint ch = {"dmenu", "dmenu"};
#ifdef XINERAMA
XineramaScreenInfo *info;
Window pw;
int a, di, n, area = 0;
#endif
/* init appearance */ /* init appearance */
for (j = 0; j < SchemeLast; j++) for (j = 0; j < SchemeLast; j++)
scheme[j] = drw_scm_create(drw, colors[j], 2); scheme[j] = drw_scm_create(drw, colors[j], 2);
@@ -686,38 +677,6 @@ setup(void)
bh = drw->fonts->h + 2; bh = drw->fonts->h + 2;
lines = MAX(lines, 0); lines = MAX(lines, 0);
mh = (lines + 1) * bh; mh = (lines + 1) * bh;
#ifdef XINERAMA
i = 0;
if (parentwin == root && (info = XineramaQueryScreens(dpy, &n))) {
XGetInputFocus(dpy, &w, &di);
if (mon >= 0 && mon < n)
i = mon;
else if (w != root && w != PointerRoot && w != None) {
/* find top-level window containing current input focus */
do {
if (XQueryTree(dpy, (pw = w), &dw, &w, &dws, &du) && dws)
XFree(dws);
} while (w != root && w != pw);
/* find xinerama screen with which the window intersects most */
if (XGetWindowAttributes(dpy, pw, &wa))
for (j = 0; j < n; j++)
if ((a = INTERSECT(wa.x, wa.y, wa.width, wa.height, info[j])) > area) {
area = a;
i = j;
}
}
/* no focused window is on screen, so use pointer location instead */
if (mon < 0 && !area && XQueryPointer(dpy, root, &dw, &dw, &x, &y, &di, &di, &du))
for (i = 0; i < n; i++)
if (INTERSECT(x, y, 1, 1, info[i]) != 0)
break;
x = info[i].x_org;
y = info[i].y_org + (topbar ? 0 : info[i].height - mh);
mw = info[i].width;
XFree(info);
} else
#endif
{ {
if (!XGetWindowAttributes(dpy, parentwin, &wa)) if (!XGetWindowAttributes(dpy, parentwin, &wa))
die("could not get embedding window attributes: 0x%lx", die("could not get embedding window attributes: 0x%lx",
@@ -830,11 +789,6 @@ main(int argc, char *argv[])
die("no fonts could be loaded."); die("no fonts could be loaded.");
lrpad = drw->fonts->h; lrpad = drw->fonts->h;
#ifdef __OpenBSD__
if (pledge("stdio rpath", NULL) == -1)
die("pledge");
#endif
if (fast && !isatty(0)) { if (fast && !isatty(0)) {
grabkeyboard(); grabkeyboard();
readstdin(); readstdin();
Binary file not shown.
+1 -5
View File
@@ -6,8 +6,4 @@ cache="$cachedir/dmenu_run"
[ ! -e "$cachedir" ] && mkdir -p "$cachedir" [ ! -e "$cachedir" ] && mkdir -p "$cachedir"
IFS=: IFS=:
if stest -dqr -n "$cache" $PATH; then cat "$cache"
stest -flx $PATH | sort -u | tee "$cache"
else
cat "$cache"
fi
Binary file not shown.
@@ -1,108 +0,0 @@
From 39ab9676914bd0d8105d0f96bbd7611a53077438 Mon Sep 17 00:00:00 2001
From: Miles Alan <m@milesalan.com>
Date: Sat, 4 Jul 2020 11:19:04 -0500
Subject: [PATCH] Add -g option to display entries in the given number of grid
columns
This option can be used in conjunction with -l to format dmenu's options in
arbitrary size grids. For example, to create a 4 column by 6 line grid, you
could use: dmenu -g 4 -l 6
---
config.def.h | 3 ++-
dmenu.1 | 7 ++++++-
dmenu.c | 22 ++++++++++++++++------
3 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/config.def.h b/config.def.h
index 1edb647..96cf3c9 100644
--- a/config.def.h
+++ b/config.def.h
@@ -13,8 +13,9 @@ static const char *colors[SchemeLast][2] = {
[SchemeSel] = { "#eeeeee", "#005577" },
[SchemeOut] = { "#000000", "#00ffff" },
};
-/* -l option; if nonzero, dmenu uses vertical list with given number of lines */
+/* -l and -g options; controls number of lines and columns in grid if > 0 */
static unsigned int lines = 0;
+static unsigned int columns = 0;
/*
* Characters not considered part of a word while deleting words
diff --git a/dmenu.1 b/dmenu.1
index 323f93c..d0a734a 100644
--- a/dmenu.1
+++ b/dmenu.1
@@ -4,6 +4,8 @@ dmenu \- dynamic menu
.SH SYNOPSIS
.B dmenu
.RB [ \-bfiv ]
+.RB [ \-g
+.IR columns ]
.RB [ \-l
.IR lines ]
.RB [ \-m
@@ -47,8 +49,11 @@ is faster, but will lock up X until stdin reaches end\-of\-file.
.B \-i
dmenu matches menu items case insensitively.
.TP
+.BI \-g " columns"
+dmenu lists items in a grid with the given number of columns.
+.TP
.BI \-l " lines"
-dmenu lists items vertically, with the given number of lines.
+dmenu lists items in a grid with the given number of lines.
.TP
.BI \-m " monitor"
dmenu is displayed on the monitor number supplied. Monitor numbers are starting
diff --git a/dmenu.c b/dmenu.c
index 6b8f51b..d79b6bb 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -77,7 +77,7 @@ calcoffsets(void)
int i, n;
if (lines > 0)
- n = lines * bh;
+ n = lines * columns * bh;
else
n = mw - (promptw + inputw + TEXTW("<") + TEXTW(">"));
/* calculate which items will begin the next page and previous page */
@@ -152,9 +152,15 @@ drawmenu(void)
}
if (lines > 0) {
- /* draw vertical list */
- for (item = curr; item != next; item = item->right)
- drawitem(item, x, y += bh, mw - x);
+ /* draw grid */
+ int i = 0;
+ for (item = curr; item != next; item = item->right, i++)
+ drawitem(
+ item,
+ x + ((i / lines) * ((mw - x) / columns)),
+ y + (((i % lines) + 1) * bh),
+ (mw - x) / columns
+ );
} else if (matches) {
/* draw horizontal list */
x += inputw;
@@ -708,9 +714,13 @@ main(int argc, char *argv[])
} else if (i + 1 == argc)
usage();
/* these options take one argument */
- else if (!strcmp(argv[i], "-l")) /* number of lines in vertical list */
+ else if (!strcmp(argv[i], "-g")) { /* number of columns in grid */
+ columns = atoi(argv[++i]);
+ if (lines == 0) lines = 1;
+ } else if (!strcmp(argv[i], "-l")) { /* number of lines in grid */
lines = atoi(argv[++i]);
- else if (!strcmp(argv[i], "-m"))
+ if (columns == 0) columns = 1;
+ } else if (!strcmp(argv[i], "-m"))
mon = atoi(argv[++i]);
else if (!strcmp(argv[i], "-p")) /* adds prompt to left of input field */
prompt = argv[++i];
--
2.23.1
@@ -1,69 +0,0 @@
diff --git a/dmenu.c b/dmenu.c
index 027dddb..0b92f1f 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -334,6 +334,8 @@ keypress(XKeyEvent *ev)
int len;
KeySym ksym = NoSymbol;
Status status;
+ int i, offscreen = 0;
+ struct item *tmpsel;
len = XmbLookupString(xic, ev, buf, sizeof buf, &ksym, &status);
switch (status) {
@@ -465,6 +467,27 @@ insert:
calcoffsets();
break;
case XK_Left:
+ if (columns > 1) {
+ if (!sel)
+ return;
+ tmpsel = sel;
+ for (i = 0; i < lines; i++) {
+ if (!tmpsel->left || tmpsel->left->right != tmpsel) {
+ if (offscreen)
+ break;
+ return;
+ }
+ if (tmpsel == curr)
+ offscreen = 1;
+ tmpsel = tmpsel->left;
+ }
+ sel = tmpsel;
+ if (offscreen) {
+ curr = prev;
+ calcoffsets();
+ }
+ break;
+ }
case XK_KP_Left:
if (cursor > 0 && (!sel || !sel->left || lines > 0)) {
cursor = nextrune(-1);
@@ -505,6 +528,27 @@ insert:
sel->out = 1;
break;
case XK_Right:
+ if (columns > 1) {
+ if (!sel)
+ return;
+ tmpsel = sel;
+ for (i = 0; i < lines; i++) {
+ if (!tmpsel->right || tmpsel->right->left != tmpsel) {
+ if (offscreen)
+ break;
+ return;
+ }
+ tmpsel = tmpsel->right;
+ if (tmpsel == next)
+ offscreen = 1;
+ }
+ sel = tmpsel;
+ if (offscreen) {
+ curr = next;
+ calcoffsets();
+ }
+ break;
+ }
case XK_KP_Right:
if (text[cursor] != '\0') {
cursor = nextrune(+1);
Binary file not shown.
-90
View File
@@ -1,90 +0,0 @@
.TH STEST 1 dmenu\-VERSION
.SH NAME
stest \- filter a list of files by properties
.SH SYNOPSIS
.B stest
.RB [ -abcdefghlpqrsuwx ]
.RB [ -n
.IR file ]
.RB [ -o
.IR file ]
.RI [ file ...]
.SH DESCRIPTION
.B stest
takes a list of files and filters by the files' properties, analogous to
.IR test (1).
Files which pass all tests are printed to stdout. If no files are given, stest
reads files from stdin.
.SH OPTIONS
.TP
.B \-a
Test hidden files.
.TP
.B \-b
Test that files are block specials.
.TP
.B \-c
Test that files are character specials.
.TP
.B \-d
Test that files are directories.
.TP
.B \-e
Test that files exist.
.TP
.B \-f
Test that files are regular files.
.TP
.B \-g
Test that files have their set-group-ID flag set.
.TP
.B \-h
Test that files are symbolic links.
.TP
.B \-l
Test the contents of a directory given as an argument.
.TP
.BI \-n " file"
Test that files are newer than
.IR file .
.TP
.BI \-o " file"
Test that files are older than
.IR file .
.TP
.B \-p
Test that files are named pipes.
.TP
.B \-q
No files are printed, only the exit status is returned.
.TP
.B \-r
Test that files are readable.
.TP
.B \-s
Test that files are not empty.
.TP
.B \-u
Test that files have their set-user-ID flag set.
.TP
.B \-v
Invert the sense of tests, only failing files pass.
.TP
.B \-w
Test that files are writable.
.TP
.B \-x
Test that files are executable.
.SH EXIT STATUS
.TP
.B 0
At least one file passed all tests.
.TP
.B 1
No files passed all tests.
.TP
.B 2
An error occurred.
.SH SEE ALSO
.IR dmenu (1),
.IR test (1)
-109
View File
@@ -1,109 +0,0 @@
/* See LICENSE file for copyright and license details. */
#include <sys/stat.h>
#include <dirent.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "arg.h"
char *argv0;
#define FLAG(x) (flag[(x)-'a'])
static void test(const char *, const char *);
static void usage(void);
static int match = 0;
static int flag[26];
static struct stat old, new;
static void
test(const char *path, const char *name)
{
struct stat st, ln;
if ((!stat(path, &st) && (FLAG('a') || name[0] != '.') /* hidden files */
&& (!FLAG('b') || S_ISBLK(st.st_mode)) /* block special */
&& (!FLAG('c') || S_ISCHR(st.st_mode)) /* character special */
&& (!FLAG('d') || S_ISDIR(st.st_mode)) /* directory */
&& (!FLAG('e') || access(path, F_OK) == 0) /* exists */
&& (!FLAG('f') || S_ISREG(st.st_mode)) /* regular file */
&& (!FLAG('g') || st.st_mode & S_ISGID) /* set-group-id flag */
&& (!FLAG('h') || (!lstat(path, &ln) && S_ISLNK(ln.st_mode))) /* symbolic link */
&& (!FLAG('n') || st.st_mtime > new.st_mtime) /* newer than file */
&& (!FLAG('o') || st.st_mtime < old.st_mtime) /* older than file */
&& (!FLAG('p') || S_ISFIFO(st.st_mode)) /* named pipe */
&& (!FLAG('r') || access(path, R_OK) == 0) /* readable */
&& (!FLAG('s') || st.st_size > 0) /* not empty */
&& (!FLAG('u') || st.st_mode & S_ISUID) /* set-user-id flag */
&& (!FLAG('w') || access(path, W_OK) == 0) /* writable */
&& (!FLAG('x') || access(path, X_OK) == 0)) != FLAG('v')) { /* executable */
if (FLAG('q'))
exit(0);
match = 1;
puts(name);
}
}
static void
usage(void)
{
fprintf(stderr, "usage: %s [-abcdefghlpqrsuvwx] "
"[-n file] [-o file] [file...]\n", argv0);
exit(2); /* like test(1) return > 1 on error */
}
int
main(int argc, char *argv[])
{
struct dirent *d;
char path[PATH_MAX], *line = NULL, *file;
size_t linesiz = 0;
ssize_t n;
DIR *dir;
int r;
ARGBEGIN {
case 'n': /* newer than file */
case 'o': /* older than file */
file = EARGF(usage());
if (!(FLAG(ARGC()) = !stat(file, (ARGC() == 'n' ? &new : &old))))
perror(file);
break;
default:
/* miscellaneous operators */
if (strchr("abcdefghlpqrsuvwx", ARGC()))
FLAG(ARGC()) = 1;
else
usage(); /* unknown flag */
} ARGEND;
if (!argc) {
/* read list from stdin */
while ((n = getline(&line, &linesiz, stdin)) > 0) {
if (line[n - 1] == '\n')
line[n - 1] = '\0';
test(line, line);
}
free(line);
} else {
for (; argc; argc--, argv++) {
if (FLAG('l') && (dir = opendir(*argv))) {
/* test directory contents */
while ((d = readdir(dir))) {
r = snprintf(path, sizeof path, "%s/%s",
*argv, d->d_name);
if (r >= 0 && (size_t)r < sizeof path)
test(path, d->d_name);
}
closedir(dir);
} else {
test(*argv, *argv);
}
}
}
return match ? 0 : 1;
}
Binary file not shown.
@@ -1,12 +0,0 @@
static const char red[] = "#E67E80";
static const char green[] = "#A7C080";
static const char yellow[] = "#DBBC7F";
static const char blue[] = "#7FBBB3";
static const char pink[] = "#D699B6";
static const char aqua[] = "#83C092";
static const char white[] = "#9DA9A0";
static const char light_gray[] = "#859289";
static const char gray[] = "#7A8478";
static const char dark_gray[] = "#374145";
static const char background[] = "#272E33";
static const char foreground[] = "#D3C6AA";
Binary file not shown.
+2 -17
View File
@@ -1,6 +1,3 @@
# dwm - dynamic window manager
# See LICENSE file for copyright and license details.
include config.mk include config.mk
SRC = drw.c dwm.c util.c SRC = drw.c dwm.c util.c
@@ -13,22 +10,11 @@ all: dwm
${OBJ}: config.h config.mk ${OBJ}: config.h config.mk
config.h:
cp config.def.h $@
dwm: ${OBJ} dwm: ${OBJ}
${CC} -o $@ ${OBJ} ${LDFLAGS} ${CC} -o $@ ${OBJ} ${LDFLAGS}
clean: clean:
rm -f dwm ${OBJ} dwm-${VERSION}.tar.gz rm -f dwm ${OBJ}
dist: clean
mkdir -p dwm-${VERSION}
cp -R LICENSE Makefile README config.def.h config.mk\
dwm.1 drw.h util.h ${SRC} dwm.png transient.c dwm-${VERSION}
tar -cf dwm-${VERSION}.tar dwm-${VERSION}
gzip dwm-${VERSION}.tar
rm -rf dwm-${VERSION}
install: all install: all
mkdir -p ${DESTDIR}${PREFIX}/bin mkdir -p ${DESTDIR}${PREFIX}/bin
@@ -37,6 +23,5 @@ install: all
uninstall: uninstall:
rm -f ${DESTDIR}${PREFIX}/bin/dwm\ rm -f ${DESTDIR}${PREFIX}/bin/dwm\
${DESTDIR}${MANPREFIX}/man1/dwm.1
.PHONY: all clean dist install uninstall .PHONY: all install clean uninstall
+7 -4
View File
@@ -13,9 +13,8 @@ static const char *colors[][3] = {
static const char *tags[] = { "1", "2", "3", "4" }; static const char *tags[] = { "1", "2", "3", "4" };
static const Rule rules[] = { static const Rule rules[] = {
/* class instance title tags mask isfloating monitor */
{ "PrismLauncher", "prismlauncher", NULL, 1 << 2, 0, -1 }, { "PrismLauncher", "prismlauncher", NULL, 1 << 2, 0, -1 },
{ "mercury-default", "Navigator", NULL, 1 << 1, 0, -1 }, { "librewolf", "Navigator", NULL, 1 << 1, 0, -1 },
{ "steam", "steamwebhelper", NULL, 1 << 2, 0, -1 }, { "steam", "steamwebhelper", NULL, 1 << 2, 0, -1 },
{ "st-256color", "st-256color", NULL, 1, 0, -1 }, { "st-256color", "st-256color", NULL, 1, 0, -1 },
}; };
@@ -25,7 +24,10 @@ static const int nmaster = 1;
static const int resizehints = 1; static const int resizehints = 1;
static const int lockfullscreen = 1; static const int lockfullscreen = 1;
static const Layout layouts[] = { { "[]=", tile } }; static const Layout layouts[] = {
{ "[]=", tile },
{ "><>", NULL }, /* no layout function means floating behavior */
};
#define MODKEY Mod1Mask #define MODKEY Mod1Mask
#define TAGKEYS(KEY,TAG) \ #define TAGKEYS(KEY,TAG) \
@@ -39,12 +41,13 @@ static const Layout layouts[] = { { "[]=", tile } };
static char dmenumon[2] = "0"; static char dmenumon[2] = "0";
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, NULL }; static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, NULL };
static const char *termcmd[] = { "st", NULL }; static const char *termcmd[] = { "st", NULL };
static const char *browsercmd[] = { "librewolf", NULL };
#include "X11/XF86keysym.h" #include "X11/XF86keysym.h"
static const Key keys[] = { static const Key keys[] = {
{ MODKEY, XK_Return, spawn, {.v = termcmd } }, { MODKEY, XK_Return, spawn, {.v = termcmd } },
{ MODKEY, XK_space, spawn, {.v = dmenucmd } }, { MODKEY, XK_space, spawn, {.v = dmenucmd } },
{ MODKEY, XK_f, spawn, SHCMD("cd /home/andrew/mercury-browser/ && ./MERCURY_PORTABLE") }, { MODKEY, XK_f, spawn, {.v = browsercmd } },
{ MODKEY, XK_h, focusstack, {.i = +1 } }, { MODKEY, XK_h, focusstack, {.i = +1 } },
{ MODKEY, XK_l, focusstack, {.i = -1 } }, { MODKEY, XK_l, focusstack, {.i = -1 } },
{ MODKEY, XK_j, setmfact, {.f = -0.05} }, { MODKEY, XK_j, setmfact, {.f = -0.05} },
+4 -6
View File
@@ -1,14 +1,13 @@
VERSION = 6.5 VERSION = 6.5
# paths
PREFIX = /usr/local PREFIX = /usr/local
X11INC = /usr/X11R6/include X11INC = /usr/X11R6/include
X11LIB = /usr/X11R6/lib X11LIB = /usr/X11R6/lib
# Xinerama, comment if you don't want it # Xinerama, comment if you don't want it
XINERAMALIBS = -lXinerama # XINERAMALIBS = -lXinerama
XINERAMAFLAGS = -DXINERAMA # XINERAMAFLAGS = -DXINERAMA
# freetype # freetype
FREETYPELIBS = -lfontconfig -lXft FREETYPELIBS = -lfontconfig -lXft
@@ -16,14 +15,13 @@ FREETYPEINC = /usr/include/freetype2
# includes and libs # includes and libs
INCS = -I${X11INC} -I${FREETYPEINC} INCS = -I${X11INC} -I${FREETYPEINC}
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} LIBS = -L${X11LIB} -lX11 ${FREETYPELIBS}
# flags # flags
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -DVERSION=\"${VERSION}\"
#CFLAGS = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS} #CFLAGS = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS}
CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os ${INCS} ${CPPFLAGS} CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os ${INCS} ${CPPFLAGS}
LDFLAGS = ${LIBS} LDFLAGS = ${LIBS}
# compiler and linker
CC = gcc CC = gcc
-100
View File
@@ -14,9 +14,6 @@
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xproto.h> #include <X11/Xproto.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
#ifdef XINERAMA
#include <X11/extensions/Xinerama.h>
#endif /* XINERAMA */
#include <X11/Xft/Xft.h> #include <X11/Xft/Xft.h>
#include "drw.h" #include "drw.h"
@@ -128,7 +125,6 @@ static void arrangemon(Monitor *m);
static void attach(Client *c); static void attach(Client *c);
static void attachstack(Client *c); static void attachstack(Client *c);
static void buttonpress(XEvent *e); static void buttonpress(XEvent *e);
static void checkotherwm(void);
static void cleanup(void); static void cleanup(void);
static void cleanupmon(Monitor *mon); static void cleanupmon(Monitor *mon);
static void clientmessage(XEvent *e); static void clientmessage(XEvent *e);
@@ -206,7 +202,6 @@ static Client *wintoclient(Window w);
static Monitor *wintomon(Window w); static Monitor *wintomon(Window w);
static int xerror(Display *dpy, XErrorEvent *ee); static int xerror(Display *dpy, XErrorEvent *ee);
static int xerrordummy(Display *dpy, XErrorEvent *ee); static int xerrordummy(Display *dpy, XErrorEvent *ee);
static int xerrorstart(Display *dpy, XErrorEvent *ee);
static void zoom(const Arg *arg); static void zoom(const Arg *arg);
/* variables */ /* variables */
@@ -432,17 +427,6 @@ buttonpress(XEvent *e)
buttons[i].func(click == ClkTagBar && buttons[i].arg.i == 0 ? &arg : &buttons[i].arg); buttons[i].func(click == ClkTagBar && buttons[i].arg.i == 0 ? &arg : &buttons[i].arg);
} }
void
checkotherwm(void)
{
xerrorxlib = XSetErrorHandler(xerrorstart);
/* this causes an error if some other window manager is running */
XSelectInput(dpy, DefaultRootWindow(dpy), SubstructureRedirectMask);
XSync(dpy, False);
XSetErrorHandler(xerror);
XSync(dpy, False);
}
void void
cleanup(void) cleanup(void)
{ {
@@ -992,18 +976,6 @@ incnmaster(const Arg *arg)
arrange(selmon); arrange(selmon);
} }
#ifdef XINERAMA
static int
isuniquegeom(XineramaScreenInfo *unique, size_t n, XineramaScreenInfo *info)
{
while (n--)
if (unique[n].x_org == info->x_org && unique[n].y_org == info->y_org
&& unique[n].width == info->width && unique[n].height == info->height)
return 0;
return 1;
}
#endif /* XINERAMA */
void void
keypress(XEvent *e) keypress(XEvent *e)
{ {
@@ -1855,62 +1827,6 @@ updategeom(void)
{ {
int dirty = 0; int dirty = 0;
#ifdef XINERAMA
if (XineramaIsActive(dpy)) {
int i, j, n, nn;
Client *c;
Monitor *m;
XineramaScreenInfo *info = XineramaQueryScreens(dpy, &nn);
XineramaScreenInfo *unique = NULL;
for (n = 0, m = mons; m; m = m->next, n++);
/* only consider unique geometries as separate screens */
unique = ecalloc(nn, sizeof(XineramaScreenInfo));
for (i = 0, j = 0; i < nn; i++)
if (isuniquegeom(unique, j, &info[i]))
memcpy(&unique[j++], &info[i], sizeof(XineramaScreenInfo));
XFree(info);
nn = j;
/* new monitors if nn > n */
for (i = n; i < nn; i++) {
for (m = mons; m && m->next; m = m->next);
if (m)
m->next = createmon();
else
mons = createmon();
}
for (i = 0, m = mons; i < nn && m; m = m->next, i++)
if (i >= n
|| unique[i].x_org != m->mx || unique[i].y_org != m->my
|| unique[i].width != m->mw || unique[i].height != m->mh)
{
dirty = 1;
m->num = i;
m->mx = m->wx = unique[i].x_org;
m->my = m->wy = unique[i].y_org;
m->mw = m->ww = unique[i].width;
m->mh = m->wh = unique[i].height;
updatebarpos(m);
}
/* removed monitors if n > nn */
for (i = nn; i < n; i++) {
for (m = mons; m && m->next; m = m->next);
while ((c = m->clients)) {
dirty = 1;
m->clients = c->next;
detachstack(c);
c->mon = mons;
attach(c);
attachstack(c);
}
if (m == selmon)
selmon = mons;
cleanupmon(m);
}
free(unique);
} else
#endif /* XINERAMA */
{ /* default monitor setup */ { /* default monitor setup */
if (!mons) if (!mons)
mons = createmon(); mons = createmon();
@@ -2105,15 +2021,6 @@ xerrordummy(Display *dpy, XErrorEvent *ee)
return 0; return 0;
} }
/* Startup Error handler to check if another window manager
* is already running. */
int
xerrorstart(Display *dpy, XErrorEvent *ee)
{
die("dwm: another window manager is already running");
return -1;
}
void void
zoom(const Arg *arg) zoom(const Arg *arg)
{ {
@@ -2129,15 +2036,8 @@ zoom(const Arg *arg)
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
if (argc == 2 && !strcmp("-v", argv[1]))
die("dwm-"VERSION);
if (argc != 1)
die("usage: dwm [-v]");
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
fputs("warning: no locale support\n", stderr);
if (!(dpy = XOpenDisplay(NULL))) if (!(dpy = XOpenDisplay(NULL)))
die("dwm: cannot open display"); die("dwm: cannot open display");
checkotherwm();
setup(); setup();
scan(); scan();
run(); run();
-42
View File
@@ -1,42 +0,0 @@
/* cc transient.c -o transient -lX11 */
#include <stdlib.h>
#include <unistd.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
int main(void) {
Display *d;
Window r, f, t = None;
XSizeHints h;
XEvent e;
d = XOpenDisplay(NULL);
if (!d)
exit(1);
r = DefaultRootWindow(d);
f = XCreateSimpleWindow(d, r, 100, 100, 400, 400, 0, 0, 0);
h.min_width = h.max_width = h.min_height = h.max_height = 400;
h.flags = PMinSize | PMaxSize;
XSetWMNormalHints(d, f, &h);
XStoreName(d, f, "floating");
XMapWindow(d, f);
XSelectInput(d, f, ExposureMask);
while (1) {
XNextEvent(d, &e);
if (t == None) {
sleep(5);
t = XCreateSimpleWindow(d, r, 50, 50, 100, 100, 0, 0, 0);
XSetTransientForHint(d, t, f);
XStoreName(d, t, "transient");
XMapWindow(d, t);
XSelectInput(d, t, ExposureMask);
}
}
XCloseDisplay(d);
exit(0);
}
-1
View File
@@ -1,4 +1,3 @@
/* See LICENSE file for copyright and license details. */
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
-2
View File
@@ -1,5 +1,3 @@
/* See LICENSE file for copyright and license details. */
#define MAX(A, B) ((A) > (B) ? (A) : (B)) #define MAX(A, B) ((A) > (B) ? (A) : (B))
#define MIN(A, B) ((A) < (B) ? (A) : (B)) #define MIN(A, B) ((A) < (B) ? (A) : (B))
#define BETWEEN(X, A, B) ((A) <= (X) && (X) <= (B)) #define BETWEEN(X, A, B) ((A) <= (X) && (X) <= (B))
+2 -15
View File
@@ -3,7 +3,7 @@
include config.mk include config.mk
REQ = util REQ = util
COM = components/run_command COM = run_command
all: slstatus all: slstatus
@@ -13,24 +13,11 @@ slstatus.o: slstatus.c slstatus.h arg.h config.h config.mk $(REQ:=.h)
.c.o: .c.o:
$(CC) -o $@ -c $(CPPFLAGS) $(CFLAGS) $< $(CC) -o $@ -c $(CPPFLAGS) $(CFLAGS) $<
config.h:
cp config.def.h $@
slstatus: slstatus.o $(COM:=.o) $(REQ:=.o) slstatus: slstatus.o $(COM:=.o) $(REQ:=.o)
$(CC) -o $@ $(LDFLAGS) $(COM:=.o) $(REQ:=.o) slstatus.o $(LDLIBS) $(CC) -o $@ $(LDFLAGS) $(COM:=.o) $(REQ:=.o) slstatus.o $(LDLIBS)
clean: clean:
rm -f slstatus slstatus.o $(COM:=.o) $(REQ:=.o) slstatus-${VERSION}.tar.gz rm -f slstatus slstatus.o $(COM:=.o) $(REQ:=.o)
dist:
rm -rf "slstatus-$(VERSION)"
mkdir -p "slstatus-$(VERSION)/components"
cp -R LICENSE Makefile README config.mk config.def.h \
arg.h slstatus.h slstatus.c $(REQ:=.c) $(REQ:=.h) \
slstatus.1 "slstatus-$(VERSION)"
cp -R $(COM:=.c) "slstatus-$(VERSION)/components"
tar -cf - "slstatus-$(VERSION)" | gzip -c > "slstatus-$(VERSION).tar.gz"
rm -rf "slstatus-$(VERSION)"
install: all install: all
mkdir -p "$(DESTDIR)$(PREFIX)/bin" mkdir -p "$(DESTDIR)$(PREFIX)/bin"
@@ -2,8 +2,8 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "../slstatus.h" #include "slstatus.h"
#include "../util.h" #include "util.h"
const char * const char *
run_command(const char *cmd) run_command(const char *cmd)
+1 -1
View File
@@ -67,7 +67,7 @@ static unsigned int cursorthickness = 2;
static int bellvolume = 0; static int bellvolume = 0;
// char *termname = "st-256color"; // char *termname = "st-256color";
char *termname = "st"; char *termname = "st-256color";
unsigned int tabspaces = 8; unsigned int tabspaces = 8;
static const char *colorname[] = { static const char *colorname[] = {