Big move about + cleanup
This commit is contained in:
2
bin/aws/configure
vendored
2
bin/aws/configure
vendored
@ -1,5 +1,5 @@
|
||||
#!/bin/zsh
|
||||
source "$HOME/.config/wryn/env/env.zsh"
|
||||
source "$HOME/.config/wryn/env.zsh"
|
||||
source $ZSH_COLOR_UTIL
|
||||
|
||||
#####################################################################
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/zsh
|
||||
source "$HOME/.config/wryn/env/env.zsh"
|
||||
source "$HOME/.config/wryn/env.zsh"
|
||||
source $ZSH_COLOR_UTIL
|
||||
|
||||
#####################################################################
|
||||
@ -10,8 +10,8 @@ case $1 in
|
||||
esac
|
||||
|
||||
case $2 in
|
||||
nodelete ) NODELETE=1 ;; # whether or not to pass '--delete' to s3 sync
|
||||
# default is --delete
|
||||
delete ) DELETE=1 ;; # whether or not to pass '--delete' to s3 sync
|
||||
# default is not to delete
|
||||
esac
|
||||
|
||||
[ ! $PULL ] && [ ! $PUSH ] && FATAL 'must specify "pull" or "push"'
|
||||
@ -25,8 +25,8 @@ PULL_MEDIA() {
|
||||
|
||||
[ ! -d $LOCAL_TARGET ] && mkdir -p $LOCAL_TARGET
|
||||
|
||||
local NO_DELETE="$2"
|
||||
[ ! $NO_DELETE ] && FLAGS=--delete
|
||||
local DELETE="$2"
|
||||
[ $DELETE ] && FLAGS=--delete
|
||||
|
||||
CHECK "downloading latest $1"
|
||||
aws --profile $DOTWRYN_AWS_PROFILE \
|
||||
@ -40,8 +40,8 @@ PUSH_MEDIA() {
|
||||
local REMOTE_TARGET="s3://$S3_SYNC_BUCKET/$1"
|
||||
local LOCAL_TARGET="$HOME/$1"
|
||||
|
||||
local NO_DELETE="$2"
|
||||
[ ! $NO_DELETE ] && FLAGS=--delete
|
||||
local DELETE="$2"
|
||||
[ $DELETE ] && FLAGS=--delete
|
||||
|
||||
CHECK "uploading $1"
|
||||
aws --profile $DOTWRYN_AWS_PROFILE \
|
||||
@ -53,6 +53,6 @@ PUSH_MEDIA() {
|
||||
|
||||
for m in $S3_SYNC_MEDIA
|
||||
do
|
||||
[ $PULL ] && PULL_MEDIA $m $NODELETE
|
||||
[ $PUSH ] && PUSH_MEDIA $m $NODELETE
|
||||
[ $PULL ] && PULL_MEDIA $m $DELETE
|
||||
[ $PUSH ] && PUSH_MEDIA $m $DELETE
|
||||
done
|
||||
|
19
bin/backlight
Executable file
19
bin/backlight
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/zsh
|
||||
source $HOME/.config/wryn/env.zsh
|
||||
|
||||
case $1 in
|
||||
up )
|
||||
xbacklight + 10 \
|
||||
|| gmux_backlight +100
|
||||
;;
|
||||
down )
|
||||
xbacklight - 10 \
|
||||
|| gmux_backlight -100
|
||||
;;
|
||||
* )
|
||||
echo 'must specify "up" or "down"'
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
PLAY_SFX backlight
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/zsh
|
||||
#!/bin/zsh
|
||||
|
||||
tmux new -d -s apps -n 'foreman' 'htop' \; \
|
||||
split-window -d -t apps:foreman "while true; do clear; ${0:a:h}/apps; echo 'Keeping apps fresh...'; sleep 30; done" \
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/zsh
|
||||
#!/bin/zsh
|
||||
|
||||
cd $HOME/Projects/gizmos/xorg-midi/code
|
||||
source ../env/bin/activate
|
@ -1,4 +0,0 @@
|
||||
source "$HOME/.config/wryn/env/env.zsh"
|
||||
|
||||
[ -d "$WALLPAPER_PATH" ] \
|
||||
&& feh --recursive --randomize --bg-fill "$WALLPAPER_PATH";
|
@ -1 +0,0 @@
|
||||
gmux_backlight -100
|
@ -1 +0,0 @@
|
||||
gmux_backlight +100
|
@ -1,33 +0,0 @@
|
||||
#!/usr/bin/zsh
|
||||
|
||||
APPLICATION_BIN="$HOME/.config/wryn/default-applications"
|
||||
APPLICATION_CLASSES=(
|
||||
'audio ^Audio$'
|
||||
'scrcpy ^scrcpy$'
|
||||
'discord ^discord$'
|
||||
'email ^Thunderbird$'
|
||||
'media ^youtubemusic-nativefier'
|
||||
'message ^android-messages-desktop$'
|
||||
'phone ^google-voice-desktop'
|
||||
'slack ^Slack$'
|
||||
)
|
||||
|
||||
for APP_CLS_STR in $APPLICATION_CLASSES; do
|
||||
APPLICATION_CLASS=($(echo $APP_CLS_STR))
|
||||
APPLICATION=${APPLICATION_CLASS[1]}
|
||||
CLIENT_CLASS=${APPLICATION_CLASS[2]}
|
||||
|
||||
echo "launching $APPLICATION_BIN/$APPLICATION"
|
||||
xdotool search --class "$CLIENT_CLASS" >/dev/null 2>&1 && echo "found existing" || {
|
||||
i3-msg "exec --no-startup-id $APPLICATION_BIN/$APPLICATION;"
|
||||
}
|
||||
done
|
||||
|
||||
sleep 10;
|
||||
|
||||
for APP_CLS_STR in $APPLICATION_CLASSES; do
|
||||
APPLICATION_CLASS=($(echo $APP_CLS_STR))
|
||||
CLIENT_CLASS=${APPLICATION_CLASS[2]}
|
||||
echo "hiding application $CLIENT_CLASS"
|
||||
i3-msg "[class=$CLIENT_CLASS] move scratchpad";
|
||||
done
|
@ -1,30 +0,0 @@
|
||||
CLIENT_CLASS="$1"
|
||||
APPLICATION="$2"
|
||||
|
||||
echo "client class:'$CLIENT_CLASS'"
|
||||
echo "application :'$APPLICATION'"
|
||||
|
||||
xdotool search --class "$CLIENT_CLASS" >/dev/null 2>&1 || {
|
||||
i3-msg "exec --no-startup-id $APPLICATION;"
|
||||
}
|
||||
|
||||
XFFSET=0.0
|
||||
YFFSET=0.0
|
||||
FACTOR=0.8
|
||||
case $(basename $APPLICATION) in
|
||||
audio ) FACTOR=0.4 YFFSET=200 ;;
|
||||
email ) FACTOR=0.8 XFFSET=-200 ;;
|
||||
esac
|
||||
|
||||
WINDOW_SIZE=$(\
|
||||
xrandr \
|
||||
| grep 'connected primary' \
|
||||
| sed 's/.*connected primary \([^x]*\)x\([^+]*\).*/\1 \2/' \
|
||||
| awk -v f=$FACTOR -v x=$XFFSET -v y=$YFFSET \
|
||||
'{print int($1*f+x)," ",int($2*f+y);}'\
|
||||
)
|
||||
|
||||
i3-msg "[class=$CLIENT_CLASS] move scratchpad"
|
||||
i3-msg "[class=$CLIENT_CLASS] resize set $WINDOW_SIZE"
|
||||
i3-msg "[class=$CLIENT_CLASS] scratchpad show"
|
||||
i3-msg "[class=$CLIENT_CLASS] move position center"
|
@ -1,16 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
source "$HOME/.config/wryn/env/env.zsh"
|
||||
|
||||
CONFIG_DIR="$DOTWRYN/config/kitty"
|
||||
|
||||
[ -f "$CONFIG_DIR/temp.conf" ] && return 1 # race condition lock
|
||||
|
||||
mv "$CONFIG_DIR/theme.conf" "$CONFIG_DIR/temp.conf"
|
||||
mv "$CONFIG_DIR/alternate.conf" "$CONFIG_DIR/theme.conf"
|
||||
|
||||
i3-sensible-terminal &
|
||||
sleep 0.1
|
||||
|
||||
mv "$CONFIG_DIR/theme.conf" "$CONFIG_DIR/alternate.conf"
|
||||
mv "$CONFIG_DIR/temp.conf" "$CONFIG_DIR/theme.conf"
|
@ -1,2 +0,0 @@
|
||||
pactl set-sink-volume @DEFAULT_SINK@ -10%
|
||||
$HOME/.config/wryn/sfx volume &
|
@ -1,3 +0,0 @@
|
||||
pactl set-sink-mute @DEFAULT_SINK@ toggle
|
||||
$HOME/.config/wryn/sfx mute &
|
||||
notify-send 'Default Sink' "$(amixer sget Master | grep -q '\[on\]' && echo unmuted || echo muted)"
|
@ -1,2 +0,0 @@
|
||||
pactl set-sink-volume @DEFAULT_SINK@ +10%
|
||||
$HOME/.config/wryn/sfx volume &
|
@ -1 +0,0 @@
|
||||
pactl set-source-mute @DEFAULT_SOURCE@ toggle
|
@ -1,2 +0,0 @@
|
||||
$HOME/.config/wryn/sfx backlight &
|
||||
xbacklight - 10
|
@ -1,2 +0,0 @@
|
||||
$HOME/.config/wryn/sfx backlight &
|
||||
xbacklight + 10
|
@ -1,19 +0,0 @@
|
||||
#
|
||||
# Chrome / YouTube only accepts keypresses when window is active
|
||||
#
|
||||
# This activates the YouTube window and sends the keypress
|
||||
#
|
||||
|
||||
xdotool search --name 'YouTube Music' >/dev/null 2>&1 || return 1;
|
||||
|
||||
TIMEOUT='0.3';
|
||||
|
||||
case $1 in
|
||||
next) KEY_COMMAND='j';;
|
||||
prev) KEY_COMMAND='k';;
|
||||
*) KEY_COMMAND='space';;
|
||||
esac
|
||||
|
||||
xdotool search --name 'YouTube Music' windowactivate;
|
||||
sleep $TIMEOUT;
|
||||
xdotool key --clearmodifiers "$KEY_COMMAND";
|
@ -1,3 +0,0 @@
|
||||
source "$HOME/.config/wryn/env/env.zsh"
|
||||
|
||||
"$DOTWRYN/bin/desktop/youtube-music/controller.sh" next
|
@ -1,3 +0,0 @@
|
||||
source "$HOME/.config/wryn/env/env.zsh"
|
||||
|
||||
"$DOTWRYN/bin/desktop/youtube-music/controller.sh" playpause
|
@ -1,3 +0,0 @@
|
||||
source "$HOME/.config/wryn/env/env.zsh"
|
||||
|
||||
"$DOTWRYN/bin/desktop/youtube-music/controller.sh" prev
|
@ -1,26 +0,0 @@
|
||||
#
|
||||
# Chrome / YouTube only accepts keypresses when window is active
|
||||
#
|
||||
# This activates the YouTube window, sends the keypress, then reactivates the original window
|
||||
#
|
||||
|
||||
xdotool search --name 'YouTube Music' >/dev/null 2>&1 || return 1;
|
||||
|
||||
ACTIVE_DESKTOP="$(xdotool get_desktop)"
|
||||
ACTIVE_WINDOW_ID="$(xdotool getactivewindow)"
|
||||
ACTIVE_WINDOW_NAME="$(xdotool getwindowname $ACTIVE_WINDOW_ID)"
|
||||
|
||||
TIMEOUT='0.1';
|
||||
|
||||
case $1 in
|
||||
next) KEY_COMMAND='j';;
|
||||
prev) KEY_COMMAND='k';;
|
||||
*) KEY_COMMAND='space';;
|
||||
esac
|
||||
|
||||
xdotool search --name 'YouTube Music' windowactivate;
|
||||
sleep $TIMEOUT;
|
||||
xdotool key --clearmodifiers "$KEY_COMMAND";
|
||||
|
||||
xdotool set_desktop "$ACTIVE_DESKTOP";
|
||||
[[ "$ACTIVE_WINDOW_NAME" != "Desktop" ]] && xdotool windowactivate "$ACTIVE_WINDOW_ID";
|
49
bin/i3/launch-or-show
Executable file
49
bin/i3/launch-or-show
Executable file
@ -0,0 +1,49 @@
|
||||
#!/bin/zsh
|
||||
#####################################################################
|
||||
|
||||
USAGE="$0 APPLICATION CLIENT_CLASS"
|
||||
|
||||
function ERROR() {
|
||||
local ERROR_CODE=$1
|
||||
local MESSAGE="$2"
|
||||
|
||||
echo -e "$MESSAGE\n\nUSAGE : $USAGE\n" >&2
|
||||
|
||||
[ $MESSAGE ] && notify-send "Application Launcher" "$MESSAGE"
|
||||
exit $ERROR_CODE
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
|
||||
APPLICATION="$1"
|
||||
which $APPLICATION >/dev/null 2>&1 \
|
||||
|| ERROR 2 "Application '$APPLICATION' not found"
|
||||
|
||||
CLIENT_CLASS="${@:2}"
|
||||
[ ! $CLIENT_CLASS ] && CLIENT_CLASS="$APPLICATION"
|
||||
|
||||
|
||||
XFFSET=0.0
|
||||
YFFSET=0.0
|
||||
FACTOR=0.8
|
||||
case $APPLICATION in
|
||||
pavucontrol ) FACTOR=0.4 YFFSET=200 ;;
|
||||
esac
|
||||
|
||||
|
||||
xdotool search --class "$CLIENT_CLASS" >/dev/null 2>&1 || {
|
||||
i3-msg "exec --no-startup-id $APPLICATION;"
|
||||
}
|
||||
|
||||
WINDOW_SIZE=$(\
|
||||
xrandr \
|
||||
| grep 'connected primary' \
|
||||
| sed 's/.*connected primary \([^x]*\)x\([^+]*\).*/\1 \2/' \
|
||||
| awk -v f=$FACTOR -v x=$XFFSET -v y=$YFFSET \
|
||||
'{print int($1*f+x)," ",int($2*f+y);}'\
|
||||
)
|
||||
|
||||
i3-msg "[class=$CLIENT_CLASS] move scratchpad"
|
||||
i3-msg "[class=$CLIENT_CLASS] resize set $WINDOW_SIZE"
|
||||
i3-msg "[class=$CLIENT_CLASS] scratchpad show"
|
||||
i3-msg "[class=$CLIENT_CLASS] move position center"
|
@ -1,3 +1,4 @@
|
||||
#!/bin/zsh
|
||||
i3-nagbar \
|
||||
-t warning \
|
||||
-m 'Do you really want to exit i3?' \
|
@ -1,5 +1,5 @@
|
||||
#!/bin/zsh
|
||||
source "$HOME/.config/wryn/env/env.zsh"
|
||||
source "$HOME/.config/wryn/env.zsh"
|
||||
source $ZSH_COLOR_UTIL
|
||||
|
||||
#####################################################################
|
||||
@ -14,7 +14,7 @@ BORDER_PIXEL_SIZE="$3"
|
||||
|
||||
|
||||
LOCAL_CONFIG="$HOME/.config/i3/config"
|
||||
MODEL_CONFIG="$DOTWRYN/config/i3/config"
|
||||
MODEL_CONFIG="$DOTWRYN/config/i3.conf"
|
||||
|
||||
REGEX_FONT='^\(font [^0-9]*\)\(.*\)'
|
||||
REGEX_DMENU="^\\(.*dmenu_run .*-fn '[^0-9]*\\)\\([0-9]*\\)'"
|
||||
@ -27,7 +27,7 @@ DEFAULT_BORDER_PIXEL_SIZE=$(sed -n "s/$REGEX_BORDER/\\2/p" $MODEL_CONFIG)
|
||||
#####################################################################
|
||||
|
||||
RESET_CONFIG_TO_DEFAULT() {
|
||||
STATUS 'relinking config to .wryn/config/i3/config'
|
||||
STATUS 'relinking default config'
|
||||
ln -s $MODEL_CONFIG $LOCAL_CONFIG
|
||||
}
|
||||
|
||||
|
27
bin/i3/utils
Executable file
27
bin/i3/utils
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/zsh
|
||||
source "$HOME/.config/wryn/env.zsh"
|
||||
|
||||
COMMAND=$1
|
||||
case $COMMAND in
|
||||
next ) $DOTWRYN/bin/youtube-music next ;;
|
||||
prev ) $DOTWRYN/bin/youtube-music prev ;;
|
||||
play ) $DOTWRYN/bin/youtube-music play ;;
|
||||
|
||||
volumeup ) $DOTWRYN/bin/pulseaudio sink up ;;
|
||||
volumedown ) $DOTWRYN/bin/pulseaudio sink down ;;
|
||||
volumemute ) $DOTWRYN/bin/pulseaudio sink mute ;;
|
||||
micmute ) $DOTWRYN/bin/pulseaudio source mute ;;
|
||||
|
||||
backlightup ) $DOTWRYN/bin/backlight up ;;
|
||||
backlightdown ) $DOTWRYN/bin/backlight down ;;
|
||||
|
||||
lock ) $DOTWRYN/bin/i3lock ;;
|
||||
|
||||
bgrandomize ) $DOTWRYN/bin/randomize-background ;;
|
||||
|
||||
alternateterm ) $DOTWRYN/bin/kitty/alternate-theme ;;
|
||||
|
||||
logout ) $DOTWRYN/bin/i3/logout ;;
|
||||
|
||||
launch ) $DOTWRYN/bin/i3/launch-or-show ${@:2} ;;
|
||||
esac
|
@ -1,3 +1,4 @@
|
||||
#!/bin/zsh
|
||||
# requires i3lock-color
|
||||
INSIDE_VER='001020'
|
||||
RING_VER='004040'
|
||||
@ -14,15 +15,15 @@ KEYREMOVE='4444ff'
|
||||
TIME='aaaaaa'
|
||||
DATE='888888'
|
||||
|
||||
i3lock\
|
||||
-e\
|
||||
--pass-screen-keys --pass-media-keys --pass-volume-keys --pass-power-keys\
|
||||
-B 6\
|
||||
--force-clock\
|
||||
--insidever-color=$INSIDE_VER --ringver-color=$RING_VER --verif-color=$INSIDE_VER\
|
||||
--insidewrong-color=$INSIDE_WRONG --ringwrong-color=$RING_WRONG --wrong-color=$INSIDE_WRONG\
|
||||
--inside-color=002010 --ring-color=103020\
|
||||
--line-color=$LINE\
|
||||
--time-color=$TIME --date-color=$DATE\
|
||||
--keyhl-color=$KEYDOWN --bshl-color=$KEYREMOVE\
|
||||
i3lock \
|
||||
-e \
|
||||
--pass-screen-keys --pass-media-keys --pass-volume-keys --pass-power-keys \
|
||||
-B 6 \
|
||||
--force-clock \
|
||||
--insidever-color=$INSIDE_VER --ringver-color=$RING_VER --verif-color=$INSIDE_VER \
|
||||
--insidewrong-color=$INSIDE_WRONG --ringwrong-color=$RING_WRONG --wrong-color=$INSIDE_WRONG \
|
||||
--inside-color=002010 --ring-color=103020 \
|
||||
--line-color=$LINE \
|
||||
--time-color=$TIME --date-color=$DATE \
|
||||
--keyhl-color=$KEYDOWN --bshl-color=$KEYREMOVE \
|
||||
;
|
15
bin/kitty/alternate-theme
Executable file
15
bin/kitty/alternate-theme
Executable file
@ -0,0 +1,15 @@
|
||||
#!/bin/zsh
|
||||
source "$HOME/.config/wryn/env.zsh"
|
||||
|
||||
function _SET_THEME() {
|
||||
local THEME="$1"
|
||||
local LOCAL_THEME="$HOME/.config/kitty/theme.conf"
|
||||
rm -- $LOCAL_THEME
|
||||
ln -s "$DOTWRYN/colorschemes/kitty.$THEME" "$LOCAL_THEME"
|
||||
}
|
||||
|
||||
|
||||
_SET_THEME alternate
|
||||
i3-sensible-terminal &
|
||||
sleep 0.1
|
||||
_SET_THEME main
|
@ -1,8 +1,9 @@
|
||||
#!/bin/sh
|
||||
source "$HOME/.config/wryn/env/env.zsh" 2>/dev/null
|
||||
#!/bin/zsh
|
||||
source "$HOME/.config/wryn/env.zsh"
|
||||
|
||||
PLAY() {
|
||||
eval "$MEDIA_ENGINE" "$SFX_PATH/$1"
|
||||
true
|
||||
}
|
||||
|
||||
case $1 in
|
||||
@ -15,5 +16,7 @@ case $1 in
|
||||
undock ) PLAY yaru-desktop-login.oga ;;
|
||||
homedock ) PLAY homedock.oga ;;
|
||||
gamedock ) PLAY gamedock.oga ;;
|
||||
* ) ls $SFX_PATH ;;
|
||||
* )
|
||||
[ -f "$SFX_PATH/$1" ] && PLAY $1 || ls $SFX_PATH
|
||||
;;
|
||||
esac
|
43
bin/pulseaudio
Executable file
43
bin/pulseaudio
Executable file
@ -0,0 +1,43 @@
|
||||
#!/bin/zsh
|
||||
source $HOME/.config/wryn/env.zsh
|
||||
#####################################################################
|
||||
|
||||
USAGE="$0 (sink|source) (up|down|mute)"
|
||||
|
||||
function ERROR() {
|
||||
local ERROR_CODE=$1
|
||||
local MESSAGE="$2"
|
||||
|
||||
echo -e "$MESSAGE\n\nUSAGE : $USAGE\n" >&2
|
||||
|
||||
exit $ERROR_CODE
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
|
||||
DEVICE="$1"
|
||||
COMMAND="$2"
|
||||
|
||||
case $DEVICE in
|
||||
sink | source ) ;;
|
||||
* ) ERROR 1 "Unsupported device '$DEVICE'" ;;
|
||||
esac
|
||||
|
||||
VOLUME_INCREMENT=10%
|
||||
DEFAULT_DEVICE="@DEFAULT_$(echo $DEVICE | tr '[:lower:]' '[:upper:]')@"
|
||||
case $COMMAND in
|
||||
up )
|
||||
pactl set-$DEVICE-volume $DEFAULT_DEVICE +$VOlUME_INCREMENT
|
||||
PLAY_SFX volume
|
||||
;;
|
||||
down )
|
||||
pactl set-$DEVICE-volume $DEFAULT_DEVICE -$VOlUME_INCREMENT
|
||||
PLAY_SFX volume
|
||||
;;
|
||||
mute )
|
||||
pactl set-$DEVICE-mute $DEFAULT_DEVICE toggle
|
||||
PLAY_SFX mute
|
||||
notify-send "default $DEVICE" "$(amixer sget Master | grep -q '\[on\]' && echo unmuted || echo muted)"
|
||||
;;
|
||||
* ) ERROR "Unsupported command '$COMMAND'" ;;
|
||||
esac
|
5
bin/randomize-background
Executable file
5
bin/randomize-background
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/zsh
|
||||
source "$HOME/.config/wryn/env.zsh"
|
||||
|
||||
[ -d "$WALLPAPER_PATH" ] \
|
||||
&& feh --recursive --randomize --bg-fill "$WALLPAPER_PATH"
|
@ -1,10 +0,0 @@
|
||||
#!/bin/bash
|
||||
source "$HOME/.config/wryn/env/env.zsh"
|
||||
|
||||
[ ! -d "$HOME/.vim" ] && mkdir "$HOME/.vim"
|
||||
[ ! -d "$HOME/.vim/colors" ] && mkdir "$HOME/.vim/colors"
|
||||
|
||||
for file in $(find "$DOTWRYN/config/colorschemes/vim" -name \*.vim); do
|
||||
cp $file ~/.vim/colors/;
|
||||
done
|
||||
echo "vim colorschemes updated"
|
14
bin/xorg/activate-default
Executable file
14
bin/xorg/activate-default
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/zsh
|
||||
_HOSTNAME=$(hostnamectl --static)
|
||||
|
||||
case $_HOSTNAME in
|
||||
butterfree ) DEFAULT=undock ;;
|
||||
altaria ) DEFAULT=hdmi4k ;;
|
||||
esac
|
||||
|
||||
LAYOUT="${0:a:h}/$_HOSTNAME/$DEFAULT"
|
||||
|
||||
[ -f $LAYOUT ] && {
|
||||
until xrandr -q >/dev/null 2>&1; do sleep .1; done
|
||||
$LAYOUT
|
||||
}
|
2
bin/xorg/altaria/common
Normal file
2
bin/xorg/altaria/common
Normal file
@ -0,0 +1,2 @@
|
||||
#!/bin/zsh
|
||||
source $HOME/.config/wryn/env.zsh
|
12
bin/xorg/altaria/hdmi4k
Executable file
12
bin/xorg/altaria/hdmi4k
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/zsh
|
||||
source ${0:a:h}/common
|
||||
|
||||
xrandr \
|
||||
--output HDMI-0 \
|
||||
--primary \
|
||||
--mode 3840x2160 \
|
||||
--rotate normal \
|
||||
--pos 0x0 \
|
||||
;
|
||||
|
||||
PLAY_SFX login
|
39
bin/xorg/butterfree/common
Normal file
39
bin/xorg/butterfree/common
Normal file
@ -0,0 +1,39 @@
|
||||
#!/bin/zsh
|
||||
source "$HOME/.config/wryn/env.zsh"
|
||||
NATIVE_MONITOR='eDP1'
|
||||
|
||||
GET_PRIMARY_MONITOR() {
|
||||
xrandr \
|
||||
| grep 'primary' \
|
||||
| awk '{print $1;}' \
|
||||
| head -n 1
|
||||
}
|
||||
|
||||
PRIMARY_MONITOR=$(GET_PRIMARY_MONITOR)
|
||||
|
||||
GET_DEFAULT_EXTERNAL_MONITOR() {
|
||||
xrandr \
|
||||
| grep ' connect' \
|
||||
| awk '{print $1;}' \
|
||||
| grep -v "$NATIVE_MONITOR" \
|
||||
| head -n 1
|
||||
}
|
||||
EXTERNAL_MONITOR=$(GET_DEFAULT_EXTERNAL_MONITOR)
|
||||
|
||||
DISCONNECT_OTHER() {
|
||||
local SFX="$1"
|
||||
|
||||
for D in $(xrandr | awk '{print $1;}' | grep -v $(GET_PRIMARY_MONITOR))
|
||||
do
|
||||
xrandr --output $D --off
|
||||
done
|
||||
|
||||
$DOTWRYN/bin/randomize-background
|
||||
|
||||
[ $SFX ] && ( PLAY_SFX $SFX ) &
|
||||
return 0
|
||||
}
|
||||
|
||||
NOTIFY() {
|
||||
notify-send 'xrandr screenlayout' $@
|
||||
}
|
15
bin/xorg/butterfree/gamedock
Executable file
15
bin/xorg/butterfree/gamedock
Executable file
@ -0,0 +1,15 @@
|
||||
#!/bin/zsh
|
||||
source ${0:a:h}/common
|
||||
[ ! $PRIMARY_MONITOR ] && {
|
||||
NOTIFY 'Unable to detect primary monitor'
|
||||
return
|
||||
}
|
||||
|
||||
xrandr \
|
||||
--output $PRIMARY_MONITOR \
|
||||
--primary \
|
||||
--mode 1920x1080 \
|
||||
--rotate normal \
|
||||
--pos 0x0 \
|
||||
&& DISCONNECT_OTHER gamedock \
|
||||
|| NOTIFY "Unable to set '$PRIMARY_MONITOR' to 1920x1080"
|
15
bin/xorg/butterfree/hdmidock
Executable file
15
bin/xorg/butterfree/hdmidock
Executable file
@ -0,0 +1,15 @@
|
||||
#!/bin/zsh
|
||||
source ${0:a:h}/common
|
||||
[ ! $EXTERNAL_MONITOR ] && {
|
||||
NOTIFY 'No external monitor connected!'
|
||||
return
|
||||
}
|
||||
|
||||
xrandr \
|
||||
--output $EXTERNAL_MONITOR \
|
||||
--primary \
|
||||
--auto \
|
||||
--rotate normal \
|
||||
--pos 0x0 \
|
||||
&& DISCONNECT_OTHER login \
|
||||
|| NOTIFY "Unable to connect '$EXTERNAL_MONITOR' to 1920x1080"
|
15
bin/xorg/butterfree/undock
Executable file
15
bin/xorg/butterfree/undock
Executable file
@ -0,0 +1,15 @@
|
||||
#!/bin/zsh
|
||||
source ${0:a:h}/common
|
||||
[ ! $NATIVE_MONITOR ] && {
|
||||
NOTIFY "Must specify NATIVE_MONITOR"
|
||||
return
|
||||
}
|
||||
|
||||
xrandr \
|
||||
--output $NATIVE_MONITOR \
|
||||
--primary \
|
||||
--mode "2560x1440" \
|
||||
--rotate normal \
|
||||
--pos 0x0 \
|
||||
&& DISCONNECT_OTHER undock \
|
||||
|| NOTIFY "Native monitor '$PRIMARY_MONITOR' unresponsive"
|
33
bin/youtube-music
Executable file
33
bin/youtube-music
Executable file
@ -0,0 +1,33 @@
|
||||
#!/bin/zsh
|
||||
#####################################################################
|
||||
|
||||
USAGE="$0 (next|prev|playpause)"
|
||||
|
||||
function ERROR() {
|
||||
local ERROR_CODE=$1
|
||||
local MESSAGE="$2"
|
||||
|
||||
echo -e "$MESSAGE\n\nUSAGE : $USAGE\n" >&2
|
||||
notify-send "YouTube media controller" "$MESSAGE"
|
||||
|
||||
exit $ERROR_CODE
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
|
||||
COMMAND="$1"
|
||||
case $COMMAND in
|
||||
next ) COMMAND_KEY='j';;
|
||||
prev ) COMMAND_KEY='k';;
|
||||
playpause ) COMMAND_KEY='space';;
|
||||
* ) ERROR 1 "unsupported command '$COMMAND'" ;;
|
||||
esac
|
||||
|
||||
xdotool search --name 'YouTube Music' windowactivate \
|
||||
|| ERROR 2 "YouTube Music is not running"
|
||||
|
||||
|
||||
# Chrome / YouTube only accepts keypresses when window is active
|
||||
xdotool search --name 'YouTube Music' windowactivate
|
||||
sleep 0.3
|
||||
xdotool key --clearmodifiers "$COMMAND_KEY"
|
Reference in New Issue
Block a user