Skip to content

Commit

Permalink
finalizing
Browse files Browse the repository at this point in the history
  • Loading branch information
FT-Labs committed Dec 23, 2023
1 parent a4019c0 commit 70af64d
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 5 deletions.
37 changes: 37 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
PROG = physettings

ifndef $(GOPATH)
GOPATH=$(shell go env GOPATH)
export GOPATH
endif

rwildcard=$(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d))

SRC = $(call rwildcard,.,*.go)

PREFIX ?= /usr

GOCMD = go

VERSION ?= 1.0.0

build: $(SRC)
GOOS=linux GOARCH=amd64 ${GOCMD} build -o ${PROG} main.go

deps: $(SRC)
${GOCMD} get github.com/gotk3/gotk3@latest

clean:
rm -f ${PROG}

all: deps build

install:
mkdir -p $(DESTDIR)$(PREFIX)/bin
cp -f ${PROG} $(DESTDIR)$(PREFIX)/bin
chmod 755 $(DESTDIR)$(PREFIX)/bin/${PROG}

uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/${PROG}

.PHONY: all build deps clean install uninstall
16 changes: 14 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@ package main
import (
"log"
"github.com/gotk3/gotk3/gtk"
p "physettings/settings"
p "github.com/physettings-gtk/settings"
)

const (
width = 564
height = 400
spacing = 25
logo_path = "/usr/share/pixmaps/phyOS-logo-128x128.png"

info_message = `OPTIONS Tab: Customize themes, wallpaper and more
ANIMATIONS Tab: Set up animations and picom related options
Check out 'man phyos' for available scripts
`
)

func imageNew(path string) *gtk.Image {
Expand Down Expand Up @@ -64,17 +69,24 @@ func main() {
if err != nil {
log.Fatal("Unable to create notebook:", err)
}
win := windowNew("phy")
win := windowNew("physettings")
win.Add(nb)
nb.SetHExpand(true)
nb.SetVExpand(true)

logo := imageNew(logo_path)
box, _ := gtk.BoxNew(gtk.ORIENTATION_VERTICAL, 15)
logo.SetHAlign(gtk.ALIGN_CENTER)

lblTitle, _ := gtk.LabelNew("")
lblTitle.SetMarginBottom(50)
lblTitle.SetMarkup("<span foreground=\"#89CFF0\" size=\"xx-large\">phyOS Settings App</span>")
lblInfo, _ := gtk.LabelNew(info_message)
box.SetMarginStart(spacing)
box.SetMarginTop(spacing)
box.Add(logo)
box.Add(lblTitle)
box.Add(lblInfo)


// Add a child widget and tab label to the notebook so it renders.
Expand Down
12 changes: 10 additions & 2 deletions settings/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"log"
"os/exec"
u "physettings/utils"
u "github.com/FT-Labs/physettings-gtk/utils"

"github.com/gotk3/gotk3/gtk"
)
Expand Down Expand Up @@ -52,10 +52,18 @@ func SetupOptionsTab() *gtk.Box {
comboBoxAddEntries(u.PowerMenuTypes, cbPowermenuType.ComboBox)
comboBoxAddEntries(u.PowerMenuStyles, cbPowermenuStyle.ComboBox)

cbRofiColor.ComboBox.Connect("popdown", func() {
cbRofiColor.ComboBox.Connect("changed", func() {
u.SetRofiColor(cbRofiColor.ComboBox.GetActiveText())
})

cbPowermenuType.ComboBox.Connect("changed", func() {
u.SetAttribute(u.POWERMENU_TYPE, cbPowermenuType.ComboBox.GetActiveText())
})

cbPowermenuStyle.ComboBox.Connect("changed", func() {
u.SetAttribute(u.POWERMENU_STYLE, cbPowermenuStyle.ComboBox.GetActiveText())
})

chkAsk, _ := gtk.CheckButtonNewWithLabel("Confirm on Shutdown")

if u.Attrs[u.POWERMENU_CONFIRM] == "true" {
Expand Down
2 changes: 1 addition & 1 deletion utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func SetAttribute(attribute, value string) error {

func SetRofiColor(c string) {
cmd := fmt.Sprintf("ln -sf /usr/share/phyos/config/rofi/colors/%s.rasi ~/.config/rofi/colors.rasi", c)
exec.Command("/bin/bash", "-c", cmd).Start()
exec.Command("/bin/bash", "-c", cmd).Run()
}

func RunScript(c string) error {
Expand Down

0 comments on commit 70af64d

Please sign in to comment.