-
Notifications
You must be signed in to change notification settings - Fork 0
/
xinitrc
112 lines (94 loc) · 2.55 KB
/
xinitrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/bin/sh
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/Xresources
sysmodmap=/etc/X11/xinit/Xmodmap
# merge in defaults and keymaps
if [ -f $sysresources ]; then
xrdb -merge $sysresources
fi
if [ -f $sysmodmap ]; then
xmodmap $sysmodmap
fi
if [ -f $userresources ]; then
xrdb -merge $userresources
fi
if [ -f $usermodmap ]; then
xmodmap $usermodmap
fi
# D-Bus
if which dbus-launch >/dev/null && test -z "$DBUS_SESSION_BUS_ADDRESS"; then
eval "$(dbus-launch --sh-syntax --exit-with-session)"
fi
## Statusbar
sp="$(echo -ne " ")"
sp1="$(echo -ne " | ")"
sp2="$(echo -ne "| ")"
sp3="$(echo -ne "|")"
print_power() {
status="$(cat /sys/class/power_supply/ADP1/online)"
battery="$(cat /sys/class/power_supply/BAT0/capacity)"
timer="$(acpi -b | grep "Battery" | awk '{print $5}' | cut -c 1-5)"
if [ "${status}" == 1 ]; then
echo -ne "${sp} ${battery}%"
else
if [ ${battery} -lt "20" ];then
echo -ne "${sp} ${battery}%" #(${timer})"
elif [ ${battery} -lt "40" ];then
echo -ne "${sp} ${battery}%" #(${timer})"
elif [ ${battery} -lt "60" ];then
echo -ne "${sp} ${battery}%" #(${timer})"
elif [ ${battery} -lt "80" ];then
echo -ne "${sp} ${battery}%" #(${timer})"
elif [ ${battery} -lt "100" ];then
echo -ne "${sp} ${battery}%" #(${timer})"
fi
fi
}
print_wifiqual() {
wifiessid="$(/sbin/iwconfig 2>/dev/null | grep ESSID | cut -d: -f2)"
wifiawk="$(echo $wifiessid | awk -F',' '{gsub(/"/, "", $1); print $1}')"
wificut="$(echo $wifiawk | cut -d' ' -f1 | cut -d'/' -f1)"
echo -ne "${sp} ${wificut}"
}
print_volume(){
mix=`amixer get Master | tail -1`
vol="$(amixer get Master | tail -n1 | sed -r 's/.*\[(.*)%\].*/\1/')"
if [[ $mix == *\[off\]* ]];then
#red 2
echo -e "${sp} OFF"
elif [[ $mix == *\[on\]* ]]; then
#green 9
echo -e "${sp} ${vol}%"
else
#yellow6
echo -e "${sp} ---"
fi
}
print_datetime() {
datetime="$(date "+%H:%M %a %d")"
# %b")"
echo -ne "${sp} ${datetime}"
}
print_kernel() {
kernel=$(uname -r)
echo "${sp}${kernel}"
}
while true; do
xsetroot -name "$(print_power)$(print_wifiqual)$(print_volume)$(print_datetime)"
done &
setxkbmap fr
### Options
#feh --bg-scale $HOME/.config/i3/classic.png &
#numlockx on
#tilda &
#synclient TapButton2=3
#synclient TapButton3=2
#synclient VertTwoFingerScroll=1
#synclient PalmDetect=1
### Touchpad off
#xinput disable 16
#xinput disable 17
### Power button off
#xinput disable 6
exec $HOME/.config/dwm/startdwm