LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 11-15-2018, 09:41 AM   #1
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
custom .xinitrc for multi WM/DT : how to


OK I am doing something silly again, sharing /home with slack and manjaro (arch knock off). with manjaro I had to kill, turn off, disable the login manager because it for whatever reason it was not allowing me to login under my user name, as soon as I disabled that (SDDM) and used startx. I can log in.

now comes Slack it too is startx setup, but because of the way it is setup every time one wants to change the wm/dt xwmconfig needs to be used which over writes .xinitrc every time a different wm/dt is to be used. so, manjaor .xinitrc is set up for $1 case statement. here it is, it is NOT working with slack other than using what is set for the DEFAULT_SESSION.

I cannot figure out why, anyone got any ideas?
Code:
#!/bin/sh
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap

#DEFAULT_SESSION=startkde
DEFAULT_SESSION=startfluxbox

# merge in defaults and keymaps

if [ -f $sysresources ]; then
    xrdb -merge $sysresources
fi

if [ -f $sysmodmap ]; then
    xmodmap $sysmodmap
fi

if [ -f "$userresources" ]; then
    xrdb -merge "$userresources"
fi

if [ -f "$usermodmap" ]; then
    xmodmap "$usermodmap"
fi

# start some nice programs

if [ -d /etc/X11/xinit/xinitrc.d ] ; then
    for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
        [ -x "$f" ] && . "$f"
    done
    unset f
fi

#does not even echo this command
echo "1 $1"

get_session(){
	local dbus_args=(--sh-syntax --exit-with-session)
	case $1 in
		awesome) dbus_args+=(awesome) ;;
		bspwm) dbus_args+=(bspwm-session) ;;
		budgie) dbus_args+=(budgie-desktop) ;;
		cinnamon) dbus_args+=(cinnamon-session) ;;
		deepin) dbus_args+=(startdde) ;;
		enlightenment) dbus_args+=(enlightenment_start) ;;
		enlight) dbus_args+=(enlightenment_start) ;;
		fluxbox) dbus_args+=(startfluxbox) ;;
		fbox) dbus_args+=(exec startfluxbox) ;;
		gnome) dbus_args+=(gnome-session) ;;
		i3|i3wm) dbus_args+=(i3 --shmlog-size 0) ;;
		jwm) dbus_args+=(jwm) ;;
		kde) dbus_args+=(startkde) ;;
		lxde) dbus_args+=(startlxde) ;;
		lxqt) dbus_args+=(lxqt-session) ;;
		mate) dbus_args+=(mate-session) ;;
		e16) dbus_args+=(e16) ;;
		bbox) dbus_args+=(startblackbox) ;;
		wmaker) dbus_args+=(wmaker) ;;
		#xfce) dbus_args+=(xfce4-session) ;;
		#xfce) dbus_args+=(xfce4-session) ;;
		openbox) dbus_args+=(openbox-session) ;;
		*) dbus_args+=($DEFAULT_SESSION) ;;
	esac

	echo "dbus-launch ${dbus_args[*]}"
}
#get_session
#exec $(get_session)
$(get_session)

#update W/M menus
## blackbox, fluxbox, windowmaker
bbmenu &
fbmenu &
mwmenu &
the only thing I am seeing worth posting on the cli after startx , is

Code:
xauth:  file /home/userx/.serverauth.5951 does not exist this
when using just 'get_session' echo "1 $1" gave me 'xterm'

back to manjaro to see what I see.

Last edited by BW-userx; 11-15-2018 at 09:53 AM.
 
Old 11-15-2018, 06:15 PM   #2
Loomx
Member
 
Registered: Sep 2012
Distribution: Slackware
Posts: 184

Rep: Reputation: Disabled
Have you got a ~/.xsession file?
This is the one that actually gets executed on the (fairly default) Slackware system I'm replying from.
Try modifying that instead.

======

A couple of notes about your script:

