scorpion-26 / gBar

Blazingly fast status bar written with GTK
MIT License
478 stars 17 forks source link

Crash when monitors are turned off #30

Closed SkyLeite closed 5 months ago

SkyLeite commented 1 year ago

Describe the bug Turning off a monitor (either manually with the power button or using dpms) causes gBar to crash

Steps to Reproduce

  1. Open the bar (or multiple bars)
  2. Turn off the monitor (hyprland dispatch dpms off for example)
  3. Turn the monitor back on
  4. Observe that the process has crashed

Expected behavior The bars should be displayed

Screenshots/Error logs

sky@home /$ gBar bar 1
Set value for AudioInput: false
Set value for AudioMaxVolume: 100
Set value for AudioMinVolume: 0
Set value for AudioRevealer: false
Set value for AudioScrollSpeed: 5
Set value for BatteryFolder: /sys/class/power_supply/BAT1
Set value for CPUThermalZone: /sys/devices/pci0000:00/0000:00:18.3/hwmon/hwmon2/temp1_input
Set value for CenterTime: true
Set value for DateTimeStyle: %a %D - %H:%M:%S %Z
Set value for DefaultWorkspaceSymbol: 
Set value for EnableSNI: true
Set value for ExitCommand: killall Hyprland
Set value for Location: T
Set value for LockCommand: ~/.config/scripts/sys.sh lock
Set value for MaxDownloadBytes: 10485760
Set value for MaxUploadBytes: 5242880
Set value for MinDownloadBytes: 0
Set value for MinUploadBytes: 0
Set value for NetworkAdapter: eno1
Set value for NetworkWidget: true
Set value for SuspendCommand: systemctl suspend
Set value for TimeSpace: 300
Set value for UseHyprlandIPC: false
Set value for WorkspaceScrollInvert: false
Set value for WorkspaceScrollOnMonitor: true
Set value for CPUThermalZone: /sys/devices/pci0000:00/0000:00:18.3/hwmon/hwmon2/temp1_input
Set value for SuspendCommand: ~/.config/scripts/sys.sh suspend
Set value for LockCommand: ~/.config/scripts/sys.sh lock
Set value for ExitCommand: killall Hyprland
Set value for BatteryFolder: /sys/class/power_supply/BAT1
Set value for DefaultWorkspaceSymbol: 
Set value for WorkspaceScrollOnMonitor: true
Set value for WorkspaceScrollInvert: false
Set value for UseHyprlandIPC: true
Set value for CenterTime: true
Set value for TimeSpace: 300
Set value for AudioInput: false
Set value for AudioRevealer: false
Set value for AudioScrollSpeed: 5
Set value for CheckPackagesCommand: p="$(checkupdates)"; e=$?; if [ $e -eq 127 ] ; then exit 127; fi; if [ $e -eq 2 ] ; then echo "0" && exit 0; fi; echo "$p" | wc -l
Set value for CheckUpdateInterval: 300
Set value for NetworkAdapter: eno1
Set value for NetworkWidget: true
Set value for EnableSNI: false
Set value for SNIIconSize: *, 25
Set value for SNIIconSize: OBS, 23
Set value for MinDownloadBytes: 0
Set value for MaxDownloadBytes: 10485760
Set value for MinUploadBytes: 0
Set value for MaxUploadBytes: 5242880
Wayland: Added workspace!
Workspace ID: 2
Wayland: Activate Workspace 2
Wayland: Added workspace!
Workspace ID: 6
Wayland: Deactivate Workspace 6
Wayland: Added workspace!
Workspace ID: 1
Wayland: Deactivate Workspace 1
Wayland: Added workspace!
Workspace ID: 7
Wayland: Deactivate Workspace 7
Wayland: Registering monitor DP-3 at ID 0
Wayland: Added group to monitor
Wayland: Registering monitor DP-1 at ID 1
Wayland: Added group to monitor
Wayland: Registering monitor DP-2 at ID 2
Wayland: Added group to monitor
Forcefully activate workspace 2
Forcefully activate workspace 1
NVML not found, disabling Nvidia GPU
PulseAudio: Context is ready!
PulseAudio: Update info
CSS found and loaded successfully!

(gBar:207739): Gtk-CRITICAL **: 17:54:57.459: gtk_widget_set_visible: assertion 'GTK_IS_WIDGET (widget)' failed

(gBar:207739): Gtk-CRITICAL **: 17:54:57.459: gtk_range_set_value: assertion 'GTK_IS_RANGE (range)' failed
sh: line 1: checkupdates: command not found
GetOutdatedPackages: Invalid command. Disabling package widget!
[1]    207739 segmentation fault (core dumped)  gBar bar 1

Information about your system and gBar

scorpion-26 commented 1 year ago

This is a known bug, see https://github.com/scorpion-26/gBar/issues/19 for more detail. I haven't implemented anything yet, because I couldn't think of clean ways to implement a fix. Though outright crashing crashing isn't ideal either, so I'll have a second look at it.

scorpion-26 commented 5 months ago

Fixed, see #31