Sfoglia il codice sorgente

Updated to allow layouts to be applied to other workspaces

Samuel W. Flint 7 anni fa
parent
commit
3e7a6b8dd5
1 ha cambiato i file con 15 aggiunte e 1 eliminazioni
  1. 15 1
      i3-layout

+ 15 - 1
i3-layout

@@ -33,6 +33,16 @@ function apply-workspace {
     fi
 }
 
+function apply-workspace-number {
+    # i3-msg "workspace number ${WORKSPACENUMBER}"
+    if [[ -e ~/.config/i3/layouts/${LAYOUT}.json ]] ; then
+        i3-msg "workspace number ${WORKSPACE}; append_layout ~/.config/i3/layouts/${LAYOUT}.json"
+        [[ -e ~/.config/i3/layouts/${LAYOUT}.after ]] && sh ~/.config/i3/layouts/${LAYOUT}.after
+    else
+        i3-nagbar -m "${LAYOUT} not available" -t error
+    fi
+}
+
 function with-external-completion {
     if [[ -e `which rofi` ]] ; then
         LAYOUT=`list-workspaces | rofi -dmenu -p "workspace layout:"`
@@ -58,5 +68,9 @@ case ${LAYOUT} in
         with-external-completion
         ;;
     *)
-        apply-workspace
+        if [[ $WORKSPACE != "" ]] ; then
+            apply-workspace-number
+        else
+            apply-workspace
+        fi
 esac