Compare commits
7 Commits
37eaf73e67
...
ce6f955a48
Author | SHA1 | Date | |
---|---|---|---|
ce6f955a48 | |||
6c32030259 | |||
b2cf6ad5c9 | |||
3ce81552e0 | |||
93d9be7e01 | |||
f726271879 | |||
61a50b31e1 |
1
programs
1
programs
@ -19,6 +19,7 @@ xorg-xrandr
|
|||||||
xorg-xset
|
xorg-xset
|
||||||
xorg-xsetroot
|
xorg-xsetroot
|
||||||
doas
|
doas
|
||||||
|
alacritty
|
||||||
|
|
||||||
# in the aur
|
# in the aur
|
||||||
xkblayout-state
|
xkblayout-state
|
||||||
|
34
src/.config/alacritty/alacritty.toml
Normal file
34
src/.config/alacritty/alacritty.toml
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
[window]
|
||||||
|
padding = { x = 8, y = 8 }
|
||||||
|
opacity = 0.0
|
||||||
|
|
||||||
|
[font]
|
||||||
|
normal = { family = "JetBrains Mono" }
|
||||||
|
size = 10
|
||||||
|
|
||||||
|
[colors]
|
||||||
|
[colors.normal]
|
||||||
|
black = "#000000"
|
||||||
|
red = "#bf616a"
|
||||||
|
green = "#a3be8c"
|
||||||
|
yellow = "#ebcb8b"
|
||||||
|
blue = "#81a1c1"
|
||||||
|
magenta = "#b48ead"
|
||||||
|
cyan = "#88c0d0"
|
||||||
|
white = "#e5e9f0"
|
||||||
|
|
||||||
|
|
||||||
|
[colors.bright]
|
||||||
|
black = "#4c566a"
|
||||||
|
red = "#bf616a"
|
||||||
|
green = "#a3be8c"
|
||||||
|
yellow = "#ebcb8b"
|
||||||
|
blue = "#81a1c1"
|
||||||
|
magenta = "#b48ead"
|
||||||
|
cyan = "#8fbcbb"
|
||||||
|
white = "#eceff4"
|
||||||
|
|
||||||
|
[keyboard]
|
||||||
|
bindings = [
|
||||||
|
{ key = "Enter", mods = "Control|Shift", action = "CreateNewWindow" }
|
||||||
|
]
|
@ -1,3 +1,7 @@
|
|||||||
|
# dynamic swallow (dwm patch)
|
||||||
|
# run this before opening, e.g., mpv or zathura
|
||||||
|
abbr -a -- ds dwmswallow \$WINDOWID\;
|
||||||
|
|
||||||
# zathura
|
# zathura
|
||||||
function thur; zathura $argv; end
|
function thur; zathura $argv; end
|
||||||
# stricter sandbox zathura
|
# stricter sandbox zathura
|
||||||
|
1
src/.config/fish/conf.d/lscolor.fish
Normal file
1
src/.config/fish/conf.d/lscolor.fish
Normal file
@ -0,0 +1 @@
|
|||||||
|
set -x LS_COLORS 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=00:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.avif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:*~=00;90:*#=00;90:*.bak=00;90:*.crdownload=00;90:*.dpkg-dist=00;90:*.dpkg-new=00;90:*.dpkg-old=00;90:*.dpkg-tmp=00;90:*.old=00;90:*.orig=00;90:*.part=00;90:*.rej=00;90:*.rpmnew=00;90:*.rpmorig=00;90:*.rpmsave=00;90:*.swp=00;90:*.tmp=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=00;90:';
|
@ -21,6 +21,7 @@ if status --is-interactive
|
|||||||
|
|
||||||
set fish_color_param normal
|
set fish_color_param normal
|
||||||
set fish_color_cwd grey
|
set fish_color_cwd grey
|
||||||
|
set fish_color_command brgrey
|
||||||
|
|
||||||
if test $SYSTEM_PROFILE = "DEFAULT"
|
if test $SYSTEM_PROFILE = "DEFAULT"
|
||||||
source ~/.config/fish/functions/extra_prompt.fish
|
source ~/.config/fish/functions/extra_prompt.fish
|
||||||
|
@ -25,7 +25,18 @@ function fish_prompt
|
|||||||
set letter '>'
|
set letter '>'
|
||||||
end
|
end
|
||||||
|
|
||||||
set -l usercolor (set_color $fish_color_cwd)
|
set -l usercolor (set_color brgrey)
|
||||||
|
|
||||||
|
printf '%s%s@%s%s '\
|
||||||
|
$usercolor \
|
||||||
|
(echo $USER | string shorten -m 5 -c '') \
|
||||||
|
(echo $hostname | string shorten -m 1 -c '') \
|
||||||
|
(set_color normal)
|
||||||
|
printf '%s%s%s%s ' (set_color $fish_color_cwd) (prompt_pwd) (set_color normal) $letter
|
||||||
|
end
|
||||||
|
|
||||||
|
# https://fishshell.com/docs/3.2/cmds/fish_mode_prompt.html
|
||||||
|
function fish_mode_prompt
|
||||||
if command -sq cksum
|
if command -sq cksum
|
||||||
# randomised color for user/hostname based on disco.fish
|
# randomised color for user/hostname based on disco.fish
|
||||||
set -l shas (echo $USER$hostname | cksum | string split -f1 ' ' | math --base=hex | string sub -s 3 | string pad -c 0 -w 6 | string match -ra ..)
|
set -l shas (echo $USER$hostname | cksum | string split -f1 ' ' | math --base=hex | string sub -s 3 | string pad -c 0 -w 6 | string match -ra ..)
|
||||||
@ -39,13 +50,27 @@ function fish_prompt
|
|||||||
end
|
end
|
||||||
set -l col (string replace 0x '' $col | string pad -c 0 -w 2 | string join "")
|
set -l col (string replace 0x '' $col | string pad -c 0 -w 2 | string join "")
|
||||||
|
|
||||||
set usercolor (set_color $col)
|
set uniquecol (set_color --bold $col)
|
||||||
end
|
end
|
||||||
|
|
||||||
printf '%s%s@%s%s '\
|
set_color --bold brgrey
|
||||||
$usercolor \
|
echo '['
|
||||||
(echo $USER | string shorten -m 5 -c '') \
|
echo $uniquecol
|
||||||
(echo $hostname | string shorten -m 1 -c '') \
|
|
||||||
(set_color normal)
|
switch $fish_bind_mode
|
||||||
printf '%s%s%s%s ' (set_color $fish_color_cwd) (prompt_pwd) (set_color normal) $letter
|
case default
|
||||||
|
echo 'N'
|
||||||
|
case insert
|
||||||
|
echo 'I'
|
||||||
|
case replace_one
|
||||||
|
echo 'R'
|
||||||
|
case visual
|
||||||
|
echo 'V'
|
||||||
|
case '*'
|
||||||
|
echo '?'
|
||||||
|
end
|
||||||
|
|
||||||
|
set_color --bold brgrey
|
||||||
|
echo '] '
|
||||||
|
set_color normal
|
||||||
end
|
end
|
||||||
|
11
src/.config/fontconfig/fonts.conf
Normal file
11
src/.config/fontconfig/fonts.conf
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
|
||||||
|
<fontconfig>
|
||||||
|
<alias>
|
||||||
|
<family>JetBrains Mono</family>
|
||||||
|
<prefer>
|
||||||
|
<family>Noto Color Emoji</family>
|
||||||
|
<family>DejaVu Sans Mono</family>
|
||||||
|
</prefer>
|
||||||
|
</alias>
|
||||||
|
</fontconfig>
|
@ -4,3 +4,10 @@ application/pdf=org.pwmt.zathura.desktop
|
|||||||
x-scheme-handler/pdfref=copy_ref
|
x-scheme-handler/pdfref=copy_ref
|
||||||
x-scheme-handler/http=org.qutebrowser.qutebrowser.desktop
|
x-scheme-handler/http=org.qutebrowser.qutebrowser.desktop
|
||||||
x-scheme-handler/https=org.qutebrowser.qutebrowser.desktop
|
x-scheme-handler/https=org.qutebrowser.qutebrowser.desktop
|
||||||
|
image/jpeg=nsxiv.desktop
|
||||||
|
image/png=nsxiv.desktop
|
||||||
|
image/webp=nsxiv.desktop
|
||||||
|
image/gif=mpv.desktop
|
||||||
|
video/mp4=mpv.desktop
|
||||||
|
video/mpeg=mpv.desktop
|
||||||
|
video/webm=mpv.desktop
|
||||||
|
@ -104,6 +104,9 @@ endif
|
|||||||
|
|
||||||
" color theme
|
" color theme
|
||||||
Plug 'kvrohit/rasmus.nvim'
|
Plug 'kvrohit/rasmus.nvim'
|
||||||
|
" personal preference
|
||||||
|
autocmd ColorScheme * highlight clear statusline
|
||||||
|
set shortmess+=I
|
||||||
|
|
||||||
" URL motions
|
" URL motions
|
||||||
Plug 'axieax/urlview.nvim'
|
Plug 'axieax/urlview.nvim'
|
||||||
|
@ -17,11 +17,6 @@ wallpaper
|
|||||||
xss-lock -- slock &
|
xss-lock -- slock &
|
||||||
dunst &
|
dunst &
|
||||||
xrdb .Xresources
|
xrdb .Xresources
|
||||||
if ! pgrep pipewire; then
|
|
||||||
wireplumber &
|
|
||||||
pipewire &
|
|
||||||
pipewire-pulse &
|
|
||||||
fi
|
|
||||||
|
|
||||||
# DBus
|
# DBus
|
||||||
export NO_AT_BRIDGE=1
|
export NO_AT_BRIDGE=1
|
||||||
|
@ -34,12 +34,15 @@ install: all
|
|||||||
mkdir -p ${DESTDIR}${PREFIX}/bin
|
mkdir -p ${DESTDIR}${PREFIX}/bin
|
||||||
cp -f dwm ${DESTDIR}${PREFIX}/bin
|
cp -f dwm ${DESTDIR}${PREFIX}/bin
|
||||||
chmod 755 ${DESTDIR}${PREFIX}/bin/dwm
|
chmod 755 ${DESTDIR}${PREFIX}/bin/dwm
|
||||||
|
cp -f dwmswallow ${DESTDIR}${PREFIX}/bin
|
||||||
|
chmod 755 ${DESTDIR}${PREFIX}/bin/dwmswallow
|
||||||
mkdir -p ${DESTDIR}${MANPREFIX}/man1
|
mkdir -p ${DESTDIR}${MANPREFIX}/man1
|
||||||
sed "s/VERSION/${VERSION}/g" < dwm.1 > ${DESTDIR}${MANPREFIX}/man1/dwm.1
|
sed "s/VERSION/${VERSION}/g" < dwm.1 > ${DESTDIR}${MANPREFIX}/man1/dwm.1
|
||||||
chmod 644 ${DESTDIR}${MANPREFIX}/man1/dwm.1
|
chmod 644 ${DESTDIR}${MANPREFIX}/man1/dwm.1
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f ${DESTDIR}${PREFIX}/bin/dwm\
|
rm -f ${DESTDIR}${PREFIX}/bin/dwm\
|
||||||
|
${DESTDIR}${MANPREFIX}/bin/dwmswallow\
|
||||||
${DESTDIR}${MANPREFIX}/man1/dwm.1
|
${DESTDIR}${MANPREFIX}/man1/dwm.1
|
||||||
|
|
||||||
.PHONY: all clean dist install uninstall
|
.PHONY: all clean dist install uninstall
|
||||||
|
@ -4,7 +4,7 @@ My build of dwm.
|
|||||||
|
|
||||||
## Patches
|
## Patches
|
||||||
|
|
||||||
- swallow
|
- dynamicswallow
|
||||||
|
|
||||||
- blanktags
|
- blanktags
|
||||||
|
|
||||||
|
@ -3,12 +3,11 @@
|
|||||||
#include <X11/XF86keysym.h>
|
#include <X11/XF86keysym.h>
|
||||||
|
|
||||||
/* constants */
|
/* constants */
|
||||||
#define TERMINAL "st"
|
#define TERMINAL "alacritty"
|
||||||
|
|
||||||
/* appearance */
|
/* appearance */
|
||||||
static const unsigned int borderpx = 2; /* border pixel of windows */
|
static const unsigned int borderpx = 2; /* border pixel of windows */
|
||||||
static const unsigned int snap = 32; /* snap pixel */
|
static const unsigned int snap = 32; /* snap pixel */
|
||||||
static const int swallowfloating = 1; /* 1 means swallow floating windows by default */
|
|
||||||
static const unsigned int gappih = 35; /* horiz inner gap between windows */
|
static const unsigned int gappih = 35; /* horiz inner gap between windows */
|
||||||
static const unsigned int gappiv = 40; /* vert inner gap between windows */
|
static const unsigned int gappiv = 40; /* vert inner gap between windows */
|
||||||
static const unsigned int gappoh = 30; /* horiz outer gap between windows and screen edge */
|
static const unsigned int gappoh = 30; /* horiz outer gap between windows and screen edge */
|
||||||
@ -48,12 +47,16 @@ static const Rule rules[] = {
|
|||||||
* WM_CLASS(STRING) = instance, class
|
* WM_CLASS(STRING) = instance, class
|
||||||
* WM_NAME(STRING) = title
|
* WM_NAME(STRING) = title
|
||||||
*/
|
*/
|
||||||
/* class instance title tags mask isfloating isterminal noswallow monitor swalresize */
|
/* class instance title tags mask isfloating monitor */
|
||||||
{ NULL, NULL, "st", 0, 0, 1, 1, -1, 0},
|
{ "Alacritty", NULL, NULL, 0, 0, -1, },
|
||||||
{ "popup-bottom-center",NULL, NULL, 0, 1, 1, 1, -1, 0},
|
{ "popup-bottom-center",NULL, NULL, 0, 1, -1, },
|
||||||
{ "mpv", NULL, NULL, 0, 0, 0, 0, -1, 1}, /* mpv */
|
{ "mpv", NULL, NULL, 0, 0, -1, }, /* mpv */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* window swallowing */
|
||||||
|
static const int swaldecay = 3;
|
||||||
|
static const int swalretroactive = 1;
|
||||||
|
|
||||||
/* layout(s) */
|
/* layout(s) */
|
||||||
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
|
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
|
||||||
static const int nmaster = 1; /* number of clients in master area */
|
static const int nmaster = 1; /* number of clients in master area */
|
||||||
@ -93,12 +96,13 @@ static const Layout layouts[] = {
|
|||||||
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
|
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
|
||||||
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
|
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
|
||||||
/* open shell command in a terminal window */
|
/* open shell command in a terminal window */
|
||||||
#define TERMCMD(cmd) { .v = (const char*[]){ "/usr/local/bin/st", cmd, NULL } }
|
#define TERMCMD(cmd) { .v = (const char*[]){ "/usr/bin/alacritty", "-e", cmd, NULL } }
|
||||||
|
|
||||||
/* commands */
|
/* commands */
|
||||||
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
|
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
|
||||||
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray5, "-sb", col_gray3, "-sf", col_gray4, "-n", NULL };
|
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray5, "-sb", col_gray3, "-sf", col_gray4, "-n", NULL };
|
||||||
static const char *termcmd[] = { "st", NULL };
|
static const char termcmd[] = "alacritty msg create-window || alacritty";
|
||||||
|
static const char *freshtermcmd[] = { "alacritty", NULL };
|
||||||
static const char *browsercmd[] = { "qutebrowser", NULL };
|
static const char *browsercmd[] = { "qutebrowser", NULL };
|
||||||
static const char *pwdcmd[] = { "keepassxc", NULL };
|
static const char *pwdcmd[] = { "keepassxc", NULL };
|
||||||
static const char *musiccmd[] = { "sonixd", NULL };
|
static const char *musiccmd[] = { "sonixd", NULL };
|
||||||
@ -115,7 +119,8 @@ static const Key keys[] = {
|
|||||||
{ Mod4Mask, XK_p, togglepass, {0} },
|
{ Mod4Mask, XK_p, togglepass, {0} },
|
||||||
{ MODKEY, XK_f, togglealtbar, {0} },
|
{ MODKEY, XK_f, togglealtbar, {0} },
|
||||||
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||||
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
|
{ MODKEY|ShiftMask, XK_Return, spawn, SHCMD(termcmd) },
|
||||||
|
{ MODKEY|ShiftMask|ControlMask, XK_Return, spawn, {.v = freshtermcmd} },
|
||||||
{ MODKEY|ShiftMask, XK_b, spawn, {.v = browsercmd } },
|
{ MODKEY|ShiftMask, XK_b, spawn, {.v = browsercmd } },
|
||||||
{ MODKEY|ShiftMask, XK_k, spawn, {.v = pwdcmd } },
|
{ MODKEY|ShiftMask, XK_k, spawn, {.v = pwdcmd } },
|
||||||
{ MODKEY|ShiftMask, XK_d, spawn, SHCMD("qbprof dsc") },
|
{ MODKEY|ShiftMask, XK_d, spawn, SHCMD("qbprof dsc") },
|
||||||
@ -169,6 +174,7 @@ static const Key keys[] = {
|
|||||||
{ MODKEY, XK_period, setmfact, {.f = +0.05} },
|
{ MODKEY, XK_period, setmfact, {.f = +0.05} },
|
||||||
{ MODKEY|ShiftMask, XK_h, tagmon, {.i = +1 } },
|
{ MODKEY|ShiftMask, XK_h, tagmon, {.i = +1 } },
|
||||||
{ MODKEY|ShiftMask, XK_l, tagmon, {.i = -1 } },
|
{ MODKEY|ShiftMask, XK_l, tagmon, {.i = -1 } },
|
||||||
|
{ MODKEY, XK_u, swalstopsel, {0} },
|
||||||
TAGKEYS( XK_1, 0)
|
TAGKEYS( XK_1, 0)
|
||||||
TAGKEYS( XK_2, 1)
|
TAGKEYS( XK_2, 1)
|
||||||
TAGKEYS( XK_3, 2)
|
TAGKEYS( XK_3, 2)
|
||||||
@ -193,6 +199,7 @@ static const Button buttons[] = {
|
|||||||
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
||||||
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
|
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
|
||||||
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
|
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
|
||||||
|
{ ClkClientWin, MODKEY|ShiftMask, Button1, swalmouse, {0} },
|
||||||
{ ClkTagBar, 0, Button1, view, {0} },
|
{ ClkTagBar, 0, Button1, view, {0} },
|
||||||
{ ClkTagBar, 0, Button3, toggleview, {0} },
|
{ ClkTagBar, 0, Button3, toggleview, {0} },
|
||||||
{ ClkTagBar, MODKEY, Button1, tag, {0} },
|
{ ClkTagBar, MODKEY, Button1, tag, {0} },
|
||||||
|
@ -20,11 +20,10 @@ FREETYPEINC = /usr/include/freetype2
|
|||||||
# OpenBSD (uncomment)
|
# OpenBSD (uncomment)
|
||||||
#FREETYPEINC = ${X11INC}/freetype2
|
#FREETYPEINC = ${X11INC}/freetype2
|
||||||
#MANPREFIX = ${PREFIX}/man
|
#MANPREFIX = ${PREFIX}/man
|
||||||
#KVMLIB = -lkvm
|
|
||||||
|
|
||||||
# includes and libs
|
# includes and libs
|
||||||
INCS = -I${X11INC} -I${FREETYPEINC}
|
INCS = -I${X11INC} -I${FREETYPEINC}
|
||||||
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lXrender -lX11-xcb -lxcb -lxcb-res ${KVMLIB}
|
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lXrender
|
||||||
|
|
||||||
# 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}\" ${XINERAMAFLAGS}
|
||||||
|
File diff suppressed because it is too large
Load Diff
120
suckless/dwm/dwmswallow
Executable file
120
suckless/dwm/dwmswallow
Executable file
@ -0,0 +1,120 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# Separator and command prefix, as defined in dwm.c:fakesignal()
|
||||||
|
SEP='###'
|
||||||
|
PREFIX='#!'
|
||||||
|
|
||||||
|
# Asserts that all arguments are valid X11 window IDs, i.e. positive integers.
|
||||||
|
# For the purpose of this script 0 is declared invalid.
|
||||||
|
is_winid() {
|
||||||
|
while :; do
|
||||||
|
# Given input incompatible to %d, some implementations of printf return
|
||||||
|
# an error while others silently evaluate the expression to 0.
|
||||||
|
if ! wid=$(printf '%d' "$1" 2>/dev/null) || [ "$wid" -le 0 ]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -n "$2" ] && shift || break
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Prints usage help. If "$1" is provided, function exits script after
|
||||||
|
# execution.
|
||||||
|
usage() {
|
||||||
|
[ -t 1 ] && myprintf=printf || myprintf=true
|
||||||
|
msg="$(cat <<-EOF
|
||||||
|
dwm window swallowing command-line interface. Usage:
|
||||||
|
|
||||||
|
$($myprintf "\033[1m")dwmswallow $($myprintf "\033[3m")SWALLOWER [-c CLASS] [-i INSTANCE] [-t TITLE]$($myprintf "\033[0m")
|
||||||
|
Register window $($myprintf "\033[3m")SWALLOWER$($myprintf "\033[0m") to swallow the next future window whose attributes
|
||||||
|
match the $($myprintf "\033[3m")CLASS$($myprintf "\033[0m") name, $($myprintf "\033[3m")INSTANCE$($myprintf "\033[0m") name and window $($myprintf "\033[3m")TITLE$($myprintf "\033[0m") filters using basic
|
||||||
|
string-matching. An omitted filter will match anything.
|
||||||
|
|
||||||
|
$($myprintf "\033[1m")dwmswallow $($myprintf "\033[3m")SWALLOWER -d$($myprintf "\033[0m")
|
||||||
|
Deregister queued swallow for window $($myprintf "\033[3m")SWALLOWER$($myprintf "\033[0m"). Inverse of above signature.
|
||||||
|
|
||||||
|
$($myprintf "\033[1m")dwmswallow $($myprintf "\033[3m")SWALLOWER SWALLOWEE$($myprintf "\033[0m")
|
||||||
|
Perform immediate swallow of window $($myprintf "\033[3m")SWALLOWEE$($myprintf "\033[0m") by window $($myprintf "\033[3m")SWALLOWER$($myprintf "\033[0m").
|
||||||
|
|
||||||
|
$($myprintf "\033[1m")dwmswallow $($myprintf "\033[3m")SWALLOWEE -s$($myprintf "\033[0m")
|
||||||
|
Stop swallow of window $($myprintf "\033[3m")SWALLOWEE$($myprintf "\033[0m"). Inverse of the above signature. Visible
|
||||||
|
windows only.
|
||||||
|
|
||||||
|
$($myprintf "\033[1m")dwmswallow -h$($myprintf "\033[0m")
|
||||||
|
Show this usage information.
|
||||||
|
EOF
|
||||||
|
)"
|
||||||
|
|
||||||
|
if [ -n "$1" ]; then
|
||||||
|
echo "$msg" >&2
|
||||||
|
exit "$1"
|
||||||
|
else
|
||||||
|
echo "$msg"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Determine number of leading positional arguments
|
||||||
|
arg1="$1" # save for later
|
||||||
|
arg2="$2" # save for later
|
||||||
|
num_pargs=0
|
||||||
|
while :; do
|
||||||
|
case "$1" in
|
||||||
|
-*|"") break ;;
|
||||||
|
*) num_pargs=$((num_pargs + 1)); shift ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
case "$num_pargs" in
|
||||||
|
1)
|
||||||
|
! is_winid "$arg1" && usage 1
|
||||||
|
|
||||||
|
widswer="$arg1"
|
||||||
|
if [ "$1" = "-d" ] && [ "$#" -eq 1 ]; then
|
||||||
|
if name="$(printf "${PREFIX}swalunreg${SEP}%u" "$widswer" 2>/dev/null)"; then
|
||||||
|
xsetroot -name "$name"
|
||||||
|
else
|
||||||
|
usage 1
|
||||||
|
fi
|
||||||
|
elif [ "$1" = "-s" ] && [ "$#" -eq 1 ]; then
|
||||||
|
widswee="$arg1"
|
||||||
|
if name="$(printf "${PREFIX}swalstop${SEP}%u" "$widswee" 2>/dev/null)"; then
|
||||||
|
xsetroot -name "$name"
|
||||||
|
else
|
||||||
|
usage 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
while :; do
|
||||||
|
case "$1" in
|
||||||
|
-c) [ -n "$2" ] && { class="$2"; shift 2; } || usage 1 ;;
|
||||||
|
-i) [ -n "$2" ] && { instance="$2"; shift 2; } || usage 1 ;;
|
||||||
|
-t) [ -n "$2" ] && { title="$2"; shift 2; } || usage 1 ;;
|
||||||
|
"") break ;;
|
||||||
|
*) usage 1 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
widswer="$arg1"
|
||||||
|
if name="$(printf "${PREFIX}swalreg${SEP}%u${SEP}%s${SEP}%s${SEP}%s" "$widswer" "$class" "$instance" "$title" 2>/dev/null)"; then
|
||||||
|
xsetroot -name "$name"
|
||||||
|
else
|
||||||
|
usage 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
! is_winid "$arg1" "$arg2" || [ -n "$1" ] && usage 1
|
||||||
|
|
||||||
|
widswer="$arg1"
|
||||||
|
widswee="$arg2"
|
||||||
|
if name="$(printf "${PREFIX}swal${SEP}%u${SEP}%u" "$widswer" "$widswee" 2>/dev/null)"; then
|
||||||
|
xsetroot -name "$name"
|
||||||
|
else
|
||||||
|
usage 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if [ "$arg1" = "-h" ] && [ $# -eq 1 ]; then
|
||||||
|
usage
|
||||||
|
else
|
||||||
|
usage 1
|
||||||
|
fi
|
||||||
|
esac
|
@ -25,6 +25,36 @@ die(const char *fmt, ...)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Splits a string into segments according to a separator. A '\0' is written to
|
||||||
|
* the end of every segment. The beginning of every segment is written to
|
||||||
|
* 'pbegin'. Only the first 'maxcount' segments will be written if
|
||||||
|
* maxcount > 0. Inspired by python's split.
|
||||||
|
*
|
||||||
|
* Used exclusively by fakesignal() to split arguments.
|
||||||
|
*/
|
||||||
|
size_t
|
||||||
|
split(char *s, const char* sep, char **pbegin, size_t maxcount) {
|
||||||
|
|
||||||
|
char *p, *q;
|
||||||
|
const size_t seplen = strlen(sep);
|
||||||
|
size_t count = 0;
|
||||||
|
|
||||||
|
maxcount = maxcount == 0 ? (size_t)-1 : maxcount;
|
||||||
|
p = s;
|
||||||
|
while ((q = strstr(p, sep)) != NULL && count < maxcount) {
|
||||||
|
pbegin[count] = p;
|
||||||
|
*q = '\0';
|
||||||
|
p = q + seplen;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
if (count < maxcount) {
|
||||||
|
pbegin[count] = p;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
ecalloc(size_t nmemb, size_t size)
|
ecalloc(size_t nmemb, size_t size)
|
||||||
{
|
{
|
||||||
|
@ -6,3 +6,4 @@
|
|||||||
|
|
||||||
void die(const char *fmt, ...);
|
void die(const char *fmt, ...);
|
||||||
void *ecalloc(size_t nmemb, size_t size);
|
void *ecalloc(size_t nmemb, size_t size);
|
||||||
|
size_t split(char *s, const char* sep, char **pbegin, size_t maxcount);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user