Added a command to adjust volume that respects hyprpanel settings and made bar module settings for click events apply immediately. (#619)
This commit is contained in:
@@ -36,7 +36,8 @@ export const Slider = ({ device, type }: SliderProps): JSX.Element => {
|
||||
self.connect('scroll-event', (_, event: Gdk.Event) => {
|
||||
if (isScrollUp(event)) {
|
||||
const newVolume = device.volume + 0.05;
|
||||
device.set_volume(Math.min(newVolume, 1));
|
||||
const minVolume = raiseMaximumVolume.get() ? 1.5 : 1;
|
||||
device.set_volume(Math.min(newVolume, minVolume));
|
||||
}
|
||||
|
||||
if (isScrollDown(event)) {
|
||||
|
||||
@@ -5,45 +5,64 @@ import { Gtk } from 'astal/gtk3';
|
||||
import { bind, Variable } from 'astal';
|
||||
const { unit } = options.menus.clock.weather;
|
||||
|
||||
export const TodayTemperature = (): JSX.Element => {
|
||||
const WeatherStatus = (): JSX.Element => {
|
||||
return (
|
||||
<box halign={Gtk.Align.CENTER}>
|
||||
<label
|
||||
className={bind(globalWeatherVar).as(
|
||||
(weather) =>
|
||||
`calendar-menu-weather today condition label ${getWeatherIcon(Math.ceil(weather.current.temp_f)).color}`,
|
||||
)}
|
||||
label={bind(globalWeatherVar).as((weather) => weather.current.condition.text)}
|
||||
truncate
|
||||
tooltipText={bind(globalWeatherVar).as((weather) => weather.current.condition.text)}
|
||||
/>
|
||||
</box>
|
||||
);
|
||||
};
|
||||
|
||||
const Temperature = (): JSX.Element => {
|
||||
const labelBinding = Variable.derive([bind(globalWeatherVar), bind(unit)], getTemperature);
|
||||
|
||||
const TemperatureLabel = (): JSX.Element => {
|
||||
return <label className={'calendar-menu-weather today temp label'} label={labelBinding()} />;
|
||||
};
|
||||
|
||||
const ThermometerIcon = (): JSX.Element => {
|
||||
return (
|
||||
<label
|
||||
className={bind(globalWeatherVar).as(
|
||||
(weather) =>
|
||||
`calendar-menu-weather today temp label icon txt-icon ${getWeatherIcon(Math.ceil(weather.current.temp_f)).color}`,
|
||||
)}
|
||||
label={bind(globalWeatherVar).as((weather) => getWeatherIcon(Math.ceil(weather.current.temp_f)).icon)}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<box
|
||||
halign={Gtk.Align.CENTER}
|
||||
className={'calendar-menu-weather today temp container'}
|
||||
valign={Gtk.Align.CENTER}
|
||||
vertical
|
||||
vertical={false}
|
||||
onDestroy={() => {
|
||||
labelBinding.drop();
|
||||
}}
|
||||
hexpand
|
||||
>
|
||||
<box
|
||||
className={'calendar-menu-weather today temp container'}
|
||||
valign={Gtk.Align.CENTER}
|
||||
vertical={false}
|
||||
hexpand
|
||||
>
|
||||
<box halign={Gtk.Align.CENTER} hexpand>
|
||||
<label className={'calendar-menu-weather today temp label'} label={labelBinding()} />
|
||||
<label
|
||||
className={bind(globalWeatherVar).as(
|
||||
(weather) =>
|
||||
`calendar-menu-weather today temp label icon txt-icon ${getWeatherIcon(Math.ceil(weather.current.temp_f)).color}`,
|
||||
)}
|
||||
label={bind(globalWeatherVar).as(
|
||||
(weather) => getWeatherIcon(Math.ceil(weather.current.temp_f)).icon,
|
||||
)}
|
||||
/>
|
||||
</box>
|
||||
</box>
|
||||
<box halign={Gtk.Align.CENTER}>
|
||||
<label
|
||||
className={bind(globalWeatherVar).as(
|
||||
(weather) =>
|
||||
`calendar-menu-weather today condition label ${getWeatherIcon(Math.ceil(weather.current.temp_f)).color}`,
|
||||
)}
|
||||
label={bind(globalWeatherVar).as((weather) => weather.current.condition.text)}
|
||||
/>
|
||||
<box halign={Gtk.Align.CENTER} hexpand>
|
||||
<TemperatureLabel />
|
||||
<ThermometerIcon />
|
||||
</box>
|
||||
</box>
|
||||
);
|
||||
};
|
||||
|
||||
export const TodayTemperature = (): JSX.Element => {
|
||||
return (
|
||||
<box halign={Gtk.Align.CENTER} valign={Gtk.Align.CENTER} vertical>
|
||||
<Temperature />
|
||||
<WeatherStatus />
|
||||
</box>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user