-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.movie_toggle
executable file
·31 lines (25 loc) · 968 Bytes
/
.movie_toggle
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
#!/bin/bash
ORIG_BORDER=`sed -ne 's/myBorderWidth *\t* *= *\t* *\([0-9]*\)/\1/p' .xmonad.hs`
MOVIE=`~/.screenmode`
# border is thick. Make it movie mode
if [ $ORIG_BORDER -ne 0 ]; then
# only toggle the screen if in vertical mode
if [ "$MOVIE" = "vertical" ]; then
~/.screen_toggle
fi
# copy the line to register q
vim '+/myBorderWidth' '+normal "qyy' '+s/\(myBorderWidth.*\)\([0-9][0-9]*\)/\10' '+x' .xmonad.hs
# turn off the screensaver, store the time in register r
vim '+/timeout' '+normal "ryy' '+s/\(timeout[^0-9]*\)\([0-9]:.*\)/\11:00:00' '+x' .xscreensaver
xmonad --restart
else
# only return to vertical mode if currently in movie mode
if [ "$MOVIE" = "movie" ]; then
~/.screen_toggle
fi
# paste the line from register q
vim '+/myBorderWidth' '+normal dd' '+normal "qp' '+x' .xmonad.hs
# restore the screensave from register r
vim '+/timeout' '+normal dd' '+normal k' '+normal "rp' '+x' .xscreensaver
xmonad --restart
fi