mirror of
https://github.com/RyanGreenup/cadmus.git
synced 2025-08-19 12:21:42 +02:00
[Fix] Detect Clipboard Based on kernal name #1
This commit is contained in:
42
bin/cadmus
42
bin/cadmus
@@ -33,8 +33,7 @@ function setvars() {
|
|||||||
readonly TERMINAL="kitty"
|
readonly TERMINAL="kitty"
|
||||||
readonly TERMINAL_EXEC='kitty -- '
|
readonly TERMINAL_EXEC='kitty -- '
|
||||||
|
|
||||||
CLIP_IN () { xclip -selection clipboard ; }
|
setClipboard
|
||||||
CLIP_OUT () { xclip -selection clipboard -o ; }
|
|
||||||
|
|
||||||
readonly NOTES_DIR="$(cat "${CONFIG}" | jq -r '.notesDir')"
|
readonly NOTES_DIR="$(cat "${CONFIG}" | jq -r '.notesDir')"
|
||||||
readonly SERVER_DIR="$(cat "${CONFIG}" | jq -r '.serverDir')"
|
readonly SERVER_DIR="$(cat "${CONFIG}" | jq -r '.serverDir')"
|
||||||
@@ -42,6 +41,45 @@ function setvars() {
|
|||||||
readonly MKDOCS_YML="$(cat "${CONFIG}" | jq -r '.mkdocsConfigDir')" ## This may be above the notes directory, the
|
readonly MKDOCS_YML="$(cat "${CONFIG}" | jq -r '.mkdocsConfigDir')" ## This may be above the notes directory, the
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setClipboard () {
|
||||||
|
|
||||||
|
case "$(uname -s)" in
|
||||||
|
|
||||||
|
Darwin)
|
||||||
|
CLIP_IN () { pbcopy ; }
|
||||||
|
CLIP_OUT () { pbpaste ; }
|
||||||
|
;;
|
||||||
|
|
||||||
|
Linux|GNU|*BSD|SunOS)
|
||||||
|
## "$XDG_SESSION_TYPE" not always defined
|
||||||
|
if [[ "$( loginctl show-session $(loginctl | grep $(whoami) | awk '{print $1}') -p Type | rg 'wayland' )" ]]; then
|
||||||
|
CLIP_IN () { wl-copy ; }
|
||||||
|
CLIP_OUT () { wl-paste ; }
|
||||||
|
else
|
||||||
|
CLIP_IN () { xclip -selection clipboard ; }
|
||||||
|
CLIP_OUT () { xclip -selection clipboard -o ; }
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
CYGWIN*|MINGW32*|MSYS*|MINGW*)
|
||||||
|
CLIP_IN () { xclip -selection clipboard ; }
|
||||||
|
CLIP_OUT () { xclip -selection clipboard -o ; }
|
||||||
|
;;
|
||||||
|
|
||||||
|
# Add here more strings to compare
|
||||||
|
# See correspondence table at the bottom of this answer
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "Could not Detect OS, if you're not on Mac/Linux, file a bug please"
|
||||||
|
echo "Applying Linux Defaults"
|
||||||
|
CLIP_IN () { xclip -selection clipboard ; }
|
||||||
|
CLIP_OUT () { xclip -selection clipboard -o ; }
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# * Sub-functions
|
# * Sub-functions
|
||||||
# ** MainMenu
|
# ** MainMenu
|
||||||
|
Reference in New Issue
Block a user