diff --git a/bin/altaria/beeg-game b/bin/altaria/beeg-game new file mode 100755 index 0000000..bf4d96d --- /dev/null +++ b/bin/altaria/beeg-game @@ -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 diff --git a/bin/altaria/gamedock b/bin/altaria/gamedock deleted file mode 100755 index 43eac54..0000000 --- a/bin/altaria/gamedock +++ /dev/null @@ -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 diff --git a/bin/altaria/homedock b/bin/altaria/homedock index 22a8403..71a7314 100755 --- a/bin/altaria/homedock +++ b/bin/altaria/homedock @@ -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 diff --git a/bin/altaria/office-game b/bin/altaria/office-game new file mode 100755 index 0000000..2fc6eaf --- /dev/null +++ b/bin/altaria/office-game @@ -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 diff --git a/bin/altaria/smol-game b/bin/altaria/smol-game new file mode 100755 index 0000000..1a9afc7 --- /dev/null +++ b/bin/altaria/smol-game @@ -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 diff --git a/bin/altaria/xorg.zsh b/bin/altaria/xorg.zsh index d77022f..c9b1c55 100644 --- a/bin/altaria/xorg.zsh +++ b/bin/altaria/xorg.zsh @@ -1,3 +1,3 @@ #!/bin/zsh source $HOME/.config/wryn/env.zsh -[ ! $DISPLAY ] && export DISPLAY=:0 +export DISPLAY=:0 diff --git a/scwrypts/dotwryn/desktop/pulse-audio/set-default-sink b/scwrypts/dotwryn/desktop/pulse-audio/set-default-sink new file mode 100755 index 0000000..0a6278d --- /dev/null +++ b/scwrypts/dotwryn/desktop/pulse-audio/set-default-sink @@ -0,0 +1,10 @@ +#!/bin/zsh +DEPENDENCIES+=() +REQUIRED_ENV+=() + +use desktop/pulse-audio --group dotwryn + +CHECK_ENVIRONMENT +##################################################################### + +PA__SET_DEFAULT_AUDIO $@ diff --git a/scwrypts/dotwryn/desktop/xrandr/disconnect-all b/scwrypts/dotwryn/desktop/xrandr/disconnect-all new file mode 100755 index 0000000..9b24bd8 --- /dev/null +++ b/scwrypts/dotwryn/desktop/xrandr/disconnect-all @@ -0,0 +1,10 @@ +#!/bin/zsh +DEPENDENCIES+=() +REQUIRED_ENV+=() + +use desktop/xrandr --group dotwryn + +CHECK_ENVIRONMENT +##################################################################### + +XRANDR__DISCONNECT_ALL_DISPLAYS $@ diff --git a/scwrypts/dotwryn/lib/desktop/pulse-audio.module.zsh b/scwrypts/dotwryn/lib/desktop/pulse-audio.module.zsh new file mode 100644 index 0000000..76ebd72 --- /dev/null +++ b/scwrypts/dotwryn/lib/desktop/pulse-audio.module.zsh @@ -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; } +} diff --git a/scwrypts/dotwryn/lib/desktop/xrandr.module.zsh b/scwrypts/dotwryn/lib/desktop/xrandr.module.zsh new file mode 100644 index 0000000..0de807b --- /dev/null +++ b/scwrypts/dotwryn/lib/desktop/xrandr.module.zsh @@ -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; } +}