aboutsummaryrefslogtreecommitdiff
path: root/conf.d
diff options
context:
space:
mode:
Diffstat (limited to 'conf.d')
-rw-r--r--conf.d/00functions.fish10
-rw-r--r--conf.d/05gui.fish28
2 files changed, 24 insertions, 14 deletions
diff --git a/conf.d/00functions.fish b/conf.d/00functions.fish
index f390b29..d1ad87b 100644
--- a/conf.d/00functions.fish
+++ b/conf.d/00functions.fish
@@ -34,3 +34,13 @@ function find_prog --description "Find one or more programs in \$PATH"
end
end
end
+
+function ask --description "Ask a question answered by yes or no"
+ read -n 1 -f -P (set_color -o blue)"::"(set_color normal)" $argv[1] [y/N] " answer
+ switch $answer
+ case y Y
+ return 0 # yes
+ case '*'
+ return 1 # no
+ end
+end
diff --git a/conf.d/05gui.fish b/conf.d/05gui.fish
index 68599ce..9fc0629 100644
--- a/conf.d/05gui.fish
+++ b/conf.d/05gui.fish
@@ -1,17 +1,17 @@
-if status is-interactive; and not fish_is_root_user
+if not fish_is_root_user
-if set -q WAYLAND_DISPLAY
- alias_if wl-copy ccpy
- alias_if wl-paste cpst
- alias_if notify notify-send
-else if set -q DISPLAY
- alias_if xclip ccpy -i -selection clipboard
- alias_if xclip cpst -o -selection clipboard
- alias_if notify-send notify
-else if test (uname) = 'Darwin'
- alias_if pbcopy ccpy
- alias_if pbpaste cpst
- alias_if osascript notify -e
-end
+ if set -q WAYLAND_DISPLAY
+ alias_if wl-copy ccpy
+ alias_if wl-paste cpst
+ alias_if notify-send notify
+ else if set -q DISPLAY
+ alias_if xclip ccpy -i -selection clipboard
+ alias_if xclip cpst -o -selection clipboard
+ alias_if notify-send notify
+ else if string match -q 'Darwin' (uname)
+ alias_if pbcopy ccpy
+ alias_if pbpaste cpst
+ alias_if osascript notify -e
+ end
end