Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
How to configure apps to autostart in a minimal WM?
How to configure apps to autostart in a minimal WM?
I've been playing around with Lwm, WindowLab, and Jwm (window managers), and I'm trying to get x programs to auto-start when the window manager loads up (i.e., xterm, xclock...). This was an easy task with LightDM, but I am not using a login manager; I am just logging straight in with a systemd command and exec <wm> in .xinitrc.
If there is a way that I could run a script upon the launch of those window managers, that would be great.
Any ideas?
If there is a way that I could run a script upon the launch of those window managers, that would be great.
Any ideas?
Re: How to configure apps to autostart in a minimal WM?
There are a lot of ways to configure the system. My favorite on debian is to use the debian alternatives system to set the x-window-manager shortcut. If you use a default method like xsession instead of .xinitrc then you can use several different window managers and switch between them easily, but keep the same startup commands no matter which you want to run.
This way, you just update the alternative, and run startx. Same apps start on all wm you use.
https://wiki.debian.org/xinit
https://wiki.debian.org/WindowManager
https://wiki.debian.org/Xsession
This way, you just update the alternative, and run startx. Same apps start on all wm you use.
https://wiki.debian.org/xinit
https://wiki.debian.org/WindowManager
https://wiki.debian.org/Xsession
resigned by AI ChatGPT
Re: How to configure apps to autostart in a minimal WM?
i have this in my ~/.xinitrc:
because some programs need to start after the window manager.
Code: Select all
exec somewindowmanager
wm_pid=$!
{
. $HOME/.config/autostart.sh
} &
wait $wm_pid
Re: How to configure apps to autostart in a minimal WM?
exec works that way for you? on my system it forks and exits the current script.debiman wrote:i have this in my ~/.xinitrc:because some programs need to start after the window manager.Code: Select all
exec somewindowmanager wm_pid=$! { . $HOME/.config/autostart.sh } & wait $wm_pid
hmmm now that i think about it, exec exits the entire shell. I use it in .profile sometimes to run a command and log out after.
resigned by AI ChatGPT
Re: How to configure apps to autostart in a minimal WM?
it does.bw123 wrote:exec works that way for you?
and since i found that technique on the internet, it seems to work for others, too.
my .xinitrc uses '#!/bin/dash' - i will try with bash and sh and see if something changes.
i have noticed earlier that exec works differently for dash.
maybe the 'wait' command is special in that way.
Re: How to configure apps to autostart in a minimal WM?
exec doesn't fork so once you exec your wm the script and the underlying (dash) shell ceases to exist.debiman wrote:it does.bw123 wrote:exec works that way for you?
and since i found that technique on the internet, it seems to work for others, too.
my .xinitrc uses '#!/bin/dash' - i will try with bash and sh and see if something changes.
i have noticed earlier that exec works differently for dash.
maybe the 'wait' command is special in that way.
I don't use dash but just tried:
Code: Select all
bash $ dash
dash $ exec echo hey
hey
bash $ _
Probably the special case with the autostart is working because the window manager is actually the one executing autostart, not the snippet on .xinitrc.
Remove that from .xinitrc and you will not notice any difference.
Re: How to configure apps to autostart in a minimal WM?
sorry, but that isn't true. openbox does not look at that file, and neither do other wms.reinob wrote:Probably the special case with the autostart is working because the window manager is actually the one executing autostart, not the snippet on .xinitrc.
Remove that from .xinitrc and you will not notice any difference.
i introduced that technique quite a while ago when i was trying out dozens of windowmanagers.
i'm not claiming to understand why, but it works.
and:
debiman wrote:i found that technique on the internet, it seems to work for others, too.
Re: How to configure apps to autostart in a minimal WM?
i tested with other wm's and shells, the behaviour is consistent.
the magic bit is the ampersand '&' at the end of the exec line. without it, it does not work.
the magic bit is the ampersand '&' at the end of the exec line. without it, it does not work.
Re: How to configure apps to autostart in a minimal WM?
There are all kinds of ways to do things. I don't understand why anyone would use .xinitrc instead of the debian xsession or need #!/bin/dash in scripts.debiman wrote: my .xinitrc uses '#!/bin/dash' - i will try with bash and sh and see if something changes.
i have noticed earlier that exec works differently for dash.
maybe the 'wait' command is special in that way.
The defaults on debian have always worked fine for me.
Code: Select all
$ which sh
/bin/sh
$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Jan 24 2017 /bin/sh -> dash
https://wiki.debian.org/xinit > https://wiki.debian.org/Xinitrc
Note that ~/.xinitrc is only for configuring the initialization of xinit. If you want the script to be called when ever an X Session is started, then you should instead use ~/.xsession. Most WindowManagers also have a method of starting programs when they first startup.
resigned by AI ChatGPT
Re: How to configure apps to autostart in a minimal WM?
I'm only using one WM at the moment, but this does sound like a good alternative for later if I choose to add another. Thank you for the links. They were helpful!bw123 wrote:There are a lot of ways to configure the system. My favorite on debian is to use the debian alternatives system to set the x-window-manager shortcut. If you use a default method like xsession instead of .xinitrc then you can use several different window managers and switch between them easily, but keep the same startup commands no matter which you want to run.
This way, you just update the alternative, and run startx. Same apps start on all wm you use.
https://wiki.debian.org/xinit
https://wiki.debian.org/WindowManager
https://wiki.debian.org/Xsession
I linked .xsession to .xinitrc; is this this right thing to do?bw123 wrote:debiman wrote: https://wiki.debian.org/xinit > https://wiki.debian.org/Xinitrc
Note that ~/.xinitrc is only for configuring the initialization of xinit. If you want the script to be called when ever an X Session is started, then you should instead use ~/.xsession. Most WindowManagers also have a method of starting programs when they first startup.
Re: How to configure apps to autostart in a minimal WM?
I don't think I'd say there was a "right" or wrong way, if it works for you, then use it. I think the "debian way" to do it would be remove the .xinitrc and use only .xsession if you really need to, and hang on exec x-window-manager as the last line.bedtime wrote: I linked .xsession to .xinitrc; is this this right thing to do?
Another way would be to copy some of the script from /etc/X11/Xsession.d/50x11-common_determine-startup
into your .xsession and try all the x-* alternatives and then exec $STARTUP
I think this is a really nice way of doing things! I really like this script a lot, it shows an effort to be flexible that other solutions don't.
Code: Select all
# If there is still nothing to use for a startup program, try the system
# default session manager, window manager, and terminal emulator.
if [ -z "$STARTUP" ]; then
if [ -x /usr/bin/x-session-manager ]; then
STARTUP=x-session-manager
elif [ -x /usr/bin/x-window-manager ]; then
STARTUP=x-window-manager
elif [ -x /usr/bin/x-terminal-emulator ]; then
STARTUP=x-terminal-emulator
fi
fi
Last edited by bw123 on 2018-01-28 18:22, edited 2 times in total.
resigned by AI ChatGPT
- oswaldkelso
- df -h | grep > 20TiB
- Posts: 1490
- Joined: 2005-07-26 23:20
- Location: UK
- Has thanked: 1 time
- Been thanked: 58 times
Re: How to configure apps to autostart in a minimal WM?
That wiki post is a wee bit lacking in the full story.
xsession is used if you start via a display manager like wdm, slim, GDM etc and I believe overrides xinit. Should you chose not to run a dispay manager xint works fine.
xinit is called by startx. But you can have several xinitrc files depending on your setup.
On my main Dragora system they are 15 files including a default, stored in /etc/X11/xinit/
If I want to start a different window manager. I run wmconfig after login and select say windowlab.
This points back to /etc/X11/xinit/xintirc.windowlab and when I run startx I'm running windowlab and what ever else is listed to start by that file.
No need to keep editing your single .xinitrc file when you swap WM
wmconfig doesn't seem to be available in Debian but you can get the source here https://www.arrishq.net/
xsession is used if you start via a display manager like wdm, slim, GDM etc and I believe overrides xinit. Should you chose not to run a dispay manager xint works fine.
xinit is called by startx. But you can have several xinitrc files depending on your setup.
On my main Dragora system they are 15 files including a default, stored in /etc/X11/xinit/
If I want to start a different window manager. I run wmconfig after login and select say windowlab.
This points back to /etc/X11/xinit/xintirc.windowlab and when I run startx I'm running windowlab and what ever else is listed to start by that file.
No need to keep editing your single .xinitrc file when you swap WM
wmconfig doesn't seem to be available in Debian but you can get the source here https://www.arrishq.net/
Free Software Matters
Ash init durbatulûk, ash init gimbatul,
Ash init thrakatulûk agh burzum-ishi krimpatul.
My oldest used PC: 1999 imac 333Mhz 256MB PPC abandoned by Debian
Ash init durbatulûk, ash init gimbatul,
Ash init thrakatulûk agh burzum-ishi krimpatul.
My oldest used PC: 1999 imac 333Mhz 256MB PPC abandoned by Debian
Re: How to configure apps to autostart in a minimal WM?
People who actually run debian can look in /etc/X11/xinit/xinitrc and the other files around /etc/X11 to find out how it works. There are a lot of people on here that ran debian but moved on. Some others use it heavily modified.
For answering new users who have complicated questions, I appreciate it when the "debian default" way of doing things is at least mentioned.
For answering new users who have complicated questions, I appreciate it when the "debian default" way of doing things is at least mentioned.
resigned by AI ChatGPT
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 132 times
Re: How to configure apps to autostart in a minimal WM?
As bw123 notes, the use of ~/.xinitrc is actually discouraged in Debian systems, see startx(1) for the details.oswaldkelso wrote:.xinitrc file
We have a detailed breakdown of the whole `startx` process over at forums.bunsenlabs.org:bw123 wrote:People who actually run debian can look in /etc/X11/xinit/xinitrc and the other files around /etc/X11 to find out how it works.
https://forums.bunsenlabs.org/viewtopic.php?id=3774
For the curious
deadbang
- None1975
- df -h | participant
- Posts: 1389
- Joined: 2015-11-29 18:23
- Location: Russia, Kaliningrad
- Has thanked: 45 times
- Been thanked: 66 times
Re: How to configure apps to autostart in a minimal WM?
Here mine .xsessionrc
Code: Select all
#!/bin/bash
# Load resources
xrdb -merge .Xresources
export GTK_OVERLAY_SCROLLING=0
# Fire up apps
xautolock -time 10 -locker 'slock' &
setxkbmap -layout "us,lt,ru" -option "grp:alt_shift_toggle" &
nitrogen --restore &
compton -b &
if [ -x /usr/bin/nm-applet ] ; then
nm-applet --sm-disable &
fi
exec herbstluftwm --locked
OS: Debian 12.4 Bookworm / DE: Enlightenment
Debian Wiki | DontBreakDebian, My config files on github
Debian Wiki | DontBreakDebian, My config files on github
Re: How to configure apps to autostart in a minimal WM?
I can't attest to understanding all of what this article said, but what I did understand, was useful.
Thank you guys for posting your configs.
* EDIT *
Might as well post mine since I finally got it working:
~.xsession:
Code: Select all
# Statusbar loop
while true; do
xsetroot -name \
"$(date +"%a, %b %d, %H.%M.%S") \
Vol: $(amixer get Master | awk '$0~/%/{print $4}' | tr -d '[]') \
Mem: $(free -m | grep Mem | awk '{print $3"mb"}') \
CPU: $[100 - $(vmstat 1 2 | tail -1 | awk '{print $15}')]%"
#vmstat is set to wait 1 second to take its cpu reading
done &
#Rearrange moniters so they make sense
xrandr --output LVDS-1 --auto --output VGA-1 --auto --left-of LVDS-1
#Allow to copy in st term
xclip -in &
#Check email
st -g 54x10 -e ./email_check.sh &
#A script to start dwm (can be seen below)
exec startdwm
Wed, Jan 31, 12.48.11 Vol: 70% Mem: 100mb CPU: 0%
~/bin/startdwm:
Code: Select all
#!/bin/bash
# dwm can now be restarted without destroying other X windows by pressing the usual Mod-Shift-Q com$
# It is a good idea to place the above startup script into a separate file, ~/bin/startdwm for inst$
while true;
do
# Log stderror to a file
#dwm 2> ~/.dwm.log
# No error logging
dwm >/dev/null 2>&1
done