Big move about + cleanup
This commit is contained in:
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"
|
5
bin/i3/logout
Executable file
5
bin/i3/logout
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/zsh
|
||||
i3-nagbar \
|
||||
-t warning \
|
||||
-m 'Do you really want to exit i3?' \
|
||||
-B 'Yes' "notify-send 'system' 'exiting i3...' -i face-tired; i3-msg exit"
|
@ -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
|
Reference in New Issue
Block a user