- your final line needs to exec the wm; this means you need to move the lines that start the menus above this.
Then your last line could be:
Code:
exec dbus-launch ${dbus_args[*]}
- why is `getsession' a separate function? I would just remove the first and last lines from the function to inline it, then you don't need to worry about how you call it.
 
1 members found this post helpful.
Old 11-15-2018, 06:49 PM   #3
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Original Poster
Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by Loomx View Post
Have you got a ~/.xsession file?
This is the one that actually gets executed on the (fairly default) Slackware system I'm replying from.
Try modifying that instead.

======

A couple of notes about your script:

- your final line needs to exec the wm; this means you need to move the lines that start the menus above this.
Then your last line could be:
Code:
exec dbus-launch ${dbus_args[*]}
- why is `getsession' a separate function? I would just remove the first and last lines from the function to inline it, then you don't need to worry about how you call it.
it is actually written by whomever from Manjaro, it is added on new user login, and It worked without a hitch a few installs ago when I took manjaro down to startx.

this time I
Code:
systemctl disable sddm
I don't remember if that is what I used the first time, I just remember it ws just as easy to trun off the login manager, anyways, I created a different user on manjaro, then tried the .xinitrc in that user login and it didn't work, I researched what other files .xinitrc uses but came up blank, everything was about .bashrc supporting files.

I'll look into that script to morrow. thanks.

Last edited by BW-userx; 11-15-2018 at 06:51 PM.
 
Old 11-15-2018, 07:23 PM   #4
Loomx
Member
 
Registered: Sep 2012
Distribution: Slackware
Posts: 184

Rep: Reputation: Disabled
Quote:
it is actually written by whomever from Manjaro, it is added on new user login, and It worked without a hitch a few installs ago when I took manjaro down to startx.
Really? Even this bit?
Code:
#get_session
#exec $(get_session)
$(get_session)

#update W/M menus
## blackbox, fluxbox, windowmaker
bbmenu &
fbmenu &

To clarify about ~/.xinitrc and ~/.xsession, running `wmconfig' on Slackware will create *both* of these files for you. However, only the ~/.xsession one will be set as executable.
 
Old 11-15-2018, 07:58 PM   #5
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Original Poster
Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by Loomx View Post
Really? Even this bit?
Code:
#get_session
#exec $(get_session)
$(get_session)

#update W/M menus
## blackbox, fluxbox, windowmaker
bbmenu &
fbmenu &

To clarify about ~/.xinitrc and ~/.xsession, running `wmconfig' on Slackware will create *both* of these files for you. However, only the ~/.xsession one will be set as executable.
nope, but as valid as you may think that is, that new user I created on manjaro just to check the original script, still didn't work.

that bit is trying to do too much at once on little sleep.
 
Old 11-16-2018, 07:38 AM   #6
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,057

Rep: Reputation: Disabled
Quote:
Originally Posted by BW-userx View Post
OK I am doing something silly again, sharing /home with slack and manjaro (arch knock off).
I'd share everything but the hidden files and directories. You could do it this way:
  • Have a separate /home/$USER for each distribution.
  • Make symlinks only when needed. For instance if you want the same config for Firefox and Thunderbird (assuming the versions are compatible) you could symlink ~/.thunderbird from a distribution to the other one (make sure your regular user has the same UID in both, i.e. "id -u" gives the same output), ditto for Firefox with ~/.mozilla.
  • Put all non-hidden files in /home/$USER/data in a distribution, make it a symlink to this directory in the other one.
    Alternatively put these files in /home/data in a distribution, this directory being owned by $USER, and again make it a symlink to that in the other one.

Last edited by Didier Spaier; 11-16-2018 at 07:39 AM.
 
Old 11-16-2018, 08:58 AM   #7
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Original Poster
Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by Didier Spaier View Post
I'd share everything but the hidden files and directories. You could do it this way:
  • Have a separate /home/$USER for each distribution.
  • Make symlinks only when needed. For instance if you want the same config for Firefox and Thunderbird (assuming the versions are compatible) you could symlink ~/.thunderbird from a distribution to the other one (make sure your regular user has the same UID in both, i.e. "id -u" gives the same output), ditto for Firefox with ~/.mozilla.
  • Put all non-hidden files in /home/$USER/data in a distribution, make it a symlink to this directory in the other one.
    Alternatively put these files in /home/data in a distribution, this directory being owned by $USER, and again make it a symlink to that in the other one.
