mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-02 03:28:28 -04:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cc307aff98 | |||
| cee7957e15 | |||
| 602697ef51 |
@@ -40,7 +40,6 @@ var resolveIncludeCmd = &cobra.Command{
|
||||
"layout.kdl",
|
||||
"outputs.kdl",
|
||||
"binds.kdl",
|
||||
"input.kdl",
|
||||
"cursor.conf",
|
||||
"layout.conf",
|
||||
"outputs.conf",
|
||||
|
||||
@@ -143,10 +143,6 @@ var dmsConfigSpecs = map[string]dmsConfigSpec{
|
||||
niriFile: "alttab.kdl",
|
||||
niriContent: func(_ string) string { return config.NiriAlttabConfig },
|
||||
},
|
||||
"input": {
|
||||
niriFile: "input.kdl",
|
||||
niriContent: func(_ string) string { return config.NiriInputConfig },
|
||||
},
|
||||
"outputs": {
|
||||
niriFile: "outputs.kdl",
|
||||
hyprFile: "outputs.lua",
|
||||
|
||||
+1
-1
@@ -69,7 +69,7 @@ require (
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/AvengeMedia/dankgo v0.0.0-20260724133713-a4ef23371e05
|
||||
github.com/AvengeMedia/dankgo v0.0.0-20260721162324-38d48943054d
|
||||
github.com/atotto/clipboard v0.1.4 // indirect
|
||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
|
||||
github.com/charmbracelet/colorprofile v0.4.3 // indirect
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
filippo.io/edwards25519 v1.2.0 h1:crnVqOiS4jqYleHd9vaKZ+HKtHfllngJIiOpNpoJsjo=
|
||||
filippo.io/edwards25519 v1.2.0/go.mod h1:xzAOLCNug/yB62zG1bQ8uziwrIqIuxhctzJT18Q77mc=
|
||||
github.com/AvengeMedia/dankgo v0.0.0-20260724133713-a4ef23371e05 h1:Ij/yzOT8y2HL7V5Rkec1GxJV0rUvhKqfAzyGxVRTk1o=
|
||||
github.com/AvengeMedia/dankgo v0.0.0-20260724133713-a4ef23371e05/go.mod h1:xt8RldAfti0QCWidwYIzsSSoJWsE61WgEhTu2H9UpD4=
|
||||
github.com/AvengeMedia/dankgo v0.0.0-20260721162324-38d48943054d h1:EZN2x2uAX975Uvw4MByqWaaVTp2fOJrNTl4V4EQbSn8=
|
||||
github.com/AvengeMedia/dankgo v0.0.0-20260721162324-38d48943054d/go.mod h1:7p7cfydr4WM1G6eOPFlANXF3IV5du3FoA4CbDPprHAo=
|
||||
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
|
||||
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
|
||||
github.com/ProtonMail/go-crypto v1.4.1 h1:9RfcZHqEQUvP8RzecWEUafnZVtEvrBVL9BiF67IQOfM=
|
||||
|
||||
@@ -264,7 +264,6 @@ func (cd *ConfigDeployer) deployNiriDmsConfigs(dmsDir, terminalCommand string) e
|
||||
{"layout.kdl", NiriLayoutConfig},
|
||||
{"alttab.kdl", NiriAlttabConfig},
|
||||
{"binds.kdl", strings.ReplaceAll(NiriBindsConfig, "{{TERMINAL_COMMAND}}", terminalCommand)},
|
||||
{"input.kdl", NiriInputConfig},
|
||||
{"outputs.kdl", ""},
|
||||
{"cursor.kdl", ""},
|
||||
{"windowrules.kdl", ""},
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
// ! DO NOT EDIT !
|
||||
// ! AUTO-GENERATED BY DMS !
|
||||
// ! CHANGES WILL BE OVERWRITTEN !
|
||||
// ! PLACE YOUR CUSTOM CONFIGURATION ELSEWHERE !
|
||||
|
||||
input {
|
||||
mouse {
|
||||
accel-speed 0.0
|
||||
}
|
||||
touchpad {
|
||||
tap
|
||||
accel-speed 0.0
|
||||
natural-scroll
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,31 @@ input {
|
||||
numlock
|
||||
}
|
||||
|
||||
// Next sections include libinput settings.
|
||||
// Omitting settings disables them, or leaves them at their default values.
|
||||
// All commented-out settings here are examples, not defaults.
|
||||
touchpad {
|
||||
// off
|
||||
tap
|
||||
// dwt
|
||||
// dwtp
|
||||
// drag false
|
||||
// drag-lock
|
||||
natural-scroll
|
||||
// accel-speed 0.2
|
||||
// accel-profile "flat"
|
||||
// scroll-method "two-finger"
|
||||
// disabled-on-external-mouse
|
||||
}
|
||||
|
||||
mouse {
|
||||
// off
|
||||
// natural-scroll
|
||||
// accel-speed 0.2
|
||||
// accel-profile "flat"
|
||||
// scroll-method "no-scroll"
|
||||
}
|
||||
|
||||
trackpoint {
|
||||
// off
|
||||
// natural-scroll
|
||||
@@ -52,7 +77,6 @@ input {
|
||||
// Setting max-scroll-amount="0%" makes it work only on windows already fully on screen.
|
||||
// focus-follows-mouse max-scroll-amount="0%"
|
||||
}
|
||||
|
||||
// You can configure outputs by their name, which you can find
|
||||
// by running `niri msg outputs` while inside a niri instance.
|
||||
// The built-in laptop monitor is usually called "eDP-1".
|
||||
@@ -247,4 +271,3 @@ include optional=true "dms/alttab.kdl"
|
||||
include optional=true "dms/binds.kdl"
|
||||
include optional=true "dms/outputs.kdl"
|
||||
include optional=true "dms/cursor.kdl"
|
||||
include optional=true "dms/input.kdl"
|
||||
|
||||
@@ -16,6 +16,3 @@ var NiriAlttabConfig string
|
||||
|
||||
//go:embed embedded/niri-binds.kdl
|
||||
var NiriBindsConfig string
|
||||
|
||||
//go:embed embedded/niri-input.kdl
|
||||
var NiriInputConfig string
|
||||
|
||||
@@ -386,8 +386,8 @@ func buildOnce(opts *Options) (bool, error) {
|
||||
default:
|
||||
syncAccentColor(primaryDark)
|
||||
}
|
||||
refreshGTKTheme(opts.Mode)
|
||||
refreshGTKColorScheme()
|
||||
refreshGTK(opts.Mode)
|
||||
refreshGTK4()
|
||||
}
|
||||
|
||||
if isDMSKDEColorSchemeActive(opts.ConfigDir) {
|
||||
@@ -911,7 +911,7 @@ func generateDank16Variants(primaryDark, primaryLight, surface string, mode Colo
|
||||
}
|
||||
|
||||
func isDMSGTKActive(configDir string) bool {
|
||||
gtkCSS := filepath.Join(configDir, "gtk-4.0", "gtk.css")
|
||||
gtkCSS := filepath.Join(configDir, "gtk-3.0", "gtk.css")
|
||||
|
||||
info, err := os.Lstat(gtkCSS)
|
||||
if err != nil {
|
||||
@@ -968,7 +968,7 @@ func applyKDEColorScheme(mode ColorMode) {
|
||||
}
|
||||
}
|
||||
|
||||
func refreshGTKTheme(mode ColorMode) {
|
||||
func refreshGTK(mode ColorMode) {
|
||||
if err := utils.GsettingsSet("org.gnome.desktop.interface", "gtk-theme", ""); err != nil {
|
||||
log.Warnf("Failed to reset gtk-theme: %v", err)
|
||||
}
|
||||
@@ -993,8 +993,8 @@ func expectColorSchemeEcho(scheme string) {
|
||||
// apps reload ~/.config/gtk-4.0 CSS (a gtk-theme flip does not). But apps
|
||||
// following the portal color-scheme (Chromium) can drop the restore signal
|
||||
// mid-repaint and latch the wrong mode, so this is opt-in.
|
||||
func refreshGTKColorScheme() {
|
||||
if os.Getenv("DMS_ENABLE_GTK_REFRESH") != "1" {
|
||||
func refreshGTK4() {
|
||||
if os.Getenv("DMS_ENABLE_GTK4_REFRESH") != "1" {
|
||||
return
|
||||
}
|
||||
output, err := utils.GsettingsGet("org.gnome.desktop.interface", "color-scheme")
|
||||
@@ -1012,13 +1012,13 @@ func refreshGTKColorScheme() {
|
||||
|
||||
expectColorSchemeEcho(toggle)
|
||||
if err := utils.GsettingsSet("org.gnome.desktop.interface", "color-scheme", toggle); err != nil {
|
||||
log.Warnf("Failed to toggle color-scheme for GTK refresh: %v", err)
|
||||
log.Warnf("Failed to toggle color-scheme for GTK4 refresh: %v", err)
|
||||
return
|
||||
}
|
||||
time.Sleep(50 * time.Millisecond)
|
||||
time.Sleep(400 * time.Millisecond)
|
||||
expectColorSchemeEcho(current)
|
||||
if err := utils.GsettingsSet("org.gnome.desktop.interface", "color-scheme", current); err != nil {
|
||||
log.Warnf("Failed to restore color-scheme for GTK refresh: %v", err)
|
||||
log.Warnf("Failed to restore color-scheme for GTK4 refresh: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,10 +43,10 @@ func NewManager() (*Manager, error) {
|
||||
broker := NewSubscriptionBroker(m.broadcastPairingPrompt)
|
||||
m.promptBroker = broker
|
||||
|
||||
adapter, err := findAdapter(conn)
|
||||
adapter, err := m.findAdapter()
|
||||
if err != nil {
|
||||
conn.Close()
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("no bluetooth adapter found: %w", err)
|
||||
}
|
||||
m.adapterPath = adapter
|
||||
|
||||
@@ -74,12 +74,12 @@ func NewManager() (*Manager, error) {
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func findAdapter(conn *dbus.Conn) (dbus.ObjectPath, error) {
|
||||
obj := conn.Object(bluezService, dbus.ObjectPath("/"))
|
||||
func (m *Manager) findAdapter() (dbus.ObjectPath, error) {
|
||||
obj := m.dbusConn.Object(bluezService, dbus.ObjectPath("/"))
|
||||
var objects map[dbus.ObjectPath]map[string]map[string]dbus.Variant
|
||||
|
||||
if err := obj.Call(objectMgrIface+".GetManagedObjects", 0).Store(&objects); err != nil {
|
||||
return "", fmt.Errorf("%w: %v", ErrNoAdapter, err)
|
||||
return "", err
|
||||
}
|
||||
|
||||
for path, interfaces := range objects {
|
||||
@@ -89,7 +89,7 @@ func findAdapter(conn *dbus.Conn) (dbus.ObjectPath, error) {
|
||||
}
|
||||
}
|
||||
|
||||
return "", ErrNoAdapter
|
||||
return "", fmt.Errorf("no adapter found")
|
||||
}
|
||||
|
||||
func (m *Manager) initialize() error {
|
||||
@@ -487,11 +487,6 @@ func (m *Manager) StopDiscovery() error {
|
||||
}
|
||||
|
||||
func (m *Manager) SetPowered(powered bool) error {
|
||||
if powered {
|
||||
if err := rfkillUnblockBluetooth(); err != nil {
|
||||
log.Debugf("[BluezManager] rfkill unblock failed: %v", err)
|
||||
}
|
||||
}
|
||||
obj := m.dbusConn.Object(bluezService, m.adapterPath)
|
||||
return obj.Call(propertiesIface+".Set", 0, adapter1Iface, "Powered", dbus.MakeVariant(powered)).Err
|
||||
}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
package bluez
|
||||
|
||||
func rfkillUnblockBluetooth() error {
|
||||
return nil
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package bluez
|
||||
|
||||
import "os"
|
||||
|
||||
// linux/rfkill.h: struct rfkill_event { __u32 idx; __u8 type; __u8 op; __u8 soft; __u8 hard; },
|
||||
// RFKILL_TYPE_BLUETOOTH=2, RFKILL_OP_CHANGE_ALL=3
|
||||
func rfkillUnblockBluetooth() error {
|
||||
f, err := os.OpenFile("/dev/rfkill", os.O_WRONLY, 0)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
var event [8]byte
|
||||
event[4] = 2
|
||||
event[5] = 3
|
||||
_, err = f.Write(event[:])
|
||||
return err
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package bluez
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/godbus/dbus/v5"
|
||||
)
|
||||
|
||||
var ErrNoAdapter = errors.New("no bluetooth adapter found")
|
||||
|
||||
func WaitForAdapter() error {
|
||||
conn, err := dbus.ConnectSystemBus()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer conn.Close()
|
||||
|
||||
if err := conn.AddMatchSignal(
|
||||
dbus.WithMatchInterface(objectMgrIface),
|
||||
dbus.WithMatchMember("InterfacesAdded"),
|
||||
); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
signals := make(chan *dbus.Signal, 64)
|
||||
conn.Signal(signals)
|
||||
|
||||
if _, err := findAdapter(conn); err == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
for sig := range signals {
|
||||
if sig == nil || sig.Name != objectMgrIface+".InterfacesAdded" || len(sig.Body) < 2 {
|
||||
continue
|
||||
}
|
||||
ifaces, ok := sig.Body[1].(map[string]map[string]dbus.Variant)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
if _, ok := ifaces[adapter1Iface]; ok {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
return fmt.Errorf("dbus signal stream closed")
|
||||
}
|
||||
@@ -116,12 +116,11 @@ func RouteRequest(conn *models.Conn, req models.Request) {
|
||||
}
|
||||
|
||||
if strings.HasPrefix(req.Method, "cups.") {
|
||||
mgr, err := ensureCupsManager()
|
||||
if err != nil {
|
||||
if cupsManager == nil {
|
||||
models.RespondError(conn, req.ID, "CUPS manager not initialized")
|
||||
return
|
||||
}
|
||||
cups.HandleRequest(conn, req, mgr)
|
||||
cups.HandleRequest(conn, req, cupsManager)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"runtime/debug"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/AvengeMedia/DankMaterialShell/core/internal/geolocation"
|
||||
@@ -79,8 +80,8 @@ var geoClientInstance geolocation.Client
|
||||
const dbusClientID = "dms-dbus-client"
|
||||
|
||||
var capabilitySubscribers syncmap.Map[string, chan ServerInfo]
|
||||
var cupsMu sync.Mutex
|
||||
var cupsSubscriberCount int
|
||||
var cupsSubscribers syncmap.Map[string, bool]
|
||||
var cupsSubscriberCount atomic.Int32
|
||||
|
||||
var appPaths = paths.New("danklinux")
|
||||
|
||||
@@ -173,55 +174,17 @@ func InitializeAppPickerManager() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func initializeCupsManagerLocked() (bool, error) {
|
||||
if cupsManager != nil {
|
||||
return false, nil
|
||||
}
|
||||
func InitializeCupsManager() error {
|
||||
manager, err := cups.NewManager()
|
||||
if err != nil {
|
||||
log.Warnf("Failed to initialize cups manager: %v", err)
|
||||
return false, err
|
||||
return err
|
||||
}
|
||||
|
||||
cupsManager = manager
|
||||
|
||||
log.Info("CUPS manager initialized")
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func ensureCupsManager() (*cups.Manager, error) {
|
||||
cupsMu.Lock()
|
||||
created, err := initializeCupsManagerLocked()
|
||||
mgr := cupsManager
|
||||
cupsMu.Unlock()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if created {
|
||||
notifyCapabilityChange()
|
||||
}
|
||||
return mgr, nil
|
||||
}
|
||||
|
||||
func cupsAvailable() bool {
|
||||
cupsMu.Lock()
|
||||
defer cupsMu.Unlock()
|
||||
return cupsManager != nil
|
||||
}
|
||||
|
||||
func releaseCupsSubscriber() {
|
||||
cupsMu.Lock()
|
||||
cupsSubscriberCount--
|
||||
var mgr *cups.Manager
|
||||
if cupsSubscriberCount == 0 && cupsManager != nil {
|
||||
mgr = cupsManager
|
||||
cupsManager = nil
|
||||
}
|
||||
cupsMu.Unlock()
|
||||
if mgr == nil {
|
||||
return
|
||||
}
|
||||
log.Info("Last CUPS subscriber disconnected, shutting down CUPS manager")
|
||||
mgr.Close()
|
||||
notifyCapabilityChange()
|
||||
return nil
|
||||
}
|
||||
|
||||
func InitializeBrightnessManager() error {
|
||||
@@ -416,7 +379,7 @@ func getCapabilities() Capabilities {
|
||||
caps = append(caps, "browser")
|
||||
}
|
||||
|
||||
if cupsAvailable() {
|
||||
if cupsManager != nil {
|
||||
caps = append(caps, "cups")
|
||||
}
|
||||
|
||||
@@ -486,7 +449,7 @@ func getServerInfo() ServerInfo {
|
||||
caps = append(caps, "browser")
|
||||
}
|
||||
|
||||
if cupsAvailable() {
|
||||
if cupsManager != nil {
|
||||
caps = append(caps, "cups")
|
||||
}
|
||||
|
||||
@@ -950,31 +913,38 @@ func handleSubscribe(conn *models.Conn, req models.Request) {
|
||||
}
|
||||
|
||||
if shouldSubscribe("cups") {
|
||||
cupsMu.Lock()
|
||||
cupsSubscriberCount++
|
||||
created, err := initializeCupsManagerLocked()
|
||||
mgr := cupsManager
|
||||
cupsMu.Unlock()
|
||||
cupsSubscribers.Store(clientID+"-cups", true)
|
||||
count := cupsSubscriberCount.Add(1)
|
||||
|
||||
if err != nil {
|
||||
log.Warnf("Failed to initialize CUPS manager for subscription: %v", err)
|
||||
} else if created {
|
||||
notifyCapabilityChange()
|
||||
if count == 1 {
|
||||
if err := InitializeCupsManager(); err != nil {
|
||||
log.Warnf("Failed to initialize CUPS manager for subscription: %v", err)
|
||||
} else {
|
||||
notifyCapabilityChange()
|
||||
}
|
||||
}
|
||||
|
||||
if mgr == nil {
|
||||
releaseCupsSubscriber()
|
||||
} else {
|
||||
if cupsManager != nil {
|
||||
wg.Add(1)
|
||||
cupsChan := mgr.Subscribe(clientID + "-cups")
|
||||
cupsChan := cupsManager.Subscribe(clientID + "-cups")
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
defer func() {
|
||||
mgr.Unsubscribe(clientID + "-cups")
|
||||
releaseCupsSubscriber()
|
||||
cupsManager.Unsubscribe(clientID + "-cups")
|
||||
cupsSubscribers.Delete(clientID + "-cups")
|
||||
count := cupsSubscriberCount.Add(-1)
|
||||
|
||||
if count == 0 {
|
||||
log.Info("Last CUPS subscriber disconnected, shutting down CUPS manager")
|
||||
if cupsManager != nil {
|
||||
cupsManager.Close()
|
||||
cupsManager = nil
|
||||
notifyCapabilityChange()
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
initialState := mgr.GetState()
|
||||
initialState := cupsManager.GetState()
|
||||
select {
|
||||
case eventChan <- ServiceEvent{Service: "cups", Data: initialState}:
|
||||
case <-stopChan:
|
||||
@@ -1284,12 +1254,9 @@ func cleanupManagers() {
|
||||
if appPickerManager != nil {
|
||||
appPickerManager.Close()
|
||||
}
|
||||
cupsMu.Lock()
|
||||
if cupsManager != nil {
|
||||
cupsManager.Close()
|
||||
cupsManager = nil
|
||||
}
|
||||
cupsMu.Unlock()
|
||||
if brightnessManager != nil {
|
||||
brightnessManager.Close()
|
||||
}
|
||||
@@ -1668,21 +1635,10 @@ func (s *Server) Serve(printDocs bool) error {
|
||||
}()
|
||||
|
||||
go func() {
|
||||
for {
|
||||
err := InitializeBluezManager()
|
||||
if err == nil {
|
||||
notifyCapabilityChange()
|
||||
return
|
||||
}
|
||||
if err := InitializeBluezManager(); err != nil {
|
||||
log.Warnf("Bluez manager unavailable: %v", err)
|
||||
if !errors.Is(err, bluez.ErrNoAdapter) {
|
||||
return
|
||||
}
|
||||
if err := bluez.WaitForAdapter(); err != nil {
|
||||
log.Warnf("Bluetooth adapter watch failed: %v", err)
|
||||
return
|
||||
}
|
||||
log.Info("Bluetooth adapter appeared, initializing bluez manager")
|
||||
} else {
|
||||
notifyCapabilityChange()
|
||||
}
|
||||
}()
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ import (
|
||||
"time"
|
||||
|
||||
wlclient "github.com/AvengeMedia/DankMaterialShell/core/pkg/go-wayland/wayland/client"
|
||||
"github.com/AvengeMedia/dankgo/boottimer"
|
||||
"github.com/godbus/dbus/v5"
|
||||
|
||||
"github.com/AvengeMedia/DankMaterialShell/core/internal/errdefs"
|
||||
@@ -24,6 +23,9 @@ import (
|
||||
|
||||
const animKelvinStep = 25
|
||||
|
||||
// Go timers freeze during suspend; cap sleeps so wall-clock deadlines can't be missed.
|
||||
const maxScheduleWait = 5 * time.Minute
|
||||
|
||||
func NewManager(display wlclient.WaylandDisplay, config Config) (*Manager, error) {
|
||||
if err := config.Validate(); err != nil {
|
||||
return nil, err
|
||||
@@ -750,8 +752,7 @@ func (m *Manager) schedulerLoop() {
|
||||
m.post(func() { m.applyCurrentTemp("startup") })
|
||||
}
|
||||
|
||||
timer := boottimer.New(24 * time.Hour)
|
||||
defer timer.Stop()
|
||||
var timer *time.Timer
|
||||
for {
|
||||
m.configMutex.RLock()
|
||||
enabled := m.config.Enabled
|
||||
@@ -760,19 +761,31 @@ func (m *Manager) schedulerLoop() {
|
||||
now := time.Now()
|
||||
m.recalcSchedule(now)
|
||||
|
||||
waitDur := 24 * time.Hour
|
||||
var waitDur time.Duration
|
||||
if enabled {
|
||||
deadline := m.getNextDeadline(now)
|
||||
if waitDur = time.Until(deadline); waitDur < time.Second {
|
||||
waitDur = time.Until(deadline)
|
||||
switch {
|
||||
case waitDur < time.Second:
|
||||
waitDur = time.Second
|
||||
case waitDur > maxScheduleWait:
|
||||
waitDur = maxScheduleWait
|
||||
}
|
||||
} else {
|
||||
waitDur = 24 * time.Hour
|
||||
}
|
||||
timer.Reset(waitDur)
|
||||
|
||||
if timer != nil {
|
||||
timer.Stop()
|
||||
}
|
||||
timer = time.NewTimer(waitDur)
|
||||
|
||||
select {
|
||||
case <-m.stopChan:
|
||||
timer.Stop()
|
||||
return
|
||||
case <-m.updateTrigger:
|
||||
timer.Stop()
|
||||
m.scheduleMutex.Lock()
|
||||
m.schedule.calcDay = time.Time{}
|
||||
m.scheduleMutex.Unlock()
|
||||
@@ -1073,11 +1086,14 @@ func (m *Manager) handleResume() {
|
||||
}
|
||||
|
||||
// Compositor gamma state is unknown after resume; force a resend (#1235)
|
||||
// and re-arm the scheduler timer, which froze during suspend.
|
||||
m.outputs.Range(func(_ uint32, out *outputState) bool {
|
||||
out.lastTemp = 0
|
||||
return true
|
||||
})
|
||||
m.recalcSchedule(time.Now())
|
||||
m.applyCurrentTemp("resume")
|
||||
m.triggerUpdate()
|
||||
}
|
||||
|
||||
func (m *Manager) triggerUpdate() {
|
||||
|
||||
+1
-1
Submodule dank-qml-common updated: a172b39841...1919595f0d
Generated
+3
-3
@@ -3,11 +3,11 @@
|
||||
"dank-qml-common": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1784935106,
|
||||
"narHash": "sha256-aVgOBRynme6XNKYCZlf/oCjPDZFwddyUQPRRkEupC3c=",
|
||||
"lastModified": 1784647395,
|
||||
"narHash": "sha256-kcLSJC8XBzmWoSBc90Zn81qrNsqWMkwQ1m/zZixOw30=",
|
||||
"owner": "AvengeMedia",
|
||||
"repo": "dank-qml-common",
|
||||
"rev": "a172b39841d8f42bac46ac133b76cade1fae91b4",
|
||||
"rev": "1919595f0dde4f5bf5ac0baa1902ff6d070971d5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
inherit version;
|
||||
pname = "dms-shell";
|
||||
src = ./core;
|
||||
vendorHash = "sha256-ZvaOPC92ZFRPqSyLJa2TA9OUKQ3QnWCIMxrnYLGnC58=";
|
||||
vendorHash = "sha256-G0KCUaNwjWfLcSnb68TMXjpB2xxwheXgrBkFEzcSZTc=";
|
||||
|
||||
subPackages = [ "cmd/dms" ];
|
||||
|
||||
|
||||
@@ -224,7 +224,6 @@ Singleton {
|
||||
property string niriOverviewLastMode: "apps"
|
||||
property string settingsSidebarExpandedIds: ","
|
||||
property string settingsSidebarCollapsedIds: ","
|
||||
property bool showConfigReloadToast: true
|
||||
|
||||
Component.onCompleted: {
|
||||
loadSettings();
|
||||
|
||||
@@ -184,24 +184,6 @@ Singleton {
|
||||
property int mangoLayoutRadiusOverride: -1
|
||||
property int mangoLayoutBorderSize: -1
|
||||
property bool mangoTrackpadNaturalScrolling: true
|
||||
property string mouseAccelProfile: "default"
|
||||
property real mouseAccelSpeed: 0.0
|
||||
property bool mouseLeftHanded: false
|
||||
property bool mouseMiddleEmulation: false
|
||||
property bool mouseNaturalScroll: false
|
||||
property real mouseScrollFactor: 1.0
|
||||
property string mouseScrollMethod: "default"
|
||||
property string touchpadAccelProfile: "default"
|
||||
property real touchpadAccelSpeed: 0.0
|
||||
property bool touchpadDisableOnExternalMouse: false
|
||||
property bool touchpadDisableWhileTyping: true
|
||||
property bool touchpadDragLock: false
|
||||
property bool touchpadMiddleEmulation: false
|
||||
property bool touchpadNaturalScroll: true
|
||||
property real touchpadScrollFactor: 1.0
|
||||
property string touchpadScrollMethod: "default"
|
||||
property bool touchpadTapAndDrag: true
|
||||
property bool touchpadTapToClick: true
|
||||
|
||||
property int firstDayOfWeek: -1
|
||||
property bool showWeekNumber: false
|
||||
@@ -934,7 +916,6 @@ Singleton {
|
||||
property int notificationTimeoutLow: 5000
|
||||
property int notificationTimeoutNormal: 5000
|
||||
property int notificationTimeoutCritical: 0
|
||||
property bool notificationIgnoreAppTimeout: false
|
||||
property bool notificationCompactMode: false
|
||||
property bool notificationShowTimeoutBar: false
|
||||
property bool notificationDedupeEnabled: true
|
||||
@@ -1498,13 +1479,6 @@ Singleton {
|
||||
MangoService.generateLayoutConfig();
|
||||
}
|
||||
|
||||
function updateCompositorInput() {
|
||||
if (typeof CompositorService === "undefined")
|
||||
return;
|
||||
if (CompositorService.isNiri && typeof NiriService !== "undefined")
|
||||
NiriService.generateNiriInputConfig();
|
||||
}
|
||||
|
||||
function updateFrameCompositorLayout() {
|
||||
// Generate before begin() so compositor readiness is already pending at transitionRequested
|
||||
if (typeof CompositorService !== "undefined") {
|
||||
@@ -1733,7 +1707,6 @@ Singleton {
|
||||
"applyStoredTheme": applyStoredTheme,
|
||||
"regenSystemThemes": regenSystemThemes,
|
||||
"updateCompositorLayout": updateCompositorLayout,
|
||||
"updateCompositorInput": updateCompositorInput,
|
||||
"applyStoredIconTheme": applyStoredIconTheme,
|
||||
"updateBarConfigs": updateBarConfigs,
|
||||
"updateCompositorCursor": updateCompositorCursor,
|
||||
|
||||
@@ -144,7 +144,7 @@ Singleton {
|
||||
Quickshell.execDetached(["mkdir", "-p", stateDir]);
|
||||
// shellDir may be an embedded-UI extraction, which is read-only and
|
||||
// unexecutable (dankgo shellapp/shellfs makeReadOnly chmods 0444)
|
||||
Quickshell.execDetached(["bash", shellDir + "/scripts/gtk.sh", configDir, "", "", shellDir]);
|
||||
Quickshell.execDetached(["bash", shellDir + "/scripts/gtk.sh", configDir, "", shellDir, "assets-only"]);
|
||||
Proc.runCommand("matugenCheck", ["sh", "-c", "command -v matugen"], (output, code) => {
|
||||
matugenAvailable = (code === 0) && !envDisableMatugen;
|
||||
|
||||
@@ -1926,41 +1926,6 @@ Singleton {
|
||||
return colors;
|
||||
}
|
||||
|
||||
function refreshGtkTheme() {
|
||||
const isLight = (typeof SessionData !== "undefined" && SessionData.isLightMode);
|
||||
const theme = isLight ? "adw-gtk3" : "adw-gtk3-dark";
|
||||
const schema = "org.gnome.desktop.interface";
|
||||
const key = "gtk-theme";
|
||||
|
||||
const makeCmd = (tool, schema, val) => {
|
||||
if (tool === "gsettings") {
|
||||
return `gsettings set ${schema} ${key} '' && gsettings set ${schema} ${key} ${val}`;
|
||||
} else {
|
||||
const dconfPath = `/${schema.replace(/\./g, "/")}`;
|
||||
return `dconf write ${dconfPath}/${key} "''" && dconf write ${dconfPath}/${key} "'${val}'"`;
|
||||
}
|
||||
};
|
||||
|
||||
Proc.runCommand("gtkRefresher", ["sh", "-c", makeCmd("gsettings", schema, theme)], (output, exitCode) => {
|
||||
if (exitCode !== 0) {
|
||||
Proc.runCommand("gtkRefreshFallback", ["sh", "-c", makeCmd("dconf", schema, theme)], (output, exitCode) => {
|
||||
if (exitCode !== 0) {
|
||||
log.warn("Failed to refresh gtk-theme");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function patchGtk3colors() {
|
||||
const isLight = (typeof SessionData !== "undefined" && SessionData.isLightMode);
|
||||
Proc.runCommand("gtk3Patcher", ["bash", shellDir + "/scripts/gtk.sh", configDir, "patch", isLight, shellDir], (output, exitCode) => {
|
||||
if (exitCode !== 0) {
|
||||
log.warn(`Failed to patch GTK3 colors: ${output}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function applyGtkColors() {
|
||||
if (!matugenAvailable) {
|
||||
if (typeof ToastService !== "undefined") {
|
||||
@@ -1970,7 +1935,7 @@ Singleton {
|
||||
}
|
||||
|
||||
const isLight = (typeof SessionData !== "undefined" && SessionData.isLightMode) ? "true" : "false";
|
||||
Proc.runCommand("gtkApplier", ["bash", shellDir + "/scripts/gtk.sh", configDir, "apply", isLight, shellDir], (output, exitCode) => {
|
||||
Proc.runCommand("gtkApplier", ["bash", shellDir + "/scripts/gtk.sh", configDir, isLight, shellDir], (output, exitCode) => {
|
||||
if (exitCode === 0) {
|
||||
if (typeof ToastService !== "undefined" && typeof NiriService !== "undefined" && !NiriService.matugenSuppression) {
|
||||
ToastService.showInfo(I18n.tr("GTK colors applied successfully"));
|
||||
@@ -2166,13 +2131,8 @@ Singleton {
|
||||
root.matugenCompleted(currentMode, "error");
|
||||
}
|
||||
|
||||
if (!pendingThemeRequest) {
|
||||
if (SettingsData.matugenTemplateGtk) {
|
||||
patchGtk3colors();
|
||||
refreshGtkTheme();
|
||||
}
|
||||
if (!pendingThemeRequest)
|
||||
return;
|
||||
}
|
||||
|
||||
const req = pendingThemeRequest;
|
||||
pendingThemeRequest = null;
|
||||
|
||||
@@ -98,8 +98,7 @@ var SPEC = {
|
||||
niriOverviewLastMode: { def: "apps" },
|
||||
|
||||
settingsSidebarExpandedIds: { def: "," },
|
||||
settingsSidebarCollapsedIds: { def: "," },
|
||||
showConfigReloadToast: { def: true }
|
||||
settingsSidebarCollapsedIds: { def: "," }
|
||||
};
|
||||
|
||||
function getValidKeys() {
|
||||
|
||||
@@ -38,24 +38,6 @@ var SPEC = {
|
||||
mangoLayoutRadiusOverride: { def: -1, onChange: "updateCompositorLayout" },
|
||||
mangoLayoutBorderSize: { def: -1, onChange: "updateCompositorLayout" },
|
||||
mangoTrackpadNaturalScrolling: { def: true, onChange: "updateCompositorCursor" },
|
||||
mouseAccelProfile: { def: "default", onChange: "updateCompositorInput" },
|
||||
mouseAccelSpeed: { def: 0.0, onChange: "updateCompositorInput" },
|
||||
mouseLeftHanded: { def: false, onChange: "updateCompositorInput" },
|
||||
mouseMiddleEmulation: { def: false, onChange: "updateCompositorInput" },
|
||||
mouseNaturalScroll: { def: false, onChange: "updateCompositorInput" },
|
||||
mouseScrollFactor: { def: 1.0, onChange: "updateCompositorInput" },
|
||||
mouseScrollMethod: { def: "default", onChange: "updateCompositorInput" },
|
||||
touchpadAccelProfile: { def: "default", onChange: "updateCompositorInput" },
|
||||
touchpadAccelSpeed: { def: 0.0, onChange: "updateCompositorInput" },
|
||||
touchpadDisableOnExternalMouse: { def: false, onChange: "updateCompositorInput" },
|
||||
touchpadDisableWhileTyping: { def: true, onChange: "updateCompositorInput" },
|
||||
touchpadDragLock: { def: false, onChange: "updateCompositorInput" },
|
||||
touchpadMiddleEmulation: { def: false, onChange: "updateCompositorInput" },
|
||||
touchpadNaturalScroll: { def: true, onChange: "updateCompositorInput" },
|
||||
touchpadScrollFactor: { def: 1.0, onChange: "updateCompositorInput" },
|
||||
touchpadScrollMethod: { def: "default", onChange: "updateCompositorInput" },
|
||||
touchpadTapAndDrag: { def: true, onChange: "updateCompositorInput" },
|
||||
touchpadTapToClick: { def: true, onChange: "updateCompositorInput" },
|
||||
|
||||
firstDayOfWeek: { def: -1 },
|
||||
showWeekNumber: { def: false },
|
||||
@@ -495,7 +477,6 @@ var SPEC = {
|
||||
notificationTimeoutLow: { def: 5000 },
|
||||
notificationTimeoutNormal: { def: 5000 },
|
||||
notificationTimeoutCritical: { def: 0 },
|
||||
notificationIgnoreAppTimeout: { def: false },
|
||||
notificationCompactMode: { def: false },
|
||||
notificationShowTimeoutBar: { def: false },
|
||||
notificationDedupeEnabled: { def: true },
|
||||
|
||||
@@ -718,20 +718,5 @@ FocusScope {
|
||||
Qt.callLater(() => item.forceActiveFocus());
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: mouseTouchpadLoader
|
||||
anchors.fill: parent
|
||||
active: root.currentIndex === 44
|
||||
visible: active
|
||||
focus: active
|
||||
|
||||
sourceComponent: MouseTouchpadTab {}
|
||||
|
||||
onActiveChanged: {
|
||||
if (active && item)
|
||||
Qt.callLater(() => item.forceActiveFocus());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,9 +41,6 @@ FloatingWindow {
|
||||
signal closingModal
|
||||
|
||||
function show() {
|
||||
if (visible && !backingWindowVisible) {
|
||||
visible = false;
|
||||
}
|
||||
visible = true;
|
||||
}
|
||||
|
||||
@@ -52,11 +49,7 @@ FloatingWindow {
|
||||
}
|
||||
|
||||
function toggle() {
|
||||
if (visible && backingWindowVisible) {
|
||||
hide();
|
||||
return;
|
||||
}
|
||||
show();
|
||||
visible = !visible;
|
||||
}
|
||||
|
||||
function setTabIndex(tabIndex: int) {
|
||||
@@ -68,12 +61,13 @@ FloatingWindow {
|
||||
|
||||
function showWithTab(tabIndex: int) {
|
||||
setTabIndex(tabIndex);
|
||||
show();
|
||||
visible = true;
|
||||
}
|
||||
|
||||
function showWithTabName(tabName: string) {
|
||||
setTabIndex(sidebar.resolveTabIndex(tabName));
|
||||
show();
|
||||
var idx = sidebar.resolveTabIndex(tabName);
|
||||
setTabIndex(idx);
|
||||
visible = true;
|
||||
}
|
||||
|
||||
function resolveTabIndex(tabName: string): int {
|
||||
|
||||
@@ -319,13 +319,6 @@ Rectangle {
|
||||
"icon": "headphones",
|
||||
"tabIndex": 29
|
||||
},
|
||||
{
|
||||
"id": "mouse_touchpad",
|
||||
"text": I18n.tr("Mouse & Touchpad"),
|
||||
"icon": "mouse",
|
||||
"tabIndex": 44,
|
||||
"niriOnly": true
|
||||
},
|
||||
{
|
||||
"id": "locale",
|
||||
"text": I18n.tr("Locale"),
|
||||
|
||||
@@ -479,8 +479,6 @@ Item {
|
||||
|
||||
delegate: Item {
|
||||
id: delegateItem
|
||||
required property var modelData
|
||||
required property int index
|
||||
|
||||
property var dockButton: {
|
||||
switch (itemData.type) {
|
||||
@@ -601,7 +599,7 @@ Item {
|
||||
height: delegateItem.height
|
||||
actualIconSize: root.iconSize
|
||||
dockApps: root
|
||||
index: delegateItem.index
|
||||
index: model.index
|
||||
}
|
||||
|
||||
DockTrashButton {
|
||||
@@ -626,7 +624,7 @@ Item {
|
||||
appData: itemData
|
||||
contextMenu: root.contextMenu
|
||||
dockApps: root
|
||||
index: delegateItem.index
|
||||
index: model.index
|
||||
parentDockScreen: root.dockScreen
|
||||
showWindowTitle: itemData?.type === "window" || itemData?.type === "grouped"
|
||||
windowTitle: {
|
||||
|
||||
@@ -410,55 +410,20 @@ Item {
|
||||
id: maskItem
|
||||
visible: false
|
||||
readonly property bool expanded: dock.reveal
|
||||
readonly property bool chrome: dock.usesConnectedFrameChrome
|
||||
readonly property bool atEndEdge: SettingsData.dockPosition === SettingsData.Position.Bottom || SettingsData.dockPosition === SettingsData.Position.Right
|
||||
readonly property real innerReach: borderThickness + (SettingsData.appsDockEnlargeOnHover ? animationHeadroom : 0)
|
||||
readonly property real bodyX: dockBackground.x + dockContainer.x + dockMouseArea.x + dockCore.x + dockSlide.x
|
||||
readonly property real bodyY: dockBackground.y + dockContainer.y + dockMouseArea.y + dockCore.y + dockSlide.y
|
||||
x: {
|
||||
if (chrome) {
|
||||
const baseX = dockCore.x + dockMouseArea.x;
|
||||
if (isVertical && atEndEdge)
|
||||
return baseX - (expanded ? animationHeadroom + borderThickness + dock.horizontalConnectorExtent : 0);
|
||||
return baseX - (expanded ? borderThickness + dock.horizontalConnectorExtent : 0);
|
||||
}
|
||||
if (!isVertical)
|
||||
return dockCore.x + dockMouseArea.x - (expanded ? borderThickness : 0);
|
||||
if (!atEndEdge)
|
||||
return 0;
|
||||
return expanded ? Math.min(bodyX - innerReach, dock.width - 1) : dock.width - 1;
|
||||
const baseX = dockCore.x + dockMouseArea.x;
|
||||
if (isVertical && SettingsData.dockPosition === SettingsData.Position.Right)
|
||||
return baseX - (expanded ? animationHeadroom + borderThickness + dock.horizontalConnectorExtent : 0);
|
||||
return baseX - (expanded ? borderThickness + dock.horizontalConnectorExtent : 0);
|
||||
}
|
||||
y: {
|
||||
if (chrome) {
|
||||
const baseY = dockCore.y + dockMouseArea.y;
|
||||
if (!isVertical && atEndEdge)
|
||||
return baseY - (expanded ? animationHeadroom + borderThickness + dock.verticalConnectorExtent : 0);
|
||||
return baseY - (expanded ? borderThickness + dock.verticalConnectorExtent : 0);
|
||||
}
|
||||
if (isVertical)
|
||||
return dockCore.y + dockMouseArea.y - (expanded ? borderThickness : 0);
|
||||
if (!atEndEdge)
|
||||
return 0;
|
||||
return expanded ? Math.min(bodyY - innerReach, dock.height - 1) : dock.height - 1;
|
||||
}
|
||||
width: {
|
||||
if (chrome)
|
||||
return dockMouseArea.width + (isVertical && expanded ? animationHeadroom : 0) + (expanded ? borderThickness * 2 + dock.horizontalConnectorExtent * 2 : 0);
|
||||
if (!isVertical)
|
||||
return dockMouseArea.width + (expanded ? borderThickness * 2 : 0);
|
||||
if (!expanded)
|
||||
return 1;
|
||||
return atEndEdge ? dock.width - x : Math.max(bodyX + dockBackground.width + innerReach, 1);
|
||||
}
|
||||
height: {
|
||||
if (chrome)
|
||||
return dockMouseArea.height + (!isVertical && expanded ? animationHeadroom : 0) + (expanded ? borderThickness * 2 + dock.verticalConnectorExtent * 2 : 0);
|
||||
if (isVertical)
|
||||
return dockMouseArea.height + (expanded ? borderThickness * 2 : 0);
|
||||
if (!expanded)
|
||||
return 1;
|
||||
return atEndEdge ? dock.height - y : Math.max(bodyY + dockBackground.height + innerReach, 1);
|
||||
const baseY = dockCore.y + dockMouseArea.y;
|
||||
if (!isVertical && SettingsData.dockPosition === SettingsData.Position.Bottom)
|
||||
return baseY - (expanded ? animationHeadroom + borderThickness + dock.verticalConnectorExtent : 0);
|
||||
return baseY - (expanded ? borderThickness + dock.verticalConnectorExtent : 0);
|
||||
}
|
||||
width: dockMouseArea.width + (isVertical && expanded ? animationHeadroom : 0) + (expanded ? borderThickness * 2 + dock.horizontalConnectorExtent * 2 : 0)
|
||||
height: dockMouseArea.height + (!isVertical && expanded ? animationHeadroom : 0) + (expanded ? borderThickness * 2 + dock.verticalConnectorExtent * 2 : 0)
|
||||
}
|
||||
|
||||
readonly property alias inputMaskItem: maskItem
|
||||
|
||||
@@ -10,7 +10,6 @@ PanelWindow {
|
||||
id: root
|
||||
|
||||
property bool active: false
|
||||
property bool _completed: false
|
||||
|
||||
signal fadeCompleted
|
||||
signal fadeCancelled
|
||||
@@ -37,8 +36,7 @@ PanelWindow {
|
||||
opacity: 0
|
||||
|
||||
onOpacityChanged: {
|
||||
if (opacity >= 0.99 && root.active && !root._completed) {
|
||||
root._completed = true;
|
||||
if (opacity >= 0.99 && root.active) {
|
||||
root.fadeCompleted();
|
||||
}
|
||||
}
|
||||
@@ -61,7 +59,6 @@ PanelWindow {
|
||||
function startFade() {
|
||||
if (!SettingsData.fadeToDpmsEnabled)
|
||||
return;
|
||||
_completed = false;
|
||||
active = true;
|
||||
fadeOverlay.opacity = 0.0;
|
||||
fadeSeq.stop();
|
||||
@@ -77,7 +74,6 @@ PanelWindow {
|
||||
fadeSeq.stop();
|
||||
fadeOverlay.opacity = 0.0;
|
||||
active = false;
|
||||
_completed = false;
|
||||
}
|
||||
|
||||
Connections {
|
||||
|
||||
@@ -113,8 +113,6 @@ Item {
|
||||
}
|
||||
|
||||
function sendLockerReadyOnce() {
|
||||
if (root.demoMode)
|
||||
return;
|
||||
if (lockerReadySent)
|
||||
return;
|
||||
if (root.unlocking)
|
||||
|
||||
@@ -45,14 +45,6 @@ PanelWindow {
|
||||
blurWidth: !win._finalized && !win.connectedFrameMode ? innerW * s : 0
|
||||
blurHeight: !win._finalized && !win.connectedFrameMode ? innerH * s : 0
|
||||
blurRadius: win.connectedFrameMode ? Theme.connectedSurfaceRadius : Theme.cornerRadius
|
||||
// Slide-out translates the card past the surface edge; intersecting with the
|
||||
// resting bounds keeps the committed region on the visible content instead of
|
||||
// leaving a stray blur sliver at the edge (#2917).
|
||||
clipEnabled: true
|
||||
clipX: content.x + content.cardInset
|
||||
clipY: content.y + content.cardInset
|
||||
clipWidth: innerW
|
||||
clipHeight: innerH
|
||||
}
|
||||
|
||||
WlrLayershell.namespace: "dms:notification-popup"
|
||||
|
||||
@@ -42,11 +42,6 @@ DankOSD {
|
||||
width: parent.width - Theme.spacingS * 2
|
||||
height: 40
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: root.hide()
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: Theme.iconSize
|
||||
height: Theme.iconSize
|
||||
@@ -130,11 +125,6 @@ DankOSD {
|
||||
anchors.fill: parent
|
||||
property int gap: Theme.spacingS
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: root.hide()
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: Theme.iconSize
|
||||
height: Theme.iconSize
|
||||
|
||||
@@ -81,11 +81,6 @@ DankOSD {
|
||||
width: parent.width - Theme.spacingS * 2
|
||||
height: 40
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: root.hide()
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: Theme.iconSize
|
||||
height: Theme.iconSize
|
||||
@@ -152,11 +147,6 @@ DankOSD {
|
||||
anchors.fill: parent
|
||||
property int gap: Theme.spacingS
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: root.hide()
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: Theme.iconSize
|
||||
height: Theme.iconSize
|
||||
|
||||
@@ -65,11 +65,6 @@ DankOSD {
|
||||
width: parent.width - Theme.spacingS * 2
|
||||
height: 40
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: root.hide()
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: Theme.iconSize
|
||||
height: Theme.iconSize
|
||||
@@ -142,11 +137,6 @@ DankOSD {
|
||||
anchors.fill: parent
|
||||
property int gap: Theme.spacingS
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: root.hide()
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: Theme.iconSize
|
||||
height: Theme.iconSize
|
||||
|
||||
@@ -60,11 +60,6 @@ DankOSD {
|
||||
width: parent.width - Theme.spacingS * 2
|
||||
height: 40
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: root.hide()
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: Theme.iconSize
|
||||
height: Theme.iconSize
|
||||
@@ -137,11 +132,6 @@ DankOSD {
|
||||
anchors.fill: parent
|
||||
property int gap: Theme.spacingS
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: root.hide()
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: Theme.iconSize
|
||||
height: Theme.iconSize
|
||||
|
||||
@@ -267,24 +267,6 @@ awk '$1 == "xray" { print FILENAME ":" FNR; exit }' $files 2>/dev/null`;
|
||||
}
|
||||
}
|
||||
|
||||
SettingsCard {
|
||||
width: parent.width
|
||||
tags: ["compositor", "toast"]
|
||||
title: I18n.tr("Notifications")
|
||||
settingKey: "compositorNotifications"
|
||||
iconName: "notifications"
|
||||
visible: CompositorService.isNiri || CompositorService.isMango
|
||||
|
||||
SettingsToggleRow {
|
||||
tags: ["compositor", "toast", "reload"]
|
||||
settingKey: "showConfigReloadToast"
|
||||
text: I18n.tr("Show \"config reloaded\" Toast")
|
||||
description: I18n.tr("Show a toast when the compositor config is reloaded")
|
||||
checked: SessionData.showConfigReloadToast
|
||||
onToggled: checked => SessionData.showConfigReloadToast = checked
|
||||
}
|
||||
}
|
||||
|
||||
SettingsCard {
|
||||
width: parent.width
|
||||
tags: ["niri", "layout", "gaps", "radius", "window", "border"]
|
||||
|
||||
@@ -1,412 +0,0 @@
|
||||
import QtCore
|
||||
import QtQuick
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
import qs.Modules.Settings.Widgets
|
||||
import "../../Common/ConfigIncludeResolve.js" as ConfigIncludeResolve
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
LayoutMirroring.enabled: I18n.isRtl
|
||||
LayoutMirroring.childrenInherit: true
|
||||
|
||||
property var inputIncludeStatus: ({
|
||||
"exists": false,
|
||||
"included": false,
|
||||
"configFormat": "",
|
||||
"readOnly": false
|
||||
})
|
||||
property bool checkingInclude: false
|
||||
property bool fixingInclude: false
|
||||
|
||||
function getInputConfigPaths() {
|
||||
const configDir = Paths.strip(StandardPaths.writableLocation(StandardPaths.ConfigLocation));
|
||||
if (CompositorService.compositor !== "niri")
|
||||
return null;
|
||||
return {
|
||||
"configFile": configDir + "/niri/config.kdl",
|
||||
"layoutFile": configDir + "/niri/dms/input.kdl",
|
||||
"grepPattern": 'include.*"dms/input.kdl"',
|
||||
"includeLine": 'include "dms/input.kdl"'
|
||||
};
|
||||
}
|
||||
|
||||
function checkInputIncludeStatus() {
|
||||
if (CompositorService.compositor !== "niri") {
|
||||
inputIncludeStatus = {
|
||||
"exists": false,
|
||||
"included": false,
|
||||
"configFormat": "",
|
||||
"readOnly": false
|
||||
};
|
||||
return;
|
||||
}
|
||||
|
||||
checkingInclude = true;
|
||||
Proc.runCommand("check-input-include", [Proc.dmsBin, "config", "resolve-include", "niri", "input.kdl"], (output, exitCode) => {
|
||||
checkingInclude = false;
|
||||
if (exitCode !== 0) {
|
||||
inputIncludeStatus = {
|
||||
"exists": false,
|
||||
"included": false,
|
||||
"configFormat": "",
|
||||
"readOnly": false
|
||||
};
|
||||
return;
|
||||
}
|
||||
try {
|
||||
inputIncludeStatus = JSON.parse(output.trim());
|
||||
} catch (e) {
|
||||
inputIncludeStatus = {
|
||||
"exists": false,
|
||||
"included": false,
|
||||
"configFormat": "",
|
||||
"readOnly": false
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function fixInputInclude() {
|
||||
const paths = getInputConfigPaths();
|
||||
if (!paths)
|
||||
return;
|
||||
|
||||
fixingInclude = true;
|
||||
const unixTime = Math.floor(Date.now() / 1000);
|
||||
const backupFile = paths.configFile + ".backup" + unixTime;
|
||||
const script = ConfigIncludeResolve.buildRepairScript({
|
||||
configFile: paths.configFile,
|
||||
backupFile: backupFile,
|
||||
fragmentFile: paths.layoutFile,
|
||||
grepPattern: paths.grepPattern,
|
||||
includeLine: paths.includeLine
|
||||
});
|
||||
Proc.runCommand("fix-input-include", ["sh", "-c", script], (output, exitCode) => {
|
||||
fixingInclude = false;
|
||||
if (exitCode !== 0)
|
||||
return;
|
||||
checkInputIncludeStatus();
|
||||
SettingsData.updateCompositorInput();
|
||||
});
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (CompositorService.isNiri) {
|
||||
checkInputIncludeStatus();
|
||||
}
|
||||
}
|
||||
|
||||
DankFlickable {
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
contentHeight: settingsColumn.height + Theme.spacingXL
|
||||
contentWidth: width
|
||||
|
||||
Column {
|
||||
id: settingsColumn
|
||||
|
||||
topPadding: 4
|
||||
width: Math.min(550, parent.width - Theme.spacingL * 2)
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
spacing: Theme.spacingXL
|
||||
|
||||
StyledRect {
|
||||
id: warningBox
|
||||
width: parent.width
|
||||
height: warningContent.implicitHeight + Theme.spacingL * 2
|
||||
radius: Theme.cornerRadius
|
||||
|
||||
readonly property bool showSetup: !root.inputIncludeStatus.included
|
||||
|
||||
color: showSetup ? Theme.withAlpha(Theme.primary, 0.15) : Theme.withAlpha(Theme.primary, 0)
|
||||
border.color: showSetup ? Theme.withAlpha(Theme.primary, 0.3) : Theme.withAlpha(Theme.primary, 0)
|
||||
border.width: 1
|
||||
visible: showSetup && !root.checkingInclude && CompositorService.isNiri
|
||||
|
||||
Row {
|
||||
id: warningContent
|
||||
anchors.fill: parent
|
||||
anchors.margins: Theme.spacingL
|
||||
spacing: Theme.spacingM
|
||||
|
||||
DankIcon {
|
||||
name: "warning"
|
||||
size: Theme.iconSize
|
||||
color: Theme.primary
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
Column {
|
||||
width: parent.width - Theme.iconSize - (fixButton.visible ? fixButton.width + Theme.spacingM : 0) - Theme.spacingM
|
||||
spacing: Theme.spacingXS
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
StyledText {
|
||||
text: I18n.tr("First Time Setup")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
font.weight: Font.Medium
|
||||
color: Theme.primary
|
||||
width: parent.width
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: I18n.tr("Click 'Setup' to create %1 and add include to your compositor config.").arg("dms/input")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
wrapMode: Text.WordWrap
|
||||
width: parent.width
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
}
|
||||
}
|
||||
|
||||
DankButton {
|
||||
id: fixButton
|
||||
visible: warningBox.showSetup
|
||||
text: root.fixingInclude ? I18n.tr("Setting up...") : I18n.tr("Setup")
|
||||
backgroundColor: Theme.primary
|
||||
textColor: Theme.primaryText
|
||||
enabled: !root.fixingInclude
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onClicked: root.fixInputInclude()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SettingsCard {
|
||||
width: parent.width
|
||||
tags: ["mouse", "input", "sensitivity", "acceleration", "pointer"]
|
||||
title: I18n.tr("Mouse Settings")
|
||||
settingKey: "mouseSettings"
|
||||
iconName: "mouse"
|
||||
|
||||
SettingsToggleRow {
|
||||
tags: ["mouse", "left", "handed", "button", "swap"]
|
||||
settingKey: "mouseLeftHanded"
|
||||
text: I18n.tr("Left-Handed Mode")
|
||||
description: I18n.tr("Swap primary and secondary mouse buttons")
|
||||
checked: SettingsData.mouseLeftHanded
|
||||
onToggled: checked => SettingsData.set("mouseLeftHanded", checked)
|
||||
}
|
||||
|
||||
SettingsSliderRow {
|
||||
tags: ["mouse", "sensitivity", "speed", "accel"]
|
||||
settingKey: "mouseAccelSpeed"
|
||||
text: I18n.tr("Pointer Speed")
|
||||
description: I18n.tr("Adjust pointer sensitivity speed")
|
||||
value: Math.round(SettingsData.mouseAccelSpeed * 10)
|
||||
minimum: -10
|
||||
maximum: 10
|
||||
step: 1
|
||||
defaultValue: 0
|
||||
onSliderValueChanged: newValue => SettingsData.set("mouseAccelSpeed", newValue / 10.0)
|
||||
}
|
||||
|
||||
SettingsButtonGroupRow {
|
||||
tags: ["mouse", "acceleration", "profile"]
|
||||
settingKey: "mouseAccelProfile"
|
||||
text: I18n.tr("Acceleration Profile")
|
||||
description: I18n.tr("Flat uses constant speed; Adaptive scales with movement speed")
|
||||
model: [I18n.tr("Default"), I18n.tr("Flat"), I18n.tr("Adaptive")]
|
||||
currentIndex: {
|
||||
if (SettingsData.mouseAccelProfile === "flat") return 1;
|
||||
if (SettingsData.mouseAccelProfile === "adaptive") return 2;
|
||||
return 0;
|
||||
}
|
||||
onSelectionChanged: (index, selected) => {
|
||||
if (!selected) return;
|
||||
const profiles = ["default", "flat", "adaptive"];
|
||||
SettingsData.set("mouseAccelProfile", profiles[index]);
|
||||
}
|
||||
}
|
||||
|
||||
SettingsToggleRow {
|
||||
tags: ["mouse", "natural", "scroll", "direction"]
|
||||
settingKey: "mouseNaturalScroll"
|
||||
text: I18n.tr("Natural Scrolling")
|
||||
description: I18n.tr("Reverse mouse wheel scrolling direction")
|
||||
checked: SettingsData.mouseNaturalScroll
|
||||
onToggled: checked => SettingsData.set("mouseNaturalScroll", checked)
|
||||
}
|
||||
|
||||
SettingsSliderRow {
|
||||
tags: ["mouse", "scroll", "speed", "factor"]
|
||||
settingKey: "mouseScrollFactor"
|
||||
text: I18n.tr("Scrolling Speed")
|
||||
description: I18n.tr("Adjust scrolling sensitivity multiplier")
|
||||
value: Math.round(SettingsData.mouseScrollFactor * 10)
|
||||
minimum: 1
|
||||
maximum: 30
|
||||
step: 1
|
||||
defaultValue: 10
|
||||
onSliderValueChanged: newValue => SettingsData.set("mouseScrollFactor", newValue / 10.0)
|
||||
}
|
||||
|
||||
SettingsButtonGroupRow {
|
||||
tags: ["mouse", "scroll", "method"]
|
||||
settingKey: "mouseScrollMethod"
|
||||
text: I18n.tr("Scroll Method")
|
||||
description: I18n.tr("Choose when to generate scrolling events")
|
||||
model: [I18n.tr("Default"), I18n.tr("No Scroll"), I18n.tr("On Button Down")]
|
||||
currentIndex: {
|
||||
if (SettingsData.mouseScrollMethod === "no-scroll") return 1;
|
||||
if (SettingsData.mouseScrollMethod === "on-button-down") return 2;
|
||||
return 0;
|
||||
}
|
||||
onSelectionChanged: (index, selected) => {
|
||||
if (!selected) return;
|
||||
const methods = ["default", "no-scroll", "on-button-down"];
|
||||
SettingsData.set("mouseScrollMethod", methods[index]);
|
||||
}
|
||||
}
|
||||
|
||||
SettingsToggleRow {
|
||||
tags: ["mouse", "middle", "click", "emulation"]
|
||||
settingKey: "mouseMiddleEmulation"
|
||||
text: I18n.tr("Middle Click Emulation")
|
||||
description: I18n.tr("Emulate middle click by pressing left and right buttons")
|
||||
checked: SettingsData.mouseMiddleEmulation
|
||||
onToggled: checked => SettingsData.set("mouseMiddleEmulation", checked)
|
||||
}
|
||||
}
|
||||
|
||||
SettingsCard {
|
||||
width: parent.width
|
||||
tags: ["touchpad", "input", "sensitivity", "tap", "click", "natural"]
|
||||
title: I18n.tr("Touchpad Settings")
|
||||
settingKey: "touchpadSettings"
|
||||
iconName: "trackpad_input_2"
|
||||
|
||||
SettingsToggleRow {
|
||||
tags: ["touchpad", "tap", "click"]
|
||||
settingKey: "touchpadTapToClick"
|
||||
text: I18n.tr("Tap to Click")
|
||||
description: I18n.tr("Tap the touchpad surface to trigger left click clicks")
|
||||
checked: SettingsData.touchpadTapToClick
|
||||
onToggled: checked => SettingsData.set("touchpadTapToClick", checked)
|
||||
}
|
||||
|
||||
SettingsToggleRow {
|
||||
tags: ["touchpad", "tap", "drag"]
|
||||
settingKey: "touchpadTapAndDrag"
|
||||
text: I18n.tr("Tap and Drag")
|
||||
description: I18n.tr("Tap and drag on the touchpad to move items")
|
||||
checked: SettingsData.touchpadTapAndDrag
|
||||
onToggled: checked => SettingsData.set("touchpadTapAndDrag", checked)
|
||||
}
|
||||
|
||||
SettingsToggleRow {
|
||||
tags: ["touchpad", "drag", "lock"]
|
||||
settingKey: "touchpadDragLock"
|
||||
text: I18n.tr("Drag Lock")
|
||||
description: I18n.tr("Keep dragging when finger is briefly lifted")
|
||||
checked: SettingsData.touchpadDragLock
|
||||
onToggled: checked => SettingsData.set("touchpadDragLock", checked)
|
||||
}
|
||||
|
||||
SettingsSliderRow {
|
||||
tags: ["touchpad", "sensitivity", "speed", "accel"]
|
||||
settingKey: "touchpadAccelSpeed"
|
||||
text: I18n.tr("Touchpad Speed")
|
||||
description: I18n.tr("Adjust touchpad pointer speed")
|
||||
value: Math.round(SettingsData.touchpadAccelSpeed * 10)
|
||||
minimum: -10
|
||||
maximum: 10
|
||||
step: 1
|
||||
defaultValue: 0
|
||||
onSliderValueChanged: newValue => SettingsData.set("touchpadAccelSpeed", newValue / 10.0)
|
||||
}
|
||||
|
||||
SettingsButtonGroupRow {
|
||||
tags: ["touchpad", "acceleration", "profile"]
|
||||
settingKey: "touchpadAccelProfile"
|
||||
text: I18n.tr("Acceleration Profile")
|
||||
description: I18n.tr("Flat uses constant speed; Adaptive scales with movement speed")
|
||||
model: [I18n.tr("Default"), I18n.tr("Flat"), I18n.tr("Adaptive")]
|
||||
currentIndex: {
|
||||
if (SettingsData.touchpadAccelProfile === "flat") return 1;
|
||||
if (SettingsData.touchpadAccelProfile === "adaptive") return 2;
|
||||
return 0;
|
||||
}
|
||||
onSelectionChanged: (index, selected) => {
|
||||
if (!selected) return;
|
||||
const profiles = ["default", "flat", "adaptive"];
|
||||
SettingsData.set("touchpadAccelProfile", profiles[index]);
|
||||
}
|
||||
}
|
||||
|
||||
SettingsToggleRow {
|
||||
tags: ["touchpad", "natural", "scroll", "direction"]
|
||||
settingKey: "touchpadNaturalScroll"
|
||||
text: I18n.tr("Natural Scrolling")
|
||||
description: I18n.tr("Reverse two-finger scrolling direction")
|
||||
checked: SettingsData.touchpadNaturalScroll
|
||||
onToggled: checked => SettingsData.set("touchpadNaturalScroll", checked)
|
||||
}
|
||||
|
||||
SettingsSliderRow {
|
||||
tags: ["touchpad", "scroll", "speed", "factor"]
|
||||
settingKey: "touchpadScrollFactor"
|
||||
text: I18n.tr("Scrolling Speed")
|
||||
description: I18n.tr("Adjust scrolling sensitivity multiplier")
|
||||
value: Math.round(SettingsData.touchpadScrollFactor * 10)
|
||||
minimum: 1
|
||||
maximum: 30
|
||||
step: 1
|
||||
defaultValue: 10
|
||||
onSliderValueChanged: newValue => SettingsData.set("touchpadScrollFactor", newValue / 10.0)
|
||||
}
|
||||
|
||||
SettingsButtonGroupRow {
|
||||
tags: ["touchpad", "scroll", "method"]
|
||||
settingKey: "touchpadScrollMethod"
|
||||
text: I18n.tr("Scroll Method")
|
||||
description: I18n.tr("Choose when to generate scrolling events")
|
||||
model: [I18n.tr("Default"), I18n.tr("Two Finger"), I18n.tr("Edge"), I18n.tr("No Scroll"), I18n.tr("On Button Down")]
|
||||
currentIndex: {
|
||||
if (SettingsData.touchpadScrollMethod === "two-finger") return 1;
|
||||
if (SettingsData.touchpadScrollMethod === "edge") return 2;
|
||||
if (SettingsData.touchpadScrollMethod === "no-scroll") return 3;
|
||||
if (SettingsData.touchpadScrollMethod === "on-button-down") return 4;
|
||||
return 0;
|
||||
}
|
||||
onSelectionChanged: (index, selected) => {
|
||||
if (!selected) return;
|
||||
const methods = ["default", "two-finger", "edge", "no-scroll", "on-button-down"];
|
||||
SettingsData.set("touchpadScrollMethod", methods[index]);
|
||||
}
|
||||
}
|
||||
|
||||
SettingsToggleRow {
|
||||
tags: ["touchpad", "disable", "typing", "dwt"]
|
||||
settingKey: "touchpadDisableWhileTyping"
|
||||
text: I18n.tr("Disable While Typing")
|
||||
description: I18n.tr("Prevent accidental cursor jumps while typing")
|
||||
checked: SettingsData.touchpadDisableWhileTyping
|
||||
onToggled: checked => SettingsData.set("touchpadDisableWhileTyping", checked)
|
||||
}
|
||||
|
||||
SettingsToggleRow {
|
||||
tags: ["touchpad", "disable", "external", "mouse"]
|
||||
settingKey: "touchpadDisableOnExternalMouse"
|
||||
text: I18n.tr("Disable on External Mouse")
|
||||
description: I18n.tr("Disable touchpad when an external mouse is connected")
|
||||
checked: SettingsData.touchpadDisableOnExternalMouse
|
||||
onToggled: checked => SettingsData.set("touchpadDisableOnExternalMouse", checked)
|
||||
}
|
||||
|
||||
SettingsToggleRow {
|
||||
tags: ["touchpad", "middle", "click", "emulation"]
|
||||
settingKey: "touchpadMiddleEmulation"
|
||||
text: I18n.tr("Middle Click Emulation")
|
||||
description: I18n.tr("Emulate middle click by pressing left and right buttons")
|
||||
checked: SettingsData.touchpadMiddleEmulation
|
||||
onToggled: checked => SettingsData.set("touchpadMiddleEmulation", checked)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -844,15 +844,6 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SettingsToggleRow {
|
||||
settingKey: "notificationIgnoreAppTimeout"
|
||||
tags: ["notification", "timeout", "expire", "app", "override", "duration"]
|
||||
text: I18n.tr("Ignore App-Requested Timeout")
|
||||
description: I18n.tr("Always use the durations above, even if an app requests a shorter or longer one")
|
||||
checked: SettingsData.notificationIgnoreAppTimeout
|
||||
onToggled: checked => SettingsData.set("notificationIgnoreAppTimeout", checked)
|
||||
}
|
||||
}
|
||||
|
||||
SettingsCard {
|
||||
|
||||
@@ -15,10 +15,8 @@ Item {
|
||||
property string socketPath: ""
|
||||
readonly property bool socketFound: socketPath.length > 0
|
||||
property bool connected: false
|
||||
readonly property bool binaryExists: launchKind.length > 0
|
||||
property bool binaryExists: false
|
||||
property bool binaryChecked: false
|
||||
// "dcal" for a host install, "flatpak" for a sandboxed one, "" for neither.
|
||||
property string launchKind: ""
|
||||
|
||||
property var calendars: []
|
||||
property var events: []
|
||||
@@ -57,20 +55,18 @@ Item {
|
||||
|
||||
Process {
|
||||
id: binaryCheck
|
||||
command: ["sh", "-c", "if command -v dcal >/dev/null 2>&1; then echo dcal; elif command -v flatpak >/dev/null 2>&1 && flatpak info com.danklinux.dankcalendar >/dev/null 2>&1; then echo flatpak; fi"]
|
||||
command: ["sh", "-c", "command -v dcal"]
|
||||
running: false
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
root.launchKind = text.trim();
|
||||
root.binaryChecked = true;
|
||||
}
|
||||
onExited: code => {
|
||||
root.binaryExists = (code === 0);
|
||||
root.binaryChecked = true;
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: discoverProcess
|
||||
running: false
|
||||
command: ["sh", "-c", "s=\"${DANKCAL_SOCKET:-}\"; if [ -S \"$s\" ]; then echo \"$s\"; exit 0; fi; for f in \"${XDG_RUNTIME_DIR:-/tmp}\"/app/com.danklinux.dankcalendar/dankcal-*.sock; do if [ -S \"$f\" ]; then echo \"$f\"; exit 0; fi; done; for f in \"${XDG_RUNTIME_DIR:-/tmp}\"/dankcal-*.sock /tmp/dankcal-*.sock; do [ -S \"$f\" ] || continue; p=$(basename \"$f\" .sock); p=${p#dankcal-}; if kill -0 \"$p\" 2>/dev/null; then echo \"$f\"; exit 0; fi; done"]
|
||||
command: ["sh", "-c", "s=\"${DANKCAL_SOCKET:-}\"; if [ -S \"$s\" ]; then echo \"$s\"; exit 0; fi; for f in \"${XDG_RUNTIME_DIR:-/tmp}\"/dankcal-*.sock /tmp/dankcal-*.sock; do [ -S \"$f\" ] || continue; p=$(basename \"$f\" .sock); p=${p#dankcal-}; if kill -0 \"$p\" 2>/dev/null; then echo \"$f\"; exit 0; fi; done"]
|
||||
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
@@ -102,16 +98,9 @@ Item {
|
||||
}
|
||||
|
||||
function launch() {
|
||||
switch (launchKind) {
|
||||
case "dcal":
|
||||
Quickshell.execDetached(["dcal", "run", "-d", "--hidden"]);
|
||||
break;
|
||||
case "flatpak":
|
||||
Quickshell.execDetached(["flatpak", "run", "com.danklinux.dankcalendar", "run", "-d", "--hidden"]);
|
||||
break;
|
||||
default:
|
||||
if (!binaryExists)
|
||||
return;
|
||||
}
|
||||
Quickshell.execDetached(["dcal", "run", "-d", "--hidden"]);
|
||||
if (enabled && !connected)
|
||||
discoverProcess.running = true;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ Singleton {
|
||||
return "wifi_1_bar";
|
||||
}
|
||||
|
||||
readonly property string userPreference: SettingsData.networkPreference
|
||||
property string userPreference: "auto"
|
||||
property bool isConnecting: false
|
||||
property string connectingSSID: ""
|
||||
property string connectionError: ""
|
||||
@@ -210,6 +210,7 @@ Singleton {
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
root.userPreference = SettingsData.networkPreference;
|
||||
lastConnectedVpnUuid = SessionData.vpnLastConnected || "";
|
||||
if (socketPath && socketPath.length > 0) {
|
||||
checkDMSCapabilities();
|
||||
@@ -731,6 +732,7 @@ Singleton {
|
||||
function setNetworkPreference(preference) {
|
||||
if (!networkAvailable)
|
||||
return;
|
||||
userPreference = preference;
|
||||
changingPreference = true;
|
||||
targetPreference = preference;
|
||||
SettingsData.set("networkPreference", preference);
|
||||
|
||||
@@ -335,7 +335,6 @@ Singleton {
|
||||
const data = response.result.data;
|
||||
|
||||
if (service === "server") {
|
||||
const prevCapabilities = capabilities;
|
||||
apiVersion = data.apiVersion || 0;
|
||||
cliVersion = data.cliVersion || "";
|
||||
capabilities = data.capabilities || [];
|
||||
@@ -347,12 +346,6 @@ Singleton {
|
||||
}
|
||||
|
||||
capabilitiesReceived();
|
||||
|
||||
const capabilitiesChanged = prevCapabilities.length !== capabilities.length || capabilities.some(c => !prevCapabilities.includes(c));
|
||||
if (prevCapabilities.length > 0 && capabilitiesChanged) {
|
||||
log.info("Capabilities changed, resubscribing");
|
||||
subscribe(activeSubscriptions);
|
||||
}
|
||||
} else if (service === "network") {
|
||||
networkStateUpdate(data);
|
||||
} else if (service === "network.credentials") {
|
||||
|
||||
@@ -473,7 +473,7 @@ Singleton {
|
||||
function reloadConfig(showToast, suppressWatch) {
|
||||
if (!CompositorService.isMango || !root.available)
|
||||
return;
|
||||
const shouldShowToast = showToast !== false && SessionData.showConfigReloadToast;
|
||||
const shouldShowToast = showToast !== false;
|
||||
const shouldSuppressWatch = suppressWatch !== false;
|
||||
if (shouldSuppressWatch)
|
||||
suppressWatchedConfigReloads(1500);
|
||||
|
||||
@@ -73,7 +73,6 @@ Singleton {
|
||||
Component.onCompleted: {
|
||||
fetchOutputs();
|
||||
Paths.mkdir(screenshotsDir);
|
||||
generateNiriInputConfig();
|
||||
}
|
||||
|
||||
Timer {
|
||||
@@ -106,15 +105,6 @@ Singleton {
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: CompositorService
|
||||
function onIsNiriChanged() {
|
||||
if (CompositorService.isNiri) {
|
||||
generateNiriInputConfig();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: validateProcess
|
||||
command: ["niri", "validate"]
|
||||
@@ -185,20 +175,6 @@ Singleton {
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: writeInputProcess
|
||||
property string inputContent: ""
|
||||
property string inputPath: ""
|
||||
|
||||
onExited: exitCode => {
|
||||
if (exitCode === 0) {
|
||||
log.info("Generated input config at", inputPath);
|
||||
return;
|
||||
}
|
||||
log.warn("Failed to write input config, exit code:", exitCode);
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: writeCursorProcess
|
||||
property string cursorContent: ""
|
||||
@@ -633,7 +609,7 @@ Singleton {
|
||||
configGenerationAction.schedule();
|
||||
configReloaded();
|
||||
|
||||
if (hasInitialConnection && !suppressConfigToast && !suppressNextConfigToast && !matugenSuppression && SessionData.showConfigReloadToast) {
|
||||
if (hasInitialConnection && !suppressConfigToast && !suppressNextConfigToast && !matugenSuppression) {
|
||||
ToastService.showInfo(I18n.tr("niri: config reloaded"), "", "", "niri-config");
|
||||
} else if (suppressNextConfigToast) {
|
||||
suppressNextConfigToast = false;
|
||||
@@ -1285,7 +1261,7 @@ window-rule {
|
||||
writeAlttabProcess.running = true;
|
||||
}
|
||||
|
||||
for (const name of ["outputs", "binds", "cursor", "windowrules", "colors", "alttab", "layout", "input"]) {
|
||||
for (const name of ["outputs", "binds", "cursor", "windowrules", "colors", "alttab", "layout"]) {
|
||||
const path = niriDmsDir + "/" + name + ".kdl";
|
||||
Proc.runCommand("niri-ensure-" + name, ["sh", "-c", `mkdir -p "${niriDmsDir}" && [ ! -f "${path}" ] && touch "${path}" || true`], (output, exitCode) => {
|
||||
if (exitCode !== 0)
|
||||
@@ -1665,129 +1641,6 @@ window-rule {
|
||||
});
|
||||
}
|
||||
|
||||
function generateNiriInputConfig() {
|
||||
if (!CompositorService.isNiri)
|
||||
return;
|
||||
|
||||
const defaultMouseLeftHanded = false;
|
||||
const defaultMouseMiddleEmulation = false;
|
||||
const defaultMouseNaturalScroll = false;
|
||||
const defaultMouseProfile = "default";
|
||||
const defaultMouseScrollFactor = 1.0;
|
||||
const defaultMouseScrollMethod = "default";
|
||||
const defaultMouseSpeed = 0.0;
|
||||
|
||||
const defaultTouchpadDisableOnExternalMouse = false;
|
||||
const defaultTouchpadDisableWhileTyping = true;
|
||||
const defaultTouchpadDragLock = false;
|
||||
const defaultTouchpadMiddleEmulation = false;
|
||||
const defaultTouchpadNaturalScroll = true;
|
||||
const defaultTouchpadProfile = "default";
|
||||
const defaultTouchpadScrollFactor = 1.0;
|
||||
const defaultTouchpadScrollMethod = "default";
|
||||
const defaultTouchpadSpeed = 0.0;
|
||||
const defaultTouchpadTap = true;
|
||||
const defaultTouchpadTapAndDrag = true;
|
||||
|
||||
const mouseLeftHanded = typeof SettingsData !== "undefined" ? SettingsData.mouseLeftHanded : defaultMouseLeftHanded;
|
||||
const mouseMiddleEmulation = typeof SettingsData !== "undefined" ? SettingsData.mouseMiddleEmulation : defaultMouseMiddleEmulation;
|
||||
const mouseNaturalScroll = typeof SettingsData !== "undefined" ? SettingsData.mouseNaturalScroll : defaultMouseNaturalScroll;
|
||||
const mouseProfile = typeof SettingsData !== "undefined" ? SettingsData.mouseAccelProfile : defaultMouseProfile;
|
||||
const mouseScrollFactor = typeof SettingsData !== "undefined" ? SettingsData.mouseScrollFactor : defaultMouseScrollFactor;
|
||||
const mouseScrollMethod = typeof SettingsData !== "undefined" ? SettingsData.mouseScrollMethod : defaultMouseScrollMethod;
|
||||
const mouseSpeed = typeof SettingsData !== "undefined" ? SettingsData.mouseAccelSpeed : defaultMouseSpeed;
|
||||
|
||||
const touchpadDisableOnExternalMouse = typeof SettingsData !== "undefined" ? SettingsData.touchpadDisableOnExternalMouse : defaultTouchpadDisableOnExternalMouse;
|
||||
const touchpadDisableWhileTyping = typeof SettingsData !== "undefined" ? SettingsData.touchpadDisableWhileTyping : defaultTouchpadDisableWhileTyping;
|
||||
const touchpadDragLock = typeof SettingsData !== "undefined" ? SettingsData.touchpadDragLock : defaultTouchpadDragLock;
|
||||
const touchpadMiddleEmulation = typeof SettingsData !== "undefined" ? SettingsData.touchpadMiddleEmulation : defaultTouchpadMiddleEmulation;
|
||||
const touchpadNaturalScroll = typeof SettingsData !== "undefined" ? SettingsData.touchpadNaturalScroll : defaultTouchpadNaturalScroll;
|
||||
const touchpadProfile = typeof SettingsData !== "undefined" ? SettingsData.touchpadAccelProfile : defaultTouchpadProfile;
|
||||
const touchpadScrollFactor = typeof SettingsData !== "undefined" ? SettingsData.touchpadScrollFactor : defaultTouchpadScrollFactor;
|
||||
const touchpadScrollMethod = typeof SettingsData !== "undefined" ? SettingsData.touchpadScrollMethod : defaultTouchpadScrollMethod;
|
||||
const touchpadSpeed = typeof SettingsData !== "undefined" ? SettingsData.touchpadAccelSpeed : defaultTouchpadSpeed;
|
||||
const touchpadTap = typeof SettingsData !== "undefined" ? SettingsData.touchpadTapToClick : defaultTouchpadTap;
|
||||
const touchpadTapAndDrag = typeof SettingsData !== "undefined" ? SettingsData.touchpadTapAndDrag : defaultTouchpadTapAndDrag;
|
||||
|
||||
const dmsWarning = `// ! DO NOT EDIT !
|
||||
// ! AUTO-GENERATED BY DMS !
|
||||
// ! CHANGES WILL BE OVERWRITTEN !
|
||||
// ! PLACE YOUR CUSTOM CONFIGURATION ELSEWHERE !
|
||||
|
||||
`;
|
||||
|
||||
let inputContent = dmsWarning + "input {\n";
|
||||
|
||||
// Mouse block
|
||||
inputContent += " mouse {\n";
|
||||
inputContent += ` accel-speed ${mouseSpeed.toFixed(1)}\n`;
|
||||
if (mouseProfile !== "default") {
|
||||
inputContent += ` accel-profile "${mouseProfile}"\n`;
|
||||
}
|
||||
if (mouseNaturalScroll) {
|
||||
inputContent += " natural-scroll\n";
|
||||
}
|
||||
if (mouseLeftHanded) {
|
||||
inputContent += " left-handed\n";
|
||||
}
|
||||
if (mouseMiddleEmulation) {
|
||||
inputContent += " middle-emulation\n";
|
||||
}
|
||||
if (mouseScrollFactor !== 1.0) {
|
||||
inputContent += ` scroll-factor ${mouseScrollFactor.toFixed(1)}\n`;
|
||||
}
|
||||
if (mouseScrollMethod !== "default") {
|
||||
inputContent += ` scroll-method "${mouseScrollMethod}"\n`;
|
||||
}
|
||||
inputContent += " }\n";
|
||||
|
||||
// Touchpad block
|
||||
inputContent += " touchpad {\n";
|
||||
if (touchpadTap) {
|
||||
inputContent += " tap\n";
|
||||
}
|
||||
inputContent += ` accel-speed ${touchpadSpeed.toFixed(1)}\n`;
|
||||
if (touchpadProfile !== "default") {
|
||||
inputContent += ` accel-profile "${touchpadProfile}"\n`;
|
||||
}
|
||||
if (touchpadNaturalScroll) {
|
||||
inputContent += " natural-scroll\n";
|
||||
}
|
||||
if (touchpadDisableOnExternalMouse) {
|
||||
inputContent += " disabled-on-external-mouse\n";
|
||||
}
|
||||
if (touchpadDisableWhileTyping) {
|
||||
inputContent += " dwt\n";
|
||||
}
|
||||
if (touchpadMiddleEmulation) {
|
||||
inputContent += " middle-emulation\n";
|
||||
}
|
||||
if (touchpadScrollFactor !== 1.0) {
|
||||
inputContent += ` scroll-factor ${touchpadScrollFactor.toFixed(1)}\n`;
|
||||
}
|
||||
if (touchpadScrollMethod !== "default") {
|
||||
inputContent += ` scroll-method "${touchpadScrollMethod}"\n`;
|
||||
}
|
||||
if (!touchpadTapAndDrag) {
|
||||
inputContent += " drag false\n";
|
||||
}
|
||||
if (touchpadDragLock) {
|
||||
inputContent += " drag-lock\n";
|
||||
}
|
||||
inputContent += " }\n";
|
||||
|
||||
inputContent += "}\n";
|
||||
|
||||
const configDir = Paths.strip(StandardPaths.writableLocation(StandardPaths.ConfigLocation));
|
||||
const niriDmsDir = configDir + "/niri/dms";
|
||||
const inputPath = niriDmsDir + "/input.kdl";
|
||||
|
||||
writeInputProcess.inputContent = inputContent;
|
||||
writeInputProcess.inputPath = inputPath;
|
||||
writeInputProcess.command = ["sh", "-c", `mkdir -p "${niriDmsDir}" && cat > "${inputPath}" << 'EOF'\n${inputContent}\nEOF`];
|
||||
writeInputProcess.running = true;
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
function screenshot(): string {
|
||||
if (!CompositorService.isNiri) {
|
||||
|
||||
@@ -777,7 +777,7 @@ Singleton {
|
||||
return 5000;
|
||||
// expireTimeout is in milliseconds; -1 defers to our settings.
|
||||
const appTimeout = wrapper.notification.expireTimeout;
|
||||
if (appTimeout >= 0 && !SettingsData.notificationIgnoreAppTimeout)
|
||||
if (appTimeout >= 0)
|
||||
return Math.round(appTimeout);
|
||||
switch (wrapper.urgency) {
|
||||
case NotificationUrgency.Low:
|
||||
|
||||
@@ -425,7 +425,7 @@ Singleton {
|
||||
}
|
||||
|
||||
function closeSettings() {
|
||||
settingsModal?.hide();
|
||||
settingsModal?.close();
|
||||
}
|
||||
|
||||
function toggleSettings() {
|
||||
|
||||
@@ -117,7 +117,7 @@ Singleton {
|
||||
|
||||
Timer {
|
||||
id: colorSchemeSettleTimer
|
||||
interval: 750
|
||||
interval: 1000
|
||||
onTriggered: {
|
||||
if (!root.canSyncColorScheme())
|
||||
return;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* BEGIN DMS OVERRIDE */
|
||||
|
||||
/*
|
||||
* GTK Colors
|
||||
* Generated with Matugen
|
||||
@@ -48,5 +46,3 @@ a color between surface and surface container so I think just giving this surfac
|
||||
@define-color theme_unfocused_base_color @window_bg_color;
|
||||
@define-color theme_unfocused_selected_bg_color @accent_bg_color;
|
||||
@define-color theme_unfocused_selected_fg_color @accent_fg_color;
|
||||
|
||||
/* END DMS OVERRIDE */
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* BEGIN DMS OVERRIDE */
|
||||
|
||||
/*
|
||||
* GTK Colors
|
||||
* Generated with Matugen
|
||||
@@ -7822,5 +7820,3 @@ window.background:not(.solid-csd):not(.csd) > notebook > stack:not(:only-child)
|
||||
@define-color sidebar_fg_color @window_fg_color;
|
||||
@define-color sidebar_border_color @window_bg_color;
|
||||
@define-color sidebar_backdrop_color @window_bg_color;
|
||||
|
||||
/* END DMS OVERRIDE */
|
||||
|
||||
+85
-222
@@ -1,251 +1,114 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CONFIG_DIR="$1"
|
||||
# apply: setup symlinks and config dirs
|
||||
# patch: refresh overrides in adw-gtk3
|
||||
# remove: remove all overrides
|
||||
MODE="${2:-apply}"
|
||||
IS_LIGHT="${3:-light}"
|
||||
SHELL_DIR="$3"
|
||||
|
||||
if [ -z "$CONFIG_DIR" ]; then
|
||||
echo "Usage: $0 <config_dir> [apply|patch|remove] [is_light] [shell_dir]" >&2
|
||||
exit 1
|
||||
echo "Usage: $0 <config_dir> [is_light] [shell_dir]" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
get_adw_gtk3_dir() {
|
||||
local variant="$1"
|
||||
local name=""
|
||||
[ "$variant" == "dark" ] && name="-$variant"
|
||||
# The light template references adw-gtk3 image assets relative to gtk.css
|
||||
# (check/radio glyphs, slider knobs); without them checked boxes render as
|
||||
# solid blocks.
|
||||
link_gtk3_assets() {
|
||||
local gtk3_dir="$1"
|
||||
local assets_link="$gtk3_dir/assets"
|
||||
|
||||
local candidates=(
|
||||
"$HOME/.local/share/themes/adw-gtk3${name}/gtk-3.0"
|
||||
"$HOME/.themes/adw-gtk3${name}/gtk-3.0"
|
||||
"/usr/share/themes/adw-gtk3${name}/gtk-3.0"
|
||||
"/usr/local/share/themes/adw-gtk3${name}/gtk-3.0"
|
||||
)
|
||||
local target=""
|
||||
for c in "${candidates[@]}"; do
|
||||
if [ -d "$c" ]; then
|
||||
target="$c"
|
||||
break
|
||||
fi
|
||||
done
|
||||
echo "$target"
|
||||
}
|
||||
if [ -e "$assets_link" ] && [ ! -L "$assets_link" ]; then
|
||||
echo "Leaving user-managed $assets_link in place"
|
||||
return
|
||||
fi
|
||||
|
||||
remove_gtk3_patch() {
|
||||
local theme_dir="$1"
|
||||
local css_variant="$2"
|
||||
[ "$css_variant" != "-dark" ] && css_variant=""
|
||||
sed -i '/\/\* BEGIN DMS OVERRIDE \*\//,/\/\* END DMS OVERRIDE \*\//d' "${theme_dir}/gtk${css_variant}.css"
|
||||
return $?
|
||||
}
|
||||
local candidates=(
|
||||
"$HOME/.local/share/themes/adw-gtk3/gtk-3.0/assets"
|
||||
"$HOME/.themes/adw-gtk3/gtk-3.0/assets"
|
||||
"/usr/share/themes/adw-gtk3/gtk-3.0/assets"
|
||||
"/usr/local/share/themes/adw-gtk3/gtk-3.0/assets"
|
||||
)
|
||||
local target=""
|
||||
for c in "${candidates[@]}"; do
|
||||
if [ -d "$c" ]; then
|
||||
target="$c"
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ -z "$target" ] && [ -n "$SHELL_DIR" ] && [ -d "$SHELL_DIR/matugen/gtk3-assets" ]; then
|
||||
target="$SHELL_DIR/matugen/gtk3-assets"
|
||||
fi
|
||||
if [ -z "$target" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
remove_gtk3_colors() {
|
||||
local config_dir="$1"
|
||||
|
||||
local gtk3_dir="$config_dir/gtk-3.0"
|
||||
|
||||
# remove global override
|
||||
if [ ! -f "${gtk3_dir}/dank-colors.css" ]; then
|
||||
echo "Nothing to remove at '${gtk3_dir}'"
|
||||
else
|
||||
if rm "${gtk3_dir}/dank-colors.css"; then
|
||||
echo "Removed GTK3 override form '${gtk3_dir}'"
|
||||
else
|
||||
echo "Failed to removed GTK3 override from '${gtk3_dir}'"
|
||||
fi
|
||||
fi
|
||||
|
||||
# remove adw-gtk3 inclusions
|
||||
for variant in light dark; do
|
||||
local adw_gtk3_dir && adw_gtk3_dir=$(get_adw_gtk3_dir "$variant")
|
||||
|
||||
if [ -z "$adw_gtk3_dir" ]; then
|
||||
echo "Error: No version of adw-gtk3 ${variant} was found" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for css_variant in light dark; do
|
||||
if remove_gtk3_patch "$adw_gtk3_dir" "$css_variant"; then
|
||||
echo "Removed GTK colors patch from '${adw_gtk3_dir}' in '$css_variant' stylesheet"
|
||||
else
|
||||
echo "Failed to remove GTK colors patch from '${adw_gtk3_dir}' in '$css_variant' stylesheet" >&2
|
||||
fi
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
do_patch() {
|
||||
local theme_dir="$1"
|
||||
local variant="$2"
|
||||
local css_variant=""
|
||||
[ "$variant" = "dark" ] && css_variant="-${variant}"
|
||||
if {
|
||||
remove_gtk3_patch "$theme_dir" "$css_variant"
|
||||
cat "${gtk3_dir}/dank-colors.css" >>"${theme_dir}/gtk${css_variant}.css"
|
||||
}; then
|
||||
echo "Successfully patched '$theme_dir/gtk${css_variant}.css' with GTK '$variant' colors"
|
||||
else
|
||||
echo "Error: failed to patch '$theme_dir/gtk${css_variant}.css' with GTK '$variant' colors" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
patch_gtk3_colors() {
|
||||
local config_dir="$1"
|
||||
local is_light="$2"
|
||||
|
||||
# Include generated colors for current variant
|
||||
local gtk3_dir="$config_dir/gtk-3.0"
|
||||
local variant="light"
|
||||
[ "$is_light" = "false" ] && variant="dark"
|
||||
local adw_gtk3_dir && adw_gtk3_dir=$(get_adw_gtk3_dir "$variant")
|
||||
|
||||
if [ -z "$adw_gtk3_dir" ]; then
|
||||
echo "Warning: No version of adw-gtk3 ${variant} was found" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$adw_gtk3_dir" =~ ^/usr ]]; then
|
||||
echo "Warning: No user version of adw-gtk3 ${variant} was found." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "${gtk3_dir}/dank-colors.css" ]; then
|
||||
echo "Error: GTK3 dank-colors.css not found at '${gtk3_dir}'" >&2
|
||||
echo "Run matugen first to generate theme files" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# NOTE : for adw-gtk3-dark gtk.css and gtk-dark.css are the same file
|
||||
if [ "$variant" = "dark" ]; then
|
||||
do_patch "$adw_gtk3_dir" "dark"
|
||||
do_patch "$adw_gtk3_dir" "light"
|
||||
do_patch "$(get_adw_gtk3_dir "light")" "dark"
|
||||
else
|
||||
do_patch "$adw_gtk3_dir" "light"
|
||||
fi
|
||||
ln -sfn "$target" "$assets_link"
|
||||
echo "Linked GTK3 assets: $assets_link -> $target"
|
||||
}
|
||||
|
||||
apply_gtk3_colors() {
|
||||
local config_dir="$1"
|
||||
local config_dir="$1"
|
||||
|
||||
local gtk3_dir="$config_dir/gtk-3.0"
|
||||
local gtk3_override="$gtk3_dir/gtk.css"
|
||||
# If no adw-gtk3 or only system wide, use global override
|
||||
local adw_gtk3 && adw_gtk3="$(get_adw_gtk3_dir)"
|
||||
if [[ "$adw_gtk3" =~ ^/usr ]] || [[ -z "$adw_gtk3" ]]; then
|
||||
echo "Warning: No user version of adw-gtk3 found" >&2
|
||||
echo "Falling back on global css override" >&2
|
||||
local dank_colors="$gtk3_dir/dank-colors.css"
|
||||
local gtk3_dir="$config_dir/gtk-3.0"
|
||||
local dank_colors="$gtk3_dir/dank-colors.css"
|
||||
local gtk_css="$gtk3_dir/gtk.css"
|
||||
|
||||
if [ ! -f "$dank_colors" ]; then
|
||||
echo "Error: dank-colors.css not found at $dank_colors" >&2
|
||||
echo "Run matugen first to generate theme files" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -f "$dank_colors" ]; then
|
||||
echo "Error: dank-colors.css not found at $dank_colors" >&2
|
||||
echo "Run matugen first to generate theme files" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -L "$gtk3_override" ]; then
|
||||
rm "$gtk3_override"
|
||||
elif [ -f "$gtk3_override" ]; then
|
||||
mv "$gtk3_override" "$gtk3_override.backup.$(date +%s)"
|
||||
echo "Backed up existing gtk.css"
|
||||
fi
|
||||
if [ -L "$gtk_css" ]; then
|
||||
rm "$gtk_css"
|
||||
elif [ -f "$gtk_css" ]; then
|
||||
mv "$gtk_css" "$gtk_css.backup.$(date +%s)"
|
||||
echo "Backed up existing gtk.css"
|
||||
fi
|
||||
|
||||
ln -s "dank-colors.css" "$gtk3_override"
|
||||
echo "Created symlink: $gtk3_override -> dank-colors.css"
|
||||
|
||||
link_gtk3_assets "$gtk3_dir"
|
||||
|
||||
return
|
||||
fi
|
||||
|
||||
# Else ensure there's no global override
|
||||
if [ -L "$gtk3_override" ]; then
|
||||
rm "$gtk3_override"
|
||||
elif [ -f "$gtk3_override" ]; then
|
||||
mv "$gtk3_override" "$gtk3_override.backup.$(date +%s)"
|
||||
echo "Backed up and removed existing gtk.css"
|
||||
fi
|
||||
|
||||
# Backup adw-gtk3 stylesheets
|
||||
for variant in light dark; do
|
||||
local adw_gtk3_dir && adw_gtk3_dir="$(get_adw_gtk3_dir "$variant")"
|
||||
cp "$adw_gtk3_dir/gtk-3.0/gtk.css" "$adw_gtk3_dir/gtk-3.0/gtk.css.backup.$(date +%s)"
|
||||
cp "$adw_gtk3_dir/gtk-3.0/gtk-dark.css" "$adw_gtk3_dir/gtk-3.0/gtk-dark.css.backup.$(date +%s)"
|
||||
done
|
||||
}
|
||||
|
||||
remove_gtk4_colors() {
|
||||
local config_dir="$1"
|
||||
|
||||
local gtk4_dir="$config_dir/gtk-4.0"
|
||||
local dank_colors="$gtk4_dir/dank-colors.css"
|
||||
local gtk_css="$gtk4_dir/gtk.css"
|
||||
|
||||
if [ ! -f "$dank_colors" ]; then
|
||||
echo "Nothing to remove in '$gtk4_dir'"
|
||||
return
|
||||
fi
|
||||
|
||||
rm "$dank_colors"
|
||||
echo "Removed 'dank-colors.css' from '$gtk4_dir'"
|
||||
|
||||
local gtk4_import="@import url(\"dank-colors.css\");"
|
||||
if [ -f "$gtk_css" ] && grep -q '^@import url.*dank-colors\.css.*);$' "$gtk_css"; then
|
||||
sed -i "/$gtk4_import/d" "$gtk_css"
|
||||
echo "Removed gtk4 import in '$gtk_css'"
|
||||
fi
|
||||
ln -s "dank-colors.css" "$gtk_css"
|
||||
echo "Created symlink: $gtk_css -> dank-colors.css"
|
||||
|
||||
link_gtk3_assets "$gtk3_dir"
|
||||
}
|
||||
|
||||
apply_gtk4_colors() {
|
||||
local config_dir="$1"
|
||||
local config_dir="$1"
|
||||
|
||||
local gtk4_dir="$config_dir/gtk-4.0"
|
||||
local dank_colors="$gtk4_dir/dank-colors.css"
|
||||
local gtk_css="$gtk4_dir/gtk.css"
|
||||
local gtk4_import="@import url(\"dank-colors.css\");"
|
||||
local gtk4_dir="$config_dir/gtk-4.0"
|
||||
local dank_colors="$gtk4_dir/dank-colors.css"
|
||||
local gtk_css="$gtk4_dir/gtk.css"
|
||||
local gtk4_import="@import url(\"dank-colors.css\");"
|
||||
|
||||
if [ ! -f "$dank_colors" ]; then
|
||||
echo "Error: GTK4 dank-colors.css not found at $dank_colors" >&2
|
||||
echo "Run matugen first to generate theme files" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -f "$dank_colors" ]; then
|
||||
echo "Error: GTK4 dank-colors.css not found at $dank_colors" >&2
|
||||
echo "Run matugen first to generate theme files" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -f "$gtk_css" ] && grep -q '^@import url.*dank-colors\.css.*);$' "$gtk_css"; then
|
||||
echo "GTK4 import already exists"
|
||||
return
|
||||
fi
|
||||
if [ -f "$gtk_css" ] && grep -q '^@import url.*dank-colors\.css.*);$' "$gtk_css"; then
|
||||
echo "GTK4 import already exists"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -f "$gtk_css" ] && [ -s "$gtk_css" ]; then
|
||||
sed -i "1i\\$gtk4_import" "$gtk_css"
|
||||
else
|
||||
echo "$gtk4_import" >"$gtk_css"
|
||||
fi
|
||||
echo "Updated GTK4 CSS import"
|
||||
if [ -f "$gtk_css" ] && [ -s "$gtk_css" ]; then
|
||||
sed -i "1i\\$gtk4_import" "$gtk_css"
|
||||
else
|
||||
echo "$gtk4_import" >"$gtk_css"
|
||||
fi
|
||||
echo "Updated GTK4 CSS import"
|
||||
}
|
||||
|
||||
case "$MODE" in
|
||||
patch)
|
||||
patch_gtk3_colors "$CONFIG_DIR" "$IS_LIGHT"
|
||||
echo "GTK3 colors patched successfully"
|
||||
;;
|
||||
remove)
|
||||
remove_gtk3_colors "$CONFIG_DIR"
|
||||
remove_gtk4_colors "$CONFIG_DIR"
|
||||
;;
|
||||
apply)
|
||||
mkdir -p "$CONFIG_DIR/gtk-3.0" "$CONFIG_DIR/gtk-4.0"
|
||||
# Repair pass for shells whose gtk.css was linked before asset handling
|
||||
# existed; only acts when DMS already manages gtk.css.
|
||||
if [ "$4" = "assets-only" ]; then
|
||||
if [ -L "$CONFIG_DIR/gtk-3.0/gtk.css" ]; then
|
||||
link_gtk3_assets "$CONFIG_DIR/gtk-3.0"
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
apply_gtk3_colors "$CONFIG_DIR"
|
||||
apply_gtk4_colors "$CONFIG_DIR"
|
||||
mkdir -p "$CONFIG_DIR/gtk-3.0" "$CONFIG_DIR/gtk-4.0"
|
||||
|
||||
echo "GTK colors applied successfully"
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 <config_dir> [apply|patch|remove] [is_light] [shell_dir]" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
apply_gtk3_colors "$CONFIG_DIR"
|
||||
apply_gtk4_colors "$CONFIG_DIR"
|
||||
|
||||
echo "GTK colors applied successfully"
|
||||
|
||||
@@ -6150,34 +6150,6 @@
|
||||
"icon": "history",
|
||||
"description": "Save dismissed notifications to history"
|
||||
},
|
||||
{
|
||||
"section": "notificationIgnoreAppTimeout",
|
||||
"label": "Ignore App-Requested Timeout",
|
||||
"tabIndex": 17,
|
||||
"category": "Notifications",
|
||||
"keywords": [
|
||||
"above",
|
||||
"alerts",
|
||||
"always",
|
||||
"app",
|
||||
"duration",
|
||||
"durations",
|
||||
"even",
|
||||
"expire",
|
||||
"ignore",
|
||||
"longer",
|
||||
"messages",
|
||||
"notification",
|
||||
"notifications",
|
||||
"override",
|
||||
"requested",
|
||||
"requests",
|
||||
"shorter",
|
||||
"timeout",
|
||||
"toast"
|
||||
],
|
||||
"description": "Always use the durations above, even if an app requests a shorter or longer one"
|
||||
},
|
||||
{
|
||||
"section": "lockScreenNotifications",
|
||||
"label": "Lock Screen",
|
||||
@@ -6571,26 +6543,18 @@
|
||||
"tabIndex": 17,
|
||||
"category": "Notifications",
|
||||
"keywords": [
|
||||
"above",
|
||||
"alerts",
|
||||
"always",
|
||||
"duration",
|
||||
"durations",
|
||||
"even",
|
||||
"longer",
|
||||
"low",
|
||||
"messages",
|
||||
"notification",
|
||||
"notifications",
|
||||
"priority",
|
||||
"requests",
|
||||
"shorter",
|
||||
"timeout",
|
||||
"timeouts",
|
||||
"toast"
|
||||
],
|
||||
"icon": "timer",
|
||||
"description": "Always use the durations above, even if an app requests a shorter or longer one"
|
||||
"icon": "timer"
|
||||
},
|
||||
{
|
||||
"section": "osdAlwaysShowValue",
|
||||
@@ -9133,32 +9097,6 @@
|
||||
],
|
||||
"description": "Space between windows"
|
||||
},
|
||||
{
|
||||
"section": "compositorNotifications",
|
||||
"label": "Notifications",
|
||||
"tabIndex": 37,
|
||||
"category": "Personalization",
|
||||
"keywords": [
|
||||
"alert",
|
||||
"alerts",
|
||||
"appearance",
|
||||
"compositor",
|
||||
"config",
|
||||
"custom",
|
||||
"customize",
|
||||
"notif",
|
||||
"notifications",
|
||||
"notifs",
|
||||
"personal",
|
||||
"personalization",
|
||||
"reloaded",
|
||||
"show",
|
||||
"toast"
|
||||
],
|
||||
"icon": "notifications",
|
||||
"description": "Show a toast when the compositor config is reloaded",
|
||||
"conditionKey": "isNiri"
|
||||
},
|
||||
{
|
||||
"section": "hyprlandLayoutGapsOutOverride",
|
||||
"label": "Outer Gaps",
|
||||
@@ -9370,26 +9308,6 @@
|
||||
],
|
||||
"description": "Resize windows by dragging their edges with the mouse"
|
||||
},
|
||||
{
|
||||
"section": "showConfigReloadToast",
|
||||
"label": "Show \\",
|
||||
"tabIndex": 37,
|
||||
"category": "Personalization",
|
||||
"keywords": [
|
||||
"appearance",
|
||||
"compositor",
|
||||
"config",
|
||||
"custom",
|
||||
"customize",
|
||||
"personal",
|
||||
"personalization",
|
||||
"reload",
|
||||
"reloaded",
|
||||
"show",
|
||||
"toast"
|
||||
],
|
||||
"description": "Show a toast when the compositor config is reloaded"
|
||||
},
|
||||
{
|
||||
"section": "hyprlandLayoutRadiusOverride",
|
||||
"label": "Window Corner Radius",
|
||||
@@ -10026,18 +9944,5 @@
|
||||
"widgets"
|
||||
],
|
||||
"icon": "dashboard"
|
||||
},
|
||||
{
|
||||
"section": "_tab_44",
|
||||
"label": "Mouse & Touchpad",
|
||||
"tabIndex": 44,
|
||||
"category": "Settings",
|
||||
"keywords": [
|
||||
"mouse",
|
||||
"settings",
|
||||
"touchpad"
|
||||
],
|
||||
"icon": "mouse",
|
||||
"conditionKey": "isNiri"
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user