View previous topic :: View next topic |
Author |
Message |
something-something-horri n00b
Joined: 23 Jun 2018 Posts: 28 Location: earth
|
Posted: Tue Jul 10, 2018 12:37 am Post subject: sway socket not detected openrc [solved] |
|
|
I've gotten sway to start after I've logged in but I couldn't get it to start in the .bash_profile
the error message
Code: |
sway socket not detected
<date> - [ipc-client.c:37] Unable to connect to
|
This still shows up but it successfully starts sway if I manually typed it from the bash tty prompt
my bash_profile code snippet
Code: |
if [[ -z DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then
XKB_DEFAULT_LAYOUT=US exec sway
fi
|
adding this code snippet did not work as there is no /run/user/*/sway-ipc.*.sock (folder user does not exist)
Code: |
export SWAYSOCK=$(ls /run/user/*/sway-ipc.*.sock | head -n 1)
|
swaymsg -t get_outputs shows the same output. Is there a openrc specific way of solving this.
I've also am getting a hard time configuring the keymap for way too, I know that it only uses xkb and I don't want to bring in gnome to tweak it. I'm just trying to get the caps lock key mapped to escape.
Last edited by something-something-horri on Tue Jul 10, 2018 6:34 pm; edited 1 time in total |
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21607
|
Posted: Tue Jul 10, 2018 1:29 am Post subject: Re: sway socket not detected openrc |
|
|
something-something-horri wrote: | Code: | if [[ -z DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then |
| I hope this is a transcription error. You test a literal string DISPLAY for whether it is empty. You probably meant to test the expansion of the variable $DISPLAY.
something-something-horri wrote: |
Code: | export SWAYSOCK=$(ls /run/user/*/sway-ipc.*.sock | head -n 1) |
| Never use ls to provide input to programs. There is always a better way. In some cases, /run/user might not be readable, in which case the glob will fail. Try instead find /run/user/$UID/ -name 'sway-ipc.*.sock' -print -quit. |
|
Back to top |
|
|
something-something-horri n00b
Joined: 23 Jun 2018 Posts: 28 Location: earth
|
Posted: Tue Jul 10, 2018 10:12 am Post subject: Re: sway socket not detected openrc |
|
|
Hu wrote: | something-something-horri wrote: | Code: | if [[ -z DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then |
| I hope this is a transcription error. You test a literal string DISPLAY for whether it is empty. You probably meant to test the expansion of the variable $DISPLAY.
something-something-horri wrote: |
Code: | export SWAYSOCK=$(ls /run/user/*/sway-ipc.*.sock | head -n 1) |
| Never use ls to provide input to programs. There is always a better way. In some cases, /run/user might not be readable, in which case the glob will fail. Try instead find /run/user/$UID/ -name 'sway-ipc.*.sock' -print -quit. |
I had a brain fart. It was actually a string. That was the problem, thanks for the help. As for the second problem it's not a problem that /run/user isn't readable it's just that /run/user folder doesn't exist. Thanks for the recommendation, I'll avoid using ls to provide input to programs. So is one of the alternatives I could use is find?
For the XKB problem it doesn't seem that putting a file in /usr/share/X11/xkb/rules/90-custom-kbd.conf with
Code: |
Section "InputClass"
Identifier "keyboard defaults"
MatchIsKeyboard "on"
Option "XKbOptions" "caps:escape"
End Section
|
Does not seem to do anything. I'll try the xkbcomp method in a bit.
Okay about that I've found a forum post that said
Nicolas Scotto Di Perto wrote: |
In the current release, sway only loads XKB layouts from environment variables at execution time (XKB_DEFAULT_LAYOUT, XKB_DEFAULT_VARIANT, XKB_DEFAULT_OPTIONS). Wayland does not provide a server like X, so each Wayland compositor has to implement its own method for setting or changing layouts -- generic tools like setxkbmap are out unless/until a protocol is defined/adopted that will allow the tool to talk to any compositor.
Eventually, sway will add the ability to change layouts during runtime. This pull request adds swaymsg input subcommands to set XKB options at runtime; it's presently in the development branch (wlroots). If it is released as in that PR, you'd be able to issue commands like these to change the keyboard:
Code: |
swaymsg input 0:0:X11_keyboard xkb_layout de
|
|
So I guess I'll just use XKB_DEFAULT_OPTIONS then. (this worked for me) |
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21607
|
Posted: Wed Jul 11, 2018 2:28 am Post subject: |
|
|
Yes, find is often a good choice if your first thought for interactive use would be ls with globs.
For your logic error, you could debug it yourself by adding set -x above the suspect code and set +x below it. Shell statements within that region would then be printed by the shell as it goes, allowing you to see things like the use of the literal when you meant a variable: Code: | $ set -x; [[ -z DISPLAY ]]; [[ -z $DISPLAY ]]; set +x
+ [[ -z DISPLAY ]]
+ [[ -z :0 ]]
+ set +x | Be cautious about leaving set -x enabled. If a complex shell function runs with it active, you may get pages of output. Some users have fairly elaborate prompt commands (e.g. to include VCS status information), so just running set -x<newline>set +x more than fills my screen when the shell traces the prompt command trying to decide what to say about VCS state. |
|
Back to top |
|
|
|