Skip to content

Commit 54f685d

Browse files
committed
Add messaging apps to the suspend script
1 parent 6eac171 commit 54f685d

File tree

5 files changed

+52
-5
lines changed

5 files changed

+52
-5
lines changed

startup/agx-user-startup.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ if [ -f "${ACTIVITYWATCH}" ]; then
5050
fi
5151

5252
if command -v flatpak >/dev/null 2>&1; then
53-
echo "Starting Slack"
54-
flatpak run com.slack.Slack --startup &
5553
echo "Starting Mattermost"
5654
flatpak run com.mattermost.Desktop --hidden &
55+
echo "Starting Slack"
56+
flatpak run com.slack.Slack --startup &
5757
fi
5858

5959
if command -v signal-desktop >/dev/null 2>&1; then
@@ -66,7 +66,7 @@ if command -v telegram-desktop >/dev/null 2>&1; then
6666
telegram-desktop -startintray &
6767
fi
6868

69-
if [ "$(hostname)" == "agx-z2e-kubuntu" ]; then
69+
if [ "$(hostname)" = "agx-z2e-kubuntu" ]; then
7070
echo "Starting Discord"
7171
flatpak run com.discordapp.Discord --start-minimized &
7272
echo "Starting Steam"

startup/suspend/agx-resume-user.sh

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,51 @@
1-
#!/usr/bin/env sh
1+
#!/usr/bin/env bash
22
set -eu
33

4+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
5+
REPO_DIR="$(dirname "$(dirname "${SCRIPT_DIR}")")"
6+
7+
. "${REPO_DIR}/utils.sh"
8+
49
# This does not seem to fix the Plasma crash on Kubuntu 24.10
510
# if pgrep -x "plasmashell" > /dev/null; then
611
# sleep 1
712
# killall plasmashell -9
813
# sleep 1
914
# kstart plasmashell
1015
# fi
16+
17+
# Wait for the laptop to connect to Wi-Fi.
18+
echo "Waiting to ensure that Wi-Fi will be available."
19+
sleep 3
20+
SSID="$(get-ssid)"
21+
if [ "${SSID}" = "eduroam" ]; then
22+
echo "Eduroam connection detected. Closing personal apps and starting work apps."
23+
# Close personal messaging apps.
24+
if pgrep -x "discord" > /dev/null 2>&1; then
25+
killall discord
26+
fi
27+
if pgrep -x "ferdium" > /dev/null 2>&1; then
28+
killall ferdium
29+
fi
30+
if pgrep -f "signal-desktop" > /dev/null 2>&1; then
31+
killall signal-desktop
32+
fi
33+
if pgrep -f "telegram-desktop" > /dev/null 2>&1; then
34+
killall telegram-desktop
35+
fi
36+
# Start work messaging apps.
37+
if pgrep -f "mattermost-desktop" > /dev/null 2>&1; then :; else
38+
flatpak run com.mattermost.Desktop --hidden &
39+
fi
40+
if pgrep -x "slack" > /dev/null 2>&1; then :; else
41+
flatpak run com.slack.Slack --startup &
42+
fi
43+
elif [ "${SSID}" = "Agnet" ]; then
44+
echo "Agnet connection detected. Starting personal apps."
45+
if pgrep -f "signal-desktop" > /dev/null 2>&1; then :; else
46+
signal-desktop --start-in-tray &
47+
fi
48+
if pgrep -f "telegram-desktop" > /dev/null 2>&1; then :; else
49+
telegram-desktop -startintray &
50+
fi
51+
fi

utils.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env sh
2+
3+
get-ssid() {
4+
nmcli -t -f active,ssid dev wifi | egrep '^yes' | cut -d\: -f2
5+
}

zsh/custom/audio.zsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env zsh
22

33
fix-audio() {
4-
# This fixes audio crackling issues
4+
# This fixes issues with audio crackling and missing devices.
55
systemctl --user restart pipewire.service pipewire-pulse.service
66
# For old PulseAudio
77
# pulseaudio -k

zsh/custom/utils.zsh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env zsh
22

33
# TODO: Think whether to use hyphens or underscores in the names.
4+
# Hyphens are probably better, since they're easire to write.
45
# https://unix.stackexchange.com/a/168222/
56

67
apt-rdepends-installed () {

0 commit comments

Comments
 (0)