{"version": "https://jsonfeed.org/version/1", "title": "/dev/posts/ - Tag index - gui", "home_page_url": "https://www.gabriel.urdhr.fr", "feed_url": "/tags/gui/feed.json", "items": [{"id": "http://www.gabriel.urdhr.fr/2020/04/11/push-to-talk-in-any-application/", "title": "Push-to-talk in any application", "url": "https://www.gabriel.urdhr.fr/2020/04/11/push-to-talk-in-any-application/", "date_published": "2020-04-11T00:00:00+02:00", "date_modified": "2020-04-11T00:00:00+02:00", "tags": ["computer", "unix", "gui", "pulseaudio", "x11", "covid-19"], "content_html": "

Some scripts I wrote to enable system-wide push-to-talk\n(for X11 and PulseAudio).\nSome people might find it for the ongoing lockdown.

\n

Some VoIP software have builtin support for push-to-talk.\nIn this mode, a global keyboard hotkey must be be held while speaking.\nThis is quite useful when in a noisy environment\nand/or with suboptimal mics.

\n

Some programs with support for this:

\n\n

Most programs don't support this.\nThis is especially true for browser-based VoIP software because as there is currently\nnot web API (AFAIU) ro register a global keyboard hotkey1.

\n

So I wrote two Python scripts for PulseAudio.

\n

Push-to-talk

\n

The first one\nimplements push-to-talk based on some keyboard key.\n(i.e. you have to hold the key while you are talking):

\n
pushtotalk --key \"Home\"\n
\n\n\n

It's intended for PulseAudio\nand X11 but it should be quite easy to adapt this to other sound and GUI systems.

\n

Toggle audio source

\n

The second one\njust toggles the mute state of the default PulseAudio source\nand provides a visual feedback (notification).\nIt's intended to be bound to some global keyboard hotkey.

\n

For example using a script\nbased on keybinder:

\n
keybinder \"<Control>m\" pulse-mute-toggle\n
\n\n\n

Simply toggling the audio source can be done with:

\n
pactl set-sink-mute @DEFAULT_SOURCE@ toggle\n
\n\n\n

Getting the notification of the state is important because otherwise you might\nend being in the wrong state.\nThere is no pactl get-sink-mute @DEFAULT_SOURCE@ command\nwhich is why it's not an absolutely straightforward shell script2.

\n
\n
\n
    \n
  1. \n

    This is why this feature is apparently available on the native Discord application\nbut not on the web one.\u00a0\u21a9

    \n
  2. \n
  3. \n

    It can be done by:

    \n
      \n
    • parsing the output of pacmd list-sources or similar (which is cumbersome);
    • \n
    • relying on the native protocol;
    • \n
    • use the PulseAudio D-Bus interface.
    • \n
    \n

    I decided to use the D-Bus interface\n(which is sadly not enabled by default).\u00a0\u21a9

    \n
  4. \n
\n
"}, {"id": "http://www.gabriel.urdhr.fr/2015/07/29/i-can-has-systray/", "title": "I can has systray?", "url": "https://www.gabriel.urdhr.fr/2015/07/29/i-can-has-systray/", "date_published": "2015-07-29T00:00:00+02:00", "date_modified": "2015-07-29T00:00:00+02:00", "tags": ["computer", "gui", "kde"], "content_html": "

In Plasma 5, support for the XEmbed-based\n\u201clegacy\u201d systray protocol\nwas removed:\nonly the new SNI protocol is handled.\nHowever, in the real worl a lot of applications do not handle the new protocol:\nQt4 and Qt5 applications can be fixed\nby installing the sni-qt (currently in experimental) and libdbusmenu-qt5 respectively\nbut other applications (such as GTK ones) must be patched/recompiled with SNI support.\nWithout this, windows disappear into oblivion \"\ud83d\ude3f\".\nYou can have a seamless systray-enabled Plasma panel\nwith a single (OK, two) line of shell \"\ud83d\ude3c\".

\n

Implementation

\n

First, resize your panel and remove some space on the right\n(this is where we're going to add a new panel):

\n

\"\"

\n

Then install trayer and run:

\n
trayer --align right --widthtype pixel --width 150 --transparent false \\\n  --heighttype pixel --height 30 --alpha 230 --padding 10\n
\n\n\n

Now, you have systrays in your panel: \"\ud83d\ude38\"

\n

\"\"

\n

You might need to adjust the parameters of trayer and resize the panel in\norder to have a seamless panel.

\n

Installation

\n

You can then add a script to do this (mine is in ~/.bin/icanhazsystray):

\n
#!/bin/sh\nexec trayer --align right --widthtype pixel --width 150 --transparent false \\\n  --heighttype pixel --height 30 --alpha 230 --padding 10\n
\n\n\n

Now, you can ask Plasma to run this script when starting the session.

\n

The new Plasma 5 is quite nice by the way (but the lack of classic\nsystray is not so nice).

\n

References

\n"}]}