aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/island/Controls.js
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-15 11:24:49 +0200
committerDanilo M. <danix@danix.xyz>2026-10-15 11:24:49 +0200
commite22d2ccee82b829875fe343cf1be48975174b054 (patch)
tree8445170966a2f41a1cc4411c792ac74c97a1ea3d /desktop/island/Controls.js
parent021c2d42271cdda15a4fdf129ce162d8af8a9ab5 (diff)
downloadquickshell-e22d2ccee82b829875fe343cf1be48975174b054.tar.gz
quickshell-e22d2ccee82b829875fe343cf1be48975174b054.zip
refactor(island): the controls panel goes
Each of its seven tiles opened a drawer page that already existed, and it went unused. SUPER alone will open the drawer instead. Removed with it: the status pill's controls icon, Island.toggleControls, the island IPC target, Controls.js and its test, and the controls list in Prefs. Prefs now holds only the pinned IP; a controls key left in desktop.json is still kept on write, because writes merge into the parsed document. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'desktop/island/Controls.js')
-rw-r--r--desktop/island/Controls.js107
1 files changed, 0 insertions, 107 deletions
diff --git a/desktop/island/Controls.js b/desktop/island/Controls.js
deleted file mode 100644
index 0ca2f6c..0000000
--- a/desktop/island/Controls.js
+++ /dev/null
@@ -1,107 +0,0 @@
-.pragma library
-
-// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License version 2 as
-// published by the Free Software Foundation.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// The controls panel's tiles and the pure operations on their order. The
-// order itself lives in Prefs.qml; everything here takes a list and returns
-// a new one, so it runs under node (test_controls.js).
-
-// Table order is the default order and the order of the hidden strip.
-const TILES = {
- wifi: { label: "Wi-Fi", page: "network" },
- bluetooth: { label: "Bluetooth", page: "bluetooth" },
- dnd: { label: "DND", page: "status" },
- presentation: { label: "Presentation", page: "status" },
- nolock: { label: "Auto-lock", page: "status" },
- output: { label: "Output", page: "sound" },
- mic: { label: "Mic", page: "sound" },
-};
-
-function defaults() {
- return Object.keys(TILES);
-}
-
-function tile(id) {
- return TILES[id] || null;
-}
-
-// Icon name for a tile's state. `on` is the tile's lit state: for the mic
-// that is "not muted". Output is "" because Logic.volumeIcon owns it.
-function icon(id, on) {
- switch (id) {
- case "wifi": return on ? "network-wireless" : "network-wireless-disconnected";
- case "bluetooth": return "preferences-system-bluetooth";
- case "dnd": return on ? "notifications-disabled" : "notifications";
- case "presentation": return "video-display";
- case "nolock": return "system-lock-screen";
- case "mic": return on ? "audio-input-microphone" : "microphone-sensitivity-muted";
- default: return "";
- }
-}
-
-// A stored list made safe: unknown ids (a tile removed from the code) and
-// duplicates dropped. An empty list is a valid choice; a non-list is not.
-function normalize(list) {
- if (!Array.isArray(list)) return defaults();
- const out = [];
- for (let i = 0; i < list.length; i++) {
- const id = list[i];
- if (TILES[id] && out.indexOf(id) < 0) out.push(id);
- }
- return out;
-}
-
-function hidden(list) {
- return defaults().filter(id => list.indexOf(id) < 0);
-}
-
-function move(list, from, to) {
- const out = list.slice();
- const id = out.splice(from, 1)[0];
- out.splice(to, 0, id);
- return out;
-}
-
-function hide(list, id) {
- return list.filter(x => x !== id);
-}
-
-function show(list, id) {
- if (!TILES[id] || list.indexOf(id) >= 0) return list.slice();
- return list.concat([id]);
-}
-
-// Audio tile bar width as a fraction. Output goes to 1.5, the bar stops at
-// 1. !(> 0) also catches a volume not populated yet.
-function fill(volume) {
- if (!(volume > 0)) return 0;
- return Math.min(1, volume);
-}
-
-// One scroll step, rounded to the percent so repeated steps do not drift.
-// The cap only stops a step up: a level already above it (set elsewhere,
-// e.g. a mic at 120% from pavucontrol) is left alone by up and stepped from
-// by down, never snapped to the cap.
-function step(volume, delta, max) {
- const cur = volume > 0 ? volume : 0;
- const v = Math.round((cur + delta) * 100) / 100;
- if (delta < 0) return Math.max(0, v);
- return Math.max(cur, Math.min(max, v));
-}
-
-// The slot a dragged tile lands in, from its centre in grid coordinates.
-// Off the grid clamps to the nearest edge; past the last tile is the last.
-function slotAt(x, y, pitch, cols, count) {
- const col = Math.max(0, Math.min(cols - 1, Math.floor(x / pitch)));
- const row = Math.max(0, Math.floor(y / pitch));
- return Math.max(0, Math.min(count - 1, row * cols + col));
-}