diff options
author | Alex S | 2017-05-16 11:47:14 +0200 |
---|---|---|
committer | Alex S | 2017-05-16 11:47:14 +0200 |
commit | 1264eb2c29bdde6930809be8866ae200f930c2c1 (patch) | |
tree | aaae64f3b69a790c913d8139d19e0e663c78bd1a | |
download | aur-1264eb2c29bdde6930809be8866ae200f930c2c1.tar.gz |
First push
-rw-r--r-- | .SRCINFO | 11 | ||||
-rw-r--r-- | PKGBUILD | 63 |
2 files changed, 74 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..e10bc149fc71 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,11 @@ +pkgbase = display-mode-switcher + pkgdesc = The simple application to switch the display with one click between single and dual mode + pkgver = 0.1 + pkgrel = 0 + url = http://aur.archlinux.org/packages/display-mode-switcher/ + arch = any + license = BSD + depends = gnome-shell + +pkgname = display-mode-switcher + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..f08aa8ef45ef --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,63 @@ +# Maintainer: Alex S. shantanna_at_hotmail_dot_com> + +pkgname=display-mode-switcher +_pkgname=dispswitch +pkgver=0.1 +pkgrel=0 +pkgdesc="The simple application to switch the display with one click between single and dual mode" +arch=('any') +url="http://aur.archlinux.org/packages/display-mode-switcher/" +license=('BSD') +depends=('gnome-shell') + +package() { + msg2 "Creating launcher..." + cd "${srcdir}" || exit + cat > "${srcdir}/Display mode switcher.desktop" << EOF +#!/usr/bin/env xdg-open +[Desktop Entry] +Type=Application +Name=Display mode switcher +Comment=The simple program to switch the display with one klick betwin single and dual mode +Exec=/usr/bin/${_pkgname} +Icon=preferences-desktop-display +Terminal=false +Categories=GNOME;GTK;Settings;HardwareSettings; +EOF + install -Dm644 Display\ mode\ switcher.desktop "${pkgdir}/usr/share/applications/Display mode switcher.desktop" + + msg2 "Creating application..." + cat > "${srcdir}/${_pkgname}" << EOF +#!/bin/sh + +prim_disp=$(xrandr | grep '\<connected primary\>' | awk 'NR==1 { print $1 }') +sec_disp=$(xrandr | grep '\<connected\>' | sed '/primary/d' | awk 'NR==1 { print $1 }') + +if [ ! "$sec_disp" ]; then + notify-send "No additional display(s) connected" +else + case $@ in + -on|-ON) + xrandr --output $sec_disp --right-of $prim_disp --auto + notify-send "Multi-display mode is ON" + ;; + -off|-OFF) + xrandr --output $sec_disp --off + notify-send "Multi-display mode is OFF" + ;; + *) + if [ "$#" -eq "0" ] && [ ! "`xrandr | grep -E "$sec_disp connected [[:digit:]]"`" ]; then + xrandr --output $sec_disp --right-of $prim_disp --auto + notify-send "Multi-display mode is ON" + elif [ "$#" -eq "0" ] && [ "`xrandr | grep -E "$sec_disp connected [[:digit:]]"`" ]; then + xrandr --output $sec_disp --off + notify-send "Multi-display mode is OFF" + fi + ;; + esac +fi +exit 0 +EOF + install -Dm755 ${_pkgname} "${pkgdir}/usr/bin/${_pkgname}" + chmod +x "${pkgdir}/usr/bin/${_pkgname}" +} |