From bf8082002534ef948abda0bd12a30d3e6973f32b Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Thu, 8 Aug 2024 10:37:28 +0200 Subject: fish: wayland/x11 aware wl-copy/xsel --- .config/fish/config.fish | 8 +++++++- .config/fish/functions/sessiontype.fish | 8 ++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 .config/fish/functions/sessiontype.fish (limited to '.config/fish') diff --git a/.config/fish/config.fish b/.config/fish/config.fish index adcbe4a..e5e5ba8 100644 --- a/.config/fish/config.fish +++ b/.config/fish/config.fish @@ -31,7 +31,6 @@ if status is-interactive abbr --add --global bc 'bc -l' abbr --add --global bo 'bukuopener' abbr --add --global cp 'cp -i' - abbr --add --global C 'xsel -b' # Copy to clipboard abbr --add --global df 'df -h' abbr --add --global free 'free -m' abbr --add --global gst 'git status' @@ -60,6 +59,13 @@ if status is-interactive abbr --add --global wim 'nvim /home/yigit/nextcloud/personal_wiki/text/index.wiki' abbr --add --global yst 'yadm status' abbr --add --global dr 'dragon-drop' + abbr --add --global ddg 'surfraw duckduckgo -j' + + if test (sessiontype) = "wayland" + abbr --add --global C 'wl-copy' # Wayland + else + abbr --add --global C 'xsel -b' # X11 + end zoxide init fish | source direnv hook fish | source diff --git a/.config/fish/functions/sessiontype.fish b/.config/fish/functions/sessiontype.fish new file mode 100644 index 0000000..33830ca --- /dev/null +++ b/.config/fish/functions/sessiontype.fish @@ -0,0 +1,8 @@ +# https://unix.stackexchange.com/questions/202891/how-to-know-whether-wayland-or-x11-is-being-used/371164#comment573431_325972 + +function sessiontype + # https://unix.stackexchange.com/questions/202891/how-to-know-whether-wayland-or-x11-is-being-used/371164#comment573431_325972 + # have to run it first? + loginctl > /dev/null + loginctl show-session (loginctl | awk '/tty/ {print $1}') -p Type | awk -F= '{print $2}' +end -- cgit v1.2.3-70-g09d2