URI:
       Merge remote-tracking branch 'origin/pr/1' - qmenu - manage qubes os via dmenu (drkhsh fork)
  HTML git clone git://git.drkhsh.at/qmenu.git
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit 1f6e768a4656288f389cef17f7fc64de857191cd
   DIR parent f534d0e9462d029a6bf6bfdb573cc480ee36f001
  HTML Author: Frédéric Pierret (fepitre) <frederic.pierret@qubes-os.org>
       Date:   Sun,  9 Feb 2020 19:11:34 +0100
       
       Merge remote-tracking branch 'origin/pr/1'
       
       * origin/pr/1:
         spec: add config(noreplace) for qemu.conf
         travis: add ShellCheck on qmenu scripts
         Create system wide configuration file qmenu.conf
         Add RPM packaging, travis and gitignore
       
       Diffstat:
         A .gitignore                          |       2 ++
         A .travis.yml                         |      13 +++++++++++++
         A Makefile.builder                    |       2 ++
         M qmenu-al                            |     135 +++++++++++++++----------------
         M qmenu.conf                          |       9 ---------
         A qmenu.spec.in                       |      39 +++++++++++++++++++++++++++++++
         A version                             |       1 +
       
       7 files changed, 122 insertions(+), 79 deletions(-)
       ---
   DIR diff --git a/.gitignore b/.gitignore
       @@ -0,0 +1,2 @@
       +pkgs/
       +*.tar.gz
   DIR diff --git a/.travis.yml b/.travis.yml
       @@ -0,0 +1,13 @@
       +sudo: required
       +dist: bionic
       +language: generic
       +install: git clone https://github.com/QubesOS/qubes-builder ~/qubes-builder
       +script: ~/qubes-builder/scripts/travis-build
       +env:
       + - DIST_DOM0=fc25 USE_QUBES_REPO_VERSION=4.0 USE_QUBES_REPO_TESTING=1
       + - DISTS_VM=fc30 USE_QUBES_REPO_VERSION=4.0 USE_QUBES_REPO_TESTING=1
       +
       +jobs:
       +  include:
       +    - env: TEST=shellcheck
       +      script: shellcheck qmenu-*
   DIR diff --git a/Makefile.builder b/Makefile.builder
       @@ -0,0 +1 @@
       +RPM_SPEC_FILES := qmenu.spec
       +\ No newline at end of file
   DIR diff --git a/qmenu-al b/qmenu-al
       @@ -1,81 +1,76 @@
        #!/bin/sh
       +# Author: SINE3o14NNAE <https://github.com/sine3o14nnae/qmenu/>
        
       -if [ "$2" = "--light-theme" ]; then
       +help() {
       +  printf "qmenu-al [OPTION] (--light-theme)\nLaunch domU applications.\n\n --all\n --focused\n"
       +}
        
       -  theme_0='#ffffff'
       -  theme_1='#000000'
       +if [ "$2" = "--light-theme" ]; then
       +    theme_0='#ffffff'
       +    theme_1='#000000'
        else
       -
       -  theme_0='#000000'
       -  theme_1='#ffffff'
       +    theme_0='#000000'
       +    theme_1='#ffffff'
        fi
        
        case $1 in
       -
       -  --all)
       -
       -    app_list=$(cat "$HOME"/.local/share/applications/*.desktop |\
       -      grep '^Name=.*\|^Exec=.*' | grep -vw 'Qube Settings\|qubes-vm-settings')
       -
       -
       -    chosen=$(echo "$app_list" | grep '^Name=.*' | cut -c 6- |\
       -      dmenu -f -m 0 -nb $theme_0 -nf $theme_1 -sb $theme_1 -sf $theme_0)
       -
       -    if [ -n "$chosen" ]; then
       -
       -      if ! $(echo "$app_list" | grep -A1 "$chosen" |\
       -        grep '^Exec=.*' | cut -c 6-); then exit 2; fi
       -
       -      exit 0
       -    fi
       -
       -    exit 1;;
       -
       -  --focused)
       -
       -    qube=$(xprop -id "$(xdotool getwindowfocus)" |\
       -      grep -w "^_QUBES_VMNAME(STRING)" |\
       -      cut -f2 -d\")
       -
       -    if [ -n "$qube" ]; then
       -
       -      qube_label=$(qvm-ls --raw-data "$qube" -O LABEL)
       -
       -      # Change label colors according to 
       -      # ~/.config/qmenu.conf if that file exists.
       -      if [ -f "$HOME/.config/qmenu.conf" ]; then
       -
       -        qube_label=$(grep "^$qube_label=" "$HOME"/.config/qmenu.conf |\
       -          cut -d= -f2)
       -      fi
       -
       -      app_list=$(cat "$HOME"/.local/share/qubes-appmenus/"$qube"/apps/*.desktop |\
       -        grep '^Name=.*\|^Exec=.*' |\
       -        grep -vw 'Qube Settings\|qubes-vm-settings')
       -
       -      chosen=$(echo "$app_list" | grep '^Name=.*' | cut -f2- -d: |\
       -        dmenu -p "$qube:" -f -m 0 -nb $theme_0 -nf $theme_1 -sb "$qube_label" -sf $theme_1)
       -
       -      if [ -n "$chosen" ]; then
       -
       -        if ! $(echo "$app_list" | grep -A1 "$chosen" |\
       -          grep '^Exec=.*' | cut -c 6-); then exit 2; fi
       -
       -        exit 0
       -      fi
       -
       -      exit 1
       -    fi
       -
       -    exit 2;;
       -
       -  *)
       -
       -    printf "qmenu-al [OPTION] (--light-theme)\nLaunch domU applications.\n\n --all\n --focused\n\n\nqmenu v1.3\n<https://github.com/sine3o14nnae/qmenu/>\n<https://gitlab.com/sine3o14nnae/qmenu/>\n\n"
       -
       -    if [ "$1" = "--help" ]; then exit 0; else exit 2; fi
       +    --all)
       +        app_list=$(cat "$HOME"/.local/share/applications/*.desktop |
       +            grep '^Name=.*\|^Exec=.*' | grep -vw 'Qube Settings\|qubes-vm-settings')
       +
       +        chosen=$(echo "$app_list" | grep '^Name=.*' | cut -c 6- |
       +            dmenu -f -m 0 -nb $theme_0 -nf $theme_1 -sb $theme_1 -sf $theme_0)
       +
       +        if [ -n "$chosen" ]; then
       +            if ! echo "$app_list" | grep -A1 "$chosen" | grep '^Exec=.*' | cut -c 6-; then exit 2; fi
       +            exit 0
       +        fi
       +
       +        exit 1
       +        ;;
       +
       +    --focused)
       +        qube=$(xprop -id "$(xdotool getwindowfocus)" |
       +            grep -w "^_QUBES_VMNAME(STRING)" |
       +            cut -f2 -d\")
       +
       +        if [ -n "$qube" ]; then
       +            qube_label=$(qvm-ls --raw-data "$qube" -O LABEL)
       +
       +            # Change label colors according configuration file
       +            # User wide: ~/.config/qmenu.conf
       +            # System wide: /etc/qmenu/qmenu.conf
       +            if [ -e "$HOME/.config/qmenu.conf" ]; then
       +                qmenu_conf="$HOME/.config/qmenu.conf"
       +            elif [ -e "/etc/qmenu/qmenu.conf" ]; then
       +                qmenu_conf="/etc/qmenu/qmenu.conf"
       +            fi
       +
       +            if [ -n "$qmenu_conf" ]; then
       +                qube_label=$(grep "^$qube_label=" "$qmenu_conf" | cut -d= -f2)
       +            fi
       +            
       +            app_list=$(cat "$HOME"/.local/share/qubes-appmenus/"$qube"/apps/*.desktop |
       +                grep '^Name=.*\|^Exec=.*' |
       +                grep -vw 'Qube Settings\|qubes-vm-settings')
       +
       +            chosen=$(echo "$app_list" | grep '^Name=.*' | cut -f2- -d: |
       +                dmenu -p "$qube:" -f -m 0 -nb $theme_0 -nf $theme_1 -sb "$qube_label" -sf $theme_1)
       +
       +            if [ -n "$chosen" ]; then
       +                if ! echo "$app_list" | grep -A1 "$chosen" | grep '^Exec=.*' | cut -c 6-; then exit 2; fi
       +                exit 0
       +            fi
       +            exit 1
       +        fi
       +        exit 2
       +        ;;
       +    *)
       +        help
       +
       +        if [ "$1" = "--help" ]; then exit 0; else exit 2; fi
       +        ;;
        esac
        
       -
        # Note that the '-m 0' option in 'dmenu' is important
        # for security, as it restricts it to monitor 0.
   DIR diff --git a/qmenu.conf b/qmenu.conf
       @@ -1,12 +1,3 @@
       -This file tells qmenu tools which color is assigned to a qube label.
       -Every utilized label has to be defined.
       -
       -[LABEL 1]=#[HEX TRIPLET]
       -[LABEL 2]=#[HEX TRIPLET]
       -...
       -[LABEL 8]=#[HEX TRIPLET]
       -
       -
        purple=#a020f0
        blue=#4363d8
        gray=#42d4f4
   DIR diff --git a/qmenu.spec.in b/qmenu.spec.in
       @@ -0,0 +1,39 @@
       +Name: qmenu
       +Version: @VERSION@
       +Release: 1%{?dist}
       +Summary: Collection of tools that utilize 'dmenu' to provide the user with a drop down menu for Qubes OS
       +License: GPLv2+
       +URL: https://github.com/QubesOS-contrib/qubes-dmenu
       +
       +Source0: %{name}-%{version}.tar.gz
       +
       +Requires: dmenu
       +
       +%description
       +Collection of tools that utilize 'dmenu' to provide the user with a
       +drop down menu for Qubes OS from which they can quickly administer
       +their qube preferences, firewall rules, applications, devices, etc.
       +with only the keyboard.
       +
       +%prep
       +%setup -q
       +
       +
       +%install
       +install -m 644 -D qmenu.conf %{buildroot}/etc/qmenu/qmenu.conf
       +install -m 755 -D qmenu-al %{buildroot}%{_bindir}/qmenu-al
       +install -m 755 -D qmenu-dm %{buildroot}%{_bindir}/qmenu-dm
       +install -m 755 -D qmenu-vm %{buildroot}%{_bindir}/qmenu-vm
       +
       +
       +%files
       +%defattr(-,root,root,-)
       +%doc README.md
       +%config(noreplace) /etc/qmenu/qmenu.conf
       +%{_bindir}/qmenu-al
       +%{_bindir}/qmenu-dm
       +%{_bindir}/qmenu-vm
       +
       +
       +%changelog
       +@CHANGELOG@
   DIR diff --git a/version b/version
       @@ -0,0 +1 @@
       +1.3.0