-
Notifications
You must be signed in to change notification settings - Fork 4
/
dwm-config-read
executable file
·94 lines (80 loc) · 2.3 KB
/
dwm-config-read
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
#!/bin/sh
###############################################################################
# dwm-config-read
#
# read dwm-scripts desktop configuration file.
#
# -----------------------------------------------------------------------------
# DWM Scripts - wrapper for dwm/dmenu/slock
# (C) 2007-2013 Gerardo García Peña
# Programmed by Gerardo García Peña
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
###############################################################################
if [ "$DSW_CONFIG_READ" ]; then
exit 0
fi
DSW_CONFIG_READ="1"
search_config_file()
{
F="$1"
if [ -z "$F" ]; then
F="dwm-config"
fi
for i in "$HOME/.$F" \
"$HOME/etc/dwm-scripts/$F" \
"/etc/dwm-scripts/$F" \
"/opt/etc/dwm-scripts/$F" ; do
if [ -e "$i" ]; then
echo "$i"
return 0
fi
done
return 1
}
log()
{
echo "$DSW_PROGNAME: $@" 1>&2
echo "`date "+%d/%m/%Y %H:%M:%s"` $DSW_PROGNAME: $@" >> "$DSW_LOG"
}
error()
{
log "error: $@"
}
msg()
{
xsetroot -name "$@"
}
# log file
DSW_LOG="$HOME/.dwm.log"
# dmenu: DMN_HOME_BIN defined will add your ~/bin binaries to dmenu list
DMN_HOME_BIN=1
# set DWM temp dir
DSW_TMP="/tmp/dwm-$USER"
# set default parameters
DSW_PROGNAME=`basename "$0"`
DSW_CONFIG_FILE=`search_config_file`
DSW_BAR_UPDATE=10
DSW_SCREEN_OFF=120
DSW_SCREEN_LOCK=200
# process config file
if [ "$DSW_CONFIG_FILE" ]; then
. "$DSW_CONFIG_FILE"
fi
# prepare ALSA commands
DSW_ALSA_CMD="amixer"
if [ "$DSW_ALSA_DEV" ]; then DSW_ALSA_CMD="$DSW_ALSA_CMD -D $DSW_ALSA_DEV"; fi
if [ "$DSW_ALSA_CARD" ]; then DSW_ALSA_CMD="$DSW_ALSA_CMD -c $DSW_ALSA_CARD"; fi