From 85c78ca316fca6a6316396040e9999d9714a9bb2 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 3 Dec 2019 20:33:31 -0500 Subject: [PATCH] Refactor xst; bring back scratch term; add emacs scratch frame --- config/sxhkd/sxhkdrc | 5 ++++- modules/desktop/bspwm.nix | 23 ++++++++++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/config/sxhkd/sxhkdrc b/config/sxhkd/sxhkdrc index eddeaa46..e275dfaa 100644 --- a/config/sxhkd/sxhkdrc +++ b/config/sxhkd/sxhkdrc @@ -24,7 +24,10 @@ super + Return xst super + grave - emacsclient -a "" -e "(open-scratch-frame)" + st-scratch + +super + shift + grave + emacsclient -e '(open-scratch-frame)' super + space rofi -monitor -4 -show drun -show-icons diff --git a/modules/desktop/bspwm.nix b/modules/desktop/bspwm.nix index 4bf3e9eb..d28c4574 100644 --- a/modules/desktop/bspwm.nix +++ b/modules/desktop/bspwm.nix @@ -8,17 +8,34 @@ environment = { systemPackages = with pkgs; [ - xst # st + nice-to-have extensions - lightdm bspwm dunst libnotify - (polybar.override { pulseSupport = true; nlSupport = true; }) + + xst # st + nice-to-have extensions + (writeScriptBin "st-scratch" '' + #!${stdenv.shell} + SCRID=st-scratch + focused=$(xdotool getactivewindow) + scratch=$(xdotool search --onlyvisible --classname $SCRID) + if [[ -n $scratch ]]; then + if [[ $focused == $scratch ]]; then + xdotool windowkill $scratch + else + xdotool windowactivate $scratch + fi + else + xst -t $SCRID -n $SCRID -c $SCRID \ + -f "$(xrdb -query | grep 'st-scratch\.font' | cut -f2)" \ + -g 100x26 \ + -e $SHELL + fi + '') ]; };