fix(eww): use absolute path for stoa-capture so eww's /bin/sh finds it#94
Merged
Merged
Conversation
The previous PR replaced the hardcoded /home/zeno/.local/bin/stoa-capture with the unqualified "stoa-capture", relying on PATH. That works from the user's interactive zsh (which has ~/.local/bin in PATH via .zshrc) but eww spawns commands via /bin/sh -c, and that shell inherits only the environment Hyprland was started with — not user shell rc files — so ~/.local/bin isn't on PATH. Result: clicking the capture button silently does nothing, with no log entry produced because the script itself never executes. Manual invocation from the terminal worked (zsh has the right PATH), which is what made the bug hard to pin down. Use \"~/.local/bin/stoa-capture\" in the onclick. sh expands a leading tilde during word expansion even from inside a -c string, so this resolves to the linked install path under any user's home.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Causa raiz (finalmente)
O log do usuário mostra um detalhe que estava me enganando: as entries
screen screenshot 0/1/2que apareceram após o teste eram todas do teste manual no terminal que pedi pra ele rodar, não do widget. Pelo widget, nada continua disparando.A diferença entre o terminal funcionando e o widget falhando é o PATH:
.zshrcque provavelmente adiciona~/.local/binao PATH./bin/sh -c "stoa-capture ...". Esse sh herda o ambiente do Hyprland (que herdou de greetd/login), que não inclui~/.local/bin— esse path normalmente é setado em rc files de shells interativos, não no ambiente do login.Por isso o original com hardcoded
/home/zeno/.local/bin/stoa-capturefuncionava: caminho absoluto, achava sempre. Quando troquei prastoa-captureno PR #87, todo o widget passou a falhar silenciosamente (clique → sh tentastoa-capture→ "command not found" → exit 127 → nenhum log).Fix
Voltar pra caminho absoluto, mas portável (não hardcoded ao usuário "zeno"):
shexpande o til no início de palavra mesmo dentro de uma string-c, então resolve corretamente pra$HOME/.local/bin/stoa-capturede qualquer usuário.Test plan
git pull && eww reload(fechar e reabrir o widget se já estiver aberto, pra pegar o config novo)~/Pictures/screenshots/Script called with args: screen screenshot 0(ou similar) ao clicar o botãoGenerated by Claude Code