-
Notifications
You must be signed in to change notification settings - Fork 3
Many different changes, details in commit messages #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
xezo360hye
wants to merge
7
commits into
K4zoku:master
Choose a base branch
from
xezo360hye:patch-3
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e8f2785
Code refactoring without functionality changes
xezo360hye 1d33842
Changes in files structure and code reformatting
xezo360hye abf151a
Returned to POSIX sh and simplified some things
xezo360hye 58019e7
Merge branch 'master' into patch-3
xezo360hye 3aca0d1
Improved NoWM executable and moved files
xezo360hye 33641f6
Small optimization changes
xezo360hye 02e3d07
Manpage changes
xezo360hye File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,107 @@ | ||
#!/bin/sh | ||
|
||
resize() { xdotool getwindowfocus windowsize "${1:-0}" "${2:-0}"; } | ||
|
||
resize_relative() { | ||
eval "$(xdotool getwindowfocus getwindowgeometry --shell | head -n5)" | ||
W_WIDTH=$(( WIDTH + "${1:-0}" )); W_HEIGHT=$(( HEIGHT + "${2:-0}" )) | ||
eval "$(xdotool getdisplaygeometry --shell)" | ||
DR_WIDTH="$(( WIDTH - X ))"; DR_HEIGHT="$(( HEIGHT - Y ))" | ||
[ "${W_WIDTH}" -lt 1 ] && W_WIDTH=1 || [ "${W_WIDTH}" -gt "${DR_WIDTH}" ] && W_WIDTH="${DR_WIDTH}" | ||
[ "${W_HEIGHT}" -lt 1 ] && W_HEIGHT=1 || [ "${W_HEIGHT}" -gt "${DR_HEIGHT}" ] && W_HEIGHT="${DR_HEIGHT}" | ||
xdotool windowsize "${WINDOW}" "${W_WIDTH}" "${W_HEIGHT}" | ||
_resize() { | ||
xdotool getwindowfocus windowsize -- "${1:-0}" "${2:-0}" | ||
} | ||
|
||
move() { xdotool getwindowfocus windowmove "${1:-0}" "${2:-0}"; } | ||
_resize_relative() { | ||
eval "$(xdotool getwindowfocus getwindowgeometry --shell | awk "/WIDTH|HEIGHT/")" | ||
WINDOW_WIDTH=$(( WIDTH + "${1:-0}" )) | ||
WINDOW_HEIGHT=$(( HEIGHT + "${2:-0}" )) | ||
|
||
move_relative() { xdotool getwindowfocus windowmove --relative "${1:-0}" "${2:-0}"; } | ||
eval "$(xdotool getdisplaygeometry --shell | awk "/WIDTH|HEIGHT|X|Y/")" | ||
DISPLAY_WIDTH="$(( WIDTH - X ))" | ||
DISPLAY_HEIGHT="$(( HEIGHT - Y ))" | ||
|
||
center() { | ||
eval "$(xdotool getwindowfocus getwindowgeometry --shell | tail -n3 | head -n2)" | ||
W_WIDTH="${WIDTH}"; W_HEIGHT="${HEIGHT}" | ||
eval "$(xdotool getdisplaygeometry --shell)" | ||
move "$(( (WIDTH - W_WIDTH) / 2 ))" "$(( (HEIGHT - W_HEIGHT) / 2 ))" | ||
if [[ "${WINDOW_WIDTH}" < 1 ]]; then | ||
WINDOW_WIDTH=1 | ||
elif [[ "${WINDOW_WIDTH}" > "${DISPLAY_WIDTH}" ]]; then | ||
WINDOW_WIDTH="${DISPLAY_WIDTH}" | ||
fi | ||
|
||
if [[ "${WINDOW_HEIGHT}" < 1 ]]; then | ||
WINDOW_HEIGHT=1 | ||
elif [[ "${WINDOW_HEIGHT}" > "${DISPLAY_HEIGHT}" ]]; then | ||
WINDOW_HEIGHT="${DISPLAY_HEIGHT}" | ||
fi | ||
|
||
xdotool windowsize -- "${WINDOW}" "${WINDOW_WIDTH}" "${WINDOW_HEIGHT}" | ||
} | ||
|
||
_move() { | ||
xdotool getwindowfocus windowmove -- "${1:-0}" "${2:-0}" | ||
} | ||
|
||
_move_relative() { | ||
xdotool getwindowfocus windowmove --relative -- "${1:-0}" "${2:-0}" | ||
} | ||
|
||
_center() { | ||
eval "$(xdotool getwindowfocus getwindowgeometry --shell | tail -n3 | head -n2)" | ||
WINDOW_WIDTH="${WIDTH}" | ||
WINDOW_HEIGHT="${HEIGHT}" | ||
eval "$(xdotool getdisplaygeometry --shell | awk "/WIDTH|HEIGHT/")" | ||
move "$(( (WIDTH - WINDOW_WIDTH) / 2 ))" "$(( (HEIGHT - WINDOW_HEIGHT) / 2 ))" | ||
} | ||
|
||
snap() { | ||
eval "$(xdotool getwindowfocus getwindowgeometry --shell | head -n5)" | ||
W_WIDTH="${WIDTH}"; W_HEIGHT="${HEIGHT}" | ||
eval "$(xdotool getdisplaygeometry --shell)" | ||
case "${1:-0}" in | ||
left) move 0 y ;; | ||
bottom) move x "$(( HEIGHT - W_HEIGHT ))";; | ||
top) move x 0 ;; | ||
right) move "$(( WIDTH - W_WIDTH ))" y ;; | ||
*) move x y ;; | ||
esac | ||
_snap() { | ||
eval "$(xdotool getwindowfocus getwindowgeometry --shell | awk "/WIDTH|HEIGHT/")" | ||
W_WIDTH="${WIDTH}" | ||
W_HEIGHT="${HEIGHT}" | ||
eval "$(xdotool getdisplaygeometry --shell)" | ||
case "${1:-0}" in | ||
left) move 0 y ;; | ||
bottom) move x "$(( HEIGHT - W_HEIGHT ))";; | ||
top) move x 0 ;; | ||
right) move "$(( WIDTH - W_WIDTH ))" y ;; | ||
*) move x y ;; | ||
esac | ||
K4zoku marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
pointer_focus() { xdotool getmouselocation windowfocus; } | ||
_pointer_focus() { | ||
xdotool getmouselocation windowfocus | ||
} | ||
|
||
select_focus() { xdotool selectwindow windowfocus; } | ||
_select_focus() { | ||
xdotool selectwindow windowfocus | ||
} | ||
|
||
close() { xdotool getwindowfocus windowclose; } | ||
_close() { | ||
xdotool getwindowfocus windowclose | ||
} | ||
|
||
quit() { xdotool getwindowfocus windowquit; } | ||
_quit() { | ||
xdotool getwindowfocus windowquit | ||
} | ||
|
||
window_kill() { xdotool getwindowfocus windowkill; } | ||
_kill() { | ||
xdotool getwindowfocus windowkill | ||
} | ||
|
||
nowm_logout() { pkill -KILL -u "$(whoami)"; } | ||
_logout() { | ||
pkill -KILL -u "$(whoami)" | ||
} | ||
|
||
nowm_main() { | ||
NOWM_AUTOSTART="${XDG_CONFIG_HOME:-${HOME}/.config}/nowm/autostart" | ||
[ -x "${NOWM_AUTOSTART}" ] && "${NOWM_AUTOSTART}" >/dev/null 2>&1 & | ||
while : ; do : ; done | ||
NOWM_AUTOSTART="${XDG_CONFIG_HOME:-${HOME}/.config}/nowm/autostart" | ||
[ -x "${NOWM_AUTOSTART}" ] && "${NOWM_AUTOSTART}" >/dev/null 2>&1 & | ||
sleep infinity | ||
K4zoku marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
noargs() { | ||
if [ -z "${DISPLAY}" ]; then | ||
exec startx "$(which nowm)" | ||
else | ||
nowm_main | ||
fi | ||
} | ||
|
||
noargs() { if [ -z "${DISPLAY}" ]; then exec startx "$(which nowm)"; else nowm_main; fi; } | ||
|
||
case "${1}" in | ||
"") noargs || exit 1 ;; | ||
resize) resize "${2}" "${3}";; | ||
resize_relative) resize_relative "${2}" "${3}";; | ||
move) move "${2}" "${3}";; | ||
move_relative) move_relative "${2}" "${3}";; | ||
center) center ;; | ||
snap) snap "${2}" ;; | ||
pointer_focus) pointer_focus ;; | ||
select_focus) select_focus ;; | ||
close) close ;; | ||
quit) quit ;; | ||
kill) window_kill ;; | ||
logout) nowm_logout ;; | ||
*) exit 1 ;; | ||
esac | ||
valid="resize|resize_relative|move|move_relative|center|snap|pointer_focus|select_focus|close|quit|kill|logout" | ||
if [[ "$1" =~ ^(${valid})$ ]]; then | ||
_"$1" "${@:2}" | ||
elif [[ -z "$1" ]]; then | ||
K4zoku marked this conversation as resolved.
Show resolved
Hide resolved
|
||
noargs | ||
else | ||
echo "Invalid command: $1" | ||
exit 1 | ||
fi |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.