-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfwmrc
executable file
·97 lines (77 loc) · 2.12 KB
/
fwmrc
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
#!/bin/sh
#
# fwmrc
# check there is a display running
[ -z "$DISPLAY" ] && return 1
# check if arg 1 is an integer
intCheck() {
printf '%d' "$1" > /dev/null 2>&1
}
widCheck() {
case "$1" in
0x*) wattr "$1" ;;
*) return 1 ;;
esac
}
save_atom() {
widCheck "$1" && wid="$1" || return 1
mode="$2"
OLD_MODE="$(atomx MODE "$wid")"
atomx MODE="$mode" "$wid" > /dev/null
atomx NEW_POS="$X $Y $W $H" "$wid" > /dev/null
atomx SCR="$(mattr i "$wid")" "$wid" > /dev/null
# overwrite old window position when mode is different
if [ "$mode" != "$OLD_MODE" ]; then
atomx OLD_POS="$(wattr xywh "$wid")" "$wid" > /dev/null
fi
# overwrite old window position if position has changed
if [ -z "$(atomx OLD_POS "$wid")" ]; then
atomx OLD_POS="$(wattr xywh "$wid")" "$wid" > /dev/null
fi
}
del_atom() {
widCheck "$1" && wid="$1" || return 1
atomx -d SCR "$wid"
atomx -d MODE "$wid"
atomx -d OLD_POS "$wid"
atomx -d NEW_POS "$wid"
}
# list windows on focused screen or given screen
listwindows() {
mattr "$1"
case "$?" in
0) SCR="$1" ;;
*) SCR="$(pfm)" ;;
esac
lsw | xargs -n 1 mattr si 2> /dev/null | grep -F "$SCR" | cut -d\ -f 1
}
wmenv() {
PFW="$(pfw 2> /dev/null || printf '%s\n' "0x00000000")"
export PFW BW=1 JUMP=30
}
wmgaps() {
PRI="$(lsm -p)"
SEC="$(lsm | grep -v "$PRI" | head -n 1)"
BAR="botborder"
export PRI SEC BAR
export TGAP=8 BGAP=40 LGAP=8 RGAP=8 IGAP=8
export TSEC=8 BSEC=8 LSEC=8 RSEC=8 ISEC=8
}
wmcolours() {
CLR="$(grep "#include" ~/.Xresources | cut -d\" -f 2)"
URGENT="$(grep -w "color1" "$CLR" | cut -d\# -f 2)"
ACTIVE="$(grep -w "foreground" "$CLR" | cut -d\# -f 2)"
INACTIVE="$(grep -w "background" "$CLR" | cut -d\# -f 2)"
DIM="808080"
export ACTIVE URGENT INACTIVE DIM
}
dcolours() {
wmcolours
NF="$INACTIVE" # normal foreground
SF="$ACTIVE" # selected foreground
NB="$ACTIVE" # normal background
SB="$INACTIVE" # selected background
BC="$URGENT" # border colour
DBW="2"
export NF SF NB SB BC DBW
}