From 49d078ae2fdb041d52a1adf5ebdcc6fe4f14c079 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20K=C3=B6rber?= Date: Fri, 14 Feb 2020 14:30:43 +0100 Subject: [PATCH] Implement presentation mode --- i3/i3status.conf.j2 | 6 ++++++ i3/scripts/presentation-mode | 40 ++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100755 i3/scripts/presentation-mode diff --git a/i3/i3status.conf.j2 b/i3/i3status.conf.j2 index c9de030..5d9655c 100644 --- a/i3/i3status.conf.j2 +++ b/i3/i3status.conf.j2 @@ -22,6 +22,7 @@ general { order += volume_status order += spotify order += "wifi" +order += presentation_mode order += online_status order += "battery_level all" order += "clock" @@ -60,6 +61,11 @@ spotify { on_click 2 = "exec $HOME/.i3/scripts/spotify-control next" } +async_script presentation_mode { + format = "{output}" + script = "$HOME/.i3/scripts/presentation-mode status" +} + online_status { format = " {icon} " } diff --git a/i3/scripts/presentation-mode b/i3/scripts/presentation-mode new file mode 100755 index 0000000..71dc77d --- /dev/null +++ b/i3/scripts/presentation-mode @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +_status_file="${RUNDIR}/presentation-mode-on" +_autostart="$HOME/.autostart.sh" + +is_on() { + [[ -e "${_status_file}" ]] +} + +switch_on() { + touch "${_status_file}" + systemctl --user --no-block stop dunst_user + systemctl --user --no-block stop redshift +} + +switch_off() { + rm -f "${_status_file}" + "$_autostart" dunst_user redshift +} + + +case "$1" in + status) + if is_on ; then + printf "on\n" + printf '#F4BF75' + else + printf "off\n" + # printf '#F4BF75' + fi + ;; + toggle) + if is_on ; then + switch_off + else + switch_on + fi +esac + +