简体   繁体   English

背景和顶部栏配置在启动时不适用

[英]Background and top bar configurations does not apply at startup

I am on Manjaro Linux and using dwm.我在 Manjaro Linux 上使用 dwm。 I have made some changes (additions) in my ~/.xinitrc file to have my wallpaper set and display date & time on top bar when I log in. But I cannot have these changes applied or having an issue with my files such as ~/.xinitrc and /etc/X11/xinit/xinitrc .我在~/.xinitrc文件中进行了一些更改(添加),以便在我登录时设置壁纸并在顶部栏上显示日期和时间。但是我无法应用这些更改或我的文件有问题,例如~/.xinitrc/etc/X11/xinit/xinitrc

I already have compton, feh (also nitrogen but do not prefer) and xsetroot installed on my system.我已经在我的系统上安装了 compton、feh(也是氮,但不喜欢)和 xsetroot。 I also applied this patch to my dwm in order to have an autostart.sh file.我也将这个补丁应用到我的 dwm 以便有一个 autostart.sh 文件。

Here is my ~/.dwm/autostart.sh file:这是我的~/.dwm/autostart.sh文件:

#! /bin/bash
compton --config ~/.config/compton/compton.conf &
feh --bg-fill /home/root113/Pictures/0239.jpg &
xcompmgr &

while true; do
     xsetroot -name "$(date)"
     sleep 1s
done &

This did not work.这没有用。 There exist a similar problem here asked 29 days ago but yet not answered or recieved any comments. 29 天前这里有一个类似的问题但尚未回答或收到任何评论。

Then I search the net for more answers and help and realised that I should try to edit my ~/.xinitrc file.然后我在网上搜索更多答案和帮助,并意识到我应该尝试编辑我的~/.xinitrc文件。 Here it is:这里是:

#!/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=gnome-session

# 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

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) ;;
        fluxbox) dbus_args+=(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) ;;
        xfce) dbus_args+=(xfce4-session) ;;
        openbox) dbus_args+=(openbox-session) ;;
        *) dbus_args+=($DEFAULT_SESSION) ;;
    esac

    echo "dbus-launch ${dbus_args[*]}"
}

exec $(get_session)

#Personal customizations below

compton --config ~/.config/compton/compton.conf &
feh -bg-fill /home/root113/Pictures/0239.jpg &
xcompmgr &

while true; do
    xsetroot -name "$(date)"
    sleep 1s
done &

exec dwm

Still, the problem haven't got solved.尽管如此,问题还是没有解决。 Then I changed the line然后我改变了线路

feh -bg-fill /home/root113/Pictures/0239.jpg &

with this:有了这个:

~/.fehbg &

What is written inside ~/.fehbg is: ~/.fehbg里面写的是:

#!/bin/sh
feh --no-fehbg --bg-fill /home/root113/Pictures/0239.jpg

Did not solve my problem.没有解决我的问题。

Then I decided to export my ~/.xinitrc file in /etc/X11/xinit/xinitrc by adding this line at the end of the file:然后我决定通过在文件末尾添加以下行来导出/etc/X11/xinit/xinitrc~/.xinitrc文件:

 export PATH="${PATH}:/home/root113/.xinitrc"

This did not work either.这也不起作用。 So I kept my solution seeking on the net and in one of the forums I was told that I should make my ~/.xinitrc file executable.所以我一直在网上寻找我的解决方案,并且在其中一个论坛中我被告知我应该让我的~/.xinitrc文件可执行。 So I did that with the following command:所以我用以下命令做到了这一点:

 chmod +x ~/.xinitrc

Did not work either.也没有用。 Every time I log back in or reboot, it is the same annoying black screen and top bar with no date being displayed at all that my eyes stares.每次我重新登录或重新启动时,都是同样令人讨厌的黑屏和顶部栏,我的眼睛盯着看,根本没有显示日期。

I also tried replacing ~/file with /home/root113/file in every file in case of the path was not recognised.我还尝试在每个~/file中用/home/root113/file替换~/file以防路径无法识别。 It was not a solution at all.这根本不是一个解决方案。 Did not work.不工作。

I kept searching and searching for answers and read these useful answers and articles:我一直在寻找答案并阅读这些有用的答案和文章:

None of them refers to a kind of problem/issue that I have directly , but indirectly.它们都不是直接而是间接地提到我遇到的一种问题/问题。 So I decided to (probably a stupid idea but worth giving a try since I started to ran out of solutions) add the following to my ~/.profile file:所以我决定(可能是一个愚蠢的想法,但值得一试,因为我开始用完解决方案)将以下内容添加到我的~/.profile文件中:

export PATH="${PATH}:/home/root113/.xinitrc"

Did not work either then I added the following to my ~/.zshrc file:也没有用,然后我将以下内容添加到我的~/.zshrc文件中:

source ~/.profile

Did not work again.没有再工作。

I searched high and low for a solution on the net.我在网上搜索了高低的解决方案。 I am literally in a desperate situation at the moment.我现在真的处于绝望的境地。 I have no hope left but asking here.我已经没有希望了,只能在这里问。 Thank you for reading through here.感谢您阅读这里。 I know it has been a long question but I wanted to explain the problem to you in details and also wanted to tell you what solutions I have tried so far.我知道这是一个很长的问题,但我想向您详细解释这个问题,还想告诉您到目前为止我尝试了哪些解决方案。

I figured out that in ~/.xinitrc file I have to declare my personel settings before all other stuff.我发现在~/.xinitrc文件中我必须在所有其他内容之前声明我的个人设置。 Just placed them on top of the file as:只需将它们放在文件顶部,如下所示:

#!/bin/sh
#
# ~/.xinitrc
#
# Executed by startx (run your window manager 
from here)

#Personal customizations below

compton --config ~/.config/compton/compton.conf &
feh -bg-fill /home/root113/Pictures/0239.jpg &
xcompmgr &

while true; do
    xsetroot -name "$(date)"
    sleep 1s
done &

exec dwm

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

DEFAULT_SESSION=gnome-session

# 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

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) ;;
        fluxbox) dbus_args+=(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) ;;
        xfce) dbus_args+=(xfce4-session) ;;
        openbox) dbus_args+=(openbox-session) ;;
        *) dbus_args+=($DEFAULT_SESSION) ;;
    esac

    echo "dbus-launch ${dbus_args[*]}"
}

exec $(get_session)

Everything is working properly now.现在一切正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM