mirror of
https://github.com/LukeHagar/omarchy.git
synced 2025-12-09 12:37:46 +00:00
Add omarchy-cmd-share script/menu (#884)
* add: omarchy-cmd-share-files script * add: call script from main menu * add: hyprland binding for sharing files * fix: dispatcher syntax * fix: make script executable * fix: script name on main menu * fix: show share menu call * fix: dispatcher order * fix: script call via shorcut * fix: share shortcut and share class for alacritty * add parameters to share files, folders and clipboard content * do not clean tmp files in clipboard mode * make tmp file txts for clipboard sharing * add menu options for folder and clipboard sharing * rename script * shortcut opens walker share menu * fix spacing in share menu * fix: share menu calls * Files with spaces in the path were breaking 'send' action * Add Trigger menu to house capture/share/toggle * Style * Fix going straight to share menu on Ctrl + Super + S * Combine --------- Co-authored-by: David Heinemeier Hansson <david@hey.com>
This commit is contained in:
committed by
GitHub
parent
3986afd0c5
commit
f401c72ea2
44
bin/omarchy-cmd-share
Executable file
44
bin/omarchy-cmd-share
Executable file
@@ -0,0 +1,44 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if (($# == 0)); then
|
||||||
|
echo "Usage: omarchy-cmd-share [clipboard|file|folder]"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
MODE="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
if [[ $MODE == "clipboard" ]]; then
|
||||||
|
TEMP_FILE=$(mktemp --suffix=.txt)
|
||||||
|
wl-paste >"$TEMP_FILE"
|
||||||
|
FILES="$TEMP_FILE"
|
||||||
|
else
|
||||||
|
if (($# > 0)); then
|
||||||
|
FILES="$*"
|
||||||
|
else
|
||||||
|
if [[ $MODE == "folder" ]]; then
|
||||||
|
# Pick a single folder from home directory
|
||||||
|
FILES=$(find "$HOME" -type d 2>/dev/null | fzf)
|
||||||
|
else
|
||||||
|
# Pick one or more files from home directory
|
||||||
|
FILES=$(find "$HOME" -type f 2>/dev/null | fzf --multi)
|
||||||
|
fi
|
||||||
|
[ -z "$FILES" ] && exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run LocalSend in its own systemd service (detached from terminal)
|
||||||
|
# Convert newline-separated files to space-separated arguments
|
||||||
|
if [[ $MODE != "clipboard" ]] && echo "$FILES" | grep -q $'\n'; then
|
||||||
|
# Multiple files selected - convert newlines to array
|
||||||
|
readarray -t FILE_ARRAY <<<"$FILES"
|
||||||
|
systemd-run --user --quiet --collect localsend --headless send "${FILE_ARRAY[@]}"
|
||||||
|
else
|
||||||
|
# Single file or clipboard mode
|
||||||
|
systemd-run --user --quiet --collect localsend --headless send "$FILES"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Note: Temporary file will remain until system cleanup for clipboard mode
|
||||||
|
# This ensures the file content is available for the LocalSend GUI
|
||||||
|
|
||||||
|
exit 0
|
||||||
104
bin/omarchy-menu
104
bin/omarchy-menu
@@ -81,6 +81,62 @@ show_learn_menu() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
show_trigger_menu() {
|
||||||
|
case $(menu "Trigger" " Capture\n Share\n Toggle") in
|
||||||
|
*Capture*) show_capture_menu ;;
|
||||||
|
*Share*) show_share_menu ;;
|
||||||
|
*Toggle*) show_toggle_menu ;;
|
||||||
|
*) show_main_menu ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
show_capture_menu() {
|
||||||
|
case $(menu "Capture" " Screenshot\n Screenrecord\n Color") in
|
||||||
|
*Screenshot*) show_screenshot_menu ;;
|
||||||
|
*Screenrecord*) show_screenrecord_menu ;;
|
||||||
|
*Color*) pkill hyprpicker || hyprpicker -a ;;
|
||||||
|
*) show_trigger_menu ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
show_screenshot_menu() {
|
||||||
|
case $(menu "Screenshot" " Region\n Window\n Display") in
|
||||||
|
*Region*) omarchy-cmd-screenshot ;;
|
||||||
|
*Window*) omarchy-cmd-screenshot window ;;
|
||||||
|
*Display*) omarchy-cmd-screenshot output ;;
|
||||||
|
*) show_capture_menu ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
show_screenrecord_menu() {
|
||||||
|
case $(menu "Screenrecord" " Region\n Region + Audio\n Display\n Display + Audio") in
|
||||||
|
*"Region + Audio"*) omarchy-cmd-screenrecord region audio ;;
|
||||||
|
*Region*) omarchy-cmd-screenrecord ;;
|
||||||
|
*"Display + Audio"*) omarchy-cmd-screenrecord output audio ;;
|
||||||
|
*Display*) omarchy-cmd-screenrecord output ;;
|
||||||
|
*) show_capture_menu ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
show_share_menu() {
|
||||||
|
case $(menu "Share" " Clipboard\n File \n Folder") in
|
||||||
|
*Clipboard*) terminal bash -c "omarchy-cmd-share clipboard" ;;
|
||||||
|
*File*) terminal bash -c "omarchy-cmd-share file" ;;
|
||||||
|
*Folder*) terminal bash -c "omarchy-cmd-share folder" ;;
|
||||||
|
*) back_to show_trigger_menu ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
show_toggle_menu() {
|
||||||
|
case $(menu "Toggle" " Screensaver\n Nightlight\n Idle Lock\n Top Bar") in
|
||||||
|
*Screensaver*) omarchy-toggle-screensaver ;;
|
||||||
|
*Nightlight*) omarchy-toggle-nightlight ;;
|
||||||
|
*Idle*) omarchy-toggle-idle ;;
|
||||||
|
*Bar*) omarchy-toggle-waybar ;;
|
||||||
|
*) show_trigger_menu ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
show_style_menu() {
|
show_style_menu() {
|
||||||
case $(menu "Style" " Theme\n Font\n Background\n Hyprland\n Screensaver\n About") in
|
case $(menu "Style" " Theme\n Font\n Background\n Hyprland\n Screensaver\n About") in
|
||||||
*Theme*) show_theme_menu ;;
|
*Theme*) show_theme_menu ;;
|
||||||
@@ -111,44 +167,6 @@ show_font_menu() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
show_capture_menu() {
|
|
||||||
case $(menu "Capture" " Screenshot\n Screenrecord\n Color") in
|
|
||||||
*Screenshot*) show_screenshot_menu ;;
|
|
||||||
*Screenrecord*) show_screenrecord_menu ;;
|
|
||||||
*Color*) pkill hyprpicker || hyprpicker -a ;;
|
|
||||||
*) show_main_menu ;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
show_screenshot_menu() {
|
|
||||||
case $(menu "Screenshot" " Region\n Window\n Display") in
|
|
||||||
*Region*) omarchy-cmd-screenshot ;;
|
|
||||||
*Window*) omarchy-cmd-screenshot window ;;
|
|
||||||
*Display*) omarchy-cmd-screenshot output ;;
|
|
||||||
*) show_capture_menu ;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
show_screenrecord_menu() {
|
|
||||||
case $(menu "Screenrecord" " Region\n Region + Audio\n Display\n Display + Audio") in
|
|
||||||
*"Region + Audio"*) omarchy-cmd-screenrecord region audio ;;
|
|
||||||
*Region*) omarchy-cmd-screenrecord ;;
|
|
||||||
*"Display + Audio"*) omarchy-cmd-screenrecord output audio ;;
|
|
||||||
*Display*) omarchy-cmd-screenrecord output ;;
|
|
||||||
*) show_capture_menu ;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
show_toggle_menu() {
|
|
||||||
case $(menu "Toggle" " Screensaver\n Nightlight\n Idle Lock\n Top Bar") in
|
|
||||||
*Screensaver*) omarchy-toggle-screensaver ;;
|
|
||||||
*Nightlight*) omarchy-toggle-nightlight ;;
|
|
||||||
*Idle*) omarchy-toggle-idle ;;
|
|
||||||
*Bar*) omarchy-toggle-waybar ;;
|
|
||||||
*) show_main_menu ;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
show_setup_menu() {
|
show_setup_menu() {
|
||||||
local options=" Audio\n Wifi\n Bluetooth\n Power Profile\n Monitors"
|
local options=" Audio\n Wifi\n Bluetooth\n Power Profile\n Monitors"
|
||||||
[ -f ~/.config/hypr/bindings.conf ] && options="$options\n Keybindings"
|
[ -f ~/.config/hypr/bindings.conf ] && options="$options\n Keybindings"
|
||||||
@@ -343,7 +361,7 @@ show_remove_menu() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
show_update_menu() {
|
show_update_menu() {
|
||||||
case $(menu "Update" " Omarchy\n Config\n Themes\n Process\n Hardware\n Password\n Timezone") in
|
case $(menu "Update" " Omarchy\n Config\n Extra Themes\n Process\n Hardware\n Password\n Timezone") in
|
||||||
*Omarchy*) present_terminal omarchy-update ;;
|
*Omarchy*) present_terminal omarchy-update ;;
|
||||||
*Config*) show_update_config_menu ;;
|
*Config*) show_update_config_menu ;;
|
||||||
*Themes*) present_terminal omarchy-theme-update ;;
|
*Themes*) present_terminal omarchy-theme-update ;;
|
||||||
@@ -409,24 +427,24 @@ show_system_menu() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
show_main_menu() {
|
show_main_menu() {
|
||||||
go_to_menu "$(menu "Go" " Apps\n Learn\n Capture\n Toggle\n Style\n Setup\n Install\n Remove\n Update\n About\n System")"
|
go_to_menu "$(menu "Go" " Apps\n Trigger\n Style\n Setup\n Install\n Remove\n Update\n Learn\n About\n System")"
|
||||||
}
|
}
|
||||||
|
|
||||||
go_to_menu() {
|
go_to_menu() {
|
||||||
case "${1,,}" in
|
case "${1,,}" in
|
||||||
*apps*) walker -p "Launch…" ;;
|
*apps*) walker -p "Launch…" ;;
|
||||||
*learn*) show_learn_menu ;;
|
*trigger*) show_trigger_menu ;;
|
||||||
|
*share*) show_share_menu ;;
|
||||||
*style*) show_style_menu ;;
|
*style*) show_style_menu ;;
|
||||||
*theme*) show_theme_menu ;;
|
*theme*) show_theme_menu ;;
|
||||||
*capture*) show_capture_menu ;;
|
|
||||||
*screenshot*) show_screenshot_menu ;;
|
*screenshot*) show_screenshot_menu ;;
|
||||||
*screenrecord*) show_screenrecord_menu ;;
|
*screenrecord*) show_screenrecord_menu ;;
|
||||||
*toggle*) show_toggle_menu ;;
|
|
||||||
*setup*) show_setup_menu ;;
|
*setup*) show_setup_menu ;;
|
||||||
*power*) show_setup_power_menu ;;
|
*power*) show_setup_power_menu ;;
|
||||||
*install*) show_install_menu ;;
|
*install*) show_install_menu ;;
|
||||||
*remove*) show_remove_menu ;;
|
*remove*) show_remove_menu ;;
|
||||||
*update*) show_update_menu ;;
|
*update*) show_update_menu ;;
|
||||||
|
*learn*) show_learn_menu ;;
|
||||||
*about*) alacritty --class Omarchy -o font.size=9 -e bash -c 'fastfetch; read -n 1 -s' ;;
|
*about*) alacritty --class Omarchy -o font.size=9 -e bash -c 'fastfetch; read -n 1 -s' ;;
|
||||||
*system*) show_system_menu ;;
|
*system*) show_system_menu ;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
@@ -10,3 +10,4 @@ source = ~/.local/share/omarchy/default/hypr/apps/retroarch.conf
|
|||||||
source = ~/.local/share/omarchy/default/hypr/apps/steam.conf
|
source = ~/.local/share/omarchy/default/hypr/apps/steam.conf
|
||||||
source = ~/.local/share/omarchy/default/hypr/apps/system.conf
|
source = ~/.local/share/omarchy/default/hypr/apps/system.conf
|
||||||
source = ~/.local/share/omarchy/default/hypr/apps/walker.conf
|
source = ~/.local/share/omarchy/default/hypr/apps/walker.conf
|
||||||
|
source = ~/.local/share/omarchy/default/hypr/apps/localsend.conf
|
||||||
|
|||||||
3
default/hypr/apps/localsend.conf
Normal file
3
default/hypr/apps/localsend.conf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Float LocalSend and fzf file picker
|
||||||
|
windowrule = float, class:(Share|localsend)
|
||||||
|
windowrule = center, class:(Share|localsend)
|
||||||
@@ -42,3 +42,6 @@ bindd = CTRL ALT SHIFT, PRINT, Screen record display with audio, exec, omarchy-c
|
|||||||
|
|
||||||
# Color picker
|
# Color picker
|
||||||
bindd = SUPER, PRINT, Color picker, exec, pkill hyprpicker || hyprpicker -a
|
bindd = SUPER, PRINT, Color picker, exec, pkill hyprpicker || hyprpicker -a
|
||||||
|
|
||||||
|
# File sharing
|
||||||
|
bindd = CTRL SUPER, S, Share, exec, omarchy-menu share
|
||||||
|
|||||||
Reference in New Issue
Block a user