scripting, formatting and fixes

This commit is contained in:
Maddie H 2023-03-12 18:44:14 +00:00
parent c45ffbcdd5
commit 8c660746de
No known key found for this signature in database
GPG Key ID: 99CD1AB536E1C7AD
10 changed files with 54 additions and 9 deletions

41
maddie/dmenu/dmenu-kdeconnect Executable file
View File

@ -0,0 +1,41 @@
#!/usr/bin/env bash
NOTIFICATIONS_TITLE="KDE Connect"
NOTIFICATIONS_EXPIRE_TIME=1000
notify-send "$NOTIFICATIONS_TITLE" "Getting devices..." --expire-time="$NOTIFICATIONS_EXPIRE_TIME"
# Get available devices
devices="$(kdeconnect-cli -a)"
[ -z "$devices" ] && notify-send "$NOTIFICATIONS_TITLE" "No devices available" --expire-time="$NOTIFICATIONS_EXPIRE_TIME" && exit 1
# Let the user choose a device
device="$(echo "$devices" | sed 's/-\ //' | sed 's/:.*//' | dmenu -i -p "Devices:")"
if [ $? -eq 0 ]
then
# Send files to a device
📂File() {
file="$(zenity --file-selection)"
kdeconnect-cli -n "$device" --share "$file"
[ "$?" -eq 0 ] && notify-send "$NOTIFICATIONS_TITLE" "📂 Shared file: $file" --expire-time="$NOTIFICATIONS_EXPIRE_TIME"
[ "$?" -ne 0 ] && notify-send "$NOTIFICATIONS_TITLE" "📂 Failed to share file: $file" --expire-time="$NOTIFICATIONS_EXPIRE_TIME" && exit 1
}
# Ping a device
📳Ping() {
kdeconnect-cli -n "$device" --ping
[ "$?" -eq 0 ] && notify-send "$NOTIFICATIONS_TITLE" "📳 Pinged device: $device" --expire-time="$NOTIFICATIONS_EXPIRE_TIME"
[ "$?" -ne 0 ] && notify-send "$NOTIFICATIONS_TITLE" "📳 Unable to ping device: $device" --expire-time="$NOTIFICATIONS_EXPIRE_TIME" && exit 1
}
# Make a device ring
Ring() {
kdeconnect-cli -n "$device" --ring
[ "$?" -eq 0 ] && notify-send "$NOTIFICATIONS_TITLE" "☎️ Ringed device: $device" --expire-time="$NOTIFICATIONS_EXPIRE_TIME"
[ "$?" -ne 0 ] && notify-send "$NOTIFICATIONS_TITLE" "☎️ Unable to ring device: $device" --expire-time="$NOTIFICATIONS_EXPIRE_TIME" && exit 1
}
# Show functions in dmenu and run the chosen function
func="$(declare -F | awk '{print $3}' | dmenu -i -p "$device":)"
[ -z "$func" ] || "$func"
fi

View File

@ -18,7 +18,7 @@
userName = "Madeleine"; userName = "Madeleine";
userEmail = "maddie@spyhoodle.me"; userEmail = "maddie@spyhoodle.me";
signing = { signing = {
key = "33CC62D0ED495156FF5FCC550C7CB348221D0AEF"; key = "467EFD918D5E770AD1EE2CE699CD1AB536E1C7AD";
signByDefault = true; signByDefault = true;
gpgPath = "gpg2"; gpgPath = "gpg2";
}; };

View File

@ -17,4 +17,8 @@
name = "Zafiro-icons-Dark"; name = "Zafiro-icons-Dark";
}; };
}; };
home.packages = with pkgs; [
gnome.zenity
];
} }

View File

@ -6,8 +6,8 @@
maim # X11 screenshot tool maim # X11 screenshot tool
]; ];
home.file.".local/bin/sst" = { home.file.".local/bin/sss" = {
source = ./screenshot/sst.sh; source = ./screenshot/sss.sh;
executable = true; executable = true;
}; };
} }

View File

@ -5,8 +5,8 @@
src = final.fetchFromGitHub { src = final.fetchFromGitHub {
owner = "SpyHoodle"; owner = "SpyHoodle";
repo = "dwm"; repo = "dwm";
rev = "e62a49b77e9490e47200b7778c5086c4dff969a9"; rev = "7dab824afc125afba150949f12f38def1ffd47a8";
sha256 = "sha256-V0tadjoEq/esz708cjfpbBBVqIActYRXKn9yNEeUKLU="; sha256 = "sha256-qINiKWz8+POCjOL5UA7Mrxw4ZZgJ5D1eGatN1RCeE9M=";
}; };
}); });
st = prev.st.overrideAttrs (oldAttrs: { st = prev.st.overrideAttrs (oldAttrs: {