osds: config show value
This commit is contained in:
parent
d2457db2c3
commit
f2945d0715
2 changed files with 26 additions and 19 deletions
|
|
@ -28,11 +28,13 @@ export const osds = {
|
|||
position: Astal.WindowAnchor.RIGHT,
|
||||
margin: 20,
|
||||
hideDelay: 1500,
|
||||
showValue: true,
|
||||
},
|
||||
brightness: {
|
||||
position: Astal.WindowAnchor.LEFT,
|
||||
margin: 20,
|
||||
hideDelay: 1500,
|
||||
showValue: true,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -131,8 +131,11 @@ const SliderOsd = ({
|
|||
cr.setAntialias(cairo.Antialias.BEST);
|
||||
|
||||
// Progress number, at top/right
|
||||
let nw = 0;
|
||||
let nh = 0;
|
||||
if (config[type].showValue) {
|
||||
const numLayout = parent.create_pango_layout(String(Math.round(progressValue * 100)));
|
||||
const [nw, nh] = numLayout.get_pixel_size();
|
||||
[nw, nh] = numLayout.get_pixel_size();
|
||||
let diff;
|
||||
if (vertical) {
|
||||
diff = ((1 - progressValue) * height) / nh;
|
||||
|
|
@ -151,6 +154,7 @@ const SliderOsd = ({
|
|||
);
|
||||
|
||||
PangoCairo.show_layout(cr, numLayout);
|
||||
}
|
||||
|
||||
// Progress icon, follows progress
|
||||
if (fontDesc === null) {
|
||||
|
|
@ -168,6 +172,7 @@ const SliderOsd = ({
|
|||
iconLayout.set_text(icon.get(), -1);
|
||||
|
||||
const [iw, ih] = iconLayout.get_pixel_size();
|
||||
let diff;
|
||||
if (vertical) {
|
||||
diff = (progressValue * height) / ih;
|
||||
cr.moveTo(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue