61 lines
No EOL
1.8 KiB
Markdown
61 lines
No EOL
1.8 KiB
Markdown
# XSession
|
|
|
|
!!! note
|
|
My modified Makefile installs DWM as a session automagically. I think.
|
|
Maybe check out the [Makefile](https://git.jakest.us/suckless/dwm/src/branch/jakefication/Makefile). Steps below should not be necessary.
|
|
|
|
You might want to add DWM as a session to start it conveniently from a display manager.
|
|
|
|
## .desktop file
|
|
|
|
For displaymanagers that parse these.
|
|
As root create a file like this:
|
|
|
|
``` desktop title="/usr/share/xsessions/dwm.desktop"
|
|
[Desktop Entry]
|
|
Encoding=UTF-8
|
|
Name=dwm
|
|
Comment=Dynamic window manager
|
|
Exec=dwm
|
|
Icon=dwm
|
|
Type=XSession
|
|
```
|
|
|
|
with these permissions
|
|
|
|
``` console
|
|
$ ls -l /usr/share/xsessions/dwm.desktop
|
|
-rw-r--r-- 1 root root 108 Jun 27 17:24 /usr/share/xsessions/dwm.desktop
|
|
```
|
|
|
|
## Execute a script
|
|
|
|
Optionally rather than executing dwm directly you could execute a shell script instead that writes stdout / stderr to a file for logging purposes. This also helps to [autostart](autostart.md) apps
|
|
|
|
So the .desktop file should be modified to have
|
|
`Exec=startdwm`
|
|
and you need a file with executable permissions
|
|
|
|
``` sh title="/usr/local/bin/startdwm"
|
|
#!/bin/sh
|
|
echo "$(date): Starting dwn" >> /path/to/logs/$(date +%Y-%m-%d_%H.dwm.log)
|
|
dwm >> /path/to/logs/$(date +%Y-%m-%d_%H.dwm.log) 2>&1
|
|
```
|
|
``` console
|
|
$ ls -l /usr/local/bin/startdwm
|
|
-rwxr-xr-x 1 root root 204 Sep 19 14:12 /usr/local/bin/startdwm
|
|
```
|
|
|
|
## Debian alternatives
|
|
|
|
For some displaymanagers, like XDM.
|
|
|
|
You may add your session with something like:
|
|
``` console
|
|
$ sudo update-alternatives --install /usr/bin/x-session-manager x-session-manager /usr/local/bin/startdwm 50
|
|
$ sudo update-alternatives --config x-session-manager
|
|
```
|
|
|
|
## Credits
|
|
|
|
Thank you u/bakkeby for providing some of this information on Reddit [https://www.reddit.com/r/suckless/comments/jj61py/comment/gaanvez/](https://www.reddit.com/r/suckless/comments/jj61py/comment/gaanvez/) |