they are back to separate /homes as of this writing.

Yes, I've made sure that both have exactly the same UID and GID, I've done this before, though that was a while ago. I was trying to see if Slack and Manjaro (arch knock off) play nice together in this kind of setup.

for some symlinks the setup is mimic to the same apps. ie Popcorntime, as far as Firefox the versions will probably, maybe different, depending on update cycles for each distro. Manjaro too is a running relese as Slack current might be put into that same category, depending on who you talk to.

thing is I had manjaro using startx and the .xinitrc that is included to that the modified one is posted, I could almost swear I copied the original over to slack and modded it for the Desktop/ window managers I was using in that and used it instead of running xwmconfig all of the time, the calling of some scripts I wrote to customize menus for dt/wm is new.

the thing is now the .xinitrc does not even work on either system. someone suggested a different file be added, xsessions, which I have not had time to test yet, nor can I remember if that is what I may have had to do the last time when it was working, but not having the two share the same /home.
 
Old 11-16-2018, 09:07 AM   #8
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Original Poster
Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by Loomx View Post
Have you got a ~/.xsession file?
This is the one that actually gets executed on the (fairly default) Slackware system I'm replying from.
Try modifying that instead.

======

A couple of notes about your script:

- your final line needs to exec the wm; this means you need to move the lines that start the menus above this.
Then your last line could be:
Code:
exec dbus-launch ${dbus_args[*]}
- why is `getsession' a separate function? I would just remove the first and last lines from the function to inline it, then you don't need to worry about how you call it.
Now that I've looked closer into this, as I've always looked at the .xinitrc slack puts in here,
Code:
#!/bin/sh
# $XConsortium: xinitrc.cpp,v 1.4 91/08/22 11:41:34 rws Exp $

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap

# merge in defaults and keymaps

if [ -f $sysresources ]; then
    xrdb -merge $sysresources
fi

if [ -f $sysmodmap ]; then
    xmodmap $sysmodmap
fi

if [ -f $userresources ]; then
    xrdb -merge $userresources
fi

if [ -f $usermodmap ]; then
    xmodmap $usermodmap
fi

# Start the window manager:
if [ -z "$DESKTOP_SESSION" -a -x /usr/bin/ck-launch-session ]; then
  exec ck-launch-session /usr/bin/startblackbox
else
  exec /usr/bin/startblackbox
fi
I never thought to look at the .xsesson file in here too, which is the same,

Code:
#!/bin/sh
# $XConsortium: xinitrc.cpp,v 1.4 91/08/22 11:41:34 rws Exp $

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap

# merge in defaults and keymaps

if [ -f $sysresources ]; then
    xrdb -merge $sysresources
fi

if [ -f $sysmodmap ]; then
    xmodmap $sysmodmap
fi

if [ -f $userresources ]; then
    xrdb -merge $userresources
fi

if [ -f $usermodmap ]; then
    xmodmap $usermodmap
fi

# Start the window manager:
if [ -z "$DESKTOP_SESSION" -a -x /usr/bin/ck-launch-session ]; then
  exec ck-launch-session /usr/bin/startblackbox
else
  exec /usr/bin/startblackbox
fi
if memory serves me correctly I'd started adding to the .xinitrc then seen how slack just replaces that every time I changed dt, so I stopped doing it that way, and sought out the other ways to start stuff for the dt,wm, this was back when I first started Linux basically.

so I never looked further into the slack uses .xsesson too.
Thanks for pointing that out.

I'll further my experimentation when I get a chance.
 
Old 11-17-2018, 01:37 PM   #9
Loomx
Member
 
Registered: Sep 2012
Distribution: Slackware
Posts: 184

Rep: Reputation: Disabled
Hi again,

After some more reading, it seems that ~/.xsession is only read when X is started by a display manager, e.g. sddm, gdm, xdm.
~/.xinitrc is used when X is started via `startx'

