From 7df356950a6a6455a562ea6d349b03945e189e46 Mon Sep 17 00:00:00 2001 From: Akshay Date: Wed, 1 Feb 2023 21:37:39 +0530 Subject: tweak tmux --- scripts/default.nix | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-) (limited to 'scripts/default.nix') diff --git a/scripts/default.nix b/scripts/default.nix index 1c57566..627b121 100644 --- a/scripts/default.nix +++ b/scripts/default.nix @@ -38,41 +38,30 @@ let # fzf script to switch between tmux sessions tmux-fzf = pkgs.writeScriptBin "tmux-fzf" '' - tbin() { - ${pkgs.tmux}/bin/tmux "$@" - } - fbin() { - ${pkgs.fzf}/bin/fzf "$@" - } + LIST_DATA="#{session_name}/#{window_name}/#{pane_current_command}" + FZF_COMMAND="${pkgs.fzf}/bin/fzf-tmux -p --delimiter=: --with-nth 4 --color=hl:2" - __fzf() { - fbin --cycle --height 7 --reverse - } + TARGET_SPEC="#{session_name}:#{window_id}:#{pane_id}:" - __list_to_fzf() { - tbin ls -F "#{session_name}" | fzf - } + LINE=$(tmux list-windows -a -F "$TARGET_SPEC $LIST_DATA" | $FZF_COMMAND) || exit 0 + args=(''${LINE//:/ }) - if [ -n "$TMUX" ]; then - tbin switch-client -t "$(__list_to_fzf)" - else - tbin a -t "$(tbin ls -F "#{session_name}" | fbin)" - fi + ${pkgs.tmux}/bin/tmux select-window -t ''${args[1]} && tmux switch-client -t ''${args[0]} ''; - touchscreen = 21; - stylus = 15; + touchscreen = "ELAN9008:00 04F3:2ED6"; + stylus = "ELAN9008:00 04F3:2ED6 Stylus Pen (0)"; portait-transform = builtins.toString [ 0 (-1) 1 1 0 0 0 0 1 ]; landscape-transform = builtins.toString [ 0 0 0 0 0 0 0 0 0 ]; portrait = pkgs.writeScriptBin "portrait" '' ${pkgs.xorg.xrandr}/bin/xrandr -o left - ${pkgs.xorg.xinput}/bin/xinput set-prop ${builtins.toString touchscreen} --type=float "Coordinate Transformation Matrix" ${portait-transform} - ${pkgs.xorg.xinput}/bin/xinput set-prop ${builtins.toString stylus} --type=float "Coordinate Transformation Matrix" ${portait-transform} + ${pkgs.xorg.xinput}/bin/xinput set-prop ${touchscreen} --type=float "Coordinate Transformation Matrix" ${portait-transform} + ${pkgs.xorg.xinput}/bin/xinput set-prop ${stylus} --type=float "Coordinate Transformation Matrix" ${portait-transform} ''; landscape = pkgs.writeScriptBin "landscape" '' ${pkgs.xorg.xrandr}/bin/xrandr -o normal - ${pkgs.xorg.xinput}/bin/xinput set-prop ${builtins.toString touchscreen} --type=float "Coordinate Transformation Matrix" ${landscape-transform} - ${pkgs.xorg.xinput}/bin/xinput set-prop ${builtins.toString stylus} --type=float "Coordinate Transformation Matrix" ${landscape-transform} + ${pkgs.xorg.xinput}/bin/xinput set-prop ${touchscreen} --type=float "Coordinate Transformation Matrix" ${landscape-transform} + ${pkgs.xorg.xinput}/bin/xinput set-prop ${stylus} --type=float "Coordinate Transformation Matrix" ${landscape-transform} ''; in -- cgit v1.2.3