From 8c660746de871b7f6967ff0d734b79658954b38d Mon Sep 17 00:00:00 2001 From: Madeleine Date: Sun, 12 Mar 2023 18:44:14 +0000 Subject: [PATCH] scripting, formatting and fixes --- maddie/bosskey.nix | 2 +- maddie/btop.nix | 2 +- maddie/dmenu/dmenu-kdeconnect | 41 ++++++++++++++++++++++++++++ maddie/git.nix | 2 +- maddie/gtk.nix | 4 +++ maddie/neovim.nix | 2 +- maddie/screenshot.nix | 4 +-- maddie/screenshot/{sst.sh => sss.sh} | 0 maddie/steam.nix | 2 +- overlays.nix | 4 +-- 10 files changed, 54 insertions(+), 9 deletions(-) create mode 100755 maddie/dmenu/dmenu-kdeconnect rename maddie/screenshot/{sst.sh => sss.sh} (100%) diff --git a/maddie/bosskey.nix b/maddie/bosskey.nix index b4a55d2..439baed 100644 --- a/maddie/bosskey.nix +++ b/maddie/bosskey.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ...}: +{ config, pkgs, ... }: { home.packages = with pkgs; [ diff --git a/maddie/btop.nix b/maddie/btop.nix index 0b25080..4de9137 100644 --- a/maddie/btop.nix +++ b/maddie/btop.nix @@ -1,4 +1,4 @@ -{ config, ...}: +{ config, ... }: { programs.btop = { diff --git a/maddie/dmenu/dmenu-kdeconnect b/maddie/dmenu/dmenu-kdeconnect new file mode 100755 index 0000000..092b7e5 --- /dev/null +++ b/maddie/dmenu/dmenu-kdeconnect @@ -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 diff --git a/maddie/git.nix b/maddie/git.nix index 8e058d0..8e19adc 100644 --- a/maddie/git.nix +++ b/maddie/git.nix @@ -18,7 +18,7 @@ userName = "Madeleine"; userEmail = "maddie@spyhoodle.me"; signing = { - key = "33CC62D0ED495156FF5FCC550C7CB348221D0AEF"; + key = "467EFD918D5E770AD1EE2CE699CD1AB536E1C7AD"; signByDefault = true; gpgPath = "gpg2"; }; diff --git a/maddie/gtk.nix b/maddie/gtk.nix index 2ae6a26..c559255 100644 --- a/maddie/gtk.nix +++ b/maddie/gtk.nix @@ -17,4 +17,8 @@ name = "Zafiro-icons-Dark"; }; }; + + home.packages = with pkgs; [ + gnome.zenity + ]; } diff --git a/maddie/neovim.nix b/maddie/neovim.nix index 7916dee..e9164ca 100644 --- a/maddie/neovim.nix +++ b/maddie/neovim.nix @@ -20,7 +20,7 @@ neovide ]; - xdg.configFile."nvim" = { + xdg.configFile."nvim" = { source = ./neovim; recursive = true; }; diff --git a/maddie/screenshot.nix b/maddie/screenshot.nix index efd34d8..31e3134 100644 --- a/maddie/screenshot.nix +++ b/maddie/screenshot.nix @@ -6,8 +6,8 @@ maim # X11 screenshot tool ]; - home.file.".local/bin/sst" = { - source = ./screenshot/sst.sh; + home.file.".local/bin/sss" = { + source = ./screenshot/sss.sh; executable = true; }; } diff --git a/maddie/screenshot/sst.sh b/maddie/screenshot/sss.sh similarity index 100% rename from maddie/screenshot/sst.sh rename to maddie/screenshot/sss.sh diff --git a/maddie/steam.nix b/maddie/steam.nix index 6a3c994..0594128 100644 --- a/maddie/steam.nix +++ b/maddie/steam.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ...}: +{ config, pkgs, ... }: { home.packages = with pkgs; [ diff --git a/overlays.nix b/overlays.nix index 0a4e9bd..a4e4b6f 100644 --- a/overlays.nix +++ b/overlays.nix @@ -5,8 +5,8 @@ src = final.fetchFromGitHub { owner = "SpyHoodle"; repo = "dwm"; - rev = "e62a49b77e9490e47200b7778c5086c4dff969a9"; - sha256 = "sha256-V0tadjoEq/esz708cjfpbBBVqIActYRXKn9yNEeUKLU="; + rev = "7dab824afc125afba150949f12f38def1ffd47a8"; + sha256 = "sha256-qINiKWz8+POCjOL5UA7Mrxw4ZZgJ5D1eGatN1RCeE9M="; }; }); st = prev.st.overrideAttrs (oldAttrs: {