summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/fetch-salt-from-emacs.sh13
-rwxr-xr-xscripts/push-salt-to-emacs.sh11
-rw-r--r--scripts/qubes-i3-sensible-terminal35
3 files changed, 59 insertions, 0 deletions
diff --git a/scripts/fetch-salt-from-emacs.sh b/scripts/fetch-salt-from-emacs.sh
new file mode 100644
index 0000000..9e64de8
--- /dev/null
+++ b/scripts/fetch-salt-from-emacs.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/bash
+if [ "$EUID" -ne 0 ]
+ then echo "Please run as root"
+ exit
+fi
+qvm-run emacs-salt 'mv /home/user/Documents/salt-repo/.git /tmp/salt.git'
+qvm-run emacs-salt 'cd /home/user/Documents && tar -cf /tmp/salt.tar salt-repo'
+qvm-run emacs-salt 'mv /tmp/salt.git /home/user/Documents/salt-repo/.git'
+qvm-run --pass-io emacs-salt 'cat /tmp/salt.tar' > /tmp/salt.tar && qvm-run emacs-salt 'rm /tmp/salt.tar'
+rm -fr /root/user_salt.bak
+mv /srv/user_salt /root/user_salt.bak
+cd /tmp && tar -xf /tmp/salt.tar
+mv /tmp/salt-repo /srv/user_salt
diff --git a/scripts/push-salt-to-emacs.sh b/scripts/push-salt-to-emacs.sh
new file mode 100755
index 0000000..c9e6bba
--- /dev/null
+++ b/scripts/push-salt-to-emacs.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/bash
+if [ "$EUID" -ne 0 ]
+ then echo "Please run as root"
+ exit
+fi
+qvm-copy-to-vm emacs-salt /srv/user_salt
+qvm-run emacs-salt 'mv /home/user/Documents/salt-repo/.git /tmp/salt.git'
+qvm-run emacs-salt 'rm -fr /home/user/Documents/salt-repo/*'
+qvm-run emacs-salt 'mv /tmp/salt.git /home/user/Documents/salt-repo/.git'
+qvm-run emacs-salt 'mv /home/user/QubesIncoming/dom0/user_salt/* /home/user/Documents/salt-repo/'
+qvm-run emacs-salt 'rm -fr /home/user/QubesIncoming/dom0/user_salt'
diff --git a/scripts/qubes-i3-sensible-terminal b/scripts/qubes-i3-sensible-terminal
new file mode 100644
index 0000000..5311dc1
--- /dev/null
+++ b/scripts/qubes-i3-sensible-terminal
@@ -0,0 +1,35 @@
+#!/usr/bin/bash
+# Slightly modified from original to prioritize xfce4-terminal and st
+
+run_terminal='
+for t in "$TERMINAL" xfce4-terminal st x-terminal-emulator urxvt rxvt termit terminator Eterm aterm gnome-terminal konsole roxterm termite lxterminal mate-terminal terminology xterm; do
+ command -v "$t" > /dev/null 2>&1 && exec "$t";
+done
+'
+
+get_id() {
+ local id=$(xprop -root _NET_ACTIVE_WINDOW)
+ echo ${id##* } # extract id
+}
+
+get_vm() {
+ local id=$(get_id)
+ local vm=$(xprop -id $id | grep '_QUBES_VMNAME(STRING)')
+ local vm=${vm#*\"} # extract vmname
+ echo ${vm%\"*} # extract vmname
+}
+
+main() {
+ local vm=$(get_vm)
+ if [[ -n "$vm" ]]; then
+ if command -v qrexec-client >/dev/null; then
+ qrexec-client -e -d "$vm" DEFAULT:"bash -c '$run_terminal'"
+ else
+ qvm-run "$vm" qvm-run "$vm" "bash -c '$run_terminal'"
+ fi
+ else # run terminal in dom0
+ exec bash -c "$run_terminal"
+ fi
+}
+
+main