From c2ee55d77f093d7a5abf8118870900b866dbba52 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 27 Feb 2016 20:05:40 -0500 Subject: stuff --- .config/wmii-hg/rules | 1 + 1 file changed, 1 insertion(+) (limited to '.config/wmii-hg') diff --git a/.config/wmii-hg/rules b/.config/wmii-hg/rules index 6334a7c..65f8339 100644 --- a/.config/wmii-hg/rules +++ b/.config/wmii-hg/rules @@ -4,4 +4,5 @@ /^FLTK:FLTK:/ floating=always /Emacs|Navigator/ force-tags=+sel floating=never +/^Eclipse:Eclipse:/ floating=never /.*/ floating=off -- cgit v1.2.3-2-g168b From 5e5e5029e76d88b3887bb175e28709a9022323a8 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 27 Feb 2016 18:31:31 -0500 Subject: X11 systemd stuff --- .config/wmii-hg/config.sh | 13 +++++++++++-- .config/wmii-hg/include.sh | 3 ++- .config/wmii-hg/rbar.sh | 4 ++-- .config/wmii-hg/term | 3 +++ .config/wmii-hg/wmiirc | 4 +--- .config/wmii-hg/workarounds.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 61 insertions(+), 8 deletions(-) create mode 100755 .config/wmii-hg/term create mode 100644 .config/wmii-hg/workarounds.sh (limited to '.config/wmii-hg') diff --git a/.config/wmii-hg/config.sh b/.config/wmii-hg/config.sh index 4b968b0..77d813f 100644 --- a/.config/wmii-hg/config.sh +++ b/.config/wmii-hg/config.sh @@ -229,9 +229,9 @@ Key() { $MODKEY-x) ## Open program menu local command command="$(path_ls "$_PATH" | wimenu -h "${HIST}.progs" -n 5000)" || return - ( PATH=$_PATH; unset _PATH NOTIFY_SOCKET; exec $command ) & ;; + runcmd "$command" & ;; $MODKEY-Return) ## Launch a terminal - ( PATH=$_PATH; unset _PATH NOTIFY_SOCKET; exec x-terminal-emulator ) & ;; + runcmd x-terminal-emulator & ;; ## Tag actions $MODKEY-t) ## Change to another tag @@ -246,6 +246,15 @@ Key() { esac } +runcmd() ( + PATH=$_PATH + unset NOTIFY_SOCKET # systemd + unset WMII_CONFPATH # wmii + unset _PATH WMII_NAMESPACE WMII_DIR # wmiirc + exec 8>&- # xinit/systemd handshake + exec systemd-run --user --scope -- sh -c "$*" +) + Action() { local prog=$(path_which "$WMII_CONFPATH" "$1"); shift if [ -n "$prog" ]; then diff --git a/.config/wmii-hg/include.sh b/.config/wmii-hg/include.sh index f8c4e0d..788e2af 100644 --- a/.config/wmii-hg/include.sh +++ b/.config/wmii-hg/include.sh @@ -8,8 +8,9 @@ if [[ -z "$WMII_NAMESPACE" ]]; then export WMII_NAMESPACE="$(wmiir namespace)" fi if [[ -z "$WMII_DIR" ]]; then - export WMII_DIR="${XDG_RUNTIME_DIR}/n/wmii${DISPLAY}" + export WMII_DIR="${XDG_RUNTIME_DIR}/wmii${DISPLAY}" fi +. workarounds.sh . util.sh . config.sh diff --git a/.config/wmii-hg/rbar.sh b/.config/wmii-hg/rbar.sh index 287f427..cf256dd 100644 --- a/.config/wmii-hg/rbar.sh +++ b/.config/wmii-hg/rbar.sh @@ -5,11 +5,11 @@ if [[ -z "$XDG_RUNTIME_DIR" ]]; then fi setup_trap() { - trap "rm -f -- \"\${XDG_RUNTIME_DIR}\"/n/wmii*/rbar/${1}" EXIT + trap "rm -f -- \"\${XDG_RUNTIME_DIR}\"/wmii*/rbar/${1}" EXIT } write() { - local dirs=("${XDG_RUNTIME_DIR}"/n/wmii*/rbar/) + local dirs=("${XDG_RUNTIME_DIR}"/wmii*/rbar/) sponge|tee -a "${dirs[@]/%/${1}}" > /dev/null } diff --git a/.config/wmii-hg/term b/.config/wmii-hg/term new file mode 100755 index 0000000..4ba9d29 --- /dev/null +++ b/.config/wmii-hg/term @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +. include.sh +exec urxvt \ No newline at end of file diff --git a/.config/wmii-hg/wmiirc b/.config/wmii-hg/wmiirc index 379de79..a66d3d9 100755 --- a/.config/wmii-hg/wmiirc +++ b/.config/wmii-hg/wmiirc @@ -12,9 +12,7 @@ fi wmiir xwrite /event WmiircQuit # close any existing wmiirc's Event WmiircStart -# Notify systemd that we're ready -systemd-notify READY=1 || true - +systemd-notify --ready || true trap "Event Quit" EXIT while read -r event; do diff --git a/.config/wmii-hg/workarounds.sh b/.config/wmii-hg/workarounds.sh new file mode 100644 index 0000000..b3d50fe --- /dev/null +++ b/.config/wmii-hg/workarounds.sh @@ -0,0 +1,42 @@ +#!/hint/bash + +## +# Just like systemd-notify(1), but slower, which is a shitty +# workaround for a race condition in systemd. +## +systemd-notify() { + local args + args="$(getopt -n systemd-notify -o h -l help,version,ready,pid::,status:,booted -- "$@")" + ret=$?; [[ $ret == 0 ]] || return $ret + eval set -- "$args" + + local arg_ready=false + local arg_pid=0 + local arg_status= + while [[ $# -gt 0 ]]; do + case "$1" in + -h|--help) command systemd-notify --help; return $?;; + --version) command systemd-notify --version; return $?;; + --ready) arg_ready=true; shift 1;; + --pid) arg_pid=${2:-$$}; shift 2;; + --status) arg_status=$2; shift 2;; + --booted) command systemd-notify --booted; return $?;; + --) shift 1; break;; + esac + done + + local our_env=() + if $arg_ready; then + our_env+=("READY=1") + fi + if [[ -n "$arg_status" ]]; then + our_env+=("STATUS=$arg_status") + fi + if [[ "$arg_pid" -gt 0 ]]; then + our_env+=("MAINPID=$arg_pid") + fi + our_env+=("$@") + local n + printf -v n '%s\n' "${our_env[@]}" + socat STDIO UNIX-SENDTO:"$NOTIFY_SOCKET" <<<"$n" +} -- cgit v1.2.3-2-g168b From 65cb251ba9d9203056c3c71e49576d7bd7e36069 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 27 Feb 2016 20:02:10 -0500 Subject: more systemd/x11 stuff --- .config/wmii-hg/quit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.config/wmii-hg') diff --git a/.config/wmii-hg/quit b/.config/wmii-hg/quit index b34a913..58d4db0 100755 --- a/.config/wmii-hg/quit +++ b/.config/wmii-hg/quit @@ -1,6 +1,6 @@ #!/usr/bin/env bash if type systemctl &>/dev/null; then - systemctl --user stop "wmii@$DISPLAY.service" + systemctl --user stop "wmii@$(systemd-escape -- "$DISPLAY").service" else . include.sh echo quit >> $WMII_DIR/ctl -- cgit v1.2.3-2-g168b