Wrapper to display a script output or a text file content on the desktop in sway or other wlroots-based compositors

Overview

nwg-wrapper

This program is a part of the nwg-shell project.

This program is a GTK3-based wrapper to display a script output, or a text file content on the desktop in sway or other wlroots-based compositors. It uses the gtk-layer-shell library to place the window on the bottom layer.

As well the script output, at the text file may be formatted with Pango Markup. The window appearance is defined with css styling. See sample files in the config folder. They also come preinstalled in your ~/.config/nwg-wrapper directory. You can find an example of use at the bottom of the page.

Packaging status

Dependencies

  • python (python3)
  • python-gobject
  • gtk3
  • gtk-layer-shell
  • python-setuptools
  • python-i3ipc: for use with sway WM
  • wlr-randr: for use with other wlroots-based Wayland compositors

To install

git clone https://github.com/nwg-piotr/nwg-wrapper.git
cd nwg-wrapper
sudo python3 setup.py install --optimize=1

To uninstall

rm -r /usr/lib/python3.9/site-packages/nwg_wrapper*
rm /usr/bin/nwg-wrapper

The path in the first line may be different, depending on your python version.

Running

$ nwg-wrapper -h
usage: nwg-wrapper [-h] [-s SCRIPT | -t TEXT] [-c CSS] [-o OUTPUT] [-p POSITION] [-a ALIGNMENT]
                   [-j JUSTIFY] [-mt MARGIN_TOP] [-mb MARGIN_BOTTOM] [-ml MARGIN_LEFT]
                   [-mr MARGIN_RIGHT] [-r REFRESH] [-v]

optional arguments:
  -h, --help            show this help message and exit
  -s SCRIPT, --script SCRIPT
                        Path to the script whose output you want to display
  -t TEXT, --text TEXT  Path to the text file you want to display
  -c CSS, --css CSS     Path to the css file
  -o OUTPUT, --output OUTPUT
                        Output to place the window on, e.g. "eDP-1"
  -p POSITION, --position POSITION
                        Position: "left" or "right"; "center" if no value given
  -a ALIGNMENT, --alignment ALIGNMENT
                        Vertical alignment: "start" or "end"; "middle" if no value given
  -j JUSTIFY, --justify JUSTIFY
                        Text justification: "right" or "center"; "left" if no value given
  -mt MARGIN_TOP, --margin_top MARGIN_TOP
                        Top margin
  -mb MARGIN_BOTTOM, --margin_bottom MARGIN_BOTTOM
                        Bottom margin
  -ml MARGIN_LEFT, --margin_left MARGIN_LEFT
                        Left margin
  -mr MARGIN_RIGHT, --margin_right MARGIN_RIGHT
                        Right margin
  -r REFRESH, --refresh REFRESH
                        Refresh rate in milliseconds; 0 (no refresh) if no value given
  -v, --version         display version information

Sample usage

nwg-wrapper -s date-wttr.sh -r 1800000 -c date-wttr.css -p left -ml 200

2021-07-10-050045_screenshot.png

nwg-wrapper -t bindings.pango -c bindings.css -p left -ml 200

2021-07-11-003357_screenshot.png

nwg-wrapper -s timezones.sh -r 1000 -c timezones.css -p right -mr 50 -a start -mt 50 -j right

2021-07-10-050810_screenshot.png

