Browse Source

Some scripts fixed up, support for dwm restart

main
Yigit Colakoglu 4 years ago
parent
commit
1212ef28b3
10 changed files with 38 additions and 26 deletions
  1. +10
    -6
      .config/X11/xinitrc
  2. +1
    -1
      .local/bin/dmenu-logout
  3. +1
    -6
      .local/bin/dmenu-refresh
  4. +1
    -1
      .local/bin/status-bar/bluetooth
  5. +1
    -1
      .local/bin/status-bar/date
  6. +3
    -3
      .local/bin/status-bar/mpc
  7. +13
    -1
      .local/bin/status-bar/network
  8. +6
    -4
      .local/src/dwm/keybind.h
  9. +1
    -1
      .local/src/dwm/patches.h
  10. +1
    -2
      .profile

+ 10
- 6
.config/X11/xinitrc View File

@ -9,6 +9,7 @@ pkill -f devmon
echo "$DBUS_SESSION_BUS_ADDRESS" > /tmp/bus-session
rm -rf $XDG_RUNTIME_DIR/day_cache
export XSESSION_PID="$$"
source ~/.config/config.env
gpgconf --dry-run --create-socketdir
@ -70,14 +71,17 @@ redshift -x 2> /dev/null > /dev/null
redshift -r -l "$LATLONG" > /dev/null 2> /dev/null &
tmux new-session -s weechat -d weechat > /dev/null 2> /dev/null
touch ~/.cache/dwm-restart
while [ -f /home/yigit/.cache/dwm-restart ];
restarted=0
while true;
do
rm -rf /home/yigit/.cache/dwm-restart
if [ $restarted = 0 ]; then
restarted=1
else
notify-send -a " Desktop Manager" "Dwm Restarted"
fi
dwmblocks > $XDG_RUNTIME_DIR/dwmblocks.out 2> $XDG_RUNTIME_DIR/dwmblocks.err &
exec dwm > $XDG_RUNTIME_DIR/dwm.log 2> $XDG_RUNTIME_DIR/dwm.err
sleep 0.2
dwm > $XDG_RUNTIME_DIR/dwm.log 2> $XDG_RUNTIME_DIR/dwm.err
done
firefox-sync

+ 1
- 1
.local/bin/dmenu-logout View File

@ -35,7 +35,7 @@ selection=$(printf '%s' "$items" | $DMENU)
case $selection in
logout)
logout
kill -9 "$XSESSION_PID"
;;
hibernate)
loginctl hibernate


+ 1
- 6
.local/bin/dmenu-refresh View File

@ -7,10 +7,6 @@ killprogs() {
pkill -x redshift
}
logout() {
pkill dwm
}
DMENU='dmenu -z 1900 -x 10 -y 10 -i'
items="dwm
@ -28,8 +24,7 @@ selection=$(printf '%s' "$items" | $DMENU)
case $selection in
dwm)
touch /home/yigit/.cache/dwm-restart
logout
kill -9 $(pidof dwm)
;;
dwmblocks)
kill -9 $(pidof dwmblocks)


+ 1
- 1
.local/bin/status-bar/bluetooth View File

@ -5,7 +5,7 @@ power=$(timeout 1 bluetoothctl show | grep "Powered: yes" | wc -w)
if [ "$power" -eq 0 ]; then
echo "^c#81a1c1^^d^" # Add color
else
device="$(echo info | bluetoothctl | grep 'Name')"
device="$(echo info | timeout 1 bluetoothctl | grep 'Name')"
if [ ! "$device" = "" ]; then
echo "^c#81a1c1^^d^ $(echo "$device" | head -n 1 | xargs | cut -c 7-)"


+ 1
- 1
.local/bin/status-bar/date View File

@ -8,7 +8,7 @@ else
events=""
fi
cmd=$(date +"%h%e")
cmd=$(date +"%h %e")
echo -n "^c#0f111a^^b#88c0d0^ $icon $events$cmd ^d^"


+ 3
- 3
.local/bin/status-bar/mpc View File

@ -1,10 +1,10 @@
#!/bin/bash
online=$(mpc 2> /dev/null)
title=$(mpc -f "%title%" 2> /dev/null | head -n 1)
artist=$(mpc -f "%artist%" 2> /dev/null | head -n 1)
online=$(timeout 2 mpc 2> /dev/null)
if [ ! "$online" = "" ]; then
title=$(mpc -f "%title%" 2> /dev/null | head -n 1)
artist=$(mpc -f "%artist%" 2> /dev/null | head -n 1)
if [ "$(echo "$online" | wc -l)" -le 1 ]; then
echo -n "^c#a48ead^ ^d^"
else


