Comments (2)
Hello, I used to use unbuffer xtitle -s -t 50
where 50 is the length of the window.
This works well but sometimes de-syncs requiring a quick i3 reload. I now run polybar in the background to stdout as the window command in i3blocks polybar -q --stdout | grep -o -P '(?<=%{l}).*(?=%{PR})'
however still the face issue just left often. Let me know how you get on!
from i3blocks.
Sorry for the late reply ;-)
This is more viable script and does work.
#!/bin/bash
# A simple blocket that prints window title in center of panel.
# Very much dependant on guessing the total length?
window_title=$(xdotool getactivewindow getwindowname)
# Estimation of characters in the block (modify this as per your estimate)
total_length=200
length=${#window_title}
padding_length=$(( total_length - length ))
# Generate the padding string with underscores
padding=$(printf ' %.0s' $(seq 1 $padding_length))
# Print the window title followed by the padding string
echo "$window_title $padding"
This is a bit of trial and error as finding the 'center' of screen depends on quite a few variables and calculations.
Based total_length by pure guess work.
from i3blocks.
Related Issues (20)
- Enable utf-8 string in i3blocks
- Persistent command does not actually persist HOT 3
- How do I tell i3blocks to refresh all blocks? HOT 2
- block freezing my status bar HOT 2
- battery regexp breaks with two batteries HOT 1
- `autogen.sh` Generates a `configure` File that Tries to Call Autoconf macro `PKG_CHECK_MODULES` HOT 1
- [Feature Request] Add ticker support
- I'm having trouble getting fixed-width strings to work on i3blocks. HOT 1
- Block's character will turn into "[" character after clicked and turn normal after sway is reloaded. HOT 1
- Can't use the config variable when running the script using i3-msg -q exec myscript HOT 4
- i3blocks does not show anything except datetime HOT 3
- dmenu hang when called from i3blocks with -fn option
- Battery regex in example doesn't handle 100% HOT 2
- Trouble with setting a label with emoji via the json format HOT 1
- Any script with a 'for' loop doesn't produce any output
- How to get back monochrome icons / emojis? Weird font issue!
- Question: is running a secondary command when clicking a button with an interval possible? HOT 1
- Change the color of borders from within a script
- If I launch a graphical program from a block and restart i3, the program dies even if disowned. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from i3blocks.