help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Clicking once, starting either daemon or client


From: Jean Louis
Subject: Clicking once, starting either daemon or client
Date: Wed, 21 Jul 2021 12:43:32 +0300

This may be useful to somebody, this is how I start Emacs client since
quite some longer time.

I have this script as the icon in Window Manager, so I do have to
click twice. It will first load Emacs server in the memory, and if it
is already in memory then it will invoke the `emacsclient' and I like
`espeak' to hear which one is being started.

Of course it could be done better, this works well for personal use.



#!/bin/bash
export EMACS_SOCKET_NAME="/run/user/1001/emacs/server"
if pgrep -f "emacs --bg-daemon" > /dev/null
then
    espeak "Starting Emacs client"
    emacsclient -c
else
    espeak "Starting Emacs daemon"
    emacs --bg-daemon
fi





Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]