diff --git a/home/global/common/gnome/dconf.nix b/home/global/common/gnome/dconf.nix index 6d779bd..6b80ec5 100644 --- a/home/global/common/gnome/dconf.nix +++ b/home/global/common/gnome/dconf.nix @@ -24,46 +24,114 @@ with lib.hm.gvariant; }; "org/gnome/desktop/wm/keybindings" = lib.mkDefault { - maximize = [ ]; - move-to-monitor-down = [ ]; - move-to-monitor-left = [ ]; - move-to-monitor-right = [ ]; - move-to-monitor-up = [ ]; - move-to-workspace-down = [ "Down" ]; - move-to-workspace-left = [ ]; - move-to-workspace-right = [ ]; - move-to-workspace-up = [ "Up" ]; - shift-overview-down = [ "" ]; - shift-overview-up = [ "" ]; - switch-applications = [ ]; - switch-applications-backward = [ - "Tab" - "Tab" - ]; + ## Workspace switching ## + switch-to-workspace-1 = [ ]; # Default: ['Home'] + switch-to-workspace-2 = [ ]; + switch-to-workspace-3 = [ ]; + switch-to-workspace-4 = [ ]; + switch-to-workspace-5 = [ ]; + switch-to-workspace-6 = [ ]; + switch-to-workspace-7 = [ ]; + switch-to-workspace-8 = [ ]; + switch-to-workspace-9 = [ ]; + switch-to-workspace-10 = [ ]; + switch-to-workspace-11 = [ ]; + switch-to-workspace-12 = [ ]; + switch-to-workspace-left = [ ]; # Default: ['Page_Up','Left','Left'] + switch-to-workspace-right = [ ]; # Default: ['Page_Down','Right','Right'] + switch-to-workspace-up = [ ]; # Default: ['Up'] + switch-to-workspace-down = [ ]; # Default: ['Down'] + switch-to-workspace-last = [ ]; # Default: ['End'] + + ## Application/Window switching ## switch-group = [ "Above_Tab" "Above_Tab" + # Default: ['Above_Tab','Above_Tab'] ]; switch-group-backward = [ "Above_Tab" "Above_Tab" + # Default: ['Above_Tab','Above_Tab'] ]; - switch-input-source = [ ]; - switch-input-source-backward = [ ]; - switch-panels = [ "Tab" ]; - switch-panels-backward = [ "Tab" ]; - switch-to-workspace-1 = [ ]; - switch-to-workspace-down = [ "" ]; - switch-to-workspace-last = [ ]; - switch-to-workspace-left = [ ]; - switch-to-workspace-right = [ ]; - switch-to-workspace-up = [ "" ]; - toggle-application-view = [ "" ]; - toggle-message-tray = [ "" ]; - unmaximize = [ ]; + switch-applications = [ ]; # Default: ['Tab','Tab'] + switch-applications-backward = [ + "Tab" + "Tab" + # Default: ['Tab','Tab'] + ]; + switch-windows = [ ]; + switch-windows-backward = [ ]; + switch-panels = [ "Tab" ]; # Default: ['Tab'] + switch-panels-backward = [ "Tab" ]; # Default: ['Tab'] + + ## Direct cycling ## + cycle-group = [ ]; # Default: ['F6'] + cycle-group-backward = [ ]; # Default: ['F6'] + cycle-windows = [ ]; # Default: ['Escape'] + cycle-windows-backward = [ ]; # Default: ['Escape'] + cycle-panels = [ ]; # Default: ['Escape'] + cycle-panels-backward = [ ]; # Default: ['Escape'] + + ## Window management ## + show-desktop = [ ]; + panel-main-menu = [ ]; # DEPRECATED + panel-run-dialog = [ ]; # Default: ['F2'] + set-spew-mark = [ ]; + activate-window-menu = [ ]; # Default: ['space'] + toggle-fullscreen = [ ]; + toggle-maximized = [ ]; # Default: ['F10'] + toggle-above = [ ]; + maximize = [ ]; # Default: ['Up'] + unmaximize = [ ]; # Default: ['Down','F5'] + minimize = [ ]; # Default: ['h'] + close = [ ]; # Default: ['F4'] + begin-move = [ ]; # Default: ['F7'] + begin-resize = [ ]; # Default: ['F8'] + toggle-on-all-workspaces = [ ]; + move-to-workspace-1 = [ ]; # Default: ['Home'] + move-to-workspace-2 = [ ]; + move-to-workspace-3 = [ ]; + move-to-workspace-4 = [ ]; + move-to-workspace-5 = [ ]; + move-to-workspace-6 = [ ]; + move-to-workspace-7 = [ ]; + move-to-workspace-8 = [ ]; + move-to-workspace-9 = [ ]; + move-to-workspace-10 = [ ]; + move-to-workspace-11 = [ ]; + move-to-workspace-12 = [ ]; + move-to-workspace-last = [ ]; # Default: ['End'] + move-to-workspace-left = [ ]; # Default: ['Page_Up','Left','Left'] + move-to-workspace-right = [ ]; # Default: ['Page_Down','Right','Right'] + move-to-workspace-up = [ ]; # Default: ['Up'] + move-to-workspace-down = [ ]; # Default: ['Down'] + move-to-monitor-left = [ ]; # Default: ['Left'] + move-to-monitor-right = [ ]; # Default: ['Right'] + move-to-monitor-up = [ ]; # Default: ['Up'] + move-to-monitor-down = [ ]; # Default: ['Down'] + raise-or-lower = [ ]; + raise = [ ]; + lower = [ ]; + maximize-vertically = [ ]; + maximize-horizontally = [ ]; + move-to-corner-nw = [ ]; + move-to-corner-ne = [ ]; + move-to-corner-sw = [ ]; + move-to-corner-se = [ ]; + move-to-side-n = [ ]; + move-to-side-s = [ ]; + move-to-side-e = [ ]; + move-to-side-w = [ ]; + move-to-center = [ ]; + always-on-top = [ ]; + + ## Input switching ## + switch-input-source = [ ]; # Default: ['space','XF86Keyboard'] + switch-input-source-backward = [ ]; # Default: ['space','XF86Keyboard'] }; - "org/gnome/desktop/wm/preferences" = lib.mkForce { + "org/gnome/desktop/wm/preferences" = lib.mkDefault { num-workspaces = 3; }; @@ -75,40 +143,127 @@ with lib.hm.gvariant; night-light-enabled = true; night-light-schedule-automatic = false; night-light-schedule-from = 19.0; - night-light-temperature = mkUint32 3892; + night-light-temperature = (mkUint32 3892); }; - "org/gnome/settings-daemon/plugins/media-keys" = lib.mkDefault { + "org/gnome/settings-daemon/plugins/media-keys" = { custom-keybindings = [ "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/" "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/" - "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/" ]; + + ## Non-static ##: + battery-status = [ ]; + calculator = [ ]; + control-center = [ ]; + decrease-text-size = [ ]; + eject = [ ]; + email = [ ]; + help = [ ]; # Default: ['', 'F1'] + hibernate = [ ]; + home = [ ]; + increase-text-size = [ ]; + keyboard-brightness-down = [ ]; + keyboard-brightness-toggle = [ ]; + keyboard-brightness-up = [ ]; + logout = [ "Delete" ]; + magnifier = [ ]; # Default: ['8'] + magnifier-zoom-in = [ ]; # Default: ['equal'] + magnifier-zoom-out = [ ]; # Default: ['minus'] + media = [ ]; + mic-mute = [ ]; next = [ "AudioNext" ]; + on-screen-keyboard = [ ]; + pause = [ ]; play = [ "AudioPlay" ]; + playback-forward = [ ]; + playback-random = [ ]; + playback-repeat = [ ]; + playback-rewind = [ ]; + power = [ ]; previous = [ "AudioPrev" ]; reboot = [ "r" ]; - rotate-video-lock-static = [ ]; + rfkill = [ ]; + rfkill-bluetooth = [ ]; + rotate-video-lock = [ ]; + screen-brightness-cycle = [ ]; + screen-brightness-down = [ ]; + screen-brightness-up = [ ]; + screenreader = [ ]; + screensaver = [ ]; # Default: ['l'] + search = [ ]; shutdown = [ "x" ]; + stop = [ ]; + suspend = [ ]; + toggle-contrast = [ ]; + touchpad-off = [ ]; + touchpad-on = [ ]; + touchpad-toggle = [ ]; volume-down = [ "AudioLowerVolume" ]; + volume-down-precise = [ ]; + volume-down-quiet = [ ]; volume-mute = [ "AudioMute" ]; + volume-mute-quiet = [ ]; + volume-step = 5; # Default: 6 volume-up = [ "AudioRaiseVolume" ]; + volume-up-precise = [ ]; + volume-up-quiet = [ ]; www = [ "w" ]; + + ## Static keys ## + # NOTE: Many of these interfere with custom keybindings, so I just disable them + battery-status-static = [ ]; # Default: ['XF86Battery'] + calculator-static = [ ]; # Default: ['XF86Calculator'] + control-center-static = [ ]; # Default: ['XF86Tools'] + eject-static = [ ]; # Default: ['XF86Eject'] + email-static = [ ]; # Default: ['XF86Mail'] + hibernate-static = [ ]; # Default: ['XF86Suspend', 'XF86Hibernate'] + home-static = [ "f" ]; # Default: ['XF86Explorer'] + keyboard-brightness-down-static = [ ]; # Default: ['XF86KbdBrightnessDown'] + keyboard-brightness-toggle-static = [ ]; # Default: ['XF86KbdLightOnOff'] + keyboard-brightness-up-static = [ ]; # Default: ['XF86KbdBrightnessUp'] + media-static = [ ]; # Default: ['XF86AudioMedia'] + mic-mute-static = [ ]; # Default: ['XF86AudioMicMute'] + next-static = [ ]; # Default: ['XF86AudioNext', 'XF86AudioNext'] + pause-static = [ ]; # Default: ['XF86AudioPause'] + play-static = [ ]; # Default: ['XF86AudioPlay', 'XF86AudioPlay'] + playback-forward-static = [ ]; # Default: ['XF86AudioForward'] + playback-random-static = [ ]; # Default: ['XF86AudioRandomPlay'] + playback-repeat-static = [ ]; # Default: ['XF86AudioRepeat'] + playback-rewind-static = [ ]; # Default: ['XF86AudioRewind'] + power-static = [ ]; # Default: ['XF86PowerOff'] + previous-static = [ ]; # Default: ['XF86AudioPrev', 'XF86AudioPrev'] + rfkill-bluetooth-static = [ ]; # Default: ['XF86Bluetooth'] + rfkill-static = [ ]; # Default: ['XF86WLAN', 'XF86UWB', 'XF86RFKill'] + rotate-video-lock-static = [ ]; # Default: ['o', 'XF86RotationLockToggle'] + screen-brightness-cycle-static = [ ]; # Default: ['XF86MonBrightnessCycle'] + screen-brightness-down-static = [ ]; # Default: ['XF86MonBrightnessDown'] + screen-brightness-up-static = [ ]; # Default: ['XF86MonBrightnessUp'] + screensaver-static = [ ]; # Default: ['XF86ScreenSaver'] + search-static = [ ]; # Default: ['XF86Search'] + stop-static = [ ]; # Default: ['XF86AudioStop'] + suspend-static = [ ]; # Default: ['XF86Sleep'] + touchpad-off-static = [ ]; # Default: ['XF86TouchpadOff'] + touchpad-on-static = [ ]; # Default: ['XF86TouchpadOn'] + touchpad-toggle-static = [ ]; # Default: ['XF86TouchpadToggle', 'XF86TouchpadToggle'] + volume-down-precise-static = [ ]; # Default: ['XF86AudioLowerVolume', 'XF86AudioLowerVolume'] + volume-down-quiet-static = [ ]; # Default: ['XF86AudioLowerVolume', 'XF86AudioLowerVolume'] + volume-down-static = [ ]; # Default: ['XF86AudioLowerVolume', 'XF86AudioLowerVolume'] + volume-mute-quiet-static = [ ]; # Default: ['XF86AudioMute'] + volume-mute-static = [ ]; # Default: ['XF86AudioMute'] + volume-up-precise-static = [ ]; # Default: ['XF86AudioRaiseVolume', 'XF86AudioRaiseVolume'] + volume-up-quiet-static = [ ]; # Default: ['XF86AudioRaiseVolume', 'XF86AudioRaiseVolume'] + volume-up-static = [ ]; # Default: ['XF86AudioRaiseVolume', 'XF86AudioRaiseVolume'] + www-static = [ ]; # Default: ['XF86WWW'] }; - "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = lib.mkDefault { + "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = { binding = "t"; command = "ghostty"; name = "Terminal"; }; - "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1" = lib.mkDefault { - binding = "f"; - command = "nautilus"; - name = "Files"; - }; - - "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2" = lib.mkDefault { + "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1" = { binding = "e"; command = "code"; name = "Code"; @@ -144,8 +299,8 @@ with lib.hm.gvariant; last-selected-power-profile = lib.mkDefault "performance"; }; - "org/gnome/shell/extensions/alphabetical-app-grid" = { - folder-order-position = lib.mkDefault "start"; + "org/gnome/shell/extensions/alphabetical-app-grid" = lib.mkDefault { + folder-order-position = "start"; }; "org/gnome/shell/extensions/appindicator" = lib.mkDefault { @@ -322,7 +477,7 @@ with lib.hm.gvariant; vertical-margin-bottom = 8; window-gap = 8; winprops = [ - '' + '' {"wm_class":"Code","spaceIndex":0} '' '' @@ -356,60 +511,101 @@ with lib.hm.gvariant; {"wm_class":".gamescope-wrapped","preferredWidth":"100%","spaceIndex":2} '' ]; + + # "workspaces" = lib.mkDefault { + # list = [ + # "000ef222-dd9f-4487-bff9-5e1960e54ab7" + # "b986bc1f-bbe1-454d-8aa8-a55614b330ec" + # "437c83fc-b11d-48f9-bac4-3df6ca297939" + # "8d4b2910-fe68-4192-b349-386c09ebf660" + # "613a7a94-8355-4519-b7a4-b3f279a3e48a" + # ]; + # }; + + # "workspaces/000ef222-dd9f-4487-bff9-5e1960e54ab7" = lib.mkDefault { + # background = ""; + # color = "rgb(255, 241, 39)"; + # index = 0; + # }; + + # "workspaces/b986bc1f-bbe1-454d-8aa8-a55614b330ec" = lib.mkDefault { + # background = ""; + # color = "rgb(98,160,234)"; + # index = 1; + # }; + + # "workspaces/437c83fc-b11d-48f9-bac4-3df6ca297939" = lib.mkDefault { + # background = ""; + # color = "rgb(219, 13, 13)"; + # index = 2; + # }; + + # "workspaces/8d4b2910-fe68-4192-b349-386c09ebf660" = lib.mkDefault { + # background = ""; + # color = "rgb(249, 102, 252)"; + # index = 3; + # }; + + # "workspaces/613a7a94-8355-4519-b7a4-b3f279a3e48a" = lib.mkDefault { + # background = ""; + # color = "rgb(202, 202, 202)"; + # index = 4; + # }; + }; "org/gnome/shell/extensions/paperwm/keybindings" = lib.mkDefault { center = [ "c" ]; - center-horizontally = [ "" ]; - center-vertically = [ "" ]; + center-horizontally = [ ]; + center-vertically = [ ]; close-window = [ "q" ]; cycle-height = [ "Up" ]; cycle-height-backwards = [ "Down" ]; cycle-width = [ "Right" ]; cycle-width-backwards = [ "Left" ]; live-alt-tab = [ "Tab" ]; - live-alt-tab-backward = [ "" ]; - live-alt-tab-scratch = [ "" ]; - live-alt-tab-scratch-backward = [ "" ]; + live-alt-tab-backward = [ ]; + live-alt-tab-scratch = [ ]; + live-alt-tab-scratch-backward = [ ]; move-down = [ "Down" ]; move-down-workspace = [ "Down" ]; move-left = [ "Left" ]; - move-monitor-above = [ "" ]; - move-monitor-below = [ "" ]; + move-monitor-above = [ ]; + move-monitor-below = [ ]; move-monitor-left = [ "Left" ]; move-monitor-right = [ "Right" ]; - move-previous-workspace = [ "" ]; - move-previous-workspace-backward = [ "" ]; + move-previous-workspace = [ ]; + move-previous-workspace-backward = [ ]; move-right = [ "Right" ]; - move-space-monitor-above = [ "" ]; - move-space-monitor-below = [ "" ]; - move-space-monitor-left = [ "" ]; - move-space-monitor-right = [ "" ]; + move-space-monitor-above = [ ]; + move-space-monitor-below = [ ]; + move-space-monitor-left = [ ]; + move-space-monitor-right = [ ]; move-up = [ "Up" ]; move-up-workspace = [ "Up" ]; new-window = [ "n" ]; - previous-workspace = [ "" ]; - previous-workspace-backward = [ "" ]; - swap-monitor-above = [ "" ]; - swap-monitor-below = [ "" ]; - swap-monitor-left = [ "" ]; - swap-monitor-right = [ "" ]; + previous-workspace = [ ]; + previous-workspace-backward = [ ]; + swap-monitor-above = [ ]; + swap-monitor-below = [ ]; + swap-monitor-left = [ ]; + swap-monitor-right = [ ]; switch-down-workspace = [ "Page_Down" ]; switch-focus-mode = [ "a" ]; - switch-monitor-above = [ "" ]; - switch-monitor-below = [ "" ]; - switch-monitor-left = [ "" ]; - switch-monitor-right = [ "" ]; - switch-next = [ "" ]; - switch-open-window-position = [ "" ]; - switch-previous = [ "" ]; + switch-monitor-above = [ ]; + switch-monitor-below = [ ]; + switch-monitor-left = [ ]; + switch-monitor-right = [ ]; + switch-next = [ ]; + switch-open-window-position = [ ]; + switch-previous = [ ]; switch-up-workspace = [ "Page_Up" ]; - take-window = [ "" ]; - toggle-maximize-width = [ "" ]; + take-window = [ ]; + toggle-maximize-width = [ ]; toggle-scratch = [ "BackSpace" ]; toggle-scratch-layer = [ "BackSpace" ]; - toggle-scratch-window = [ "" ]; - toggle-top-and-position-bar = [ "" ]; + toggle-scratch-window = [ ]; + toggle-top-and-position-bar = [ ]; }; "org/gnome/shell/extensions/user-theme" = lib.mkDefault { diff --git a/home/global/common/gnome/programs/brightness.nix b/home/global/common/gnome/programs/brightness.nix new file mode 100644 index 0000000..9743630 --- /dev/null +++ b/home/global/common/gnome/programs/brightness.nix @@ -0,0 +1,134 @@ +{ pkgs, lib, ... }: + +let + # Script to detect and save bus numbers + detectBusesScript = pkgs.writeScript "detect-buses" '' + #!${lib.getExe pkgs.fish} + + # Create cache directory if it doesn't exist + mkdir -p /tmp/ddcutil-cache + + # Detect buses and save to cache file + set buses (${pkgs.ddcutil}/bin/ddcutil detect 2>/dev/null | ${pkgs.gnugrep}/bin/grep "I2C bus:" | ${pkgs.gnused}/bin/sed 's/.*i2c-\([0-9]\+\).*/\1/' | ${pkgs.coreutils}/bin/sort -n | ${pkgs.coreutils}/bin/tr '\n' ' ' | ${pkgs.gnused}/bin/sed 's/ $//') + + if test -n "$buses" + echo "$buses" > /tmp/ddcutil-cache/buses + echo "Detected I2C buses: $buses" + else + echo "No I2C buses detected" + # Create empty file to indicate detection was attempted + touch /tmp/ddcutil-cache/buses + end + ''; + + # The brightness control script + brightnessScript = pkgs.writeScriptBin "brightness" '' + #!${lib.getExe pkgs.fish} + + # Usage: + # brightness --up 10 + # brightness + 10 + # brightness --down 15 + # brightness - 15 + + if test (count $argv) -ne 2 + echo "Usage: $argv[0] [--up|+|--down|-] " + exit 1 + end + + set option $argv[1] + set value $argv[2] + + if test "$option" = "--up" -o "$option" = "+" + set op "+" + else if test "$option" = "--down" -o "$option" = "-" + set op "-" + else + echo "Invalid option. Use --up | + or --down | -" + exit 1 + end + + # Read cached bus numbers + if test -f /tmp/ddcutil-cache/buses + set buses_string (cat /tmp/ddcutil-cache/buses) + # Split the space-separated string into individual bus numbers + set buses (string split " " "$buses_string") + else + echo "Bus cache not found. Make sure ddcutil-detect service is running." + echo "Try: systemctl --user start ddcutil-detect" + exit 1 + end + + if test -z "$buses_string" + echo "No I2C buses found in cache. Check ddcutil configuration." + exit 1 + end + + echo "Using cached buses: $buses" + + for bus in $buses + echo "Changing brightness on bus $bus" + ${pkgs.ddcutil}/bin/ddcutil setvcp 10 $op $value --bus $bus + end + ''; + +in +{ + home.packages = [ brightnessScript ]; + + dconf.settings = { + "org/gnome/settings-daemon/plugins/media-keys" = { + custom-keybindings = [ + "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/brightness-up/" + "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/brightness-down/" + ]; + }; + + "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/brightness-up" = { + binding = "MonBrightnessUp"; + command = "${lib.getExe brightnessScript} + 10"; + name = "Brightness up"; + }; + + "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/brightness-down" = { + binding = "MonBrightnessDown"; + command = "${lib.getExe brightnessScript} - 10"; + name = "Brightness down"; + }; + }; + + # Systemd user service to detect buses at startup + systemd.user.services.ddcutil-detect = { + Unit = { + Description = "Detect DDC/CI I2C buses for brightness control"; + After = [ "graphical-session.target" ]; + Wants = [ "graphical-session.target" ]; + }; + + Service = { + Type = "oneshot"; + ExecStart = "${detectBusesScript}"; + RemainAfterExit = true; + }; + + Install = { + WantedBy = [ "default.target" ]; + }; + }; + + # Timer to periodically refresh the bus cache (optional) + systemd.user.timers.ddcutil-detect = { + Unit = { + Description = "Refresh DDC/CI bus detection"; + }; + + Timer = { + OnBootSec = "2min"; + OnUnitActiveSec = "1h"; + }; + + Install = { + WantedBy = [ "timers.target" ]; + }; + }; +} diff --git a/home/hosts/rune/config/dconf.nix b/home/hosts/rune/config/dconf.nix index fecb44a..ec97317 100644 --- a/home/hosts/rune/config/dconf.nix +++ b/home/hosts/rune/config/dconf.nix @@ -5,7 +5,6 @@ with lib.hm.gvariant; { dconf.settings = { - "org/gnome/desktop/app-folders" = { folder-children = [ "System"