mirror of
https://github.com/Dichgrem/DCGOS.git
synced 2025-12-17 03:31:59 -05:00
feat:add_monitors_switch
This commit is contained in:
2
dotfiles/.config/hypr/hyprland/bind.conf
vendored
2
dotfiles/.config/hypr/hyprland/bind.conf
vendored
@@ -8,6 +8,8 @@ binds {
|
|||||||
## App Launcher
|
## App Launcher
|
||||||
bindr = SUPER, SPACE, exec, fuzzel
|
bindr = SUPER, SPACE, exec, fuzzel
|
||||||
|
|
||||||
|
## Display Toggle
|
||||||
|
bind = SUPER, F4, exec, sh ~/.config/hypr/scripts/kde_like_monitors.sh
|
||||||
|
|
||||||
## Restart some programs
|
## Restart some programs
|
||||||
### Input Tool
|
### Input Tool
|
||||||
|
|||||||
52
dotfiles/.config/hypr/scripts/kde_like_monitors.sh
vendored
Normal file
52
dotfiles/.config/hypr/scripts/kde_like_monitors.sh
vendored
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
STATE_FILE="/tmp/hypr_monitor_mode"
|
||||||
|
INTERNAL="eDP-1"
|
||||||
|
EXTERNAL="DP-1"
|
||||||
|
|
||||||
|
# 预设模式参数
|
||||||
|
INT_RES="2560x1600@165,0x0,1.25"
|
||||||
|
EXT_RES="2560x1440@144,2560x0,1.25"
|
||||||
|
MIRROR_RES="2560x1440@144,0x0,1.25"
|
||||||
|
|
||||||
|
# 模式顺序:内屏 → 外屏 → 扩展
|
||||||
|
MODES=("internal_only" "external_only" "extended")
|
||||||
|
|
||||||
|
# 读取上次模式
|
||||||
|
if [[ -f "$STATE_FILE" ]]; then
|
||||||
|
LAST_MODE=$(cat "$STATE_FILE")
|
||||||
|
else
|
||||||
|
LAST_MODE="extended"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 找出下一个模式
|
||||||
|
NEXT_INDEX=0
|
||||||
|
for i in "${!MODES[@]}"; do
|
||||||
|
if [[ "${MODES[$i]}" == "$LAST_MODE" ]]; then
|
||||||
|
NEXT_INDEX=$(((i + 1) % ${#MODES[@]}))
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
NEXT_MODE="${MODES[$NEXT_INDEX]}"
|
||||||
|
|
||||||
|
# 应用新模式
|
||||||
|
case "$NEXT_MODE" in
|
||||||
|
internal_only)
|
||||||
|
hyprctl keyword monitor "$EXTERNAL,disable"
|
||||||
|
hyprctl keyword monitor "$INTERNAL,$INT_RES"
|
||||||
|
notify-send "显示模式" "仅内屏"
|
||||||
|
;;
|
||||||
|
external_only)
|
||||||
|
hyprctl keyword monitor "$INTERNAL,disable"
|
||||||
|
hyprctl keyword monitor "$EXTERNAL,$EXT_RES"
|
||||||
|
notify-send "显示模式" "仅外屏"
|
||||||
|
;;
|
||||||
|
extended)
|
||||||
|
hyprctl keyword monitor "$INTERNAL,$INT_RES"
|
||||||
|
hyprctl keyword monitor "$EXTERNAL,$EXT_RES"
|
||||||
|
notify-send "显示模式" "扩展模式"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# 保存新模式
|
||||||
|
echo "$NEXT_MODE" >"$STATE_FILE"
|
||||||
2
dotfiles/.config/waybar/config.jsonc
vendored
2
dotfiles/.config/waybar/config.jsonc
vendored
@@ -22,7 +22,7 @@
|
|||||||
"custom/screenshot",
|
"custom/screenshot",
|
||||||
"tray",
|
"tray",
|
||||||
"custom/wl-gammarelay-brightness",
|
"custom/wl-gammarelay-brightness",
|
||||||
/ "custom/wl-gammarelay-temperature",
|
// "custom/wl-gammarelay-temperature",
|
||||||
"clock",
|
"clock",
|
||||||
"custom/swaync",
|
"custom/swaync",
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
Locale = "en_US.UTF-8";
|
Locale = "en_US.UTF-8";
|
||||||
### See https://docs.moodle.org/405/en/Table_of_locales
|
### See https://docs.moodle.org/405/en/Table_of_locales
|
||||||
|
|
||||||
StateVersion = "25.05";
|
StateVersion = "25.11";
|
||||||
### See https://mynixos.com/nixpkgs/option/system.stateVersion
|
### See https://mynixos.com/nixpkgs/option/system.stateVersion
|
||||||
|
|
||||||
TimeZone = "Asia/Singapore";
|
TimeZone = "Asia/Singapore";
|
||||||
|
|||||||
Reference in New Issue
Block a user