Git Product home page Git Product logo

Comments (9)

3N4N avatar 3N4N commented on August 16, 2024 4

@vivien, I can't seem to work xtitle -s on my i3blocks. When my focused window is st is works ok. But otherwise, it doesn't output anything, not even the label.

from i3blocks.

rainerborene avatar rainerborene commented on August 16, 2024 3

This might be related but the following blocklet does not work.

[focused window]
command=xtitle -s
interval=persist

from i3blocks.

Alighorab avatar Alighorab commented on August 16, 2024 2
[Title]
command=xdotool getactivewindow getwindowname 2> /dev/null || echo "None"
interval=1

I tried this and it worked just fine, way better than xtitle, I use interval=1 'cause persist does not work and repeat is killing the processor.

from i3blocks.

vivien avatar vivien commented on August 16, 2024

I updated the wiki with your suggestion. Feel free to do so ;-)
For this, it'd be great to have a Perl script to connect on the IPC socket and wait indefinitely for focus updates, in a blocklet with interval=persist. That way you can have instant update. The doc includes all needed Perl snippets: http://i3wm.org/docs/ipc.html#_subscribing_to_events
I'll try to find time for this, unless somebody is willing to write it.

from i3blocks.

Airblader avatar Airblader commented on August 16, 2024

I wrote the following. I'm really sick today, though, so I'll stop right now and lay back down. It works if I execute it from the console, but somehow not via command and interval=persist. Not sure why. It's also missing handling for when the last container of a workspace was closed.

#!/usr/bin/env perl
use Data::Dumper;
use List::Util qw(first);
use AnyEvent;
use AnyEvent::I3;

use strict;
use warnings qw(FATAL utf8);
use v5.10;

my $i3 = i3();
$i3->connect->recv or die "failed to connect to i3";

$i3->subscribe({
  window => sub {
    my ($msg) = @_; 

    return unless $msg->{change} eq "focus" or $msg->{change} eq "title";
    say $msg->{container}->{name};
  }
})->recv->{success} or die "failed to subscribe to i3 events";

AE::cv->recv;

from i3blocks.

8carlosf avatar 8carlosf commented on August 16, 2024

please check if you have the latest git version of i3blocks, it will not work with the last tagged version.
also check the command "xtitle -s" in your terminal, and see if it works okay (if not, install https://github.com/baskerville/xtitle or from the AUR if you are a archlinux user).
then it should all work.

from i3blocks.

Airblader avatar Airblader commented on August 16, 2024

The xtitle solution is actually a whole lot better. And it works fine with persist mode for me.

from i3blocks.

vivien avatar vivien commented on August 16, 2024

I close this issue since the wiki is updated. The xtitle example is nice btw!

from i3blocks.

fpcr avatar fpcr commented on August 16, 2024

That was AWESOME. the very last thing that bothered me with i3 is now gone!

from i3blocks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.