My personal project and infrastructure archive
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.
 
 
 
 
 
 
nomicon/infra/libkookie/modules/workstation/ui/i3/core/tools/i3-switch.nix

21 lines
670 B

/** 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.
*/
{ bottom, pkgs, ... }: with pkgs;
let dmenu-cmd = if bottom then
"${dmenu}/bin/dmenu -b -i \"$@\""
else
"${dmenu}/bin/dmenu -i \"$@\"";
in
writeShellScript "libkookie-i3-switch" ''
WS=$(${i3}/bin/i3-msg -t get_workspaces | \
${jq}/bin/jq -r -M '.[] | .name' | sort -u | \
${dmenu-cmd})
${i3}/bin/i3-msg workspace $WS
''