auto-default audio when switching screens
This commit is contained in:
parent
181688ef7c
commit
e3db34ba97
19
bin/altaria/beeg-game
Executable file
19
bin/altaria/beeg-game
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/zsh
|
||||
source ${0:a:h}/xorg.zsh
|
||||
|
||||
: \
|
||||
&& scwrypts desktop/xrandr/disconnect-all \
|
||||
&& xrandr \
|
||||
--output DP-2 \
|
||||
--primary \
|
||||
--mode 3840x2160 --rate 119.88 \
|
||||
--rotate normal \
|
||||
--pos 0x0 \
|
||||
;
|
||||
|
||||
pkill compton
|
||||
scwrypts desktop/pulse-audio/set-default-sink -- hdmi --id 0 --profile output:hdmi-surround71-extra2
|
||||
|
||||
scwrypts desktop/screen-blank -- disable
|
||||
scwrypts desktop/i3/set-background -- roy-art.jpg
|
||||
scwrypts desktop/play-sound -- gamedock
|
@ -1,18 +0,0 @@
|
||||
#!/bin/zsh
|
||||
source ${0:a:h}/xorg.zsh
|
||||
|
||||
xrandr \
|
||||
--output DP-0 \
|
||||
--off \
|
||||
--output HDMI-0 \
|
||||
--primary \
|
||||
--mode 3840x2160 \
|
||||
--rotate normal \
|
||||
--pos 0x0 \
|
||||
;
|
||||
|
||||
pkill compton
|
||||
|
||||
scwrypts desktop/screen-blank -- disable
|
||||
scwrypts desktop/i3/set-background -- roy-art.jpg
|
||||
scwrypts desktop/play-sound -- gamedock
|
@ -1,19 +1,29 @@
|
||||
#!/bin/zsh
|
||||
source ${0:a:h}/xorg.zsh
|
||||
|
||||
xrandr \
|
||||
--output DP-0 \
|
||||
--primary \
|
||||
--mode 1920x1080 \
|
||||
--rotate normal \
|
||||
--pos 0x0 \
|
||||
--output HDMI-0 \
|
||||
--mode 1920x1080 \
|
||||
--rotate normal \
|
||||
--pos 0x0 \
|
||||
: \
|
||||
&& scwrypts desktop/xrandr/disconnect-all \
|
||||
&& xrandr \
|
||||
--output DP-0 \
|
||||
--primary \
|
||||
--mode 3840x2160 \
|
||||
--rotate normal \
|
||||
--pos 0x0 \
|
||||
&& xrandr \
|
||||
--output HDMI-0 \
|
||||
--mode 3840x2160 \
|
||||
--rate 60.00 \
|
||||
--rotate normal \
|
||||
--pos 0x0 \
|
||||
--output DP-2 \
|
||||
--mode 3840x2160 \
|
||||
--rate 60.00 \
|
||||
--rotate normal \
|
||||
--pos 0x0 \
|
||||
;
|
||||
|
||||
(pkill compton; sleep 1; compton;) &
|
||||
scwrypts desktop/pulse-audio/set-default-sink -- Komplete
|
||||
|
||||
scwrypts desktop/screen-blank -- disable
|
||||
scwrypts desktop/i3/set-background -- purple.jpg
|
||||
|
19
bin/altaria/office-game
Executable file
19
bin/altaria/office-game
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/zsh
|
||||
source ${0:a:h}/xorg.zsh
|
||||
|
||||
: \
|
||||
&& scwrypts desktop/xrandr/disconnect-all \
|
||||
&& xrandr \
|
||||
--output DP-0 \
|
||||
--primary \
|
||||
--mode 3840x2160 \
|
||||
--rotate normal \
|
||||
--pos 0x0 \
|
||||
;
|
||||
|
||||
pkill compton
|
||||
scwrypts desktop/pulse-audio/set-default-sink -- Komplete
|
||||
|
||||
scwrypts desktop/screen-blank -- disable
|
||||
scwrypts desktop/i3/set-background -- roy-art.jpg
|
||||
scwrypts desktop/play-sound -- gamedock
|
20
bin/altaria/smol-game
Executable file
20
bin/altaria/smol-game
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/zsh
|
||||
source ${0:a:h}/xorg.zsh
|
||||
|
||||
: \
|
||||
&& scwrypts desktop/xrandr/disconnect-all \
|
||||
&& xrandr \
|
||||
--output HDMI-0 \
|
||||
--primary \
|
||||
--mode 3840x2160 --rate 119.88 \
|
||||
--rotate normal \
|
||||
--pos 0x0 \
|
||||
;
|
||||
|
||||
pkill compton
|
||||
|
||||
scwrypts desktop/pulse-audio/set-default-sink -- hdmi --id 0 --profile output:hdmi-surround-extra1
|
||||
|
||||
scwrypts desktop/screen-blank -- disable
|
||||
scwrypts desktop/i3/set-background -- roy-art.jpg
|
||||
scwrypts desktop/play-sound -- gamedock
|
@ -1,3 +1,3 @@
|
||||
#!/bin/zsh
|
||||
source $HOME/.config/wryn/env.zsh
|
||||
[ ! $DISPLAY ] && export DISPLAY=:0
|
||||
export DISPLAY=:0
|
||||
|
10
scwrypts/dotwryn/desktop/pulse-audio/set-default-sink
Executable file
10
scwrypts/dotwryn/desktop/pulse-audio/set-default-sink
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/zsh
|
||||
DEPENDENCIES+=()
|
||||
REQUIRED_ENV+=()
|
||||
|
||||
use desktop/pulse-audio --group dotwryn
|
||||
|
||||
CHECK_ENVIRONMENT
|
||||
#####################################################################
|
||||
|
||||
PA__SET_DEFAULT_AUDIO $@
|
10
scwrypts/dotwryn/desktop/xrandr/disconnect-all
Executable file
10
scwrypts/dotwryn/desktop/xrandr/disconnect-all
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/zsh
|
||||
DEPENDENCIES+=()
|
||||
REQUIRED_ENV+=()
|
||||
|
||||
use desktop/xrandr --group dotwryn
|
||||
|
||||
CHECK_ENVIRONMENT
|
||||
#####################################################################
|
||||
|
||||
XRANDR__DISCONNECT_ALL_DISPLAYS $@
|
65
scwrypts/dotwryn/lib/desktop/pulse-audio.module.zsh
Normal file
65
scwrypts/dotwryn/lib/desktop/pulse-audio.module.zsh
Normal file
@ -0,0 +1,65 @@
|
||||
#####################################################################
|
||||
|
||||
DEPENDENCIES+=(
|
||||
pactl
|
||||
yq
|
||||
)
|
||||
REQUIRED_ENV+=()
|
||||
|
||||
#####################################################################
|
||||
|
||||
PA__SET_DEFAULT_AUDIO() {
|
||||
local USAGE="
|
||||
usage: CARD_PATTERN [...options...]
|
||||
|
||||
options
|
||||
-p, --profile change profile of card (requires -i)
|
||||
-i, --id when changing profile (-p), the id of the card to change
|
||||
|
||||
--hdmi-wait wait for the hdmi card to be available before changing default
|
||||
"
|
||||
local CARD_PATTERN=()
|
||||
local CARD_PROFILE CARD_ID
|
||||
|
||||
local HDMI_WAIT=0
|
||||
|
||||
while [[ $# -gt 0 ]]
|
||||
do
|
||||
case $1 in
|
||||
--hdmi-wait ) HDMI_WAIT=1 ;;
|
||||
|
||||
--profile ) CARD_PROFILE="$2"; shift 1 ;;
|
||||
--id ) CARD_ID="$2"; shift 1 ;;
|
||||
|
||||
* ) CARD_PATTERN+=($1) ;;
|
||||
esac
|
||||
shift 1
|
||||
done
|
||||
|
||||
##########################################
|
||||
|
||||
[[ ${#CARD_PATTERN[@]} -gt 0 ]] || ERROR "no card pattern specified"
|
||||
|
||||
CHECK_ERRORS -n || return 1
|
||||
|
||||
##########################################
|
||||
|
||||
[[ $CARD_PATTERN =~ hdmi ]] && HDMI_WAIT=1
|
||||
|
||||
[[ $HDMI_WAIT -eq 1 ]] \
|
||||
&& STATUS 'waiting for hdmi sink to be available...' \
|
||||
&& until echo $(pactl list sinks 2>/dev/null | grep 'Name.*hdmi'); do sleep 1; done \
|
||||
&& SUCCESS 'hdmi sink ready!' \
|
||||
;
|
||||
|
||||
[ $CARD_ID ] && [ $CARD_PROFILE ] \
|
||||
&& STATUS "setting profile $CARD_PROFILE for card#$CARD_ID" \
|
||||
&& pactl set-card-profile $CARD_ID $CARD_PROFILE \
|
||||
&& SUCCESS "profile set" \
|
||||
;
|
||||
|
||||
STATUS "setting default audio sink to '$CARD_PATTERN'"
|
||||
pactl set-default-sink $(pactl list sinks 2>/dev/null | grep "Name.*$CARD_PATTERN" | sed 's/^\s*//' | yq -r .Name) \
|
||||
&& SUCCESS "default sink set to '$CARD_PATTERN'" \
|
||||
|| { ERROR "unable to set sink to '$CARD_PATTERN'" ; return 1; }
|
||||
}
|
16
scwrypts/dotwryn/lib/desktop/xrandr.module.zsh
Normal file
16
scwrypts/dotwryn/lib/desktop/xrandr.module.zsh
Normal file
@ -0,0 +1,16 @@
|
||||
#####################################################################
|
||||
|
||||
DEPENDENCIES+=(
|
||||
xrandr
|
||||
)
|
||||
REQUIRED_ENV+=()
|
||||
|
||||
#####################################################################
|
||||
|
||||
XRANDR__DISCONNECT_ALL_DISPLAYS() {
|
||||
STATUS 'disconnecting all displays' \
|
||||
&& xrandr $(xrandr | grep ' connected' | awk '{print "--output "$1" --off"}') \
|
||||
&& sleep 1 \
|
||||
&& SUCCESS 'all displays disconnected' \
|
||||
|| { ERROR 'unable to disconnect displays'; return 1; }
|
||||
}
|
Loading…
Reference in New Issue
Block a user