diff options
author | Akshay <[email protected]> | 2023-02-01 16:07:39 +0000 |
---|---|---|
committer | Akshay <[email protected]> | 2023-02-01 16:07:39 +0000 |
commit | 7df356950a6a6455a562ea6d349b03945e189e46 (patch) | |
tree | 9b69006779e1dae6fadd3d09e3601f5c9b1ca90e /scripts | |
parent | cec4fcabdab7a1bd137130111e8ee6567686815c (diff) |
tweak tmux
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/default.nix | 35 |
1 files changed, 12 insertions, 23 deletions
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 | |||
38 | 38 | ||
39 | # fzf script to switch between tmux sessions | 39 | # fzf script to switch between tmux sessions |
40 | tmux-fzf = pkgs.writeScriptBin "tmux-fzf" '' | 40 | tmux-fzf = pkgs.writeScriptBin "tmux-fzf" '' |
41 | tbin() { | 41 | LIST_DATA="#{session_name}/#{window_name}/#{pane_current_command}" |
42 | ${pkgs.tmux}/bin/tmux "$@" | 42 | FZF_COMMAND="${pkgs.fzf}/bin/fzf-tmux -p --delimiter=: --with-nth 4 --color=hl:2" |
43 | } | ||
44 | fbin() { | ||
45 | ${pkgs.fzf}/bin/fzf "$@" | ||
46 | } | ||
47 | 43 | ||
48 | __fzf() { | 44 | TARGET_SPEC="#{session_name}:#{window_id}:#{pane_id}:" |
49 | fbin --cycle --height 7 --reverse | ||
50 | } | ||
51 | 45 | ||
52 | __list_to_fzf() { | 46 | LINE=$(tmux list-windows -a -F "$TARGET_SPEC $LIST_DATA" | $FZF_COMMAND) || exit 0 |
53 | tbin ls -F "#{session_name}" | fzf | 47 | args=(''${LINE//:/ }) |
54 | } | ||
55 | 48 | ||
56 | if [ -n "$TMUX" ]; then | 49 | ${pkgs.tmux}/bin/tmux select-window -t ''${args[1]} && tmux switch-client -t ''${args[0]} |
57 | tbin switch-client -t "$(__list_to_fzf)" | ||
58 | else | ||
59 | tbin a -t "$(tbin ls -F "#{session_name}" | fbin)" | ||
60 | fi | ||
61 | ''; | 50 | ''; |
62 | 51 | ||
63 | touchscreen = 21; | 52 | touchscreen = "ELAN9008:00 04F3:2ED6"; |
64 | stylus = 15; | 53 | stylus = "ELAN9008:00 04F3:2ED6 Stylus Pen (0)"; |
65 | portait-transform = builtins.toString [ 0 (-1) 1 1 0 0 0 0 1 ]; | 54 | portait-transform = builtins.toString [ 0 (-1) 1 1 0 0 0 0 1 ]; |
66 | landscape-transform = builtins.toString [ 0 0 0 0 0 0 0 0 0 ]; | 55 | landscape-transform = builtins.toString [ 0 0 0 0 0 0 0 0 0 ]; |
67 | portrait = pkgs.writeScriptBin "portrait" '' | 56 | portrait = pkgs.writeScriptBin "portrait" '' |
68 | ${pkgs.xorg.xrandr}/bin/xrandr -o left | 57 | ${pkgs.xorg.xrandr}/bin/xrandr -o left |
69 | ${pkgs.xorg.xinput}/bin/xinput set-prop ${builtins.toString touchscreen} --type=float "Coordinate Transformation Matrix" ${portait-transform} | 58 | ${pkgs.xorg.xinput}/bin/xinput set-prop ${touchscreen} --type=float "Coordinate Transformation Matrix" ${portait-transform} |
70 | ${pkgs.xorg.xinput}/bin/xinput set-prop ${builtins.toString stylus} --type=float "Coordinate Transformation Matrix" ${portait-transform} | 59 | ${pkgs.xorg.xinput}/bin/xinput set-prop ${stylus} --type=float "Coordinate Transformation Matrix" ${portait-transform} |
71 | ''; | 60 | ''; |
72 | landscape = pkgs.writeScriptBin "landscape" '' | 61 | landscape = pkgs.writeScriptBin "landscape" '' |
73 | ${pkgs.xorg.xrandr}/bin/xrandr -o normal | 62 | ${pkgs.xorg.xrandr}/bin/xrandr -o normal |
74 | ${pkgs.xorg.xinput}/bin/xinput set-prop ${builtins.toString touchscreen} --type=float "Coordinate Transformation Matrix" ${landscape-transform} | 63 | ${pkgs.xorg.xinput}/bin/xinput set-prop ${touchscreen} --type=float "Coordinate Transformation Matrix" ${landscape-transform} |
75 | ${pkgs.xorg.xinput}/bin/xinput set-prop ${builtins.toString stylus} --type=float "Coordinate Transformation Matrix" ${landscape-transform} | 64 | ${pkgs.xorg.xinput}/bin/xinput set-prop ${stylus} --type=float "Coordinate Transformation Matrix" ${landscape-transform} |
76 | ''; | 65 | ''; |
77 | 66 | ||
78 | in | 67 | in |