aboutsummaryrefslogtreecommitdiff
path: root/dotfiles
diff options
context:
space:
mode:
authorYaroslav <contact@yaroslavps.com>2020-08-23 15:44:34 +0300
committerYaroslav <contact@yaroslavps.com>2020-08-23 15:44:34 +0300
commitb94839324996ab3c9b0249eadc3930e54ffd1a86 (patch)
treefdd075a056165b29c0899896c4e4468db683a932 /dotfiles
parentb3318da576333bd5caf32506b6706638e40ca458 (diff)
downloadswayrice-b94839324996ab3c9b0249eadc3930e54ffd1a86.tar.gz
swayrice-b94839324996ab3c9b0249eadc3930e54ffd1a86.zip
Shortcuts to control my other computer through ssh
* Scripts to simplify executing of commands through ssh, and to send current computer's clipboard to the other one and viceversa. * sway shortcuts to control mpd, audio volume and clipboard data.
Diffstat (limited to 'dotfiles')
-rw-r--r--dotfiles/.config/sway/config21
-rwxr-xr-xdotfiles/.local/bin/clipremote15
-rwxr-xr-xdotfiles/.local/bin/exremote9
3 files changed, 44 insertions, 1 deletions
diff --git a/dotfiles/.config/sway/config b/dotfiles/.config/sway/config
index c8da8ea..2db1645 100644
--- a/dotfiles/.config/sway/config
+++ b/dotfiles/.config/sway/config
@@ -182,7 +182,6 @@ bindsym --to-code {
$mod+m exec $term -e ncmpcpp
$mod+n exec $term -e newsboat && killall -42 waybar
$mod+a exec $term -e aerc
- $mod+Ctrl+v exec $term -e vis
$mod+o exec --no-startup-id notistats
$mod+c exec --no-startup-id camtoggle
$mod+grave exec --no-startup-id menuemoji
@@ -342,6 +341,26 @@ bindsym --to-code {
$mod+Shift+period gaps outer current minus 5
$mod+comma gaps inner current plus 5
$mod+Shift+comma gaps inner current minus 5
+
+ #### Shortcuts to control my other computer through ssh ####
+
+ # Media keys
+ $mod+XF86AudioPrev exec --no-startup-id exremote "lmc prev"
+ $mod+XF86AudioPlay exec --no-startup-id exremote "lmc toggle"
+ $mod+XF86AudioNext exec --no-startup-id exremote "lmc next"
+ $mod+XF86AudioRaiseVolume exec --no-startup-id exremote "lmc up 5"
+ $mod+XF86AudioLowerVolume exec --no-startup-id exremote "lmc down 5"
+ $mod+XF86AudioMute exec --no-startup-id exremote "lmc mute"
+
+ $mod+Ctrl+Shift+F5 exec exremote "mpc seek -10"
+ $mod+Ctrl+F5 exec exremote "lmc prev"
+ $mod+Ctrl+F6 exec exremote "lmc toggle"
+ $mod+Ctrl+F7 exec exremote "lmc next"
+ $mod+Ctrl+Shift+F7 exec exremote "mpc seek +10"
+
+ # Remote computer's clipboard
+ $mod+Ctrl+c exec clipremote copy
+ $mod+Ctrl+v exec clipremote paste
}
# bar {
diff --git a/dotfiles/.local/bin/clipremote b/dotfiles/.local/bin/clipremote
new file mode 100755
index 0000000..2dc2295
--- /dev/null
+++ b/dotfiles/.local/bin/clipremote
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Helper script to retrieve and send clipboard data to/from remote host
+
+action="copy"
+[ -n "$1" ] && action="$1"
+
+case "$action" in
+ copy)
+ exremote "wl-copy '$(wl-paste)'";;
+ paste)
+ exremote "wl-paste" | wl-copy --trim-newline;;
+ *)
+ echo "$1 is not a valid action";;
+esac
diff --git a/dotfiles/.local/bin/exremote b/dotfiles/.local/bin/exremote
new file mode 100755
index 0000000..a6bbbbb
--- /dev/null
+++ b/dotfiles/.local/bin/exremote
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# Helper script to execute commands on remote host
+
+[ -n "$1" ] || (echo "Specify command to run" && exit 0)
+
+host=$(cat $HOME/.config/exremote/host)
+
+ssh "$host" "source /home/$(whoami)/.profile 2> /dev/null && $1"