Compare commits
4 commits
11f5eecbc2
...
c5859fa87b
Author | SHA1 | Date | |
---|---|---|---|
c5859fa87b | |||
6603902687 | |||
7347fa6a65 | |||
b255853935 |
12 changed files with 219 additions and 211 deletions
|
@ -3,6 +3,7 @@ import { Box, Icon, Label } from 'resource:///com/github/Aylur/ags/widget.js';
|
||||||
|
|
||||||
const DEFAULT_KB = 'at-translated-set-2-keyboard';
|
const DEFAULT_KB = 'at-translated-set-2-keyboard';
|
||||||
|
|
||||||
|
|
||||||
export default () => Box({
|
export default () => Box({
|
||||||
className: 'toggle-off',
|
className: 'toggle-off',
|
||||||
css: 'padding: 0 10px;',
|
css: 'padding: 0 10px;',
|
||||||
|
|
|
@ -2,9 +2,6 @@ import Mpris from 'resource:///com/github/Aylur/ags/service/mpris.js';
|
||||||
import { Button, Icon, Label, Stack, Slider, CenterBox, Box } from 'resource:///com/github/Aylur/ags/widget.js';
|
import { Button, Icon, Label, Stack, Slider, CenterBox, Box } from 'resource:///com/github/Aylur/ags/widget.js';
|
||||||
import { execAsync, lookUpIcon, readFileAsync } from 'resource:///com/github/Aylur/ags/utils.js';
|
import { execAsync, lookUpIcon, readFileAsync } from 'resource:///com/github/Aylur/ags/utils.js';
|
||||||
|
|
||||||
import Gdk from 'gi://Gdk';
|
|
||||||
const display = Gdk.Display.get_default();
|
|
||||||
|
|
||||||
import Separator from '../misc/separator.js';
|
import Separator from '../misc/separator.js';
|
||||||
import EventBox from '../misc/cursorbox.js';
|
import EventBox from '../misc/cursorbox.js';
|
||||||
|
|
||||||
|
@ -148,24 +145,18 @@ export const PlayerIcon = (player, { symbolic = true, ...props } = {}) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const PositionSlider = (player, props) => EventBox({
|
export const PositionSlider = (player, props) => Slider({
|
||||||
child: Slider({
|
|
||||||
...props,
|
...props,
|
||||||
className: 'position-slider',
|
className: 'position-slider',
|
||||||
|
cursor: 'pointer',
|
||||||
|
vpack: 'center',
|
||||||
hexpand: true,
|
hexpand: true,
|
||||||
drawValue: false,
|
drawValue: false,
|
||||||
onChange: ({ value }) => {
|
onChange: ({ value }) => {
|
||||||
player.position = player.length * value;
|
player.position = player.length * value;
|
||||||
},
|
},
|
||||||
properties: [['update', slider => {
|
properties: [['update', slider => {
|
||||||
if (slider.dragging) {
|
if (!slider.dragging) {
|
||||||
slider.get_parent().window.set_cursor(Gdk.Cursor
|
|
||||||
.new_from_name(display, 'grabbing'));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
slider.get_parent()?.window?.set_cursor(Gdk.Cursor
|
|
||||||
.new_from_name(display, 'pointer'));
|
|
||||||
|
|
||||||
slider.visible = player.length > 0;
|
slider.visible = player.length > 0;
|
||||||
if (player.length > 0)
|
if (player.length > 0)
|
||||||
slider.value = player.position / player.length;
|
slider.value = player.position / player.length;
|
||||||
|
@ -185,17 +176,19 @@ export const PositionSlider = (player, props) => EventBox({
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
['button-press-event', s => { s.cursor = 'grabbing'; }],
|
||||||
|
['button-release-event', s => { s.cursor = 'pointer'; }],
|
||||||
],
|
],
|
||||||
}),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const PlayerButton = ({ player, items, onClick, prop }) => Button({
|
const PlayerButton = ({ player, items, onClick, prop }) => EventBox({
|
||||||
|
child: Button({
|
||||||
child: Stack({ items }),
|
child: Stack({ items }),
|
||||||
onPrimaryClickRelease: () => player[onClick](),
|
onPrimaryClickRelease: () => player[onClick](),
|
||||||
properties: [['hovered', false]],
|
properties: [['hovered', false]],
|
||||||
onHover: self => {
|
onHover: self => {
|
||||||
self._hovered = true;
|
self._hovered = true;
|
||||||
self.window.set_cursor(Gdk.Cursor.new_from_name(display, 'pointer'));
|
|
||||||
|
|
||||||
if (prop == 'playBackStatus') {
|
if (prop == 'playBackStatus') {
|
||||||
items.forEach(item => {
|
items.forEach(item => {
|
||||||
|
@ -212,7 +205,6 @@ const PlayerButton = ({ player, items, onClick, prop }) => Button({
|
||||||
},
|
},
|
||||||
onHoverLost: self => {
|
onHoverLost: self => {
|
||||||
self._hovered = false;
|
self._hovered = false;
|
||||||
self.window.set_cursor(null);
|
|
||||||
if (prop == 'playBackStatus') {
|
if (prop == 'playBackStatus') {
|
||||||
items.forEach(item => {
|
items.forEach(item => {
|
||||||
item[1].setCss(`
|
item[1].setCss(`
|
||||||
|
@ -266,6 +258,7 @@ const PlayerButton = ({ player, items, onClick, prop }) => Button({
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
],
|
],
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const ShuffleButton = player => PlayerButton({
|
export const ShuffleButton = player => PlayerButton({
|
||||||
|
|
|
@ -1,49 +1,55 @@
|
||||||
|
import Variable from 'resource:///com/github/Aylur/ags/variable.js';
|
||||||
import { Button, EventBox } from 'resource:///com/github/Aylur/ags/widget.js';
|
import { Button, EventBox } from 'resource:///com/github/Aylur/ags/widget.js';
|
||||||
|
|
||||||
import Gdk from 'gi://Gdk';
|
import Gtk from 'gi://Gtk';
|
||||||
const display = Gdk.Display.get_default();
|
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: wrap in another EventBox for disabled cursor
|
||||||
export default ({
|
export default ({
|
||||||
isButton = false,
|
isButton = false,
|
||||||
reset = true,
|
onPrimaryClickRelease = () => {},
|
||||||
onHover = () => {},
|
|
||||||
onHoverLost = () => {},
|
|
||||||
...props
|
...props
|
||||||
}) => {
|
}) => {
|
||||||
if (!isButton) {
|
// Make this variable to know if the function should
|
||||||
return EventBox({
|
// be executed depending on where the click is released
|
||||||
|
const CanRun = Variable(true);
|
||||||
|
|
||||||
|
const properties = {
|
||||||
...props,
|
...props,
|
||||||
onHover: self => {
|
cursor: 'pointer',
|
||||||
if (!self.child.sensitive || !self.sensitive)
|
onPrimaryClickRelease: self => {
|
||||||
self.window.set_cursor(Gdk.Cursor.new_from_name(display, 'not-allowed'));
|
// Every click, do a one shot connect to
|
||||||
|
// CanRun to wait for location of click
|
||||||
|
const id = CanRun.connect('changed', () => {
|
||||||
|
if (CanRun.value)
|
||||||
|
onPrimaryClickRelease(self);
|
||||||
|
|
||||||
else
|
CanRun.disconnect(id);
|
||||||
self.window.set_cursor(Gdk.Cursor.new_from_name(display, 'pointer'));
|
|
||||||
|
|
||||||
onHover(self);
|
|
||||||
},
|
|
||||||
onHoverLost: self => {
|
|
||||||
if (reset)
|
|
||||||
self.window.set_cursor(null);
|
|
||||||
|
|
||||||
onHoverLost(self);
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
else {
|
};
|
||||||
return Button({
|
|
||||||
...props,
|
let widget;
|
||||||
onHover: self => {
|
if (!isButton)
|
||||||
if (!self.child.sensitive || !self.sensitive)
|
widget = EventBox(properties);
|
||||||
self.window.set_cursor(Gdk.Cursor.new_from_name(display, 'not-allowed'));
|
|
||||||
else
|
else
|
||||||
self.window.set_cursor(Gdk.Cursor.new_from_name(display, 'pointer'));
|
widget = Button(properties);
|
||||||
},
|
|
||||||
onHoverLost: self => {
|
const gesture = Gtk.GestureLongPress.new(widget);
|
||||||
if (reset)
|
|
||||||
self.window.set_cursor(null);
|
widget.connectTo(gesture, () => {
|
||||||
},
|
const pointer = gesture.get_point(null);
|
||||||
});
|
const x = pointer[1];
|
||||||
}
|
const y = pointer[2];
|
||||||
|
|
||||||
|
if ((!x || !y) || x === 0 && y === 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CanRun.value = !(
|
||||||
|
x > widget.get_allocated_width() ||
|
||||||
|
y > widget.get_allocated_height()
|
||||||
|
);
|
||||||
|
}, 'end');
|
||||||
|
|
||||||
|
return widget;
|
||||||
};
|
};
|
||||||
|
|
|
@ -179,7 +179,6 @@ export const Notification = ({
|
||||||
label: setTime(notif.time),
|
label: setTime(notif.time),
|
||||||
}),
|
}),
|
||||||
EventBox({
|
EventBox({
|
||||||
reset: false,
|
|
||||||
child: Button({
|
child: Button({
|
||||||
className: 'close-button',
|
className: 'close-button',
|
||||||
vpack: 'start',
|
vpack: 'start',
|
||||||
|
|
|
@ -5,8 +5,6 @@ import { timeout } from 'resource:///com/github/Aylur/ags/utils.js';
|
||||||
import { HasNotifs } from './base.js';
|
import { HasNotifs } from './base.js';
|
||||||
|
|
||||||
import Gtk from 'gi://Gtk';
|
import Gtk from 'gi://Gtk';
|
||||||
import Gdk from 'gi://Gdk';
|
|
||||||
const display = Gdk.Display.get_default();
|
|
||||||
|
|
||||||
|
|
||||||
export default ({
|
export default ({
|
||||||
|
@ -20,13 +18,12 @@ export default ({
|
||||||
}) => {
|
}) => {
|
||||||
const widget = EventBox({
|
const widget = EventBox({
|
||||||
...props,
|
...props,
|
||||||
|
cursor: 'grab',
|
||||||
onHover: self => {
|
onHover: self => {
|
||||||
self.window.set_cursor(Gdk.Cursor.new_from_name(display, 'grab'));
|
|
||||||
if (!self._hovered)
|
if (!self._hovered)
|
||||||
self._hovered = true;
|
self._hovered = true;
|
||||||
},
|
},
|
||||||
onHoverLost: self => {
|
onHoverLost: self => {
|
||||||
self.window.set_cursor(null);
|
|
||||||
if (self._hovered)
|
if (self._hovered)
|
||||||
self._hovered = false;
|
self._hovered = false;
|
||||||
},
|
},
|
||||||
|
@ -85,9 +82,11 @@ export default ({
|
||||||
// When dragging
|
// When dragging
|
||||||
[gesture, self => {
|
[gesture, self => {
|
||||||
var offset = gesture.get_offset()[1];
|
var offset = gesture.get_offset()[1];
|
||||||
|
if (offset === 0)
|
||||||
|
return;
|
||||||
|
|
||||||
// Slide right
|
// Slide right
|
||||||
if (offset >= 0) {
|
if (offset > 0) {
|
||||||
self.setCss(`
|
self.setCss(`
|
||||||
margin-top: 0px; margin-bottom: 0px; opacity: 1; transition: none;
|
margin-top: 0px; margin-bottom: 0px; opacity: 1; transition: none;
|
||||||
margin-left: ${Number(offset + startMargin)}px;
|
margin-left: ${Number(offset + startMargin)}px;
|
||||||
|
@ -107,7 +106,7 @@ export default ({
|
||||||
|
|
||||||
// Put a threshold on if a click is actually dragging
|
// Put a threshold on if a click is actually dragging
|
||||||
widget._dragging = Math.abs(offset) > 10;
|
widget._dragging = Math.abs(offset) > 10;
|
||||||
widget.window?.set_cursor(Gdk.Cursor.new_from_name(display, 'grabbing'));
|
widget.cursor = 'grabbing';
|
||||||
}, 'drag-update'],
|
}, 'drag-update'],
|
||||||
|
|
||||||
|
|
||||||
|
@ -137,8 +136,7 @@ export default ({
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
self.setCss(defaultStyle);
|
self.setCss(defaultStyle);
|
||||||
widget.window?.set_cursor(Gdk.Cursor.new_from_name(display, 'grab'));
|
widget.cursor = 'grab',
|
||||||
|
|
||||||
widget._dragging = false;
|
widget._dragging = false;
|
||||||
}
|
}
|
||||||
}, 'drag-end'],
|
}, 'drag-end'],
|
||||||
|
|
|
@ -233,7 +233,7 @@ const SecondRow = () => Row({
|
||||||
|
|
||||||
GridButton({
|
GridButton({
|
||||||
command: () => {
|
command: () => {
|
||||||
execAsync(['pactl', 'set-source-mute', '@DEFAULT_SOURCE@', 'toggle'])
|
execAsync(['pactl', 'set-sink-mute', '@DEFAULT_SINK@', 'toggle'])
|
||||||
.catch(print);
|
.catch(print);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,13 @@ import PopupWindow from '../misc/popup.js';
|
||||||
import ToggleButton from './toggle-button.js';
|
import ToggleButton from './toggle-button.js';
|
||||||
|
|
||||||
|
|
||||||
const QuickSettingsWidget = () => Box({
|
const QuickSettingsWidget = () => {
|
||||||
|
const rev = Revealer({
|
||||||
|
transition: 'slide_down',
|
||||||
|
child: Player(),
|
||||||
|
});
|
||||||
|
|
||||||
|
return Box({
|
||||||
className: 'qs-container',
|
className: 'qs-container',
|
||||||
vertical: true,
|
vertical: true,
|
||||||
children: [
|
children: [
|
||||||
|
@ -31,18 +37,16 @@ const QuickSettingsWidget = () => Box({
|
||||||
|
|
||||||
SliderBox(),
|
SliderBox(),
|
||||||
|
|
||||||
ToggleButton(),
|
ToggleButton(rev),
|
||||||
|
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
|
|
||||||
Revealer({
|
rev,
|
||||||
transition: 'slide_down',
|
|
||||||
child: Player(),
|
|
||||||
}),
|
|
||||||
|
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
|
||||||
export default () => PopupWindow({
|
export default () => PopupWindow({
|
||||||
name: 'quick-settings',
|
name: 'quick-settings',
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import Audio from 'resource:///com/github/Aylur/ags/service/audio.js';
|
import Audio from 'resource:///com/github/Aylur/ags/service/audio.js';
|
||||||
import { Box, Slider, Icon, EventBox } from 'resource:///com/github/Aylur/ags/widget.js';
|
import { Box, Slider, Icon } from 'resource:///com/github/Aylur/ags/widget.js';
|
||||||
|
|
||||||
import { SpeakerIcon } from '../misc/audio-icons.js';
|
import { SpeakerIcon } from '../misc/audio-icons.js';
|
||||||
|
|
||||||
|
@ -22,10 +22,16 @@ export default () => Box({
|
||||||
}),
|
}),
|
||||||
|
|
||||||
Slider({
|
Slider({
|
||||||
connections: [[Audio, slider => {
|
cursor: 'pointer',
|
||||||
if (Audio.speaker)
|
vpack: 'center',
|
||||||
slider.value = Audio.speaker.volume;
|
connections: [
|
||||||
}, 'speaker-changed']],
|
[Audio, slider => {
|
||||||
|
slider.value = Audio.speaker?.volume;
|
||||||
|
}, 'speaker-changed'],
|
||||||
|
|
||||||
|
['button-press-event', s => { s.cursor = 'grabbing'; }],
|
||||||
|
['button-release-event', s => { s.cursor = 'pointer'; }],
|
||||||
|
],
|
||||||
onChange: ({ value }) => Audio.speaker.volume = value,
|
onChange: ({ value }) => Audio.speaker.volume = value,
|
||||||
max: 0.999,
|
max: 0.999,
|
||||||
draw_value: false,
|
draw_value: false,
|
||||||
|
@ -43,23 +49,20 @@ export default () => Box({
|
||||||
icon: 'display-brightness-symbolic',
|
icon: 'display-brightness-symbolic',
|
||||||
}),
|
}),
|
||||||
|
|
||||||
EventBox({
|
Slider({
|
||||||
onHover: box => box.child._canChange = false,
|
cursor: 'pointer',
|
||||||
onHoverLost: box => box.child._canChange = true,
|
vpack: 'center',
|
||||||
child: Slider({
|
onChange: ({ value }) => Brightness.screen = value,
|
||||||
properties: [
|
connections: [
|
||||||
['canChange', true],
|
[Brightness, slider => {
|
||||||
],
|
|
||||||
onChange: ({ value }) => {
|
|
||||||
Brightness.screen = value;
|
|
||||||
},
|
|
||||||
connections: [[Brightness, slider => {
|
|
||||||
if (slider._canChange)
|
|
||||||
slider.value = Brightness.screen;
|
slider.value = Brightness.screen;
|
||||||
}, 'screen']],
|
}, 'screen'],
|
||||||
|
|
||||||
|
['button-press-event', s => { s.cursor = 'grabbing'; }],
|
||||||
|
['button-release-event', s => { s.cursor = 'pointer'; }],
|
||||||
|
],
|
||||||
draw_value: false,
|
draw_value: false,
|
||||||
}),
|
}),
|
||||||
}),
|
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
import App from 'resource:///com/github/Aylur/ags/app.js';
|
import App from 'resource:///com/github/Aylur/ags/app.js';
|
||||||
import Mpris from 'resource:///com/github/Aylur/ags/service/mpris.js';
|
import Mpris from 'resource:///com/github/Aylur/ags/service/mpris.js';
|
||||||
import { Icon, ToggleButton } from 'resource:///com/github/Aylur/ags/widget.js';
|
import { CenterBox, Icon, ToggleButton } from 'resource:///com/github/Aylur/ags/widget.js';
|
||||||
|
|
||||||
import EventBox from '../misc/cursorbox.js';
|
|
||||||
|
|
||||||
|
|
||||||
export default () => EventBox({
|
export default rev => CenterBox({
|
||||||
child: ToggleButton({
|
center_widget: ToggleButton({
|
||||||
|
cursor: 'pointer',
|
||||||
setup: self => {
|
setup: self => {
|
||||||
// Open at startup if there are players
|
// Open at startup if there are players
|
||||||
const id = Mpris.connect('changed', () => {
|
const id = Mpris.connect('changed', () => {
|
||||||
|
@ -16,8 +15,6 @@ export default () => EventBox({
|
||||||
},
|
},
|
||||||
|
|
||||||
connections: [['toggled', self => {
|
connections: [['toggled', self => {
|
||||||
const rev = self.get_parent().get_parent().get_parent().children[1];
|
|
||||||
|
|
||||||
if (self.get_active()) {
|
if (self.get_active()) {
|
||||||
self.get_children()[0]
|
self.get_children()[0]
|
||||||
.setCss('-gtk-icon-transform: rotate(0deg);');
|
.setCss('-gtk-icon-transform: rotate(0deg);');
|
||||||
|
@ -36,4 +33,6 @@ export default () => EventBox({
|
||||||
css: '-gtk-icon-transform: rotate(180deg);',
|
css: '-gtk-icon-transform: rotate(180deg);',
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
|
start_widget: null,
|
||||||
|
end_widget: null,
|
||||||
});
|
});
|
||||||
|
|
|
@ -132,8 +132,10 @@
|
||||||
margin-right: -20px;
|
margin-right: -20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
scale {
|
.slider {
|
||||||
min-height: 55px;
|
min-height: 55px;
|
||||||
|
|
||||||
|
scale {
|
||||||
min-width: 400px;
|
min-width: 400px;
|
||||||
margin-left: 18px;
|
margin-left: 18px;
|
||||||
margin-right: 20px;
|
margin-right: 20px;
|
||||||
|
@ -163,4 +165,5 @@
|
||||||
transition: background-color 0.5s ease-in-out;
|
transition: background-color 0.5s ease-in-out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,9 @@ exec-once = gnome-keyring-daemon --start --components=secrets
|
||||||
exec-once = squeekboard
|
exec-once = squeekboard
|
||||||
|
|
||||||
exec-once = bash -c "sleep 3; ags -t applauncher"
|
exec-once = bash -c "sleep 3; ags -t applauncher"
|
||||||
|
|
||||||
layerrule = blur, overview
|
layerrule = blur, overview
|
||||||
|
layerrule = ignorealpha[0.97], overview ## don't blur corners
|
||||||
|
|
||||||
exec-once = wl-paste --watch cliphist store
|
exec-once = wl-paste --watch cliphist store
|
||||||
|
|
||||||
|
|
BIN
flake.lock
BIN
flake.lock
Binary file not shown.
Loading…
Reference in a new issue