danderzei · 2022-03-25 09:17
I use the i3 window manager. I start the Emacs client (using systemd unit) with a keyboard shortcut:
bindsym $mod+F1 exec emacsclient -ce '(toggle-frame-fullscreen)'
This works perfectly, but I would like the client to start at login. The last line in my i3 config file is:
exec emacsclient -ce '(toggle-frame-fullscreen)'
But this does not seem to work and I still have to start the client manually. Any suggestions what I am doing wrong?
flexibeast · 2022-03-25 10:07
What do your i3 logs say?
danderzei · 2022-03-25 10:19
Where do I find them?
flexibeast · 2022-03-25 10:23
Wherever the call to i3 puts them. Like, in my `~/.xinitrc`, the call is:
/usr/bin/i3 -V -d all >> ~/.config/i3/logfile
danderzei · 2022-03-25 10:35
I could not see anything interesting these logs. It appears that perhaps the [autotiling package](https://github.com/nwg-piotr/autotiling) creates some conflict.
dakra · 2022-03-25 13:32
Maybe it's because you start the Emacs daemon as a user systemd unit which only get's started once you log in, and when you execute emacsclient right after it's not completely started yet.
So maybe wait for a second or 2 before starting emacsclient,
or simply don't use the systemd user unit and start the daemon from i3.
E.g. I have this in my config:
# Start Emacs in daemon mode (-a "") and create a frame (-c)
exec emacsclient -a "" -c
Qwarctick · 2022-03-25 15:36
You should put the fullpath of your emacsclient in your i3conf.
`$ which emacsclient`
`/usr/bin/emacsclient`
Then in your i3/config `exec --no-startup-id /usr/bin/emacsclient -c`
danderzei · 2022-03-25 20:55
That didn't help.
There was a delay using systemd (see comment above). All good now.
danderzei · 2022-03-25 21:12
That has helped. Thanks. I removed the systemd service, adding another 2 second to startup was annoying :)
by_wicker · 2022-03-28 15:55
Yeah, I tried and dropped the systemd spawn for (IIRC) this reason.
by_wicker · 2022-03-28 17:23
As an aside, I found it limiting to have one single Emacs daemon.
I use a bash script (fragment below) to allow me to have one per workspace, but often just connect to the first one found (I keep my 'primary' Emacs in an early workspace so this works out)
So I have one key bound to `exec <my-script> emacsclient`, and to *force* an Emacs specific to the current workspace `exec <my-script> emacsclient local`:
# Returns the current workspace name
workspace() {
i3-msg -t get_workspaces | jq -r '.[] | select(.focused==true).name'
}
if [[ "$@" == "emacsclient" ]]; then
# Basic emacsclient launch - attach to an existing Emacs, preferring one for
# this workspace, or spawn one for this workspace
if [[ -S "$XDG_RUNTIME_DIR/emacs/$(workspace)" ]]; then
SOCKETNAME=$(workspace)
else
SOCKETNAME=$(find $XDG_RUNTIME_DIR/emacs -type s -printf '%P\n' \
| sort | head -1)
fi
SOCKETNAME=${SOCKETNAME:-$(workspace)}
exec emacsclient -c --socket-name=${SOCKETNAME}
fi
if [[ "$@" == "emacsclient local" ]]; then
# Insist on an Emacs for this workspace, whether it exists or not
exec emacsclient -c --socket-name=$(workspace)
fi