focus 1st power button on Tab key
This commit is contained in:
40
main.go
40
main.go
@@ -34,6 +34,7 @@ var (
|
|||||||
exclusions []string
|
exclusions []string
|
||||||
hyprlandMonitors []monitor
|
hyprlandMonitors []monitor
|
||||||
beenScrolled bool
|
beenScrolled bool
|
||||||
|
firstPowerBtn *gtk.Button
|
||||||
)
|
)
|
||||||
|
|
||||||
var categoryNames = [...]string{
|
var categoryNames = [...]string{
|
||||||
@@ -462,6 +463,10 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
|
} else if key.KeyVal() == gdk.KEY_Tab {
|
||||||
|
if firstPowerBtn != nil {
|
||||||
|
firstPowerBtn.ToWidget().GrabFocus()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
@@ -588,25 +593,30 @@ func main() {
|
|||||||
powerButtonsWrapper, _ := gtk.BoxNew(gtk.ORIENTATION_HORIZONTAL, 0)
|
powerButtonsWrapper, _ := gtk.BoxNew(gtk.ORIENTATION_HORIZONTAL, 0)
|
||||||
powerBarWrapper.PackStart(powerButtonsWrapper, true, false, 12)
|
powerBarWrapper.PackStart(powerButtonsWrapper, true, false, 12)
|
||||||
|
|
||||||
if *pbLock != "" {
|
if *pbPoweroff != "" {
|
||||||
btn := powerButton(filepath.Join(dataDirectory, "img/lock.svg"), *pbLock)
|
btn := powerButton(filepath.Join(dataDirectory, "img/poweroff.svg"), *pbPoweroff)
|
||||||
powerButtonsWrapper.PackStart(btn, true, false, 0)
|
powerButtonsWrapper.PackEnd(btn, true, false, 0)
|
||||||
}
|
firstPowerBtn = btn
|
||||||
if *pbExit != "" {
|
|
||||||
btn := powerButton(filepath.Join(dataDirectory, "img/exit.svg"), *pbExit)
|
|
||||||
powerButtonsWrapper.PackStart(btn, true, false, 0)
|
|
||||||
}
|
|
||||||
if *pbReboot != "" {
|
|
||||||
btn := powerButton(filepath.Join(dataDirectory, "img/reboot.svg"), *pbReboot)
|
|
||||||
powerButtonsWrapper.PackStart(btn, true, false, 0)
|
|
||||||
}
|
}
|
||||||
if *pbSleep != "" {
|
if *pbSleep != "" {
|
||||||
btn := powerButton(filepath.Join(dataDirectory, "img/sleep.svg"), *pbSleep)
|
btn := powerButton(filepath.Join(dataDirectory, "img/sleep.svg"), *pbSleep)
|
||||||
powerButtonsWrapper.PackStart(btn, true, false, 0)
|
powerButtonsWrapper.PackEnd(btn, true, false, 0)
|
||||||
|
firstPowerBtn = btn
|
||||||
}
|
}
|
||||||
if *pbPoweroff != "" {
|
if *pbReboot != "" {
|
||||||
btn := powerButton(filepath.Join(dataDirectory, "img/poweroff.svg"), *pbPoweroff)
|
btn := powerButton(filepath.Join(dataDirectory, "img/reboot.svg"), *pbReboot)
|
||||||
powerButtonsWrapper.PackStart(btn, true, false, 0)
|
powerButtonsWrapper.PackEnd(btn, true, false, 0)
|
||||||
|
firstPowerBtn = btn
|
||||||
|
}
|
||||||
|
if *pbExit != "" {
|
||||||
|
btn := powerButton(filepath.Join(dataDirectory, "img/exit.svg"), *pbExit)
|
||||||
|
powerButtonsWrapper.PackEnd(btn, true, false, 0)
|
||||||
|
firstPowerBtn = btn
|
||||||
|
}
|
||||||
|
if *pbLock != "" {
|
||||||
|
btn := powerButton(filepath.Join(dataDirectory, "img/lock.svg"), *pbLock)
|
||||||
|
powerButtonsWrapper.PackEnd(btn, true, false, 0)
|
||||||
|
firstPowerBtn = btn
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user