68 lines
3.7 KiB
Bash
Executable File
68 lines
3.7 KiB
Bash
Executable File
#! /bin/bash
|
|
data="$HOME"/.local/share/tromjaro-layouts
|
|
icons=$data/icons
|
|
profiles=$data/profiles
|
|
enable-global-menus() {
|
|
pacman -Qq vala-panel-appmenu-registrar ||
|
|
zensu SKIP_AUTOSNAP= pacman -S --noconfirm vala-panel-appmenu-registrar ||
|
|
{ notify-send 'Error' 'failed installing vala-panel-appmenu-registrar !\nmake sure you type the correct password\nEnabling the internet connection might solve the issue'; exit; }
|
|
pacman -Qq vala-panel-appmenu-registrar || exit
|
|
}
|
|
disable-global-menus() {
|
|
! pacman -Qq vala-panel-appmenu-registrar ||
|
|
zensu SKIP_AUTOSNAP= pacman -R --noconfirm vala-panel-appmenu-registrar ||
|
|
{ notify-send 'Error' 'failed removing vala-panel-appmenu-registrar !\nmake sure you type the correct password'; exit; }
|
|
pacman -Qq vala-panel-appmenu-registrar && exit
|
|
killall appmenu-registrar &
|
|
}
|
|
choice=$(
|
|
yad --no-buttons --center --keep-icon-size --separator='' --use-interp --title 'Layout Switch' --text-align=center --text 'Changing to or from any layout that has global menus, will require your admin password' --form --columns 3 \
|
|
--field=!"$icons/windows.png"!'Windows-Like':BTN "kill -USR1 \$YAD_PID; echo -n 'Windows-Like'" \
|
|
--field=!"$icons/macos.png"!'MacOS-Like':BTN "kill -USR1 \$YAD_PID; echo -n 'MacOS-Like'" \
|
|
--field=!"$icons/mx.png"!'MX-Like':BTN "kill -USR1 \$YAD_PID; echo -n 'MX-Like'" \
|
|
--field=!"$icons/gnome.png"!'Gnome-Like':BTN "kill -USR1 \$YAD_PID; echo -n 'Gnome-Like'" \
|
|
--field=!"$icons/unity.png"!'Unity-Like /default/':BTN "kill -USR1 \$YAD_PID; echo -n 'Unity-Like /default/'" \
|
|
--field=!"$icons/topx.png"!'TopX-Like':BTN "kill -USR1 \$YAD_PID; echo -n 'TopX-Like'"
|
|
)
|
|
case "$choice" in
|
|
'Windows-Like')
|
|
disable-global-menus
|
|
xfconf-query -c xfwm4 -p /general/borderless_maximize -n -t bool -s true &
|
|
xfconf-query -c xfwm4 -p /general/titleless_maximize -n -t bool -s false &
|
|
xfconf-query -c xfwm4 -p /general/button_layout -n -t string -s "|HMC" &
|
|
xfce4-panel-profiles load "$profiles"/Windows-Like.tar.bz2 & ;;
|
|
'Unity-Like /default/')
|
|
enable-global-menus
|
|
xfconf-query -c xfwm4 -p /general/borderless_maximize -n -t bool -s true &
|
|
xfconf-query -c xfwm4 -p /general/titleless_maximize -n -t bool -s true &
|
|
xfconf-query -c xfwm4 -p /general/button_layout -n -t string -s "CMH|" &
|
|
xfce4-panel-profiles load "$profiles"/Unity-Like.tar.bz2 & ;;
|
|
'MX-Like')
|
|
disable-global-menus
|
|
xfconf-query -c xfwm4 -p /general/borderless_maximize -n -t bool -s true &
|
|
xfconf-query -c xfwm4 -p /general/titleless_maximize -n -t bool -s false &
|
|
xfconf-query -c xfwm4 -p /general/button_layout -n -t string -s "|HMC" &
|
|
xfce4-panel-profiles load "$profiles"/MX-Like.tar.bz2 & ;;
|
|
'MacOS-Like')
|
|
enable-global-menus
|
|
xfconf-query -c xfwm4 -p /general/borderless_maximize -n -t bool -s true &
|
|
xfconf-query -c xfwm4 -p /general/titleless_maximize -n -t bool -s true &
|
|
xfconf-query -c xfwm4 -p /general/button_layout -n -t string -s "CMH|" &
|
|
xfce4-panel-profiles load "$profiles"/MacOS-Like.tar.bz2 & ;;
|
|
'Gnome-Like')
|
|
disable-global-menus
|
|
xfconf-query -c xfwm4 -p /general/borderless_maximize -n -t bool -s true &
|
|
xfconf-query -c xfwm4 -p /general/titleless_maximize -n -t bool -s false &
|
|
xfconf-query -c xfwm4 -p /general/button_layout -n -t string -s "|HMC" &
|
|
xfce4-panel-profiles load "$profiles"/Gnome-Like.tar.bz2 & ;;
|
|
'TopX-Like')
|
|
disable-global-menus
|
|
xfconf-query -c xfwm4 -p /general/borderless_maximize -n -t bool -s true &
|
|
xfconf-query -c xfwm4 -p /general/titleless_maximize -n -t bool -s false &
|
|
xfconf-query -c xfwm4 -p /general/button_layout -n -t string -s "|HMC" &
|
|
xfce4-panel-profiles load "$profiles"/TopX-Like.tar.bz2 & ;;
|
|
*) exit ;;
|
|
esac
|
|
|
|
sleep 5 && notify-send "$choice layout was enabled"
|