From c067614a8a634825098463e44eac7424d609525f Mon Sep 17 00:00:00 2001 From: Wryn Wagner Date: Tue, 4 May 2021 09:24:46 -0600 Subject: [PATCH] added a way to launch all relevant, scratchpad applications --- .../i3/launch-all-scratchpad-applications.sh | 40 +++++++++---------- config/i3/config | 12 ++++-- config/i3/utils | 7 ++++ 3 files changed, 36 insertions(+), 23 deletions(-) diff --git a/bin/desktop/i3/launch-all-scratchpad-applications.sh b/bin/desktop/i3/launch-all-scratchpad-applications.sh index b980651..9c8e1d0 100755 --- a/bin/desktop/i3/launch-all-scratchpad-applications.sh +++ b/bin/desktop/i3/launch-all-scratchpad-applications.sh @@ -1,32 +1,32 @@ +#!/usr/bin/zsh + APPLICATION_BIN="$HOME/.config/wryn/default-applications" -APPLICATIONS=( - 'audio' - 'discord' - 'email' - 'media' - 'message' - 'phone' - 'slack' +APPLICATION_CLASSES=( + 'audio ^Pavucontrol$' + 'discord ^discord$' + 'email ^Thunderbird$' + 'media ^youtubemusic-nativefier' + 'message ^android-messages-desktop$' + 'phone ^google-voice-desktop' + 'slack ^Slack$' ) -CLIENT_CLASSES=( - '^Pavucontrol$' - '^discord$' - '^Thunderbird$' - '^youtubemusic-nativefier' - '^android-messages-desktop$' - '^google-voice-desktop' - '^Slack$' - ) +for APP_CLS_STR in $APPLICATION_CLASSES; do + APPLICATION_CLASS=($(echo $APP_CLS_STR)) + APPLICATION=${APPLICATION_CLASS[1]} + CLIENT_CLASS=${APPLICATION_CLASS[2]} -for APPLICATION in $(echo $APPLICATIONS); do - xdotool search --class "$CLIENT_CLASS" >/dev/null 2>&1 || { + 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 CLIENT_CLASS in $CLIENT_CLASSES; do +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 diff --git a/config/i3/config b/config/i3/config index bf7534d..974abb3 100644 --- a/config/i3/config +++ b/config/i3/config @@ -8,11 +8,13 @@ font pango:monospace 20 set $UTILS /home/w0ryn/.config/wryn/i3utils -set $SLACK_CLIENT_CLASS ^Slack$ -set $MESSAGE_CLIENT_CLASS ^android-messages-desktop$ -set $MEDIA_CLIENT_CLASS ^youtubemusic-nativefier +set $AUDIO_CLIENT_CLASS ^Pavucontrol$ set $DISCORD_CLIENT_CLASS ^discord$ set $EMAIL_CLIENT_CLASS ^Thunderbird$ +set $MEDIA_CLIENT_CLASS ^youtubemusic-nativefier +set $MESSAGE_CLIENT_CLASS ^android-messages-desktop$ +set $PHONE_CLIENT_CLASS ^google-voice-desktop +set $SLACK_CLIENT_CLASS ^Slack$ set $GAMES_CLIENT_CLASSES ^(Steam)|(dolphin-emu)|(Visualboyadvance-m)$ set $TERMINAL_EMULATOR_CLASSES ^(kitty)$ @@ -98,10 +100,14 @@ floating_modifier $mod bindsym $mod+Shift+Tab move scratchpad bindsym $mod+Tab scratchpad show +bindsym $mod+Shift+a exec --no-startup-id $UTILS launchallhidden; + +bindsym $mod+a exec --no-startup-id $UTILS audio $AUDIO_CLIENT_CLASS; bindsym $mod+Shift+d exec --no-startup-id $UTILS discord $DISCORD_CLIENT_CLASS; bindsym $mod+Shift+t exec --no-startup-id $UTILS email $EMAIL_CLIENT_CLASS; bindsym $mod+m exec --no-startup-id $UTILS media $MEDIA_CLIENT_CLASS; bindsym $mod+Shift+m exec --no-startup-id $UTILS message $MESSAGE_CLIENT_CLASS; +bindsym $mod+c exec --no-startup-id $UTILS phone $PHONE_CLIENT_CLASS; bindsym $mod+Shift+s exec --no-startup-id $UTILS slack $SLACK_CLIENT_CLASS; bindsym $mod+Shift+x [class=$GAMES_CLIENT_CLASSES] scratchpad show diff --git a/config/i3/utils b/config/i3/utils index da93ce9..83794b5 100755 --- a/config/i3/utils +++ b/config/i3/utils @@ -20,15 +20,18 @@ BACKLIGHT__DOWN="$UTIL_BIN/xbacklight/down.sh"; LOCK_SCREEN="$UTIL_BIN/i3lock/lock.sh"; LOG_OUT="$UTIL_BIN/i3/logout.sh"; LAUNCH_OR_SHOW="$UTIL_BIN/i3/launch-or-show-application.sh"; +LAUNCH_ALL_SCRATCHPAD="$UTIL_BIN/i3/launch-all-scratchpad-applications.sh"; BG_RANDOMIZE="$UTIL_BIN/feh/randomize-background.sh" ALTERNATE_TERMINAL="$UTIL_BIN/kitty/alternate-terminal.sh" +AUDIO="$APP_BIN/audio" DISCORD="$APP_BIN/discord" EMAIL="$APP_BIN/email" MEDIA="$APP_BIN/media" MESSAGES="$APP_BIN/messages" +PHONE="$APP_BIN/phone" SLACK="$APP_BIN/slack" case $1 in @@ -51,9 +54,13 @@ case $1 in alternateterm ) "$ALTERNATE_TERMINAL" ;; + launchallhidden ) "$LAUNCH_ALL_SCRATCHPAD" ;; + + audio ) "$LAUNCH_OR_SHOW" "$2" "$AUDIO" ;; discord ) "$LAUNCH_OR_SHOW" "$2" "$DISCORD" ;; email ) "$LAUNCH_OR_SHOW" "$2" "$EMAIL" ;; media ) "$LAUNCH_OR_SHOW" "$2" "$MEDIA" ;; message ) "$LAUNCH_OR_SHOW" "$2" "$MESSAGES";; + phone ) "$LAUNCH_OR_SHOW" "$2" "$PHONE" ;; slack ) "$LAUNCH_OR_SHOW" "$2" "$SLACK" ;; esac