question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Very strange issue with script and notification , might be unrelated...

See original GitHub issue

Issue description

While calling my script through qtile (mouse-callback and via the run promt) the pango markup in the notification just vanishes… I just cant wrap my head around how this is possible. The same script , just called through qtile. I use dunst ( 1.6.1 (2021-02-21) ) for notifications, I will post an issue there as well.

#!/bin/sh

day="$(date +'%A')"
calendar="$(cal --color=always |\
		sed -r 's#\[7m(.*)\[27m#<b><i><big>\1</big></i></b>#' |\
		sed -r 's/$/ /g')"
# echo -n "$calendar"
weather="$(curl -s wttr.in/Crete\?format=4)"
notify-send "$day" "\n<big>$calendar</big>\n\n$weather" -i weather_few_cloud

https://user-images.githubusercontent.com/61395246/133851772-406cd98f-f66d-4c89-a373-2d30042b5546.mp4

Dbus log

dbus.txt

Qtile version

0.18.1.dev0+g8e7ecc0a.d20210719

Stack traces

Both of these are empty:

  • ~/.xsession-errors
  • ~/.local/share/qtile/qtile.log

Configuration


#
#   ___ _____ ___ _     _____
#  / _ \_   _|_ _| |   | ____|
# | | | || |  | || |   |  _|
# | |_| || |  | || |___| |___
#  \__\_\|_| |___|_____|_____|
#
import os
# import subprocess
from typing import List  # noqa: F401

from libqtile import bar, layout, widget ,qtile  #, hook
from libqtile.config import Click, Drag, DropDown, Group, Key, KeyChord, Match, ScratchPad, Screen
from libqtile.lazy import lazy
# from libqtile.utils import guess_terminal

script = os.path.expanduser("~/.scripts/")


# @hook.subscribe.startup
# def autostart():
#     home = os.path.expanduser('~')
#     subprocess.call([home + '/.config/qtile/autostart.sh'])


mod = "mod4"
# terminal = guess_terminal()
terminal = "kitty"

keys = [
    # Switch between windows
    Key([mod], "f", lazy.hide_show_bar("all"), desc="Hide Bar"),
    Key([mod], "h", lazy.layout.left(), desc="Move focus to left"),
    Key([mod], "l", lazy.layout.right(), desc="Move focus to right"),
    Key([mod], "j", lazy.layout.down(), desc="Move focus down"),
    Key([mod], "k", lazy.layout.up(), desc="Move focus up"),
    Key([mod], "c", lazy.group.next_window(),
        desc="Move window focus to other window"),

    # App Launcher
    KeyChord([mod], "o", [
        Key([], "v", lazy.spawn(terminal + " -e vifm"), desc="Launch vifm"),
        Key([], "q", lazy.spawn(script + "qute_search.sh"), desc="Launch qutebrowser"),
        Key([], "n", lazy.spawn(terminal + " -e nvim"), desc="Launch Nvim")
    ]),

    # Move windows between left/right columns or move up/down in current stack.
    # Moving out of range in Columns layout will create new column.
    Key([mod, "shift"], "h", lazy.layout.shuffle_left(),
        desc="Move window to the left"),
    Key([mod, "shift"], "l", lazy.layout.shuffle_right(),
        desc="Move window to the right"),
    Key([mod, "shift"], "j", lazy.layout.shuffle_down(),
        desc="Move window down"),
    Key([mod, "shift"], "k", lazy.layout.shuffle_up(), desc="Move window up"),

    # Grow windows. If current window is on the edge of screen and direction
    # will be to screen edge - window would shrink.
    Key([mod, "control"], "h", lazy.layout.grow_left(),
        desc="Grow window to the left"),
    Key([mod, "control"], "l", lazy.layout.grow_right(),
        desc="Grow window to the right"),
    Key([mod, "control"], "j", lazy.layout.grow_down(),
        desc="Grow window down"),
    Key([mod, "control"], "k", lazy.layout.grow_up(), desc="Grow window up"),
    Key([mod], "n", lazy.layout.normalize(), desc="Reset all window sizes"),

    # Toggle between split and unsplit sides of stack.
    # Split = all windows displayed
    # Unsplit = 1 window displayed, like Max layout, but still with
    # multiple stack panes
    Key([mod, "shift"], "Return", lazy.layout.toggle_split(),
        desc="Toggle between split and unsplit sides of stack"),
    Key([mod, "shift"], "t", lazy.window.toggle_floating(),
        desc="Toggle between floating and tiled of window"),
    Key([mod], "Return", lazy.spawn(terminal), desc="Launch terminal"),

    # Toggle between different layouts as defined below
    Key([mod], "Tab", lazy.next_layout(), desc="Toggle between layouts"),
    Key([mod], "w", lazy.window.kill(), desc="Kill focused window"),

    Key([mod, "control"], "r", lazy.restart(), desc="Restart Qtile"),
    Key([mod, "control"], "q", lazy.shutdown(), desc="Shutdown Qtile"),
    Key([mod], "r", lazy.spawncmd(),
        desc="Spawn a command using a prompt widget"),
    # Custom
    Key([], "Print", lazy.spawn(script+'print_screen'), desc="Take a Screenshot"),
    Key(["shift"], "Print", lazy.spawn(script+'print_window'),
        desc="Take a Screenshot of a window"),
    Key([mod], "Print", lazy.spawn('peek'), desc="Record portion of screen"),
    Key([], "XF86AudioPlay", lazy.spawn(
        'cmus-remote --pause'), desc="Toggle pause in cmus"),
    Key([], "XF86AudioPrev", lazy.spawn(
        'cmus-remote --prev'), desc="Toggle pause in cmus"),
    Key([], "XF86AudioNext", lazy.spawn(
        'cmus-remote --next'), desc="Toggle pause in cmus"),
    Key([], "XF86MonBrightnessUp", lazy.spawn(
        'brightnessctl s 10%+'), desc="Increase Brightness"),
    Key([], "XF86MonBrightnessDown", lazy.spawn(
        'brightnessctl s 10%-'), desc="Decrease Brightness"),
    Key([], "XF86AudioRaiseVolume", lazy.spawn(
        script + 'volume_up.sh'), desc="Increase Volume"),
    Key([], "XF86AudioLowerVolume", lazy.spawn(
        script + 'volume_down.sh'), desc="Decrease Volume"),
    Key([mod], "space", lazy.spawn('rofi -show drun -lines 8'), desc="Run Rofi"),
    Key([mod, "mod1"], "x", lazy.spawn(script+'poweroff.sh'), desc="Run Rofi Poweroff"),
]
# groups = [
#     Group(name=""),
#     Group(name=""),
#     Group(name=""),
#     Group(name=""),
#     Group(name=""),
#     Group(name="λ")
# ]
dropdown_defaults={
        "y": 0.35,
        "x": 0.2,
        "width": 0.6,
        }
