Skip to content

Commit

Permalink
Changing font to Monospace
Browse files Browse the repository at this point in the history
  • Loading branch information
SaiNageswarS committed Apr 19, 2021
1 parent 78d0668 commit 67f4593
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 17 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.google.protobuf.gradle.*

plugins {
kotlin("jvm") version "1.4.32"
id("org.jetbrains.compose") version "0.4.0-build180"
id("org.jetbrains.compose") version "0.4.0-build183"
id("com.google.protobuf") version "0.8.15"
}

Expand Down
10 changes: 7 additions & 3 deletions src/main/kotlin/com/kotlang/ui/UiUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
Expand All @@ -37,6 +38,7 @@ fun Chip(text: String, dropDownItems: List<String> = listOf(), onSelect: (idx: I
Row {
Text(text,
color = Color.Black,
fontFamily = FontFamily.Monospace
)

Icon(Icons.Default.ArrowDropDown, contentDescription = "", tint = Color.Black)
Expand All @@ -49,7 +51,7 @@ fun Chip(text: String, dropDownItems: List<String> = listOf(), onSelect: (idx: I
onSelect(idx)
showDropDown.value = false
}) {
Text(item, color = Color.Black)
Text(item, color = Color.Black, fontFamily = FontFamily.Monospace)
}
}
}
Expand All @@ -61,7 +63,9 @@ fun PromptIcon(osShell: String) {
Text(
"$osShell > ",
color = MaterialTheme.colors.primary,
style = TextStyle(fontSize = 15.sp, fontWeight = FontWeight.Bold)
fontWeight = FontWeight.Bold,
fontFamily = FontFamily.Monospace,
fontSize = 15.sp
)
}

Expand All @@ -84,7 +88,7 @@ fun SearchSuggestions(items: List<String>,
DropdownMenuItem(onClick = { onClick(item) },
modifier = Modifier.background(bckgndColor)
) {
Text(item, color = textColor)
Text(item, color = textColor, fontFamily = FontFamily.Monospace)
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/main/kotlin/com/kotlang/ui/dialogs/EnvironmentDialog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import com.kotlang.omnishell.EnvironmentRequest
Expand All @@ -26,12 +27,11 @@ fun EnvironmentDialog(shell: Shell) = Window(title = "Environment") {
Text(
entry.split("=")[0],
modifier = Modifier.padding(horizontal = 5.dp),
style = TextStyle(
color = MaterialTheme.colors.primaryVariant,
fontWeight = FontWeight.SemiBold,
)
color = MaterialTheme.colors.primaryVariant,
fontWeight = FontWeight.SemiBold,
fontFamily = FontFamily.Monospace
)
Text(entry.split("=")[1])
Text(entry.split("=")[1], fontFamily = FontFamily.Monospace)
}
Divider()
}
Expand Down
9 changes: 6 additions & 3 deletions src/main/kotlin/com/kotlang/ui/shell/CommandExecutionCard.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.input.key.*
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.PasswordVisualTransformation
import androidx.compose.ui.text.input.VisualTransformation
Expand Down Expand Up @@ -118,8 +119,8 @@ class CommandExecutionCard(
) {
for (child in document) {
when(child.format) {
CommandOutput.TextFormat.ERROR -> Text(child.text.sanitize(), color = Color.Red)
else -> Text(child.text.sanitize(), color = Color.DarkGray)
CommandOutput.TextFormat.ERROR -> Text(child.text.sanitize(), color = Color.Red, fontFamily = FontFamily.Monospace)
else -> Text(child.text.sanitize(), color = Color.DarkGray, fontFamily = FontFamily.Monospace)
}
}

Expand Down Expand Up @@ -181,7 +182,9 @@ class CommandExecutionCard(
Row(modifier = Modifier.fillMaxWidth(0.93f)) {
PromptIcon(osShell)
Text(cmd.command, color = Color.DarkGray,
style = TextStyle(fontSize = 15.sp, fontWeight = FontWeight.Bold)
fontWeight = FontWeight.Bold,
fontFamily = FontFamily.Monospace,
fontSize = 15.sp
)
}
CommandStateIcon(state.value)
Expand Down
6 changes: 4 additions & 2 deletions src/main/kotlin/com/kotlang/ui/shell/FileTree.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
Expand Down Expand Up @@ -69,7 +70,7 @@ class FileTree(private val shell: Shell) {
}
},
modifier = Modifier.padding(horizontal = 5.dp, vertical = 0.dp),
style = TextStyle(color = Color.White)
style = TextStyle(color = Color.White, fontFamily = FontFamily.Monospace)
)
}
}
Expand All @@ -85,7 +86,8 @@ class FileTree(private val shell: Shell) {
text = "FOLDERS",
style = TextStyle(
fontSize = 20.sp,
fontWeight = FontWeight.SemiBold
fontWeight = FontWeight.SemiBold,
fontFamily = FontFamily.Monospace
),
color = Color.White
)
Expand Down
5 changes: 3 additions & 2 deletions src/main/kotlin/com/kotlang/ui/shell/Prompt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.input.key.*
import androidx.compose.ui.text.TextRange
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.TextFieldValue
import androidx.compose.ui.unit.dp
Expand Down Expand Up @@ -105,7 +106,7 @@ class Prompt(private val shell: Shell) {
) {
TextField(
value = command.value,
textStyle = TextStyle(color = Color.DarkGray),
textStyle = TextStyle(color = Color.DarkGray, fontFamily = FontFamily.Monospace),
onValueChange = { newVal: TextFieldValue ->
command.value = newVal
scope.launch {
Expand All @@ -128,7 +129,7 @@ class Prompt(private val shell: Shell) {
commandSuggestions.value = suggestions.distinct()
}
},
placeholder = { Text("Run Command here. Press Tab for Auto-Complete") },
placeholder = { Text("Run Command here. Press Tab for Auto-Complete", fontFamily = FontFamily.Monospace) },
leadingIcon = { PromptOsShellChoice() },
modifier = Modifier
.fillMaxWidth()
Expand Down
2 changes: 2 additions & 0 deletions src/main/kotlin/com/kotlang/ui/shell/Shell.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.unit.dp
import com.kotlang.HostAgent
import com.kotlang.isOldVersion
Expand Down Expand Up @@ -68,6 +69,7 @@ class Shell(var commandExecutionCards: LinkedList<CommandExecutionCard> = Linked
Text(
"Update available. Visit https://github.com/SaiNageswarS/Omnishell/releases",
color = warningColor,
fontFamily = FontFamily.Monospace
)
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/main/kotlin/com/kotlang/ui/shell/ShellHeader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import androidx.compose.material.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import com.kotlang.remoting.LocalTargetManager
Expand Down Expand Up @@ -36,6 +37,7 @@ class ShellHeader(private val shell: Shell) {
Text(
getHost(),
color = Color.DarkGray,
fontFamily = FontFamily.Monospace,
fontWeight = FontWeight.Bold,
modifier = Modifier.padding(10.dp)
)
Expand All @@ -49,6 +51,7 @@ class ShellHeader(private val shell: Shell) {
Text(
currentWorkingDir,
color = Color.DarkGray,
fontFamily = FontFamily.Monospace,
modifier = Modifier.padding(10.dp)
)
}
Expand All @@ -62,6 +65,7 @@ class ShellHeader(private val shell: Shell) {
"Env",
color = Color.DarkGray,
fontWeight = FontWeight.Bold,
fontFamily = FontFamily.Monospace,
modifier = Modifier.padding(10.dp)
)
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/kotlin/com/kotlang/ui/tabs/TabHeader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.Close
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.unit.dp
import com.kotlang.ui.window.OmnishellWindow

Expand All @@ -19,7 +20,7 @@ class TabHeader(private val windowActions: OmnishellWindow) {
onClick = { windowActions.changeTab(index) }
) {
Row {
Text(title, modifier = Modifier.padding(vertical = 10.dp))
Text(title, modifier = Modifier.padding(vertical = 10.dp), fontFamily = FontFamily.Monospace)
//close tab button
IconButton(onClick = { windowActions.closeTab(index) }) {
Icon(
Expand Down

0 comments on commit 67f4593

Please sign in to comment.