-
Notifications
You must be signed in to change notification settings - Fork 0
/
tag-qutebrowser.html
108 lines (97 loc) · 4.59 KB
/
tag-qutebrowser.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="alternate"
type="application/rss+xml"
href="https://blog.winny.tech/rss.xml"
title="RSS feed for https://blog.winny.tech/"/>
<title>blog.winny.tech</title>
<link href="static/style.css?v=1.7" rel="stylesheet" type="text/css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div id="preamble" class="status">
<nav>
<div class="flexcontainer">
<div class="smallitem">
blog.winny.tech
</div>
<div class="bigitem">
<ul class="inline-list">
<li><a href=".">Home</a></li>
<li><a href="archive.html">Archive</a></li>
<li><a href="tags.html">Tags</a></li>
<li><a href="rss.xml">RSS Feed</a></li>
</ul>
</div>
</div>
</nav>
<hr/>
</div>
<div id="content">
<h1 class="title">Posts tagged "qutebrowser":</h1>
<div class="post-date">28 Jul 2019</div><h1 class="post-title"><a href="2019-07-28-open-url-in-existing-qutebrowser-from-emacs-daemon-on-gentoo.html">Open URL in existing Qutebrowser from Emacs Daemon on Gentoo</a></h1>
<p>
On my Gentoo desktops, I use Emacs Daemon via <code>sys-emacs/emacs-daemon</code><sup><a id="fnr.1" class="footref" href="#fn.1">1</a></sup>
to ensure an Emacs instance is ready to go and always available from
boot. This is done via creating a symbolic link like
<code>/etc/init.d/emacs.winston</code> to <code>/etc/init.d/emacs</code> which will start Emacs
for the given user. See the package README for more details.
</p>
<p>
A shortcoming of this setup is <code>XDG_RUNTIME_DIR</code><sup><a id="fnr.2" class="footref" href="#fn.2">2</a></sup> is not set, as this is
set by my Desktop Session - maybe LightDM or consolekit set this? As a
result, when I open a URL from Emacs Daemon, it opens a fresh
qutebrowser session, loading the saved default session, and making a
mess of my workflow.
</p>
<p>
One approach to fix this might be to instead run Emacs daemon from my
<code>.xsession</code> script, but I rather not supervise daemons at the user
level; if I were to consider this, I'd be better off to switch to
systemd for user-level services anyway.
</p>
<p>
The solution I came up with is to add some lines to my <code>init.el</code> to
ensure <code>XDG_RUNTIME_DIR</code> is set to the expected value:
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp">(<span style="color: #4c83ff;">defun</span> <span style="color: #ff1493;">winny/ensure-XDG_RUNTIME_DIR</span> ()
<span style="color: #FBDE2D;">"Ensure XDG_RUNTIME_DIR is set. Used by qutebrowser and other utilities."</span>
(<span style="color: #4c83ff;">let</span> ((rd (getenv <span style="color: #61CE3C;">"XDG_RUNTIME_DIR"</span>)))
(<span style="color: #4c83ff;">when</span> (<span style="color: #4c83ff;">or</span> (not rd) (string-empty-p rd))
(setenv <span style="color: #61CE3C;">"XDG_RUNTIME_DIR"</span> (format <span style="color: #61CE3C;">"/run/user/%d"</span> (user-uid))))))
(add-hook 'after-init-hook #'winny/ensure-XDG_RUNTIME_DIR)
</pre>
</div>
<p>
A strange emacs-ism: <code>(user-uid)</code> returns float or integer, despite the
backing <code>uid_t</code> (on *nix) is guarenteed to be an integer type. I'll just
assume this'll never return a float. Please contact me otherwise, I'd
love to hear about this.
</p>
<div id="footnotes">
<h2 class="footnotes">Footnotes: </h2>
<div id="text-footnotes">
<div class="footdef"><sup><a id="fn.1" class="footnum" href="#fnr.1">1</a></sup> <div class="footpara"><p class="footpara">
<a href="https://packages.gentoo.org/packages/app-emacs/emacs-daemon">https://packages.gentoo.org/packages/app-emacs/emacs-daemon</a>
</p></div></div>
<div class="footdef"><sup><a id="fn.2" class="footnum" href="#fnr.2">2</a></sup> <div class="footpara"><p class="footpara">
<a href="https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html">freedesktop.org XDG Base Directory Specification</a>
</p></div></div>
</div>
</div><div class="taglist"><a href="tags.html">Tags</a>: <a href="tag-emacs.html">emacs</a> <a href="tag-productivity.html">productivity</a> <a href="tag-computing.html">computing</a> <a href="tag-gentoo.html">gentoo</a> <a href="tag-qutebrowser.html">qutebrowser</a> </div><div id="archive">
<a href="archive.html">Other posts</a>
</div>
</div>
<div id="postamble" class="status">
<hr/>
<ul class="inline-list interpunct">
<li>Powered by <a href="https://github.com/bastibe/org-static-blog">org-static-blog</a></li>
<li>Like what I do? <a href="https://www.buymeacoffee.com/winny">Buy me a Coffee</a></li>
</ul>
<p>© Winston Weinert (winny) — <a href="https://creativecommons.org/licenses/by-sa/4.0/legalcode">CC-BY-SA-4.0</a></p>
</div>
</body>
</html>