groups = [
    Group(name="TERM"),
    Group(name="WEB"),
    # Group(name="CODE"),
    Group(name="UNI"),
    Group(name="NOTES"),
    ScratchPad("ScratchPad",[
            DropDown("term","kitty",**dropdown_defaults),
            DropDown("music","kitty -e cmus", **dropdown_defaults),
            DropDown("vifm","kitty -e vifm", **dropdown_defaults)
        ])
]
for i in groups[:4]:
    keys.extend([
        # mod1 + letter of group = switch to group
        Key([mod], str(groups.index(i)+1), lazy.group[i.name].toscreen(),
            desc="Switch to group {}".format(i.name)),

        # mod1 + shift + letter of group = switch to & move focused window to group
        Key([mod, "shift"], str(groups.index(i)+1),
            lazy.window.togroup(i.name, switch_group=True),
            desc="Switch to & move focused window to group {}".format(i.name)),
        # Or, use below if you prefer not to switch to that group.
        # # mod1 + shift + letter of group = move focused window to group
        # Key([mod, "shift"], i.name, lazy.window.togroup(i.name),
        #     desc="move focused window to group {}".format(i.name)),
    ])
keys.extend([
Key([mod],"period",lazy.group['ScratchPad'].dropdown_toggle('term')),
Key([mod],"m",lazy.group['ScratchPad'].dropdown_toggle('music')),
Key([mod],"comma",lazy.group['ScratchPad'].dropdown_toggle('vifm'))
    ])
layout_defaults = {
    'border_focus': '#C5C8C6',
    'border_normal': '#222222',
    'border_width': 2
}
layouts = [
    # layout.Columns(name="𤋮", margin=4, **layout_defaults),
    # Try more layouts by unleashing below layouts.
    # layout.Stack(num_stacks=2),
    layout.Bsp(name="舘", fair=False, **layout_defaults),
    layout.Max(name=""),
    # layout.Slice(name="ﯻ", fallback=layout.Bsp(**layout_defaults), match=Match(title=["vifm"]), width=320),
    # layout.Matrix(),
    # layout.Floating(),
    # layout.MonadTall(),
    # layout.MonadWide(),
    # layout.RatioTile(),
    # layout.Tile(name="舘", **layout_defaults),
    # layout.TreeTab(),
    # layout.VerticalTile(),
    # layout.Zoomy(),
]

widget_defaults = dict(
    font='Fira Code SemiBold',
    fontsize=13,
    padding=4,
)
extension_defaults = widget_defaults.copy()
color=dict(background='ffb53a', foreground='222222')

def get_day_info():
    qtile.cmd_spawn(script+"get_day_info.sh")

