replaced keyring bind with a sort of control panel thing with several system related options like changing the wallpaper, managing volume controls, etc. also has a calculator
This commit is contained in:
@@ -45,7 +45,7 @@
|
||||
base16scheme = "nord"; # can be easily changed with the chscheme script
|
||||
|
||||
# Map colors from yaml to attribute set
|
||||
# Extracting colors into a set here allows them to be propagated across the entire config
|
||||
# Extracting colors into a set here allows them to be propagated across the entire config, with or without stylix
|
||||
lib = nixpkgs.lib;
|
||||
pkgs = import nixpkgs { system = "x86_64-linux"; };
|
||||
scheme_path = "${pkgs.base16-schemes}/share/themes/${base16scheme}.yaml";
|
||||
|
||||
@@ -160,9 +160,7 @@ in
|
||||
"super, q, exec, kitty --title Kitty"
|
||||
"super, d, exec, switchmon"
|
||||
"super, c, killactive,"
|
||||
"super, e, exec, [float;size 45% 70%;move 10 50] kitty btop"
|
||||
"super, n, exec, [float;size 50% 35%;move 10 50] pavucontrol"
|
||||
"super, p, exec, [float;size 25% 30%;move onscreen cursor 20 20] [ ! -f /tmp/keyringfile ] && kitty keyring"
|
||||
"super, p, exec, [float;size 35% 35%;move onscreen cursor] [ ! -f /tmp/keyringfile ] && kitty toolbelt"
|
||||
"super, 0, exec, aplay ~/assets/sound/soundtest.wav"
|
||||
"super shift, q, exit,"
|
||||
"super, m, exec, fuzzel"
|
||||
|
||||
83
modules/home/scripts/commands/toolbelt.nix
Normal file
83
modules/home/scripts/commands/toolbelt.nix
Normal file
@@ -0,0 +1,83 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
pkgs.writeShellScriptBin "toolbelt" ''
|
||||
calc() {
|
||||
echo "Give me some math"
|
||||
read input
|
||||
|
||||
answer=$(echo "$input" | bc)
|
||||
|
||||
if [ "$input" = "9+10" ] \
|
||||
|| [ "$input" = "9 +10" ] \
|
||||
|| [ "$input" = "9+ 10" ] \
|
||||
|| [ "$input" = "9 + 10" ]; then
|
||||
answer="21"
|
||||
fi
|
||||
echo "$input = $answer"
|
||||
echo "$answer" | wl-copy
|
||||
echo "answer copied to clipboard. press any key to exit."
|
||||
read -n 1 -s
|
||||
}
|
||||
|
||||
chpaper() {
|
||||
paper="$\{self}/assets/wallpapers/$(find "$FLAKEPATH"/assets/wallpapers -exec basename {} \; | rg "\.\w+$" | fzf --preview "chafa -s 30x40 $FLAKEPATH/assets/wallpapers/{}")"
|
||||
[ "$paper" = "$\{self}/assets/wallpapers/" ] && echo "Cancelling wallpaper change" && exit 0
|
||||
echo "$paper" | xargs -I {} sed -i '/wallpaper =/s|"[^"]*"|"{}"|' "$FLAKEPATH"/flake.nix
|
||||
echo "Successfully changed wallpaper. Rebuild now?" && \
|
||||
select choice in "Yes" "No"; do
|
||||
case $choice in
|
||||
"Yes")
|
||||
rebuild;pkill -9 hyprpaper;exit 0;;
|
||||
"No")
|
||||
echo "Exiting...";exit 0;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
declare -A commands=(
|
||||
["Change Wallpaper"]="chpaper"
|
||||
["Change System Color Scheme"]="exec hyprctl dispatch exec '[float;size 50% 70%;move onscreen cursor -50% -50%] kitty chscheme'"
|
||||
["Open System Monitor"]="exec hyprctl dispatch exec '[float;size 50% 70%;move onscreen cursor -50% -50%] kitty btop'"
|
||||
["Open Volume Controls"]="exec hyprctl dispatch exec '[float;size 50% 70%;move onscreen cursor -50% -50%] pavucontrol'"
|
||||
["Open Keyring"]="exec hyprctl dispatch exec '[float;size 25% 30%;move onscreen cursor 20 20] [ ! -f /tmp/keyringfile ] && kitty keyring'"
|
||||
["Calculator"]="calc"
|
||||
)
|
||||
|
||||
declare -A descriptions=(
|
||||
["Change Wallpaper"]="Choose a wallpaper to switch to from \$FLAKEPATH/assets/wallpapers. Requires rebuilding the system and restarting hyprpaper."
|
||||
["Change System Color Scheme"]="Changes the base16 color scheme used by stylix to color system applications."
|
||||
["Open System Monitor"]="Opens a btop window."
|
||||
["Open Volume Controls"]="Opens pavucontrol."
|
||||
["Open Keyring"]="Opens a fuzzy finder with all of the paths held in ~/.password-store. Selecting one uses pass to copy that password to the clipboard. Password is cleared from clipboard history after 45 seconds."
|
||||
["Calculator"]="Wrapper for bc. Output is copied to the clipboard."
|
||||
)
|
||||
|
||||
# Export the descriptions array so it's available to the subshell
|
||||
export -A descriptions
|
||||
|
||||
# Use fzf to select a command with preview
|
||||
selected_command=$(printf "%s\n" "''${!commands[@]}" | fzf --preview="
|
||||
cleaned_key=\$(echo {} | tr -d \"'\"); \
|
||||
echo \"Cleaned key: \$cleaned_key\"; \
|
||||
declare -A descriptions=(
|
||||
[\"Change Wallpaper\"]=\"Choose a wallpaper to switch to from the assets/wallpapers folder in the system flake directory. Requires rebuilding the system and restarting hyprpaper.\"
|
||||
[\"Change System Color Scheme\"]=\"Changes the base16 color scheme used by stylix to color system applications.\"
|
||||
[\"Open System Monitor\"]=\"Opens a btop window.\"
|
||||
[\"Open Volume Controls\"]=\"Opens pavucontrol.\"
|
||||
[\"Open Keyring\"]=\"Opens a fuzzy finder with all of the paths held in ~/.password-store. Selecting one uses pass to copy that password to the clipboard. Password is cleared from clipboard history after 45 seconds.\"
|
||||
[\"Calculator\"]=\"Wrapper for bc. Output is copied to the clipboard.\"
|
||||
); \
|
||||
if [[ -v descriptions[\$cleaned_key] ]]; then \
|
||||
clear; \
|
||||
echo \''${descriptions[\$cleaned_key]} | fmt -w 28; \
|
||||
else \
|
||||
clear; \
|
||||
echo \"No description available\"; \
|
||||
fi" --prompt="> ")
|
||||
|
||||
|
||||
#Execute the selected command if selection is not empty
|
||||
if [[ -n $selected_command ]]; then
|
||||
eval "''${commands[$selected_command]}"
|
||||
fi
|
||||
''
|
||||
@@ -6,7 +6,7 @@ pkgs.writeShellScriptBin "viconf" ''
|
||||
#!/usr/bin/env bash
|
||||
|
||||
[ ! $# -eq 1 ] && echo "Usage: viconf <*.nix>" && exit 1
|
||||
results=$(find "$FLAKEPATH" -name "*$1*" -exec find {} \; | sort | uniq | rg '\.nix$')
|
||||
results=$(find "$FLAKEPATH" -wholename "*$1*" -exec find {} \; | sort | uniq | rg '\.nix$')
|
||||
numresults=$(echo "$results" | wc -l)
|
||||
[ "$numresults" -eq 0 ] && echo "$1 not found in \$FLAKEPATH" && exit 1
|
||||
if [ "$numresults" -gt 1 ]; then
|
||||
|
||||
@@ -86,6 +86,7 @@
|
||||
self = self;
|
||||
pkgs = pkgs;
|
||||
};
|
||||
toolbelt = import ./commands/toolbelt.nix { pkgs = pkgs; };
|
||||
viconf = import ./commands/viconf.nix {
|
||||
pkgs = pkgs;
|
||||
};
|
||||
@@ -116,6 +117,7 @@ in {
|
||||
toggle_float
|
||||
toggle_oppacity
|
||||
toggle_waybar
|
||||
toolbelt
|
||||
viconf
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user