[StumpWM, Emacs, Bin] Move randr calls to xinitrc files

Due to a recent bug, StumpWM crashes if the screen layout is
reorganized in its configuration file (maybe not just then, I’ll have
to check).

Thus, this commit removes calls to xrandr and autorandr from my WM
configurations and moves them to their respective xinitrc file. It
also removes the `set-screens` script in my scripts collection as it
became obsolete the moment I began using `autorandr` instead.

It also removes the call to `xsetroot` in my StumpWM config since it
is redundant with its xinitrc file.
This commit is contained in:
Lucien Cartier-Tilet 2022-08-07 11:11:24 +02:00
parent 1e1e40160e
commit bf121fec10
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA
3 changed files with 10 additions and 46 deletions

View File

@ -34,7 +34,6 @@ of said command running.
| ~mpc~ | ~stop~ | no |
| ~xrdb~ | ~-merge "$XDG_CONFIG_HOME"/X11/Xresources~ | no |
| ~picom~ | ~--experimental-backends~ | yes |
| ~set-screens~ | | no |
| ~numlockx~ | ~on~ | yes |
| ~pumopm~ | | yes |
| ~xfce-polkit~ | | yes |
@ -74,7 +73,7 @@ of said command running.
"\n")
#+END_SRC
#+RESULTS[62975f44e46334798ca0fd7d51ea8f83802fe745]: autostart-gen
#+RESULTS[aa17455bbc7ba3f6fcf543c0ebf6eb85342bb77d]: autostart-gen
#+begin_src bash :exports code
which pactl && pactl load-module module-switch-on-connect &
which mpc && mpc stop &
@ -85,7 +84,6 @@ else
picom --experimental-backends &
disown
fi
which set-screens && set-screens &
which numlockx && if pgrep -x numlockx ; then
echo numlockx already running
else
@ -142,39 +140,6 @@ if [[ -n $SOUNDCARD ]]; then
fi
#+END_SRC
* Screen utilities
:PROPERTIES:
:CUSTOM_ID: Screen-utilities-f237c566
:END:
** set-screens
:PROPERTIES:
:HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/set-screens
:CUSTOM_ID: set-screens-01bd989a
:END:
~set-screens~ is a small script that allows the user to automatically set up an
external monitor. First, lets set some variables so we dont have to type in
hidden places some values that should be easily modifiable.
#+BEGIN_SRC fish
set internal "eDP1"
set external "HDMI1"
#+END_SRC
Now, lets set the ~DETECTEDSCREEN~ variable with a simple ~grep~. If the
variable turns out to be empty, this means the display was not detected.
However, if its not, then it will be an array with its second value that holds
the maximum resolution the display can handle. It needs to be passed through
~awk~ in order to get only the resolution itself and not the refresh rate, but
once weve got that, we can set our external monitor as the main monitor with
its maximum resolution. i3 is also restarted in order to properly display the
wallpaper and Polybar on the new screen.
#+BEGIN_SRC fish
set externaldisplay (xrandr -q --current | grep -A 1 -i "$external connected")
if test -n "$externaldisplay"
set resolution (echo $externaldisplay[2] | awk '{$1=$1;print $1}')
xrandr --output "$external" --primary --auto --mode "$resolution" --left-of "$internal"
end
#+END_SRC
* cli utilities
:PROPERTIES:
:CUSTOM_ID: cli-utilities-ec2120b0

View File

@ -3702,16 +3702,14 @@ easily.
In order to launch Emacs with EXWM with ~startx~, I need a ~xinit~ file.
This one is exported to ~$HOME/.xinitrc.emacs~.
#+begin_src sh :tangle ~/.xinitrc.emacs
#!/bin/sh
#+begin_src sh :tangle ~/.xinitrc.emacs :shebang "#!/bin/sh"
xhost +SI:localuser:$USER
# Set fallback cursor
xsetroot -cursor_name left_ptr
# If Emacs is started in server mode, `emacsclient` is a convenient way to edit
# files in place (used by e.g. `git commit`)
# If Emacs is started in server mode, `emacsclient` is a convenient
# way to edit files in place (used by e.g. `git commit`)
export VISUAL=emacsclient
export EDITOR="$VISUAL"
@ -3719,6 +3717,8 @@ export EDITOR="$VISUAL"
# wmname LG3D
# export _JAVA_AWT_WM_NONREPARENTING=1
autorandr -l home
exec emacs --with-exwm
#+end_src

View File

@ -90,9 +90,7 @@ follows this architecture:
You will also find below my ~xinit~ file for StumpWM, exported to
~$HOME/.xinitrc.stumpwm~, which I use to start Stump through ~startx
~/.xinitrc.stumpwm~.
#+begin_src sh :tangle ~/.xinitrc.stumpwm
#!/bin/sh
#+begin_src sh :tangle ~/.xinitrc.stumpwm :shebang "#!/bin/sh"
# this makes it work in Ubuntu
xhost +SI:localuser:$USER
@ -106,6 +104,8 @@ export GDK_CORE_DEVICE_EVENTS=1
# wmname LG3D
# export _JAVA_AWT_WM_NONREPARENTING=1
autorandr -l home
exec stumpwm
#+end_src
@ -152,8 +152,7 @@ The first thing I want to do after that is to set some decent cursor
pointer as well as get a bunch of stuff started. To see whats in the
~autostart~ script, [[file:bin.org::#Autostart-a99e99e7][see here]].
#+begin_src lisp
(run-shell-command "xsetroot -cursor_name left_ptr")
(run-shell-command "sleep 1 && autorandr -l home; autostart")
(run-shell-command "autostart")
#+end_src
Next I need to register the AltGr key so it works correctly when used.