added cliphist package, replaced calculator on toolbelt with a fzf clipboard history thing
This commit is contained in:
@@ -1,12 +1,16 @@
|
|||||||
{
|
{
|
||||||
username,
|
username,
|
||||||
host,
|
host,
|
||||||
scheme,
|
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
desktop = (host == "oganesson");
|
desktop = (host == "oganesson");
|
||||||
|
screenshot_bind = if desktop then [ # My laptop does not have a printscreen button
|
||||||
|
"super, print, exec, grimblast copy area"
|
||||||
|
] else [
|
||||||
|
"super, insert, exec, grimblast copy area"
|
||||||
|
];
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
wayland.windowManager.hyprland = {
|
wayland.windowManager.hyprland = {
|
||||||
@@ -24,7 +28,8 @@ in
|
|||||||
exec-once = [
|
exec-once = [
|
||||||
"waybar &"
|
"waybar &"
|
||||||
"swaync &"
|
"swaync &"
|
||||||
"wl-paste --watch cliphist store &"
|
"wl-paste --type text --watch cliphist store &"
|
||||||
|
"wl-paste --type image --watch cliphist store &"
|
||||||
"wl-clip-persist --clipboard both"
|
"wl-clip-persist --clipboard both"
|
||||||
"systemctl --user import-environment &"
|
"systemctl --user import-environment &"
|
||||||
"hash dbus-update-activation-environment 2>/dev/null &"
|
"hash dbus-update-activation-environment 2>/dev/null &"
|
||||||
@@ -166,7 +171,6 @@ in
|
|||||||
bind = [
|
bind = [
|
||||||
"super, up, exec, pactl set-sink-volume @default_sink@ +10%"
|
"super, up, exec, pactl set-sink-volume @default_sink@ +10%"
|
||||||
"super, down, exec, pactl set-sink-volume @default_sink@ -10%"
|
"super, down, exec, pactl set-sink-volume @default_sink@ -10%"
|
||||||
"super, print, exec, grimblast copy area"
|
|
||||||
"super, t, exec, swaync-client -t -sw"
|
"super, t, exec, swaync-client -t -sw"
|
||||||
"super, a, exec, firefox"
|
"super, a, exec, firefox"
|
||||||
"super, q, exec, kitty --title Kitty"
|
"super, q, exec, kitty --title Kitty"
|
||||||
@@ -203,7 +207,7 @@ in
|
|||||||
"super shift, 6, movetoworkspace, 6"
|
"super shift, 6, movetoworkspace, 6"
|
||||||
"super, s, togglespecialworkspace, magic"
|
"super, s, togglespecialworkspace, magic"
|
||||||
"super shift, s, movetoworkspace, special:magic"
|
"super shift, s, movetoworkspace, special:magic"
|
||||||
];
|
] ++ screenshot_bind;
|
||||||
bindm = [
|
bindm = [
|
||||||
"super, mouse:272, movewindow"
|
"super, mouse:272, movewindow"
|
||||||
"super, mouse:273, resizewindow"
|
"super, mouse:273, resizewindow"
|
||||||
|
|||||||
@@ -1,25 +1,19 @@
|
|||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
|
|
||||||
pkgs.writeShellScriptBin "toolbelt" ''
|
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
|
|
||||||
}
|
|
||||||
|
|
||||||
hostname=$(cat /etc/hostname)
|
hostname=$(cat /etc/hostname)
|
||||||
|
|
||||||
|
cliphistory() {
|
||||||
|
cliphist list | fzf --preview="
|
||||||
|
index=\$(echo {} | awk '{print \$1}'); \
|
||||||
|
mime=\$(cliphist decode \$index | file -i -); \
|
||||||
|
if echo \"\$mime\" | grep -q 'image'; then \
|
||||||
|
echo \$(cliphist list | rg \"^\$index\" | cut -d ' ' -f 2- | fmt -w 30); \
|
||||||
|
else \
|
||||||
|
cliphist decode \"\$index\" | fmt -w 30; \
|
||||||
|
fi
|
||||||
|
" --prompt="> " | wl-copy
|
||||||
|
}
|
||||||
btop_cmd() {
|
btop_cmd() {
|
||||||
if [ "$hostname" = 'oganesson' ]; then
|
if [ "$hostname" = 'oganesson' ]; then
|
||||||
hyprctl dispatch resizeactive 20% 140% &&
|
hyprctl dispatch resizeactive 20% 140% &&
|
||||||
@@ -44,12 +38,21 @@ declare -A commands=(
|
|||||||
["Open System Monitor"]="hyprctl dispatch resizeactive 20% 140% && moveonscreen --center && btop_cmd && hyprctl dispatch resizeactive exact 40% 25% && moveonscreen"
|
["Open System Monitor"]="hyprctl dispatch resizeactive 20% 140% && moveonscreen --center && btop_cmd && hyprctl dispatch resizeactive exact 40% 25% && moveonscreen"
|
||||||
["Open Volume Controls"]="hyprctl dispatch resizeactive 10% 80% && moveonscreen --center && alsamixer && hyprctl dispatch resizeactive exact 40% 25% && moveonscreen"
|
["Open Volume Controls"]="hyprctl dispatch resizeactive 10% 80% && moveonscreen --center && alsamixer && hyprctl dispatch resizeactive exact 40% 25% && moveonscreen"
|
||||||
["Open Keyring"]="hyprctl dispatch resizeactive -300 0 && moveonscreen && if keyring; then running=false; else hyprctl dispatch resizeactive exact 40% 25% && moveonscreen; fi"
|
["Open Keyring"]="hyprctl dispatch resizeactive -300 0 && moveonscreen && if keyring; then running=false; else hyprctl dispatch resizeactive exact 40% 25% && moveonscreen; fi"
|
||||||
["Calculator"]="calc"
|
["View Clipboard History"]="hyprctl dispatch resizeactive 45% 120% && moveonscreen --center && if cliphistory;then running=false; else hyprctl dispatch resizeactive exact 40% 25% && moveonscreen; fi"
|
||||||
|
)
|
||||||
|
|
||||||
|
ordered_commands=(
|
||||||
|
"Open Keyring"
|
||||||
|
"Open System Monitor"
|
||||||
|
"Open Volume Controls"
|
||||||
|
"Change Wallpaper"
|
||||||
|
"Change System Color Scheme"
|
||||||
|
"View Clipboard History"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Use fzf to select a command with preview
|
# Use fzf to select a command with preview
|
||||||
while $running; do
|
while $running; do
|
||||||
selected_command=$(printf "%s\n" "''${!commands[@]}" | fzf --preview="
|
selected_command=$(printf "%s\n" "''${ordered_commands[@]}" | fzf --preview="
|
||||||
cleaned_key=\$(echo {} | tr -d \"'\"); \
|
cleaned_key=\$(echo {} | tr -d \"'\"); \
|
||||||
echo \"Cleaned key: \$cleaned_key\"; \
|
echo \"Cleaned key: \$cleaned_key\"; \
|
||||||
declare -A descriptions=(
|
declare -A descriptions=(
|
||||||
@@ -58,7 +61,7 @@ declare -A descriptions=(
|
|||||||
[\"Open System Monitor\"]=\"Opens a btop window.\"
|
[\"Open System Monitor\"]=\"Opens a btop window.\"
|
||||||
[\"Open Volume Controls\"]=\"Opens alsamixer.\"
|
[\"Open Volume Controls\"]=\"Opens alsamixer.\"
|
||||||
[\"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.\"
|
[\"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.\"
|
[\"View Clipboard History\"]=\"Opens clipboard history. Selecting an item copies it to the clipboard.\"
|
||||||
); \
|
); \
|
||||||
if [[ -v descriptions[\$cleaned_key] ]]; then \
|
if [[ -v descriptions[\$cleaned_key] ]]; then \
|
||||||
clear; \
|
clear; \
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
cabal-install
|
cabal-install
|
||||||
clang
|
clang
|
||||||
clang-tools
|
clang-tools
|
||||||
|
cliphist
|
||||||
cmake
|
cmake
|
||||||
fail2ban
|
fail2ban
|
||||||
feh
|
feh
|
||||||
|
|||||||
Reference in New Issue
Block a user