+ 13
- 1
.local/bin/status-bar/network View File

@ -2,6 +2,18 @@
source ~/.config/config.env
get_ssid(){
networks=$(connmanctl services | \
awk -F ' +' '{ service_id=$NF; $NF=""; $1=""; name=substr($0, 2, length-2); gsub(/[^a-zA-Z0-9-]/, "_", name) }
name { print name, service_id }')
while read -r name service_id; do
if [ $(connmanctl services "$service_id" | awk '$1 == "State" { print $3 }') = "online" ]; then
echo "$name"
break
fi
done <<< "$networks"
}
is_eth_used=$(cat /sys/class/net/$ETH_IT/carrier)
is_wlan_used=$(cat /sys/class/net/$WLAN_IT/carrier)
@ -10,7 +22,7 @@ echo -n "^c#88c0d0^"
if [ "$is_eth_used" -eq 1 ]; then # wired network is carrying
icon=" ^d^ " #uF6FF
elif [ "$is_wlan_used" -eq 1 ]; then # wireless network is carrying
icon="直 ^d^ $(nmcli -t -f active,ssid dev wifi | egrep '^yes' | cut -d\' -f2 | cut -d ':' -f2)" #uF1EB
icon="直 ^d^ $(get_ssid)" #uF1EB
else
icon=" ^d^" #uf128 # no network
fi


+ 6
- 4
.local/src/dwm/keybind.h View File

@ -69,13 +69,15 @@ static Key keys[] = {
{ MODKEY, XK_Return, spawn, {.v = termcmd } },
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = tmuxcmd } },
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY|ShiftMask, XK_i, spawn, {.v = screensaver} },
{ MODKEY|ShiftMask, XK_n, spawn, {.v = notification } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
{ MODKEY|ShiftMask, XK_Return, zoom, {0} },
{ MODKEY, XK_Right, setmfact, {.f = +0.05} },
{ MODKEY, XK_Left, setmfact, {.f = -0.05} },
{ MODKEY, XK_Down, setcfact, {.f = -0.25} },
{ MODKEY, XK_Up, setcfact, {.f = +0.25} },
{ MODKEY|ShiftMask, XK_z, zoom, {0} },
{ MODKEY, XK_Tab, view, {0} },
{ MODKEY, XK_q, killclient, {0} },
{ MODKEY|Mod1Mask, XK_i, incnmaster, {.i = +1 } },


+ 1
- 1
.local/src/dwm/patches.h View File

@ -417,7 +417,7 @@
* respective stack in tiled layout.
* https://dwm.suckless.org/patches/cfacts/
*/
#define CFACTS_PATCH 0
#define CFACTS_PATCH 1
/* This patch allows color attributes to be set through the command line.
* https://dwm.suckless.org/patches/cmdcustomize/


+ 1
- 2
.profile View File

@ -19,7 +19,6 @@ export XDG_CONFIG_HOME="$HOME"/.config
export XDG_CACHE_HOME="$HOME"/.cache
export XDG_DATA_DIRS="/usr/local/share:/usr/share"
export XDG_CONFIG_DIRS="/etc/xdg"
export XDG_RUNTIME_DIR="/run/user/1000"
# Cleanup Home Directory
export HISTFILE="$XDG_DATA_HOME"/history
@ -92,7 +91,7 @@ fi
# Start xinit if logged in from tty1
if [ "$DISPLAY" = "" ] && [ "$(tty)" = /dev/tty1 ]; then
if [ "$DBUS_SESSION_BUS_ADDRESS" = "" ] && [ ! $(command -v dbus-launch) = "" ]; then
exec dbus-launch --exit-with-session xinit 2> $XDG_RUNTIME_DIR/xinit.err > $XDG_RUNTIME_DIR/xinit
exec dbus-run-session xinit 2> $XDG_RUNTIME_DIR/xinit.err > $XDG_RUNTIME_DIR/xinit
else
exec xinit 2> $XDG_RUNTIME_DIR/xinit.err > $XDG_RUNTIME_DIR/xinit
fi


Loading…
Cancel
Save