Files
att_menu/shell.qml
T

150 lines
3.2 KiB
QML

import Quickshell
import Quickshell.Io
import qs.config
import qs.modules
import qs.services
ShellRoot {
// One panel per screen. Variants tracks screen hotplug, so panels appear and
// disappear with monitors without a reload.
Variants {
model: Quickshell.screens
Bar {}
}
// Lets the menus be bound to keys in the compositor, e.g.
// bindsym $mod+d exec qs -c att_menu ipc call launcher toggle
// `close` closes whichever menu is open — only one ever is.
IpcHandler {
target: "launcher"
function toggle(): void {
Session.toggle("launcher", "");
}
function open(): void {
Session.open("launcher", "");
}
function close(): void {
Session.close();
}
}
IpcHandler {
target: "power"
function toggle(): void {
Session.toggle("power", "");
}
function open(): void {
Session.open("power", "");
}
function close(): void {
Session.close();
}
}
IpcHandler {
target: "wifi"
function toggle(): void {
Session.toggle("wifi", "");
}
function open(): void {
Session.open("wifi", "");
}
function close(): void {
Session.close();
}
}
// Not a menu: this one drives squeekboard, so it is worth binding to a
// hardware key or a tablet-mode switch as well as clicking.
IpcHandler {
target: "osk"
function toggle(): void {
Osk.toggle();
}
// Named to match the menu targets above: `qs ipc call` swallows a
// function called `show` — it collides with the `ipc show` subcommand
// — and a lone `hide` next to `open` would read oddly anyway.
function open(): void {
Osk.show();
}
function close(): void {
Osk.hide();
}
}
IpcHandler {
target: "controls"
function toggle(): void {
Session.toggle("controls", "");
}
function open(): void {
Session.open("controls", "");
}
function close(): void {
Session.close();
}
}
// Not a menu: these are for the volume and brightness keys, which want to
// move the level without putting anything on screen.
IpcHandler {
target: "volume"
function up(): void {
Audio.step(Config.volumeStep);
}
function down(): void {
Audio.step(-Config.volumeStep);
}
function mute(): void {
Audio.toggleMute();
}
}
IpcHandler {
target: "brightness"
function up(): void {
Brightness.step(Config.brightnessStep);
}
function down(): void {
Brightness.step(-Config.brightnessStep);
}
}
IpcHandler {
target: "bluetooth"
function toggle(): void {
Session.toggle("bluetooth", "");
}
function open(): void {
Session.open("bluetooth", "");
}
function close(): void {
Session.close();
}
}
}