بسم الله الرحمن الرحيم

Pendahuluan

Presentation Mode. Beberapa teman-teman yang menggunakan XFCE pasti pernah menggunakan fitur ini. Fitur yang membuat system kita tidak bisa melakukan sleep/standby. Biasanya kita gunakan ditengah presentasi atau sedang menonton film.

Pada catatan kali ini, kita akan meniru Presentation Mode tersebut tanpa menggunakan xfce4-power-manager, melainkan menggunakan DPMS (Display Power Management Signal) yang dapat kita on dan off kan melalui xset.

DPMS (Display Power Management Signaling) enables power saving behaviour of monitors when the computer is not in use.

Arch Wiki - Display Power Management Signal

Paket yang Diperlukan

Pastikan paket xorg-xset sudah terpasang.

extra/xorg-xset 1.2.4-3 (19.0 KiB 39.8 KiB) [xorg-apps xorg]
  User preference utility for X

Cara Penggunaan

Melihat value dari DPMS

Secara default, DPMS sudah dalam keadaan aktif. Kita dapat melihat query parameter apa saja yang tersedia dengan perintah:

$ xset q
...
...

DPMS (Energy Star):
  Standby: 300    Suspend: 0    Off: 600
  DPMS is Enabled
  Monitor is On

Presentation Mode ON atau OFF

Presentation Mode ON

$ xset -dpms


Presentation Mode OFF

$ xset +dpms

Bonus!

dmenu-presentationmode

FILE~/.local/bin/dmenu-presentationmode
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash

# Deps:
# - xorg-xset
# - dmenu
# - dunst
# - jq

presentation_on() {
    xset -dpms
    dunstify "Presentation Mode: ON" "(DPMS Disabled)" -t 3000 -r 1
}

presentation_off() {
    xset +dpms
    dunstify "Presentation Mode: OFF" "(DPMS Enabled)" -t 3000 -r 1
}

presentation_status() {
    dpms_status=$(xset q | grep 'DPMS is' | awk 'NF>1{print $NF}')
    if [[ $dpms_status = "Enabled" ]]; then
        status="OFF"
    else
        status="ON"
    fi
    dunstify "Presentation Mode: $status"
}

main() {
    OPTIONS='''
    [
    ["On",     "presentation_on"],
    ["Off",    "presentation_off"],
    ["Status", "presentation_status"]
    ]
    '''

    OBJ_MENU=$(echo $OPTIONS | jq -r '.[][0]' | dmenu -i -p ' Presentation Mode')
    OBJ_SELECTED=$(echo $OPTIONS | jq -r ".[] | select(.[0] == \"$OBJ_MENU\") | .[1]")

    $OBJ_SELECTED
}

main

Pesan Penulis

Penggunaan lebih lanjut saya serahkan pada imajinasi dan kreatifitas teman-teman.

Terima kasih sudah mampir yaa.

Referensi

  1. https://wiki.archlinux.org/title/Display_Power_Management_Signaling
    Diakses tanggal: 2022/07/31


Penulis

bandithijo

My journey kicks off from reading textbooks as a former Medical Student to digging bugs as a Software Engineer – a delightful rollercoaster of career twists. Embracing failure with the grace of a Cat avoiding water, I've seamlessly transitioned from Stethoscope to Keyboard. Armed with ability for learning and adapting faster than a Heart Beat, I'm on a mission to turn Code into a Product.

- Rizqi Nur Assyaufi

f3483b4443d04be70121f670e132e0d8dabe5719