Skip to content

Commit

Permalink
more yabai/nibar stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Glenn Wurr committed Jul 24, 2020
1 parent d6451b3 commit eb53708
Show file tree
Hide file tree
Showing 27 changed files with 717 additions and 1 deletion.
8 changes: 7 additions & 1 deletion .profile.macos
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ if test -d "/usr/local/opt/coreutils/libexec/gnubin" ; then
alias ls="ls --color=auto"
fi

INTERACTIVE=FALSE
case "$-" in
*i*) INTERACTIVE=TRUE && export INTERACTIVE ;;
*) INTERACTIVE=FALSE ;;
esac

# below we see if we're running the default bash, and if so, exec the good bash.
# on MacOS we need to use libproc calls to find exe path for pid.
# see: https://ops.tips/blog/macos-pid-absolute-path-and-procfs-exploration/
Expand All @@ -31,7 +37,7 @@ fi
# the bash we want:
GOODBASH=/usr/local/bin/bash

contains "$0" "bash" && \
contains "$0" "bash" && contains "$INTERACTIVE" "TRUE" && \
test -x "$GOODBASH" && \
{ \
command -v pidpath >>/dev/null || \
Expand Down
115 changes: 115 additions & 0 deletions .skhdrc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,121 @@ 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

# restart
shift + alt - r : brew services restart skhd

# focus window
lalt - h : yabai -m window --focus west
lalt - l : yabai -m window --focus east
lalt - j : yabai -m window --focus south
lalt - k : yabai -m window --focus north

# swap managed window
lshift + lalt - h : yabai -m window --swap west
lshift + lalt - l : yabai -m window --swap east
lshift + lalt - j : yabai -m window --swap south
lshift + lalt - k : yabai -m window --swap north

# move managed window
lshift + lcmd - h : yabai -m window --warp west
lshift + lcmd - l : yabai -m window --warp east
lshift + lcmd - j : yabai -m window --warp south
lshift + lcmd - k : yabai -m window --warp north

# toggle float on window
lalt - f : yabai -m window --toggle float
# toggle zoom
#lshift + lalt - f : yabai -m window --toggle zoom-parent
#lshift + lalt - f : yabai -m window --toggle zoom-fullscreen


# move floating window
lalt - left : yabai -m window --move rel:-20:0
lalt - right : yabai -m window --move rel:20:0
lalt - down : yabai -m window --move rel:0:20
lalt - up : yabai -m window --move rel:0:-20

# increase window size
lshift + lalt - left : yabai -m window --resize left:-20:0
lshift + lalt - right : yabai -m window --resize right:20:0
lshift + lalt - up : yabai -m window --resize top:0:-20
lshift + lalt - down : yabai -m window --resize bottom:0:20

# decrease window size
lctrl + lalt - right : yabai -m window --resize left:20:0
lctrl + lalt - left : yabai -m window --resize right:-20:0
lctrl + lalt - down : yabai -m window --resize top:0:20
lctrl + lalt - up : yabai -m window --resize bottom:0:-20


# balance size of windows
lshift + lalt - 0 : yabai -m space --balance

# create desktop, move window and follow focus - uses jq for parsing json (brew install jq)
lshift + lalt - n : yabai -m space --create && \
index="$(yabai -m query --spaces --display | jq 'map(select(."native-fullscreen" == 0))[-1].index')" && \
yabai -m window --space "${index}" && \
yabai -m space --focus "${index}"

# send window to desktop
lshift + lalt - 0x21 : yabai -m window --space prev
lshift + lalt - 0x1E : yabai -m window --space next
lshift + lalt - 1 : yabai -m window --space 1
lshift + lalt - 2 : yabai -m window --space 2
lshift + lalt - 3 : yabai -m window --space 3
lshift + lalt - 4 : yabai -m window --space 4
lshift + lalt - 5 : yabai -m window --space 5
lshift + lalt - 6 : yabai -m window --space 6
lshift + lalt - 7 : yabai -m window --space 7
lshift + lalt - 8 : yabai -m window --space 8
lshift + lalt - 9 : yabai -m window --space 9

# focus desktop
lalt - tab : yabai -m space --focus recent
lalt - 0x21 : yabai -m space --focus prev || yabai -m space --focus last
lalt - 0x1E : yabai -m space --focus next || yabai -m space --focus first
lalt - 1 : yabai -m space --focus 1
lalt - 2 : yabai -m space --focus 2
lalt - 3 : yabai -m space --focus 3
lalt - 4 : yabai -m space --focus 4
lalt - 5 : yabai -m space --focus 5
lalt - 6 : yabai -m space --focus 6
lalt - 7 : yabai -m space --focus 7
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
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
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

# toggle window split type
# alt - e : yabai -m window --toggle split

# float / unfloat window and center on screen
# alt - t : yabai -m window --toggle float;\
# yabai -m window --grid 4:4:1:1:2:2

# toggle sticky(+float), topmost, picture-in-picture
# alt - p : yabai -m window --toggle sticky;\
# yabai -m window --toggle topmost;\
# yabai -m window --toggle pip





### Old chunkwm stuff below:

## close focused window
#shift + alt - c : chunkc tiling::window --close
#
Expand Down
13 changes: 13 additions & 0 deletions .spacebarrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env sh

spacebar -m config text_font "Helvetica Neue:Bold:12.0"
spacebar -m config icon_font "Font Awesome 5 Free:Regular:12.0"
spacebar -m config background_color 0xff202020
spacebar -m config foreground_color 0xffa8a8a8
spacebar -m config space_icon_strip I II III IV V VI VII VIII IX X
spacebar -m config power_icon_strip  
spacebar -m config space_icon 
spacebar -m config clock_icon 
spacebar -m config clock_format "%d/%m/%y %R"

echo "spacebar configuration loaded.."
49 changes: 49 additions & 0 deletions .yabairc
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env sh

# global settings
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
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 active_window_opacity 1.0
yabai -m config active_window_opacity 0.96
yabai -m config normal_window_opacity 0.88
yabai -m config window_border on
yabai -m config window_border_width 10
yabai -m config active_window_border_color 0xff775759
yabai -m config normal_window_border_color 0xff555555
yabai -m config insert_feedback_color 0xffd75f5f
yabai -m config split_ratio 0.50
yabai -m config auto_balance off
yabai -m config mouse_modifier fn
yabai -m config mouse_action1 move
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 external_bar all:20:20

# float and sticky system preferences
yabai -m rule --add app="^System Preferences$" manage=off
yabai -m rule --add app="^System Preferences$" sticky=on

# show digital colour meter topmost and on all spaces
#yabai -m rule --add app="^Digital Colou?r Meter$" sticky=on

# update nibar
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"
38 changes: 38 additions & 0 deletions Library/Application Support/Übersicht/widgets/gwurr3.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# this is the shell command that gets executed every time this widget refreshes
command: "${HOME}/bin/mac_check_wireless_battery"

# the refresh frequency in milliseconds
refreshFrequency: 30000

# render gets called after the shell command has executed. The command's output
# is passed in as a string. Whatever it returns will get rendered as HTML.
render: (output) -> """
<h1>#{output}</h1>
"""

# the CSS style for this widget, written using Stylus
# (http://learnboost.github.io/stylus/)
style: """
-webkit-backdrop-filter: blur(2px)
border-radius: 5px
border: 1px solid #fff
box-sizing: border-box
color: #DC143C
font-family: Glass TTY VT220
font-weight: 300
left: 100%
line-height: 1.5
margin-left: -295px
padding: 7px 7px 7px
top: 94%
text-align: justify
h1
font-size: 16px
font-weight: 300
margin: 16px 0 8px
em
font-weight: 400
font-style: normal
"""
64 changes: 64 additions & 0 deletions Library/Application Support/Übersicht/widgets/nibar/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next

# OS Files
.DS_Store
21 changes: 21 additions & 0 deletions Library/Application Support/Übersicht/widgets/nibar/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Gadzhi Kharkharov

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This whole dir is stolen from https://github.com/kkga/nibar
23 changes: 23 additions & 0 deletions Library/Application Support/Übersicht/widgets/nibar/bar.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import styles from "./lib/styles.jsx";

const style = {
background: styles.colors.bg,
cursor: "default",
userSelect: "none",
zIndex: "-1",
width: "100%",
height: "20px",
position: "fixed",
overflow: "hidden",
top: "0px",
right: "0px",
left: "0px"
};

export const refreshFrequency = 1000000;

export const render = ({ output }) => {
return <div style={style} />;
};

export default null;
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import styles from "./styles.jsx";

const render = ({ output }) => {
let charging = output.charging;
let percentage = output.percentage;
let remaining = output.remaining;
return (
<div>
<div
style={
percentage < 10 && charging == false
? { color: styles.colors.red }
: null
}
>
<span>{charging ? "􀋦" : null} {percentage}%</span>
</div>
</div>
);
};

export default render;
12 changes: 12 additions & 0 deletions Library/Application Support/Übersicht/widgets/nibar/lib/Cpu.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import styles from "./styles.jsx";

const render = ({ output }) => {
if (typeof output === "undefined") return null;
return (
<div style={output.loadAverage > 3 ? { color: styles.colors.red } : null}>
<span>􀍽 {output.loadAverage}</span>
</div>
);
};

export default render;
Loading

0 comments on commit eb53708

Please sign in to comment.