commit de08117
hovercats
·
2023-01-16 20:46:04 +0000 UTC
parent 2a63491
fullscreen: nits
1 files changed,
+10,
-10
+10,
-10
1@@ -5,37 +5,37 @@
2 # depends on: focus
3
4 # this file is used to store the previous geometry of a window
5-FSFILE=${FSFILE:-/tmp/.fwin}
6+FSFILE="${FSFILE:-/tmp/.fwin}"
7
8 # it's pretty simple, but anyway...
9 usage() {
10- echo "usage: $(basename $0) <wid>"
11+ echo "usage: $(basename "$0") <wid>"
12 exit 1
13 }
14
15 # exit if no argument given
16-test -z "$1" && usage
17+[ -z "$1" ] && usage
18
19 # this will unset the fullscreen state of any fullscreen window if there is one.
20 # this way, there will only be one window in fullscreen at a time, and no window
21 # will loose their previous geometry info
22-test -f $FSFILE && wtp $(cat $FSFILE)
23+[ -f "${FSFILE}" ] && wtp $(cat "${FSFILE}")
24
25 # if file exist and contain our window id, it means that out window is in
26 # fullscreen mode
27-if test -f $FSFILE && grep -q $1 $FSFILE; then
28+if [ -f "${FSFILE}" ] && grep -q "$1" "${FSFILE}"; then
29 # if the window we removed was our window, delete the file, so we can
30 # fullscreen it again later
31- rm -f $FSFILE
32+ rm -f "${FSFILE}"
33
34 else
35 # if not, then put the current window in fullscreen mode, after saving its
36 # geometry and id to $FSFILE we also remove any border from this window.
37- wattr xywhi $1 > $FSFILE
38- chwb -s 0 $1
39- wtp $(wattr xywh $(lsw -r)) $1
40+ wattr xywhi "$1" > "${FSFILE}"
41+ chwb -s 0 "$1"
42+ wtp $(wattr xywh $(lsw -r)) "$1"
43 fi
44
45 # now focus the window, and put it in front, no matter which state we're in, and
46 # put the cursor on its bottom-right corner (for consistency)
47-focus $1
48+focus "$1"