36 lines
1.1 KiB
Bash
Executable File
36 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env zsh
|
|
|
|
#set -x
|
|
old_profile="$(kanshictl status | jq -r '.current_profile')"
|
|
new_profile="${1}"
|
|
shift
|
|
|
|
if [[ "${old_profile}" == "${new_profile}" ]]; then
|
|
if [[ "${1}" != "--force" ]] && [[ "${1}" != '-f' ]]; then
|
|
exit 0
|
|
fi
|
|
fi
|
|
|
|
case "${new_profile}" in
|
|
home_office)
|
|
perl -pi -e 'if (/shell/) {s/monitor:.*?,/monitor:DP-6,/}' ${XDG_CONFIG_HOME}/hypr/workspaces.conf
|
|
perl -pi -e 'if (/browser/) {s/monitor:.*?,/monitor:DP-6,/}' ${XDG_CONFIG_HOME}/hypr/workspaces.conf
|
|
perl -pi -e 'if (/work/) {s/monitor:.*?,/monitor:HDMI-A-1,/}' ${XDG_CONFIG_HOME}/hypr/workspaces.conf
|
|
perl -pi -e 'if (/jobs/) {s/monitor:.*?,/monitor:HDMI-A-1,/}' ${XDG_CONFIG_HOME}/hypr/workspaces.conf
|
|
kanshictl switch home_office
|
|
hyprctl reload
|
|
killall -s USR2 waybar
|
|
;;
|
|
single_headed)
|
|
perl -pi -e 's/monitor:.*?,/monitor:eDP-1,/' ${XDG_CONFIG_HOME}/hypr/workspaces.conf
|
|
kanshictl switch single_headed
|
|
hyprctl reload
|
|
killall -s USR2 waybar
|
|
;;
|
|
*)
|
|
print "Invalid profile!" >&2
|
|
;;
|
|
esac
|
|
|
|
#set +x
|