TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Lowering resource usage with foot and systemd

69 点作者 HaoZeke12 个月前

11 条评论

chme12 个月前
The title is kinda odd. &quot;Lowering resource usage of foot with systemd&quot; sounds more appropriate.<p>Not knowing that foot is a terminal emulator, I assumed that foot is some kind of improved resource manager that allows for a general lesser resource usage.
评论 #40563100 未加载
tupolef12 个月前
I don&#x27;t want to switch to Wayland for now, but I will check foot when I do.<p>I do the same thing with URxvt as a systemd daemon, Tmux as a transient service with systemd-run from .bashrc, and a script in i3wm to run URxvtd client or hide&#x2F;get the window.<p>The way I use to run Tmux from a transient service locally and in ssh with the same .bashrc is nice I think. Tmux will survive the terminal and even if I close my session and come back to it:<p><pre><code> #!&#x2F;usr&#x2F;bin&#x2F;env bash # ~&#x2F;.bashrc: sourced by bash(1) for non-login shells. # If not running interactively, don&#x27;t do anything case $- in *i*) ;; *) return ;; esac chmod 700 ~&#x2F;.bashrc.d chmod 600 ~&#x2F;.bashrc ~&#x2F;.bashrc.d&#x2F;* # check if we are already in a Tmux session and not in ssh then open&#x2F;attach the default one if [[ ! &quot;${TERM}&quot; == &quot;tmux&quot;* ]] &amp;&amp; [[ -z &quot;${TMUX}&quot; ]] &amp;&amp; [[ -z &quot;${SSH_CONNECTION}&quot; ]] &amp;&amp; command -v tmux 1&gt; &#x2F;dev&#x2F;null; then # attach or start the local default Tmux session if systemctl --quiet $([[ $(id -u) != 0 ]]; echo &quot;--user&quot;) is-active tmux-local-$(id -un).scope; then tmux -L local-$(id -un) attach-session -t local-$(id -un) ; exit fi systemd-run -q --unit tmux-local-$(id -un) --scope $([[ $(id -u) != 0 ]] &amp;&amp; echo &quot;--user&quot;) tmux -L local-$(id -un) new-session -s local-$(id -un) ; exit elif [[ -z &quot;${TMUX}&quot; ]] &amp;&amp; [[ -n &quot;${SSH_CONNECTION}&quot; ]] &amp;&amp; command -v tmux 1&gt; &#x2F;dev&#x2F;null; then # attach or start the ssh default Tmux session if systemctl --quiet $([[ $(id -u) != 0 ]]; echo &quot;--user&quot;) is-active tmux-ssh-$(id -un).scope; then tmux -L ssh-$(id -un) attach-session -t ssh-$(id -un) ; exit fi systemd-run -q --unit tmux-ssh-$(id -un) --scope $([[ $(id -u) != 0 ]] &amp;&amp; echo &quot;--user&quot;) tmux -L ssh-$(id -un) new-session -s ssh-$(id -un) &amp;&amp; exit || echo &#x27;Tmux Systemd unit failed&#x2F;exited&#x27; fi # if Tmux is not installed or if we are inside a Tmux session continue the sourcing for file in ~&#x2F;.bashrc.d&#x2F;*.bashrc; do source &quot;${file}&quot; done</code></pre>
emmanueloga_12 个月前
I never heard about it but foot is a terminal emulator with some server mode [1].<p>—<p>1: <a href="https:&#x2F;&#x2F;wiki.gentoo.org&#x2F;wiki&#x2F;Foot#Server_mode_configuration" rel="nofollow">https:&#x2F;&#x2F;wiki.gentoo.org&#x2F;wiki&#x2F;Foot#Server_mode_configuration</a>
评论 #40558580 未加载
评论 #40561903 未加载
评论 #40558881 未加载
FrostKiwi12 个月前
Really enjoyed foot! Runs along the same lines of emacs server and emacsclient.<p>I ended up dropping it for the same reason I dropped emacs server. There are rare edge cases which causes the server to hang and thus taking down not just one instance of your work, but all of it. Losing the resilience of multiple processes is not worth the RAM it saves, not on modern hardware.
评论 #40559111 未加载
评论 #40561510 未加载
NewJazz12 个月前
IMO the best part of the foot client&#x2F;server setup is not lower memory usage, but faster terminal opening time. Starting alacritty is kinda slow. Maybe not a second, but noticeable. Starting foot standalone is definitely faster. Opening a foot window via an already running server is near instant.
评论 #40562044 未加载
评论 #40560009 未加载
yjftsjthsd-h12 个月前
&gt; Right of the bat, it is rather evident that this configuration will spawn two instances of foot, one for each scratchpad.<p>&gt; Figure 1: Snapshot of memory consumption (from btop), clients take around 10x less memory<p>By all means use a server&#x2F;clients approach if it reduces per-process memory, but it&#x27;s probably not as bad as it looks, because AFAIK the actual executable only gets loaded once and then reused. So each process has its own data in RAM, but the executable&#x2F;binary only gets loaded the once.<p>Also, if this is a problem maybe revisit your choice of terminal? It&#x27;s annoyingly hard to get a total (or more likely I just don&#x27;t know how to get it), but every number I can seem to find says alacritty is only using &lt;2MB <i>total</i> on my box, so your 27M max on foot looks... weird. Like, I can run a full standalone terminal in the size of your client; I appreciate that it might have features that make it worthwhile, but consider the tradeoffs?
评论 #40559084 未加载
评论 #40560075 未加载
评论 #40560679 未加载
MuffinFlavored12 个月前
&gt; foot is a lightweight terminal emulator designed for Wayland, focusing on minimal resource usage while maintaining performance.<p><a href="https:&#x2F;&#x2F;codeberg.org&#x2F;dnkl&#x2F;foot" rel="nofollow">https:&#x2F;&#x2F;codeberg.org&#x2F;dnkl&#x2F;foot</a><p>For those out of the loop
paulcarroty12 个月前
Still no ligatures support in foot, which is critical in dev environment.
评论 #40564638 未加载
评论 #40564431 未加载
评论 #40564660 未加载
nurettin12 个月前
This is why I run xvfb in systemd instead of using something like xvfb-run which spawns a new virtual display every time you run it.
sed312 个月前
&gt; Since I often work in strong sunlight, I often want to reconfigure my terminal to use a light or a dark scheme depending on the time of day.<p>Konsole can switch color theme with simple dbus message.<p>For the rest, I use tmux sessions and some scripts. When I restart computer, all terminal windows with remote ssh sessions get restored.<p>I do not need any modifications on server (except tmux or screen package).
Zambyte12 个月前
I thought the &quot;written by human not AI&quot; badge was kind of cute, then I clicked on it. It seems like people <i>pay</i> for the &quot;right&quot; to put that badge on their page? The author was scammed.
评论 #40562851 未加载
评论 #40562278 未加载