diff --git a/files/usr/local/bin/toggle-wm b/files/usr/local/bin/toggle-wm new file mode 100755 index 0000000..690d31d --- /dev/null +++ b/files/usr/local/bin/toggle-wm @@ -0,0 +1,64 @@ +#!/bin/bash + +usage () { +echo "" +echo usage: +echo "$0 [-t|-e|-s]" +echo "" +echo "-t toggle current mode (default)" +echo "-e set expert mode" +echo "-s set standard mode" +echo "" +exit 1 +} + + +MODE=toggle + +while getopts tes option +do + case $option in + t) ;; + e) MODE=setexp + ;; + s) MODE=setstd + ;; + *) usage + ;; + esac +done + +do-std () { + echo setting std mode... + gsettings set org.gnome.desktop.wm.preferences focus-mode "'click'" + gsettings set org.gnome.desktop.wm.keybindings raise-or-lower "@as []" + gsettings set org.gnome.desktop.wm.preferences raise-on-click true +} + +do-exp () { + echo setting expert mode... + gsettings set org.gnome.desktop.wm.preferences focus-mode "'sloppy'" + gsettings set org.gnome.desktop.wm.keybindings raise-or-lower "['1']" + gsettings set org.gnome.desktop.wm.preferences raise-on-click false +} + +do-toggle () { + FOCUS=`gsettings get org.gnome.desktop.wm.preferences focus-mode` + if [[ $FOCUS == "'sloppy'" ]] + then + do-std + else + do-exp + fi +} + +echo MODE=$MODE + +case $MODE in + setexp) do-exp + ;; + setstd) do-std + ;; + toggle) do-toggle + ;; +esac diff --git a/tasks/main.yml b/tasks/main.yml index f0f084f..abc39be 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -44,3 +44,9 @@ dest: '/etc/dconf/profile/user' mode: '644' notify: 'Rebuild dconf database' + +- name: Install wm toggle script + ansible.builtin.copy: + src: 'usr/local/bin/toggle-wm' + dest: '/usr/local/bin/toggle-wm' + mode: '755' diff --git a/templates/etc/dconf/db/local.d/20_advanced_wm_settings.j2 b/templates/etc/dconf/db/local.d/20_advanced_wm_settings.j2 index a0d61ca..d676e58 100644 --- a/templates/etc/dconf/db/local.d/20_advanced_wm_settings.j2 +++ b/templates/etc/dconf/db/local.d/20_advanced_wm_settings.j2 @@ -1,15 +1,5 @@ # advanced settings for window manager {% if potos_dconf_20_advanced_wm_settings is defined and potos_dconf_20_advanced_wm_settings %} -# focus follows mouse, but no autoraise -# make alt1/alt2 keybindings - -[org/gnome/desktop/wm/preferences] -focus-mode='sloppy' -auto-raise=false -raise-on-click=false - -[org/gnome/desktop/wm/keybindings] -raise-or-lower=['1'] [org/gnome/desktop/peripherals/touchpad] click-method='areas'