unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How can I (programmatically) tell if exwm is active?
@ 2023-08-16 10:27 Eric S Fraga
  2023-08-16 11:27 ` Basile Starynkevitch
  2023-08-16 12:37 ` Marcus Harnisch
  0 siblings, 2 replies; 6+ messages in thread
From: Eric S Fraga @ 2023-08-16 10:27 UTC (permalink / raw)
  To: help-gnu-emacs

Hello all,

As the subject line says, how can I check to see if exwm is active so I
can adapt my Emacs configuration accordingly?

Thank you,
eric

-- 
Eric S Fraga via gnus (Emacs 30.0.50 2023-08-14) on Debian 12.1




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How can I (programmatically) tell if exwm is active?
  2023-08-16 10:27 How can I (programmatically) tell if exwm is active? Eric S Fraga
@ 2023-08-16 11:27 ` Basile Starynkevitch
  2023-08-16 12:37 ` Marcus Harnisch
  1 sibling, 0 replies; 6+ messages in thread
From: Basile Starynkevitch @ 2023-08-16 11:27 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: e.fraga


On 8/16/23 12:27, Eric S Fraga wrote:
> Hello all,
>
> As the subject line says, how can I check to see if exwm is active so I
> can adapt my Emacs configuration accordingly?
>
> Thank you,
> eric


On Linux, you could use the pgrep utility or the /proc/ filesystem.

https://man7.org/linux/man-pages/man1/pgrep.1.html

https://man7.org/linux/man-pages/man5/proc.5.html

Maybe you need to write some GNU emacs module using these 
https://phst.eu/emacs-modules.html

BTW, my pet open source project is the RefPerSys inference engine on 
https://github.com/RefPerSys/RefPerSys (and amateurish website on 
http://refpersys.org/ ....) - contributions are welcome!


Regards


-- 
Basile Starynkevitch                  <basile@starynkevitch.net>
(only mine opinions / les opinions sont miennes uniquement)
92340 Bourg-la-Reine, France
web page: starynkevitch.net/Basile/




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How can I (programmatically) tell if exwm is active?
  2023-08-16 10:27 How can I (programmatically) tell if exwm is active? Eric S Fraga
  2023-08-16 11:27 ` Basile Starynkevitch
@ 2023-08-16 12:37 ` Marcus Harnisch
  2023-08-16 13:39   ` Eric S Fraga
  1 sibling, 1 reply; 6+ messages in thread
From: Marcus Harnisch @ 2023-08-16 12:37 UTC (permalink / raw)
  To: help-gnu-emacs

On 16/08/2023 12.27, Eric S Fraga wrote:
 > As the subject line says, how can I check to see if exwm is active so I
 > can adapt my Emacs configuration accordingly?

Check out the following environment variables:

DESKTOP_SESSION, XDG_SESSION_DESKTOP, GDMSESSION

potentially others.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How can I (programmatically) tell if exwm is active?
  2023-08-16 12:37 ` Marcus Harnisch
@ 2023-08-16 13:39   ` Eric S Fraga
  2023-08-16 14:20     ` Marcus Harnisch
  0 siblings, 1 reply; 6+ messages in thread
From: Eric S Fraga @ 2023-08-16 13:39 UTC (permalink / raw)
  To: help-gnu-emacs

Hi Marcus,

On Wednesday, 16 Aug 2023 at 14:37, Marcus Harnisch wrote:
> Check out the following environment variables:

Sorry, maybe I should have been more clear: I'm looking for an elisp
variable or function that tells me that exwm is active.  Yes, I can
drill down into the operating system (as Basile has suggested) and the
process environment but I had imagined that there would something along
the lines of `exwmp` or similar.  I just cannot find such which I find
surprising but maybe I have not searched effectively.

For the record, in any case,

> Check out the following environment variables:
> DESKTOP_SESSION, XDG_SESSION_DESKTOP, GDMSESSION

