├── LICENSE ├── Makefile ├── README.md ├── bin └── nowm ├── examples ├── autostart └── sxhkdrc ├── logo.svg ├── man └── nowm.1 └── package.json /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Kazoku 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | PREFIX ?= /usr/local 2 | MANDIR ?= $(PREFIX)/share/man 3 | BIN ?= nowm 4 | 5 | install: 6 | @mkdir -p $(PREFIX)/bin 7 | @mkdir -p $(MANDIR)/man1 8 | 9 | @cp -p bin/$(BIN) $(PREFIX)/bin/ 10 | @cp -p man/$(BIN).1 $(MANDIR)/man1/ 11 | 12 | @chmod 755 $(PREFIX)/bin/$(BIN) 13 | 14 | 15 | uninstall: 16 | @rm -rf $(PREFIX)/bin/$(BIN) 17 | @rm -rf $(MANDIR)/man1/$(BIN).1* 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
nowm
Managing window without a window manager
3 |
4 |
5 |
6 |
7 |
Made with ❤️ by @K4zoku
146 | -------------------------------------------------------------------------------- /bin/nowm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | resize() { xdotool getwindowfocus windowsize "${1:-0}" "${2:-0}"; } 4 | 5 | resize_relative() { 6 | eval "$(xdotool getwindowfocus getwindowgeometry --shell | head -n5)" 7 | W_WIDTH=$(( WIDTH + "${1:-0}" )); W_HEIGHT=$(( HEIGHT + "${2:-0}" )) 8 | eval "$(xdotool getdisplaygeometry --shell)" 9 | DR_WIDTH="$(( WIDTH - X ))"; DR_HEIGHT="$(( HEIGHT - Y ))" 10 | [ "${W_WIDTH}" -lt 1 ] && W_WIDTH=1 || [ "${W_WIDTH}" -gt "${DR_WIDTH}" ] && W_WIDTH="${DR_WIDTH}" 11 | [ "${W_HEIGHT}" -lt 1 ] && W_HEIGHT=1 || [ "${W_HEIGHT}" -gt "${DR_HEIGHT}" ] && W_HEIGHT="${DR_HEIGHT}" 12 | xdotool windowsize "${WINDOW}" "${W_WIDTH}" "${W_HEIGHT}" 13 | } 14 | 15 | move() { xdotool getwindowfocus windowmove "${1:-0}" "${2:-0}"; } 16 | 17 | move_relative() { xdotool getwindowfocus windowmove --relative "${1:-0}" "${2:-0}"; } 18 | 19 | center() { 20 | eval "$(xdotool getwindowfocus getwindowgeometry --shell | tail -n3 | head -n2)" 21 | W_WIDTH="${WIDTH}"; W_HEIGHT="${HEIGHT}" 22 | eval "$(xdotool getdisplaygeometry --shell)" 23 | move "$(( (WIDTH - W_WIDTH) / 2 ))" "$(( (HEIGHT - W_HEIGHT) / 2 ))" 24 | } 25 | 26 | snap() { 27 | eval "$(xdotool getwindowfocus getwindowgeometry --shell | head -n5)" 28 | W_WIDTH="${WIDTH}"; W_HEIGHT="${HEIGHT}" 29 | eval "$(xdotool getdisplaygeometry --shell)" 30 | case "${1:-0}" in 31 | left) move 0 y ;; 32 | bottom) move x "$(( HEIGHT - W_HEIGHT ))";; 33 | top) move x 0 ;; 34 | right) move "$(( WIDTH - W_WIDTH ))" y ;; 35 | *) move x y ;; 36 | esac 37 | } 38 | 39 | pointer_focus() { xdotool getmouselocation windowfocus; } 40 | 41 | select_focus() { xdotool selectwindow windowfocus; } 42 | 43 | close() { xdotool getwindowfocus windowclose; } 44 | 45 | quit() { xdotool getwindowfocus windowquit; } 46 | 47 | window_kill() { xdotool getwindowfocus windowkill; } 48 | 49 | nowm_logout() { pkill -KILL -u "$(whoami)"; } 50 | 51 | nowm_main() { 52 | NOWM_AUTOSTART="${XDG_CONFIG_HOME:-${HOME}/.config}/nowm/autostart" 53 | [ -x "${NOWM_AUTOSTART}" ] && "${NOWM_AUTOSTART}" >/dev/null 2>&1 & 54 | while : ; do : ; done 55 | } 56 | 57 | noargs() { if [ -z "${DISPLAY}" ]; then exec startx "$(which nowm)"; else nowm_main; fi; } 58 | 59 | case "${1}" in 60 | "") noargs || exit 1 ;; 61 | resize) resize "${2}" "${3}";; 62 | resize_relative) resize_relative "${2}" "${3}";; 63 | move) move "${2}" "${3}";; 64 | move_relative) move_relative "${2}" "${3}";; 65 | center) center ;; 66 | snap) snap "${2}" ;; 67 | pointer_focus) pointer_focus ;; 68 | select_focus) select_focus ;; 69 | close) close ;; 70 | quit) quit ;; 71 | kill) window_kill ;; 72 | logout) nowm_logout ;; 73 | *) exit 1 ;; 74 | esac 75 | -------------------------------------------------------------------------------- /examples/autostart: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | pgrep -x sxhkd || sxkhd -c "${NOWM_CONFIG_HOME}/sxhkdrc" & 4 | -------------------------------------------------------------------------------- /examples/sxhkdrc: -------------------------------------------------------------------------------- 1 | ########################## 2 | # WM INDEPENDENT HOTKEYS # 3 | ########################## 4 | 5 | # terminal 6 | super + Return 7 | urxvt 8 | 9 | # reload sxhkd configuration files 10 | super + Escape 11 | pkill -USR1 -x sxhkd 12 | 13 | ################ 14 | # NOWM HOTKEYS # 15 | ################ 16 | 17 | # [nowm] logout 18 | super + alt + q 19 | nowm logout 20 | 21 | # [nowm] move 22 | super + {Left,Down,Up,Right} 23 | nowm move_relative {-4 0, 0 4, 0 -4, 4 0} 24 | 25 | # [nowm] resize 26 | super + {a,s,w,d} 27 | nowm resize_relative {-4 0, 0 4, 0 -4, 4 0} 28 | 29 | # [nowm] window close 30 | super + w 31 | nowm close 32 | 33 | # [nowm] focus 34 | ~button1 35 | nowm pointer_focus 36 | -------------------------------------------------------------------------------- /logo.svg: -------------------------------------------------------------------------------- 1 | 15 | -------------------------------------------------------------------------------- /man/nowm.1: -------------------------------------------------------------------------------- 1 | .TH NOWM "1" "2022" "K4zoku" "User Commands" 2 | .SH NAME 3 | NoWM \- Managing window without a window manager 4 | .SH SYNOPSIS 5 | .B nowm 6 | .SH DESCRIPTION 7 | A dead simple tool to managing windows from the tty, written in shell script. 8 | .SH OPTIONS 9 | \fBresize\fR \fBw h\fR 10 | Shrink or grow the current window by the given w/h arguments 11 | .TP 12 | \fBresize_relative\fR \fBw h\fR 13 | Shrink or grow the current window relatively by the given w/h arguments 14 | .TP 15 | \fBmove\fR \fBx y\fR 16 | Shift the current window by the given x/y coordinates 17 | .TP 18 | \fBmove_relative\fR \fBx y\fR 19 | Shift the current window relatively by the given x/y coordinates 20 | .TP 21 | \fBcenter\fR 22 | Centers the current window. 23 | .TP 24 | \fBsnap\fR \fB(top|bottom|left|right)\fR 25 | Move and resize the current window to fill the DIRECTION half of the screen 26 | .TP 27 | \fBpointer_focus\fR 28 | Focus the window underneath the pointer 29 | .TP 30 | \fBselect_focus\fR 31 | Focus selected window 32 | .TP 33 | \fBclose\fR 34 | Destroy the window but will not try to kill the client controlling it 35 | \fBquit\fR 36 | Close window gracefully, this action sends a request, allowing the application to apply close confirmation mechanics 37 | \fBkill\fR 38 | Destroy the window and kill the client controlling it 39 | \fBlogout\fR 40 | Log user out 41 | .SH REPORTING BUGS 42 | Report bugs to https://github.com/K4zoku/nowm/issues 43 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nowm", 3 | "version": "0.0.1", 4 | "description": "Managing window without a window manager", 5 | "global": "true", 6 | "scripts": ["bin/nowm"], 7 | "files": ["man/nowm.1"], 8 | "install": "make install" 9 | } 10 | --------------------------------------------------------------------------------