screens = [
    Screen(
        top=bar.Bar(
            [
                widget.Spacer(length=10),
                widget.CurrentLayout(fontsize=20),
                widget.GroupBox(fontsize=12,
                                highlight_method='block',
                                this_current_screen_border='ffb52a',
                                rounded=False,
                                block_highlight_text_color='222222'),
                widget.Prompt(**color, prompt='Run: '),
                widget.Spacer(length=20),
                widget.WindowName(max_chars=100),
                widget.Systray(),
                widget.TextBox(text='',fontsize=22,**color),
                widget.Volume(**color),
                widget.Spacer(length=2),
                # widget.BatteryIcon(theme_path='/home/inferno/.config/qtile/battery_icons/'),
                widget.TextBox(text='',fontsize=22),
                widget.Battery(format='{percent:2.0%}{char}',
                                charge_char='+',
                                discharge_char='',
                                update_interval=20,
                                notify_below = 38),
                widget.Spacer(length=2),
                widget.TextBox(text='',fontsize=22,**color),
                widget.Clock(format='%d-%m-%Y', mouse_callbacks = {'Button1' : get_day_info } ,**color),
                widget.TextBox(text='',fontsize=22),
                widget.Clock(format='%I:%M %p'),
                widget.Spacer(length=10)
            ],
            24,
            background="#222222",
            margin=[6,150,6,150],
        ),
    ),
]

# Drag floating layouts.
mouse = [
    Drag([mod], "Button1", lazy.window.set_position_floating(),
         start=lazy.window.get_position()),
    Drag([mod,"shift"], "Button1", lazy.window.set_size_floating(),
         start=lazy.window.get_size()),
    Click([mod], "Button2", lazy.window.bring_to_front())
]

dgroups_key_binder = None
dgroups_app_rules = []  # type: List
main = None  # WARNING: this is deprecated and will be removed soon
follow_mouse_focus = True
bring_front_click = False
cursor_warp = False
floating_layout = layout.Floating(float_rules=[
    # Run the utility of `xprop` to see the wm class and name of an X client.
    *layout.Floating.default_float_rules,
    Match(wm_class='confirmreset'),  # gitk
    Match(wm_class='makebranch'),  # gitk
    Match(wm_class='maketag'),  # gitk
    Match(wm_class='yad'),  # gitk
    Match(wm_class='mpv'),  # gitk
    Match(wm_class='qalculate-gtk'),  # gitk
    Match(wm_class='ssh-askpass'),  # ssh-askpass
    Match(wm_class='pinentry-gtk-2'),  # ssh-askpass
    Match(title='branchdialog'),  # gitk
    Match(title='pinentry'),  # GPG key password entry
],**layout_defaults)
auto_fullscreen = True
focus_on_window_activation = "smart"

# XXX: Gasp! We're lying here. In fact, nobody really uses or cares about this
# string besides java UI toolkits; you can see several discussions on the
# mailing lists, GitHub issues, and other WM documentation that suggest setting
# this string if your java app doesn't work correctly. We may as well just lie
# and say that we're a working one by default.
#
# We choose LG3D to maximize irony: it is a 3D non-reparenting WM written in
# java that happens to be on java's whitelist.
wmname = "LG3D"

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
m-colcommented, Sep 18, 2021

NIce, sounds like notify-send was getting some terminfo to figure out what to do with the escaping of text… maybe? Anyway, great that you got it 😃

0reactions
LamprosPitsilloscommented, Sep 18, 2021

UPDATE! I started running env -u *** ~/.scripts/get_day_info.sh which what -u does is removes variables and runs a command. I started running it while going through the Diff file, and i found what was braking it, still dont know why tho… While running it with TERM var removed , a var that Qtile env doesnt have ,it doesn’t work. env -u TERM ~/.scripts/get_day_info.sh

Adding export TERM=xterm-kitty to my script fixed it!

I would love an explanation on why this was the problem before closing the issue, or a better fix ( maybe how to add this var to Qtile env so that this doesn’t happen again?)

Read more comments on GitHub >

github_iconTop Results From Across the Web

How should I version control (sort of) unrelated scripts in the ...
Grouping of files based on their functionality should be based on. 1) Name. 2) Folder they are in. Just give a proper name...
Read more >
Script Errors (What They Are and How to Fix Them) - Lifewire
A script error is an error that occurs when the instructions from a script can't be executed correctly for some reason.
Read more >
Project scripts randomly inaccessible for short period - Ignition ...
We just had a strange occurrence on our 8.0.6 server, and I'm trying to figure out what happened and how to prevent it...
Read more >
Help:Locating broken scripts - MediaWiki
This tool, combined with a special URL, will help you to identify the broken scripts.
Read more >
CityRiots/IsSettlementRioting turn of process, and unrelated strange ...
Finally, the war and neutral stance of the command never returned errors that I could catch so far, and they do get their...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found