-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathintegration.html
345 lines (326 loc) · 14.1 KB
/
integration.html
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
<!DOCTYPE html>
<html lang=en>
<head>
<title>jgmenu</title>
<meta charset="utf-8" />
<meta name="description" content="jgmenu"/>
<meta name="viewport" content="width=device-width">
<style>
body {
overflow-y: scroll;
font-family: sans-serif;
background-color: #fff;
color: black;
max-width: 600px;
padding: 20px;
line-height: 1.5;
word-wrap: break-word;
margin: auto;
}
pre {
padding: 20px;
white-space: pre-wrap;
border: 1px dotted gray;
display: block;
margin: 20px auto;
background-color: #eee;
color: #111;
}
code {
font-family: monospace;
background-color: #eee;
color: #111;
}
img {
margin: 20px auto;
max-width: 100%;
}
table {
border-collapse: collapse;
}
table,th,td {
border: 1px solid black;
}
th,td {
padding: 15px;
text-align: left;
}
h1 a, h2 a, h3 a, h4 a, h5 a {
text-decoration: none;
}
h1, h2, h3, h4, h5 {
font-family: sans-serif;
font-weight: bold;
}
h1 {
font-size: 130%;
}
h2 {
font-size: 110%;
}
h3 {
font-size: 95%;
}
h4 {
font-size: 90%;
font-style: italic;
}
h5 {
font-size: 90%;
font-style: italic;
}
dt code {
font-weight: bold;
}
dd p {
margin-top: 0;
}
</style>
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-162822348-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-162822348-1');
</script>
</head>
<body>
<main>
<a href='index.html'>Home</a><h1 id="integration">Integration</h1>
<p>Panels</p>
<ul>
<li><a href="#tint2">tint2</a></li>
<li><a href="#polybar">polybar</a></li>
<li><a href="#unity">unity</a></li>
<li><a href="#cairo">cairo-dock</a></li>
<li><a href="#polybar">plank</a></li>
</ul>
<p>Window Managers</p>
<ul>
<li><a href="#openbox">openbox</a></li>
<li><a href="#i3">i3</a></li>
<li><a href="#dwm">dwm</a></li>
<li><a href="#xmonad">xmonad</a></li>
</ul>
<p>Other</p>
<ul>
<li><a href="#background">start in background</a></li>
<li><a href="#compton">compton</a></li>
<li><a href="#obmenu">obmenu-generator</a></li>
<li><a href="#superkey">superkey</a></li>
<li><a href="#gtktheme">gtk theme</a></li>
</ul>
<h2 id="panels">Panels</h2>
<h3 id="tint2">tint2</h3>
<p>In jgmenurc, set <code>tint2_look = 1</code> to make jgmenu look like
tint2 (i.e. colour, font, margin, padding and position). Other config
variables in jgmenurc will overrule any tint2 settings, so start with
all other lines commented out.</p>
<p>The <code>button</code> plugin was designed for jgmenu, and is
therefore the preferred method. Take the following steps to insert a
button plugin:</p>
<p>Add the letter <code>P</code> to <code>panel_items</code> in tint2rc.
For example <code>panel_items = PTSBC</code>.</p>
<p>Add the following to tint2rc:</p>
<pre><code>button = new
button_icon = /path/to/favourite_icon.png
button_lclick_command = jgmenu_run</code></pre>
<p>An <code>exec plugin</code> (<code>E</code>) or
<code>launcher plugin</code> (<code>L</code>) can also be used. See
<code>man tint2</code> for implementation details.</p>
<p>Note: The tint2 <code>launcher plugin</code> is significantly slower
than button and exec plugins.</p>
<p>In order to avoid <code>startup notification</code> (spinning
hour-glass after clicking button or launcher), set the following in
~/.config/tint2/tint2rc:</p>
<pre><code>startup_notifications = 0</code></pre>
<p>tint2 respects the <code>StartupNotify=</code> key in the .desktop
files, so if you want to have a menu button wihtout SN and other
launchers with SN, you would have to set
<code>startup_notification = 1</code> in tint2rc and use a launcher
plugin for your jgmenu button.</p>
<h3 id="polybar">polybar</h3>
<p>Add “jgmenu” to one of “modules-{left,center,right} in the”[bar/foo]”
section.</p>
<p>For example:</p>
<pre><code>[bar/example]
modules-left = jgmenu bspwm i3</code></pre>
<p>Also add:</p>
<pre><code>[module/jgmenu]
type = custom/text
content-padding = 2
content = menu
click-left = "jgmenu_run >/dev/null 2>&1 &"</code></pre>
<h3 id="unity">unity</h3>
<p>The installation process creates a desktop-file in
<code>$prefix/share/applications</code> (or
<code>~/.local/share/applications</code> if $prefix is set to
$HOME).</p>
<p>If using default desktop file (which simply executes
<code>jgmenu_run</code>) in Ubuntu’s Unity panel, the launcher will
flash for 5-7 seconds and you will not be able to click it again during
this time.</p>
<p>To prevent this from happening, prepend the <code>Exec=</code>
command with <code>env JGMENU_UNITY=1</code>. For example:</p>
<pre><code>Exec=env JGMENU_UNITY=1 jgmenu_run</code></pre>
<h3 id="cairo">cairo-dock</h3>
<p>Add the jgmenu launcher by dragging to the dock.</p>
<p>By default, cairo-dock is setup to prevent the user clicking multiple
times in quick succession on the same icon. In order to achieve
menu-like behaviour, carry out the following steps:</p>
<ul>
<li>Right-click on the jgmenu launcher.</li>
<li>Click “Cairo-Dock” -> “Configure”</li>
<li>Select the “Current Items” tab.</li>
<li>Select “jgmenu”</li>
<li>Under “Extra Parameters”, tick “Don’t link the launcher with its
window”</li>
</ul>
<h3 id="plank">plank</h3>
<p>In your file manager, navigate to
<code>/usr/share/applications/</code> (or similar path depending on
where .desktop files are installed on your system).</p>
<p>Drag the jgmenu launcher onto the panel.</p>
<p>On early versions of plank, the full icon path name was needed in the
.desktop file. Please edit manually if this is the case on your
system.</p>
<h2 id="window-managers">Window Managers</h2>
<h3 id="openbox">openbox</h3>
<p>To bind <code>jgmenu_run</code> to a keyboard shortcut (ctrl-escape
in this case), add the following to the
<code><keyboard></keyboard></code> section of
<code>~/.config/openbox/rc.xml</code></p>
<pre><code><keybind key="C-Escape">
<action name="Execute">
<command>jgmenu_run</command>
</action>
</keybind></code></pre>
<p>To bind <code>jgmenu_run</code> to a mouse event (right click on root
window in this case), add the following to the
<code><mouse><context name="Root"></context></mouse></code>
section of <code>~/.config/openbox/rc.xml</code></p>
<pre><code><mousebind button="Right" action="Release">
<action name="Execute">
<command>jgmenu_run</command>
</action>
</mousebind></code></pre>
<p>Note: <code>action="Press"</code> can be used instead of
<code>action="Release"</code></p>
<h3 id="i3">i3</h3>
<p>In i3 it would probably seem most natural to bind a key-combination
to jgmenu. For example, like this:</p>
<pre><code>bindsym $mod+z exec jgmenu_run</code></pre>
<p>i3 provides no way to access the root window, a right-click can be
bound on the status bar like this.</p>
<pre><code>bar {
bindsym button3 exec --no-startup-id jgmenu_run
}</code></pre>
<h3 id="dwm">dwm</h3>
<p>To associate jgmenu with a keyboard shortcut (alt-F1 in this case),
add the following to the <code>keys[]</code> array in
<code>config.h</code></p>
<div class="sourceCode" id="cb10"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="op">{</span> MODKEY<span class="op">,</span> XK_F1<span class="op">,</span> spawn<span class="op">,</span> <span class="op">{.</span>v <span class="op">=</span> jgmenucmd <span class="op">}</span> <span class="op">},</span></span></code></pre></div>
<p>In the <code>/* commands */</code> section, add</p>
<div class="sourceCode" id="cb11"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="dt">static</span> <span class="dt">const</span> <span class="dt">char</span> <span class="op">*</span>jgmenucmd<span class="op">[]</span> <span class="op">=</span> <span class="op">{</span> <span class="st">"jgmenu_run"</span><span class="op">,</span> NULL <span class="op">};</span></span></code></pre></div>
<p>Example jgmenurc to suit dwm:</p>
<pre><code>tint2_look = 0
menu_width = 120
menu_margin_y = 17
menu_margin_x = 0
menu_padding_top = 0
menu_padding_right = 0
menu_padding_bottom = 0
menu_padding_left = 0
menu_radius = 1
menu_valign = top
sub_spacing = 0
item_margin_x = 1
item_margin_y = 1
item_height = 17
sep_height = 4
icon_size = 0
arrow_width = 8</code></pre>
<p>To launch jgmenu on background right click or window title click, add
the following to the <code>buttons[]</code> array:</p>
<div class="sourceCode" id="cb13"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a><span class="op">{</span> ClkWinTitle<span class="op">,</span> <span class="dv">0</span><span class="op">,</span> Button1<span class="op">,</span> spawn<span class="op">,</span> <span class="op">{.</span>v <span class="op">=</span> jgmenucmd <span class="op">}</span> <span class="op">},</span></span>
<span id="cb13-2"><a href="#cb13-2" aria-hidden="true" tabindex="-1"></a><span class="op">{</span> ClkWinTitle<span class="op">,</span> <span class="dv">0</span><span class="op">,</span> Button3<span class="op">,</span> spawn<span class="op">,</span> <span class="op">{.</span>v <span class="op">=</span> jgmenucmd <span class="op">}</span> <span class="op">},</span></span>
<span id="cb13-3"><a href="#cb13-3" aria-hidden="true" tabindex="-1"></a><span class="op">{</span> ClkRootWin<span class="op">,</span> <span class="dv">0</span><span class="op">,</span> Button3<span class="op">,</span> spawn<span class="op">,</span> <span class="op">{.</span>v <span class="op">=</span> jgmenucmd <span class="op">}</span> <span class="op">},</span></span></code></pre></div>
<p>and add the following to jgmenurc</p>
<pre><code>at_pointer = 1</code></pre>
<h3 id="xmonad">xmonad</h3>
<p>To launch jgmenu on a keyboard shortcut (super+p in this case), add
the following to your keys def in <code>xmonad.hs</code>:</p>
<div class="sourceCode" id="cb15"><pre
class="sourceCode haskell"><code class="sourceCode haskell"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a>customKeys (<span class="dt">XConfig</span> { modMask <span class="ot">=</span> modm }) <span class="ot">=</span> M.fromList</span>
<span id="cb15-2"><a href="#cb15-2" aria-hidden="true" tabindex="-1"></a> [ ((modm, xK_p), spawn <span class="st">"jgmenu_run"</span>) <span class="op">...</span></span></code></pre></div>
<p>To trigger on, say, super+right click, add the following to your
mouse bindings def:</p>
<div class="sourceCode" id="cb16"><pre
class="sourceCode haskell"><code class="sourceCode haskell"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a>customMouseBindings (<span class="dt">XConfig</span> { modMask <span class="ot">=</span> modm }) <span class="ot">=</span> M.fromList</span>
<span id="cb16-2"><a href="#cb16-2" aria-hidden="true" tabindex="-1"></a> [ ((modm, button2), <span class="fu">const</span> <span class="op">$</span> spawn <span class="st">"jgmenu_run"</span>) <span class="op">...</span></span></code></pre></div>
<h2 id="other">Other</h2>
<h3 id="background">Start in background</h3>
<p>To start jgmenu in the background during the boot process, use the
following command:</p>
<pre><code>(sleep 2s; jgmenu --hide-on-startup) &</code></pre>
<p>Note: If started in this way, <code>_NET_WORKAREA</code> may not be
read correctly</p>
<h3 id="compton">compton</h3>
<p>The X11 properties <code>WM_NAME</code> and <code>WM_CLASS</code> are
set for jgmenu windows.</p>
<p>For example, in order to avoid jgmenu shadows, add one of these lines
to ~/.config/compton.conf:</p>
<pre><code>shadow-exclude = [ "name = 'jgmenu'" ];</code></pre>
<pre><code>shadow-exclude = [ "class_g = 'jgmenu'" ];</code></pre>
<p>For a snappier experience, avoid fade by adding:</p>
<pre><code>fade-exclude = [ "name = 'jgmenu'" ];</code></pre>
<h3 id="obmenu">obmenu-generator</h3>
<p><a
href="https://github.com/trizen/obmenu-generator">obmenu-generator</a>
produces menu data in openbox XML format. It can be integrated with with
jgmenu in a number of ways.</p>
<p>For a short-lived menu, run this from a terminal:</p>
<pre><code>jgmenu --csv-cmd="jgmenu_run ob --cmd='obmenu-generator -i'" --simple</code></pre>
<p>To run jgmenu as a long-running application, set the following in
your ~/.config/jgmenu/jgmenurc:</p>
<pre><code>csv_cmd = jgmenu_run ob --cmd='obmenu-generator -i'</code></pre>
<p>For installation of obmenu-generator, see<br />
<a
href="https://github.com/trizen/obmenu-generator/blob/master/INSTALL.md">https://github.com/trizen/obmenu-generator/blob/master/INSTALL.md</a></p>
<h3 id="superkey">superkey</h3>
<p>In order to bind jgmenu to the super-key, take the following
steps:</p>
<ol type="1">
<li><p>Bind <code>jgmenu_run</code> to a key combination. The method for
doing this depends on your system and is outside the scope of this
guide. For the next step, let’s assume that you have bound
<code>Control + Escape</code> to <code>jgmenu_run</code></p></li>
<li><p>Install <code>xcape</code> and run the following:
<code>xcape -e 'Super_L=Control_L|Escape'</code></p></li>
</ol>
<p><code>ksuperkey</code> is a very similar package and can be used
instead of <code>xcape</code></p>
<h3 id="gtktheme">GTK theme</h3>
<p>Add the code below to ~/.config/jgmenu/startup and make the file
executable:</p>
<pre><code>#!/bin/sh
gtktheme () {
while IFS='=' read -r key value; do
if [ "${key}" = "gtk-theme-name" ]; then
printf '%s' "${value}"
return 0
fi
done < "$HOME/.config/gtk-3.0/settings.ini"
}
old=$(cat ~/.cache/jgmenu/.last-gtktheme)
new=$(gtktheme)
if ! [ "${old}" = "${new}" ]; then
printf '%b
' "info: change gtk theme from ${old} to ${new}"
jgmenu_run gtktheme
fi</code></pre>
<p>Add the following to ~/.config/jgmenu/hooks:</p>
<pre><code>~/.config/gtk-3.0/settings.ini,jgmenu_run gtktheme</code></pre>
</main>
</body>
</html>