Comments
  • Allow different layer for wraper

    Allow different layer for wraper

    Feature request : to have an option to show wrapper in bottom or top layer.

    infact having an option like waybar where you can send a custom signal to a module will be awesome. an id can be given to wraper window which can be used to toggle surface layer . It sounds a bit over the edge but will be an aweosme option to have

    opened by Iss-in 13
  • Display on top of swaylock?

    Display on top of swaylock?

    I use swaylock to display a random image while locked:

    swaylock --daemonize --image "$IMAGE" &
    

    Is there any way to have nwg-wrapper display some text 'on top of' that image. I tried --layer=2 but it does not display (until I unlock!).

    opened by bhepple 9
  • Add sig refresh

    Add sig refresh

    it would be useful to add custom signals for script refresh so the script can be triggered by signals instead of constantly polling/refreshing. This is useful for things like album cover update on music player's track/status changes. By the way, do you guys think using real-time signal would be better? i.e. RTMIN+No. Think those status bars mostly use that for triggering update.

    opened by hillyu 7
  • Config files

    Config files

    I want to able able to define a config for wrapper instance in .ini file, so that this (for example) very verbose string nwg-wrapper -s swaylock-time.sh -o eDP-1 -r 1000 -c timezones.css -p right -mr 50 -a start -mt 0 -j right -l 3 -sq 31 can become that nwg-wrapper ~/.config/nwg-wrapper/time.ini

    with config file being in that format

    [wrapper]
    script=swaylock-time.sh
    output=eDP-1
    refresh=1000
    css=timezones.css
    position=right
    margin_right=50
    margin_top=0
    justify=right
    layer=3
    sig_quit=31
    

    I can implement that feature.

    opened by warezgibzzz 4
  • Signalling 8 to refresh doesn't work

    Signalling 8 to refresh doesn't work

    As the title says, script doesn't refresh when I signal 8 with pkill. But instead, if I run nwg-wrapper with --sig_refresh 7 flag, it does work if I signal 7. I have no idea why. Also, 7 is just random and 8 is the default of nwg_wrapper. Any help appreciated. Thanks.

    opened by MelihDarcanxyz 3
  • Support specifying output by

    Support specifying output by "make model serial", not just name

    The output names (like eDP-1) are unpredictable, and depend on the order in which you connect your external monitors. So the established way of binding programs and settings to outputs is to address the monitors by "Make model serial" (for example, Goldstar Company Ltd LG IPS FULLHD 604NTDV33634) which are unique. This is how Sway and Kanshi do it, for example.

    Can you please add the support for this to nwg-wrapper? I'd like to be able to do nwg-wrapper -o 'Goldstar Company Ltd LG IPS FULLHD 604NTDV33634' and have the overlay drawn on the specified monitor.

    https://git.sr.ht/~emersion/kanshi/tree/eddaeac2/item/main.c#L25

    Here, you can find an example of how Kanshi implements the matching logic. (Maybe you could even borrow the code from there.)

    Ivan

    opened by gnull 2
  • Fix: Match documented behavior of --sig_layer

    Fix: Match documented behavior of --sig_layer

    Currently, signalling nwg-wrapper with the configured layer signal will alternate its layer between layer 1 (bottom) and 2 (top) instead of between the provided --layer and 3 (overlay). This updates nwg-wrapper's behavior to match the documentation.

    (Found this when pkill -10 nwg-wrapper; swaylock "$@"; pkill -10 nwg-wrapper didn't do what I expected.)

    opened by xPMo 0
  • Feature: spawn window instance invisible on launch

    Feature: spawn window instance invisible on launch

    In some cases i want to be able to spawn a wrapper window instance that is visibly hidden and show it only when i want, i.e. on nwg-panel executor left click. This feature does just that, it adds a boolean flag, that when it passed, wrapper spawns visibly hidden.

    opened by warezgibzzz 0
  • add example

    add example

    added some script I used. on top of a few modifications I made. Included signal refresh patch. 6f95224102633fb708837771f5afa9b2798ff72e quit if output is offline: 19a734952524b7e43a8a0e665fecbe4e1f384e53 anchor issue: 2ec3082957cd966dd153ba9e65d2cb6d6f0c6b52 examples: ca8ea7163c6686ae327b97135f6ed53db85263d4

    opened by hillyu 0
  • Upgrade to Python 3.10

    Upgrade to Python 3.10

    How can we make this happen? I upgraded python to 3.10 on my computer and NWG stopped working due to pygobject not being compiled to support python 3.9.

    I wanna help. :D

    opened by FromOopsToOps 2
  • I need to sleep 1

    I need to sleep 1

    I've found that if I 'sleep 0.5' after nwg-wrapper and before running swaylock/gtklock, it doesn't always display correctly. Increasing the sleep to 1 second fixes it. I daresay this depends on the CPU speed etc, but it might be a good idea to document it in the README

    opened by bhepple 2
  • Adding actions

    Adding actions

    Hi.

    I'd like to add some actions to a nwg-wrapper to use it as a real desktop widget. For example, open a web link when I clicks or to change workspace with mouse wheel via swaymsg, etc. Is it possible?

    Thanks for the code!

    opened by RiccardoPP 1
  • Outputting a continuously running script without interval

    Outputting a continuously running script without interval

    An example, running the following script currently doesn't output anything.

    #!/usr/bin/env sh
    dbus-monitor --session "interface='org.freedesktop.Notifications',member='Notify',type='method_call'" | grep "method call"
    
    opened by arafatamim 1
  • Sixel support

    Sixel support

    It is almost ready to be full-on conky support, but one crutial pice is missing - graphs. And this "renderer" being so rightfully unixway I don't see a justification to implement something like custom protocol, no, but I also see that there is no way to render output of programs that already can draw them. Therefore I ask for sixel suppopt, that would make it a lot easier. And you can also render regular images with it.

    opened by 0Karakurt0 3
Releases(v0.1.3)
  • v0.1.3(Sep 11, 2022)

  • v0.1.2(Jan 7, 2022)

    • added custom signals for script refresh #10 by @hillyu
    • added some cools example scripts #11 by @hillyu
    • added single instance mode:

    With the -si | --single_instance argument you may force single instance mode. The program on startup checks the pid file stored in /tmp/nwg-wrapper.pid and kills the appropriate process. You can use this only once, as always the same file is used.

    Source code(tar.gz)
    Source code(zip)
  • v0.1.1(Jan 3, 2022)

  • v0.1.0(Nov 8, 2021)

    • Different layer switching: the signal specified with the --sig_layer argument will switch to the overlay layer, and back to what you selected with the --layer argument;
    • added the -sq | --sig_quit argument, which allows to define a custom signal to terminate a certain wrapper instance, w/o killing the others.
    Source code(tar.gz)
    Source code(zip)
  • v0.0.3(Nov 5, 2021)

  • v0.0.2(Jul 17, 2021)

  • v0.0.1(Jul 10, 2021)

Owner
Piotr Miller
After hours developer, Linux fan, Arch Linux user
Piotr Miller
This repo stores the codes for topic modeling on palliative care journals.

This repo stores the codes for topic modeling on palliative care journals. Data Preparation You first need to download the journal papers. bash 1_down

3 Dec 20, 2022
Ukrainian TTS (text-to-speech) using Coqui TTS

title emoji colorFrom colorTo sdk app_file pinned Ukrainian TTS 🐸 green green gradio app.py false Ukrainian TTS 📢 🤖 Ukrainian TTS (text-to-speech)

Yurii Paniv 85 Dec 26, 2022
Semi-automated vocabulary generation from semantic vector models

vec2word Semi-automated vocabulary generation from semantic vector models This script generates a list of potential conlang word forms along with asso

9 Nov 25, 2022
HuggingSound: A toolkit for speech-related tasks based on HuggingFace's tools

HuggingSound HuggingSound: A toolkit for speech-related tasks based on HuggingFace's tools. I have no intention of building a very complex tool here.

Jonatas Grosman 247 Dec 26, 2022
A collection of Classical Chinese natural language processing models, including Classical Chinese related models and resources on the Internet.

GuwenModels: 古文自然语言处理模型合集, 收录互联网上的古文相关模型及资源. A collection of Classical Chinese natural language processing models, including Classical Chinese related models and resources on the Internet.

Ethan 66 Dec 26, 2022
Segmenter - Transformer for Semantic Segmentation

Segmenter - Transformer for Semantic Segmentation

592 Dec 27, 2022
A simple recipe for training and inferencing Transformer architecture for Multi-Task Learning on custom datasets. You can find two approaches for achieving this in this repo.

multitask-learning-transformers A simple recipe for training and inferencing Transformer architecture for Multi-Task Learning on custom datasets. You

Shahrukh Khan 48 Jan 02, 2023
A minimal code for fairseq vq-wav2vec model inference.

vq-wav2vec inference A minimal code for fairseq vq-wav2vec model inference. Runs without installing the fairseq toolkit and its dependencies. Usage ex

Vladimir Larin 7 Nov 15, 2022
Chinese Named Entity Recognization (BiLSTM with PyTorch)

BiLSTM-CRF for Name Entity Recognition PyTorch version A PyTorch implemention of Bi-LSTM-CRF model for Chinese Named Entity Recognition. 使用 PyTorch 实现

5 Jun 01, 2022
This repository structures data in title, summary, tags, sentiment given a fragment of a conversation

Understand-conversation-AI This repository structures data in title, summary, tags, sentiment given a fragment of a conversation How to install: pip i

Juan Camilo López Montes 1 Jan 11, 2022
We have built a Voice based Personal Assistant for people to access files hands free in their device using natural language processing.

Voice Based Personal Assistant We have built a Voice based Personal Assistant for people to access files hands free in their device using natural lang

Rushabh 2 Nov 13, 2021
Resources for "Natural Language Processing" Coursera course.

Natural Language Processing course resources This github contains practical assignments for Natural Language Processing course by Higher School of Eco

Advanced Machine Learning specialisation by HSE 1.1k Jan 01, 2023
SpikeX - SpaCy Pipes for Knowledge Extraction

SpikeX is a collection of pipes ready to be plugged in a spaCy pipeline. It aims to help in building knowledge extraction tools with almost-zero effort.

Erre Quadro Srl 384 Dec 12, 2022
Yes it's true :broken_heart:

Information WARNING: No longer hosted If you would like to be on this repo's readme simply fork or star it! Forks 1 - Flowzii 2 - Errorcrafter 3 - vk-

Dropout 66 Dec 31, 2022
Gold standard corpus annotated with verb-preverb connections for Hungarian.

Hungarian Preverb Corpus A gold standard corpus manually annotated with verb-preverb connections for Hungarian. corpus The corpus consist of the follo

RIL Lexical Knowledge Representation Research Group 3 Jan 27, 2022
A method for cleaning and classifying text using transformers.

NLP Translation and Classification The repository contains a method for classifying and cleaning text using NLP transformers. Overview The input data

Ray Chamidullin 0 Nov 15, 2022
Repository for the paper: VoiceMe: Personalized voice generation in TTS

🗣 VoiceMe: Personalized voice generation in TTS Abstract Novel text-to-speech systems can generate entirely new voices that were not seen during trai

Pol van Rijn 80 Dec 29, 2022
Repo for Enhanced Seq2Seq Autoencoder via Contrastive Learning for Abstractive Text Summarization

ESACL: Enhanced Seq2Seq Autoencoder via Contrastive Learning for AbstractiveText Summarization This repo is for our paper "Enhanced Seq2Seq Autoencode

Rachel Zheng 14 Nov 01, 2022
:house_with_garden: Fast & easy transfer learning for NLP. Harvesting language models for the industry. Focus on Question Answering.

(Framework for Adapting Representation Models) What is it? FARM makes Transfer Learning with BERT & Co simple, fast and enterprise-ready. It's built u

deepset 1.6k Dec 27, 2022
Large-scale Self-supervised Pre-training Across Tasks, Languages, and Modalities

Hiring We are hiring at all levels (including FTE researchers and interns)! If you are interested in working with us on NLP and large-scale pre-traine

Microsoft 7.8k Jan 09, 2023