diff options
author | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2023-10-24 22:29:35 +0530 |
---|---|---|
committer | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2023-10-24 22:29:35 +0530 |
commit | 4f0a26b94993e4a910ab9dc54bb5c93ce2aa660d (patch) | |
tree | 6e7ed889e119b3aa9602cf4bb0a8b25fc6743412 | |
parent | 2e3d99acd413c663c489312daadd3197fd558c15 (diff) |
not turning on laptop screen if lid is off upon login
-rw-r--r-- | .config/polybar/config.ini | 7 | ||||
-rwxr-xr-x | .scripts/screensetup.sh | 9 | ||||
-rwxr-xr-x | .scripts/virtual_mic.sh | 7 | ||||
-rwxr-xr-x | .xprofile | 6 |
4 files changed, 22 insertions, 7 deletions
diff --git a/.config/polybar/config.ini b/.config/polybar/config.ini index 1f8e31a..3764a85 100644 --- a/.config/polybar/config.ini +++ b/.config/polybar/config.ini @@ -109,6 +109,10 @@ batt-full-fg = ${colors.module-color-0} ; also has different font size, bar height, etc ; modules are the same and should be synced if either is changed [bar/mybar2] +tray-position = right +tray-padding = 2 +tray-background = ${colors.systray-bg} + monitor = ${env:MONITOR:HDMI-0} enable-ipc = true width = 1920 @@ -154,7 +158,8 @@ tray-position = right tray-padding = 2 tray-background = ${colors.systray-bg} -;monitor = ${env:MONITOR:eDP-1} +monitor = ${env:MONITOR:eDP-1} +monitor-fallback = ${env:MONITOR:eDP-1-1} enable-ipc = true width = 1920 height = 28 diff --git a/.scripts/screensetup.sh b/.scripts/screensetup.sh new file mode 100755 index 0000000..31d9c3a --- /dev/null +++ b/.scripts/screensetup.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +if [[ $(xrandr --query | grep "eDP-1-1" ) ]]; then + if [[ $(cat /proc/acpi/button/lid/LID/state | awk '{print $2}') = "closed" ]]; then + xrandr --output HDMI-0 --primary --mode 1920x1080 --pos 1920x0 --rotate normal --output eDP-1-1 --off + else + xrandr --output HDMI-0 --primary --mode 1920x1080 --pos 1920x0 --rotate normal --output eDP-1-1 --mode 1920x1080 --pos 0x489 --rotate normal # monitor front, laptop left + fi +fi diff --git a/.scripts/virtual_mic.sh b/.scripts/virtual_mic.sh index a33382d..b5a6354 100755 --- a/.scripts/virtual_mic.sh +++ b/.scripts/virtual_mic.sh @@ -1,12 +1,15 @@ #!/bin/sh +default_source="$(pactl get-default-source)" +default_sink="$(pactl get-default-sink)" + # create virtual sinks pactl load-module module-null-sink sink_name=VirtualSpeaker pactl load-module module-null-sink media.class=Audio/Duplex sink_name=VirtualMicrophone # create loopbacks -pactl load-module module-loopback source="VirtualSpeaker.monitor" sink="$(pactl get-default-sink)" -pactl load-module module-loopback source="$(pactl get-default-source)" sink="VirtualMicrophone" +pactl load-module module-loopback source="VirtualSpeaker.monitor" sink="$default_sink" +pactl load-module module-loopback source="$default_source" sink="VirtualMicrophone" pactl load-module module-loopback source="VirtualSpeaker.monitor" sink="VirtualMicrophone" # set default mic @@ -12,13 +12,11 @@ dbus-update-activation-environment --all & # autostart apps for both xmonad and any other DE emacs --daemon & mpd & +#virtual_mic.sh & # autostart apps for xmonad if [[ $DESKTOP_SESSION = "xmonad" ]]; then - # set screen layout - # this would fail when on integrated graphics - # that's the desired behaviour - xrandr --output HDMI-0 --mode 1920x1080 --pos 0x0 --rotate normal --output eDP-1-1 --primary --mode 1920x1080 --pos 1920x926 --rotate normal + screensetup.sh # autostart apps nitrogen --restore & |