Skip to content
This repository was archived by the owner on Jun 19, 2023. It is now read-only.

Commit 065b00f

Browse files
committed
Prepare first release
1 parent f5adbc4 commit 065b00f

File tree

5 files changed

+28
-17
lines changed

5 files changed

+28
-17
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## Unreleased
2+
3+
4+
## v0.1.0 (2022-05-01)
5+
6+
* Initial release

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 [Christoph Krybus](mailto:ckrybus@googlemail.com)
3+
Copyright (c) 2020-2022 [Christoph Krybus](mailto:chris@ckrybus.com)
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Makefile

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
lint:
2+
nimpretty src/*.nim
3+
4+
build:
5+
nim c --styleCheck:hint src/*.nim
6+
7+
release:
8+
nim -d:release --opt:size --passL:-s c src/yakuakep.nim

README.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ sudo apt-get install qdbus-qt5
1818

1919
## Features
2020

21-
- display yakuake tabs
22-
- save yakuake tabs to a json file
23-
- restore yakuake tabs from a json file
21+
- [x] display yakuake tabs
22+
- [x] save yakuake tabs to a json file
23+
- [ ] (TODO) restore yakuake tabs from a json file
2424

2525
## Usage
2626

@@ -29,7 +29,6 @@ For now only a very basic interface exists
2929
```bash
3030
$ yakuakep ps # show all tabs
3131
$ yakuake save # save tabs
32-
$ yakuake load # load previously saved tabs
3332
```
3433

3534
## Limitations
@@ -45,4 +44,3 @@ Welcome❤
4544
## License
4645

4746
MIT License. Please see [License File](LICENSE) for more information.
48-

src/yakuakep.nim

+10-11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import osproc, strutils, strformat, algorithm, cligen, terminaltables, os, sequtils, json
1+
import osproc, strutils, strformat, algorithm, cligen, terminaltables, os,
2+
sequtils, json
23

34

45
proc run(cmd: string): string =
@@ -32,27 +33,25 @@ proc getCmd(pid: int, fgpid: int): string =
3233
return ""
3334

3435

35-
iterator getSessionData(): Tab =
36+
iterator getTabs(): Tab =
3637
for i, _ in dbusMany(fmt"/yakuake/sessions sessionIdList"):
3738
# in yakuake you can have multiple terminals per tab
3839
# yakuakep currently supports only one terminal per tab
3940
var sessionId = dbus(fmt"/yakuake/tabs sessionAtTab {i}")
40-
var terminalIdsRaw = dbusMany(fmt"/yakuake/sessions terminalIdsForSessionId {session_id}")
4141

42+
var terminalIdsRaw = dbusMany(fmt"/yakuake/sessions terminalIdsForSessionId {session_id}")
4243
# TODO how to sort by int in nim?
4344
var terminalIds = newSeq[int](0)
4445
for x in terminalIdsRaw:
4546
terminalIds.add(x.parseInt)
4647
terminalIds.sort()
4748
var terminalId = terminalIds[0]
48-
4949
var title = dbus(fmt"/yakuake/tabs tabTitle {sessionId}")
5050
var sid = terminalId + 1
5151
var pid = dbus(fmt"/Sessions/{sid} processId").parseInt
5252
var fgpid = dbus(fmt"/Sessions/{sid} foregroundProcessId").parseInt
5353
var command = getCmd(pid, fgpid)
5454
var workingDirectory = getPwd(pid)
55-
5655
yield Tab(command: command, workingDirectory: workingDirectory, title: title)
5756

5857

@@ -69,7 +68,7 @@ proc ps() =
6968
## Show yakuake session
7069
var table = newTerminalTable()
7170
table.setHeaders(@["TITLE", "WORKING DIRECTORY", "COMMAND"])
72-
for tab in getSessionData():
71+
for tab in getTabs():
7372
table.addRow(@[tab.title, tab.workingDirectory, tab.command])
7473
printTable(table)
7574
discard
@@ -79,18 +78,18 @@ proc save() =
7978
## Save yakuake session to a file
8079
let configDirPath = joinPath(getConfigDir(), "yakuakep")
8180
discard existsOrCreateDir(configDirPath)
82-
let tabs = toSeq(getSessionData())
81+
let tabs = toSeq(getTabs())
8382
let filepath = joinPath(configDirPath, "default.json")
8483
writeFile(filepath, $(pretty(%*tabs)))
8584
echo(fmt"Yakuake tabs saved successfully to {filepath}")
8685
discard
8786

8887

89-
proc load() =
90-
## Load yakuake session from a file
91-
echo "TODO load"
88+
proc restore() =
89+
## Restore yakuake session from a file
90+
echo "TODO restore"
9291
discard
9392

9493

9594
when isMainModule:
96-
dispatchMulti([ps], [save], [load])
95+
dispatchMulti([ps], [save], [restore])

0 commit comments

Comments
 (0)