diff options
| author | Ophestra Umiker <cat@ophivana.moe> | 2024-09-17 13:48:42 +0900 |
|---|---|---|
| committer | Ophestra Umiker <cat@ophivana.moe> | 2024-09-17 13:48:42 +0900 |
| commit | 4b7d616862dc7d8c73561b85deb0ca1fabf30781 (patch) | |
| tree | d069af086d1fcfeca2f9a629e0f3eb3e2f19500f /internal/app/x.go | |
| parent | 6a6f62efa672bdb439c2f9056055193a53c1df01 (diff) | |
exit: move final and early code to internal package
Exit cleanup state information is now stored in a dedicated struct and built up using methods of that struct.
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
Diffstat (limited to 'internal/app/x.go')
| -rw-r--r-- | internal/app/x.go | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/internal/app/x.go b/internal/app/x.go index f198fee3..16b3d95c 100644 --- a/internal/app/x.go +++ b/internal/app/x.go @@ -4,8 +4,7 @@ import ( "fmt" "os" - "git.ophivana.moe/cat/fortify/internal/final" - "git.ophivana.moe/cat/fortify/internal/state" + "git.ophivana.moe/cat/fortify/internal" "git.ophivana.moe/cat/fortify/internal/verbose" "git.ophivana.moe/cat/fortify/xcb" ) @@ -13,20 +12,20 @@ import ( const display = "DISPLAY" func (a *App) ShareX() { - a.setEnablement(state.EnableX) + a.setEnablement(internal.EnableX) // discovery X11 and grant user permission via the `ChangeHosts` command if d, ok := os.LookupEnv(display); !ok { - final.Fatal("X11: DISPLAY not set") + internal.Fatal("X11: DISPLAY not set") } else { // add environment variable for new process a.AppendEnv(display, d) verbose.Printf("X11: Adding XHost entry SI:localuser:%s to display '%s'\n", a.Username, d) if err := xcb.ChangeHosts(xcb.HostModeInsert, xcb.FamilyServerInterpreted, "localuser\x00"+a.Username); err != nil { - final.Fatal(fmt.Sprintf("Error adding XHost entry to '%s':", d), err) + internal.Fatal(fmt.Sprintf("Error adding XHost entry to '%s':", d), err) } else { - final.XcbActionComplete() + a.exit.XcbActionComplete() } } } |
