From c85d0d66c4fdbc2925ccb222156861ddf250a6da Mon Sep 17 00:00:00 2001 From: eoli3n Date: Thu, 14 May 2020 10:26:01 +0200 Subject: [PATCH] updated fish sync --- TODO | 4 +- roles/fish/README.md | 21 ++++++++++ .../files/fish/{ => cli}/conf.d/lscolors.fish | 0 .../fish/{ => cli}/conf.d/pure-symbol.fish | 0 roles/fish/files/fish/{ => cli}/config.fish | 0 .../files/fish/{ => cli}/functions/cat.fish | 0 .../files/fish/{ => cli}/functions/lh.fish | 0 .../fish/{ => cli}/functions/upfile.fish | 0 .../files/fish/{ => cli}/functions/vi.fish | 0 .../files/fish/desktop/conf.d/desktop.fish | 7 ++++ .../files/fish/desktop/functions/gpick.fish | 4 ++ .../functions/sway_getwindowinfo.fish | 0 roles/fish/files/fish/functions/cpic.fish | 4 -- roles/fish/files/fish/functions/gpull.fish | 4 -- roles/fish/files/fish/functions/gpush.fish | 4 -- roles/fish/files/laptop.fish | 3 -- roles/fish/tasks/main.yml | 42 +++++++++++-------- 17 files changed, 59 insertions(+), 34 deletions(-) create mode 100644 roles/fish/README.md rename roles/fish/files/fish/{ => cli}/conf.d/lscolors.fish (100%) rename roles/fish/files/fish/{ => cli}/conf.d/pure-symbol.fish (100%) rename roles/fish/files/fish/{ => cli}/config.fish (100%) rename roles/fish/files/fish/{ => cli}/functions/cat.fish (100%) rename roles/fish/files/fish/{ => cli}/functions/lh.fish (100%) rename roles/fish/files/fish/{ => cli}/functions/upfile.fish (100%) rename roles/fish/files/fish/{ => cli}/functions/vi.fish (100%) create mode 100644 roles/fish/files/fish/desktop/conf.d/desktop.fish create mode 100644 roles/fish/files/fish/desktop/functions/gpick.fish rename roles/fish/files/fish/{ => desktop}/functions/sway_getwindowinfo.fish (100%) delete mode 100644 roles/fish/files/fish/functions/cpic.fish delete mode 100644 roles/fish/files/fish/functions/gpull.fish delete mode 100644 roles/fish/files/fish/functions/gpush.fish delete mode 100644 roles/fish/files/laptop.fish diff --git a/TODO b/TODO index 8d2486f..27147e2 100644 --- a/TODO +++ b/TODO @@ -5,7 +5,6 @@ - sway keybind screens output # DE -* try a GTK theme with some transparency - tray menu theme and over window - firefox menu size when scaling * sway border issue : https://github.com/swaywm/sway/issues/5327 @@ -27,7 +26,8 @@ * wofi issues : https://todo.sr.ht/~scoopta/wofi # IMPROVMENTS -- dynamic username: sed 's/user/{{ user }}/g' and use templating +* try a GTK theme with some transparency +* dynamic username: sed 's/user/{{ user }}/g' and use templating - how to configure a user and root for desktop in one run ? - fish role is ugly - readd terminfo role diff --git a/roles/fish/README.md b/roles/fish/README.md new file mode 100644 index 0000000..0438434 --- /dev/null +++ b/roles/fish/README.md @@ -0,0 +1,21 @@ +##### files/fish tree + +- ``cli`` dir is the basedir and will be sync on all hosts +- ``desktop`` dir will be sync only on desktop hosts. +- If you want to configure something for a specific host, use this snippets in *fish* script: +``` +if test "$hostname" = "host1" + set -x key "value" +end +``` + +``` +fish +├── cli +│   ├── conf.d # Default config dir +│   ├── config.fish # Default config file +│   └── functions # Default functions dir +└── desktop + ├── conf.d # Desktop hosts config dir + └── functions # Desktop hosts functions dir +``` diff --git a/roles/fish/files/fish/conf.d/lscolors.fish b/roles/fish/files/fish/cli/conf.d/lscolors.fish similarity index 100% rename from roles/fish/files/fish/conf.d/lscolors.fish rename to roles/fish/files/fish/cli/conf.d/lscolors.fish diff --git a/roles/fish/files/fish/conf.d/pure-symbol.fish b/roles/fish/files/fish/cli/conf.d/pure-symbol.fish similarity index 100% rename from roles/fish/files/fish/conf.d/pure-symbol.fish rename to roles/fish/files/fish/cli/conf.d/pure-symbol.fish diff --git a/roles/fish/files/fish/config.fish b/roles/fish/files/fish/cli/config.fish similarity index 100% rename from roles/fish/files/fish/config.fish rename to roles/fish/files/fish/cli/config.fish diff --git a/roles/fish/files/fish/functions/cat.fish b/roles/fish/files/fish/cli/functions/cat.fish similarity index 100% rename from roles/fish/files/fish/functions/cat.fish rename to roles/fish/files/fish/cli/functions/cat.fish diff --git a/roles/fish/files/fish/functions/lh.fish b/roles/fish/files/fish/cli/functions/lh.fish similarity index 100% rename from roles/fish/files/fish/functions/lh.fish rename to roles/fish/files/fish/cli/functions/lh.fish diff --git a/roles/fish/files/fish/functions/upfile.fish b/roles/fish/files/fish/cli/functions/upfile.fish similarity index 100% rename from roles/fish/files/fish/functions/upfile.fish rename to roles/fish/files/fish/cli/functions/upfile.fish diff --git a/roles/fish/files/fish/functions/vi.fish b/roles/fish/files/fish/cli/functions/vi.fish similarity index 100% rename from roles/fish/files/fish/functions/vi.fish rename to roles/fish/files/fish/cli/functions/vi.fish diff --git a/roles/fish/files/fish/desktop/conf.d/desktop.fish b/roles/fish/files/fish/desktop/conf.d/desktop.fish new file mode 100644 index 0000000..42e46e9 --- /dev/null +++ b/roles/fish/files/fish/desktop/conf.d/desktop.fish @@ -0,0 +1,7 @@ +# Set path by host + +if test "$hostname" = "osz" + set -x fish_user_paths $HOME/bin $HOME/go/bin $HOME/.gem/ruby/2.7.0/bin +end + +set -x VAGRANT_DEFAULT_PROVIDER 'libvirt' diff --git a/roles/fish/files/fish/desktop/functions/gpick.fish b/roles/fish/files/fish/desktop/functions/gpick.fish new file mode 100644 index 0000000..fb9c70c --- /dev/null +++ b/roles/fish/files/fish/desktop/functions/gpick.fish @@ -0,0 +1,4 @@ +# Defined in - @ line 1 +function cpic --description 'alias cpic' + grim -g (slurp -p) -t ppm - | convert - -format '%[pixel:p{0,0}]' txt:- | tail -n1 | awk '{ print $3 }' | pastel color -; +end diff --git a/roles/fish/files/fish/functions/sway_getwindowinfo.fish b/roles/fish/files/fish/desktop/functions/sway_getwindowinfo.fish similarity index 100% rename from roles/fish/files/fish/functions/sway_getwindowinfo.fish rename to roles/fish/files/fish/desktop/functions/sway_getwindowinfo.fish diff --git a/roles/fish/files/fish/functions/cpic.fish b/roles/fish/files/fish/functions/cpic.fish deleted file mode 100644 index 4f149d5..0000000 --- a/roles/fish/files/fish/functions/cpic.fish +++ /dev/null @@ -1,4 +0,0 @@ -# Defined in - @ line 1 -function cpic --description 'alias cpic' - grim -g (slurp -p) -t ppm - | convert - -format '%[pixel:p{0,0}]' txt:-; -end diff --git a/roles/fish/files/fish/functions/gpull.fish b/roles/fish/files/fish/functions/gpull.fish deleted file mode 100644 index 7a4c258..0000000 --- a/roles/fish/files/fish/functions/gpull.fish +++ /dev/null @@ -1,4 +0,0 @@ -# Defined in - @ line 1 -function gpull --description 'Pull from googledrive to ~/googledrive/' - rclone sync googledrive: ~/googledrive/; -end diff --git a/roles/fish/files/fish/functions/gpush.fish b/roles/fish/files/fish/functions/gpush.fish deleted file mode 100644 index be31c16..0000000 --- a/roles/fish/files/fish/functions/gpush.fish +++ /dev/null @@ -1,4 +0,0 @@ -# Defined in - @ line 1 -function gpush --description 'Push from ~/googledrive/ to googledrive' - rclone sync ~/googledrive/ googledrive: ; -end diff --git a/roles/fish/files/laptop.fish b/roles/fish/files/laptop.fish deleted file mode 100644 index 0689dcb..0000000 --- a/roles/fish/files/laptop.fish +++ /dev/null @@ -1,3 +0,0 @@ -set -x fish_user_paths $HOME/bin $HOME/go/bin $HOME/.gem/ruby/2.7.0/bin -set -x BROWSER 'firefox' -set -x VAGRANT_DEFAULT_PROVIDER 'libvirt' diff --git a/roles/fish/tasks/main.yml b/roles/fish/tasks/main.yml index 744712a..2fade1a 100644 --- a/roles/fish/tasks/main.yml +++ b/roles/fish/tasks/main.yml @@ -42,24 +42,32 @@ src: dircolors dest: ~/.config/ -- name: Sync fish config files (root) +# Separated root|users synchronize as module bugs when using become on the task: it copies always in user homedir +- name: Sync fish config files for cli (if user) synchronize: - src: files/fish - dest: /root/.config - recursive: yes - when: ansible_user_id == "root" - tags: rsync - -- name: Sync fish config files (users) - synchronize: - src: files/fish - dest: ~/.config + src: fish/cli/ + dest: ~/.config/fish recursive: yes when: ansible_user_id != "root" - tags: rsync -- name: Laptops fish configuration - copy: - src: laptop.fish - dest: ~/.config/fish/conf.d/ - when: "'laptop' in {{ group_names }}" +- name: Sync fish config files for cli (if root) + synchronize: + src: fish/cli/ + dest: /root/.config/fish + recursive: yes + when: ansible_user_id == "root" + +- name: Sync fish config files for desktop (if user) + synchronize: + src: files/fish/desktop/ + dest: ~/.config/fish + recursive: yes + when: ansible_user_id != "root" + +- name: Sync fish config files for desktop (if root) + synchronize: + src: files/fish/desktop + dest: /root/.config/fish + recursive: yes + when: ansible_user_id == "root" +