Browse Source

Edited some scripts, and updated dwm so that it is better

main
Yigit Colakoglu 3 years ago
parent
commit
333c953fb0
13 changed files with 47 additions and 71 deletions
  1. +0
    -2
      .config/X11/xinitrc
  2. +3
    -0
      .config/doom/config.el
  3. +0
    -6
      .config/vim/vimrc
  4. +2
    -5
      .config/zsh/.zshrc
  5. +13
    -9
      .local/bin/backup
  6. +1
    -1
      .local/bin/calconsync
  7. +4
    -3
      .local/bin/dmenu-refresh
  8. +16
    -36
      .local/bin/dmenu-xrandr
  9. +3
    -0
      .local/share/bookmarks
  10. +1
    -1
      .local/share/dwm/autostart.sh
  11. +2
    -3
      .local/src/dwm/keybinds.h
  12. +1
    -0
      .local/src/dwm/rules.h
  13. +1
    -5
      .profile

+ 0
- 2
.config/X11/xinitrc View File

@ -19,8 +19,6 @@ export XSESSION_PID="$$"
source ~/.config/config.env
pactl upload-sample /usr/share/sounds/freedesktop/stereo/bell.oga x11-bell
pactl load-module module-x11-bell sample=x11-bell display=$DISPLAY
xset b 100


+ 3
- 0
.config/doom/config.el View File

