support output assignment on Hyprland

This commit is contained in:
piotr
2023-11-26 23:14:18 +01:00
parent b05b0f484a
commit a2917d68dd
2 changed files with 122 additions and 32 deletions

40
main.go
View File

@@ -24,13 +24,14 @@ import (
const version = "0.4.2"
var (
appDirs []string
configDirectory string
pinnedFile string
pinned []string
id2entry map[string]desktopEntry
preferredApps map[string]interface{}
exclusions []string
appDirs []string
configDirectory string
pinnedFile string
pinned []string
id2entry map[string]desktopEntry
preferredApps map[string]interface{}
exclusions []string
hyprlandMonitors []monitor
)
var categoryNames = [...]string{
@@ -66,6 +67,30 @@ type desktopEntry struct {
NoDisplay bool
}
type monitor struct {
Id int `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Make string `json:"make"`
Model string `json:"model"`
Serial string `json:"serial"`
Width int `json:"width"`
Height int `json:"height"`
RefreshRate float64 `json:"refreshRate"`
X int `json:"x"`
Y int `json:"y"`
ActiveWorkspace struct {
Id int `json:"id"`
Name string `json:"name"`
} `json:"activeWorkspace"`
Reserved []int `json:"reserved"`
Scale float64 `json:"scale"`
Transform int `json:"transform"`
Focused bool `json:"focused"`
DpmsStatus bool `json:"dpmsStatus"`
Vrr bool `json:"vrr"`
}
// slices below will hold DesktopID strings
var (
listUtility []string
@@ -372,6 +397,7 @@ func main() {
if *targetOutput != "" {
// We want to assign layershell to a monitor, but we only know the output name!
output2mon, err = mapOutputs()
fmt.Println(">>>", output2mon)
if err == nil {
monitor := output2mon[*targetOutput]
layershell.SetMonitor(win, monitor)