Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
955429d809 | ||
|
|
4bf82d9a98 | ||
|
|
eb358b24cd | ||
|
|
27718a9f1b | ||
|
|
b4f0f70f56 | ||
|
|
f54be1c13a | ||
|
|
cd6e544adc | ||
|
|
f2bda0e496 | ||
|
|
fd8b9ba128 | ||
|
|
94aba90f3d | ||
|
|
fa9d9c3425 | ||
|
|
4711c36c56 |
1
Makefile
1
Makefile
@@ -16,6 +16,7 @@ install:
|
|||||||
cp bin/nwg-drawer /usr/bin
|
cp bin/nwg-drawer /usr/bin
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
|
rm -r /usr/share/nwg-drawer
|
||||||
rm /usr/bin/nwg-drawer
|
rm /usr/bin/nwg-drawer
|
||||||
|
|
||||||
run:
|
run:
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ and `nwggrid`.
|
|||||||
|
|
||||||
[more screenshots](https://scrot.cloud/album/nwg-drawer.Bogd) | [see on YouTube](https://youtu.be/iIgxJQhCQf0)
|
[more screenshots](https://scrot.cloud/album/nwg-drawer.Bogd) | [see on YouTube](https://youtu.be/iIgxJQhCQf0)
|
||||||
|
|
||||||
|
[](https://repology.org/project/nwg-drawer/versions)
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
### Dependencies
|
### Dependencies
|
||||||
@@ -62,7 +64,7 @@ Usage of nwg-drawer:
|
|||||||
-lang string
|
-lang string
|
||||||
force lang, e.g. "en", "pl"
|
force lang, e.g. "en", "pl"
|
||||||
-o string
|
-o string
|
||||||
name of the Output to display the menu on (sway only)
|
name of the Output to display the drawer on (sway only)
|
||||||
-ovl
|
-ovl
|
||||||
use OVerLay layer
|
use OVerLay layer
|
||||||
-s string
|
-s string
|
||||||
|
|||||||
BIN
bin/nwg-drawer
BIN
bin/nwg-drawer
Binary file not shown.
@@ -3,11 +3,12 @@ window {
|
|||||||
color: #eeeeee
|
color: #eeeeee
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* search entry */
|
||||||
entry {
|
entry {
|
||||||
background-color: rgba (0, 0, 0, 0.2)
|
background-color: rgba (0, 0, 0, 0.2)
|
||||||
}
|
}
|
||||||
|
|
||||||
button {
|
button, image {
|
||||||
background: none;
|
background: none;
|
||||||
border: none
|
border: none
|
||||||
}
|
}
|
||||||
@@ -16,6 +17,11 @@ button:hover {
|
|||||||
background-color: rgba (255, 255, 255, 0.1)
|
background-color: rgba (255, 255, 255, 0.1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* in case you wanted to give category buttons a different look */
|
||||||
|
#category-button {
|
||||||
|
margin: 0 10px 0 10px
|
||||||
|
}
|
||||||
|
|
||||||
#pinned-box {
|
#pinned-box {
|
||||||
padding-bottom: 5px;
|
padding-bottom: 5px;
|
||||||
border-bottom: 1px dotted gray
|
border-bottom: 1px dotted gray
|
||||||
|
|||||||
2
go.mod
2
go.mod
@@ -1,4 +1,4 @@
|
|||||||
module github.com/nwg-piotr/nwg-menu
|
module github.com/nwg-piotr/nwg-drawer
|
||||||
|
|
||||||
go 1.16
|
go 1.16
|
||||||
|
|
||||||
|
|||||||
18
main.go
18
main.go
@@ -19,7 +19,7 @@ import (
|
|||||||
"github.com/gotk3/gotk3/gtk"
|
"github.com/gotk3/gotk3/gtk"
|
||||||
)
|
)
|
||||||
|
|
||||||
const version = "0.1.0"
|
const version = "0.1.4"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
appDirs []string
|
appDirs []string
|
||||||
@@ -98,7 +98,7 @@ var (
|
|||||||
|
|
||||||
// Flags
|
// Flags
|
||||||
var cssFileName = flag.String("s", "drawer.css", "Styling: css file name")
|
var cssFileName = flag.String("s", "drawer.css", "Styling: css file name")
|
||||||
var targetOutput = flag.String("o", "", "name of the Output to display the menu on (sway only)")
|
var targetOutput = flag.String("o", "", "name of the Output to display the drawer on (sway only)")
|
||||||
var displayVersion = flag.Bool("v", false, "display Version information")
|
var displayVersion = flag.Bool("v", false, "display Version information")
|
||||||
var overlay = flag.Bool("ovl", false, "use OVerLay layer")
|
var overlay = flag.Bool("ovl", false, "use OVerLay layer")
|
||||||
var iconSize = flag.Int("is", 64, "Icon Size")
|
var iconSize = flag.Int("is", 64, "Icon Size")
|
||||||
@@ -172,6 +172,7 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
pinned = nil
|
pinned = nil
|
||||||
}
|
}
|
||||||
|
println(fmt.Sprintf("Found %v pinned items", len(pinned)))
|
||||||
|
|
||||||
cssFile := filepath.Join(configDirectory, *cssFileName)
|
cssFile := filepath.Join(configDirectory, *cssFileName)
|
||||||
|
|
||||||
@@ -204,6 +205,7 @@ func main() {
|
|||||||
log.Fatal("Unable to create window:", err)
|
log.Fatal("Unable to create window:", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if wayland() {
|
||||||
layershell.InitForWindow(win)
|
layershell.InitForWindow(win)
|
||||||
|
|
||||||
var output2mon map[string]*gdk.Monitor
|
var output2mon map[string]*gdk.Monitor
|
||||||
@@ -232,6 +234,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
layershell.SetKeyboardMode(win, layershell.LAYER_SHELL_KEYBOARD_MODE_EXCLUSIVE)
|
layershell.SetKeyboardMode(win, layershell.LAYER_SHELL_KEYBOARD_MODE_EXCLUSIVE)
|
||||||
|
}
|
||||||
|
|
||||||
win.Connect("destroy", func() {
|
win.Connect("destroy", func() {
|
||||||
gtk.MainQuit()
|
gtk.MainQuit()
|
||||||
@@ -274,6 +277,17 @@ func main() {
|
|||||||
cancelClose()
|
cancelClose()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/*
|
||||||
|
In case someone REALLY needed to use X11 - for some stupid Zoom meeting or something, this allows
|
||||||
|
the drawer to behave properly on Openbox, and possibly somewhere else. For sure not on i3.
|
||||||
|
This feature is not really supported and will stay undocumented.
|
||||||
|
*/
|
||||||
|
if !wayland() {
|
||||||
|
println("Not Wayland, oh really?")
|
||||||
|
win.SetDecorated(false)
|
||||||
|
win.Maximize()
|
||||||
|
}
|
||||||
|
|
||||||
// Set up UI
|
// Set up UI
|
||||||
outerVBox, _ := gtk.BoxNew(gtk.ORIENTATION_VERTICAL, 0)
|
outerVBox, _ := gtk.BoxNew(gtk.ORIENTATION_VERTICAL, 0)
|
||||||
win.Add(outerVBox)
|
win.Add(outerVBox)
|
||||||
|
|||||||
6
tools.go
6
tools.go
@@ -20,6 +20,10 @@ import (
|
|||||||
"github.com/joshuarubin/go-sway"
|
"github.com/joshuarubin/go-sway"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func wayland() bool {
|
||||||
|
return os.Getenv("WAYLAND_DISPLAY") != "" || os.Getenv("XDG_SESSION_TYPE") == "wayland"
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Window leave-notify-event event quits the program with glib Timeout 500 ms.
|
Window leave-notify-event event quits the program with glib Timeout 500 ms.
|
||||||
We might have left the window by accident, so let's clear the timeout if window re-entered.
|
We might have left the window by accident, so let's clear the timeout if window re-entered.
|
||||||
@@ -264,7 +268,7 @@ func listDesktopFiles() []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func setUpCategories() {
|
func setUpCategories() {
|
||||||
path := filepath.Join(getDataHome(), "nwg-menu/desktop-directories")
|
path := filepath.Join(getDataHome(), "nwg-drawer/desktop-directories")
|
||||||
var other category
|
var other category
|
||||||
|
|
||||||
for _, cName := range categoryNames {
|
for _, cName := range categoryNames {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ func setUpPinnedFlowBox() *gtk.FlowBox {
|
|||||||
flowBox, _ := gtk.FlowBoxNew()
|
flowBox, _ := gtk.FlowBoxNew()
|
||||||
if uint(len(pinned)) >= *columnsNumber {
|
if uint(len(pinned)) >= *columnsNumber {
|
||||||
flowBox.SetMaxChildrenPerLine(*columnsNumber)
|
flowBox.SetMaxChildrenPerLine(*columnsNumber)
|
||||||
} else {
|
} else if len(pinned) > 0 {
|
||||||
flowBox.SetMaxChildrenPerLine(uint(len(pinned)))
|
flowBox.SetMaxChildrenPerLine(uint(len(pinned)))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,16 +78,17 @@ func setUpPinnedFlowBox() *gtk.FlowBox {
|
|||||||
})
|
})
|
||||||
flowBox.Add(btn)
|
flowBox.Add(btn)
|
||||||
}
|
}
|
||||||
|
pinnedFlowBoxWrapper.PackStart(flowBox, true, false, 0)
|
||||||
|
|
||||||
|
//While moving focus with arrow keys we want buttons to get focus directly
|
||||||
|
flowBox.GetChildren().Foreach(func(item interface{}) {
|
||||||
|
item.(*gtk.Widget).SetCanFocus(false)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
flowBox.Connect("enter-notify-event", func() {
|
flowBox.Connect("enter-notify-event", func() {
|
||||||
cancelClose()
|
cancelClose()
|
||||||
})
|
})
|
||||||
|
|
||||||
pinnedFlowBoxWrapper.PackStart(flowBox, true, false, 0)
|
|
||||||
//While moving focus with arrow keys we want buttons to get focus directly
|
|
||||||
flowBox.GetChildren().Foreach(func(item interface{}) {
|
|
||||||
item.(*gtk.Widget).SetCanFocus(false)
|
|
||||||
})
|
|
||||||
flowBox.ShowAll()
|
flowBox.ShowAll()
|
||||||
|
|
||||||
return flowBox
|
return flowBox
|
||||||
@@ -113,6 +114,7 @@ func setUpCategoriesButtonBox() *gtk.EventBox {
|
|||||||
hBox, _ := gtk.BoxNew(gtk.ORIENTATION_HORIZONTAL, 0)
|
hBox, _ := gtk.BoxNew(gtk.ORIENTATION_HORIZONTAL, 0)
|
||||||
eventBox.Add(hBox)
|
eventBox.Add(hBox)
|
||||||
button, _ := gtk.ButtonNewWithLabel("All")
|
button, _ := gtk.ButtonNewWithLabel("All")
|
||||||
|
button.SetProperty("name", "category-button")
|
||||||
button.Connect("clicked", func(item *gtk.Button) {
|
button.Connect("clicked", func(item *gtk.Button) {
|
||||||
searchEntry.SetText("")
|
searchEntry.SetText("")
|
||||||
appFlowBox = setUpAppsFlowBox(nil, "")
|
appFlowBox = setUpAppsFlowBox(nil, "")
|
||||||
@@ -126,6 +128,7 @@ func setUpCategoriesButtonBox() *gtk.EventBox {
|
|||||||
for _, cat := range categories {
|
for _, cat := range categories {
|
||||||
if isSupposedToShowUp(cat.Name) {
|
if isSupposedToShowUp(cat.Name) {
|
||||||
button, _ = gtk.ButtonNewFromIconName(cat.Icon, gtk.ICON_SIZE_MENU)
|
button, _ = gtk.ButtonNewFromIconName(cat.Icon, gtk.ICON_SIZE_MENU)
|
||||||
|
button.SetProperty("name", "category-button")
|
||||||
catButtons = append(catButtons, button)
|
catButtons = append(catButtons, button)
|
||||||
button.SetLabel(cat.DisplayName)
|
button.SetLabel(cat.DisplayName)
|
||||||
hBox.PackStart(button, false, false, 0)
|
hBox.PackStart(button, false, false, 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user