aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/modules/workstation/ui/i3/core/tools/i3-switch.nix
blob: 4e1cd4dd53af227f5db2efb44205617f424bd967 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/**    A utility script to switch to a workspace
 *
 *  This tool relies on i3-msg, jq, and dmenu to switch to a different
 *  workspace.  In the future, maybe the display mechanism (dmenu)
 *  could be made configurable, so not to rely on nazi code.
 */

{ pkgs, ... }: with pkgs; writeShellScript "libkookie-i3-switch" ''

  WS=$(${i3}/bin/i3-msg -t get_workspaces | \
    ${jq}/bin/jq -r -M '.[] | .name' | sort -u | \
    ${dmenu}/bin/dmenu -b -i "$@")
  
  ${i3}/bin/i3-msg workspace $WS
''