The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
2

Scratchpad indicator in the status bar?

asked 2013-08-21 09:50:50 +0000

anonymous user

Anonymous

Hi. Is it possible to add an indicator in the status bar that shows up when there is a window in the scratchpad, similar to the workspace indicators? It would sometimes be useful to see whether there still is a window open "in the background" without opening the scratchpad. Thanks!

edit retag flag offensive close merge delete

Comments

Good idea. I would like to see something like that.

cee gravatar imagecee ( 2013-08-21 11:55:28 +0000 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2013-08-21 13:13:53 +0000

A bit dirty solution that works could be a simple script that you append to the i3status output (see man for details):

#!/usr/bin/python

import subprocess
import simplejson

def getNodes(data):
    result = 0
    if data['scratchpad_state'] != 'none': 
        result += 1    
    if (len(data['nodes']) > 0) or (len(data['floating_nodes']) > 0):
        for node in (data['nodes'] + data['floating_nodes']):
            result += getNodes(node)
    return result

r = subprocess.check_output(["i3-msg", "-t", "get_tree"])
j = simplejson.loads(r)
c = getNodes(j)

if c > 0:
    print "S:%d" % c
else:
    print ''

You can save this simple script and call it with i3status, which should give similar result to what you are after.

edit flag offensive delete link more

Comments

If you need to output to i3bar in colors, here is a solution that works nicely: https://gist.github.com/brunobraga/6076658 (see the comments)

bruno.braga gravatar imagebruno.braga ( 2013-08-21 14:28:55 +0000 )edit

Question Tools

Stats

Asked: 2013-08-21 09:50:50 +0000

Seen: 395 times

Last updated: Aug 21 '13