You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

on-focus-workspace 927B

2 年之前
2 年之前
3 年之前
2 年之前
1234567891011121314151617181920212223242526272829303132333435
  1. #!/usr/bin/fish
  2. # get workspace
  3. if count $argv
  4. set ws $argv[1]
  5. else
  6. set ws (i3-msg -t get_workspaces | jq --raw-output '.[]|select(.focused == true).name') | grep -oP '([0-9]*:)?\K(.*)'
  7. end
  8. set ws_regex (string escape --style=regex $ws)
  9. # set todo line
  10. set todo_file ~/todo.txt
  11. if test -e $todo_file
  12. set todo_i3block_sock ~/.todo/i3block.sock
  13. grep -v '^x ' $todo_file | grep -P " @ws:$ws_regex(\s|\$)" | head -n 1 | string trim | read todo
  14. if test -z $todo
  15. echo - | socat STDIN UNIX-CONNECT:$todo_i3block_sock
  16. else
  17. echo $todo | sed -e 's/ @ws:[^\s].*//g' -e 's/ uuid:[0-9a-f\-]*//g' | socat STDIN UNIX-CONNECT:$todo_i3block_sock
  18. end
  19. end
  20. # focus script
  21. set focus_script ~/.workspaces/$ws/focus
  22. if type -q $focus_script
  23. $focus_script
  24. else
  25. i3-msg mode default
  26. end
  27. # space script
  28. set space_script ~/.workspaces/$ws/space
  29. if type -q $space_script
  30. systemctl --user start workspace-app@$ws.service
  31. end