aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2020-07-19 18:23:52 +0200
committerFlorian Fischer <florian.fl.fischer@fau.de>2020-07-19 18:23:52 +0200
commitcea5407f200ca3101ae0142ec51539a4045d2145 (patch)
tree721a6e2103b5817f4969e9cdb2732cdbd34630e1
parent55723002efb42a0e8d9e8571f75d119d52beb2ed (diff)
downloaddotfiles-cea5407f200ca3101ae0142ec51539a4045d2145.tar.gz
dotfiles-cea5407f200ca3101ae0142ec51539a4045d2145.zip
[sway] support opening primary selection in browser
-rw-r--r--config/sway/config4
-rwxr-xr-xscripts/open_primary_in_browser.sh11
2 files changed, 14 insertions, 1 deletions
diff --git a/config/sway/config b/config/sway/config
index 2b83153..a0bf392 100644
--- a/config/sway/config
+++ b/config/sway/config
@@ -121,6 +121,10 @@ input "1:1:AT_Translated_Set_2_keyboard" {
# exit sway (logs you out of your Wayland session)
bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'
+
+ # open primary selection in browser
+ bindsym $mod+Shift+o exec $DOTFILES_LOCATION/scripts/open_primary_in_browser.sh
+
#
# Moving around:
#
diff --git a/scripts/open_primary_in_browser.sh b/scripts/open_primary_in_browser.sh
index 9fb05d6..9ae8243 100755
--- a/scripts/open_primary_in_browser.sh
+++ b/scripts/open_primary_in_browser.sh
@@ -1,3 +1,12 @@
#!/bin/bash
-eval $BROWSER $(xclip -o -selection primary)
+PRIMARY=""
+
+if [[ ! -z "$WAYLAND_DISPLAY" ]]
+then
+ PRIMARY=$(wl-paste -p)
+else
+ PRIMARY=$(xclip -o -selection primary)
+fi
+
+eval $BROWSER "$PRIMARY"