You are not logged in.

#1 2023-04-08 14:49:30

Morta
Member
Registered: 2019-07-07
Posts: 660

[SOLVED]Add a export command to bemenu entry

Hi!

I'm using sway with Wayland and bemenu

So i want change pycharm entry in bemenu to

export _JAVA_AWT_WM_NONREPARENTING=1 && pycharm

How I can do it?

pycharm.desktop isn't the solution

Last edited by Morta (2023-04-08 22:02:43)

Offline

#2 2023-04-08 15:30:16

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,491
Website

Re: [SOLVED]Add a export command to bemenu entry

You really should just export that variable from your shell profile prior to even launching sway.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2023-04-08 15:32:47

-MacNuke-
Member
Registered: 2013-01-29
Posts: 26

Re: [SOLVED]Add a export command to bemenu entry

The "systemd way" would be to set it in ~/.config/environment.d/myenv.conf (or any other filename).

Offline

#4 2023-04-08 15:41:55

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,491
Website

Re: [SOLVED]Add a export command to bemenu entry

That "systemd way" is rather silly as then you'd need to use yet another systemd command to import that environment ... e.g., into your shell profile.  Skip the middle man - especially when the middle man is excessively complicated for no reason at all.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#5 2023-04-08 15:49:40

Morta
Member
Registered: 2019-07-07
Posts: 660

Re: [SOLVED]Add a export command to bemenu entry

I did in .bashrc and ~/.profile but when I'm lunching over bemenu it's doesn't work with config in sway and mod+p as shortcut it's works like a charm

Offline

#6 2023-04-08 15:51:57

-MacNuke-
Member
Registered: 2013-01-29
Posts: 26

Re: [SOLVED]Add a export command to bemenu entry

Trilby wrote:

That "systemd way" is rather silly as then you'd need to use yet another systemd command to import that environment ... e.g., into your shell profile.  Skip the middle man - especially when the middle man is excessively complicated for no reason at all.

I honestly do not know what you mean. For me it is set without running any command.

Last edited by -MacNuke- (2023-04-08 15:52:27)

Offline

#7 2023-04-08 16:00:58

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,491
Website

Re: [SOLVED]Add a export command to bemenu entry

It's set for systemd user services and anything launched from them.  But if you start a compositor from a tty, it will not be set unless you have specifically done something to import that environment.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#8 2023-04-08 19:57:14

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,063

Re: [SOLVED]Add a export command to bemenu entry

Morta wrote:

I did in .bashrc and ~/.profile but when I'm lunching over bemenu it's doesn't work with config in sway and mod+p as shortcut it's works like a charm

Post those files and explain how you start sway.

Offline

#9 2023-04-08 20:27:32

Morta
Member
Registered: 2019-07-07
Posts: 660

Re: [SOLVED]Add a export command to bemenu entry

I start sway with GDM or SDDM.

[morta@lapt0p ~]$ cat /home/morta/.bashrc
#
# ~/.bashrc
#

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ '

if [ "$XDG_SESSION_DESKTOP" = "sway" ] ; then
    # https://github.com/swaywm/sway/issues/595
    export _JAVA_AWT_WM_NONREPARENTING=1
fi
[morta@lapt0p ~]$ cat  ~/.profile
if [ "$XDG_SESSION_DESKTOP" = "sway" ] ; then
    # https://github.com/swaywm/sway/issues/595
    export _JAVA_AWT_WM_NONREPARENTING=1
fi

Offline

#10 2023-04-08 20:33:52

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,491
Website

Re: [SOLVED]Add a export command to bemenu entry

Trilby wrote:

... from your shell profile prior to even launching sway.

Morta wrote:
if [ "$XDG_SESSION_DESKTOP" = "sway" ]...

Do you see the problem here?  The code in that conditional block will almost never execute (you'd have to take special steps to start a terminal emulator to start a login shell).

But if you are using display manager(s) this may not actually be relevant.  You'd need to set it somewhere the display manager would pick it up ... I can't help with display managers.

Last edited by Trilby (2023-04-08 20:35:07)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#11 2023-04-08 20:36:54

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,063

Re: [SOLVED]Add a export command to bemenu entry

~/.profile might be sourced, but I'd be way less confident about $XDG_SESSION_DESKTOP being set ahead of the session (and when this is sourced)
You'd probably want to edit /usr/share/wayland-sessions/sway.desktop

Offline

#12 2023-04-08 21:02:36

Morta
Member
Registered: 2019-07-07
Posts: 660

Re: [SOLVED]Add a export command to bemenu entry

doesn't work

[morta@lapt0p ~]$ cat /usr/share/wayland-sessions/sway.desktop 
[Desktop Entry]
Name=Sway
Comment=An i3-compatible Wayland compositor
Exec=sway && export _JAVA_AWT_WM_NONREPARENTING=1
Type=Application

neither

[morta@lapt0p ~]$ cat /usr/share/wayland-sessions/sway.desktop 
[Desktop Entry]
Name=Sway
Comment=An i3-compatible Wayland compositor
Exec=export _JAVA_AWT_WM_NONREPARENTING=1 && sway
Type=Application

I can't login anymore on sway

Last edited by Morta (2023-04-08 21:07:53)

Offline

#13 2023-04-08 21:08:06

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,063

Re: [SOLVED]Add a export command to bemenu entry

Because that's not legal desktop service syntax.

man env

Offline

#14 2023-04-08 21:30:04

Morta
Member
Registered: 2019-07-07
Posts: 660

Re: [SOLVED]Add a export command to bemenu entry

[morta@lapt0p ~]$ cat /usr/share/wayland-sessions/sway.desktop 
[Desktop Entry]
Name=Sway
Comment=An i3-compatible Wayland compositor
Exec=env -i sway -u _JAVA_AWT_WM_NONREPARENTING=1
Type=Application

Dosen’t work

Offline

#15 2023-04-08 21:32:33

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,063

Re: [SOLVED]Add a export command to bemenu entry

Exec=env -i sway -u _JAVA_AWT_WM_NONREPARENTING=1

How did you cook up that nonsense?
There's a asynopsis in the manpage and you can frankly also just google how to use "env"…

Offline

#16 2023-04-08 21:40:54

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,491
Website

Re: [SOLVED]Add a export command to bemenu entry


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#17 2023-04-08 21:40:57

Morta
Member
Registered: 2019-07-07
Posts: 660

Re: [SOLVED]Add a export command to bemenu entry

I have googled. Cloud you help me?

Offline

#18 2023-04-08 21:56:28

Morta
Member
Registered: 2019-07-07
Posts: 660

Re: [SOLVED]Add a export command to bemenu entry

I got it

Offline

#19 2023-04-08 21:57:18

Morta
Member
Registered: 2019-07-07
Posts: 660

Re: [SOLVED]Add a export command to bemenu entry

Exec=env JAVA_AWT_WM_NONREPARENTING=1 sway

did the job

Last edited by Morta (2023-04-08 21:57:47)

Offline

#20 2023-04-08 21:59:26

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,063

Re: [SOLVED]Add a export command to bemenu entry

Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Offline

Board footer

Powered by FluxBB