none of these environment variables gives anything useful.  Obviously, I
can set my own environment variable, say WM=exwm (or =stumpwm etc.) and
maybe that's what I'll end up doing.

Thank you,
eric

-- 
Eric S Fraga via gnus (Emacs 30.0.50 2023-08-14) on Debian 12.1




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How can I (programmatically) tell if exwm is active?
  2023-08-16 13:39   ` Eric S Fraga
@ 2023-08-16 14:20     ` Marcus Harnisch
  2023-08-16 14:34       ` Eric S Fraga
  0 siblings, 1 reply; 6+ messages in thread
From: Marcus Harnisch @ 2023-08-16 14:20 UTC (permalink / raw)
  To: help-gnu-emacs

On 16/08/2023 15.39, Eric S Fraga wrote:
> On Wednesday, 16 Aug 2023 at 14:37, Marcus Harnisch wrote:
>> Check out the following environment variables:
> 
> Sorry, maybe I should have been more clear: I'm looking for an elisp
> variable or function that tells me that exwm is active.  Yes, I can
> drill down into the operating system (as Basile has suggested) and the
> process environment but I had imagined that there would something along
> the lines of `exwmp` or similar.  I just cannot find such which I find
> surprising but maybe I have not searched effectively.

If such a function existed, how would it work without doing essentially 
the same?

You could also follow this advice: https://askubuntu.com/a/466153
But note that this will also require drilling into the OS.

I'd probably not use procfs for that, since it is much harder to tell 
the different session apart. Less critical in single user scenarios but 
still...

> For the record, in any case,
> 
>> Check out the following environment variables:
>> DESKTOP_SESSION, XDG_SESSION_DESKTOP, GDMSESSION
> 
> none of these environment variables gives anything useful.  Obviously, I
> can set my own environment variable, say WM=exwm (or =stumpwm etc.) and
> maybe that's what I'll end up doing.

Not claiming to be an expert on these matters, it looks like at least 
XDG_SESSION_DESKTOP might be a common standard. So if you must roll your 
own, it could be a good idea to use that or one of the others.

Cheers,
Marcus





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How can I (programmatically) tell if exwm is active?
  2023-08-16 14:20     ` Marcus Harnisch
@ 2023-08-16 14:34       ` Eric S Fraga
  0 siblings, 0 replies; 6+ messages in thread
From: Eric S Fraga @ 2023-08-16 14:34 UTC (permalink / raw)
  To: help-gnu-emacs

On Wednesday, 16 Aug 2023 at 16:20, Marcus Harnisch wrote:
> If such a function existed, how would it work without doing
> essentially the same?

Well, not necessarily: I would have thought that invoking exwm-enable
would set some flag (i.e. an elisp global variable) but it does not look
like it does, having gone through the code.  Oh well, never mind!

> Not claiming to be an expert on these matters, it looks like at least
> XDG_SESSION_DESKTOP might be a common standard. So if you must roll
> your own, it could be a good idea to use that or one of the others.

Again, for the record, as I do not use a desktop environment, this
variable is set to "lightdm-session" regardless of the window manager I
start up from my .xsession file.

But thank you for your suggestions.  I've gone with (getenv "WM") in my
.emacs, where WM is the environment variable I use in my .xsession to
store the name of the window manager I choose during startup of the X
session.  I just had to make sure I "exported" that variable.  Very easy
and pretty much what you were suggesting except with my own variable.

Thanks again,
eric

-- 
Eric S Fraga via gnus (Emacs 30.0.50 2023-08-14) on Debian 12.1




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-08-16 14:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-16 10:27 How can I (programmatically) tell if exwm is active? Eric S Fraga
2023-08-16 11:27 ` Basile Starynkevitch
2023-08-16 12:37 ` Marcus Harnisch
2023-08-16 13:39   ` Eric S Fraga
2023-08-16 14:20     ` Marcus Harnisch
2023-08-16 14:34       ` Eric S Fraga

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).