As Slackware lets the user choose how to run things, the `xwmconfig' script simply updates both files.

(Interestingly enough, the ~/.xinitrc file doesn't need to be executable)

So... my input hasn't helped you much here, sorry. I don't know why your ~/.xinitrc doesn't seem to be being used.
 
Old 11-17-2018, 01:42 PM   #10
Loomx
Member
 
Registered: Sep 2012
Distribution: Slackware
Posts: 184

Rep: Reputation: Disabled
Just out of interest, what is the result of this command?
Code:
ls -l /etc/X11/xinit/xinitrc.d/*
 
Old 11-17-2018, 02:09 PM   #11
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Original Poster
Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by Loomx View Post
Just out of interest, what is the result of this command?
Code:
ls -l /etc/X11/xinit/xinitrc.d/*
in which distro? I am in Mint right now. thuogh to add, $1 is the 2 string off the cli and it is comming up empty whenever I echo'ed it in both distros, slack, and manJoieo

this is mint though, cough cough..
Code:
userx@minko:~$ ls -l /etc/X11/xinit/xinitrc.d/*
ls: cannot access '/etc/X11/xinit/xinitrc.d/*': No such file or directory
userx@minko:~$ ls /etc/X11
app-defaults             fonts    Xreset      Xsession.d        Xwrapper.config
blackbox                 rgb.txt  Xreset.d    Xsession.options
cursors                  xinit    Xresources  xsm
default-display-manager  xkb      Xsession    XvMCConfig
I am sightly too busy to jump out of Mint at the present moment, in a 10 mins maybe..

back..
same..
no .d dir
Code:
userx@SlackOLatern:~$ ls -l /etc/X11/xinit/xinitrc.d/*
/bin/ls: cannot access '/etc/X11/xinit/xinitrc.d/*': No such file or directory
userx@SlackOLatern:~$ ls -l /etc/X11/xinit/
total 36
-rw-r--r-- 1 root root  321 Mar 16  2003 README.Xmodmap
lrwxrwxrwx 1 root root   15 Nov 14 08:56 xinitrc -> xinitrc.fluxbox*
-rwxr-xr-x 1 root root  661 Nov  9 13:26 xinitrc.blackbox*
-rwxr-xr-x 1 root root  618 Nov 15 17:47 xinitrc.e16*
-rwxr-xr-x 1 root root  660 Apr 13  2018 xinitrc.fluxbox*
-rwxr-xr-x 1 root root  704 Jun  1 13:06 xinitrc.fvwm2*
-rwxr-xr-x 1 root root  627 Apr 17  2018 xinitrc.kde*
-rwxr-xr-x 1 root root  725 Dec  1  2009 xinitrc.twm*
-rwxr-xr-x 1 root root  958 Apr 13  2018 xinitrc.wmaker*
-rwxr-xr-x 1 root root 1198 Apr 13  2018 xinitrc.xfce*
userx@SlackOLatern:~$

Last edited by BW-userx; 11-17-2018 at 02:21 PM.
 
Old 11-17-2018, 02:17 PM   #12
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Original Poster
Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by Loomx View Post
Hi again,

After some more reading, it seems that ~/.xsession is only read when X is started by a display manager, e.g. sddm, gdm, xdm.
~/.xinitrc is used when X is started via `startx'

As Slackware lets the user choose how to run things, the `xwmconfig' script simply updates both files.

(Interestingly enough, the ~/.xinitrc file doesn't need to be executable)

So... my input hasn't helped you much here, sorry. I don't know why your ~/.xinitrc doesn't seem to be being used.
hummm well I guess I got a take back my helpful on your post; j/k
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] what good is this in the .xinitrc : different GUI on Multi tty's BW-userx Manjaro 1 06-18-2018 09:19 AM
best practice Multihead, multi-screen, multi-display or multi-monitor-Debian 8 lgtrean Linux - Software 1 10-14-2015 09:53 AM
[SOLVED] editing .xinitrc-custom newbiesforever Linux - General 11 11-28-2014 04:08 PM
[SOLVED] what's the difference between a multi-cpu , multi-core and a multi-thread system ? entz Linux - Hardware 11 12-20-2011 04:49 PM
GRUB, Multi Linux/Multi Disk Boot gtnorton Linux - Software 1 03-16-2003 03:48 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration