Commands in .profile seem to be ignored

Forum Forums New users New Users and General Questions Commands in .profile seem to be ignored

This topic contains 9 replies, has 5 voices, and was last updated by skidoo Jan 6-10:58 am.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #15029
    Member
    mowest
    mowest

    Perhaps this is by design, but maybe I’ve encountered a bug.

    I’m a vim user and so I like to swap the function of my Caps_Lock and Esc keys. This is easy to do with the command “setxkbmap -option caps:swapescape”. This command works as expected when I run it in the terminal, but I would like to to do this automatically when I start Antix 17.3.1 from Persistence All on a Live USB.

    I have “setxkbmap -option caps:swapescape” command in my ~/.profile. In Ubuntu based distros this command get run when I log into a session once because it is in the .profile. This does not seem to happen when I log into Antix. I know that Persistence All is working because all of my additional apps are installed, and my .vimrc file is kept and works as expected as well. So I know that Persistence root and home are functioning as expected.

    Any thoughts on why this isn’t working to have the command in ~/.profile?
    Is there a better way I could run this command that would work in Antix 17.3.1?

    Thanks for your help.

    #15031
    Member

    skidoo

    Bash-Startup-Files.html

    Possibly you added that line near the top of ~/.profile, earlier than the PATH declaration line. If so, full path may be necessary
    /full/path/to/setxkbmap -option caps:swapescape

    #15033
    Member
    caprea
    caprea

    You could also try to write the above command in the startup-file in the hidden desktop-session folder in home.Maybe with the full path, like skidoo mentioned.

    #15074
    Member
    mowest
    mowest

    I put the command at the end of ~/.profile, however, that was a good suggestion skidoo, so I tried it, but it still doesn’t work. At the end of ~/.profile I put:
    /usr/bin/setxkbmap -option caps:swapescape

    It still fails to execute the command and make the change. After adding the full path as above, I tried restarting the session, and even rebooting hoping that it would be triggered, but nothing.

    Caprea, I’m a little unsure of what you are suggesting so I didn’t give that a try. Are you suggesting that I write a bash script called “swap.sh” with just that command in the script file and put it into my ~/bin folder and then put “~/bin/swap.sh” into my ~/.profile file? I could try that if that is what you mean.

    • This reply was modified 1 week, 3 days ago by mowest.
    #15079
    Member
    caprea
    caprea

    Are you suggesting that I write a bash script called “swap.sh”……

    No, my thoughts were much less complicated
    Open control-centre, go to session
    then open “desktop session of user”
    this will open geany and the startup-file
    There you can write in the
    /usr/bin/setxkbmap -option caps:swapescape &
    command
    Close and save, logout/in or reboot.

    #15082
    Member

    skidoo

    results of a quick websearch “session setxkbmap” indicate adding that line into ~/.xinitrc should be effective

    #15099
    Moderator
    masinick
    masinick

    results of a quick websearch “session setxkbmap” indicate adding that line into ~/.xinitrc should be effective

    That makes good sense since it is a keyboard mapping that activates with the X server, therefore initialize it in the X init file, a.k.a. .xinitrc.

    Brian Masinick

    #15118
    Forum Admin
    Dave
    Dave

    I don’t think .xinitrc is used and as such caprea’s suggestion would be the correct replacement file.

    I am thinking that perhaps bash is not being loaded when a terminal is opened… this would be visible by the user prompt not being colourful and showing the path. You can verify if this is the case by typing “bash” as the first command in terminal and see if it makes a difference. If it does then /bin/bash likely needs to be specified in /etc/passwd as the user shell.

    Computers are like air conditioners. They work fine until you start opening Windows. ~Author Unknown

    #15122
    Moderator
    masinick
    masinick

    I don’t think .xinitrc is used and as such caprea’s suggestion would be the correct replacement file.

    I am thinking that perhaps bash is not being loaded when a terminal is opened… this would be visible by the user prompt not being colourful and showing the path. You can verify if this is the case by typing “bash” as the first command in terminal and see if it makes a difference. If it does then /bin/bash likely needs to be specified in /etc/passwd as the user shell.

    If that is the case, you may also be able to add commands to .bashrc

    If so make sure they run only in the interactive invocation of the Bash resource file .bashrc.

    Otherwise non-interactive scripts could be adversely impacted.

    Brian Masinick

    #15123
    Member

    skidoo

    ~/.desktop-session/startup
    insert the line
    /usr/bin/setxkbmap -option caps:swapescape &

    Save the edited file and logout. When you login, test whether setxkbmap is now autostarted.

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.