Browse Source

Added one more patch to dwm

main
Yigit Colakoglu 2 years ago
parent
commit
5c3c814099
4 changed files with 113 additions and 23 deletions
  1. +79
    -4
      .local/src/dwm/dwm.c
  2. +2
    -1
      .local/src/dwm/keybinds.h
  3. +19
    -11
      install.sh
  4. +13
    -7
      pkg.list

+ 79
- 4
.local/src/dwm/dwm.c View File

@ -151,6 +151,7 @@ struct Monitor {
Client *clients;
Client *sel;
Client *stack;
Client *tagmarked[32];
Monitor *next;
Window barwin;
const Layout *lt[2];
@ -197,9 +198,11 @@ static void drawbar(Monitor *m);
static void drawbars(void);
static void enternotify(XEvent *e);
static void expose(XEvent *e);
static Client *findbefore(Client *c);
static void floatpos(const Arg *arg);
static void focus(Client *c);
static void focusin(XEvent *e);
static void focusmaster(const Arg *arg);
static void focusmon(const Arg *arg);
static void focusstack(const Arg *arg);
static Atom getatomprop(Client *c, Atom prop);
@ -290,6 +293,7 @@ static pid_t winpid(Window w);
/* variables */
static const char autostartblocksh[] = "autostart_blocking.sh";
static const char autostartsh[] = "autostart.sh";
static Client *prevzoom = NULL;
static const char broken[] = "broken";
static const char dwmdir[] = "dwm";
static const char localshare[] = ".local/share";
@ -925,6 +929,10 @@ detach(Client *c)
{
Client **tc;
for (int i = 1; i < LENGTH(tags); i++)
if (c == c->mon->tagmarked[i])
c->mon->tagmarked[i] = NULL;
for (tc = &c->mon->clients; *tc && *tc != c; tc = &(*tc)->next);
*tc = c->next;
}
@ -1184,6 +1192,16 @@ expose(XEvent *e)
drawbar(m);
}
Client *
findbefore(Client *c)
{
Client *tmp;
if (c == selmon->clients)
return NULL;
for (tmp = selmon->clients; tmp && tmp->next != c; tmp = tmp->next);
return tmp;
}
void
focus(Client *c)
{
@ -1219,6 +1237,34 @@ focusin(XEvent *e)
setfocus(selmon->sel);
}
void
focusmaster(const Arg *arg)
{
Client *master;
if (selmon->nmaster > 1)
return;
if (!selmon->sel || (selmon->sel->isfullscreen))
return;
master = nexttiled(selmon->clients);
if (!master)
return;
int i;
for (i = 0; !(selmon->tagset[selmon->seltags] & 1 << i); i++);
i++;
if (selmon->sel == master) {
if (selmon->tagmarked[i] && ISVISIBLE(selmon->tagmarked[i]))
focus(selmon->tagmarked[i]);
} else {
selmon->tagmarked[i] = selmon->sel;
focus(master);
}
}
void
focusmon(const Arg *arg)
{
@ -1799,6 +1845,11 @@ nexttiled(Client *c)
void
pop(Client *c)
{
int i;
for (i = 0; !(selmon->tagset[selmon->seltags] & 1 << i); i++);
i++;
c->mon->tagmarked[i] = nexttiled(c->mon->clients);
detach(c);
attach(c);
focus(c);
@ -3093,14 +3144,38 @@ void
zoom(const Arg *arg)
{
Client *c = selmon->sel;
Client *at = NULL, *cold, *cprevious = NULL;
if (!selmon->lt[selmon->sellt]->arrange
|| (selmon->sel && selmon->sel->isfloating))
return;
if (c == nexttiled(selmon->clients))
if (!c || !(c = nexttiled(c->next)))
return;
pop(c);
if (c == nexttiled(selmon->clients)) {
at = findbefore(prevzoom);
if (at)
cprevious = nexttiled(at->next);
if (!cprevious || cprevious != prevzoom) {
prevzoom = NULL;
if (!c || !(c = nexttiled(c->next)))
return;
} else
c = cprevious;
}
cold = nexttiled(selmon->clients);
if (c != cold && !at)
at = findbefore(c);
detach(c);
attach(c);
/* swap windows instead of pushing the previous one down */
if (c != cold && at) {
prevzoom = cold;
if (cold && at != cold) {
detach(cold);
cold->next = at->next;
at->next = cold;
}
}
focus(c);
arrange(c->mon);
}
int


+ 2
- 1
.local/src/dwm/keybinds.h View File

@ -83,11 +83,12 @@ static Key keys[] = {
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_i, focusmaster, {0} },
{ MODKEY|ShiftMask, XK_i, spawn, {.v = screensaver} },
{ MODKEY|ShiftMask, XK_n, spawn, {.v = notification } },
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
{ MODKEY|ShiftMask, XK_z, zoom, {0} },
{ MODKEY|ShiftMask, XK_z, zoom, {0} },
{ MODKEY, XK_Tab, view, {0} },
{ MODKEY, XK_q, killclient, {0} },
{ MODKEY|Mod1Mask, XK_i, incnmaster, {.i = +1 } },


+ 19
- 11
install.sh View File

@ -1,10 +1,12 @@
#!/bin/bash
alias dots="git --git-dir=\$HOME/.dotfiles.git/ --work-tree=\$HOME"
dots="git --git-dir=\$HOME/.dotfiles.git/ --work-tree=\$HOME"
username=$(whoami)
prev=$(pwd)
verbose=0
rm -rf "~/dots_backup"
while getopts "v" OPTION
do
case $OPTION in
@ -49,7 +51,7 @@ IFS="
info "Backing up your old dotfiles"
## Backup eveything in the git tree
mkdir "$HOME/dots_backup"
for i in $(dots ls-files); do
for i in $(bash -c "$dots ls-files"); do
if [ -f "$i" ]; then
debug "$i"
mkdir -p "$HOME/dots_backup/$(echo "$i" | sed "s/\/[^\/]*$//g")"
@ -64,13 +66,13 @@ mvie ~/.icons ~/.dotfiles_backup/icons
ln -s ~/.dotfiles/local/share/icons ~/.icons
info "Checking out dotfiles"
dots checkout
bash -c "$dots checkout"
# Configuring for your username
if [ ! "$username" = "yigit" ]; then
info "Replacing the occurences of /home/yigit with /home/$username"
echo "Setting up the dotfiles according to your username"
dots ls-files | xargs -L 1 sed -i "s/\/home\/yigit/\/home\/$username/g"
bash -c "$dots ls-files | xargs -L 1 sed -i \"s/\/home\/yigit/\/home\/$username/g\""
fi
info "Setting up sudo so that you won't be prompted for a password for the next of the script"
@ -114,8 +116,8 @@ info "Copying some necessary files that are not in ~"
IFS="
"
for i in $(cat "$HOME/.local/root/mappings"); do
src="$(echo "$i" | sed "s/ ->.*//g)")"
dest="$(echo "$i" | sed "s/.*-> //g)")"
src="$(echo "$i" | sed "s/ ->.*//g")"
dest="$(echo "$i" | sed "s/.*-> //g")"
sudo mkdir -p "$(echo "$dest" | sed "s/\/[^\/]*$//g")"
sudo cp "$HOME/.local/root/$src" "$dest"
done
@ -133,7 +135,7 @@ cp ~/.config/config.env.default ~/.config/config.env
##Fonts
info "Downloading assets"
debug "Downloading minio binary"
curl https://minio.yigitcolakoglu.com/dotfiles/tools/mc 2> /dev/null > "$HOME/.local/bin/mc"
wget https://minio.yigitcolakoglu.com/dotfiles/tools/mc > "$HOME/.local/bin/mc"
chmod +x "$HOME/.local/bin/mc"
alias mc="$HOME/.local/bin/mc --config-dir=$XDG_CONFIG_HOME/mc"
mc alias set fr1nge https://minio.yigitcolakoglu.com "" "" > /dev/null 2> /dev/null
@ -141,11 +143,11 @@ debug "Downloading backgrounds"
mc cp -r fr1nge/dotfiles/fonts/ ~/.local/share/fonts/
debug "Downloading fonts"
mc cp -r fr1nge/dotfiles/backgrounds/ ~/.local/backgrounds/
fc-cache
debug "Downloading the GTK theme"
git clone https://github.com/material-ocean/Gtk-Theme.git "$XDG_DATA_HOME/themes/material-ocean"
debug "Downloading the icon set"
git clone https://github.com/vinceliuice/Tela-icon-theme.git /tmp/tela
fc-cache
# Setup Crontab
if [ ! -f "/var/spool/cron/$username" ]; then
@ -185,6 +187,12 @@ EOF
# Build and Install Everything
## Suckless utilities
if [ "$(hostnamectl hostname)" = "workstation" ]; then
export VPS=1
else
export VPS=0
fi
info "Installing suckless utilities"
(cd ~/.local/src; ./build.sh > /dev/null 2> /dev/null)
sudo groupadd nogroup
@ -206,7 +214,7 @@ cd $prev
mkdir -p ~/.tmux/plugins
vim +PlugInstall +qall
cd ~/.config/coc/extensions
yarn
yarn install
cd $prev
# Install mconnect
@ -236,8 +244,8 @@ rm -rf ~/.dotfiles/.git/hooks/*
rm -rf ~/install.sh
rm -rf ~/README.md
rm -rf ~/pkg.list
dots update-index --assume-unchanged {pkg.list,install.sh,README.md}
dots config --local status.showUntrackedFiles no
bash -c "$dots update-index --assume-unchanged {pkg.list,install.sh,README.md}"
bash -c "$dots config --local status.showUntrackedFiles no"
sudo rm -rf /etc/urlview/system.urlview
echo "I am now restarting your system so that the configurations changes apply"
sleep 5


+ 13
- 7
pkg.list View File

@ -1,3 +1,15 @@
ripgrep
xclip
python-pynvim
ctags
xkb-switch
mpdris2
nodejs
npm
xss-lock
picom
cronie
wget
yajl
webkit2gtk
surfraw
@ -8,25 +20,19 @@ antibody
direnv
tmux
lf
bitwarden-cli
wallabag-client
spotify-tui
spotifyd-full-git
zathura
notmuch
msmtp
isync
pass
pass-otp
newsboat
pam-gnupg
libgee
calcurse
neomutt
nvim
neovim
mpd
mpc
mpc-mpris
libxfixes
libxi
libxt


Loading…
Cancel
Save