@ -38,6 +38,9 @@ user-mail-address "yigit@yigitcolakoglu.com")
(setq evil-vsplit-window-right t
evil-split-window-below t)
(require 'gas-mode)
(add-to-list 'auto-mode-alist '("\\.S\\'" . gas-mode))
(require 'bison-mode)
(after! bison-mode-hook
(setq imenu-create-index-function


+ 0
- 6
.config/vim/vimrc View File

@ -205,12 +205,6 @@ if has('nvim')
let g:Tlist_WinWidth = 40 " Tlist
endif
let hostname = substitute(system('hostname'), '\n', '', '')
if hostname == "workstation" " Check for remote machine
autocmd TextYankPost * if v:event.operator is 'y' && v:event.regname is '' | OSCYankReg " | endif"
set clipboard& clipboard^=unnamed,unnamedplus
endif
" Don't clear clipboard on exit
autocmd VimLeave * call system("xsel -ib", getreg('+'))


+ 2
- 5
.config/zsh/.zshrc View File

@ -101,11 +101,8 @@ local paste_widgets=(
vi-put-{before,after}
)
# Use X11 Clipboard
if command -v xclip; then
x11-clip-wrap-widgets copy $copy_widgets
x11-clip-wrap-widgets paste $paste_widgets
fi
x11-clip-wrap-widgets copy $copy_widgets
x11-clip-wrap-widgets paste $paste_widgets
# create a zkbd compatible hash;
# to add other keys to this hash, see: man 5 terminfo


+ 13
- 9
.local/bin/backup View File

@ -5,14 +5,18 @@
# crontab for regular backups
# Config
readonly SSH_HOST=192.168.1.8
readonly SSH_USER=yigit
readonly SSH_HOST=192.168.1.34
readonly SSH_USER=pi
readonly SSH_KEY="/home/yigit/.ssh/id_skeleton"
readonly RSYNC_PROFILE="$SSH_USER@$SSH_HOST:~/snapshots"
readonly BACKUP_DESTINATION="~/snapshots/backups"
readonly RSYNC_PROFILE="$SSH_USER@$SSH_HOST:$BACKUP_DESTINATION"
[ $(id -u) != "0" ] && printf "This program must be run as root!\n" && exit
alias ssh_cmd="ssh -i \"$SSH_KEY\" $SSH_USER@$SSH_HOST"
[ -f "$XDG_CACHE_HOME/dbus_settings" ] && "$XDG_CACHE_HOME/dbus_settings" # Load the dbus settings for current session
displays="$(ps -u $(id -u) -o pid= \
| xargs -I PID -r cat /proc/PID/environ 2> /dev/null \
| tr '\0' '\n' \
@ -48,18 +52,18 @@ timeout 3 ssh -i "$SSH_KEY" $SSH_USER@$SSH_HOST id < /dev/null > /dev/null 2> /d
while IFS= read -r DIR
do
LINK="--link-dest=/home/$SSH_USER/snapshots/tatooine/last$DIR/"
ssh -i "$SSH_KEY" $SSH_USER@$SSH_HOST mkdir -p "~/snapshots/$DEVICE/$date$DIR" < /dev/null
ssh -i "$SSH_KEY" $SSH_USER@$SSH_HOST mkdir -p "$BACKUP_DESTINATION/$DEVICE/$date$DIR" < /dev/null
rsync --exclude '.cache' "$@" -e "ssh -i $SSH_KEY" $OPT "$LINK" "$DIR/" "${SNAP}$date$DIR/"
done << EOF
$DIRS
EOF
# Remove symlink to previous snapshot
ssh_cmd rm -f "~/snapshots/$DEVICE/last" < /dev/null
ssh_cmd rm -f "$BACKUP_DESTINATION/$DEVICE/last" < /dev/null
# Create new symlink to latest snapshot for the next backup to hardlink
ssh -i "$SSH_KEY" $SSH_USER@$SSH_HOST ln -s "~/snapshots/$DEVICE/$date" "~/snapshots/$DEVICE/last" < /dev/null
ssh -i "$SSH_KEY" $SSH_USER@$SSH_HOST ln -s "$BACKUP_DESTINATION/$DEVICE/$date" "$BACKUP_DESTINATION/$DEVICE/last" < /dev/null
pidof slock > /dev/null && {
shutdown -h now
}
# pidof slock > /dev/null && { # Shutdown if screen inhibition is enabled
# shutdown -h now
# }

+ 1
- 1
.local/bin/calconsync View File

@ -7,7 +7,7 @@ eval "$(grep -h -- \
"$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.config/zsh/.zshrc" "$HOME/.pam_environment" 2>/dev/null)"
export CALCURSE_CALDAV_PASSWORD=$(pass show Server/drive.yigitcolakoglu.com/yigitcolakoglu)
calcurse-caldav
calcurse-caldav --lockfile $(mktemp) # Prevent lock file conflicts
tmpfile=$(mktemp)


+ 4
- 3
.local/bin/dmenu-refresh View File

@ -14,7 +14,7 @@ dwmblocks
mconnect
dunst
clipmenud
quark
darkhttpd
devmon
emacs
mpd
@ -63,8 +63,9 @@ case $selection in
--exec-on-unmount "/sbin/notify-send '禍 drive unmounted' '%l (%f) from %d '" \
--no-unmount --no-gui &
;;
quark)
sudo systemctl restart quark
darkhttpd)
killall -9 darkhttpd
darkhttpd $HOME/.local/share/startpage/dist --port 9999 --daemon --addr 127.0.0.1
;;
esac


+ 16
- 36
.local/bin/dmenu-xrandr View File

@ -5,7 +5,6 @@
# external commands: cat, cut, dmenu, grep, sed, xrandr
# Released under GPLv2
#
# TODO: add dpi support
typeset XRANDR_TXT # readonly; stdout of running xrandr without any options
typeset -A OUTPUT_CONFIGURED # key=connected output name
@ -92,41 +91,6 @@ function main() {
prompt='Select primary output:'
output="$(menu_select "${prompt}" ${(k)=OUTPUT_CONFIGURED})"
if [ "$(pidof x11vnc)" ]; then
killvnc="$(printf "no\nyes" | dmenu -p "Would you like to kill existing vnc display?")"
if [ "$killvnc" = "yes" ]; then
xrandr --output HDMI2 --off
killall -9 x11vnc
vnc="$(printf "no\nyes" | dmenu -p "Would you like to connect a remote display?")"
fi
else
vnc="$(printf "no\nyes" | dmenu -p "Would you like to connect a remote display?")"
fi
if [ "$vnc" = "yes" ]; then
echo "1920x1080" | dmenu -p "Please enter resolution:" | read resolution
[ "$resolution" ] || exit 1
printf "normal\nleft" | dmenu -p "Please enter rotation:" | read rotation
[ "$rotation" ] || exit 1
xrandr --output HDMI2 --off
h=$(echo "$resolution" | cut -d'x' -f1)
w=$(echo "$resolution" | cut -d'x' -f2)
modeline="$(gtf $h $w 60 | tail -n 2 | xargs | sed 's/Modeline [^ ]*//g'| xargs)"
name="${h}x${w}_$$.00"
wlan="$(ip -o -4 addr list wlan0 | awk '{print $4}' | cut -d/ -f1)"
eth="$(ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1)"
bash -c "xrandr --newmode \"$name\" $modeline"
if [ "$rotation" = "normal" ]; then
clip="${h}x${w}+0+0"
else
clip="${w}x${h}+0+0"
fi
xrandr --addmode HDMI2 "$name"
xrandr --output HDMI2 --rotation $rotation --mode $name --left-of $output && { x11vnc \
-repeat -clip $clip & } || notify-send -a "Display Manager" "An issue occured"
pidof x11vnc && notify-send -t 60000 -a " Network info" "$(echo -e "wlan0: $wlan\neth0: $eth\nRunning on port 5900")"
daily-update -f
fi
[ "$output" = "eDP1" ] && bail 1
position='--primary'
@ -152,6 +116,22 @@ function main() {
xrandr_cmd+=" --output ${output} ${position} ${rotation} ${mode}"
done
if [ "$(pidof x11vnc)" ]; then
killvnc="$(printf "no\nyes" | dmenu -p "Would you like to kill existing vnc display?")"
if [ "$killvnc" = "yes" ]; then
xrandr --output HDMI2 --off
killall -9 x11vnc
vnc="$(printf "no\nyes" | dmenu -p "Would you like to connect to your ipad?")"
fi
else
vnc="$(printf "no\nyes" | dmenu -p "Would you like to connect to your ipad?")"
fi
if [ "$vnc" = "yes" ]; then
$HOME/.local/bin/ipad_xrandr.sh
pidof x11vnc && notify-send -t 60000 -a " Network info" "$(echo -e "wlan0: $wlan\neth0: $eth\nRunning on port 5900")"
fi
# forcibly '--off' disconnected outputs
for output in ${DISCONNECTED_OUTPUTS}; do
xrandr_cmd+=" --output ${output} --off"


+ 3
- 0
.local/share/bookmarks View File

@ -4,3 +4,6 @@ https://my.tudelft.nl
https://queue.tudelft.nl
https://weblab.tudelft.nl
https://stackoverflow.com/c/tud-cs/questions
https://tudelft.zoom.us/j/98183250143?pwd=SXI4dUhBS0NxM1g2czd0azJTVitUdz09#success
https://collegerama.tudelft.nl/Mediasite/Channel/eemcs-bsc-cse/browse/null/most-recent/null/0/17117c0553d341f588d577f39bfe09ae14
https://wiki.fr1nge.xyz

+ 1
- 1
.local/share/dwm/autostart.sh View File

@ -34,7 +34,7 @@ restart_if_fails "picom --no-fading-openclose"
restart_if_fails "xbanish"
# Start emacs
restart_if_fails "emacs --daemon && emacsclient -c --eval \"(delete-frame)\""
# restart_if_fails "emacs --daemon && emacsclient -c --eval \"(delete-frame)\""
~/.local/bin/firefox-sync &
~/.local/bin/mailsync &


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

@ -46,11 +46,10 @@ static const char *notification[] = {"/home/yigit/.local/bin/dunst_toggle.sh", "
static const char *screensaver[] = {"/home/yigit/.local/bin/screensaver_toggle", "-t",NULL};
static const char *online_class[] = {"/home/yigit/.local/bin/tedportal",NULL};
static const char *toolbelt[] = {"/home/yigit/.local/bin/toolbelt", NULL};
static const char *bwmenu[] = {"/home/yigit/.local/bin/password_manager", NULL};
static const char *wallabag[] = {"/home/yigit/.local/bin/dmenu-wallabag", "-s", NULL};
static const char *wiki[] = {"/home/yigit/.local/bin/dmenu-arch", NULL};
@ -152,7 +151,7 @@ static Key keys[] = {
{ MODKEY|Mod1Mask, XK_r, spawn, {.v = record } },
{ MODKEY|ShiftMask, XK_w, spawn, {.v = wallabag} },
{ MODKEY, XK_w, spawn, {.v = wiki} },
{ MODKEY, XK_t, spawn, {.v = online_class} },
{ MODKEY, XK_t, spawn, {.v = toolbelt } },
{ MODKEY|ShiftMask, XK_m, spawn, {.v = mconnect} },
{ MODKEY|ShiftMask, XK_l, spawn, {.v = wc } },
{ MODKEY|ShiftMask, XK_d, spawn, {.v = udevil} },


+ 1
- 0
.local/src/dwm/rules.h View File

@ -44,6 +44,7 @@ static const Rule rules[] = {
{ "htop" , NULL , NULL , 0 , 1 , "50% 50% 1200W 600H" , 0 , 0 , -1 },
{ "Pavucontrol" , NULL , NULL , 0 , 1 , "50% 50% 1200W 600H" , 0 , 0 , -1 },
{ "Zathura" , NULL , NULL , 0 , 0 , NULL , 0 , 1 , -1 },
{ "Qemu-system-x86_64", NULL , NULL , 0 , 1 , NULL , 0 , 1 , -1 },
{ "spfeh" , NULL , NULL , SPTAG(1) , 1 , NULL , 0 , 0 , -1 },
{ NULL , "spterm" , NULL , SPTAG(0) , 1 , NULL , 0 , 0 , -1 },
{ NULL , "spmutt" , NULL , SPTAG(2) , 1 , NULL , 0 , 0 , -1 },


+ 1
- 5
.profile View File

@ -94,15 +94,11 @@ case "$(readlink -f /sbin/init)" in
esac
# Setup SSH
if [ ! "$SSH_AUTH_SOCK" ] && [ $(hostnamectl hostname) != "workstation" ]; then
if [ ! "$SSH_AUTH_SOCK" ]; then
eval "$(ssh-agent | head -n 2)"
grep -slR "PRIVATE" ~/.ssh/ | xargs ssh-add > /dev/null 2> /dev/null
fi
if [ $(hostnamectl hostname) = "workstation" ]; then # Server specific setup
ssh-add ~/.ssh/id_skeleton > /dev/null 2> /dev/null
fi
# Start xinit if logged in from tty1
if [ "$DISPLAY" = "" ] && [ "$(tty)" = /dev/tty1 ]; then
if [ "$DBUS_SESSION_BUS_ADDRESS" = "" ] && [ ! $(command -v dbus-run-session) = "" ]; then


Loading…
Cancel
Save