From b8974738d03413718bfafbadf504cd6ad7628ff1 Mon Sep 17 00:00:00 2001 From: Glenn Wurr Date: Thu, 27 Aug 2020 00:41:57 -0700 Subject: [PATCH] mmmm --- .skhdrc | 23 +++++---- .yabairc | 50 ++++++++++++++----- .../widgets/nibar/scripts/spaces_tertiary.sh" | 18 +++++++ .../widgets/nibar/spaces-tertiary.jsx" | 48 ++++++++++++++++++ bin/awsproxy | 1 + bin/ch_virt | 1 + bin/mac_refresh_nibar | 1 + bin/mac_restart_uber | 16 ++++++ bin/mac_setup | 6 ++- bin/mac_wall | 9 ++++ bin/vipe | 17 +++++++ 11 files changed, 168 insertions(+), 22 deletions(-) create mode 100755 "Library/Application Support/U\314\210bersicht/widgets/nibar/scripts/spaces_tertiary.sh" create mode 100644 "Library/Application Support/U\314\210bersicht/widgets/nibar/spaces-tertiary.jsx" create mode 100755 bin/awsproxy create mode 100755 bin/ch_virt create mode 100755 bin/mac_restart_uber create mode 100755 bin/mac_wall create mode 100755 bin/vipe diff --git a/.skhdrc b/.skhdrc index 7ae0a2a..0891c3e 100644 --- a/.skhdrc +++ b/.skhdrc @@ -29,13 +29,16 @@ # # an EOL character signifies the end of the bind. - -cmd - return : osascript ~/bin/.osa/run_term.scpt -lshift + lcmd - return : osascript ~/bin/.osa/run_oterm.scpt -lshift + lcmd - f : osascript ~/bin/.osa/run_finder.scpt +# start term +lalt - return : osascript ~/bin/.osa/run_term.scpt +lalt + lshift - return : osascript ~/bin/.osa/run_oterm.scpt +# start finder +lalt + lshift - f : osascript ~/bin/.osa/run_finder.scpt +# close window +lalt + lshift - c : yabai -m window --close # restart -shift + alt - r : brew services restart skhd +shift + alt - r : launchctl kickstart -k "gui/${UID}/homebrew.mxcl.yabai" # focus window lalt - h : yabai -m window --focus west @@ -118,15 +121,17 @@ lalt - 8 : yabai -m space --focus 8 lalt - 9 : yabai -m space --focus 9 # focus monitor -lalt - 0x2B : yabai -m display --focus prev || yabai -m display --focus last -lalt - 0x2F : yabai -m display --focus next || yabai -m display --focus first +#lalt - 0x2B : yabai -m display --focus prev || yabai -m display --focus last +#lalt - 0x2F : yabai -m display --focus next || yabai -m display --focus first +lalt - 0x2B : yabai -m display --focus west +lalt - 0x2F : yabai -m display --focus east lctrl + lalt - 3 : yabai -m display --focus 3 lctrl + lalt - 2 : yabai -m display --focus 2 lctrl + lalt - 1 : yabai -m display --focus 1 # send window to monitor -lalt + lshift - 0x2B : yabai -m window --display prev -lalt + lshift - 0x2F : yabai -m window --display next +lalt + lshift - 0x2B : yabai -m window --display west +lalt + lshift - 0x2F : yabai -m window --display east lctrl + lalt + lshift - 1 : yabai -m window --display 1 lctrl + lalt + lshift - 2 : yabai -m window --display 2 lctrl + lalt + lshift - 3 : yabai -m window --display 3 diff --git a/.yabairc b/.yabairc index bb8db77..96cabfe 100755 --- a/.yabairc +++ b/.yabairc @@ -5,15 +5,16 @@ yabai -m config mouse_follows_focus on #yabai -m config focus_follows_mouse autoraise yabai -m config focus_follows_mouse autofocus yabai -m config window_placement second_child +# makes floating windows always on top: yabai -m config window_topmost on yabai -m config window_shadow on yabai -m config window_opacity on -yabai -m config window_opacity_duration 0.0 +yabai -m config window_opacity_duration 0.2 #yabai -m config active_window_opacity 1.0 -yabai -m config active_window_opacity 0.96 +yabai -m config active_window_opacity 0.98 yabai -m config normal_window_opacity 0.88 yabai -m config window_border on -yabai -m config window_border_width 10 +yabai -m config window_border_width 8 yabai -m config active_window_border_color 0xff775759 yabai -m config normal_window_border_color 0xff555555 yabai -m config insert_feedback_color 0xffd75f5f @@ -25,20 +26,43 @@ yabai -m config mouse_action2 resize # general space settings yabai -m config layout bsp -yabai -m config top_padding 12 -yabai -m config bottom_padding 12 -yabai -m config left_padding 12 -yabai -m config right_padding 12 -#yabai -m config window_gap 06 -yabai -m config window_gap 12 - -# add padding for bar +yabai -m config top_padding 40 +yabai -m config bottom_padding 40 +yabai -m config left_padding 20 +yabai -m config right_padding 20 + +yabai -m config window_gap 20 + +# add fixed padding for bar yabai -m config external_bar all:20:20 +# set space 1 to have no pad +yabai -m config --space 1 window_gap 0 +yabai -m config --space 1 right_padding 0 +yabai -m config --space 1 left_padding 0 +yabai -m config --space 1 top_padding 0 +yabai -m config --space 1 bottom_padding 0 + # float and sticky system preferences -yabai -m rule --add app="^System Preferences$" manage=off +yabai -m rule --add app="^System Preferences$" manage=off layer=above yabai -m rule --add app="^System Preferences$" sticky=on +yabai -m rule --add app="Finder" manage=off layer=above +yabai -m rule --add app="App Store" manage=off layer=above + +yabai -m rule --add title='Opening$' manage=off layer=above +yabai -m rule --add title='Preferences$' manage=off layer=above + +# pesky MS Teams notification window popups +#yabai -m rule --add title='^Microsoft Teams Notification$' manage=off layer=above sticky=on +yabai -m rule --add title='^Microsoft Teams Notification$' manage=off layer=below sticky=off border=off space=9 + +yabai -m rule --add app="GarageBand" sticky=off manage=off layer=below space=4 + +# focus last recent window in event of window or app getting closed: +yabai -m signal --add event=window_destroyed action="yabai -m query --windows --window &> /dev/null || yabai -m window --focus recent" +yabai -m signal --add event=application_terminated action="yabai -m query --windows --window &> /dev/null || yabai -m window --focus recent" + # show digital colour meter topmost and on all spaces #yabai -m rule --add app="^Digital Colou?r Meter$" sticky=on @@ -47,3 +71,5 @@ yabai -m signal --add event=space_changed \ action="$HOME/bin/mac_refresh_nibar" yabai -m signal --add event=display_changed \ action="$HOME/bin/mac_refresh_nibar" + +mac_restart_uber diff --git "a/Library/Application Support/U\314\210bersicht/widgets/nibar/scripts/spaces_tertiary.sh" "b/Library/Application Support/U\314\210bersicht/widgets/nibar/scripts/spaces_tertiary.sh" new file mode 100755 index 0000000..7b59566 --- /dev/null +++ "b/Library/Application Support/U\314\210bersicht/widgets/nibar/scripts/spaces_tertiary.sh" @@ -0,0 +1,18 @@ +#!/bin/sh + +PATH=/usr/local/bin/:$PATH + +# Check if yabai exists +if ! [ -x "$(command -v yabai)" ]; then + echo "{\"error\":\"yabai binary not found\"}" + exit 1 +fi + +SPACES_TERTIARY=$(yabai -m query --space3 --display 3) + +echo $(cat <<-EOF +{ + "spaces_tertiary": $SPACES_TERTIARY +} +EOF +) diff --git "a/Library/Application Support/U\314\210bersicht/widgets/nibar/spaces-tertiary.jsx" "b/Library/Application Support/U\314\210bersicht/widgets/nibar/spaces-tertiary.jsx" new file mode 100644 index 0000000..1dfb849 --- /dev/null +++ "b/Library/Application Support/U\314\210bersicht/widgets/nibar/spaces-tertiary.jsx" @@ -0,0 +1,48 @@ +import Desktop from "./lib/Desktop.jsx"; +import Error from "./lib/Error.jsx"; +import parse from "./lib/parse.jsx"; +import styles from "./lib/styles.jsx"; + +const style = { + padding: "0 8px", + display: "grid", + gridAutoFlow: "column", + gridGap: "16px", + position: "fixed", + overflow: "hidden", + left: "0px", + top: "0px", + fontFamily: styles.fontFamily, + lineHeight: styles.lineHeight, + fontSize: styles.fontSize, + color: styles.colors.dim, + fontWeight: styles.fontWeight +}; + +export const refreshFrequency = false; +export const command = "./nibar/scripts/spaces_tertiary.sh"; + +export const render = ({ output }) => { + const data = parse(output); + if (typeof data === "undefined") { + return ( +
+ +
+ ); + } + if (typeof data.error !== "undefined") { + return ( +
+ +
+ ); + } + return ( +
+ +
+ ); +}; + +export default null; diff --git a/bin/awsproxy b/bin/awsproxy new file mode 100755 index 0000000..e8a0aa7 --- /dev/null +++ b/bin/awsproxy @@ -0,0 +1 @@ +ssh -v -N -D 22223 awsgw diff --git a/bin/ch_virt b/bin/ch_virt new file mode 100755 index 0000000..a5094b3 --- /dev/null +++ b/bin/ch_virt @@ -0,0 +1 @@ +virt-manager -c 'qemu+ssh://mack/system?socket=/var/run/libvirt/libvirt-sock' diff --git a/bin/mac_refresh_nibar b/bin/mac_refresh_nibar index 7b3afd9..707283f 100755 --- a/bin/mac_refresh_nibar +++ b/bin/mac_refresh_nibar @@ -1,2 +1,3 @@ osascript -e 'tell application "Übersicht" to refresh widget id "nibar-spaces-primary-jsx"' osascript -e 'tell application "Übersicht" to refresh widget id "nibar-spaces-secondary-jsx"' + osascript -e 'tell application "Übersicht" to refresh widget id "nibar-spaces-tertiary-jsx"' diff --git a/bin/mac_restart_uber b/bin/mac_restart_uber new file mode 100755 index 0000000..1612996 --- /dev/null +++ b/bin/mac_restart_uber @@ -0,0 +1,16 @@ +#!/bin/bash + +function _kill() { + pgrep Übersicht | xargs kill +} + +function _run() { + ( "/Applications/Übersicht.app/Contents/MacOS/Übersicht" 2>&1 | tee -a "${HOME}/.uber.log" ) & +} + + +_kill || true +_kill || true + +_run & + diff --git a/bin/mac_setup b/bin/mac_setup index fc39b7e..d99e226 100755 --- a/bin/mac_setup +++ b/bin/mac_setup @@ -220,7 +220,7 @@ sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutio defaults write com.apple.finder QuitMenuItem -bool true # Finder: disable window animations and Get Info animations -#defaults write com.apple.finder DisableAllAnimations -bool true +defaults write com.apple.finder DisableAllAnimations -bool true # Set Desktop as the default location for new Finder windows # For other paths, use `PfLo` and `file:///full/path/here/` @@ -742,3 +742,7 @@ for app in "Activity Monitor" \ killall "${app}" &> /dev/null done echo "Done. Note that some of these changes require a logout/restart to take effect." + +# no desktop icons +defaults write com.apple.finder CreateDesktop false && \ +killall Finder diff --git a/bin/mac_wall b/bin/mac_wall new file mode 100755 index 0000000..c74582d --- /dev/null +++ b/bin/mac_wall @@ -0,0 +1,9 @@ +#! /bin/bash +#script to change all desktop backgrounds +if [ -z "$1" ]; then + echo "Please specify an absolute path to an image as first parameter" + exit -1 +fi + +osascript -e "tell application \"System Events\" to set picture of every desktop to \"$1\"" +killall Dock diff --git a/bin/vipe b/bin/vipe new file mode 100755 index 0000000..542e6cb --- /dev/null +++ b/bin/vipe @@ -0,0 +1,17 @@ +#!/bin/bash + + +TMPFILE=`mktemp -q -t tmp.vipe.XXXXXXXXX` +trap "rm -f ${TMPFILE}" EXIT + +# read from stdin +if [ ! -t 0 ]; then + cat - > $TMPFILE +fi + +# spawn editor with stdio connected +${EDITOR} "${TMPFILE}" < /dev/tty > /dev/tty || exit $? + +# write to stdout +cat $TMPFILE && exit 0 || exit $? +