From 1b3dad4212e6e6473ea13330cf0e43b98a0dff46 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Tue, 1 Mar 2022 21:38:50 -0800 Subject: Add script to connect to remote desktop --- herbstluftwm/usr/share/scsh/herbstluft.scm | 14 ++++++++++++++ work/usr/bin/r-twillemse2223 | 24 ++++++++++++++++++++++++ zsh/profile.org | 8 ++++++++ 3 files changed, 46 insertions(+) create mode 100644 herbstluftwm/usr/share/scsh/herbstluft.scm create mode 100755 work/usr/bin/r-twillemse2223 diff --git a/herbstluftwm/usr/share/scsh/herbstluft.scm b/herbstluftwm/usr/share/scsh/herbstluft.scm new file mode 100644 index 0000000..98dc6c0 --- /dev/null +++ b/herbstluftwm/usr/share/scsh/herbstluft.scm @@ -0,0 +1,14 @@ +(define-structure herbstluft (export hc hc-get-attr) + (open scheme-with-scsh + (subset srfi-13 (string-trim-both))) + (begin + (define-syntax hc + (syntax-rules () + ((_ a ...) + (herbstclient `(a ...))))) + + (define (herbstclient args) + (run (herbstclient ,@args))) + + (define (hc-get-attr arg) + (string-trim-both (run/string (herbstclient attr ,arg)))))) diff --git a/work/usr/bin/r-twillemse2223 b/work/usr/bin/r-twillemse2223 new file mode 100755 index 0000000..a272043 --- /dev/null +++ b/work/usr/bin/r-twillemse2223 @@ -0,0 +1,24 @@ +#!/usr/bin/env sh +# -*- mode: scheme; -*- +IFS=" " +exec scsh -ll herbstluft.scm -o herbstluft -s "$0" "$@" +!# + +(define tag-name "rdp") + +(dynamic-wind + (lambda () (hc add ,tag-name)) + (lambda () + (hc rule once class=xfreerdp floating=on ,(string-append "tag=" tag-name) switchtag=on) + + (run (xfreerdp /u:WillemsenT /v:R-TWILLEMSE2223.re.sega.internal /f + /sound:sys:pulse +fonts "/floatbar:sticky:off,default:hidden" + -decorations /microphone:sys:pulse + ,(string-append "/p:" (run/string (secret-tool lookup service vpn host vpn.relic.com))) + -wallpaper -toggle-fullscreen))) + (lambda () + (let ((current-tag (hc-get-attr 'tags.focus.name))) + (if (string= current-tag tag-name) + (hc use_previous))) + (hc merge_tag ,tag-name))) + diff --git a/zsh/profile.org b/zsh/profile.org index 533abe8..98803b8 100644 --- a/zsh/profile.org +++ b/zsh/profile.org @@ -83,6 +83,14 @@ I don't want to send any telemetry to Microsoft about my usage of the ~dotnet~ t export DOTNET_CLI_TELEMETRY_OPTOUT=1 #+end_src +** SCSH + +Add a directory in my home to the list where scsh will try to load libraries from when using =-ll=. This variable is treated as a list of s-exps, so each element needs to be quoted. And =#f= means to insert the default list of directories there. scsh doesn't understand what =~/= means, so we need to use escaped quotes instead of wrapping everything in single quotes. + +#+begin_src sh + export SCSH_LIB_DIRS="#f \"${HOME}/usr/share/scsh/\"" +#+end_src + * Systemd Import some variables into the systemd environment so that services -- cgit v1.2.3-54-g00ecf