diff --git a/tasks/workstation/linux/software/tlp.yml b/tasks/workstation/linux/software/tlp.yml index 5a529f7..9f78fa3 100644 --- a/tasks/workstation/linux/software/tlp.yml +++ b/tasks/workstation/linux/software/tlp.yml @@ -134,3 +134,41 @@ - "ln -sf {{ runit_script_dir }}/{{ tlp_service }} {{ runit_service_dir }}/{{ tlp_service }}" #- "sv start {{ tlp_service }}" # Not necessary and sometimes gives a false negative. when: ansible_service_mgr == "runit" + +- name: Workstation | Linux | Software | TLP | runit | Functions & Aliases + blockinfile: + path: "{{ item }}" + block: | + function tlp-devices { + if [[ ! -z "$@" ]]; then + tlp-devices + echo -e "\nApplying '$@'...\n" + fi + wifi $@ + bluetooth $@ + nfc $@ + wwan $@ + } + alias devices="tlp-devices " + + function all-off { + tlp-devices off + mullvad disconnect + } + alias off="all-off " + + function all-on { + tlp-devices on + mullvad connect + mullvad reconnect + } + alias on="all-on " + marker: '# {mark} MANAGED BY ANSIBLE | tlp' + state: present + create: yes + backup: no + loop: + - "{{ user_user.home }}/.bashrc" + - "{{ user_user.home }}/.zshrc" + - "{{ user_root.home }}/.bashrc" + - "{{ user_root.home }}/.zshrc"