x11: add `monitors.sh` script

This commit is contained in:
Hoang Nguyen 2021-03-11 14:22:29 +03:00
parent c40bc875bf
commit a784801bad
No known key found for this signature in database
GPG Key ID: 813CF484F4993419
5 changed files with 23 additions and 7 deletions

View File

@ -9,7 +9,7 @@ $HOME/.config/polybar/run_polybar.sh &
ibus-daemon -drx &
greenclip daemon &
# emacs --daemon &
# xrandr --output eDP-1 --primary --auto --output DP-2 --left-of eDP-1 --auto --output HDMI-2 --right-of eDP-1 --auto &
# $HOME/.local/bin/X11/monitors.sh
# animatedwall --full ~/Pictures/Animated/fubuki.mp4 &
feh --no-fehbg --bg-fill --randomize ~/Pictures/Wallpapers/* &
mpDris2 &

View File

@ -109,7 +109,7 @@
(map! :map minibuffer-local-map
"C-r" 'counsel-minibuffer-history)
(use-package! all-the-icons-ivy-rich
:after counsel-projectile
:defer-incrementally counsel-projectile
:init (all-the-icons-ivy-rich-mode 1)
:config
(setq all-the-icons-ivy-rich-icon-size 1.0))

View File

@ -36,12 +36,10 @@
(exwm-layout-hide-mode-line))))
(defun follie/update-displays ()
(lambda ()
(start-process-shell-command
"xrandr" nil "xrandr --output eDP-1 --mode 1920x1080 --pos 0x0 --rotate normal --output HDMI-1 --mode 1920x1080 --pos 1920x0 --rotate normal"))
(follie/run-in-background "~/.local/bin/X11/monitors.sh")
(follie/set-wallpaper)
(message "Updated displays: %s"
(string-trim (shell-command-to-string "xrandr | grep \" connected\" | awk '{print $1}' | sed '$!N;s/\\n/ /'"))))
(string-trim (shell-command-to-string "xrandr | grep \" connected\" | awk '{print $1}' | sed 's/^/ /' | tr -d '\\n'"))))
(defun follie/exwm-rename-buffer ()
(exwm-workspace-rename-buffer

View File

@ -5,7 +5,7 @@ dunst &
ibus-daemon -drx &
greenclip daemon &
# emacs --daemon &
# xrandr --output eDP-1 --primary --auto --output DP-2 --left-of eDP-1 --auto --output HDMI-2 --right-of eDP-1 --auto &
# $HOME/.local/bin/X11/monitors.sh
# animatedwall --full ~/Pictures/Animated/fubuki.mp4 &
feh --no-fehbg --bg-fill --randomize ~/Pictures/Wallpapers/* &
mpDris2 &

18
home/.local/bin/X11/monitors.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/sh
status=$(xrandr | grep " connected")
# Built-int monitor
xrandr --output eDP-1 --primary --mode 1920x1080 --pos 0x0 --rotate normal
if echo "$status" | grep "HDMI-1"; then
xrandr --output HDMI-1 --mode 1920x1080 --pos 1920x0 --rotate normal
else
xrandr --output HDMI-1 --off
fi
if echo "$status" | grep "DP-2"; then
xrandr --output DP-2 --mode 1920x1080 --pos -1920x0 --rotate normal
else
xrandr --output DP-2 --off
fi