Skip to content

Commit

Permalink
options tab
Browse files Browse the repository at this point in the history
  • Loading branch information
FT-Labs committed Dec 13, 2023
1 parent 76e154f commit a4019c0
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 326 deletions.
286 changes: 0 additions & 286 deletions buttons.css

This file was deleted.

15 changes: 6 additions & 9 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package main
import (
"log"
"github.com/gotk3/gotk3/gtk"
p "physettings/picom"
p "physettings/settings"
)

const (
width = 800
height = 600
width = 564
height = 400
spacing = 25
logo_path = "/usr/share/pixmaps/phyOS-logo-128x128.png"
)
Expand Down Expand Up @@ -66,7 +66,7 @@ func main() {
}
win := windowNew("phy")
win.Add(nb)
nb.SetHExpand(true)
nb.SetHExpand(true)
nb.SetVExpand(true)

logo := imageNew(logo_path)
Expand All @@ -78,18 +78,15 @@ func main() {


// Add a child widget and tab label to the notebook so it renders.
nbChild, err := gtk.LabelNew("Notebook content")
if err != nil {
log.Fatal("Unable to create button:", err)
}
nbInfo := labelNew("INFO")
nbOptions := labelNew("OPTIONS")
nbAnimations := labelNew("ANIMATIONS")
nb.SetTabPos(gtk.POS_BOTTOM)
nb.AppendPage(box, nbInfo)
nb.AppendPage(nbChild, nbOptions)

animationsBox := p.SetupAnimationsTab()
optionsBox := p.SetupOptionsTab()
nb.AppendPage(optionsBox, nbOptions)
nb.AppendPage(animationsBox, nbAnimations)

win.ShowAll()
Expand Down
18 changes: 8 additions & 10 deletions picom/animations.go → settings/animations.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package picom
package settings

import (
"log"
Expand All @@ -21,15 +21,6 @@ type SpinButtonLabel struct {
SpinButton *gtk.SpinButton
}

// Setup the TextView, put it in a ScrolledWindow, and add both to box.
func setupTextView(box *gtk.Box) *gtk.TextView {
sw, _ := gtk.ScrolledWindowNew(nil, nil)
tv, _ := gtk.TextViewNew()
sw.Add(tv)
box.PackStart(sw, true, true, 0)
return tv
}

func comboBoxAddEntries(s []string, cbx *gtk.ComboBoxText) {
for _, val := range s {
cbx.AppendText(val)
Expand Down Expand Up @@ -94,6 +85,10 @@ func SetupAnimationsTab() *gtk.Box{
gtk.ORIENTATION_HORIZONTAL,
30, 250, 1)
spnAnimSpeedOnTagChange.SpinButton.SetValue(stof(picomOpts[_animation_stiffness_tag_change]))
spnShadowRadius := spinButtonNewWithLabel("Shadow Radius: ",
gtk.ORIENTATION_HORIZONTAL,
5, 100, 1)
spnShadowRadius.SpinButton.SetValue(stof(picomOpts[_shadow_radius]))

cmbOpenWindowAnim := comboBoxNewWithLabel("Open Window Anim: ", gtk.ORIENTATION_HORIZONTAL)
comboBoxAddEntries(animOpenOpts, cmbOpenWindowAnim.ComboBox)
Expand All @@ -114,6 +109,7 @@ func SetupAnimationsTab() *gtk.Box{

boxRight.Add(spnAnimSpeedInTag.Box)
boxRight.Add(spnAnimSpeedOnTagChange.Box)
boxRight.Add(spnShadowRadius.Box)
boxRight.Add(cmbOpenWindowAnim.Box)
boxRight.Add(cmbCloseWindowAnim.Box)
boxRight.Add(cmbPrevTag.Box)
Expand Down Expand Up @@ -167,9 +163,11 @@ func SetupAnimationsTab() *gtk.Box{

picomOpts[_animation_stiffness_in_tag] = strconv.FormatFloat(spnAnimSpeedInTag.SpinButton.GetValue(), 'f', 1, 64)
picomOpts[_animation_stiffness_tag_change] = strconv.FormatFloat(spnAnimSpeedOnTagChange.SpinButton.GetValue(), 'f', 1, 64)
picomOpts[_shadow_radius] = strconv.FormatFloat(spnShadowRadius.SpinButton.GetValue(), 'f', 1, 64)

changePicomAttribute(_animation_stiffness_in_tag, picomOpts[_animation_stiffness_in_tag], false)
changePicomAttribute(_animation_stiffness_tag_change, picomOpts[_animation_stiffness_tag_change], false)
changePicomAttribute(_shadow_radius, picomOpts[_shadow_radius], false)


err := savePicomOpts()
Expand Down
Loading

0 comments on commit a4019c0

Please sign in to comment.