From 164e54bafc7c6450ce71f9571d5b774cff310557 Mon Sep 17 00:00:00 2001 From: Urbain Vaes Date: Tue, 8 Mar 2016 11:49:33 +0000 Subject: Add Khoi's scripts --- .i3/config | 2 ++ bin/rename_workspace | 12 ++++++++++++ bin/tmux_attach | 9 +++++++++ 3 files changed, 23 insertions(+) create mode 100755 bin/rename_workspace create mode 100755 bin/tmux_attach diff --git a/.i3/config b/.i3/config index 0d5e9e6..7429767 100644 --- a/.i3/config +++ b/.i3/config @@ -187,3 +187,5 @@ bindsym XF86AudioPlay exec $HOME/bin/touchpad # font pango:DejaVu Sans Mono 10 bindsym F1 exec --no-startup-id feh --bg-fill --randomize /usr/share/backgrounds bindsym $mod+semicolon exec --no-startup-id $HOME/bin/run +bindsym $mod+z exec --no-startup-id $HOME/bin/tmux_attach +bindsym $mod+e exec --no-startup-id $HOME/bin/rename_workspace diff --git a/bin/rename_workspace b/bin/rename_workspace new file mode 100755 index 0000000..7636fd2 --- /dev/null +++ b/bin/rename_workspace @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +workspace=$(i3-msg -t get_outputs | grep -Po '"current_workspace":"[^\"]*"' | sed 's/"current_workspace":"\([^"]\+\)"/\1/g') +number=$(echo "${workspace//[!0-9]}") + +new_name=$(zenity --entry --title="Rename workspace" --entry-text "$workspace") +if [[ "$new_name" != *:* ]]; then + new_name="$number:$new_name" +fi + +echo $new_name +exec i3-msg rename workspace to "$new_name" diff --git a/bin/tmux_attach b/bin/tmux_attach new file mode 100755 index 0000000..564e3bb --- /dev/null +++ b/bin/tmux_attach @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +SESSIONS=$(tmux list-sessions | cut -d':' -f1) + +SESSION=$(echo "$SESSIONS" | dmenu -i -p "Session:" | tr -d '[[:space:]]') + +[[ -n $SESSION ]] || exit + +urxvt -e zsh -c "tmux new-session -A -s $SESSION" -- cgit v1.2.3