-
Notifications
You must be signed in to change notification settings - Fork 2
/
new-startup-config
127 lines (107 loc) · 5.38 KB
/
new-startup-config
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
[[
no. just, no. dislike hardwiring stuff, that's what got us into the
messes this wants to fix (about 5 bugs from the old bug tracker),
but making something that can script around e.g. multiple lib
directories is just too complex. will just hardcode that, and then
90% of this goes away.
...aaaaaand it's gone.
]]
xmonad sandbox/config directory support
build.config
${XDG_CONFIG_HOME:-$HOME/.config:${XDG_CONFIG_DIRS:-/etc/xdg}}/xmonad/build.config
$HOME/Library/Preferences/xmonad/build.config
$HOME/.xmonad/build.config
The first of these found is used, and defines the default location for other files;
this can be overridden via entries in build.config. If none has this then we repeat
looking for xmonad.hs and otherwise use defaults.
XDG_DATA_HOME / XDG_DATA_DIRS. Some contribs actually have a use for this,
all currently operating in an ad hoc manner. It is arguable whether xmonad.errors counts
as data or as cache. I'd been leaning toward cache but may change my mind. That said,
strict reading of XDG spec seems to agree that it should be cache. The local package tree
will also go here.
All other files are considered generated and belong in $XDG_CACHE_HOME.
The build.config is parsed with ReadP to avoid extra dependencies on a parser.
xmessage_file = "xmessage -in" -- command to run for xmessage; should be UTF8 aware
-- (note that xmessage itself is not! ghc output will have noise.)
-- filename is appended to this. It should output literally; Pango-based
-- programs such as zenity should be told not to process markup.
-- see https://github.com/geekosaur/xmonad.hs/blob/master/xmessage which
-- might go into xmonad-contrib.
-- This is mostly in here because the rebuild uses it to display errors.
-- Strictly speaking it is not about build, and is intended to address contrib
-- uses as well.
-- Use %f for filename to allow e.g. sed pipeline, else it will be appended.
xmessage_short = "xmessage" -- as above but message is on command line
-- message will be provided as a single parameter.
-- Use %s for message, or it will be appended.
recompile = "%xmonad --recompile" -- command to recompile
-- replacing hardcoded "xmonad --recompile". used by mod-q. the actual
-- recompilation is not directly controllable; trying to make it so
turned this into a nightmare, so it's gone again.
-- example usage: recompile = "stack exec -- xmonad --recompile"
environment = [] -- list of (name,val) strings to be added to environment
-- environment = [("PATH","...")]
xmonad = "xmonad" -- path to xmonad executable, available as %xmonad in commands
-- NB. prefer fixing $PATH in environment[], this is a last resort
@@@ what do -odir and -hidir do in --make mode?
@@@ recompile lock?
@@@ xmonad's own recompile check expects to be able to find various files.
@@@ this means xmonad and all .hs files in all lib directories.
Strings can use %-escapes. Original %-escapes, from sandboxed xmonad configs
(see script at end):
%% %
%{...} delimited to allow run-together. other modifiers go inside the braces.
%pid process id
%kind which sandbox (empty, -test, ...)
%arch 2nd component of executable name xmonad%kind-%arch-%os
%os 3rd component of executable name xmonad%kind-%arch-%os
%hc path to compiler
%hcver compiler version
(since most of these will not be exposed, they may go away again)
Likely additions:
%f filename for xmessage_file
%s message for xmessage_short
%$NAME environment variable (conjectural at present)
# # #
New API functions for the above:
- getXMonadDir is deprecated, and acts like getXMonadDataDir.
- getXMonadConfigDir produces the directory with sandbox.config.
You should not put data files used by extensions with the xmonad config in XDG;
this may be a sandbox directory.
- getXMonadLibDir produces the data directory.
- getXMonadDataDir produces the cache directory.
- getXMonadHs produces the location of xmonad.hs. This may be in a sandbox.
- getXMonadProg produces the location of the main xmonad binary.
- getXMessageFileProg FILE produces the xmessage command line
- getXMessageStrProg MESSAGE produces the xmessage command line.
- getXMonadKind produces the kind suffix (%kind).
- xmessage (Either String FilePath) convenience wrapper
better, data XMsgType = ShortMsg String | FromFile FilePath
- expandXMonadString STR expands %-escapes in a string
New command line parameters:
-kind KIND specifies %kind for the compiled config.
# # #
This is the recompile script from my old newXMonad, supporting config sandboxes
(a different concept from build sandboxes like stack/nix/cabal). It's several
years out of date, and needs adjustment for the new tricks I want it to do.
Also it's wired for when I was using one config for standalone and another for
running xmonad in place of kwin in KDE3.
(The script also handles the restart, and does so assuming it's running under
KDE's session manager.)
cd "$HOME/.xmonad"
ghc -W -v0 --make -i -ilib xmonad%kind.hs -o xmonad%kind-%arch-%os >xmonad%kind.errors 2>&1
if [ $? -ne 0 ] || test -s xmonad%kind.errors; then
cat xmonad%kind.errors >&2
kdialog --title=xmonad%kind --sorry "$(cat xmonad%kind.errors)"
else
cd
kill %pid
sleep 1
if [ x%kind != x ]; then
xmonad%kind-%arch-%os && exit 0
fi
exec xmonad
kdialog --title=xmonad%kind --sorry "fallback xmonad went missing?"
exec /usr/bin/kwin
fi
exit 177